From e5e0d088f46df2ea7f159a5efa4f2aea0cd3037d Mon Sep 17 00:00:00 2001 From: Lester Caine Date: Fri, 15 May 2026 13:54:37 +0100 Subject: Move libraries to relevant packages --- javascript/bitweaver.js | 1323 -------------------- javascript/class.JavaScriptPacker.php | 728 ----------- .../fancyzoom/images-global/zoom/closebox.png | Bin 1910 -> 0 bytes javascript/fancyzoom/images-global/zoom/spacer.gif | Bin 43 -> 0 bytes .../images-global/zoom/zoom-caption-fill.png | Bin 134 -> 0 bytes .../images-global/zoom/zoom-caption-l.png | Bin 310 -> 0 bytes .../images-global/zoom/zoom-caption-r.png | Bin 290 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-shadow1.png | Bin 310 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-shadow2.png | Bin 164 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-shadow3.png | Bin 368 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-shadow4.png | Bin 178 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-shadow5.png | Bin 180 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-shadow6.png | Bin 428 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-shadow7.png | Bin 186 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-shadow8.png | Bin 426 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-spin-1.png | Bin 1882 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-spin-10.png | Bin 1892 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-spin-11.png | Bin 1901 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-spin-12.png | Bin 1902 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-spin-2.png | Bin 1893 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-spin-3.png | Bin 1922 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-spin-4.png | Bin 1890 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-spin-5.png | Bin 1938 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-spin-6.png | Bin 1927 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-spin-7.png | Bin 1898 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-spin-8.png | Bin 1910 -> 0 bytes .../fancyzoom/images-global/zoom/zoom-spin-9.png | Bin 1901 -> 0 bytes javascript/fancyzoom/js-global/FancyZoom.js | 768 ------------ javascript/fancyzoom/js-global/FancyZoomHTML.js | 318 ----- 29 files changed, 3137 deletions(-) delete mode 100755 javascript/bitweaver.js delete mode 100755 javascript/class.JavaScriptPacker.php delete mode 100644 javascript/fancyzoom/images-global/zoom/closebox.png delete mode 100644 javascript/fancyzoom/images-global/zoom/spacer.gif delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-caption-fill.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-caption-l.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-caption-r.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-shadow1.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-shadow2.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-shadow3.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-shadow4.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-shadow5.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-shadow6.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-shadow7.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-shadow8.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-spin-1.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-spin-10.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-spin-11.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-spin-12.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-spin-2.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-spin-3.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-spin-4.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-spin-5.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-spin-6.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-spin-7.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-spin-8.png delete mode 100644 javascript/fancyzoom/images-global/zoom/zoom-spin-9.png delete mode 100644 javascript/fancyzoom/js-global/FancyZoom.js delete mode 100644 javascript/fancyzoom/js-global/FancyZoomHTML.js diff --git a/javascript/bitweaver.js b/javascript/bitweaver.js deleted file mode 100755 index 01b6834..0000000 --- a/javascript/bitweaver.js +++ /dev/null @@ -1,1323 +0,0 @@ -// $Header: /cvsroot/bitweaver/_bit_util/javascript/bitweaver.js,v 1.58 2010/05/31 14:36:33 spiderr Exp $ - -// please modify this file and leave plenty of comments. This file will be -// compressed automatically. Please make sure you only use comments beginning -// with '//' and put comments on separate lines otherwise the packer will choke - -// the beginning of the clean up of bitweaver core js - use name spaces -// if you are adding new features to this file add them to the BitBase object. -BitBase = { - // windowCenter and windowSize hacked based on http://www.demtron.com/blog/post/2009/01/14/Centering-a-DIV-Window-with-Cross-Browser-JavaScript.aspx - windowSize : function() - { - var w = 0; - var h = 0; - //IE - if(!window.innerWidth) - { - //strict mode - if(!(document.documentElement.clientWidth == 0)) - { - w = document.documentElement.clientWidth; - h = document.documentElement.clientHeight; - } - //quirks mode - else - { - w = document.body.clientWidth; - h = document.body.clientHeight; - } - } - //w3c - else - { - w = window.innerWidth; - h = window.innerHeight; - } - return {width:w,height:h}; - }, - - windowCenter : function(hWnd) - { - var _x = 0; - var _y = 0; - var offsetX = 0; - var offsetY = 0; - //IE - if(!window.pageYOffset) - { - //strict mode - if(!(document.documentElement.scrollTop == 0)) - { - offsetY = document.documentElement.scrollTop; - offsetX = document.documentElement.scrollLeft; - } - //quirks mode - else - { - offsetY = document.body.scrollTop; - offsetX = document.body.scrollLeft; - } - } - //w3c - else - { - offsetX = window.pageXOffset; - offsetY = window.pageYOffset; - } - _sz = BitBase.windowSize(); - _x = ((_sz.width-hWnd.width)/2)+offsetX; - _y = ((_sz.height-hWnd.height)/2)+offsetY; - return{x:_x,y:_y}; - }, - - // constants - // DATE - set in init() - // newWindow used in closeWin() - newWindow:null, - - //-- initialization --// - // desc: setup called at the end of this file - init: function(){ - var self = BitBase; - self.DATE = new Date(); - var tz_offset = -(self.DATE.getTimezoneOffset() * 60); - self.DATE.setFullYear(self.DATE.getFullYear() + 1); - self.setCookie("tz_offset", tz_offset); - self.setCookie("javascript_enabled", "y"); - }, - - deprecatedFunc: function ( funcName ){ - alert( 'Warning: Use of deprecated global function ' + funcName + ' use name space BitBase: BitBase.' + funcName ) - }, - - // Adds a function to be called at page load time - addLoadHook: function(func) { - if ( typeof window.addEventListener != "undefined" ) { - window.addEventListener( "load", func, false ); - } else if ( typeof window.attachEvent != "undefined" ) { - window.attachEvent( "onload", func ); - } else { - if ( window.onload != null ) { - var oldOnload = window.onload; - window.onload = function ( e ) { - oldOnload( e ); - func(e); - }; - } else { - window.onload = func(e); - } - } - }, - - //-- cookie coercion --// - // desc: Creates a Cookie - // params: name = the name of the cookie - // value = the value placed in the cookie - // [expires] (optional) = the expiration date of the cookie (defaults to end of current session) - // [path] (optional) = the path for which the cookie is valid (defaults to path of calling document) - // [domain] (optional) = the domain for which the cookie is valid (defaults to domain of calling document) - // [secure] (optional) = Boolean value indicating if the cookie transmission requires a secure transmission - // NOTE: * an argument defaults when it is assigned null as a placeholder - // * a null placeholder is not required for trailing omitted arguments - setCookie: function(name, value, expire, path, domain, secure) { - var self = BitBase; - var path = (path) ? path : bitCookiePath; - var domain = encodeURIComponent((domain) ? domain : bitCookieDomain); - var cookie_path = ((path) ? "; path=" + path : ""); - var cookie_domain = ((domain) ? "; domain=" + domain : ""); - var cookie_expire = ((expire)?expire:((self.DATE) ? "; expires=" + self.DATE.toGMTString() : "")); - var cookie_secure = ((secure) ? "; secure" : ""); - var curCookie = name + "=" + encodeURIComponent(value) - + cookie_path - + cookie_domain - + cookie_expire - + cookie_secure; - document.cookie = curCookie; - }, - - // desc: creates a cookie if required and sets the element in the array - // params: name - cookie name / key - in the cookie array / val - value to store - setCookieArray: function(name, key, val){ - var self = BitBase; - var curval = self.getCookie(name); - var newval; - if (curval != null) { - newval = self.unserialize(curval); - newval[key] = val; - } - else { - newval = new Array(); - newval[key] = val; - } - self.setCookie(name, BitBase.serialize(newval)); - }, - - // desc: Gets a Cookie and returns it's value - // params: name = the name of the desired cookie - getCookie: function(name) { - var dc = document.cookie; - var prefix = name + "="; - var begin = dc.indexOf("; " + prefix); - if (begin == -1) { - begin = dc.indexOf(prefix); - if (begin != 0) - return null; - } else begin += 2; - var end = document.cookie.indexOf(";", begin); - if (end == -1) - end = dc.length; - return unescape(dc.substring(begin + prefix.length, end)); - }, - - // desc: Returns a value from a key stored in an array in a cookie. - // params: name - cookie name / key - in the cookie array - getCookieArray: function(name, key) { - var self = BitBase; - var curval = self.getCookie(name); - var val; - if (curval != null) { - var arr = self.unserialize(curval); - val = arr[key]; - } - return val; - }, - - // desc: Deletes a Cookie - // params: name = the name of the cookie - // [path] (optional) = the path of the cookie (must be same path used when created) - // [domain] (optional) = the domain of the cookie (must be same domain used when created) - // NOTE: path and domain default if assigned null or omitted if no explicit argument proceeds - deleteCookie: function(name, path, domain) { - var self = BitBase; - var cookie_path = (path) ? path : bitCookiePath; - var cookie_domain = encodeURIComponent((domain) ? domain : bitCookieDomain); - if (self.getCookie(name)) { - document.cookie = name + "=" - + "; path=" + cookie_path + "; domain=" + cookie_domain + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; - } - }, - - //-- DOM coercion --// - // desc: returns a dom element - // parms: id - element id to look up or if id is an element it will be returned - getElement: function(id){ - if(typeof(id) == "string"){ - if(document.layers){ - return document.layers[id]; - }else if(document.all){ - return document.all[id]; - }else if(document.getElementById){ - return document.getElementById(id); - } - } - return id; - }, - - // desc: sets display style - // params: elm a DOM element or id / val the style value to toggle / useCookie to persist the setting - setElementDisplay: function( elm, val, useCookie ){ - var self = BitBase; - var obj = self.getElement( elm ); - if( obj != null ){ obj.style.display=val; } - if (useCookie && obj.id) { self.setCookieArray('showhide', obj.id, (val=='none'?"c":"o")); } - }, - - // desc: toggles an element's style between the value and none - // params: elm a DOM element or id / val the style value to toggle / useCookie to persist the setting - toggleElementDisplay: function( elm, val, useCookie ){ - var self = BitBase; - var obj = self.getElement( elm ); - if( typeof(val) == 'undefined' ) { - val = 'block'; - } - var value = obj.style.display == 'none'?val:'none'; - self.setElementDisplay( obj, value, useCookie ); - return value != 'none'; - }, - - // desc: convenience - // params: elm - ad DOM element or id / useCookie = any value (not 0 or null) to turn cookies on - showById: function( elm, useCookie ) { - BitBase.setElementDisplay( elm, 'block', useCookie ); - }, - - // desc: convenience - // params: elm - ad DOM element or id / useCookie = any value (not 0 or null) to turn cookies on - hideById: function( elm, useCookie) { - BitBase.setElementDisplay( elm, 'none', useCookie ); - }, - - // shows or hides based on the showhide cookie - setupShowHide: function() { - var self = BitBase; - var curval = self.getCookie('showhide'); - if (curval != null) { - var ids = self.unserialize(curval); - for (id in ids) { - if (ids[id] == "o") { - self.showById(id); - } - else { - self.hideById(id); - } - } - } - }, - - // desc: Toggles the visibility of dynamic variable passed to it - // params: name - toggleDynamicVar: function(name) { - var self = BitBase; - var elm1 = self.getElement('dyn_'+name+'_display'); - var elm2 = self.getElement('dyn_'+name+'_edit'); - if(elm1.style.display == "none") { - elm2.style.display = "none"; - elm1.style.display = "inline"; - } else { - elm1.style.display = "none"; - elm2.style.display = "inline"; - } - }, - - // desc: convenience - showSpinner: function() { - // Center the spinner - div = document.getElementById( 'spinner' ); - w = div.style.width.replace(/[a-z]/gi, ''); - h = div.style.height.replace(/[a-z]/gi,''); - center = BitBase.windowCenter({width: w, height: h}); - div.style.top = center.y + "px"; - div.style.left = center.x + "px" - // show the spinner and overlay. - BitBase.setElementDisplay( 'spinner_overlay', 'block' ); - BitBase.setElementDisplay( 'spinner', 'block'); - }, - - // desc: convenience - hideSpinner: function() { - BitBase.setElementDisplay( 'spinner','none' ); - BitBase.setElementDisplay( 'spinner_overlay','none' ); - }, - - // desc: No Idea - used by insertAt - setSelectionRange: function(textarea, selectionStart, selectionEnd) { - if (textarea.setSelectionRange) { - textarea.focus(); - textarea.setSelectionRange(selectionStart, selectionEnd); - } else if (textarea.createTextRange) { - var range = textarea.createTextRange(); - textarea.collapse(true); - textarea.moveEnd('character', selectionEnd); - textarea.moveStart('character', selectionStart); - textarea.select(); - } - }, - - // desc: No Idea - used by insertAt - setCaretToPos: function(textarea, pos) { - BitBase.setSelectionRange(textarea, pos, pos); - }, - - // desc: inserts replaceString in elementId - used by QuickTags & Plugin Help - // params: elementId = a HTML Id / replaceString = string - insertAt: function(elementId, replaceString) { - var self = BitBase; - //inserts given text at selection or cursor position - //substrings in replaceString to be replaced by the selection if a selection was done - var toBeReplaced = /text|page|textarea_id/; - - // FCKEditor is completely different - if (document.FCKEditorLoaded) { - oEditor = FCKeditorAPI.GetInstance(elementId); - // Check if it is a fckeditor. If not fall back on old code. - if (oEditor) { - // Fetching selection can't be done through the 'Selection'. Stupid. - if (document.all) { - oSel = oEditor.EditorDocument.selection.createRange().text; - } else { - oSel = oEditor.EditorWindow.getSelection(); - } - // Convert oSel to a string. - oSel = "" + oSel; - if (oSel.length > 0) { - replaceString = replaceString.replace(toBeReplaced, oSel); - // Delete selection - oEditor.Selection.Delete(); - } - oEditor.InsertHtml(replaceString); - return; - } - } - - var textarea = document.getElementById(elementId); - - if (textarea.setSelectionRange) { - //Mozilla UserAgent Gecko-1.4 - var selectionStart = textarea.selectionStart; - var selectionEnd = textarea.selectionEnd; - // has there been a selection - if (selectionStart != selectionEnd) { - var newString = replaceString.replace(toBeReplaced, textarea.value.substring(selectionStart, selectionEnd)); - textarea.value = textarea.value.substring(0, selectionStart) - + newString - + textarea.value.substring(selectionEnd); - self.setSelectionRange(textarea, selectionStart, selectionStart + newString.length); - // set caret - } else { - textarea.value = textarea.value.substring(0, selectionStart) - + replaceString - + textarea.value.substring(selectionEnd); - self.setCaretToPos(textarea, selectionStart + replaceString.length); - } - } else if (document.selection) { - //UserAgent IE-6.0 - textarea.focus(); - var range = document.selection.createRange(); - if (range.parentElement() == textarea) { - var isCollapsed = range.text == ''; - if (! isCollapsed) { - range.text = replaceString.replace(toBeReplaced, range.text); - range.moveStart('character', -range.text.length); - range.select(); - } else { - range.text = replaceString; - } } - } else { - //UserAgent Gecko-1.0.1 (NN7.0) - var obj = self.getElement(elementId); - obj.getElement(elementId).value = obj.value + replaceString; - //alert("don't know yet how to handle insert" + document); - } - }, - - // function: flipMulti - // desc: Toggles visibility for multiple HTML elements - can be used with an HTML Selector - // On the first call - Shows the window id's defined by (header) & (numbr) & saves them in a variable - // On subsequent calls - Hide the saved windows and shows the new windows - // added by: StarRider - // date: 1/5/06 - // Note For Cross-Browser compatibility - An HTML elements id's must begin with a Letter or String. - // Operates by appending a string (header) with the number (numbr) to show/hide the window id. - // With multiple windows - the id's need to be sequencial eg. each id is 1 greater than the last - // with the first being (numbr). - // example: When used in a tpl file with div elements: $header='dog'; - // / the id is "dog1" - // / the id is "dog2" - // The Selector: , and . - // params: elm - an element or id - /* - Script by RoBorg - RoBorg@geniusbug.com - http://javascript.geniusbug.com | http://www.roborg.co.uk - Please do not remove or edit this message - Please link to this website if you use this script! - */ - getElementValue: function(elm){ - if(formElement = BitBase.getElement(elm)) { - if(formElement.length != null) { - var type = formElement[0].type; - } - if((typeof(type) == 'undefined') || (type == 0)) { - var type = formElement.type; - } - - switch(type) - { - case 'undefined': return; - - case 'radio': - for(var x=0; x < formElement.length; x++) { - if(formElement[x].checked == true) { - return formElement[x].value; - } - } - break; - - case 'select-multiple': - var myArray = new Array(); - for(var x=0; x < formElement.length; x++) - if(formElement[x].selected == true) - myArray[myArray.length] = formElement[x].value; - return myArray; - - case 'checkbox': return formElement.checked; - - default: return formElement.value; - } - } - }, - - // desc: set the value of form elements: , and . - // params: elm - an element or id, value to set form to - /* - Script by RoBorg - RoBorg@geniusbug.com - http://javascript.geniusbug.com | http://www.roborg.co.uk - Please do not remove or edit this message - Please link to this website if you use this script! - */ - setElementValue: function(elm, value){ - if(formElement = BitBase.getElement(elm)) { - switch(formElement.type) - { - case 'undefined': return; - case 'radio': formElement.checked = value; break; - case 'checkbox': formElement.checked = value; break; - case 'select-one': formElement.selectedIndex = value; break; - - case 'select-multiple': - for(var x=0; x < formElement.length; x++) - formElement[x].selected = value[x]; - break; - - default: formElement.value = value; break; - } - } - }, - - // function: switchCheckboxes - // desc: Will Check / Uncheck all Checkboxes - // params: the_form = a HTML Id of a form - // elements_name = the name of the checkbox / see note - // switcher_name = UNKNOWN - // NOTE: checkboxes need to have the same name as elements_name - // Example: , will arrive as Array in php. - switchCheckboxes: function(the_form, elements_name, switcher_name) { - var elements = document.getElementById(the_form).elements[elements_name]; - var elements_cnt = ( typeof (elements.length) != 'undefined') ? elements.length : 0; - - if (elements_cnt) { - for (var i = 0; i < elements_cnt; i++) { - elements[i].checked = document.forms[the_form].elements[switcher_name].checked; - } - } else { - elements.checked = document.forms[the_form].elements[switcher_name].checked; - } - return true; - }, - - // desc: disable form stuff after submission - // params: id = a HTML Id - // note: a button you disable with this function will not appear in $_REQUEST - disableSubmit: function(id) { - if(document.getElementById) { - // this is the way the standards work - document.getElementById(id).disabled = true; - document.getElementById(id).value = "Please Wait..."; - } else if(document.all) { - // this is the way old msie versions work - document.all[id].disabled = true; - } else if(document.layers) { - // this is the way nn4 works - document.layers[id].disabled = true; - } - }, - - // desc: added for use in navigation dropdown - // params: elementId = a HTML Id - // Example: - go: function(o) { - if (o.options[o.selectedIndex].value != "") { - location = o.options[o.selectedIndex].value; - } - return false; - }, - - // desc: Closes the window stored in newWindow - used by popUpWin - // params: None - closeWin: function(){ - var self = BitBase; - if (self.newWindow != null) - if(!self.newWindow.closed) self.newWindow.close(); - }, - - // function: popUpWin - // desc: span a new window which is XHTML 1.0 Strict compliant and in accordance with WCAG - // params: url: the url for the new window - // type: standard or fullscreen - // strWidth: width of the window - // strHeight: height of the spawned window - // usage: {tr}FooBar{/tr} - popUpWin: function(url, type, strWidth, strHeight) { - var self = BitBase; - self.closeWin(); - if (type == "fullScreen") { - strWidth = screen.availWidth - 10; - strHeight = screen.availHeight - 160; - } - var tools=""; - if (type == "standard" || type == "fullScreen") tools = "resizable,toolbar=no,location=no,scrollbars=yes,menubar=no,width="+strWidth+",height="+strHeight+",top=0,left=0"; - if (type == "console") tools = "resizable,toolbar=no,location=no,scrollbars=yes,width="+strWidth+",height="+strHeight+",left=0,top=0"; - self.newWindow = window.open(url, 'newWin', tools); - self.newWindow.focus(); - }, - - // swiped from this page: http://www.onicos.com/staff/iz/amuse/javascript/expert/utf.txt - // utf.js - UTF-8 <=> UTF-16 convertion - // - // Copyright (C) 1999 Masanao Izumo - // Version: 1.0 - // LastModified: Dec 25 1999 - // This library is free. You can redistribute it and/or modify it. - - // Interfaces: - // utf8 = utf16to8(utf16); - // utf16 = utf16to8(utf8); - utf16to8: function(str) { - var out, i, len, c; - - out = ""; - len = str.length; - for(i = 0; i < len; i++) { - c = str.charCodeAt(i); - if ((c >= 0x0001) && (c <= 0x007F)) { - out += str.charAt(i); - } else if (c > 0x07FF) { - out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F)); - out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F)); - out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F)); - } else { - out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F)); - out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F)); - } - } - return out; - }, - - utf8to16: function(str) { - var out, i, len, c; - var char2, char3; - - out = ""; - len = str.length; - i = 0; - while(i < len) { - c = str.charCodeAt(i++); - switch(c >> 4) - { - case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: - // 0xxxxxxx - out += str.charAt(i-1); - break; - case 12: case 13: - // 110x xxxx 10xx xxxx - char2 = str.charCodeAt(i++); - out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F)); - break; - case 14: - // 1110 xxxx 10xx xxxx 10xx xxxx - char2 = str.charCodeAt(i++); - char3 = str.charCodeAt(i++); - out += String.fromCharCode(((c & 0x0F) << 12) | - ((char2 & 0x3F) << 6) | - ((char3 & 0x3F) << 0)); - break; - } - } - - return out; - }, - - // swiped from this page: http://www.coolcode.cn/?p=171 - // - // phpserializer.js - JavaScript to PHP serialize / unserialize class. - // - // This class is designed to convert php variables to javascript - // and javascript variables to php with a php serialize unserialize - // compatible way. - // - // Copyright (C) 2006 Ma Bingyao - // Version: 3.0f - // LastModified: Nov 30, 2006 - // This library is free. You can redistribute it and/or modify it. - // http://www.coolcode.cn/?p=171 - - serialize: function(o) { - var self = BitBase; - var p = 0, sb = [], ht = [], hv = 1; - var classname = function(o) { - if (typeof(o) == "undefined" || typeof(o.constructor) == "undefined") return ''; - var c = o.constructor.toString(); - c = self.utf16to8(c.substr(0, c.indexOf('(')).replace(/(^\s*function\s*)|(\s*$)/ig, '')); - return ((c == '') ? 'Object' : c); - }; - var is_int = function(n) { - var s = n.toString(), l = s.length; - if (l > 11) return false; - for (var i = (s.charAt(0) == '-') ? 1 : 0; i < l; i++) { - switch (s.charAt(i)) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': break; - default : return false; - } - } - return !(n < -2147483648 || n > 2147483647); - }; - var in_ht = function(o) { - for (k in ht) if (ht[k] === o) return k; - return false; - }; - var ser_null = function() { - sb[p++] = 'N;'; - }; - var ser_boolean = function(b) { - sb[p++] = (b ? 'b:1;' : 'b:0;'); - }; - var ser_integer = function(i) { - sb[p++] = 'i:' + i + ';'; - }; - var ser_double = function(d) { - if (isNaN(d)) d = 'NAN'; - else if (d == Number.POSITIVE_INFINITY) d = 'INF'; - else if (d == Number.NEGATIVE_INFINITY) d = '-INF'; - sb[p++] = 'd:' + d + ';'; - }; - var ser_string = function(s) { - var utf8 = self.utf16to8(s); - sb[p++] = 's:' + utf8.length + ':"'; - sb[p++] = utf8; - sb[p++] = '";'; - }; - var ser_array = function(a) { - sb[p++] = 'a:'; - var lp = p; - sb[p++] = 0; - sb[p++] = ':{'; - for (var k in a) { - if (typeof(a[k]) != 'function') { - is_int(k) ? ser_integer(k) : ser_string(k); - __serialize(a[k]); - sb[lp]++; - } - } - sb[p++] = '}'; - }; - var ser_object = function(o) { - var cn = classname(o); - if (cn == '') ser_null(); - else if (typeof(o.serialize) != 'function') { - sb[p++] = 'O:' + cn.length + ':"'; - sb[p++] = cn; - sb[p++] = '":'; - var lp = p; - sb[p++] = 0; - sb[p++] = ':{'; - if (typeof(o.__sleep) == 'function') { - var a = o.__sleep(); - for (var kk in a) { - ser_string(a[kk]); - __serialize(o[a[kk]]); - sb[lp]++; - } - } - else { - for (var k in o) { - if (typeof(o[k]) != 'function') { - ser_string(k); - __serialize(o[k]); - sb[lp]++; - } - } - } - sb[p++] = '}'; - } - else { - var cs = o.serialize(); - sb[p++] = 'C:' + cn.length + ':"'; - sb[p++] = cn; - sb[p++] = '":' + cs.length + ':{'; - sb[p++] = cs; - sb[p++] = "}"; - } - }; - var ser_pointref = function(R) { - sb[p++] = "R:" + R + ";"; - }; - var ser_ref = function(r) { - sb[p++] = "r:" + r + ";"; - }; - var __serialize = function(o) { - if (o == null || o.constructor == Function) { - hv++; - ser_null(); - } - else switch (o.constructor) { - case Boolean: { - hv++; - ser_boolean(o); - break; - } - case Number: { - hv++; - is_int(o) ? ser_integer(o) : ser_double(o); - break; - } - case String: { - hv++; - ser_string(o); - break; - } - // @cc_on @ - // @if (@_jscript) - // case VBArray: { - // o = o.toArray(); - // } - // @end @ - case Array: { - var r = in_ht(o); - if (r) { - ser_pointref(r); - } - else { - ht[hv++] = o; - ser_array(o); - } - break; - } - default: { - var r = in_ht(o); - if (r) { - hv++; - ser_ref(r); - } - else { - ht[hv++] = o; - ser_object(o); - } - break; - } - } - }; - __serialize(o); - return sb.join(''); - }, - - unserialize: function(ss) { - var self = BitBase; - var p = 0, ht = [], hv = 1; r = null; - var unser_null = function() { - p++; - return null; - }; - var unser_boolean = function() { - p++; - var b = (ss.charAt(p++) == '1'); - p++; - return b; - }; - var unser_integer = function() { - p++; - var i = parseInt(ss.substring(p, p = ss.indexOf(';', p))); - p++; - return i; - }; - var unser_double = function() { - p++; - var d = ss.substring(p, p = ss.indexOf(';', p)); - switch (d) { - case 'NAN': d = NaN; break; - case 'INF': d = Number.POSITIVE_INFINITY; break; - case '-INF': d = Number.NEGATIVE_INFINITY; break; - default: d = parseFloat(d); - } - p++; - return d; - }; - var unser_string = function() { - p++; - var l = parseInt(ss.substring(p, p = ss.indexOf(':', p))); - p += 2; - var s = self.utf8to16(ss.substring(p, p += l)); - p += 2; - return s; - }; - var unser_array = function() { - p++; - var n = parseInt(ss.substring(p, p = ss.indexOf(':', p))); - p += 2; - var a = []; - ht[hv++] = a; - for (var i = 0; i < n; i++) { - var k; - switch (ss.charAt(p++)) { - case 'i': k = unser_integer(); break; - case 's': k = unser_string(); break; - case 'U': k = unser_unicode_string(); break; - default: return false; - } - a[k] = __unserialize(); - } - p++; - return a; - }; - var unser_object = function() { - p++; - var l = parseInt(ss.substring(p, p = ss.indexOf(':', p))); - p += 2; - var cn = self.utf8to16(ss.substring(p, p += l)); - p += 2; - var n = parseInt(ss.substring(p, p = ss.indexOf(':', p))); - p += 2; - if (eval(['typeof(', cn, ') == "undefined"'].join(''))) { - eval(['function ', cn, '(){}'].join('')); - } - var o = eval(['new ', cn, '()'].join('')); - ht[hv++] = o; - for (var i = 0; i < n; i++) { - var k; - switch (ss.charAt(p++)) { - case 's': k = unser_string(); break; - case 'U': k = unser_unicode_string(); break; - default: return false; - } - // the \0 breaks the javascript packer - it outputs \ and the 0 is missing. - // \1 works fine though. perhaps we can fix the packer or find a way not to use \0 here - //if (k.charAt(0) == '\0') { - // k = k.substring(k.indexOf('\0', 1) + 1, k.length); - //} - o[k] = __unserialize(); - } - p++; - if (typeof(o.__wakeup) == 'function') o.__wakeup(); - return o; - }; - var unser_custom_object = function() { - p++; - var l = parseInt(ss.substring(p, p = ss.indexOf(':', p))); - p += 2; - var cn = self.utf8to16(ss.substring(p, p += l)); - p += 2; - var n = parseInt(ss.substring(p, p = ss.indexOf(':', p))); - p += 2; - if (eval(['typeof(', cn, ') == "undefined"'].join(''))) { - eval(['function ', cn, '(){}'].join('')); - } - var o = eval(['new ', cn, '()'].join('')); - ht[hv++] = o; - if (typeof(o.unserialize) != 'function') p += n; - else o.unserialize(ss.substring(p, p += n)); - p++; - return o; - }; - var unser_unicode_string = function() { - p++; - var l = parseInt(ss.substring(p, p = ss.indexOf(':', p))); - p += 2; - var sb = []; - for (var i = 0; i < l; i++) { - if ((sb[i] = ss.charAt(p++)) == '\\') { - sb[i] = String.fromCharCode(parseInt(ss.substring(p, p += 4), 16)); - } - } - p += 2; - return sb.join(''); - }; - var unser_ref = function() { - p++; - var r = parseInt(ss.substring(p, p = ss.indexOf(';', p))); - p++; - return ht[r]; - }; - var __unserialize = function() { - switch (ss.charAt(p++)) { - case 'N': return ht[hv++] = unser_null(); - case 'b': return ht[hv++] = unser_boolean(); - case 'i': return ht[hv++] = unser_integer(); - case 'd': return ht[hv++] = unser_double(); - case 's': return ht[hv++] = unser_string(); - case 'U': return ht[hv++] = unser_unicode_string(); - case 'r': return ht[hv++] = unser_ref(); - case 'a': return unser_array(); - case 'O': return unser_object(); - case 'C': return unser_custom_object(); - case 'R': return unser_ref(); - default: return false; - } - }; - return __unserialize(); - }, - // end swipe - - // params: w1 / w2 / w3 - genPass: function(w1, w2, w3) { - var vo = "aeiouAEU"; - var co = "bcdfgjklmnprstvwxzBCDFGHJKMNPQRSTVWXYZ0123456789#"; - var s = Math.round(Math.random()); - var l = 12; - var p = ''; - var has_num = false; - for (i = 0; i < l; i++) { - if (s) { - letter = vo.charAt(Math.round(Math.random() * (vo.length - 1))); - s = 0; - } else { - letter = co.charAt(Math.round(Math.random() * (co.length - 1))); - s = 1; - } - - if( ! isNaN( letter ) ) // Keep track of weather we put a number in the password - has_num = true; - - p = p + letter; - } - - if( ! has_num ) // If we never put a number in the password we'll put one in a random place now - p = p.replace( p.charAt( Math.round(Math.random() * p.length - 1 ) ), Math.round(Math.random() * 9 ) ); - - document.getElementById(w1).value = p; - document.getElementById(w2).value = p; - document.getElementById(w3).value = p; - }, - - /** - * XHConn - Simple XMLHTTP Interface - bfults@gmail.com - 2005-04-08 ** - * Code licensed under Creative Commons Attribution-ShareAlike License ** - * http://creativecommons.org/licenses/by-sa/2.0/ ** - * - * var fnWhenDone = function ( pResponse ) { - * alert( pResponse.responseText ); - * }; - * var ajax = new BitBase.SimpleAjax(); - * ajax.connect("mypage.php", "foo=bar&baz=qux", fnWhenDone, "POST"); - * }; - * - **/ - SimpleAjax: function() { - var xmlhttp, bComplete = false; - try { - xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); - } - catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } - catch (e) { try { xmlhttp = new XMLHttpRequest(); } - catch (e) { xmlhttp = false; }}} - if (!xmlhttp) return null; - this.connect = function(sURL, sVars, fnDone, sMethod) { - if (!xmlhttp) return false; - bComplete = false; - sMethod = sMethod || 'POST'; - sMethod = sMethod.toUpperCase(); - - try { - if (sMethod == "GET") { - xmlhttp.open(sMethod, sURL+"?"+sVars, true); - sVars = ""; - } else { - xmlhttp.open(sMethod, sURL, true); - xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1"); - xmlhttp.setRequestHeader("Content-Type", - "application/x-www-form-urlencoded"); - } - xmlhttp.onreadystatechange = function() { - if (xmlhttp.readyState == 4 && !bComplete) { - bComplete = true; - fnDone(xmlhttp); - } - }; - xmlhttp.setRequestHeader('X_REQUESTED_WITH', 'XMLHttpRequest'); - xmlhttp.send(sVars); - } - catch(z) { return false; } - return true; - }; - this.update = function( pUpdateEleId, sURL, sVars, sMethod ) { - this.connect( sURL, sVars, function( pResponse ) { document.getElementById( pUpdateEleId ).innerHTML = pResponse.responseText; }, sMethod ); - }; - return this; - }, - - evalJSON: function ( j ) { - return eval("(" + j + ")"); - }, - - /** - * Extremely lightweight fixIEDropMenu function to support css drop menus for all browsers without need for 30K of fixes/ie7.js - **/ - fixIEDropMenu: function( pMenuId ) { - if(document.getElementById(pMenuId)){ - var menuItems = document.getElementById(pMenuId).getElementsByTagName("LI"); - for( var i=0; i< menuItems.length; i++ ) { - menuItems[i].onmouseover = function() { - this.className += " iemenuhover"; - }; - menuItems[i].onmouseout = function() { - this.className = this.className.replace(new RegExp(" iemenuhover\\b"), ""); - }; - /* In IE6 brute add iframes to anything that might have a z-index - someone else can narrow this better it doesn't need to be on all LIs */ - BitBase.bgIframe( menuItems[i] ); - } - } - }, - - /** - * This mess right here ads an iframe behind any element you need to float over selects in that POS IE6 - **/ - bgIframe: function(e, s) { - /* This is only for IE6 */ - if( document.all && (navigator.userAgent.toLowerCase().indexOf("msie 6.") != -1) ){ - /* @TODO enable override of params */ - s = { - top : 'auto', /* auto == .currentStyle.borderTopWidth */ - left : 'auto', /* auto == .currentStyle.borderLeftWidth */ - width : 'auto', /* auto == offsetWidth */ - height : 'auto', /* auto == offsetHeight */ - opacity : true, - src : 'javascript:void(0);' - }; - - var prop = function(n){return n&&n.constructor==Number?n+'px':n;}, - html = ''; - e.innerHTML = html+e.innerHTML; - } - }, - - /** - * This common short cut can raise all kinds of hell, since it behaves differently for different Ajax libraries - * in particularly, jQuery which does things like $('.someclass') to address multiple elements. - * - * It's use is strongly discouraged, particularly in distro'ed packages - **/ - - $: 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; - }, - - // NOTICE: this only appears to be used in quicktags - put it there - // function: textareasize - // desc: Modifies the dimensions of a textarea - // date: Pre-bitweaver - // params: elementId = a HTML Id to a textarea - // height = nb pixels to add to the height (the number can be negative) - // width = nb pixels to add to the width - // formid = a HTML Id to form - see Note: - // Note: * The form must have 2 input rows and cols - textareasize: function(elementId, height) { - textarea = document.getElementById( elementId ); - if (textarea && height != 0 && textarea.rows + height > 5) { - textarea.rows += height; - BitBase.setCookie('rows', textarea.rows); - } - }, - - - parseQueryString: function(queryString) { - var data = {}; - var pairs = queryString.split('&'); - for (var i = 0; i < pairs.length; i++) { - var pair = pairs[i].split('='); - data[pair[0]] = pair[1]; - } - return data; - }, - - updater: function(target, url, queryString) { - BitBase.showSpinner(); - var data = BitBase.parseQueryString(queryString); - $.ajax({ - type: 'GET', - url: url, - data: data, - async: true, - success: function(html) { - // create a placeholder element if it doesn't exist - if (!$('#' + target).length) { - $('
').appendTo('body'); - } - // update the placeholder element with the HTML content - $('#' + target).html(html); - BitBase.hideSpinner(); - }, - error: function(xhr, status, error) { - // handle the error - console.error("Error updating target: " + error); - } - }); - }, - -}; - -// init -BitBase.init(); diff --git a/javascript/class.JavaScriptPacker.php b/javascript/class.JavaScriptPacker.php deleted file mode 100755 index 635d1f5..0000000 --- a/javascript/class.JavaScriptPacker.php +++ /dev/null @@ -1,728 +0,0 @@ -pack(); - * - * or - * - * $myPacker = new JavaScriptPacker($script, 'Normal', true, false); - * $packed = $myPacker->pack(); - * - * or (default values) - * - * $myPacker = new JavaScriptPacker($script); - * $packed = $myPacker->pack(); - * - * - * params of the constructor : - * $script: the JavaScript to pack, string. - * $encoding: level of encoding, int or string : - * 0,10,62,95 or 'None', 'Numeric', 'Normal', 'High ASCII'. - * default: 62. - * $fastDecode: include the fast decoder in the packed result, boolean. - * default : true. - * $specialChars: if you are flagged your private and local variables - * in the script, boolean. - * default: false. - * - * The pack() method return the compressed JavasScript, as a string. - * - * see http://dean.edwards.name/packer/usage/ for more information. - * - * Notes : - * # [del]need PHP 5 . Tested with PHP 5.1.2[/del] - * this is a modified version for PHP 4 - * - * # The packed result may be different than with the Dean Edwards - * version, but with the same length. The reason is that the PHP - * function usort to sort array don't necessarily preserve the - * original order of two equal member. The Javascript sort function - * in fact preserve this order (but that's not require by the - * ECMAScript standard). So the encoded keywords order can be - * different in the two results. - * - * # Be careful with the 'High ASCII' Level encoding if you use - * UTF-8 in your files... - */ - - /* - * modified by Mark Fabrizio Jr. to work with php 4 - */ - -class JavaScriptPacker { - var $IGNORE = "$1"; - - // validate parameters - var $_script = ""; - var $_encoding = 62; - var $_fastDecode = true; - var $_specialChars = false; - - var $LITERAL_ENCODING = [ - "None" => 0, - "Numeric" => 10, - "Normal" => 62, - "High ASCII" => 95, - ]; - - function JavaScriptPacker($_script, $_encoding = 62, $_fastDecode = true, $_specialChars = false) - { - $this->_script = $_script . "\n"; - if (array_key_exists($_encoding, $this->LITERAL_ENCODING)) - $_encoding = $this->LITERAL_ENCODING[$_encoding]; - $this->_encoding = min((int)$_encoding, 95); - $this->_fastDecode = $_fastDecode; - $this->_specialChars = $_specialChars; - } - - function pack() { - $this->_addParser("_basicCompression"); - if ($this->_specialChars) - $this->_addParser("_encodeSpecialChars"); - if ($this->_encoding) - $this->_addParser("_encodeKeywords"); - - // go! - return $this->_pack($this->_script); - } - - // apply all parsing routines - function _pack($script) { - for ($i = 0; isset($this->_parsers[$i]); $i++) { - $script = call_user_func([&$this,$this->_parsers[$i]], $script); - } - return $script; - } - - // keep a list of parsing functions, they'll be executed all at once - var $_parsers = []; - function _addParser($parser) { - $this->_parsers[] = $parser; - } - - // zero encoding - just removal of white space and comments - function _basicCompression($script) { - $parser = new ParseMaster(); - // make safe - $parser->escapeChar = '\\'; - // protect strings - $parser->add('/\'[^\'\\n\\r]*\'/',$this->IGNORE); - $parser->add('/"[^"\\n\\r]*"/', $this->IGNORE); - // remove comments - $parser->add('/\\/\\/[^\\n\\r]*[\\n\\r]/', " "); - $parser->add('/\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\//', " "); - // protect regular expressions - $parser->add('/\\s+(\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/g?i?)/', "$2"); // IGNORE - $parser->add('/[^\\w\\x24\\/\'"*)\\?:]\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/g?i?/', $this->IGNORE); - // remove: ;;; doSomething(); - if ($this->_specialChars) $parser->add('/;;;[^\\n\\r]+[\\n\\r]/'); - // remove redundant semi-colons - $parser->add('/\\(;;\\)/', $this->IGNORE); // protect for (;;) loops - $parser->add('/;+\\s*([};])/', "$2"); - // apply the above - $script = $parser->exec($script); - - // remove white-space - $parser->add('/(\\b|\\x24)\\s+(\\b|\\x24)/', "$2 $3"); - $parser->add('/([+\\-])\\s+([+\\-])/', "$2 $3"); - $parser->add('/\\s+/', ""); - // done - return $parser->exec($script); - } - - function _encodeSpecialChars($script) { - $parser = new ParseMaster(); - // replace: $name -> n, $$name -> na - $parser->add('/((\\x24+)([a-zA-Z$_]+))(\\d*)/', - ["fn" => "_replace_name"], - ); - // replace: _name -> _0, double-underscore (__name) is ignored - $regexp = '/\\b_[A-Za-z\\d]\\w*/'; - // build the word list - $keywords = $this->_analyze($script, $regexp, "_encodePrivate"); - // quick ref - $encoded = $keywords["encoded"]; - - $parser->add($regexp, - [ - "fn" => "_replace_encoded", - "data" => $encoded, - ], - ); - return $parser->exec($script); - } - - function _encodeKeywords($script) { - // escape high-ascii values already in the script (i.e. in strings) - if ($this->_encoding > 62) - $script = $this->_escape95($script); - // create the parser - $parser = new ParseMaster(); - $encode = $this->_getEncoder($this->_encoding); - // for high-ascii, don't encode single character low-ascii - $regexp = ($this->_encoding > 62) ? '/\\w\\w+/' : '/\\w+/'; - // build the word list - $keywords = $this->_analyze($script, $regexp, $encode); - $encoded = $keywords["encoded"]; - - // encode - $parser->add($regexp, - [ - "fn" => "_replace_encoded", - "data" => $encoded, - ], - ); - if (empty($script)) return $script; - - //$res = $parser->exec($script); - //$res = $this->_bootStrap($res, $keywords); - //return $res; - return $this->_bootStrap($parser->exec($script), $keywords); - - } - - function _analyze($script, $regexp, $encode) { - // analyse - // retreive all words in the script - $all = []; - preg_match_all($regexp, $script, $all); - $_sorted = []; // list of words sorted by frequency - $_encoded = []; // dictionary of word->encoding - $_protected = []; // instances of "protected" words - $all = $all[0]; // simulate the javascript comportement of global match - if (!empty($all)) { - $unsorted = []; // same list, not sorted - $protected = []; // "protected" words (dictionary of word->"word") - $value = []; // dictionary of charCode->encoding (eg. 256->ff) - $this->_count = []; // word->count - $i = count($all); $j = 0; //$word = null; - // count the occurrences - used for sorting later - do { - --$i; - $word = "$" . $all[$i]; - if (!isset($this->_count[$word])) { - $this->_count[$word] = 0; - $unsorted[$j] = $word; - // make a dictionary of all of the protected words in this script - // these are words that might be mistaken for encoding - //if (is_string($encode) && method_exists($this, $encode)) - $values[$j] = call_user_func([&$this, $encode], $j); - $protected["$" . $values[$j]] = $j++; - } - // increment the word counter - $this->_count[$word]++; - } while ($i > 0); - // prepare to sort the word list, first we must protect - // words that are also used as codes. we assign them a code - // equivalent to the word itself. - // e.g. if "do" falls within our encoding range - // then we store keywords["do"] = "do"; - // this avoids problems when decoding - $i = count($unsorted); - do { - $word = $unsorted[--$i]; - if (isset($protected[$word]) /*!= null*/) { - $_sorted[$protected[$word]] = substr($word, 1); - $_protected[$protected[$word]] = true; - $this->_count[$word] = 0; - } - } while ($i); - - // sort the words by frequency - // Note: the javascript and php version of sort can be different : - // in php manual, usort : - // " If two members compare as equal, - // their order in the sorted array is undefined." - // so the final packed script is different of the Dean's javascript version - // but equivalent. - // the ECMAscript standard does not guarantee this behaviour, - // and thus not all browsers (e.g. Mozilla versions dating back to at - // least 2003) respect this. - usort($unsorted, [&$this, "_sortWords"]); - $j = 0; - // because there are "protected" words in the list - // we must add the sorted words around them - do { - if (!isset($_sorted[$i])) - $_sorted[$i] = substr($unsorted[$j++], 1); - $_encoded[$_sorted[$i]] = $values[$i]; - } while (++$i < count($unsorted)); - } - return [ - "sorted" => $_sorted, - "encoded" => $_encoded, - "protected" => $_protected, ]; - } - - var $_count = []; - function _sortWords($match1, $match2) { - return $this->_count[$match2] - $this->_count[$match1]; - } - - // build the boot function used for loading and decoding - function _bootStrap($packed, $keywords) { - $ENCODE = $this->_safeRegExp('$encode\\($count\\)'); - - // $packed: the packed script - $packed = "'" . $this->_escape($packed) . "'"; - - // $ascii: base for encoding - $ascii = min(count($keywords["sorted"]), $this->_encoding); - if ($ascii == 0) $ascii = 1; - - // $count: number of words contained in the script - $count = count($keywords["sorted"]); - - // $keywords: list of words contained in the script - foreach ($keywords["protected"] as $i=>$value) { - $keywords["sorted"][$i] = ""; - } - // convert from a string to an array - ksort($keywords["sorted"]); - $keywords = "'" . implode("|",$keywords["sorted"]) . "'.split('|')"; - - $encode = ($this->_encoding > 62) ? "_encode95" : $this->_getEncoder($ascii); - $encode = $this->_getJSFunction($encode); - $encode = preg_replace("/_encoding/","$ascii", $encode); - $encode = preg_replace('/arguments\\.callee/',"$encode", $encode); - $inline = '\\$count' . ($ascii > 10 ? '.toString(\\$ascii)' : ""); - - // $decode: code snippet to speed up decoding - if ($this->_fastDecode) { - // create the decoder - $decode = $this->_getJSFunction("_decodeBody"); - if ($this->_encoding > 62) - $decode = preg_replace('/\\\\w/', '[\\xa1-\\xff]', $decode); - // perform the encoding inline for lower ascii values - elseif ($ascii < 36) - $decode = preg_replace($ENCODE, $inline, $decode); - // special case: when $count==0 there are no keywords. I want to keep - // the basic shape of the unpacking funcion so i'll frig the code... - if ($count == 0) - $decode = preg_replace($this->_safeRegExp('($count)\\s*=\\s*1'), "$1=0", $decode, 1); - } - - // boot function - $unpack = $this->_getJSFunction("_unpack"); - if ($this->_fastDecode) { - // insert the decoder - $this->buffer = $decode; - $unpack = preg_replace_callback('/\\{/', [&$this, "_insertFastDecode"], $unpack, 1); - } - $unpack = preg_replace('/"/', "'", $unpack); - if ($this->_encoding > 62) { // high-ascii - // get rid of the word-boundaries for regexp matches - $unpack = preg_replace('/\'\\\\\\\\b\'\s*\\+|\\+\s*\'\\\\\\\\b\'/', "", $unpack); - } - if ($ascii > 36 || $this->_encoding > 62 || $this->_fastDecode) { - // insert the encode function - $this->buffer = $encode; - $unpack = preg_replace_callback('/\\{/', [&$this, "_insertFastEncode"], $unpack, 1); - } else { - // perform the encoding inline - $unpack = preg_replace($ENCODE, $inline, $unpack); - } - // pack the boot function too - $unpackPacker = new JavaScriptPacker($unpack, 0, false, true); - $unpack = $unpackPacker->pack(); - - // arguments - $params = [$packed, $ascii, $count, $keywords]; - if ($this->_fastDecode) { - $params[] = 0; - $params[] = "{}"; - } - $params = implode(",", $params); - - // the whole thing - return "eval(" . $unpack . "(" . $params . "));\n"; - } - - var $buffer; - function _insertFastDecode($match) { - return "{" . $this->buffer . ";"; - } - function _insertFastEncode($match) { - return "{$encode=" . $this->buffer . ";"; - } - - // mmm.. ..which one do i need ?? - function _getEncoder($ascii) { - return $ascii > 10 ? $ascii > 36 ? $ascii > 62 ? - "_encode95" : "_encode62" : "_encode36" : "_encode10"; - } - - // zero encoding - // characters: 0123456789 - function _encode10($charCode) { - return $charCode; - } - - // inherent base36 support - // characters: 0123456789abcdefghijklmnopqrstuvwxyz - function _encode36($charCode) { - return base_convert($charCode, 10, 36); - } - - // hitch a ride on base36 and add the upper case alpha characters - // characters: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ - function _encode62($charCode) { - $res = ""; - if ($charCode >= $this->_encoding) { - $res = $this->_encode62((int)($charCode / $this->_encoding)); - } - $charCode = $charCode % $this->_encoding; - - if ($charCode > 35) - return $res . chr($charCode + 29); - - return $res . base_convert($charCode, 10, 36); - } - - // use high-ascii values - // characters: ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿À�ÂÃÄÅÆÇÈÉÊËÌ�Î��ÑÒÓÔÕÖרÙÚÛÜ�Þßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ - function _encode95($charCode) { - $res = ""; - if ($charCode >= $this->_encoding) - $res = $this->_encode95($charCode / $this->_encoding); - - return $res . chr(($charCode % $this->_encoding) + 161); - } - - function _safeRegExp($string) { - return "/".preg_replace('/\$/', '\\\$', $string)."/"; - } - - function _encodePrivate($charCode) { - return "_" . $charCode; - } - - // protect characters used by the parser - function _escape($script) { - return preg_replace('/([\\\\\'])/', '\\\$1', $script); - } - - // protect high-ascii characters already in the script - function _escape95($script) { - return preg_replace_callback( - '/[\\xa1-\\xff]/', - [&$this, "_escape95Bis"], - $script, - ); - } - function _escape95Bis($match) { - return '\x'.((string)dechex(ord($match))); - } - - function _getJSFunction($aName) { - $func = "JSFUNCTION".$aName; - if (isset($this->$func)){ - return $this->$func; - } - - return ""; - } - - // JavaScript Functions used. - // Note : In Dean's version, these functions are converted - // with 'String(aFunctionName);'. - // This internal conversion complete the original code, ex : - // 'while (aBool) anAction();' is converted to - // 'while (aBool) { anAction(); }'. - // The JavaScript functions below are corrected. - - // unpacking function - this is the boot strap function - // data extracted from this packing routine is passed to - // this function when decoded in the target - // NOTE ! : without the ';' final. - var $JSFUNCTION_unpack = 'function($packed, $ascii, $count, $keywords, $encode, $decode) { - while ($count--) { - if ($keywords[$count]) { - $packed = $packed.replace(new RegExp(\'\\\\b\' + $encode($count) + \'\\\\b\', \'g\'), $keywords[$count]); - } - } - return $packed; -}'; -/* -'function($packed, $ascii, $count, $keywords, $encode, $decode) { - while ($count--) - if ($keywords[$count]) - $packed = $packed.replace(new RegExp(\'\\\\b\' + $encode($count) + \'\\\\b\', \'g\'), $keywords[$count]); - return $packed; -}'; -*/ - - // code-snippet inserted into the unpacker to speed up decoding - var $JSFUNCTION_decodeBody = ' if (!\'\'.replace(/^/, String)) { - // decode all the values we need - while ($count--) { - $decode[$encode($count)] = $keywords[$count] || $encode($count); - } - // global replacement function - $keywords = [function ($encoded) {return $decode[$encoded]}]; - // generic match - $encode = function () {return \'\\\\w+\'}; - // reset the loop counter - we are now doing a global replace - $count = 1; - } -'; -//}; -/* -' if (!\'\'.replace(/^/, String)) { - // decode all the values we need - while ($count--) $decode[$encode($count)] = $keywords[$count] || $encode($count); - // global replacement function - $keywords = [function ($encoded) {return $decode[$encoded]}]; - // generic match - $encode = function () {return\'\\\\w+\'}; - // reset the loop counter - we are now doing a global replace - $count = 1; - }'; -*/ - - // zero encoding - // characters: 0123456789 - var $JSFUNCTION_encode10 = "function($charCode) { - return $charCode; -}";//;'; - - // inherent base36 support - // characters: 0123456789abcdefghijklmnopqrstuvwxyz - var $JSFUNCTION_encode36 = "function($charCode) { - return $charCode.toString(36); -}";//;'; - - // hitch a ride on base36 and add the upper case alpha characters - // characters: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ - var $JSFUNCTION_encode62 = 'function($charCode) { - return ($charCode < _encoding ? \'\' : arguments.callee(parseInt($charCode / _encoding))) + - (($charCode = $charCode % _encoding) > 35 ? String.fromCharCode($charCode + 29) : $charCode.toString(36)); -}'; - - // use high-ascii values - // characters: ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿À�ÂÃÄÅÆÇÈÉÊËÌ�Î��ÑÒÓÔÕÖרÙÚÛÜ�Þßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ - var $JSFUNCTION_encode95 = 'function($charCode) { - return ($charCode < _encoding ? \'\' : arguments.callee($charCode / _encoding)) + - String.fromCharCode($charCode % _encoding + 161); -}'; - -} - -class ParseMaster { - var $ignoreCase = false; - var $escapeChar = ""; - - // constants - var $EXPRESSION = 0; - var $REPLACEMENT = 1; - var $LENGTH = 2; - - // used to determine nesting levels - var $GROUPS = '/\\(/';//g - var $SUB_REPLACE = '/\\$\\d/'; - var $INDEXED = '/^\\$\\d+$/'; - var $TRIM = '/([\'"])\\1\\.(.*)\\.\\1\\1$/'; - var $ESCAPE = '/\\\./';//g - var $QUOTE = '/\'/'; - var $DELETED = '/\\x01[^\\x01]*\\x01/';//g - - function add($expression, $replacement = "") { - // count the number of sub-expressions - // - add one because each pattern is itself a sub-expression - $length = 1 + preg_match_all($this->GROUPS, $this->_internalEscape((string)$expression), $out); - - // treat only strings $replacement - if (is_string($replacement)) { - // does the pattern deal with sub-expressions? - if (preg_match($this->SUB_REPLACE, $replacement)) { - // a simple lookup? (e.g. "$2") - if (preg_match($this->INDEXED, $replacement)) { - // store the index (used for fast retrieval of matched strings) - $replacement = (int)(substr($replacement, 1)) - 1; - } else { // a complicated lookup (e.g. "Hello $2 $1") - // build a function to do the lookup - $quote = preg_match($this->QUOTE, $this->_internalEscape($replacement)) - ? '"' : "'"; - $replacement = [ - "fn" => "_backReferences", - "data" => [ - "replacement" => $replacement, - "length" => $length, - "quote" => $quote, - ], - ]; - } - } - } - // pass the modified arguments - if (!empty($expression)) $this->_add($expression, $replacement, $length); - else $this->_add("/^$/", $replacement, $length); - } - - function exec($string) { - // execute the global replacement - $this->_escaped = []; - - // simulate the _patterns.toSTring of Dean - $regexp = "/"; - foreach ($this->_patterns as $reg) { - $regexp .= "(" . substr($reg[$this->EXPRESSION], 1, -1) . ")|"; - } - $regexp = substr($regexp, 0, -1) . "/"; - $regexp .= ($this->ignoreCase) ? "i" : ""; - - $string = $this->_escape($string, $this->escapeChar); - $string = preg_replace_callback( - $regexp, - [ - &$this, - "_replacement", - ], - $string, - ); - $string = $this->_unescape($string, $this->escapeChar); - - return preg_replace($this->DELETED, "", $string); - } - - function reset() { - // clear the patterns collection so that this object may be re-used - $this->_patterns = []; - } - - // private - var $_escaped = []; // escaped characters - var $_patterns = []; // patterns stored by index - - // create and add a new pattern to the patterns collection - function _add() { - $arguments = func_get_args(); - $this->_patterns[] = $arguments; - } - - // this is the global replace function (it's quite complicated) - function _replacement($arguments) { - if (empty($arguments)) return ""; - - $i = 1; $j = 0; - // loop through the patterns - while (isset($this->_patterns[$j])) { - $pattern = $this->_patterns[$j++]; - // do we have a result? - if (isset($arguments[$i]) && ($arguments[$i] != "")) { - $replacement = $pattern[$this->REPLACEMENT]; - - if (is_array($replacement) && isset($replacement["fn"])) { - - if (isset($replacement["data"])) $this->buffer = $replacement["data"]; - return call_user_func([&$this, $replacement["fn"]], $arguments, $i); - - } elseif (is_int($replacement)) { - return $arguments[$replacement + $i]; - - } - $delete = ($this->escapeChar == "" || - strpos($arguments[$i], $this->escapeChar) === false) - ? "" : "\x01" . $arguments[$i] . "\x01"; - return $delete . $replacement; - - // skip over references to sub-expressions - } - $i += $pattern[$this->LENGTH]; - - } - } - - function _backReferences($match, $offset) { - $replacement = $this->buffer["replacement"]; - $quote = $this->buffer["quote"]; - $i = $this->buffer["length"]; - while ($i) { - $replacement = str_replace("$".$i--, $match[$offset + $i], $replacement); - } - return $replacement; - } - - function _replace_name($match, $offset){ - $length = strlen($match[$offset + 2]); - $start = $length - max($length - strlen($match[$offset + 3]), 0); - return substr($match[$offset + 1], $start, $length) . $match[$offset + 4]; - } - - function _replace_encoded($match, $offset) { - return $this->buffer[$match[$offset]]; - } - - // php : we cannot pass additional data to preg_replace_callback, - // and we cannot use &$this in create_function, so let's go to lower level - var $buffer; - - // encode escaped characters - function _escape($string, $escapeChar) { - if ($escapeChar) { - $this->buffer = $escapeChar; - return preg_replace_callback( - '/\\' . $escapeChar . "(.)" ."/", - [&$this, "_escapeBis"], - $string, - ); - - } - return $string; - - } - function _escapeBis($match) { - $this->_escaped[] = $match[1]; - return $this->buffer; - } - - // decode escaped characters - function _unescape($string, $escapeChar) { - if ($escapeChar) { - $regexp = "/".'\\'.$escapeChar."/"; - $this->buffer = ["escapeChar"=> $escapeChar, "i" => 0]; - return preg_replace_callback - ( - $regexp, - [&$this, "_unescapeBis"], - $string, - ); - - } - return $string; - - } - function _unescapeBis() { - if (!empty($this->_escaped[$this->buffer["i"]])) { - $temp = $this->_escaped[$this->buffer["i"]]; - } else { - $temp = ""; - } - $this->buffer["i"]++; - return $this->buffer["escapeChar"] . $temp; - } - - function _internalEscape($string) { - return preg_replace($this->ESCAPE, "", $string); - } -} -?> diff --git a/javascript/fancyzoom/images-global/zoom/closebox.png b/javascript/fancyzoom/images-global/zoom/closebox.png deleted file mode 100644 index 4de4396..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/closebox.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/spacer.gif b/javascript/fancyzoom/images-global/zoom/spacer.gif deleted file mode 100644 index 5bfd67a..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/spacer.gif and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-caption-fill.png b/javascript/fancyzoom/images-global/zoom/zoom-caption-fill.png deleted file mode 100644 index 1e34153..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-caption-fill.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-caption-l.png b/javascript/fancyzoom/images-global/zoom/zoom-caption-l.png deleted file mode 100644 index a63ea48..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-caption-l.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-caption-r.png b/javascript/fancyzoom/images-global/zoom/zoom-caption-r.png deleted file mode 100644 index 15980d5..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-caption-r.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-shadow1.png b/javascript/fancyzoom/images-global/zoom/zoom-shadow1.png deleted file mode 100644 index 8b48000..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-shadow1.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-shadow2.png b/javascript/fancyzoom/images-global/zoom/zoom-shadow2.png deleted file mode 100644 index 09209f3..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-shadow2.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-shadow3.png b/javascript/fancyzoom/images-global/zoom/zoom-shadow3.png deleted file mode 100644 index 7636fec..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-shadow3.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-shadow4.png b/javascript/fancyzoom/images-global/zoom/zoom-shadow4.png deleted file mode 100644 index c7f148d..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-shadow4.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-shadow5.png b/javascript/fancyzoom/images-global/zoom/zoom-shadow5.png deleted file mode 100644 index 2a75b82..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-shadow5.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-shadow6.png b/javascript/fancyzoom/images-global/zoom/zoom-shadow6.png deleted file mode 100644 index 65801aa..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-shadow6.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-shadow7.png b/javascript/fancyzoom/images-global/zoom/zoom-shadow7.png deleted file mode 100644 index cb44760..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-shadow7.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-shadow8.png b/javascript/fancyzoom/images-global/zoom/zoom-shadow8.png deleted file mode 100644 index f1c6acd..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-shadow8.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-spin-1.png b/javascript/fancyzoom/images-global/zoom/zoom-spin-1.png deleted file mode 100644 index 5615629..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-spin-1.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-spin-10.png b/javascript/fancyzoom/images-global/zoom/zoom-spin-10.png deleted file mode 100644 index 77595db..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-spin-10.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-spin-11.png b/javascript/fancyzoom/images-global/zoom/zoom-spin-11.png deleted file mode 100644 index c2147d5..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-spin-11.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-spin-12.png b/javascript/fancyzoom/images-global/zoom/zoom-spin-12.png deleted file mode 100644 index cf02724..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-spin-12.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-spin-2.png b/javascript/fancyzoom/images-global/zoom/zoom-spin-2.png deleted file mode 100644 index 95eaae8..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-spin-2.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-spin-3.png b/javascript/fancyzoom/images-global/zoom/zoom-spin-3.png deleted file mode 100644 index 9e2b9cb..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-spin-3.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-spin-4.png b/javascript/fancyzoom/images-global/zoom/zoom-spin-4.png deleted file mode 100644 index a39c0fc..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-spin-4.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-spin-5.png b/javascript/fancyzoom/images-global/zoom/zoom-spin-5.png deleted file mode 100644 index 80bea63..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-spin-5.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-spin-6.png b/javascript/fancyzoom/images-global/zoom/zoom-spin-6.png deleted file mode 100644 index b962e5f..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-spin-6.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-spin-7.png b/javascript/fancyzoom/images-global/zoom/zoom-spin-7.png deleted file mode 100644 index 9b6e489..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-spin-7.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-spin-8.png b/javascript/fancyzoom/images-global/zoom/zoom-spin-8.png deleted file mode 100644 index fe147d5..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-spin-8.png and /dev/null differ diff --git a/javascript/fancyzoom/images-global/zoom/zoom-spin-9.png b/javascript/fancyzoom/images-global/zoom/zoom-spin-9.png deleted file mode 100644 index b321b1c..0000000 Binary files a/javascript/fancyzoom/images-global/zoom/zoom-spin-9.png and /dev/null differ diff --git a/javascript/fancyzoom/js-global/FancyZoom.js b/javascript/fancyzoom/js-global/FancyZoom.js deleted file mode 100644 index 99970cb..0000000 --- a/javascript/fancyzoom/js-global/FancyZoom.js +++ /dev/null @@ -1,768 +0,0 @@ -// FancyZoom.js - v1.1 - http://www.fancyzoom.com -// -// Copyright (c) 2008 Cabel Sasser / Panic Inc -// All rights reserved. -// -// Requires: FancyZoomHTML.js -// Instructions: Include JS files in page, call setupZoom() in onLoad. That's it! -// Any links to images will be updated to zoom inline. -// Add rel="nozoom" to your to disable zooming for an image. -// -// Redistribution and use of this effect in source form, with or without modification, -// are permitted provided that the following conditions are met: -// -// * USE OF SOURCE ON COMMERCIAL (FOR-PROFIT) WEBSITE REQUIRES ONE-TIME LICENSE FEE PER DOMAIN. -// Reasonably priced! Visit www.fancyzoom.com for licensing instructions. Thanks! -// -// * Non-commercial (personal) website use is permitted without license/payment! -// -// * Redistribution of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistribution of source code and derived works cannot be sold without specific -// written prior 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 OF SUCH DAMAGE. - - -// {{{ BITMOD -// Modifications to make it work with bitweaver: -// rename setOpacity to _setOpacity to avoid conflicts with mochikit. -// }}} BITMOD - - -var includeCaption = true; // Turn on the "caption" feature, and write out the caption HTML -var zoomTime = 3; // Milliseconds between frames of zoom animation -var zoomSteps = 10; // Number of zoom animation frames -var includeFade = 1; // Set to 1 to fade the image in / out as it zooms -var minBorder = 50; // Amount of padding between large, scaled down images, and the window edges -var shadowSettings = '0px 5px 25px rgba(0, 0, 0)'; // Blur, radius, color of shadow for compatible browsers - -var zoomImagesURI = bitRootUrl+'util/javascript/fancyzoom/images-global/zoom/'; // Location of the zoom and shadow images - -// Init. Do not add anything below this line, unless it's something awesome. - -var myWidth = 0, myHeight = 0, myScroll = 0; myScrollWidth = 0; myScrollHeight = 0; -var zoomOpen = false, preloadFrame = 1, preloadActive = false, preloadTime = 0, imgPreload = new Image(); -var preloadAnimTimer = 0; - -var zoomActive = new Array(); var zoomTimer = new Array(); -var zoomOrigW = new Array(); var zoomOrigH = new Array(); -var zoomOrigX = new Array(); var zoomOrigY = new Array(); - -var zoomID = "ZoomBox"; -var theID = "ZoomImage"; -var zoomCaption = "ZoomCaption"; -var zoomCaptionDiv = "ZoomCapDiv"; - -if (navigator.userAgent.indexOf("MSIE") != -1) { - var browserIsIE = true; -} - -// Zoom: Setup The Page! Called in your 's onLoad handler. - -function setupZoom() { - prepZooms(); - insertZoomHTML(); - zoomdiv = document.getElementById(zoomID); - zoomimg = document.getElementById(theID); -} - -// Zoom: Inject Javascript functions into hrefs pointing to images, one by one! -// Skip any href that contains a rel="nozoom" tag. -// This is done at page load time via an onLoad() handler. - -function prepZooms() { - if (! document.getElementsByTagName) { - return; - } - var links = document.getElementsByTagName("a"); - for (i = 0; i < links.length; i++) { - if (links[i].getAttribute("href")) { - if (links[i].getAttribute("href").search(/(.*)\.(jpg|jpeg|gif|png|bmp|tif|tiff)/gi) != -1) { - if (links[i].getAttribute("rel") != "nozoom") { - links[i].onclick = function (event) { return zoomClick(this, event); }; - links[i].onmouseover = function () { zoomPreload(this); }; - } - } - } - } -} - -// Zoom: Load an image into an image object. When done loading, function sets preloadActive to false, -// so other bits know that they can proceed with the zoom. -// Preloaded image is stored in imgPreload and swapped out in the zoom function. - -function zoomPreload(from) { - - var theimage = from.getAttribute("href"); - - // Only preload if we have to, i.e. the image isn't this image already - - if (imgPreload.src.indexOf(from.getAttribute("href").substr(from.getAttribute("href").lastIndexOf("/"))) == -1) { - preloadActive = true; - imgPreload = new Image(); - - // Set a function to fire when the preload is complete, setting flags along the way. - - imgPreload.onload = function() { - preloadActive = false; - }; - - // Load it! - imgPreload.src = theimage; - } -} - -// Zoom: Start the preloading animation cycle. - -function preloadAnimStart() { - preloadTime = new Date(); - document.getElementById("ZoomSpin").style.left = (myWidth / 2) + 'px'; - document.getElementById("ZoomSpin").style.top = ((myHeight / 2) + myScroll) + 'px'; - document.getElementById("ZoomSpin").style.visibility = "visible"; - preloadFrame = 1; - document.getElementById("SpinImage").src = zoomImagesURI+'zoom-spin-'+preloadFrame+'.png'; - preloadAnimTimer = setInterval("preloadAnim()", 100); -} - -// Zoom: Display and ANIMATE the jibber-jabber widget. Once preloadActive is false, bail and zoom it up! - -function preloadAnim(from) { - if (preloadActive != false) { - document.getElementById("SpinImage").src = zoomImagesURI+'zoom-spin-'+preloadFrame+'.png'; - preloadFrame++; - if (preloadFrame > 12) preloadFrame = 1; - } else { - document.getElementById("ZoomSpin").style.visibility = "hidden"; - clearInterval(preloadAnimTimer); - preloadAnimTimer = 0; - zoomIn(preloadFrom); - } -} - -// ZOOM CLICK: We got a click! Should we do the zoom? Or wait for the preload to complete? -// todo?: Double check that imgPreload src = clicked src - -function zoomClick(from, evt) { - - var shift = getShift(evt); - - // Check for Command / Alt key. If pressed, pass them through -- don't zoom! - if (! evt && window.event && (window.event.metaKey || window.event.altKey)) { - return true; - } else if (evt && (evt.metaKey|| evt.altKey)) { - return true; - } - - // Get browser dimensions - getSize(); - - // If preloading still, wait, and display the spinner. - if (preloadActive == true) { - // But only display the spinner if it's not already being displayed! - if (preloadAnimTimer == 0) { - preloadFrom = from; - preloadAnimStart(); - } - } else { - // Otherwise, we're loaded: do the zoom! - zoomIn(from, shift); - } - - return false; - -} - -// Zoom: Move an element in to endH endW, using zoomHost as a starting point. -// "from" is an object reference to the href that spawned the zoom. - -function zoomIn(from, shift) { - - zoomimg.src = from.getAttribute("href"); - - // Determine the zoom settings from where we came from, the element in the . - // If there's no element in the , or we can't get the width, make stuff up - - if (from.childNodes[0].width) { - startW = from.childNodes[0].width; - startH = from.childNodes[0].height; - startPos = findElementPos(from.childNodes[0]); - } else { - startW = 50; - startH = 12; - startPos = findElementPos(from); - } - - hostX = startPos[0]; - hostY = startPos[1]; - - // Make up for a scrolled containing div. - // TODO: This HAS to move into findElementPos. - - if (document.getElementById('scroller')) { - hostX = hostX - document.getElementById('scroller').scrollLeft; - } - - // Determine the target zoom settings from the preloaded image object - - endW = imgPreload.width; - endH = imgPreload.height; - - // Start! But only if we're not zooming already! - - if (zoomActive[theID] != true) { - - // Clear everything out just in case something is already open - - if (document.getElementById("ShadowBox")) { - document.getElementById("ShadowBox").style.visibility = "hidden"; - } else if (! browserIsIE) { - - // Wipe timer if shadow is fading in still - if (fadeActive["ZoomImage"]) { - clearInterval(fadeTimer["ZoomImage"]); - fadeActive["ZoomImage"] = false; - fadeTimer["ZoomImage"] = false; - } - - document.getElementById("ZoomImage").style.webkitBoxShadow = shadowSettings + '0.0)'; - } - - document.getElementById("ZoomClose").style.visibility = "hidden"; - - // Setup the CAPTION, if existing. Hide it first, set the text. - - if (includeCaption) { - document.getElementById(zoomCaptionDiv).style.visibility = "hidden"; - if (from.getAttribute('title') && includeCaption) { - // Yes, there's a caption, set it up - document.getElementById(zoomCaption).innerHTML = from.getAttribute('title'); - } else { - document.getElementById(zoomCaption).innerHTML = ""; - } - } - - // Store original position in an array for future zoomOut. - - zoomOrigW[theID] = startW; - zoomOrigH[theID] = startH; - zoomOrigX[theID] = hostX; - zoomOrigY[theID] = hostY; - - // Now set the starting dimensions - - zoomimg.style.width = startW + 'px'; - zoomimg.style.height = startH + 'px'; - zoomdiv.style.left = hostX + 'px'; - zoomdiv.style.top = hostY + 'px'; - - // Show the zooming image container, make it invisible - - if (includeFade == 1) { - _setOpacity(0, zoomID); - } - zoomdiv.style.visibility = "visible"; - - // If it's too big to fit in the window, shrink the width and height to fit (with ratio). - - sizeRatio = endW / endH; - if (endW > myWidth - minBorder) { - endW = myWidth - minBorder; - endH = endW / sizeRatio; - } - if (endH > myHeight - minBorder) { - endH = myHeight - minBorder; - endW = endH * sizeRatio; - } - - zoomChangeX = ((myWidth / 2) - (endW / 2) - hostX); - zoomChangeY = (((myHeight / 2) - (endH / 2) - hostY) + myScroll); - zoomChangeW = (endW - startW); - zoomChangeH = (endH - startH); - - // Shift key? - - if (shift) { - tempSteps = zoomSteps * 7; - } else { - tempSteps = zoomSteps; - } - - // Setup Zoom - - zoomCurrent = 0; - - // Setup Fade with Zoom, If Requested - - if (includeFade == 1) { - fadeCurrent = 0; - fadeAmount = (0 - 100) / tempSteps; - } else { - fadeAmount = 0; - } - - // Do It! - - zoomTimer[theID] = setInterval("zoomElement('"+zoomID+"', '"+theID+"', "+zoomCurrent+", "+startW+", "+zoomChangeW+", "+startH+", "+zoomChangeH+", "+hostX+", "+zoomChangeX+", "+hostY+", "+zoomChangeY+", "+tempSteps+", "+includeFade+", "+fadeAmount+", 'zoomDoneIn(zoomID)')", zoomTime); - zoomActive[theID] = true; - } -} - -// Zoom it back out. - -function zoomOut(from, evt) { - - // Get shift key status. - // IE events don't seem to get passed through the function, so grab it from the window. - - if (getShift(evt)) { - tempSteps = zoomSteps * 7; - } else { - tempSteps = zoomSteps; - } - - // Check to see if something is happening/open - - if (zoomActive[theID] != true) { - - // First, get rid of the shadow if necessary. - - if (document.getElementById("ShadowBox")) { - document.getElementById("ShadowBox").style.visibility = "hidden"; - } else if (! browserIsIE) { - - // Wipe timer if shadow is fading in still - if (fadeActive["ZoomImage"]) { - clearInterval(fadeTimer["ZoomImage"]); - fadeActive["ZoomImage"] = false; - fadeTimer["ZoomImage"] = false; - } - - document.getElementById("ZoomImage").style.webkitBoxShadow = shadowSettings + '0.0)'; - } - - // ..and the close box... - - document.getElementById("ZoomClose").style.visibility = "hidden"; - - // ...and the caption if necessary! - - if (includeCaption && document.getElementById(zoomCaption).innerHTML != "") { - // fadeElementSetup(zoomCaptionDiv, 100, 0, 5, 1); - document.getElementById(zoomCaptionDiv).style.visibility = "hidden"; - } - - // Now, figure out where we came from, to get back there - - startX = parseInt(zoomdiv.style.left); - startY = parseInt(zoomdiv.style.top); - startW = zoomimg.width; - startH = zoomimg.height; - zoomChangeX = zoomOrigX[theID] - startX; - zoomChangeY = zoomOrigY[theID] - startY; - zoomChangeW = zoomOrigW[theID] - startW; - zoomChangeH = zoomOrigH[theID] - startH; - - // Setup Zoom - - zoomCurrent = 0; - - // Setup Fade with Zoom, If Requested - - if (includeFade == 1) { - fadeCurrent = 0; - fadeAmount = (100 - 0) / tempSteps; - } else { - fadeAmount = 0; - } - - // Do It! - - zoomTimer[theID] = setInterval("zoomElement('"+zoomID+"', '"+theID+"', "+zoomCurrent+", "+startW+", "+zoomChangeW+", "+startH+", "+zoomChangeH+", "+startX+", "+zoomChangeX+", "+startY+", "+zoomChangeY+", "+tempSteps+", "+includeFade+", "+fadeAmount+", 'zoomDone(zoomID, theID)')", zoomTime); - zoomActive[theID] = true; - } -} - -// Finished Zooming In - -function zoomDoneIn(zoomdiv, theID) { - - // Note that it's open - - zoomOpen = true; - zoomdiv = document.getElementById(zoomdiv); - - // Position the table shadow behind the zoomed in image, and display it - - if (document.getElementById("ShadowBox")) { - - _setOpacity(0, "ShadowBox"); - shadowdiv = document.getElementById("ShadowBox"); - - shadowLeft = parseInt(zoomdiv.style.left) - 13; - shadowTop = parseInt(zoomdiv.style.top) - 8; - shadowWidth = zoomdiv.offsetWidth + 26; - shadowHeight = zoomdiv.offsetHeight + 26; - - shadowdiv.style.width = shadowWidth + 'px'; - shadowdiv.style.height = shadowHeight + 'px'; - shadowdiv.style.left = shadowLeft + 'px'; - shadowdiv.style.top = shadowTop + 'px'; - - document.getElementById("ShadowBox").style.visibility = "visible"; - fadeElementSetup("ShadowBox", 0, 100, 5); - - } else if (! browserIsIE) { - // Or, do a fade of the modern shadow - fadeElementSetup("ZoomImage", 0, .8, 5, 0, "shadow"); - } - - // Position and display the CAPTION, if existing - - if (includeCaption && document.getElementById(zoomCaption).innerHTML != "") { - // _setOpacity(0, zoomCaptionDiv); - zoomcapd = document.getElementById(zoomCaptionDiv); - zoomcapd.style.top = parseInt(zoomdiv.style.top) + (zoomdiv.offsetHeight + 15) + 'px'; - zoomcapd.style.left = (myWidth / 2) - (zoomcapd.offsetWidth / 2) + 'px'; - zoomcapd.style.visibility = "visible"; - // fadeElementSetup(zoomCaptionDiv, 0, 100, 5); - } - - // Display Close Box (fade it if it's not IE) - - if (!browserIsIE) _setOpacity(0, "ZoomClose"); - document.getElementById("ZoomClose").style.visibility = "visible"; - if (!browserIsIE) fadeElementSetup("ZoomClose", 0, 100, 5); - - // Get keypresses - document.onkeypress = getKey; - -} - -// Finished Zooming Out - -function zoomDone(zoomdiv, theID) { - - // No longer open - - zoomOpen = false; - - // Clear stuff out, clean up - - zoomOrigH[theID] = ""; - zoomOrigW[theID] = ""; - document.getElementById(zoomdiv).style.visibility = "hidden"; - zoomActive[theID] == false; - - // Stop getting keypresses - - document.onkeypress = null; - -} - -// Actually zoom the element - -function zoomElement(zoomdiv, theID, zoomCurrent, zoomStartW, zoomChangeW, zoomStartH, zoomChangeH, zoomStartX, zoomChangeX, zoomStartY, zoomChangeY, zoomSteps, includeFade, fadeAmount, execWhenDone) { - - // console.log("Zooming Step #"+zoomCurrent+ " of "+zoomSteps+" (zoom " + zoomStartW + "/" + zoomChangeW + ") (zoom " + zoomStartH + "/" + zoomChangeH + ") (zoom " + zoomStartX + "/" + zoomChangeX + ") (zoom " + zoomStartY + "/" + zoomChangeY + ") Fade: "+fadeAmount); - - // Test if we're done, or if we continue - - if (zoomCurrent == (zoomSteps + 1)) { - zoomActive[theID] = false; - clearInterval(zoomTimer[theID]); - - if (execWhenDone != "") { - eval(execWhenDone); - } - } else { - - // Do the Fade! - - if (includeFade == 1) { - if (fadeAmount < 0) { - _setOpacity(Math.abs(zoomCurrent * fadeAmount), zoomdiv); - } else { - _setOpacity(100 - (zoomCurrent * fadeAmount), zoomdiv); - } - } - - // Calculate this step's difference, and move it! - - moveW = cubicInOut(zoomCurrent, zoomStartW, zoomChangeW, zoomSteps); - moveH = cubicInOut(zoomCurrent, zoomStartH, zoomChangeH, zoomSteps); - moveX = cubicInOut(zoomCurrent, zoomStartX, zoomChangeX, zoomSteps); - moveY = cubicInOut(zoomCurrent, zoomStartY, zoomChangeY, zoomSteps); - - document.getElementById(zoomdiv).style.left = moveX + 'px'; - document.getElementById(zoomdiv).style.top = moveY + 'px'; - zoomimg.style.width = moveW + 'px'; - zoomimg.style.height = moveH + 'px'; - - zoomCurrent++; - - clearInterval(zoomTimer[theID]); - zoomTimer[theID] = setInterval("zoomElement('"+zoomdiv+"', '"+theID+"', "+zoomCurrent+", "+zoomStartW+", "+zoomChangeW+", "+zoomStartH+", "+zoomChangeH+", "+zoomStartX+", "+zoomChangeX+", "+zoomStartY+", "+zoomChangeY+", "+zoomSteps+", "+includeFade+", "+fadeAmount+", '"+execWhenDone+"')", zoomTime); - } -} - -// Zoom Utility: Get Key Press when image is open, and act accordingly - -function getKey(evt) { - if (! evt) { - theKey = event.keyCode; - } else { - theKey = evt.keyCode; - } - - if (theKey == 27) { // ESC - zoomOut(this, evt); - } -} - -//////////////////////////// -// -// FADE Functions -// - -function fadeOut(elem) { - if (elem.id) { - fadeElementSetup(elem.id, 100, 0, 10); - } -} - -function fadeIn(elem) { - if (elem.id) { - fadeElementSetup(elem.id, 0, 100, 10); - } -} - -// Fade: Initialize the fade function - -var fadeActive = new Array(); -var fadeQueue = new Array(); -var fadeTimer = new Array(); -var fadeClose = new Array(); -var fadeMode = new Array(); - -function fadeElementSetup(theID, fdStart, fdEnd, fdSteps, fdClose, fdMode) { - - // alert("Fading: "+theID+" Steps: "+fdSteps+" Mode: "+fdMode); - - if (fadeActive[theID] == true) { - // Already animating, queue up this command - fadeQueue[theID] = new Array(theID, fdStart, fdEnd, fdSteps); - } else { - fadeSteps = fdSteps; - fadeCurrent = 0; - fadeAmount = (fdStart - fdEnd) / fadeSteps; - fadeTimer[theID] = setInterval("fadeElement('"+theID+"', '"+fadeCurrent+"', '"+fadeAmount+"', '"+fadeSteps+"')", 15); - fadeActive[theID] = true; - fadeMode[theID] = fdMode; - - if (fdClose == 1) { - fadeClose[theID] = true; - } else { - fadeClose[theID] = false; - } - } -} - -// Fade: Do the fade. This function will call itself, modifying the parameters, so -// many instances can run concurrently. Can fade using opacity, or fade using a box-shadow. - -function fadeElement(theID, fadeCurrent, fadeAmount, fadeSteps) { - - if (fadeCurrent == fadeSteps) { - - // We're done, so clear. - - clearInterval(fadeTimer[theID]); - fadeActive[theID] = false; - fadeTimer[theID] = false; - - // Should we close it once the fade is complete? - - if (fadeClose[theID] == true) { - document.getElementById(theID).style.visibility = "hidden"; - } - - // Hang on.. did a command queue while we were working? If so, make it happen now - - if (fadeQueue[theID] && fadeQueue[theID] != false) { - fadeElementSetup(fadeQueue[theID][0], fadeQueue[theID][1], fadeQueue[theID][2], fadeQueue[theID][3]); - fadeQueue[theID] = false; - } - } else { - - fadeCurrent++; - - // Now actually do the fade adjustment. - - if (fadeMode[theID] == "shadow") { - - // Do a special fade on the webkit-box-shadow of the object - - if (fadeAmount < 0) { - document.getElementById(theID).style.webkitBoxShadow = shadowSettings + (Math.abs(fadeCurrent * fadeAmount)) + ')'; - } else { - document.getElementById(theID).style.webkitBoxShadow = shadowSettings + (100 - (fadeCurrent * fadeAmount)) + ')'; - } - - } else { - - // Set the opacity depending on if we're adding or subtracting (pos or neg) - - if (fadeAmount < 0) { - _setOpacity(Math.abs(fadeCurrent * fadeAmount), theID); - } else { - _setOpacity(100 - (fadeCurrent * fadeAmount), theID); - } - } - - // Keep going, and send myself the updated variables - clearInterval(fadeTimer[theID]); - fadeTimer[theID] = setInterval("fadeElement('"+theID+"', '"+fadeCurrent+"', '"+fadeAmount+"', '"+fadeSteps+"')", 15); - } -} - -//////////////////////////// -// -// UTILITY functions -// - -// Utility: Set the opacity, compatible with a number of browsers. Value from 0 to 100. - -function _setOpacity(opacity, theID) { - - var object = document.getElementById(theID).style; - - // If it's 100, set it to 99 for Firefox. - - if (navigator.userAgent.indexOf("Firefox") != -1) { - if (opacity == 100) { opacity = 99.9999; } // This is majorly awkward - } - - // Multi-browser opacity setting - - object.filter = "alpha(opacity=" + opacity + ")"; // IE/Win - object.opacity = (opacity / 100); // Safari 1.2, Firefox+Mozilla - -} - -// Utility: Math functions for animation calucations - From http://www.robertpenner.com/easing/ -// -// t = time, b = begin, c = change, d = duration -// time = current frame, begin is fixed, change is basically finish - begin, duration is fixed (frames), - -function linear(t, b, c, d) -{ - return c*t/d + b; -} - -function sineInOut(t, b, c, d) -{ - return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; -} - -function cubicIn(t, b, c, d) { - return c*(t/=d)*t*t + b; -} - -function cubicOut(t, b, c, d) { - return c*((t=t/d-1)*t*t + 1) + b; -} - -function cubicInOut(t, b, c, d) -{ - if ((t/=d/2) < 1) return c/2*t*t*t + b; - return c/2*((t-=2)*t*t + 2) + b; -} - -function bounceOut(t, b, c, d) -{ - if ((t/=d) < (1/2.75)){ - return c*(7.5625*t*t) + b; - } else if (t < (2/2.75)){ - return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; - } else if (t < (2.5/2.75)){ - return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; - } else { - return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; - } -} - - -// Utility: Get the size of the window, and set myWidth and myHeight -// Credit to quirksmode.org - -function getSize() { - - // Window Size - - if (self.innerHeight) { // Everyone but IE - myWidth = window.innerWidth; - myHeight = window.innerHeight; - myScroll = window.pageYOffset; - } else if (document.documentElement && document.documentElement.clientHeight) { // IE6 Strict - myWidth = document.documentElement.clientWidth; - myHeight = document.documentElement.clientHeight; - myScroll = document.documentElement.scrollTop; - } else if (document.body) { // Other IE, such as IE7 - myWidth = document.body.clientWidth; - myHeight = document.body.clientHeight; - myScroll = document.body.scrollTop; - } - - // Page size w/offscreen areas - - if (window.innerHeight && window.scrollMaxY) { - myScrollWidth = document.body.scrollWidth; - myScrollHeight = window.innerHeight + window.scrollMaxY; - } else if (document.body.scrollHeight > document.body.offsetHeight) { // All but Explorer Mac - myScrollWidth = document.body.scrollWidth; - myScrollHeight = document.body.scrollHeight; - } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari - myScrollWidth = document.body.offsetWidth; - myScrollHeight = document.body.offsetHeight; - } -} - -// Utility: Get Shift Key Status -// IE events don't seem to get passed through the function, so grab it from the window. - -function getShift(evt) { - var shift = false; - if (! evt && window.event) { - shift = window.event.shiftKey; - } else if (evt) { - shift = evt.shiftKey; - if (shift) evt.stopPropagation(); // Prevents Firefox from doing shifty things - } - return shift; -} - -// Utility: Find the Y position of an element on a page. Return Y and X as an array - -function findElementPos(elemFind) -{ - var elemX = 0; - var elemY = 0; - do { - elemX += elemFind.offsetLeft; - elemY += elemFind.offsetTop; - } while ( elemFind = elemFind.offsetParent ) - - return Array(elemX, elemY); -} diff --git a/javascript/fancyzoom/js-global/FancyZoomHTML.js b/javascript/fancyzoom/js-global/FancyZoomHTML.js deleted file mode 100644 index 7644a9a..0000000 --- a/javascript/fancyzoom/js-global/FancyZoomHTML.js +++ /dev/null @@ -1,318 +0,0 @@ -// FancyZoomHTML.js - v1.0 -// Used to draw necessary HTML elements for FancyZoom -// -// Copyright (c) 2008 Cabel Sasser / Panic Inc -// All rights reserved. - -function insertZoomHTML() { - - // All of this junk creates the three
's used to hold the closebox, image, and zoom shadow. - - var inBody = document.getElementsByTagName("body").item(0); - - // WAIT SPINNER - - var inSpinbox = document.createElement("div"); - inSpinbox.setAttribute('id', 'ZoomSpin'); - inSpinbox.style.position = 'absolute'; - inSpinbox.style.left = '10px'; - inSpinbox.style.top = '10px'; - inSpinbox.style.visibility = 'hidden'; - inSpinbox.style.zIndex = '525'; - inBody.insertBefore(inSpinbox, inBody.firstChild); - - var inSpinImage = document.createElement("img"); - inSpinImage.setAttribute('id', 'SpinImage'); - inSpinImage.setAttribute('src', zoomImagesURI+'zoom-spin-1.png'); - inSpinbox.appendChild(inSpinImage); - - // ZOOM IMAGE - // - //
- // - //
- // - //
- //
- - var inZoombox = document.createElement("div"); - inZoombox.setAttribute('id', 'ZoomBox'); - - inZoombox.style.position = 'absolute'; - inZoombox.style.left = '10px'; - inZoombox.style.top = '10px'; - inZoombox.style.visibility = 'hidden'; - inZoombox.style.zIndex = '499'; - - inBody.insertBefore(inZoombox, inSpinbox.nextSibling); - - var inImage1 = document.createElement("img"); - inImage1.onclick = function (event) { zoomOut(this, event); return false; }; - inImage1.setAttribute('src',zoomImagesURI+'spacer.gif'); - inImage1.setAttribute('id','ZoomImage'); - inImage1.setAttribute('border', '0'); - // inImage1.setAttribute('onMouseOver', 'zoomMouseOver();') - // inImage1.setAttribute('onMouseOut', 'zoomMouseOut();') - - // This must be set first, so we can later test it using webkitBoxShadow. - inImage1.setAttribute('style', '-webkit-box-shadow: '+shadowSettings+'0.0)'); - inImage1.style.display = 'block'; - inImage1.style.width = '10px'; - inImage1.style.height = '10px'; - inImage1.style.cursor = 'pointer'; // -webkit-zoom-out? - inZoombox.appendChild(inImage1); - - var inClosebox = document.createElement("div"); - inClosebox.setAttribute('id', 'ZoomClose'); - inClosebox.style.position = 'absolute'; - - // In MSIE, we need to put the close box inside the image. - // It's 2008 and I'm having to do a browser detect? Sigh. - if (browserIsIE) { - inClosebox.style.left = '-1px'; - inClosebox.style.top = '0px'; - } else { - inClosebox.style.left = '-15px'; - inClosebox.style.top = '-15px'; - } - - inClosebox.style.visibility = 'hidden'; - inZoombox.appendChild(inClosebox); - - var inImage2 = document.createElement("img"); - inImage2.onclick = function (event) { zoomOut(this, event); return false; }; - inImage2.setAttribute('src',zoomImagesURI+'closebox.png'); - inImage2.setAttribute('width','30'); - inImage2.setAttribute('height','30'); - inImage2.setAttribute('border','0'); - inImage2.style.cursor = 'pointer'; - inClosebox.appendChild(inImage2); - - // SHADOW - // Only draw the table-based shadow if the programatic webkitBoxShadow fails! - // Also, don't draw it if we're IE -- it wouldn't look quite right anyway. - - if (! document.getElementById('ZoomImage').style.webkitBoxShadow && ! browserIsIE) { - - // SHADOW BASE - - var inFixedBox = document.createElement("div"); - inFixedBox.setAttribute('id', 'ShadowBox'); - inFixedBox.style.position = 'absolute'; - inFixedBox.style.left = '50px'; - inFixedBox.style.top = '50px'; - inFixedBox.style.width = '100px'; - inFixedBox.style.height = '100px'; - inFixedBox.style.visibility = 'hidden'; - inFixedBox.style.zIndex = '498'; - inBody.insertBefore(inFixedBox, inZoombox.nextSibling); - - // SHADOW - // Now, the shadow table. Skip if not compatible, or irrevelant with -box-shadow. - - //
X - // - // - // - // - // - - var inShadowTable = document.createElement("table"); - inShadowTable.setAttribute('border', '0'); - inShadowTable.setAttribute('width', '100%'); - inShadowTable.setAttribute('height', '100%'); - inShadowTable.setAttribute('cellpadding', '0'); - inShadowTable.setAttribute('cellspacing', '0'); - inFixedBox.appendChild(inShadowTable); - - var inShadowTbody = document.createElement("tbody"); // Needed for IE (for HTML4). - inShadowTable.appendChild(inShadowTbody); - - var inRow1 = document.createElement("tr"); - inRow1.style.height = '25px'; - inShadowTbody.appendChild(inRow1); - - var inCol1 = document.createElement("td"); - inCol1.style.width = '27px'; - inRow1.appendChild(inCol1); - var inShadowImg1 = document.createElement("img"); - inShadowImg1.setAttribute('src', zoomImagesURI+'zoom-shadow1.png'); - inShadowImg1.setAttribute('width', '27'); - inShadowImg1.setAttribute('height', '25'); - inShadowImg1.style.display = 'block'; - inCol1.appendChild(inShadowImg1); - - var inCol2 = document.createElement("td"); - inCol2.setAttribute('background', zoomImagesURI+'zoom-shadow2.png'); - inRow1.appendChild(inCol2); - // inCol2.innerHTML = ' - // - // - // - // - - inRow2 = document.createElement("tr"); - inShadowTbody.appendChild(inRow2); - - var inCol4 = document.createElement("td"); - inCol4.setAttribute('background', zoomImagesURI+'zoom-shadow4.png'); - inRow2.appendChild(inCol4); - // inCol4.innerHTML = ' '; - var inSpacer2 = document.createElement("img"); - inSpacer2.setAttribute('src',zoomImagesURI+'spacer.gif'); - inSpacer2.setAttribute('height', '1'); - inSpacer2.setAttribute('width', '1'); - inSpacer2.style.display = 'block'; - inCol4.appendChild(inSpacer2); - - var inCol5 = document.createElement("td"); - inCol5.setAttribute('bgcolor', '#ffffff'); - inRow2.appendChild(inCol5); - // inCol5.innerHTML = ' '; - var inSpacer3 = document.createElement("img"); - inSpacer3.setAttribute('src',zoomImagesURI+'spacer.gif'); - inSpacer3.setAttribute('height', '1'); - inSpacer3.setAttribute('width', '1'); - inSpacer3.style.display = 'block'; - inCol5.appendChild(inSpacer3); - - var inCol6 = document.createElement("td"); - inCol6.setAttribute('background', zoomImagesURI+'zoom-shadow5.png'); - inRow2.appendChild(inCol6); - // inCol6.innerHTML = ' '; - var inSpacer4 = document.createElement("img"); - inSpacer4.setAttribute('src',zoomImagesURI+'spacer.gif'); - inSpacer4.setAttribute('height', '1'); - inSpacer4.setAttribute('width', '1'); - inSpacer4.style.display = 'block'; - inCol6.appendChild(inSpacer4); - - // - // - // - // - //
 
   
- //  
- - var inRow3 = document.createElement("tr"); - inRow3.style.height = '26px'; - inShadowTbody.appendChild(inRow3); - - var inCol7 = document.createElement("td"); - inCol7.style.width = '27px'; - inRow3.appendChild(inCol7); - var inShadowImg7 = document.createElement("img"); - inShadowImg7.setAttribute('src', zoomImagesURI+'zoom-shadow6.png'); - inShadowImg7.setAttribute('width', '27'); - inShadowImg7.setAttribute('height', '26'); - inShadowImg7.style.display = 'block'; - inCol7.appendChild(inShadowImg7); - - var inCol8 = document.createElement("td"); - inCol8.setAttribute('background', zoomImagesURI+'zoom-shadow7.png'); - inRow3.appendChild(inCol8); - // inCol8.innerHTML = ' '; - var inSpacer5 = document.createElement("img"); - inSpacer5.setAttribute('src',zoomImagesURI+'spacer.gif'); - inSpacer5.setAttribute('height', '1'); - inSpacer5.setAttribute('width', '1'); - inSpacer5.style.display = 'block'; - inCol8.appendChild(inSpacer5); - - var inCol9 = document.createElement("td"); - inCol9.style.width = '27px'; - inRow3.appendChild(inCol9); - var inShadowImg9 = document.createElement("img"); - inShadowImg9.setAttribute('src', zoomImagesURI+'zoom-shadow8.png'); - inShadowImg9.setAttribute('width', '27'); - inShadowImg9.setAttribute('height', '26'); - inShadowImg9.style.display = 'block'; - inCol9.appendChild(inShadowImg9); - } - - if (includeCaption) { - - // CAPTION - // - //
- // - // - // - // - // - // - //
- //
- - var inCapDiv = document.createElement("div"); - inCapDiv.setAttribute('id', 'ZoomCapDiv'); - inCapDiv.style.position = 'absolute'; - inCapDiv.style.visibility = 'hidden'; - inCapDiv.style.marginLeft = 'auto'; - inCapDiv.style.marginRight = 'auto'; - inCapDiv.style.zIndex = '501'; - - inBody.insertBefore(inCapDiv, inZoombox.nextSibling); - - var inCapTable = document.createElement("table"); - inCapTable.setAttribute('border', '0'); - inCapTable.setAttribute('cellPadding', '0'); // Wow. These honestly need to - inCapTable.setAttribute('cellSpacing', '0'); // be intercapped to work in IE. WTF? - inCapDiv.appendChild(inCapTable); - - var inTbody = document.createElement("tbody"); // Needed for IE (for HTML4). - inCapTable.appendChild(inTbody); - - var inCapRow1 = document.createElement("tr"); - inTbody.appendChild(inCapRow1); - - var inCapCol1 = document.createElement("td"); - inCapCol1.setAttribute('align', 'right'); - inCapRow1.appendChild(inCapCol1); - var inCapImg1 = document.createElement("img"); - inCapImg1.setAttribute('src', zoomImagesURI+'zoom-caption-l.png'); - inCapImg1.setAttribute('width', '13'); - inCapImg1.setAttribute('height', '26'); - inCapImg1.style.display = 'block'; - inCapCol1.appendChild(inCapImg1); - - var inCapCol2 = document.createElement("td"); - inCapCol2.setAttribute('background', zoomImagesURI+'zoom-caption-fill.png'); - inCapCol2.setAttribute('id', 'ZoomCaption'); - inCapCol2.setAttribute('valign', 'middle'); - inCapCol2.style.fontSize = '14px'; - inCapCol2.style.fontFamily = 'Helvetica'; - inCapCol2.style.fontWeight = 'bold'; - inCapCol2.style.color = '#ffffff'; - inCapCol2.style.textShadow = '0px 2px 4px #000000'; - inCapCol2.style.whiteSpace = 'nowrap'; - inCapRow1.appendChild(inCapCol2); - - var inCapCol3 = document.createElement("td"); - inCapRow1.appendChild(inCapCol3); - var inCapImg2 = document.createElement("img"); - inCapImg2.setAttribute('src', zoomImagesURI+'zoom-caption-r.png'); - inCapImg2.setAttribute('width', '13'); - inCapImg2.setAttribute('height', '26'); - inCapImg2.style.display = 'block'; - inCapCol3.appendChild(inCapImg2); - } -} \ No newline at end of file -- cgit v1.3