aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/scripts/script.js
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2005-10-29 02:26:52 +0200
committerAndreas Gohr <andi@splitbrain.org>2005-10-29 02:26:52 +0200
commitbad31ae944f074dab12f7a6d1362775d8f2b18dd (patch)
treeaf7ed25d7d8ef9c2c836afdd21b1ee7398db3dcd /lib/scripts/script.js
parent551242f8292dd257969d52089332f6ddb8bd70b2 (diff)
downloaddokuwiki-bad31ae944f074dab12f7a6d1362775d8f2b18dd.tar.gz
dokuwiki-bad31ae944f074dab12f7a6d1362775d8f2b18dd.zip
JavaScript refactoring
This patch addes a first go on a central javascript and CSS dispatcher which builds a single script from all needed scripts, does optimizing and caching. darcs-hash:20051029002652-7ad00-7558b569c2bf65f5e41820644580d97c62edd0d6.gz
Diffstat (limited to 'lib/scripts/script.js')
-rw-r--r--lib/scripts/script.js33
1 files changed, 17 insertions, 16 deletions
diff --git a/lib/scripts/script.js b/lib/scripts/script.js
index 44409c712..180f2dcd5 100644
--- a/lib/scripts/script.js
+++ b/lib/scripts/script.js
@@ -16,19 +16,6 @@ if (clientPC.indexOf('opera')!=-1) {
var is_opera_seven = (window.opera && document.childNodes);
}
-//http://simon.incutio.com/archive/2004/05/26/addLoadEvent#comment2
-function addEvent(oTarget, sType, fpDest) {
- var oOldEvent = oTarget[sType];
- if (typeof oOldEvent != "function") {
- oTarget[sType] = fpDest;
- } else {
- oTarget[sType] = function(e) {
- oOldEvent(e);
- fpDest(e);
- }
- }
-}
-
/**
* Get the X offset of the top left corner of the given object
*
@@ -293,7 +280,7 @@ function fnt(id, e, evt) {
}
// activate the tooltip
- domTT_activate(e, evt, 'content', footnote, 'type', 'velcro', 'id', 'insitu-fn'+id, 'styleClass', 'insitu-footnote', '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;
}
@@ -318,8 +305,8 @@ function initSizeCtl(ctlid,edid){
var s = document.createElement('img');
l.src = DOKU_BASE+'lib/images/larger.gif';
s.src = DOKU_BASE+'lib/images/smaller.gif';
- l.onclick = function(){sizeCtl(edid,100);}
- s.onclick = function(){sizeCtl(edid,-100);}
+ addEvent(l,'click',function(){sizeCtl(edid,100);});
+ addEvent(s,'click',function(){sizeCtl(edid,-100);});
ctl.appendChild(l);
ctl.appendChild(s);
}
@@ -338,3 +325,17 @@ function sizeCtl(edid,val){
now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000); //expire in a year
setCookie('DokuWikisizeCtl',textarea.style.height,now);
}
+
+/**
+ * Handler to close all open Popups
+ */
+function closePopups(){
+ if(!document.getElementById) return;
+
+ var divs = document.getElementsByTagName('div');
+ for(var i=0; i < divs.length; i++){
+ if(divs[i].className.indexOf('JSpopup') != -1){
+ divs[i].style.display = 'none';
+ }
+ }
+}