summaryrefslogtreecommitdiff
path: root/lib/scripts
diff options
context:
space:
mode:
authorMichal Rezler <rezlemic@fel.cvut.cz>2011-03-23 10:39:45 +0100
committerMichal Rezler <rezlemic@fel.cvut.cz>2011-03-23 10:39:45 +0100
commit35838d22a57707952f630eaf9f9e9ab4c6c3cfb0 (patch)
tree3603e2e56314af40a4b7922e14e52c0bc06f6f9d /lib/scripts
parentc4bb7947fcb2d4a5e5f8a15d9e3bbec333e44e13 (diff)
parentee1214abb2c14cf0f86ff6d9a5b49536c6b01e18 (diff)
downloadrpg-35838d22a57707952f630eaf9f9e9ab4c6c3cfb0.tar.gz
rpg-35838d22a57707952f630eaf9f9e9ab4c6c3cfb0.tar.bz2
jQuery rewrite branch merged into master branch of whole project
Diffstat (limited to 'lib/scripts')
-rw-r--r--lib/scripts/ajax.js126
-rw-r--r--lib/scripts/edit.js111
-rw-r--r--lib/scripts/hotkeys.js2
-rw-r--r--lib/scripts/linkwiz.js4
-rw-r--r--lib/scripts/locktimer.js99
-rw-r--r--lib/scripts/media.js93
-rw-r--r--lib/scripts/script.js70
-rw-r--r--lib/scripts/toolbar.js2
8 files changed, 321 insertions, 186 deletions
diff --git a/lib/scripts/ajax.js b/lib/scripts/ajax.js
index de009d448..44dcee999 100644
--- a/lib/scripts/ajax.js
+++ b/lib/scripts/ajax.js
@@ -5,44 +5,114 @@
* @author Andreas Gohr <andi@splitbrain.org>
* @author Adrian Lang <lang@cosmocode.de>
*/
-addInitEvent(function () {
+var ajax_quicksearch = {
- var inID = 'qsearch__in';
- var outID = 'qsearch__out';
+ inObj: null,
+ outObj: null,
+ sackObj: null,
+ delay: null,
- var inObj = document.getElementById(inID);
- var outObj = document.getElementById(outID);
+ init: function(inID, outID) {
- // objects found?
- if (inObj === null){ return; }
- if (outObj === null){ return; }
+ this.inObj = $(inID);
+ this.outObj = $(outID);
- function clear_results(){
- outObj.style.display = 'none';
- outObj.innerHTML = '';
- }
+ // objects found?
+ if (this.inObj === null) return;
+ if (this.outObj === null) return;
+
+ // prepare AJAX
+ this.sackObj = new sack(DOKU_BASE + 'lib/exe/ajax.php');
+ this.sackObj.AjaxFailedAlert = '';
+ this.sackObj.encodeURIString = false;
+ this.sackObj.onCompletion = ajax_quicksearch.onCompletion;
+
+ // attach eventhandler to search field
+ this.delay = new Delay(function () {
+ ajax_quicksearch.clear_results();
+ var value = ajax_quicksearch.inObj.value;
+ if(value === ''){ return; }
+ ajax_quicksearch.sackObj.runAJAX('call=qsearch&q=' + encodeURI(value));
+ });
+
+ addEvent(this.inObj, 'keyup', function () {
+ ajax_quicksearch.clear_results();
+ ajax_quicksearch.delay.start();
+ });
- var sack_obj = new sack(DOKU_BASE + 'lib/exe/ajax.php');
- sack_obj.AjaxFailedAlert = '';
- sack_obj.encodeURIString = false;
- sack_obj.onCompletion = function () {
- var data = sack_obj.response;
+ // attach eventhandler to output field
+ addEvent(this.outObj, 'click', function () {
+ ajax_quicksearch.outObj.style.display = 'none';
+ });
+ },
+
+ clear_results: function(){
+ ajax_quicksearch.outObj.style.display = 'none';
+ ajax_quicksearch.outObj.innerHTML = '';
+ },
+
+ onCompletion: function() {
+ var data = this.response; // 'this' is sack context
if (data === '') { return; }
+ var outObj = ajax_quicksearch.outObj;
+
outObj.innerHTML = data;
outObj.style.display = 'block';
- };
+ outObj.style['white-space'] = 'nowrap';
- // attach eventhandler to search field
- var delay = new Delay(function () {
- clear_results();
- var value = inObj.value;
- if(value === ''){ return; }
- sack_obj.runAJAX('call=qsearch&q=' + encodeURI(value));
- });
+ // shorten namespaces if too long
+ var width = outObj.clientWidth;
+ var links = outObj.getElementsByTagName('a');
+ for(var i=0; i<links.length; i++){
+ // maximum allowed width:
+ var max = width - links[i].offsetLeft;
+ var isRTL = (document.documentElement.dir == 'rtl');
- addEvent(inObj, 'keyup', function () {clear_results(); delay.start(); });
+ if(!isRTL && links[i].offsetWidth < max) continue;
+ if(isRTL && links[i].offsetLeft > 0) continue;
- // attach eventhandler to output field
- addEvent(outObj, 'click', function () {outObj.style.display = 'none'; });
+ var nsL = links[i].innerText.indexOf('(');
+ var nsR = links[i].innerText.indexOf(')');
+ var eli = 0;
+ var runaway = 0;
+
+ while( (nsR - nsL > 3) &&
+ (
+ (!isRTL && links[i].offsetWidth > max) ||
+ (isRTL && links[i].offsetLeft < 0)
+ )
+ ){
+ if(runaway++ > 500) return; // just in case something went wrong
+
+ if(eli){
+ // elipsis already inserted
+ if( (eli - nsL) > (nsR - eli) ){
+ // cut left
+ links[i].innerText = links[i].innerText.substring(0,eli-2)+
+ links[i].innerText.substring(eli);
+ }else{
+ // cut right
+ links[i].innerText = links[i].innerText.substring(0,eli+1)+
+ links[i].innerText.substring(eli+2);
+ }
+ }else{
+ // replace middle with ellipsis
+ var mid = Math.floor( nsL + ((nsR-nsL)/2) );
+ links[i].innerText = links[i].innerText.substring(0,mid)+'…'+
+ links[i].innerText.substring(mid+1);
+ }
+ eli = links[i].innerText.indexOf('…');
+ nsL = links[i].innerText.indexOf('(');
+ nsR = links[i].innerText.indexOf(')');
+ }
+ }
+ }
+
+};
+
+
+addInitEvent(function(){
+ ajax_quicksearch.init('qsearch__in','qsearch__out');
});
+
diff --git a/lib/scripts/edit.js b/lib/scripts/edit.js
index 01262bcef..45c1fb111 100644
--- a/lib/scripts/edit.js
+++ b/lib/scripts/edit.js
@@ -268,6 +268,7 @@ var textChanged = false;
*/
function deleteDraft() {
if (is_opera) return;
+ if (window.keepDraft) return;
// remove a possibly saved draft using ajax
var dwform = $('dw__editform');
@@ -318,8 +319,13 @@ addInitEvent(function (){
window.onunload = deleteDraft;
// reset change memory var on submit
- addEvent($('edbtn__save'), 'click', function(){ textChanged = false; });
- addEvent($('edbtn__preview'), 'click', function(){ textChanged = false; });
+ addEvent($('edbtn__save'), 'click', function(){
+ textChanged = false;
+ });
+ addEvent($('edbtn__preview'), 'click', function(){
+ textChanged = false;
+ window.keepDraft = true; // needed to keep draft on page unload
+ });
var summary = $('edit__summary');
addEvent(summary, 'change', summaryCheck);
@@ -341,104 +347,3 @@ function summaryCheck(){
}
}
-
-/**
- * Class managing the timer to display a warning on a expiring lock
- */
-function locktimer_class(){
- this.sack = null;
- this.timeout = 0;
- this.timerID = null;
- this.lasttime = null;
- this.msg = '';
- this.pageid = '';
-};
-var locktimer = new locktimer_class();
- locktimer.init = function(timeout,msg,draft){
- // init values
- locktimer.timeout = timeout*1000;
- locktimer.msg = msg;
- locktimer.draft = draft;
- locktimer.lasttime = new Date();
-
- if(!$('dw__editform')) return;
- locktimer.pageid = $('dw__editform').elements.id.value;
- if(!locktimer.pageid) return;
-
- // init ajax component
- locktimer.sack = new sack(DOKU_BASE + 'lib/exe/ajax.php');
- locktimer.sack.AjaxFailedAlert = '';
- locktimer.sack.encodeURIString = false;
- locktimer.sack.onCompletion = locktimer.refreshed;
-
- // register refresh event
- addEvent($('dw__editform'),'keypress',function(){locktimer.refresh();});
- // start timer
- locktimer.reset();
- };
-
- /**
- * (Re)start the warning timer
- */
- locktimer.reset = function(){
- locktimer.clear();
- locktimer.timerID = window.setTimeout("locktimer.warning()", locktimer.timeout);
- };
-
- /**
- * Display the warning about the expiring lock
- */
- locktimer.warning = function(){
- locktimer.clear();
- alert(locktimer.msg);
- };
-
- /**
- * Remove the current warning timer
- */
- locktimer.clear = function(){
- if(locktimer.timerID !== null){
- window.clearTimeout(locktimer.timerID);
- locktimer.timerID = null;
- }
- };
-
- /**
- * Refresh the lock via AJAX
- *
- * Called on keypresses in the edit area
- */
- locktimer.refresh = function(){
- var now = new Date();
- // refresh every minute only
- if(now.getTime() - locktimer.lasttime.getTime() > 30*1000){ //FIXME decide on time
- var params = 'call=lock&id='+encodeURIComponent(locktimer.pageid);
- var dwform = $('dw__editform');
- if(locktimer.draft && dwform.elements.wikitext){
- params += '&prefix='+encodeURIComponent(dwform.elements.prefix.value);
- params += '&wikitext='+encodeURIComponent(dwform.elements.wikitext.value);
- params += '&suffix='+encodeURIComponent(dwform.elements.suffix.value);
- if(dwform.elements.date){
- params += '&date='+encodeURIComponent(dwform.elements.date.value);
- }
- }
- locktimer.sack.runAJAX(params);
- locktimer.lasttime = now;
- }
- };
-
-
- /**
- * Callback. Resets the warning timer
- */
- locktimer.refreshed = function(){
- var data = this.response;
- var error = data.charAt(0);
- data = data.substring(1);
-
- $('draft__status').innerHTML=data;
- if(error != '1') return; // locking failed
- locktimer.reset();
- };
-// end of locktimer class functions
-
diff --git a/lib/scripts/hotkeys.js b/lib/scripts/hotkeys.js
index ad608b227..bff28530d 100644
--- a/lib/scripts/hotkeys.js
+++ b/lib/scripts/hotkeys.js
@@ -52,7 +52,7 @@ function Hotkeys() {
t.each(anchors, function(a) {
if (a.accessKey != "") {
t.addShortcut(t.modifier + '+' + a.accessKey, function() {
- a.click();
+ location.href = a.href;
});
a.accessKey = '';
}
diff --git a/lib/scripts/linkwiz.js b/lib/scripts/linkwiz.js
index 6130bbf4c..2750d07a8 100644
--- a/lib/scripts/linkwiz.js
+++ b/lib/scripts/linkwiz.js
@@ -10,7 +10,7 @@
var wiz;
var entry;
- var result
+ var result;
var timer;
var textArea;
var selected;
@@ -21,9 +21,11 @@
* and attaching the eventhandlers
*/
var init = function(textAreaElement){
+
// create HTML Structure
wiz = document.createElement('div');
+ wiz.style.position = 'absolute';
wiz.id = 'link__wiz';
wiz.className = 'picker';
wiz.style.top = (findPosY(textAreaElement)+20)+'px';
diff --git a/lib/scripts/locktimer.js b/lib/scripts/locktimer.js
new file mode 100644
index 000000000..f5ba1c60d
--- /dev/null
+++ b/lib/scripts/locktimer.js
@@ -0,0 +1,99 @@
+/**
+ * Class managing the timer to display a warning on a expiring lock
+ */
+var locktimer = {
+ sack: null,
+ timeout: 0,
+ timerID: null,
+ lasttime: null,
+ msg: '',
+ pageid: '',
+
+ init: function(timeout,msg,draft){
+ // init values
+ locktimer.timeout = timeout*1000;
+ locktimer.msg = msg;
+ locktimer.draft = draft;
+ locktimer.lasttime = new Date();
+
+ if(!$('dw__editform')) return;
+ locktimer.pageid = $('dw__editform').elements.id.value;
+ if(!locktimer.pageid) return;
+ if($('wiki__text').readOnly) return;
+
+ // init ajax component
+ locktimer.sack = new sack(DOKU_BASE + 'lib/exe/ajax.php');
+ locktimer.sack.AjaxFailedAlert = '';
+ locktimer.sack.encodeURIString = false;
+ locktimer.sack.onCompletion = locktimer.refreshed;
+
+ // register refresh event
+ addEvent($('dw__editform'),'keypress',function(){locktimer.refresh();});
+ // start timer
+ locktimer.reset();
+ },
+
+ /**
+ * (Re)start the warning timer
+ */
+ reset: function(){
+ locktimer.clear();
+ locktimer.timerID = window.setTimeout("locktimer.warning()", locktimer.timeout);
+ },
+
+ /**
+ * Display the warning about the expiring lock
+ */
+ warning: function(){
+ locktimer.clear();
+ alert(locktimer.msg);
+ },
+
+ /**
+ * Remove the current warning timer
+ */
+ clear: function(){
+ if(locktimer.timerID !== null){
+ window.clearTimeout(locktimer.timerID);
+ locktimer.timerID = null;
+ }
+ },
+
+ /**
+ * Refresh the lock via AJAX
+ *
+ * Called on keypresses in the edit area
+ */
+ refresh: function(){
+ var now = new Date();
+ // refresh every minute only
+ if(now.getTime() - locktimer.lasttime.getTime() > 30*1000){
+ var params = 'call=lock&id='+encodeURIComponent(locktimer.pageid);
+ var dwform = $('dw__editform');
+ if(locktimer.draft && dwform.elements.wikitext){
+ params += '&prefix='+encodeURIComponent(dwform.elements.prefix.value);
+ params += '&wikitext='+encodeURIComponent(dwform.elements.wikitext.value);
+ params += '&suffix='+encodeURIComponent(dwform.elements.suffix.value);
+ if(dwform.elements.date){
+ params += '&date='+encodeURIComponent(dwform.elements.date.value);
+ }
+ }
+ locktimer.sack.runAJAX(params);
+ locktimer.lasttime = now;
+ }
+ },
+
+ /**
+ * Callback. Resets the warning timer
+ */
+ refreshed: function(){
+ var data = this.response;
+ var error = data.charAt(0);
+ data = data.substring(1);
+
+ $('draft__status').innerHTML=data;
+ if(error != '1') return; // locking failed
+ locktimer.reset();
+ }
+};
+
diff --git a/lib/scripts/media.js b/lib/scripts/media.js
index ea8f56af2..c00a71e5f 100644
--- a/lib/scripts/media.js
+++ b/lib/scripts/media.js
@@ -2,9 +2,6 @@
/*global jQuery, window, DOKU_BASE*/
"use strict";
-// TODO
-// * fix the css to have pointers on the +/- images in the tree when JS is enabled
-// * fix the css to have pointers on a.select when JS is enabled
// * refactor once the jQuery port is over ;)
/**
@@ -27,6 +24,9 @@
ext: false,
};
+
+
+
/**
* build the popup window
*
@@ -37,9 +37,10 @@
popup = document.createElement('div');
popup.setAttribute('id','media__popup');
+ popup.style.display = "none";
var root = document.getElementById('media__manager');
- if (root == null) return;
+ if (root === null) return;
root.appendChild(popup);
var headline = document.createElement('h1');
@@ -68,8 +69,7 @@
for (var i = 0 ; i < linkbtns.length ; ++i) {
var linkbtn = document.createElement('button');
linkbtn.className = 'button';
- linkbtn.value = i + 1;
- linkbtn.id = "media__linkbtn" + (i + 1);
+ linkbtn.id = "media__linkbtn" + (i+1);
linkbtn.title = LANG['media' + linkbtns[i]];
linkbtn.style.borderStyle = 'outset';
$(linkbtn).click(function (event) { return setlink(event,this); });
@@ -101,8 +101,7 @@
var alignimg = document.createElement('img');
alignimg.src = DOKU_BASE + 'lib/images/media_align_' + alignbtns[n] + '.png';
- alignbtn.id = "media__alignbtn" + n;
- alignbtn.value = n;
+ alignbtn.id = "media__alignbtn" + (n+1);
alignbtn.title = LANG['media' + alignbtns[n]];
alignbtn.className = 'button';
alignbtn.appendChild(alignimg);
@@ -136,7 +135,6 @@
sizebtn.className = 'button';
sizebtn.appendChild(sizeimg);
- sizebtn.value = size + 1;
sizebtn.id = 'media__sizebtn' + (size + 1);
sizebtn.title = LANG['media' + sizebtns[size]];
sizebtn.style.borderStyle = 'outset';
@@ -191,7 +189,7 @@
optsstart = true;
}
- var s = parseInt(media_manager.size);
+ var s = parseInt(media_manager.size, 10);
if (s && s >= 1) {
opts += (optsstart)?'&':'?';
@@ -212,21 +210,23 @@
}
}
}
- if (media_manager.align == '1') {
+ if (media_manager.align == '2') {
alignleft = '';
alignright = ' ';
}
- if (media_manager.align == '2') {
+ if (media_manager.align == '3') {
alignleft = ' ';
alignright = ' ';
}
- if (media_manager.align == '3') {
+ if (media_manager.align == '4') {
alignleft = ' ';
alignright = '';
}
}
}
- opener.insertTags('wiki__text','{{'+alignleft+id+opts+alignright+'|','}}','');
+ var edid = String.prototype.match.call(document.location, /&edid=([^&]+)/);
+ edid = edid ? edid[1] : 'wiki__text';
+ opener.insertTags(edid,'{{'+alignleft+id+opts+alignright+'|','}}','');
if(!media_manager.keepopen) window.close();
opener.focus();
@@ -285,7 +285,7 @@
DOKU_BASE + 'lib/exe/ajax.php',
link.attr('search').substr(1) + '&call=medians',
function (data) {
- ul.html(data)
+ ul.html(data);
listitem.append(ul);
},
'html'
@@ -491,7 +491,7 @@
* @author Pierre Spring <pierre.spring@caillou.ch>
*/
attachoptions = function(){
- obj = $('#media__opts')[0]
+ obj = $('#media__opts')[0];
if(!obj) return;
// keep open
@@ -548,7 +548,7 @@
obj.appendChild(hdlbl);
obj.appendChild(hdbr);
updatehide();
- },
+ };
/**
* Generalized toggler
@@ -563,7 +563,7 @@
DokuCookie.setValue(variable, '');
media_manager[variable] = false;
}
- }
+ };
initFlashUpload = function () {
var oform, oflash, title;
@@ -618,14 +618,15 @@
* @author Dominik Eckelmann <eckelmann@cosmocode.de>
*/
setalign = function(event,cb){
- if(cb.value){
- DokuCookie.setValue('align',cb.value);
- media_manager.align = cb.value;
- outSet("media__alignbtn0");
- outSet("media__alignbtn1");
- outSet("media__alignbtn2");
- outSet("media__alignbtn3");
- inSet("media__alignbtn"+cb.value);
+
+ var id = cb.id.substring(cb.id.length -1);
+ if(id){
+ DokuCookie.setValue('align',id);
+ media_manager.align = id;
+ for (var i = 1; i<=4; i++) {
+ outSet("media__alignbtn" + i);
+ }
+ inSet("media__alignbtn"+id);
}else{
DokuCookie.setValue('align','');
media_manager.align = false;
@@ -638,23 +639,34 @@
* @author Dominik Eckelmann <eckelmann@cosmocode.de>
*/
setlink = function(event,cb){
- if(cb.value){
- DokuCookie.setValue('link',cb.value);
- media_manager.link = cb.value;
- outSet("media__linkbtn1");
- outSet("media__linkbtn2");
- outSet("media__linkbtn3");
- outSet("media__linkbtn4");
- inSet("media__linkbtn"+cb.value);
+ var id = cb.id.substring(cb.id.length -1);
+ if(id){
+ DokuCookie.setValue('link',id);
+ for (var i = 1; i<=4; i++) {
+ outSet("media__linkbtn"+i);
+ }
+ inSet("media__linkbtn"+id);
+
var size = $("#media__size");
var align = $("#media__align");
- if (cb.value != '4') {
+ if (id != '4') {
size.show();
align.show();
+ if (media_manager.link == '4') {
+ media_manager.align = '1';
+ DokuCookie.setValue('align', '1');
+ inSet('media__alignbtn1');
+
+ media_manager.size = '2';
+ DokuCookie.setValue('size', '2');
+ inSet('media__sizebtn2');
+ }
+
} else {
size.hide();
align.hide();
}
+ media_manager.link = id;
}else{
DokuCookie.setValue('link','');
media_manager.link = false;
@@ -667,13 +679,14 @@
* @author Dominik Eckelmann <eckelmann@cosmocode.de>
*/
setsize = function(event,cb){
- if (cb.value) {
- DokuCookie.setValue('size',cb.value);
- media_manager.size = cb.value;
- for (var i = 1 ; i <= 4 ; ++i) {
+ var id = cb.id.substring(cb.id.length -1);
+ if (id) {
+ DokuCookie.setValue('size',id);
+ media_manager.size = id;
+ for (var i = 1 ; i <=4 ; ++i) {
outSet("media__sizebtn" + i);
}
- inSet("media__sizebtn"+cb.value);
+ inSet("media__sizebtn"+id);
} else {
DokuCookie.setValue('size','');
media_manager.width = false;
diff --git a/lib/scripts/script.js b/lib/scripts/script.js
index 1badf63a5..a99735c99 100644
--- a/lib/scripts/script.js
+++ b/lib/scripts/script.js
@@ -119,6 +119,20 @@ function findPosY(object){
} //end findPosY function
/**
+ * Get the computed style of a node.
+ *
+ * @link https://acidmartin.wordpress.com/2008/08/26/style-get-any-css-property-value-of-an-object/
+ * @link http://svn.dojotoolkit.org/src/dojo/trunk/_base/html.js
+ */
+function gcs(node){
+ if(node.currentStyle){
+ return node.currentStyle;
+ }else{
+ return node.ownerDocument.defaultView.getComputedStyle(node, null);
+ }
+}
+
+/**
* Escape special chars in JavaScript
*
* @author Andreas Gohr <andi@splitbrain.org>
@@ -265,10 +279,32 @@ function insitu_popup(target, popup_id) {
getElementsByClass('dokuwiki', document.body, 'div')[0].appendChild(fndiv);
}
+ var non_static_parent = fndiv.parentNode;
+ while (non_static_parent != document && gcs(non_static_parent)['position'] == 'static') {
+ non_static_parent = non_static_parent.parentNode;
+ }
+
+ var fixed_target_parent = target;
+ while (fixed_target_parent != document && gcs(fixed_target_parent)['position'] != 'fixed') {
+ fixed_target_parent = fixed_target_parent.parentNode;
+ }
+
// position the div and make it visible
- fndiv.style.position = 'absolute';
- fndiv.style.left = findPosX(target)+'px';
- fndiv.style.top = (findPosY(target)+target.offsetHeight * 1.5) + 'px';
+ if (fixed_target_parent != document) {
+ // the target has position fixed, that means the footnote needs to be fixed, too
+ fndiv.style.position = 'fixed';
+ } else {
+ fndiv.style.position = 'absolute';
+ }
+
+ if (fixed_target_parent != document || non_static_parent == document) {
+ fndiv.style.left = findPosX(target)+'px';
+ fndiv.style.top = (findPosY(target)+target.offsetHeight * 1.5) + 'px';
+ } else {
+ fndiv.style.left = (findPosX(target) - findPosX(non_static_parent)) +'px';
+ fndiv.style.top = (findPosY(target)+target.offsetHeight * 1.5 - findPosY(non_static_parent)) + 'px';
+ }
+
fndiv.style.display = '';
return fndiv;
}
@@ -465,19 +501,29 @@ addInitEvent(function(){
});
/**
- * Add the event handler to the actiondropdown
+ * Autosubmit quick select forms
+ *
+ * When a <select> tag has the class "quickselect", this script will
+ * automatically submit its parent form when the select value changes.
+ * It also hides the submit button of the form.
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
addInitEvent(function(){
- var selector = $('action__selector');
- if(!selector) return;
-
- addEvent(selector,'change',function(e){
- this.form.submit();
- });
-
- $('action__selectorbtn').style.display = 'none';
+ var selects = getElementsByClass('quickselect',document,'select');
+ for(var i=0; i<selects.length; i++){
+ // auto submit on change
+ addEvent(selects[i],'change',function(e){
+ this.form.submit();
+ });
+ // hide submit buttons
+ var btns = selects[i].form.getElementsByTagName('input');
+ for(var j=0; j<btns.length; j++){
+ if(btns[j].type == 'submit'){
+ btns[j].style.display = 'none';
+ }
+ }
+ }
});
/**
diff --git a/lib/scripts/toolbar.js b/lib/scripts/toolbar.js
index f969cee64..795e105df 100644
--- a/lib/scripts/toolbar.js
+++ b/lib/scripts/toolbar.js
@@ -153,7 +153,7 @@ function tb_insert(btn, props, edid) {
*/
function tb_mediapopup(btn, props, edid) {
window.open(
- DOKU_BASE+props['url']+encodeURIComponent(NS),
+ DOKU_BASE+props['url']+encodeURIComponent(NS)+'&edid='+encodeURIComponent(edid),
props['name'],
props['options']);
return false;