summaryrefslogtreecommitdiff
path: root/lib/scripts
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2006-02-26 18:23:32 +0100
committerAndreas Gohr <andi@splitbrain.org>2006-02-26 18:23:32 +0100
commit24a33b42ae28709c5ef59638ddd1189329d176db (patch)
tree829c46cbd54f70f659e060f1434b20c76642714f /lib/scripts
parent10dc665f3da01cbf84d09714a4681a1317eb3ea0 (diff)
downloadrpg-24a33b42ae28709c5ef59638ddd1189329d176db.tar.gz
rpg-24a33b42ae28709c5ef59638ddd1189329d176db.tar.bz2
changed IDs to avoid name clashes
darcs-hash:20060226172332-7ad00-f073117ba2f027935f87cf23106bf6a4316a5790.gz
Diffstat (limited to 'lib/scripts')
-rw-r--r--lib/scripts/ajax.js6
-rw-r--r--lib/scripts/edit.js154
-rw-r--r--lib/scripts/script.js20
-rw-r--r--lib/scripts/spellcheck.js68
4 files changed, 124 insertions, 124 deletions
diff --git a/lib/scripts/ajax.js b/lib/scripts/ajax.js
index c0323f09e..a2a48a996 100644
--- a/lib/scripts/ajax.js
+++ b/lib/scripts/ajax.js
@@ -31,7 +31,7 @@ ajax_qsearch.init = function(inID,outID){
if(ajax_qsearch.outObj === null){ return; }
// attach eventhandler to search field
- addEvent(ajax_qsearch.inObj,'keyup',ajax_qsearch.call);
+ addEvent(ajax_qsearch.inObj,'keyup',ajax_qsearch.call);
// attach eventhandler to output field
addEvent(ajax_qsearch.outObj,'click',function(){ ajax_qsearch.outObj.style.display='none'; });
@@ -47,14 +47,14 @@ ajax_qsearch.clear = function(){
};
ajax_qsearch.exec = function(){
- ajax_qsearch.clear();
+ ajax_qsearch.clear();
var value = ajax_qsearch.inObj.value;
if(value === ''){ return; }
ajax_qsearch.sack.runAJAX('call=qsearch&q='+encodeURI(value));
};
ajax_qsearch.sack.onCompletion = function(){
- var data = ajax_qsearch.sack.response;
+ var data = ajax_qsearch.sack.response;
if(data === ''){ return; }
ajax_qsearch.outObj.innerHTML = data;
diff --git a/lib/scripts/edit.js b/lib/scripts/edit.js
index 9a317a85c..22d040610 100644
--- a/lib/scripts/edit.js
+++ b/lib/scripts/edit.js
@@ -49,13 +49,13 @@ function createToolButton(icon,label,key,id){
*/
function createPicker(id,list,icobase,edid){
var cnt = list.length;
-
+
var picker = document.createElement('div');
picker.className = 'picker';
picker.id = id;
picker.style.position = 'absolute';
picker.style.display = 'none';
-
+
for(var key in list){
var btn = document.createElement('button');
@@ -139,7 +139,7 @@ function initToolbar(tbid,edid,tb){
case 'format':
var sample = tb[i]['title'];
if(tb[i]['sample']){ sample = tb[i]['sample']; }
-
+
eval("btn.onclick = function(){insertTags('"+
jsEscape(edid)+"','"+
jsEscape(tb[i]['open'])+"','"+
@@ -207,7 +207,7 @@ function insertTags(edid,tagOpen, tagClose, sampleText) {
theSelection=sampleText;
}
txtarea.focus();
-
+
// This has change
var text = theSelection;
if(theSelection.charAt(theSelection.length - 1) == " "){// exclude ending space char, if any
@@ -240,14 +240,14 @@ function insertTags(edid,tagOpen, tagClose, sampleText) {
txtarea.value = txtarea.value.substring(0, startPos) + subst +
txtarea.value.substring(endPos, txtarea.value.length);
txtarea.focus();
-
+
//set new selection
if(replaced){
var cPos=startPos+(tagOpen.length+myText.length+tagClose.length);
txtarea.selectionStart=cPos;
txtarea.selectionEnd=cPos;
}else{
- txtarea.selectionStart=startPos+tagOpen.length;
+ txtarea.selectionStart=startPos+tagOpen.length;
txtarea.selectionEnd=startPos+tagOpen.length+myText.length;
}
txtarea.scrollTop=scrollTop;
@@ -363,21 +363,21 @@ function initChangeCheck(msg){
}
// reset change memory var on submit
- var btn_save = document.getElementById('edbtn_save');
+ var btn_save = document.getElementById('edbtn__save');
btn_save.onclick = function(){ textChanged = false; };
btn_save.onkeypress = function(){ textChanged = false; };
- var btn_prev = document.getElementById('edbtn_preview');
+ var btn_prev = document.getElementById('edbtn__preview');
btn_prev.onclick = function(){ textChanged = false; };
btn_prev.onkeypress = function(){ textChanged = false; };
// add change memory setter
- var edit_text = document.getElementById('wikitext');
+ var edit_text = document.getElementById('wiki__text');
edit_text.onchange = function(){
textChanged = true; //global var
summaryCheck();
};
edit_text.onkeyup = summaryCheck;
- var summary = document.getElementById('summary');
+ var summary = document.getElementById('edit__summary');
summary.onchange = summaryCheck;
summary.onkeyup = summaryCheck;
@@ -391,7 +391,7 @@ function initChangeCheck(msg){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function summaryCheck(){
- var sum = document.getElementById('summary');
+ var sum = document.getElementById('edit__summary');
if(sum.value === ''){
sum.className='missing';
}else{
@@ -404,84 +404,84 @@ 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 = '';
+ 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){
- // init values
- locktimer.timeout = timeout*1000;
- locktimer.msg = msg;
- 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').elements.wikitext,'keyup',function(){locktimer.refresh();});
-
- // start timer
- locktimer.reset();
- };
-
- /**
+ locktimer.init = function(timeout,msg){
+ // init values
+ locktimer.timeout = timeout*1000;
+ locktimer.msg = msg;
+ 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').elements.wikitext,'keyup',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.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;
- }
- };
-
- /**
+ 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() > 60*1000){
- locktimer.sack.runAJAX('call=lock&id='+encodeURI(locktimer.pageid));
- locktimer.lasttime = now;
- }
- };
+ locktimer.refresh = function(){
+ var now = new Date();
+ // refresh every minute only
+ if(now.getTime() - locktimer.lasttime.getTime() > 60*1000){
+ locktimer.sack.runAJAX('call=lock&id='+encodeURI(locktimer.pageid));
+ locktimer.lasttime = now;
+ }
+ };
- /**
+ /**
* Callback. Resets the warning timer
*/
- locktimer.refreshed = function(){
- if(this.response != '1') return; // locking failed
- locktimer.reset();
- };
+ locktimer.refreshed = function(){
+ if(this.response != '1') return; // locking failed
+ locktimer.reset();
+ };
// end of locktimer class functions
diff --git a/lib/scripts/script.js b/lib/scripts/script.js
index d621232ce..834f0f4a4 100644
--- a/lib/scripts/script.js
+++ b/lib/scripts/script.js
@@ -132,7 +132,7 @@ function prependChild(parent,element) {
function showLoadBar(){
if(document.getElementById){
document.write('<img src="'+DOKU_BASE+'lib/images/loading.gif" '+
- 'width="150" height="12" id="loading" />');
+ 'width="150" height="12" id="dw__loading" />');
}
}
@@ -143,7 +143,7 @@ function showLoadBar(){
*/
function hideLoadBar(){
if(document.getElementById){
- $('loading').style.display="none";
+ $('dw__loading').style.display="none";
}
}
@@ -153,7 +153,7 @@ function hideLoadBar(){
* @see http://www.alexking.org/index.php?content=software/javascript/content.php
*/
function mediaSelect(file){
- opener.insertTags('wikitext','{{'+file+'|','}}',file);
+ opener.insertTags('wiki__text','{{'+file+'|','}}',file);
window.close();
}
@@ -296,34 +296,34 @@ var currentFootnote = 0;
function fnt(id, e, evt) {
if (currentFootnote && id != currentFootnote) {
- domTT_close($('insitu-fn'+currentFootnote));
+ domTT_close($('insitu__fn'+currentFootnote));
}
// does the footnote tooltip already exist?
- var fnote = $('insitu-fn'+id);
+ var fnote = $('insitu__fn'+id);
var footnote;
if (!fnote) {
// if not create it...
// locate the footnote anchor element
- var a = $( "fn"+id );
+ var a = $( "fn__"+id );
if (!a){ return; }
// anchor parent is the footnote container, get its innerHTML
footnote = new String (a.parentNode.innerHTML);
// strip the leading footnote anchors and their comma separators
- footnote = footnote.replace(/<a\s.*?href=\".*\#fnt\d+\".*?<\/a>/gi, '');
+ footnote = footnote.replace(/<a\s.*?href=\".*\#fnt__\d+\".*?<\/a>/gi, '');
footnote = footnote.replace(/^\s+(,\s+)+/,'');
- // prefix ids on any elements with "insitu-" to ensure they remain unique
- footnote = footnote.replace(/\bid=\"(.*?)\"/gi,'id="insitu-$1');
+ // prefix ids on any elements with "insitu__" to ensure they remain unique
+ footnote = footnote.replace(/\bid=\"(.*?)\"/gi,'id="insitu__$1');
} else {
footnote = new String(fnt.innerHTML);
}
// activate the tooltip
- domTT_activate(e, evt, 'content', footnote, 'type', 'velcro', 'id', 'insitu-fn'+id, 'styleClass', 'insitu-footnote JSpopup', 'maxWidth', document.body.offsetWidth*0.4);
+ domTT_activate(e, evt, 'content', footnote, 'type', 'velcro', 'id', 'insitu__fn'+id, 'styleClass', 'insitu-footnote JSpopup', 'maxWidth', document.body.offsetWidth*0.4);
currentFootnote = id;
}
diff --git a/lib/scripts/spellcheck.js b/lib/scripts/spellcheck.js
index 9ce529131..2af56642f 100644
--- a/lib/scripts/spellcheck.js
+++ b/lib/scripts/spellcheck.js
@@ -1,5 +1,5 @@
/**
- * DokuWiki Spellcheck AJAX clientside script
+ * DokuWiki Spellcheck AJAX clientside script
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Andreas Gohr <andi@splitbrain.org>
@@ -16,27 +16,27 @@
* Copyright (c) 2005, Garrison Locke
* All rights reserved.
*
- * Redistribution and use in source and binary forms, with or without
+ * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
- * * Redistributions of source code must retain the above copyright notice,
+ * * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- * * Neither the name of the http://www.broken-notebook.com nor the names of its
- * contributors may be used to endorse or promote products derived from this
+ * * Neither the name of the http://www.broken-notebook.com nor the names of its
+ * contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*/
@@ -81,7 +81,7 @@ function ajax_spell_class(){
this.utf8ok = 1;
this.handler = DOKU_BASE+'lib/exe/spellcheck.php';
// to hold the page objects (initialized with init())
- this.textboxObj = null;
+ this.textboxObj = null;
this.showboxObj = null;
this.suggestObj = null;
this.editbarObj = null;
@@ -114,25 +114,25 @@ function ajax_spell_class(){
if(ajax.failed){ return; }
// get Elements
- this.textboxObj = document.getElementById('wikitext');
- this.editbarObj = document.getElementById('wikieditbar');
- this.showboxObj = document.getElementById('spell_result');
- this.suggestObj = document.getElementById('spell_suggest');
+ this.textboxObj = document.getElementById('wiki__text');
+ this.editbarObj = document.getElementById('wiki__editbar');
+ this.showboxObj = document.getElementById('spell__result');
+ this.suggestObj = document.getElementById('spell__suggest');
// set Translation Strings
this.txtStart = txtStart;
this.txtStop = txtStop;
this.txtRun = txtRun;
- this.txtNoErr = txtNoErr;
+ this.txtNoErr = txtNoErr;
this.txtNoSug = txtNoSug;
this.txtChange= txtChange;
// create ToolBar Button with ID and add it to the toolbar with null action
- var toolbarObj = document.getElementById('toolbar');
- this.buttonObj = createToolButton('spellcheck.png',txtStart,'k','spellcheck');
+ var toolbarObj = document.getElementById('tool__bar');
+ this.buttonObj = createToolButton('spellcheck.png',txtStart,'k','spell__check');
this.buttonObj.onclick = function(){return false;};
toolbarObj.appendChild(this.buttonObj);
- this.imageObj = document.getElementById('spellcheck_ico');
+ this.imageObj = document.getElementById('spell__check_ico');
// start UTF-8 compliance test - send an UTF-8 char and see what comes back
ajax.AjaxFailedAlert = '';
@@ -204,7 +204,7 @@ function ajax_spell_class(){
* @author Garrison Locke <http://www.broken-notebook.com>
*/
this.correct = function (id, word){
- var obj = document.getElementById('spell_error'+id);
+ var obj = document.getElementById('spell__error'+id);
obj.innerHTML = decodeURIComponent(word);
obj.style.color = "#005500";
this.suggestObj.style.display = "none";
@@ -212,11 +212,11 @@ function ajax_spell_class(){
/**
* Opens a prompt to let the user change the word her self
- *
+ *
* @author Andreas Gohr <andi@splitbrain.org>
*/
this.ask = function(id){
- var word = document.getElementById('spell_error'+id).innerHTML;
+ var word = document.getElementById('spell__error'+id).innerHTML;
word = prompt(this.txtChange,word);
if(word){
this.correct(id,encodeURIComponent(word));
@@ -236,10 +236,10 @@ function ajax_spell_class(){
// set position of the popup
this.suggestObj.style.display = "none";
- var x = findPosX('spell_error'+id);
- var y = findPosY('spell_error'+id);
+ var x = findPosX('spell__error'+id);
+ var y = findPosY('spell__error'+id);
- // handle scrolling
+ // handle scrolling
var scrollPos;
if(is_opera){
scrollPos = 0; //FIXME how to do this without browser sniffing?
@@ -294,7 +294,7 @@ function ajax_spell_class(){
addEvent(ajax_spell.textboxObj,'focus',ajax_spell.setState);
// get started
- ajax_spell.setState('start');
+ ajax_spell.setState('start');
};
/**
@@ -302,7 +302,7 @@ function ajax_spell_class(){
* Inside the callback 'this' is the SACK object!!
*
* @author Andreas Gohr <andi@splitbrain.org>
- */
+ */
this.start = function(){
var data = this.response;
var error = data.charAt(0);
@@ -350,7 +350,7 @@ function ajax_spell_class(){
return String.fromCharCode(+match1);
});
// now remove &amp; protection
- data = data.replace(/&amp;/g,'&');
+ data = data.replace(/&amp;/g,'&');
}
// replace div with textbox again