aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/scripts/edit.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/scripts/edit.js')
-rw-r--r--lib/scripts/edit.js73
1 files changed, 5 insertions, 68 deletions
diff --git a/lib/scripts/edit.js b/lib/scripts/edit.js
index 86ebb230d..3b1ca8834 100644
--- a/lib/scripts/edit.js
+++ b/lib/scripts/edit.js
@@ -67,7 +67,7 @@ function createPicker(id,props,edid){
}
picker.id = id;
picker.style.position = 'absolute';
- picker.style.marginLeft = '-10000px'; // no display none, to keep access keys working
+ picker.style.marginLeft = '-10000px'; // no display:none, to keep access keys working
for(var key in list){
if (!list.hasOwnProperty(key)) continue;
@@ -84,9 +84,7 @@ function createPicker(id,props,edid){
}
btn.title = key;
btn.appendChild(ico);
- eval("btn.onclick = function(){pickerInsert('"+
- jsEscape(key)+"','"+
- jsEscape(edid)+"');return false;}");
+ addEvent(btn,'click',bind(pickerInsert,key,edid));
picker.appendChild(btn);
}else if(isString(list[key])){
// a list of text -> treat as text picker
@@ -95,9 +93,7 @@ function createPicker(id,props,edid){
var txt = document.createTextNode(list[key]);
btn.title = list[key];
btn.appendChild(txt);
- eval("btn.onclick = function(){pickerInsert('"+
- jsEscape(list[key])+"','"+
- jsEscape(edid)+"');return false;}");
+ addEvent(btn,'click',bind(pickerInsert,list[key],edid));
picker.appendChild(btn);
}else{
// a list of lists -> treat it as subtoolbar
@@ -117,9 +113,7 @@ function createPicker(id,props,edid){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function pickerInsert(text,edid){
- // insert
insertAtCarret(edid,text);
- // close picker
pickerClose();
}
@@ -132,51 +126,15 @@ function pickerInsert(text,edid){
* @return boolean If button should be appended
* @author Gabriel Birke <birke@d-scribe.de>
*/
-function addBtnActionSignature(btn, props, edid)
-{
+function addBtnActionSignature(btn, props, edid) {
if(typeof(SIG) != 'undefined' && SIG != ''){
- eval("btn.onclick = function(){insertAtCarret('"+
- jsEscape(edid)+"','"+
- jsEscape(SIG)+
- "');return false;}");
+ addEvent(btn,'click',bind(insertAtCarret,edid,SIG));
return true;
}
return false;
}
/**
- * Add button action for the mediapopup button
- *
- * @param DOMElement btn Button element to add the action to
- * @param array props Associative array of button properties
- * @return boolean If button should be appended
- * @author Gabriel Birke <birke@d-scribe.de>
- */
-function addBtnActionMediapopup(btn, props) {
- eval("btn.onclick = function(){window.open('"+DOKU_BASE+
- jsEscape(props['url']+encodeURIComponent(NS))+"','"+
- jsEscape(props['name'])+"','"+
- jsEscape(props['options'])+
- "');return false;}");
- return true;
-}
-
-/**
- * Add button action for the headline buttons
- *
- * @param DOMElement btn Button element to add the action to
- * @param array props Associative array of button properties
- * @return boolean If button should be appended
- * @author Andreas Gohr <gohr@cosmocode.de>
- */
-function addBtnActionAutohead(btn, props, edid, id) {
- eval("btn.onclick = function(){"+
- "insertHeadline('"+edid+"',"+props['mod']+",'"+jsEscape(props['text'])+"'); "+
- "return false};");
- return true;
-}
-
-/**
* Make intended formattings easier to handle
*
* Listens to all key inputs and handle indentions
@@ -272,27 +230,6 @@ function currentHeadlineLevel(textboxId){
return 0;
}
-/**
- * Insert a new headline based on the current section level
- *
- * @param string textboxId - the edit field ID
- * @param int mod - the headline modificator ( -1, 0, 1)
- * @param string text - the sample text passed to insertTags
- */
-function insertHeadline(textboxId,mod,text){
- var lvl = currentHeadlineLevel(textboxId);
-
-
- // determine new level
- lvl += mod;
- if(lvl < 1) lvl = 1;
- if(lvl > 5) lvl = 5;
-
- var tags = '=';
- for(var i=0; i<=5-lvl; i++) tags += '=';
- insertTags(textboxId, tags+' ', ' '+tags+"\n", text);
- pickerClose();
-}
/**
* global var used for not saved yet warning