Skip to content
Snippets Groups Projects
Commit 5382ed1a authored by Andreas Gohr's avatar Andreas Gohr
Browse files

aliased some vars in linkwiz for brevity

parent 6d23f6ac
No related branches found
No related tags found
No related merge requests found
...@@ -176,16 +176,17 @@ var dw_linkwiz = { ...@@ -176,16 +176,17 @@ var dw_linkwiz = {
* Handles the "click" on a given result anchor * Handles the "click" on a given result anchor
*/ */
resultClick: function(a){ resultClick: function(a){
var L = dw_linkwiz;
var id = a.title; var id = a.title;
if(id == '' || id.substr(id.length-1) == ':'){ if(id == '' || id.substr(id.length-1) == ':'){
dw_linkwiz.entry.value = id; L.entry.value = id;
dw_linkwiz.autocomplete_exec(); L.autocomplete_exec();
}else{ }else{
dw_linkwiz.entry.value = id; L.entry.value = id;
if(a.nextSibling && a.nextSibling.tagName == 'SPAN'){ if(a.nextSibling && a.nextSibling.tagName == 'SPAN'){
dw_linkwiz.insertLink(a.nextSibling.innerHTML); L.insertLink(a.nextSibling.innerHTML);
}else{ }else{
dw_linkwiz.insertLink(''); L.insertLink('');
} }
} }
}, },
...@@ -197,10 +198,12 @@ var dw_linkwiz = { ...@@ -197,10 +198,12 @@ var dw_linkwiz = {
* as link title instead * as link title instead
*/ */
insertLink: function(title){ insertLink: function(title){
if(!dw_linkwiz.entry.value) return; var L = dw_linkwiz;
var E = L.entry;
if(!E.value) return;
var sel = getSelection(dw_linkwiz.textArea); var sel = getSelection(L.textArea);
if(sel.start == 0 && sel.end == 0) sel = dw_linkwiz.selection; if(sel.start == 0 && sel.end == 0) sel = L.selection;
var stxt = sel.getText(); var stxt = sel.getText();
...@@ -213,22 +216,22 @@ var dw_linkwiz = { ...@@ -213,22 +216,22 @@ var dw_linkwiz = {
if(!stxt && !DOKU_UHC) stxt=title; if(!stxt && !DOKU_UHC) stxt=title;
// prepend colon inside namespaces for non namespace pages // prepend colon inside namespaces for non namespace pages
if(dw_linkwiz.textArea.form['id'].value.indexOf(':') != -1 && if(L.textArea.form['id'].value.indexOf(':') != -1 &&
dw_linkwiz.entry.value.indexOf(':') == -1){ E.value.indexOf(':') == -1){
dw_linkwiz.entry.value = ':'+dw_linkwiz.entry.value; E.value = ':'+E.value;
} }
var link = '[['+dw_linkwiz.entry.value+'|'; var link = '[['+E.value+'|';
if(stxt) link += stxt; if(stxt) link += stxt;
link += ']]'; link += ']]';
var so = dw_linkwiz.entry.value.length+3; var so = E.value.length+3;
var eo = 2; var eo = 2;
pasteText(sel,link,{startofs: so, endofs: eo}); pasteText(sel,link,{startofs: so, endofs: eo});
dw_linkwiz.hide(); L.hide();
// reset the entry to the parent namespace and remove : at the beginning // reset the entry to the parent namespace and remove : at the beginning
dw_linkwiz.entry.value = dw_linkwiz.entry.value.replace(/(^:)?[^:]*$/, ''); E.value = E.value.replace(/(^:)?[^:]*$/, '');
}, },
/** /**
...@@ -268,32 +271,25 @@ var dw_linkwiz = { ...@@ -268,32 +271,25 @@ var dw_linkwiz = {
}, },
/** /**
* Clears the result area * Show the link wizard
* @fixme localize
*/
clear: function(){
dw_linkwiz.result.innerHTML = 'Search for a matching page name above, or browse through the pages on the right';
dw_linkwiz.entry.value = '';
},
/**
* Show the dw_linkwizard
*/ */
show: function(){ show: function(){
dw_linkwiz.selection = getSelection(dw_linkwiz.textArea); var L = dw_linkwiz;
dw_linkwiz.$wiz.css('marginLeft', '0'); L.selection = getSelection(dw_linkwiz.textArea);
dw_linkwiz.$wiz.css('marginTop', '0'); L.$wiz.css('marginLeft', '0');
dw_linkwiz.entry.focus(); L.$wiz.css('marginTop', '0');
dw_linkwiz.autocomplete(); L.entry.focus();
L.autocomplete();
}, },
/** /**
* Hide the link wizard * Hide the link wizard
*/ */
hide: function(){ hide: function(){
dw_linkwiz.$wiz.css('marginLeft', '-10000px'); var L = dw_linkwiz;
dw_linkwiz.$wiz.css('marginTop', '-10000px'); L.$wiz.css('marginLeft', '-10000px');
dw_linkwiz.textArea.focus(); L.$wiz.css('marginTop', '-10000px');
L.textArea.focus();
}, },
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment