Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.2/styles/graphics-ie6.css ============================================================================== --- websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.2/styles/graphics-ie6.css (added) +++ websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.2/styles/graphics-ie6.css Wed Apr 12 14:40:22 2017 @@ -0,0 +1,77 @@ +.simileAjax-bubble-border-left-pngNotTranslucent { + filter: expression( + "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + SimileAjax.urlPrefix + "images/bubble-left.png', sizingMethod='crop')" + ); +} + +.simileAjax-bubble-border-right-pngNotTranslucent { + filter: expression( + "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + SimileAjax.urlPrefix + "images/bubble-right.png', sizingMethod='crop')" + ); +} + +.simileAjax-bubble-border-top-pngNotTranslucent { + filter: expression( + "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + SimileAjax.urlPrefix + "images/bubble-top.png', sizingMethod='crop')" + ); +} + +.simileAjax-bubble-border-bottom-pngNotTranslucent { + filter: expression( + "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + SimileAjax.urlPrefix + "images/bubble-bottom.png', sizingMethod='crop')" + ); +} + +.simileAjax-bubble-border-top-left-pngNotTranslucent { + filter: expression( + "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + SimileAjax.urlPrefix + "images/bubble-top-left.png', sizingMethod='crop')" + ); +} + +.simileAjax-bubble-border-top-right-pngNotTranslucent { + filter: expression( + "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + SimileAjax.urlPrefix + "images/bubble-top-right.png', sizingMethod='crop')" + ); +} + +.simileAjax-bubble-border-bottom-left-pngNotTranslucent { + filter: expression( + "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + SimileAjax.urlPrefix + "images/bubble-bottom-left.png', sizingMethod='crop')" + ); +} + +.simileAjax-bubble-border-bottom-right-pngNotTranslucent { + filter: expression( + "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + SimileAjax.urlPrefix + "images/bubble-bottom-right.png', sizingMethod='crop')" + ); +} + +.simileAjax-bubble-arrow-point-left-pngNotTranslucent { + filter: expression( + "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + SimileAjax.urlPrefix + "images/bubble-arrow-point-left.png', sizingMethod='crop')" + ); +} + +.simileAjax-bubble-arrow-point-right-pngNotTranslucent { + filter: expression( + "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + SimileAjax.urlPrefix + "images/bubble-arrow-point-right.png', sizingMethod='crop')" + ); +} + +.simileAjax-bubble-arrow-point-up-pngNotTranslucent { + filter: expression( + "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + SimileAjax.urlPrefix + "images/bubble-arrow-point-up.png', sizingMethod='crop')" + ); +} + +.simileAjax-bubble-arrow-point-down-pngNotTranslucent { + filter: expression( + "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + SimileAjax.urlPrefix + "images/bubble-arrow-point-down.png', sizingMethod='crop')" + ); +} + +.simileAjax-bubble-close-pngNotTranslucent { + filter: expression( + "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + SimileAjax.urlPrefix + "images/close-button.png', sizingMethod='crop')" + ); +}
Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.2/styles/graphics.css ============================================================================== --- websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.2/styles/graphics.css (added) +++ websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.2/styles/graphics.css Wed Apr 12 14:40:22 2017 @@ -0,0 +1,171 @@ +div.simileAjax-bubble-container { + margin: 0px; + padding: 0px; + border: none; + position: absolute; + z-index: 1000; +} + +div.simileAjax-bubble-innerContainer { + margin: 0px; + padding: 0px; + border: none; + position: relative; + width: 100%; + height: 100%; + overflow: visible; +} + +div.simileAjax-bubble-contentContainer { + margin: 0px; + padding: 0px; + border: none; + position: absolute; + left: 0px; + top: 0px; + width: 100%; + height: 100%; + overflow: auto; + background: white; +} + +div.simileAjax-bubble-border-left { + position: absolute; + left: -50px; + top: 0px; + width: 50px; + height: 100%; +} +div.simileAjax-bubble-border-left-pngTranslucent { + background: url(../images/bubble-left.png) top right repeat-y; +} + +div.simileAjax-bubble-border-right { + position: absolute; + right: -50px; + top: 0px; + width: 50px; + height: 100%; +} +.simileAjax-bubble-border-right-pngTranslucent { + background: url(../images/bubble-right.png) top left repeat-y; +} + +div.simileAjax-bubble-border-top { + position: absolute; + top: -50px; + left: 0px; + width: 100%; + height: 50px; +} +.simileAjax-bubble-border-top-pngTranslucent { + background: url(../images/bubble-top.png) bottom left repeat-x; +} + +div.simileAjax-bubble-border-bottom { + position: absolute; + bottom: -50px; + left: 0px; + width: 100%; + height: 50px; +} +.simileAjax-bubble-border-bottom-pngTranslucent { + background: url(../images/bubble-bottom.png) top left repeat-x; +} + +div.simileAjax-bubble-border-top-left { + position: absolute; + top: -50px; + left: -50px; + width: 50px; + height: 50px; +} +.simileAjax-bubble-border-top-left-pngTranslucent { + background: url(../images/bubble-top-left.png) bottom right no-repeat; +} + +div.simileAjax-bubble-border-top-right { + position: absolute; + top: -50px; + right: -50px; + width: 50px; + height: 50px; +} +.simileAjax-bubble-border-top-right-pngTranslucent { + background: url(../images/bubble-top-right.png) bottom left no-repeat; +} + +div.simileAjax-bubble-border-bottom-left { + position: absolute; + bottom: -50px; + left: -50px; + width: 50px; + height: 50px; +} +.simileAjax-bubble-border-bottom-left-pngTranslucent { + background: url(../images/bubble-bottom-left.png) top right no-repeat; +} + +div.simileAjax-bubble-border-bottom-right { + position: absolute; + bottom: -50px; + right: -50px; + width: 50px; + height: 50px; +} +.simileAjax-bubble-border-bottom-right-pngTranslucent { + background: url(../images/bubble-bottom-right.png) top left no-repeat; +} + +div.simileAjax-bubble-arrow-point-left { + position: absolute; + left: -100px; + width: 100px; + height: 49px; +} +.simileAjax-bubble-arrow-point-left-pngTranslucent { + background: url(../images/bubble-arrow-point-left.png) center right no-repeat; +} + +div.simileAjax-bubble-arrow-point-right { + position: absolute; + right: -100px; + width: 100px; + height: 49px; +} +.simileAjax-bubble-arrow-point-right-pngTranslucent { + background: url(../images/bubble-arrow-point-right.png) center left no-repeat; +} + +div.simileAjax-bubble-arrow-point-up { + position: absolute; + top: -100px; + width: 49px; + height: 100px; +} +.simileAjax-bubble-arrow-point-up-pngTranslucent { + background: url(../images/bubble-arrow-point-up.png) bottom center no-repeat; +} + +div.simileAjax-bubble-arrow-point-down { + position: absolute; + bottom: -100px; + width: 49px; + height: 100px; +} +.simileAjax-bubble-arrow-point-down-pngTranslucent { + background: url(../images/bubble-arrow-point-down.png) bottom center no-repeat; +} + + +div.simileAjax-bubble-close { + position: absolute; + right: -10px; + top: -12px; + width: 16px; + height: 16px; + cursor: pointer; +} +.simileAjax-bubble-close-pngTranslucent { + background: url(../images/close-button.png) no-repeat; +} Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/compile-epilog.js ============================================================================== --- websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/compile-epilog.js (added) +++ websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/compile-epilog.js Wed Apr 12 14:40:22 2017 @@ -0,0 +1,16 @@ +(function() { + var f = null; + if ("SimileWidgets_onLoad" in window) { + if (typeof SimileWidgets_onLoad == "string") { + f = eval(SimileWidgets_onLoad); + SimileWidgets_onLoad = null; + } else if (typeof SimileWidgets_onLoad == "function") { + f = SimileWidgets_onLoad; + SimileWidgets_onLoad = null; + } + } + + if (f != null) { + f(); + } +})(); \ No newline at end of file Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/compile-prolog.js ============================================================================== --- websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/compile-prolog.js (added) +++ websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/compile-prolog.js Wed Apr 12 14:40:22 2017 @@ -0,0 +1 @@ +window.SimileAjax_isCompiled = true; \ No newline at end of file Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/content/history.html ============================================================================== --- websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/content/history.html (added) +++ websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/content/history.html Wed Apr 12 14:40:22 2017 @@ -0,0 +1,28 @@ +<!--#include virtual="/doctype.html" --> +<html> +<head> +<link href="/css/ooo.css" rel="stylesheet" type="text/css"> + + <title>Dummy Page for Keeping Track of History</title> + +<!--#include virtual="/google-analytics.js" --> +<!--#include virtual="/scripts/entourage.js" --> +</head> +<body> +<!--#include virtual="/brand.html" --> + <div id="topbara"> + <!--#include virtual="/topnav.html" --> + <div id="breadcrumbsa"><a href="/">home</a> » <a href="/scripts/">scripts</a> » <a href="/scripts/simile-widget/">simile-widget</a> » <a href="/scripts/simile-widget/ajax/">ajax</a> » <a href="/scripts/simile-widget/ajax/2.2.3/">2.2.3</a> » <a href="/scripts/simile-widget/ajax/2.2.3/content/">content</a></div> + </div> + <div id="clear"></div> + + + <div id="content"> + + + + + </div> +<!--#include virtual="/footer.html" --> +</body> +</html> Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-arrow-point-down.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-arrow-point-down.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-arrow-point-left.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-arrow-point-left.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-arrow-point-right.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-arrow-point-right.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-arrow-point-up.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-arrow-point-up.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-bottom-left.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-bottom-left.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-bottom-right.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-bottom-right.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-bottom.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-bottom.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-left.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-left.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-right.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-right.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-top-left.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-top-left.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-top-right.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-top-right.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-top.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/bubble-top.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/close-button.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/close-button.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/copy.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/copy.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/message-bottom-left.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/message-bottom-left.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/message-bottom-right.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/message-bottom-right.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/message-left.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/message-left.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/message-right.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/message-right.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/message-top-left.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/message-top-left.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/message-top-right.png ============================================================================== Binary file - no diff available. Propchange: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/images/message-top-right.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/loader.js ============================================================================== --- websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/loader.js (added) +++ websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/loader.js Wed Apr 12 14:40:22 2017 @@ -0,0 +1,34 @@ +(function() { + if ("SimileWidgets_styles" in window) { + var head = document.getElementsByTagName("head")[0]; + var styles = SimileWidgets_styles; + for (var i = 0; i < styles.length; i++) { + var link = document.createElement("link"); + link.href = styles[i]; + link.rel = "stylesheet"; + link.type = "text/css"; + head.appendChild(link); + } + } + if ("SimileWidgets_scripts" in window) { + var onLoad = window.SimileWidgets_onLoad; + + var scripts = SimileWidgets_scripts; + var i = 0; + var next = function() { + if (i < scripts.length) { + var url = scripts[i++]; + + window.SimileWidgets_onLoad = arguments.callee; + + var script = document.createElement("script"); + script.src = url; + script.type = "text/javascript"; + document.body.appendChild(script); + } else { + onLoad(); + } + }; + next(); + } +})(); \ No newline at end of file Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/scripts/ajax.js ============================================================================== --- websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/scripts/ajax.js (added) +++ websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/scripts/ajax.js Wed Apr 12 14:40:22 2017 @@ -0,0 +1,45 @@ +/*================================================== + * General, miscellaneous SimileAjax stuff + *================================================== + */ + +SimileAjax.ListenerQueue = function(wildcardHandlerName) { + this._listeners = []; + this._wildcardHandlerName = wildcardHandlerName; +}; + +SimileAjax.ListenerQueue.prototype.add = function(listener) { + this._listeners.push(listener); +}; + +SimileAjax.ListenerQueue.prototype.remove = function(listener) { + var listeners = this._listeners; + for (var i = 0; i < listeners.length; i++) { + if (listeners[i] == listener) { + listeners.splice(i, 1); + break; + } + } +}; + +SimileAjax.ListenerQueue.prototype.fire = function(handlerName, args) { + var listeners = [].concat(this._listeners); + for (var i = 0; i < listeners.length; i++) { + var listener = listeners[i]; + if (handlerName in listener) { + try { + listener[handlerName].apply(listener, args); + } catch (e) { + SimileAjax.Debug.exception("Error firing event of name " + handlerName, e); + } + } else if (this._wildcardHandlerName != null && + this._wildcardHandlerName in listener) { + try { + listener[this._wildcardHandlerName].apply(listener, [ handlerName ]); + } catch (e) { + SimileAjax.Debug.exception("Error firing event of name " + handlerName + " to wildcard handler", e); + } + } + } +}; + Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/scripts/data-structure.js ============================================================================== --- websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/scripts/data-structure.js (added) +++ websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/scripts/data-structure.js Wed Apr 12 14:40:22 2017 @@ -0,0 +1,447 @@ +/** + * A basic set (in the mathematical sense) data structure + * + * @constructor + * @param {Array or SimileAjax.Set} [a] an initial collection + */ +SimileAjax.Set = function(a) { + this._hash = {}; + this._count = 0; + + if (a instanceof Array) { + for (var i = 0; i < a.length; i++) { + this.add(a[i]); + } + } else if (a instanceof SimileAjax.Set) { + this.addSet(a); + } +} + +/** + * Adds the given object to this set, assuming there it does not already exist + * + * @param {Object} o the object to add + * @return {Boolean} true if the object was added, false if not + */ +SimileAjax.Set.prototype.add = function(o) { + if (!(o in this._hash)) { + this._hash[o] = true; + this._count++; + return true; + } + return false; +} + +/** + * Adds each element in the given set to this set + * + * @param {SimileAjax.Set} set the set of elements to add + */ +SimileAjax.Set.prototype.addSet = function(set) { + for (var o in set._hash) { + this.add(o); + } +} + +/** + * Removes the given element from this set + * + * @param {Object} o the object to remove + * @return {Boolean} true if the object was successfully removed, + * false otherwise + */ +SimileAjax.Set.prototype.remove = function(o) { + if (o in this._hash) { + delete this._hash[o]; + this._count--; + return true; + } + return false; +} + +/** + * Removes the elements in this set that correspond to the elements in the + * given set + * + * @param {SimileAjax.Set} set the set of elements to remove + */ +SimileAjax.Set.prototype.removeSet = function(set) { + for (var o in set._hash) { + this.remove(o); + } +} + +/** + * Removes all elements in this set that are not present in the given set, i.e. + * modifies this set to the intersection of the two sets + * + * @param {SimileAjax.Set} set the set to intersect + */ +SimileAjax.Set.prototype.retainSet = function(set) { + for (var o in this._hash) { + if (!set.contains(o)) { + delete this._hash[o]; + this._count--; + } + } +} + +/** + * Returns whether or not the given element exists in this set + * + * @param {SimileAjax.Set} o the object to test for + * @return {Boolean} true if the object is present, false otherwise + */ +SimileAjax.Set.prototype.contains = function(o) { + return (o in this._hash); +} + +/** + * Returns the number of elements in this set + * + * @return {Number} the number of elements in this set + */ +SimileAjax.Set.prototype.size = function() { + return this._count; +} + +/** + * Returns the elements of this set as an array + * + * @return {Array} a new array containing the elements of this set + */ +SimileAjax.Set.prototype.toArray = function() { + var a = []; + for (var o in this._hash) { + a.push(o); + } + return a; +} + +/** + * Iterates through the elements of this set, order unspecified, executing the + * given function on each element until the function returns true + * + * @param {Function} f a function of form f(element) + */ +SimileAjax.Set.prototype.visit = function(f) { + for (var o in this._hash) { + if (f(o) == true) { + break; + } + } +} + +/** + * A sorted array data structure + * + * @constructor + */ +SimileAjax.SortedArray = function(compare, initialArray) { + this._a = (initialArray instanceof Array) ? initialArray : []; + this._compare = compare; +}; + +SimileAjax.SortedArray.prototype.add = function(elmt) { + var sa = this; + var index = this.find(function(elmt2) { + return sa._compare(elmt2, elmt); + }); + + if (index < this._a.length) { + this._a.splice(index, 0, elmt); + } else { + this._a.push(elmt); + } +}; + +SimileAjax.SortedArray.prototype.remove = function(elmt) { + var sa = this; + var index = this.find(function(elmt2) { + return sa._compare(elmt2, elmt); + }); + + while (index < this._a.length && this._compare(this._a[index], elmt) == 0) { + if (this._a[index] == elmt) { + this._a.splice(index, 1); + return true; + } else { + index++; + } + } + return false; +}; + +SimileAjax.SortedArray.prototype.removeAll = function() { + this._a = []; +}; + +SimileAjax.SortedArray.prototype.elementAt = function(index) { + return this._a[index]; +}; + +SimileAjax.SortedArray.prototype.length = function() { + return this._a.length; +}; + +SimileAjax.SortedArray.prototype.find = function(compare) { + var a = 0; + var b = this._a.length; + + while (a < b) { + var mid = Math.floor((a + b) / 2); + var c = compare(this._a[mid]); + if (mid == a) { + return c < 0 ? a+1 : a; + } else if (c < 0) { + a = mid; + } else { + b = mid; + } + } + return a; +}; + +SimileAjax.SortedArray.prototype.getFirst = function() { + return (this._a.length > 0) ? this._a[0] : null; +}; + +SimileAjax.SortedArray.prototype.getLast = function() { + return (this._a.length > 0) ? this._a[this._a.length - 1] : null; +}; + +/*================================================== + * Event Index + *================================================== + */ + +SimileAjax.EventIndex = function(unit) { + var eventIndex = this; + + this._unit = (unit != null) ? unit : SimileAjax.NativeDateUnit; + this._events = new SimileAjax.SortedArray( + function(event1, event2) { + return eventIndex._unit.compare(event1.getStart(), event2.getStart()); + } + ); + this._idToEvent = {}; + this._indexed = true; +}; + +SimileAjax.EventIndex.prototype.getUnit = function() { + return this._unit; +}; + +SimileAjax.EventIndex.prototype.getEvent = function(id) { + return this._idToEvent[id]; +}; + +SimileAjax.EventIndex.prototype.add = function(evt) { + this._events.add(evt); + this._idToEvent[evt.getID()] = evt; + this._indexed = false; +}; + +SimileAjax.EventIndex.prototype.removeAll = function() { + this._events.removeAll(); + this._idToEvent = {}; + this._indexed = false; +}; + +SimileAjax.EventIndex.prototype.getCount = function() { + return this._events.length(); +}; + +SimileAjax.EventIndex.prototype.getIterator = function(startDate, endDate) { + if (!this._indexed) { + this._index(); + } + return new SimileAjax.EventIndex._Iterator(this._events, startDate, endDate, this._unit); +}; + +SimileAjax.EventIndex.prototype.getReverseIterator = function(startDate, endDate) { + if (!this._indexed) { + this._index(); + } + return new SimileAjax.EventIndex._ReverseIterator(this._events, startDate, endDate, this._unit); +}; + +SimileAjax.EventIndex.prototype.getAllIterator = function() { + return new SimileAjax.EventIndex._AllIterator(this._events); +}; + +SimileAjax.EventIndex.prototype.getEarliestDate = function() { + var evt = this._events.getFirst(); + return (evt == null) ? null : evt.getStart(); +}; + +SimileAjax.EventIndex.prototype.getLatestDate = function() { + var evt = this._events.getLast(); + if (evt == null) { + return null; + } + + if (!this._indexed) { + this._index(); + } + + var index = evt._earliestOverlapIndex; + var date = this._events.elementAt(index).getEnd(); + for (var i = index + 1; i < this._events.length(); i++) { + date = this._unit.later(date, this._events.elementAt(i).getEnd()); + } + + return date; +}; + +SimileAjax.EventIndex.prototype._index = function() { + /* + * For each event, we want to find the earliest preceding + * event that overlaps with it, if any. + */ + + var l = this._events.length(); + for (var i = 0; i < l; i++) { + var evt = this._events.elementAt(i); + evt._earliestOverlapIndex = i; + } + + var toIndex = 1; + for (var i = 0; i < l; i++) { + var evt = this._events.elementAt(i); + var end = evt.getEnd(); + + toIndex = Math.max(toIndex, i + 1); + while (toIndex < l) { + var evt2 = this._events.elementAt(toIndex); + var start2 = evt2.getStart(); + + if (this._unit.compare(start2, end) < 0) { + evt2._earliestOverlapIndex = i; + toIndex++; + } else { + break; + } + } + } + this._indexed = true; +}; + +SimileAjax.EventIndex._Iterator = function(events, startDate, endDate, unit) { + this._events = events; + this._startDate = startDate; + this._endDate = endDate; + this._unit = unit; + + this._currentIndex = events.find(function(evt) { + return unit.compare(evt.getStart(), startDate); + }); + if (this._currentIndex - 1 >= 0) { + this._currentIndex = this._events.elementAt(this._currentIndex - 1)._earliestOverlapIndex; + } + this._currentIndex--; + + this._maxIndex = events.find(function(evt) { + return unit.compare(evt.getStart(), endDate); + }); + + this._hasNext = false; + this._next = null; + this._findNext(); +}; + +SimileAjax.EventIndex._Iterator.prototype = { + hasNext: function() { return this._hasNext; }, + next: function() { + if (this._hasNext) { + var next = this._next; + this._findNext(); + + return next; + } else { + return null; + } + }, + _findNext: function() { + var unit = this._unit; + while ((++this._currentIndex) < this._maxIndex) { + var evt = this._events.elementAt(this._currentIndex); + if (unit.compare(evt.getStart(), this._endDate) < 0 && + unit.compare(evt.getEnd(), this._startDate) > 0) { + + this._next = evt; + this._hasNext = true; + return; + } + } + this._next = null; + this._hasNext = false; + } +}; + +SimileAjax.EventIndex._ReverseIterator = function(events, startDate, endDate, unit) { + this._events = events; + this._startDate = startDate; + this._endDate = endDate; + this._unit = unit; + + this._minIndex = events.find(function(evt) { + return unit.compare(evt.getStart(), startDate); + }); + if (this._minIndex - 1 >= 0) { + this._minIndex = this._events.elementAt(this._minIndex - 1)._earliestOverlapIndex; + } + + this._maxIndex = events.find(function(evt) { + return unit.compare(evt.getStart(), endDate); + }); + + this._currentIndex = this._maxIndex; + this._hasNext = false; + this._next = null; + this._findNext(); +}; + +SimileAjax.EventIndex._ReverseIterator.prototype = { + hasNext: function() { return this._hasNext; }, + next: function() { + if (this._hasNext) { + var next = this._next; + this._findNext(); + + return next; + } else { + return null; + } + }, + _findNext: function() { + var unit = this._unit; + while ((--this._currentIndex) >= this._minIndex) { + var evt = this._events.elementAt(this._currentIndex); + if (unit.compare(evt.getStart(), this._endDate) < 0 && + unit.compare(evt.getEnd(), this._startDate) > 0) { + + this._next = evt; + this._hasNext = true; + return; + } + } + this._next = null; + this._hasNext = false; + } +}; + +SimileAjax.EventIndex._AllIterator = function(events) { + this._events = events; + this._index = 0; +}; + +SimileAjax.EventIndex._AllIterator.prototype = { + hasNext: function() { + return this._index < this._events.length(); + }, + next: function() { + return this._index < this._events.length() ? + this._events.elementAt(this._index++) : null; + } +}; \ No newline at end of file Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/scripts/date-time.js ============================================================================== --- websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/scripts/date-time.js (added) +++ websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/scripts/date-time.js Wed Apr 12 14:40:22 2017 @@ -0,0 +1,452 @@ +/** + * @fileOverview A collection of date/time utility functions + * @name SimileAjax.DateTime + */ + +SimileAjax.DateTime = new Object(); + +SimileAjax.DateTime.MILLISECOND = 0; +SimileAjax.DateTime.SECOND = 1; +SimileAjax.DateTime.MINUTE = 2; +SimileAjax.DateTime.HOUR = 3; +SimileAjax.DateTime.DAY = 4; +SimileAjax.DateTime.WEEK = 5; +SimileAjax.DateTime.MONTH = 6; +SimileAjax.DateTime.YEAR = 7; +SimileAjax.DateTime.DECADE = 8; +SimileAjax.DateTime.CENTURY = 9; +SimileAjax.DateTime.MILLENNIUM = 10; + +SimileAjax.DateTime.EPOCH = -1; +SimileAjax.DateTime.ERA = -2; + +/** + * An array of unit lengths, expressed in milliseconds, of various lengths of + * time. The array indices are predefined and stored as properties of the + * SimileAjax.DateTime object, e.g. SimileAjax.DateTime.YEAR. + * @type Array + */ +SimileAjax.DateTime.gregorianUnitLengths = []; + (function() { + var d = SimileAjax.DateTime; + var a = d.gregorianUnitLengths; + + a[d.MILLISECOND] = 1; + a[d.SECOND] = 1000; + a[d.MINUTE] = a[d.SECOND] * 60; + a[d.HOUR] = a[d.MINUTE] * 60; + a[d.DAY] = a[d.HOUR] * 24; + a[d.WEEK] = a[d.DAY] * 7; + a[d.MONTH] = a[d.DAY] * 31; + a[d.YEAR] = a[d.DAY] * 365; + a[d.DECADE] = a[d.YEAR] * 10; + a[d.CENTURY] = a[d.YEAR] * 100; + a[d.MILLENNIUM] = a[d.YEAR] * 1000; + })(); + +SimileAjax.DateTime._dateRegexp = new RegExp( + "^(-?)([0-9]{4})(" + [ + "(-?([0-9]{2})(-?([0-9]{2}))?)", // -month-dayOfMonth + "(-?([0-9]{3}))", // -dayOfYear + "(-?W([0-9]{2})(-?([1-7]))?)" // -Wweek-dayOfWeek + ].join("|") + ")?$" +); +SimileAjax.DateTime._timezoneRegexp = new RegExp( + "Z|(([-+])([0-9]{2})(:?([0-9]{2}))?)$" +); +SimileAjax.DateTime._timeRegexp = new RegExp( + "^([0-9]{2})(:?([0-9]{2})(:?([0-9]{2})(\.([0-9]+))?)?)?$" +); + +/** + * Takes a date object and a string containing an ISO 8601 date and sets the + * the date using information parsed from the string. Note that this method + * does not parse any time information. + * + * @param {Date} dateObject the date object to modify + * @param {String} string an ISO 8601 string to parse + * @return {Date} the modified date object + */ +SimileAjax.DateTime.setIso8601Date = function(dateObject, string) { + /* + * This function has been adapted from dojo.date, v.0.3.0 + * http://dojotoolkit.org/. + */ + + var d = string.match(SimileAjax.DateTime._dateRegexp); + if(!d) { + throw new Error("Invalid date string: " + string); + } + + var sign = (d[1] == "-") ? -1 : 1; // BC or AD + var year = sign * d[2]; + var month = d[5]; + var date = d[7]; + var dayofyear = d[9]; + var week = d[11]; + var dayofweek = (d[13]) ? d[13] : 1; + + dateObject.setUTCFullYear(year); + if (dayofyear) { + dateObject.setUTCMonth(0); + dateObject.setUTCDate(Number(dayofyear)); + } else if (week) { + dateObject.setUTCMonth(0); + dateObject.setUTCDate(1); + var gd = dateObject.getUTCDay(); + var day = (gd) ? gd : 7; + var offset = Number(dayofweek) + (7 * Number(week)); + + if (day <= 4) { + dateObject.setUTCDate(offset + 1 - day); + } else { + dateObject.setUTCDate(offset + 8 - day); + } + } else { + if (month) { + dateObject.setUTCDate(1); + dateObject.setUTCMonth(month - 1); + } + if (date) { + dateObject.setUTCDate(date); + } + } + + return dateObject; +}; + +/** + * Takes a date object and a string containing an ISO 8601 time and sets the + * the time using information parsed from the string. Note that this method + * does not parse any date information. + * + * @param {Date} dateObject the date object to modify + * @param {String} string an ISO 8601 string to parse + * @return {Date} the modified date object + */ +SimileAjax.DateTime.setIso8601Time = function (dateObject, string) { + /* + * This function has been adapted from dojo.date, v.0.3.0 + * http://dojotoolkit.org/. + */ + + var d = string.match(SimileAjax.DateTime._timeRegexp); + if(!d) { + SimileAjax.Debug.warn("Invalid time string: " + string); + return false; + } + var hours = d[1]; + var mins = Number((d[3]) ? d[3] : 0); + var secs = (d[5]) ? d[5] : 0; + var ms = d[7] ? (Number("0." + d[7]) * 1000) : 0; + + dateObject.setUTCHours(hours); + dateObject.setUTCMinutes(mins); + dateObject.setUTCSeconds(secs); + dateObject.setUTCMilliseconds(ms); + + return dateObject; +}; + +/** + * The timezone offset in minutes in the user's browser. + * @type Number + */ +SimileAjax.DateTime.timezoneOffset = new Date().getTimezoneOffset(); + +/** + * Takes a date object and a string containing an ISO 8601 date and time and + * sets the date object using information parsed from the string. + * + * @param {Date} dateObject the date object to modify + * @param {String} string an ISO 8601 string to parse + * @return {Date} the modified date object + */ +SimileAjax.DateTime.setIso8601 = function (dateObject, string){ + /* + * This function has been adapted from dojo.date, v.0.3.0 + * http://dojotoolkit.org/. + */ + + var offset = null; + var comps = (string.indexOf("T") == -1) ? string.split(" ") : string.split("T"); + + SimileAjax.DateTime.setIso8601Date(dateObject, comps[0]); + if (comps.length == 2) { + // first strip timezone info from the end + var d = comps[1].match(SimileAjax.DateTime._timezoneRegexp); + if (d) { + if (d[0] == 'Z') { + offset = 0; + } else { + offset = (Number(d[3]) * 60) + Number(d[5]); + offset *= ((d[2] == '-') ? 1 : -1); + } + comps[1] = comps[1].substr(0, comps[1].length - d[0].length); + } + + SimileAjax.DateTime.setIso8601Time(dateObject, comps[1]); + } + if (offset == null) { + offset = dateObject.getTimezoneOffset(); // local time zone if no tz info + } + dateObject.setTime(dateObject.getTime() + offset * 60000); + + return dateObject; +}; + +/** + * Takes a string containing an ISO 8601 date and returns a newly instantiated + * date object with the parsed date and time information from the string. + * + * @param {String} string an ISO 8601 string to parse + * @return {Date} a new date object created from the string + */ +SimileAjax.DateTime.parseIso8601DateTime = function (string) { + try { + return SimileAjax.DateTime.setIso8601(new Date(0), string); + } catch (e) { + return null; + } +}; + +/** + * Takes a string containing a Gregorian date and time and returns a newly + * instantiated date object with the parsed date and time information from the + * string. If the param is actually an instance of Date instead of a string, + * simply returns the given date instead. + * + * @param {Object} o an object, to either return or parse as a string + * @return {Date} the date object + */ +SimileAjax.DateTime.parseGregorianDateTime = function(o) { + if (o == null) { + return null; + } else if (o instanceof Date) { + return o; + } + + var s = o.toString(); + if (s.length > 0 && s.length < 8) { + var space = s.indexOf(" "); + if (space > 0) { + var year = parseInt(s.substr(0, space)); + var suffix = s.substr(space + 1); + if (suffix.toLowerCase() == "bc") { + year = 1 - year; + } + } else { + var year = parseInt(s); + } + + var d = new Date(0); + d.setUTCFullYear(year); + + return d; + } + + try { + return new Date(Date.parse(s)); + } catch (e) { + return null; + } +}; + +/** + * Rounds date objects down to the nearest interval or multiple of an interval. + * This method modifies the given date object, converting it to the given + * timezone if specified. + * + * @param {Date} date the date object to round + * @param {Number} intervalUnit a constant, integer index specifying an + * interval, e.g. SimileAjax.DateTime.HOUR + * @param {Number} timeZone a timezone shift, given in hours + * @param {Number} multiple a multiple of the interval to round by + * @param {Number} firstDayOfWeek an integer specifying the first day of the + * week, 0 corresponds to Sunday, 1 to Monday, etc. + */ +SimileAjax.DateTime.roundDownToInterval = function(date, intervalUnit, timeZone, multiple, firstDayOfWeek) { + var timeShift = timeZone * + SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR]; + + var date2 = new Date(date.getTime() + timeShift); + var clearInDay = function(d) { + d.setUTCMilliseconds(0); + d.setUTCSeconds(0); + d.setUTCMinutes(0); + d.setUTCHours(0); + }; + var clearInYear = function(d) { + clearInDay(d); + d.setUTCDate(1); + d.setUTCMonth(0); + }; + + switch(intervalUnit) { + case SimileAjax.DateTime.MILLISECOND: + var x = date2.getUTCMilliseconds(); + date2.setUTCMilliseconds(x - (x % multiple)); + break; + case SimileAjax.DateTime.SECOND: + date2.setUTCMilliseconds(0); + + var x = date2.getUTCSeconds(); + date2.setUTCSeconds(x - (x % multiple)); + break; + case SimileAjax.DateTime.MINUTE: + date2.setUTCMilliseconds(0); + date2.setUTCSeconds(0); + + var x = date2.getUTCMinutes(); + date2.setTime(date2.getTime() - + (x % multiple) * SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.MINUTE]); + break; + case SimileAjax.DateTime.HOUR: + date2.setUTCMilliseconds(0); + date2.setUTCSeconds(0); + date2.setUTCMinutes(0); + + var x = date2.getUTCHours(); + date2.setUTCHours(x - (x % multiple)); + break; + case SimileAjax.DateTime.DAY: + clearInDay(date2); + break; + case SimileAjax.DateTime.WEEK: + clearInDay(date2); + var d = (date2.getUTCDay() + 7 - firstDayOfWeek) % 7; + date2.setTime(date2.getTime() - + d * SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.DAY]); + break; + case SimileAjax.DateTime.MONTH: + clearInDay(date2); + date2.setUTCDate(1); + + var x = date2.getUTCMonth(); + date2.setUTCMonth(x - (x % multiple)); + break; + case SimileAjax.DateTime.YEAR: + clearInYear(date2); + + var x = date2.getUTCFullYear(); + date2.setUTCFullYear(x - (x % multiple)); + break; + case SimileAjax.DateTime.DECADE: + clearInYear(date2); + date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / 10) * 10); + break; + case SimileAjax.DateTime.CENTURY: + clearInYear(date2); + date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / 100) * 100); + break; + case SimileAjax.DateTime.MILLENNIUM: + clearInYear(date2); + date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / 1000) * 1000); + break; + } + + date.setTime(date2.getTime() - timeShift); +}; + +/** + * Rounds date objects up to the nearest interval or multiple of an interval. + * This method modifies the given date object, converting it to the given + * timezone if specified. + * + * @param {Date} date the date object to round + * @param {Number} intervalUnit a constant, integer index specifying an + * interval, e.g. SimileAjax.DateTime.HOUR + * @param {Number} timeZone a timezone shift, given in hours + * @param {Number} multiple a multiple of the interval to round by + * @param {Number} firstDayOfWeek an integer specifying the first day of the + * week, 0 corresponds to Sunday, 1 to Monday, etc. + * @see SimileAjax.DateTime.roundDownToInterval + */ +SimileAjax.DateTime.roundUpToInterval = function(date, intervalUnit, timeZone, multiple, firstDayOfWeek) { + var originalTime = date.getTime(); + SimileAjax.DateTime.roundDownToInterval(date, intervalUnit, timeZone, multiple, firstDayOfWeek); + if (date.getTime() < originalTime) { + date.setTime(date.getTime() + + SimileAjax.DateTime.gregorianUnitLengths[intervalUnit] * multiple); + } +}; + +/** + * Increments a date object by a specified interval, taking into + * consideration the timezone. + * + * @param {Date} date the date object to increment + * @param {Number} intervalUnit a constant, integer index specifying an + * interval, e.g. SimileAjax.DateTime.HOUR + * @param {Number} timeZone the timezone offset in hours + */ +SimileAjax.DateTime.incrementByInterval = function(date, intervalUnit, timeZone) { + timeZone = (typeof timeZone == 'undefined') ? 0 : timeZone; + + var timeShift = timeZone * + SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR]; + + var date2 = new Date(date.getTime() + timeShift); + + switch(intervalUnit) { + case SimileAjax.DateTime.MILLISECOND: + date2.setTime(date2.getTime() + 1) + break; + case SimileAjax.DateTime.SECOND: + date2.setTime(date2.getTime() + 1000); + break; + case SimileAjax.DateTime.MINUTE: + date2.setTime(date2.getTime() + + SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.MINUTE]); + break; + case SimileAjax.DateTime.HOUR: + date2.setTime(date2.getTime() + + SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR]); + break; + case SimileAjax.DateTime.DAY: + date2.setUTCDate(date2.getUTCDate() + 1); + break; + case SimileAjax.DateTime.WEEK: + date2.setUTCDate(date2.getUTCDate() + 7); + break; + case SimileAjax.DateTime.MONTH: + date2.setUTCMonth(date2.getUTCMonth() + 1); + break; + case SimileAjax.DateTime.YEAR: + date2.setUTCFullYear(date2.getUTCFullYear() + 1); + break; + case SimileAjax.DateTime.DECADE: + date2.setUTCFullYear(date2.getUTCFullYear() + 10); + break; + case SimileAjax.DateTime.CENTURY: + date2.setUTCFullYear(date2.getUTCFullYear() + 100); + break; + case SimileAjax.DateTime.MILLENNIUM: + date2.setUTCFullYear(date2.getUTCFullYear() + 1000); + break; + } + + date.setTime(date2.getTime() - timeShift); +}; + +/** + * Returns a new date object with the given time offset removed. + * + * @param {Date} date the starting date + * @param {Number} timeZone a timezone specified in an hour offset to remove + * @return {Date} a new date object with the offset removed + */ +SimileAjax.DateTime.removeTimeZoneOffset = function(date, timeZone) { + return new Date(date.getTime() + + timeZone * SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR]); +}; + +/** + * Returns the timezone of the user's browser. + * + * @return {Number} the timezone in the user's locale in hours + */ +SimileAjax.DateTime.getTimezone = function() { + var d = new Date().getTimezoneOffset(); + return d / -60; +}; Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/scripts/debug.js ============================================================================== --- websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/scripts/debug.js (added) +++ websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/scripts/debug.js Wed Apr 12 14:40:22 2017 @@ -0,0 +1,94 @@ +/*================================================== + * Debug Utility Functions + *================================================== + */ + +SimileAjax.Debug = { + silent: false +}; + +SimileAjax.Debug.log = function(msg) { + var f; + if ("console" in window && "log" in window.console) { // FireBug installed + f = function(msg2) { + console.log(msg2); + } + } else { + f = function(msg2) { + if (!SimileAjax.Debug.silent) { + alert(msg2); + } + } + } + SimileAjax.Debug.log = f; + f(msg); +}; + +SimileAjax.Debug.warn = function(msg) { + var f; + if ("console" in window && "warn" in window.console) { // FireBug installed + f = function(msg2) { + console.warn(msg2); + } + } else { + f = function(msg2) { + if (!SimileAjax.Debug.silent) { + alert(msg2); + } + } + } + SimileAjax.Debug.warn = f; + f(msg); +}; + +SimileAjax.Debug.exception = function(e, msg) { + var f, params = SimileAjax.parseURLParameters(); + if (params.errors == "throw" || SimileAjax.params.errors == "throw") { + f = function(e2, msg2) { + throw(e2); // do not hide from browser's native debugging features + }; + } else if ("console" in window && "error" in window.console) { // FireBug installed + f = function(e2, msg2) { + if (msg2 != null) { + console.error(msg2 + " %o", e2); + } else { + console.error(e2); + } + throw(e2); // do not hide from browser's native debugging features + }; + } else { + f = function(e2, msg2) { + if (!SimileAjax.Debug.silent) { + alert("Caught exception: " + msg2 + "\n\nDetails: " + ("description" in e2 ? e2.description : e2)); + } + throw(e2); // do not hide from browser's native debugging features + }; + } + SimileAjax.Debug.exception = f; + f(e, msg); +}; + +SimileAjax.Debug.objectToString = function(o) { + return SimileAjax.Debug._objectToString(o, ""); +}; + +SimileAjax.Debug._objectToString = function(o, indent) { + var indent2 = indent + " "; + if (typeof o == "object") { + var s = "{"; + for (n in o) { + s += indent2 + n + ": " + SimileAjax.Debug._objectToString(o[n], indent2) + "\n"; + } + s += indent + "}"; + return s; + } else if (typeof o == "array") { + var s = "["; + for (var n = 0; n < o.length; n++) { + s += SimileAjax.Debug._objectToString(o[n], indent2) + "\n"; + } + s += indent + "]"; + return s; + } else { + return o; + } +}; Added: websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/scripts/dom.js ============================================================================== --- websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/scripts/dom.js (added) +++ websites/staging/ooo-site/trunk/content/scripts/simile-widget/ajax/2.2.3/scripts/dom.js Wed Apr 12 14:40:22 2017 @@ -0,0 +1,355 @@ +/*================================================== + * DOM Utility Functions + *================================================== + */ + +SimileAjax.DOM = new Object(); + +SimileAjax.DOM.registerEventWithObject = function(elmt, eventName, obj, handlerName) { + SimileAjax.DOM.registerEvent(elmt, eventName, function(elmt2, evt, target) { + return obj[handlerName].call(obj, elmt2, evt, target); + }); +}; + +SimileAjax.DOM.registerEvent = function(elmt, eventName, handler) { + var handler2 = function(evt) { + evt = (evt) ? evt : ((event) ? event : null); + if (evt) { + var target = (evt.target) ? + evt.target : ((evt.srcElement) ? evt.srcElement : null); + if (target) { + target = (target.nodeType == 1 || target.nodeType == 9) ? + target : target.parentNode; + } + + return handler(elmt, evt, target); + } + return true; + } + + if (SimileAjax.Platform.browser.isIE) { + elmt.attachEvent("on" + eventName, handler2); + } else { + elmt.addEventListener(eventName, handler2, false); + } +}; + +SimileAjax.DOM.getPageCoordinates = function(elmt) { + var left = 0; + var top = 0; + + if (elmt.nodeType != 1) { + elmt = elmt.parentNode; + } + + var elmt2 = elmt; + while (elmt2 != null) { + left += elmt2.offsetLeft; + top += elmt2.offsetTop; + elmt2 = elmt2.offsetParent; + } + + var body = document.body; + while (elmt != null && elmt != body) { + if ("scrollLeft" in elmt) { + left -= elmt.scrollLeft; + top -= elmt.scrollTop; + } + elmt = elmt.parentNode; + } + + return { left: left, top: top }; +}; + +SimileAjax.DOM.getSize = function(elmt) { + var w = this.getStyle(elmt,"width"); + var h = this.getStyle(elmt,"height"); + if (w.indexOf("px") > -1) w = w.replace("px",""); + if (h.indexOf("px") > -1) h = h.replace("px",""); + return { + w: w, + h: h + } +} + +SimileAjax.DOM.getStyle = function(elmt, styleProp) { + if (elmt.currentStyle) { // IE + var style = elmt.currentStyle[styleProp]; + } else if (window.getComputedStyle) { // standard DOM + var style = document.defaultView.getComputedStyle(elmt, null).getPropertyValue(styleProp); + } else { + var style = ""; + } + return style; +} + +SimileAjax.DOM.getEventRelativeCoordinates = function(evt, elmt) { + if (SimileAjax.Platform.browser.isIE) { + if (evt.type == "mousewheel") { + var coords = SimileAjax.DOM.getPageCoordinates(elmt); + return { + x: evt.clientX - coords.left, + y: evt.clientY - coords.top + }; + } else { + return { + x: evt.offsetX, + y: evt.offsetY + }; + } + } else { + var coords = SimileAjax.DOM.getPageCoordinates(elmt); + + if ((evt.type == "DOMMouseScroll") && + SimileAjax.Platform.browser.isFirefox && + (SimileAjax.Platform.browser.majorVersion == 2)) { + // Due to: https://bugzilla.mozilla.org/show_bug.cgi?id=352179 + + return { + x: evt.screenX - coords.left, + y: evt.screenY - coords.top + }; + } else { + return { + x: evt.pageX - coords.left, + y: evt.pageY - coords.top + }; + } + } +}; + +SimileAjax.DOM.getEventPageCoordinates = function(evt) { + if (SimileAjax.Platform.browser.isIE) { + + var scrOfY = 0; + var scrOfX = 0; + + if (document.body && (document.body.scrollLeft || document.body.scrollTop)) { + //DOM compliant + scrOfY = document.body.scrollTop; + scrOfX = document.body.scrollLeft; + } else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) { + //IE6 standards compliant mode + scrOfY = document.documentElement.scrollTop; + scrOfX = document.documentElement.scrollLeft; + } + + return { x: evt.clientX + scrOfX, y: evt.clientY + scrOfY }; + } else { + return { + x: evt.pageX, + y: evt.pageY + }; + } +}; + +SimileAjax.DOM.hittest = function(x, y, except) { + return SimileAjax.DOM._hittest(document.body, x, y, except); +}; + +SimileAjax.DOM._hittest = function(elmt, x, y, except) { + var childNodes = elmt.childNodes; + outer: for (var i = 0; i < childNodes.length; i++) { + var childNode = childNodes[i]; + for (var j = 0; j < except.length; j++) { + if (childNode == except[j]) { + continue outer; + } + } + + if (childNode.offsetWidth == 0 && childNode.offsetHeight == 0) { + /* + * Sometimes SPAN elements have zero width and height but + * they have children like DIVs that cover non-zero areas. + */ + var hitNode = SimileAjax.DOM._hittest(childNode, x, y, except); + if (hitNode != childNode) { + return hitNode; + } + } else { + var top = 0; + var left = 0; + + var node = childNode; + while (node) { + top += node.offsetTop; + left += node.offsetLeft; + node = node.offsetParent; + } + + if (left <= x && top <= y && (x - left) < childNode.offsetWidth && (y - top) < childNode.offsetHeight) { + return SimileAjax.DOM._hittest(childNode, x, y, except); + } else if (childNode.nodeType == 1 && childNode.tagName == "TR") { + /* + * Table row might have cells that span several rows. + */ + var childNode2 = SimileAjax.DOM._hittest(childNode, x, y, except); + if (childNode2 != childNode) { + return childNode2; + } + } + } + } + return elmt; +}; + +SimileAjax.DOM.cancelEvent = function(evt) { + evt.returnValue = false; + evt.cancelBubble = true; + if ("preventDefault" in evt) { + evt.preventDefault(); + } +}; + +SimileAjax.DOM.appendClassName = function(elmt, className) { + var classes = elmt.className.split(" "); + for (var i = 0; i < classes.length; i++) { + if (classes[i] == className) { + return; + } + } + classes.push(className); + elmt.className = classes.join(" "); +}; + +SimileAjax.DOM.createInputElement = function(type) { + var div = document.createElement("div"); + div.innerHTML = "<input type='" + type + "' />"; + + return div.firstChild; +}; + +SimileAjax.DOM.createDOMFromTemplate = function(template) { + var result = {}; + result.elmt = SimileAjax.DOM._createDOMFromTemplate(template, result, null); + + return result; +}; + +SimileAjax.DOM._createDOMFromTemplate = function(templateNode, result, parentElmt) { + if (templateNode == null) { + /* + var node = doc.createTextNode("--null--"); + if (parentElmt != null) { + parentElmt.appendChild(node); + } + return node; + */ + return null; + } else if (typeof templateNode != "object") { + var node = document.createTextNode(templateNode); + if (parentElmt != null) { + parentElmt.appendChild(node); + } + return node; + } else { + var elmt = null; + if ("tag" in templateNode) { + var tag = templateNode.tag; + if (parentElmt != null) { + if (tag == "tr") { + elmt = parentElmt.insertRow(parentElmt.rows.length); + } else if (tag == "td") { + elmt = parentElmt.insertCell(parentElmt.cells.length); + } + } + if (elmt == null) { + elmt = tag == "input" ? + SimileAjax.DOM.createInputElement(templateNode.type) : + document.createElement(tag); + + if (parentElmt != null) { + parentElmt.appendChild(elmt); + } + } + } else { + elmt = templateNode.elmt; + if (parentElmt != null) { + parentElmt.appendChild(elmt); + } + } + + for (var attribute in templateNode) { + var value = templateNode[attribute]; + + if (attribute == "field") { + result[value] = elmt; + + } else if (attribute == "className") { + elmt.className = value; + } else if (attribute == "id") { + elmt.id = value; + } else if (attribute == "title") { + elmt.title = value; + } else if (attribute == "type" && elmt.tagName == "input") { + // do nothing + } else if (attribute == "style") { + for (n in value) { + var v = value[n]; + if (n == "float") { + n = SimileAjax.Platform.browser.isIE ? "styleFloat" : "cssFloat"; + } + elmt.style[n] = v; + } + } else if (attribute == "children") { + for (var i = 0; i < value.length; i++) { + SimileAjax.DOM._createDOMFromTemplate(value[i], result, elmt); + } + } else if (attribute != "tag" && attribute != "elmt") { + elmt.setAttribute(attribute, value); + } + } + return elmt; + } +} + +SimileAjax.DOM._cachedParent = null; +SimileAjax.DOM.createElementFromString = function(s) { + if (SimileAjax.DOM._cachedParent == null) { + SimileAjax.DOM._cachedParent = document.createElement("div"); + } + SimileAjax.DOM._cachedParent.innerHTML = s; + return SimileAjax.DOM._cachedParent.firstChild; +}; + +SimileAjax.DOM.createDOMFromString = function(root, s, fieldElmts) { + var elmt = typeof root == "string" ? document.createElement(root) : root; + elmt.innerHTML = s; + + var dom = { elmt: elmt }; + SimileAjax.DOM._processDOMChildrenConstructedFromString(dom, elmt, fieldElmts != null ? fieldElmts : {} ); + + return dom; +}; + +SimileAjax.DOM._processDOMConstructedFromString = function(dom, elmt, fieldElmts) { + var id = elmt.id; + if (id != null && id.length > 0) { + elmt.removeAttribute("id"); + if (id in fieldElmts) { + var parentElmt = elmt.parentNode; + parentElmt.insertBefore(fieldElmts[id], elmt); + parentElmt.removeChild(elmt); + + dom[id] = fieldElmts[id]; + return; + } else { + dom[id] = elmt; + } + } + + if (elmt.hasChildNodes()) { + SimileAjax.DOM._processDOMChildrenConstructedFromString(dom, elmt, fieldElmts); + } +}; + +SimileAjax.DOM._processDOMChildrenConstructedFromString = function(dom, elmt, fieldElmts) { + var node = elmt.firstChild; + while (node != null) { + var node2 = node.nextSibling; + if (node.nodeType == 1) { + SimileAjax.DOM._processDOMConstructedFromString(dom, node, fieldElmts); + } + node = node2; + } +};