var DOKU_BASE = '/portfolioswiki/';var DOKU_TPL = '/portfolioswiki/lib/tpl/monobook/';var alertText = 'Please enter the text you want to format.\nIt will be appended to the end of the document.';var notSavedYet = 'Unsaved changes will be lost.\nReally continue?';var reallyDel = 'Really delete selected item(s)?';LANG = {"keepopen":"Keep window open on selection","hidedetails":"Hide Details"}; /* XXXXXXXXXX begin of /mnt/WWW/PHYSICS/portfolioswiki/lib/scripts/helpers.js XXXXXXXXXX */ /** * $Id: helpers.js 156 2006-12-23 08:48:25Z wingedfox $ * $HeadURL: https://svn.debugger.ru/repos/jslibs/BrowserExtensions/trunk/helpers.js $ * * File contains differrent helper functions * * @author Ilya Lebedev * @license LGPL * @version $Rev: 156 $ */ //----------------------------------------------------------------------------- // Variable/property checks //----------------------------------------------------------------------------- /** * Checks if property is undefined * * @param {Object} prop value to check * @return {Boolean} true if matched * @scope public */ function isUndefined (prop /* :Object */) /* :Boolean */ { return (typeof prop == 'undefined'); } /** * Checks if property is function * * @param {Object} prop value to check * @return {Boolean} true if matched * @scope public */ function isFunction (prop /* :Object */) /* :Boolean */ { return (typeof prop == 'function'); } /** * Checks if property is string * * @param {Object} prop value to check * @return {Boolean} true if matched * @scope public */ function isString (prop /* :Object */) /* :Boolean */ { return (typeof prop == 'string'); } /** * Checks if property is number * * @param {Object} prop value to check * @return {Boolean} true if matched * @scope public */ function isNumber (prop /* :Object */) /* :Boolean */ { return (typeof prop == 'number'); } /** * Checks if property is the calculable number * * @param {Object} prop value to check * @return {Boolean} true if matched * @scope public */ function isNumeric (prop /* :Object */) /* :Boolean */ { return isNumber(prop)&&!isNaN(prop)&&isFinite(prop); } /** * Checks if property is array * * @param {Object} prop value to check * @return {Boolean} true if matched * @scope public */ function isArray (prop /* :Object */) /* :Boolean */ { return (prop instanceof Array); } /** * Checks if property is regexp * * @param {Object} prop value to check * @return {Boolean} true if matched * @scope public */ function isRegExp (prop /* :Object */) /* :Boolean */ { return (prop instanceof RegExp); } /** * Checks if property is a boolean value * * @param {Object} prop value to check * @return {Boolean} true if matched * @scope public */ function isBoolean (prop /* :Object */) /* :Boolean */ { return ('boolean' == typeof prop); } /** * Checks if property is a scalar value (value that could be used as the hash key) * * @param {Object} prop value to check * @return {Boolean} true if matched * @scope public */ function isScalar (prop /* :Object */) /* :Boolean */ { return isNumeric(prop)||isString(prop); } /** * Checks if property is empty * * @param {Object} prop value to check * @return {Boolean} true if matched * @scope public */ function isEmpty (prop /* :Object */) /* :Boolean */ { if (isBoolean(prop)) return false; if (isRegExp(prop) && new RegExp("").toString() == prop.toString()) return true; if (isString(prop) || isNumber(prop)) return !prop; if (Boolean(prop)&&false != prop) { for (var i in prop) if(prop.hasOwnProperty(i)) return false } return true; } /* * Checks if property is derived from prototype, applies method if it is not exists * * @param string property name * @return bool true if prototyped * @access public */ if ('undefined' == typeof Object.hasOwnProperty) { Object.prototype.hasOwnProperty = function (prop) { return !('undefined' == typeof this[prop] || this.constructor && this.constructor.prototype[prop] && this[prop] === this.constructor.prototype[prop]); } } /* XXXXXXXXXX end of /mnt/WWW/PHYSICS/portfolioswiki/lib/scripts/helpers.js XXXXXXXXXX */ /* XXXXXXXXXX begin of /mnt/WWW/PHYSICS/portfolioswiki/lib/scripts/events.js XXXXXXXXXX */ // written by Dean Edwards, 2005 // with input from Tino Zijdel // http://dean.edwards.name/weblog/2005/10/add-event/ function addEvent(element, type, handler) { // assign each event handler a unique ID if (!handler.$$guid) handler.$$guid = addEvent.guid++; // create a hash table of event types for the element if (!element.events) element.events = {}; // create a hash table of event handlers for each element/event pair var handlers = element.events[type]; if (!handlers) { handlers = element.events[type] = {}; // store the existing event handler (if there is one) if (element["on" + type]) { handlers[0] = element["on" + type]; } } // store the event handler in the hash table handlers[handler.$$guid] = handler; // assign a global event handler to do all the work element["on" + type] = handleEvent; }; // a counter used to create unique IDs addEvent.guid = 1; function removeEvent(element, type, handler) { // delete the event handler from the hash table if (element.events && element.events[type]) { delete element.events[type][handler.$$guid]; } }; function handleEvent(event) { var returnValue = true; // grab the event object (IE uses a global event object) event = event || fixEvent(window.event); // get a reference to the hash table of event handlers var handlers = this.events[event.type]; // execute each event handler for (var i in handlers) { if (!handlers.hasOwnProperty(i)) continue; this.$$handleEvent = handlers[i]; if (this.$$handleEvent(event) === false) { returnValue = false; } } return returnValue; }; function fixEvent(event) { // add W3C standard event methods event.preventDefault = fixEvent.preventDefault; event.stopPropagation = fixEvent.stopPropagation; // fix target event.target = event.srcElement; return event; }; fixEvent.preventDefault = function() { this.returnValue = false; }; fixEvent.stopPropagation = function() { this.cancelBubble = true; }; /** * Pseudo event handler to be fired after the DOM was parsed or * on window load at last. * * @author based upon some code by Dean Edwards * @author Dean Edwards * @link http://dean.edwards.name/weblog/2006/06/again/ */ window.fireoninit = function() { // quit if this function has already been called if (arguments.callee.done) return; // flag this function so we don't do the same thing twice arguments.callee.done = true; // kill the timer if (_timer) { clearInterval(_timer); _timer = null; } if (typeof window.oninit == 'function') { window.oninit(); } }; /** * Run the fireoninit function as soon as possible after * the DOM was loaded, using different methods for different * Browsers * * @author Dean Edwards * @link http://dean.edwards.name/weblog/2006/06/again/ */ // for Mozilla if (document.addEventListener) { document.addEventListener("DOMContentLoaded", window.fireoninit, null); } // for Internet Explorer (using conditional comments) /*@cc_on @*/ /*@if (@_win32) document.write("<\/script>"); var script = document.getElementById("__ie_init"); script.onreadystatechange = function() { if (this.readyState == "complete") { window.fireoninit(); // call the onload handler } }; /*@end @*/ // for Safari if (/WebKit/i.test(navigator.userAgent)) { // sniff var _timer = setInterval(function() { if (/loaded|complete/.test(document.readyState)) { window.fireoninit(); // call the onload handler } }, 10); } // for other browsers window.onload = window.fireoninit; /** * This is a pseudo Event that will be fired by the fireoninit * function above. * * Use addInitEvent to bind to this event! * * @author Andreas Gohr * @see fireoninit() */ window.oninit = function(){}; /** * Bind a function to the window.init pseudo event * * @author Simon Willison * @see http://simon.incutio.com/archive/2004/05/26/addLoadEvent */ function addInitEvent(func) { var oldoninit = window.oninit; if (typeof window.oninit != 'function') { window.oninit = func; } else { window.oninit = function() { oldoninit(); func(); }; } } /* XXXXXXXXXX end of /mnt/WWW/PHYSICS/portfolioswiki/lib/scripts/events.js XXXXXXXXXX */ /* XXXXXXXXXX begin of /mnt/WWW/PHYSICS/portfolioswiki/lib/scripts/cookie.js XXXXXXXXXX */ /** * Handles the cookie used by several JavaScript functions * * Only a single cookie is written and read. You may only save * sime name-value pairs - no complex types! * * You should only use the getValue and setValue methods * * @author Andreas Gohr */ DokuCookie = { data: Array(), name: 'DOKU_PREFS', /** * Save a value to the cookie * * @author Andreas Gohr */ setValue: function(key,val){ DokuCookie.init(); DokuCookie.data[key] = val; // prepare expire date var now = new Date(); DokuCookie.fixDate(now); now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000); //expire in a year //save the whole data array var text = ''; for(var key in DokuCookie.data){ if (!DokuCookie.data.hasOwnProperty(key)) continue; text += '#'+escape(key)+'#'+DokuCookie.data[key]; } DokuCookie.setCookie(DokuCookie.name,text.substr(1),now,DOKU_BASE); }, /** * Get a Value from the Cookie * * @author Andreas Gohr */ getValue: function(key){ DokuCookie.init(); return DokuCookie.data[key]; }, /** * Loads the current set cookie * * @author Andreas Gohr */ init: function(){ if(DokuCookie.data.length) return; var text = DokuCookie.getCookie(DokuCookie.name); if(text){ var parts = text.split('#'); for(var i=0; i 0){ date.setTime(date.getTime() - skew); } } }; /* XXXXXXXXXX end of /mnt/WWW/PHYSICS/portfolioswiki/lib/scripts/cookie.js XXXXXXXXXX */ /* XXXXXXXXXX begin of /mnt/WWW/PHYSICS/portfolioswiki/lib/scripts/script.js XXXXXXXXXX */ /** * Some of these scripts were taken from wikipedia.org and were modified for DokuWiki */ /** * Some browser detection */ var clientPC = navigator.userAgent.toLowerCase(); // Get client info var is_macos = navigator.appVersion.indexOf('Mac') != -1; var is_gecko = ((clientPC.indexOf('gecko')!=-1) && (clientPC.indexOf('spoofer')==-1) && (clientPC.indexOf('khtml') == -1) && (clientPC.indexOf('netscape/7.0')==-1)); var is_safari = ((clientPC.indexOf('AppleWebKit')!=-1) && (clientPC.indexOf('spoofer')==-1)); var is_khtml = (navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled )); if (clientPC.indexOf('opera')!=-1) { var is_opera = true; var is_opera_preseven = (window.opera && !document.childNodes); var is_opera_seven = (window.opera && document.childNodes); } /** * Rewrite the accesskey tooltips to be more browser and OS specific. * * Accesskey tooltips are still only a best-guess of what will work * on well known systems. * * @author Ben Coburn */ function updateAccessKeyTooltip() { // determin tooltip text (order matters) var tip = 'ALT+'; //default if (is_macos) { tip = 'CTRL+'; } if (is_opera) { tip = 'SHIFT+ESC '; } // add other cases here... // do tooltip update if (tip=='ALT+') { return; } var exp = /\[ALT\+/i; var rep = '['+tip; var elements = document.getElementsByTagName('a'); for (var i=0; i0) { elements[i].title = elements[i].title.replace(exp, rep); } } elements = document.getElementsByTagName('input'); for (var i=0; i0) { elements[i].title = elements[i].title.replace(exp, rep); } } elements = document.getElementsByTagName('button'); for (var i=0; i0) { elements[i].title = elements[i].title.replace(exp, rep); } } } /** * Handy shortcut to document.getElementById * * This function was taken from the prototype library * * @link http://prototype.conio.net/ */ function $() { var elements = new Array(); for (var i = 0; i < arguments.length; i++) { var element = arguments[i]; if (typeof element == 'string') element = document.getElementById(element); if (arguments.length == 1) return element; elements.push(element); } return elements; } /** * Simple function to check if a global var is defined * * @author Kae Verens * @link http://verens.com/archives/2005/07/25/isset-for-javascript/#comment-2835 */ function isset(varname){ return(typeof(window[varname])!='undefined'); } /** * Select elements by their class name * * @author Dustin Diaz * @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 (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/index.html?/js/findpos.html */ function findPosX(object){ var curleft = 0; var obj = $(object); if (obj.offsetParent){ while (obj.offsetParent){ curleft += obj.offsetLeft; 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/index.html?/js/findpos.html */ function findPosY(object){ var curtop = 0; var obj = $(object); if (obj.offsetParent){ while (obj.offsetParent){ curtop += obj.offsetTop; obj = obj.offsetParent; } } else if (obj.y){ curtop += obj.y; } return curtop; } //end findPosY function /** * Escape special chars in JavaScript * * @author Andreas Gohr */ function jsEscape(text){ var re=new RegExp("\\\\","g"); text=text.replace(re,"\\\\"); re=new RegExp("'","g"); text=text.replace(re,"\\'"); re=new RegExp('"',"g"); text=text.replace(re,'"'); re=new RegExp("\\\\\\\\n","g"); text=text.replace(re,"\\n"); return text; } /** * This function escapes some special chars * @deprecated by above function */ function escapeQuotes(text) { var re=new RegExp("'","g"); text=text.replace(re,"\\'"); re=new RegExp('"',"g"); text=text.replace(re,'"'); re=new RegExp("\\n","g"); text=text.replace(re,"\\n"); return 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 * and parsed completely we have to rely on document.write() * * @author Andreas Gohr */ function showLoadBar(){ document.write('...'); /* this does not work reliable in IE obj = $(id); if(obj){ obj.innerHTML = '...'; obj.style.display="block"; } */ } /** * Disables the animated gif to show the search is done * * @author Andreas Gohr */ function hideLoadBar(id){ obj = $(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 obj = document.createElement('span'); obj.id = 'toc__toggle'; obj.innerHTML = ''; obj.className = 'toc_close'; obj.style.cursor = 'pointer'; prependChild(header,obj); obj.parentNode.onclick = toggleToc; try { obj.parentNode.style.cursor = 'pointer'; obj.parentNode.style.cursor = 'hand'; }catch(e){} } /** * 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 = ''; obj.className = 'toc_close'; } else { toc.style.display = 'none'; obj.innerHTML = '+'; obj.className = 'toc_open'; } } /** * This enables/disables checkboxes for acl-administration * * @author Frank Schubert */ function checkAclLevel(){ if(document.getElementById) { var scope = $('acl_scope').value; //check for namespace if( (scope.indexOf(":*") > 0) || (scope == "*") ){ document.getElementsByName('acl_checkbox[4]')[0].disabled=false; document.getElementsByName('acl_checkbox[8]')[0].disabled=false; }else{ document.getElementsByName('acl_checkbox[4]')[0].checked=false; document.getElementsByName('acl_checkbox[8]')[0].checked=false; document.getElementsByName('acl_checkbox[4]')[0].disabled=true; document.getElementsByName('acl_checkbox[8]')[0].disabled=true; } } } /** * Display an insitu footnote popup * * @author Andreas Gohr * @author Chris Smith */ function footnote(e){ var obj = e.target; var id = obj.id.substr(5); // get or create the footnote popup div var fndiv = $('insitu__fn'); if(!fndiv){ fndiv = document.createElement('div'); fndiv.id = 'insitu__fn'; fndiv.className = 'insitu-footnote JSpopup dokuwiki'; // autoclose on mouseout - ignoring bubbled up events addEvent(fndiv,'mouseout',function(e){ if(e.target != fndiv){ e.stopPropagation(); return; } // check if the element was really left if(e.pageX){ // Mozilla var bx1 = findPosX(fndiv); var bx2 = bx1 + fndiv.offsetWidth; var by1 = findPosY(fndiv); var by2 = by1 + fndiv.offsetHeight; var x = e.pageX; var y = e.pageY; if(x > bx1 && x < bx2 && y > by1 && y < by2){ // we're still inside boundaries e.stopPropagation(); return; } }else{ // IE if(e.offsetX > 0 && e.offsetX < fndiv.offsetWidth-1 && e.offsetY > 0 && e.offsetY < fndiv.offsetHeight-1){ // we're still inside boundaries e.stopPropagation(); return; } } // okay, hide it fndiv.style.display='none'; }); document.body.appendChild(fndiv); } // locate the footnote anchor element var a = $( "fn__"+id ); if (!a){ return; } // anchor parent is the footnote container, get its innerHTML var content = new String (a.parentNode.innerHTML); // strip the leading content anchors and their comma separators content = content.replace(//gi, ''); content = content.replace(/^\s+(,\s+)+/,''); // prefix ids on any elements with "insitu__" to ensure they remain unique content = content.replace(/\bid=\"(.*?)\"/gi,'id="insitu__$1'); // now put the content into the wrapper fndiv.innerHTML = content; // position the div and make it visible var x; var y; if(e.pageX){ // Mozilla x = e.pageX; y = e.pageY; }else{ // IE x = e.offsetX; y = e.offsetY; } fndiv.style.position = 'absolute'; fndiv.style.left = (x+2)+'px'; fndiv.style.top = (y+2)+'px'; fndiv.style.display = ''; } /** * Add the event handlers to footnotes * * @author Andreas Gohr */ addInitEvent(function(){ var elems = getElementsByClass('fn_top',null,'a'); for(var i=0; i * @link http://news.hping.org/comp.lang.javascript.archive/12265.html * @author * @link https://bugzilla.mozilla.org/show_bug.cgi?id=302710#c2 */ function toggleWrap(edid){ var txtarea = $(edid); var wrap = txtarea.getAttribute('wrap'); if(wrap && wrap.toLowerCase() == 'off'){ txtarea.setAttribute('wrap', 'soft'); }else{ txtarea.setAttribute('wrap', 'off'); } // Fix display for mozilla var parNod = txtarea.parentNode; var nxtSib = txtarea.nextSibling; parNod.removeChild(txtarea); parNod.insertBefore(txtarea, 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'; } } } /** * Looks for an element with the ID scroll__here at scrolls to it */ function scrollToMarker(){ var obj = $('scroll__here'); if(obj) obj.scrollIntoView(); } /** * Looks for an element with the ID focus__this at sets focus to it */ function focusMarker(){ var obj = $('focus__this'); if(obj) obj.focus(); } /** * Remove messages */ function cleanMsgArea(){ var elems = getElementsByClass('(success|info|error)',document,'div'); if(elems){ for(var i=0; i */ //prepare class function ajax_qsearch_class(){ this.sack = null; this.inObj = null; this.outObj = null; this.timer = null; } //create global object and add functions var ajax_qsearch = new ajax_qsearch_class(); ajax_qsearch.sack = new sack(DOKU_BASE + 'lib/exe/ajax.php'); ajax_qsearch.sack.AjaxFailedAlert = ''; ajax_qsearch.sack.encodeURIString = false; ajax_qsearch.init = function(inID,outID){ ajax_qsearch.inObj = document.getElementById(inID); ajax_qsearch.outObj = document.getElementById(outID); // objects found? if(ajax_qsearch.inObj === null){ return; } if(ajax_qsearch.outObj === null){ return; } // attach eventhandler to search field 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'; }); }; ajax_qsearch.clear = function(){ ajax_qsearch.outObj.style.display = 'none'; ajax_qsearch.outObj.innerHTML = ''; if(ajax_qsearch.timer !== null){ window.clearTimeout(ajax_qsearch.timer); ajax_qsearch.timer = null; } }; ajax_qsearch.exec = function(){ 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; if(data === ''){ return; } ajax_qsearch.outObj.innerHTML = data; ajax_qsearch.outObj.style.display = 'block'; }; ajax_qsearch.call = function(){ ajax_qsearch.clear(); ajax_qsearch.timer = window.setTimeout("ajax_qsearch.exec()",500); }; /* XXXXXXXXXX end of /mnt/WWW/PHYSICS/portfolioswiki/lib/scripts/ajax.js XXXXXXXXXX */ /* XXXXXXXXXX begin of /mnt/WWW/PHYSICS/portfolioswiki/lib/tpl/monobook/script.js XXXXXXXXXX */ /* XXXXXXXXXX end of /mnt/WWW/PHYSICS/portfolioswiki/lib/tpl/monobook/script.js XXXXXXXXXX */ addInitEvent(function(){ ajax_qsearch.init('qsearch__in','qsearch__out'); }); addInitEvent(function(){ addEvent(document,'click',closePopups); }); addInitEvent(function(){ addTocToggle(); }); /* XXXXXXXXXX begin of /mnt/WWW/PHYSICS/portfolioswiki/lib/plugins/color/script.js XXXXXXXXXX */ /* XXXXXXXXXX end of /mnt/WWW/PHYSICS/portfolioswiki/lib/plugins/color/script.js XXXXXXXXXX */ addInitEvent(function(){ updateAccessKeyTooltip(); }); addInitEvent(function(){ scrollToMarker(); }); addInitEvent(function(){ focusMarker(); });