summaryrefslogtreecommitdiff
path: root/lib/scripts/script.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/scripts/script.js')
-rw-r--r--lib/scripts/script.js213
1 files changed, 6 insertions, 207 deletions
diff --git a/lib/scripts/script.js b/lib/scripts/script.js
index 8adba829c..b44d95d6f 100644
--- a/lib/scripts/script.js
+++ b/lib/scripts/script.js
@@ -14,10 +14,12 @@ if ('function' === typeof jQuery && 'function' === typeof jQuery.noConflict) {
*/
function DEPRECATED(msg){
if(!window.console) return;
- if(!arguments.callee) return;
+ if(!msg) msg = '';
- var func = arguments.callee.caller.name;
- var line = 'DEPRECATED function call '+func+'(). '+msg;
+ var func;
+ if(arguments.callee) func = arguments.callee.caller.name;
+ if(func) func = ' '+func+'()';
+ var line = 'DEPRECATED function call'+func+'. '+msg;
if(console.warn){
console.warn(line);
@@ -100,68 +102,6 @@ function isset(varname){
}
/**
- * Select elements by their class name
- *
- * @author Dustin Diaz <dustin [at] dustindiaz [dot] com>
- * @link http://www.dustindiaz.com/getelementsbyclass/
- */
-function getElementsByClass(searchClass,node,tag) {
- var classElements = new Array();
- if ( node == null )
- node = document;
- if ( tag == null )
- tag = '*';
- var els = node.getElementsByTagName(tag);
- var elsLen = els.length;
- var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
- for (var i = 0, j = 0; i < elsLen; i++) {
- if ( pattern.test(els[i].className) ) {
- classElements[j] = els[i];
- j++;
- }
- }
- return classElements;
-}
-
-/**
- * Get the X offset of the top left corner of the given object
- *
- * @link http://www.quirksmode.org/js/findpos.html
- */
-function findPosX(object){
- var curleft = 0;
- var obj = $(object);
- if (obj.offsetParent){
- do {
- curleft += obj.offsetLeft;
- } while (obj = obj.offsetParent);
- }
- else if (obj.x){
- curleft += obj.x;
- }
- return curleft;
-} //end findPosX function
-
-/**
- * Get the Y offset of the top left corner of the given object
- *
- * @link http://www.quirksmode.org/js/findpos.html
- */
-function findPosY(object){
- var curtop = 0;
- var obj = $(object);
- if (obj.offsetParent){
- do {
- curtop += obj.offsetTop;
- } while (obj = obj.offsetParent);
- }
- else if (obj.y){
- curtop += obj.y;
- }
- return curtop;
-} //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/
@@ -207,19 +147,6 @@ function escapeQuotes(text) {
}
/**
- * Adds a node as the first childenode to the given parent
- *
- * @see appendChild()
- */
-function prependChild(parent,element) {
- if(!parent.firstChild){
- parent.appendChild(element);
- }else{
- parent.insertBefore(element,parent.firstChild);
- }
-}
-
-/**
* Prints a animated gif to show the search is performed
*
* Because we need to modify the DOM here before the document is loaded
@@ -253,47 +180,6 @@ function hideLoadBar(id){
if(obj) obj.style.display="none";
}
-/**
- * Adds the toggle switch to the TOC
- */
-function addTocToggle() {
- if(!document.getElementById) return;
- var header = $('toc__header');
- if(!header) return;
- var toc = $('toc__inside');
-
- var obj = document.createElement('span');
- obj.id = 'toc__toggle';
- obj.style.cursor = 'pointer';
- if (toc && toc.style.display == 'none') {
- obj.innerHTML = '<span>+</span>';
- obj.className = 'toc_open';
- } else {
- obj.innerHTML = '<span>&minus;</span>';
- obj.className = 'toc_close';
- }
-
- prependChild(header,obj);
- obj.parentNode.onclick = toggleToc;
- obj.parentNode.style.cursor = 'pointer';
-}
-
-/**
- * This toggles the visibility of the Table of Contents
- */
-function toggleToc() {
- var toc = $('toc__inside');
- var obj = $('toc__toggle');
- if(toc.style.display == 'none') {
- toc.style.display = '';
- obj.innerHTML = '<span>&minus;</span>';
- obj.className = 'toc_close';
- } else {
- toc.style.display = 'none';
- obj.innerHTML = '<span>+</span>';
- obj.className = 'toc_open';
- }
-}
/**
* Create JavaScript mouseover popup
@@ -391,99 +277,12 @@ addInitEvent(function(){
}
});
-/**
- * Add the edit window size controls
- */
-function initSizeCtl(ctlid,edid){
- if(!document.getElementById){ return; }
-
- var ctl = $(ctlid);
- var textarea = $(edid);
- if(!ctl || !textarea) return;
-
- var hgt = DokuCookie.getValue('sizeCtl');
- if(hgt){
- textarea.style.height = hgt;
- }else{
- textarea.style.height = '300px';
- }
-
- var wrp = DokuCookie.getValue('wrapCtl');
- if(wrp){
- setWrap(textarea, wrp);
- } // else use default value
-
- var l = document.createElement('img');
- var s = document.createElement('img');
- var w = document.createElement('img');
- l.src = DOKU_BASE+'lib/images/larger.gif';
- s.src = DOKU_BASE+'lib/images/smaller.gif';
- w.src = DOKU_BASE+'lib/images/wrap.gif';
- addEvent(l,'click',function(){sizeCtl(edid,100);});
- addEvent(s,'click',function(){sizeCtl(edid,-100);});
- addEvent(w,'click',function(){toggleWrap(edid);});
- ctl.appendChild(l);
- ctl.appendChild(s);
- ctl.appendChild(w);
-}
-
-/**
- * This sets the vertical size of the editbox
- */
-function sizeCtl(edid,val){
- var textarea = $(edid);
- var height = parseInt(textarea.style.height.substr(0,textarea.style.height.length-2));
- height += val;
- textarea.style.height = height+'px';
-
- DokuCookie.setValue('sizeCtl',textarea.style.height);
-}
-
-/**
- * Toggle the wrapping mode of a textarea
- */
-function toggleWrap(edid){
- var textarea = $(edid);
- var wrap = textarea.getAttribute('wrap');
- if(wrap && wrap.toLowerCase() == 'off'){
- setWrap(textarea, 'soft');
- }else{
- setWrap(textarea, 'off');
- }
-
- DokuCookie.setValue('wrapCtl',textarea.getAttribute('wrap'));
-}
-
-/**
- * Set the wrapping mode of a textarea
- *
- * @author Fluffy Convict <fluffyconvict@hotmail.com>
- * @author <shutdown@flashmail.com>
- * @link http://news.hping.org/comp.lang.javascript.archive/12265.html
- * @link https://bugzilla.mozilla.org/show_bug.cgi?id=41464
- */
-function setWrap(textarea, wrapAttrValue){
- textarea.setAttribute('wrap', wrapAttrValue);
-
- // Fix display for mozilla
- var parNod = textarea.parentNode;
- var nxtSib = textarea.nextSibling;
- parNod.removeChild(textarea);
- parNod.insertBefore(textarea, nxtSib);
-}
/**
* 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';
- }
- }
+ jQuery('div.JSpopup').hide();
}
/**