[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/js/yahoo/yui/examples autocomplete/js/...
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] phpgwapi/js/yahoo/yui/examples autocomplete/js/... |
Date: |
Mon, 25 Sep 2006 11:52:30 +0000 |
CVSROOT: /cvsroot/phpgwapi
Module name: phpgwapi
Changes by: Dave Hall <skwashd> 06/09/25 11:52:30
Added files:
js/yahoo/yui/examples/autocomplete/js: json.js
states_jsfunction.js
js/yahoo/yui/examples/container/js: PanelEffect.js PhotoBox.js
js/yahoo/yui/examples/dragdrop/js: DDList.js DDMy.js DDMy2.js
DDOnTop.js DDPlayer.js
DDResize.js DDResize2.js
DDSwap.js color.js key.js
log.js
js/yahoo/yui/examples/slider/js: color.js key.js log.js
logger.js
js/yahoo/yui/examples/treeview/js: CheckOnClickNode.js
TaskNode.js
dpSyntaxHighlighter.js
json.js key.js log.js
Log message:
more example files.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/autocomplete/js/json.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/autocomplete/js/states_jsfunction.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/container/js/PanelEffect.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/container/js/PhotoBox.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/dragdrop/js/DDList.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/dragdrop/js/DDMy.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/dragdrop/js/DDMy2.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/dragdrop/js/DDOnTop.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/dragdrop/js/DDPlayer.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/dragdrop/js/DDResize.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/dragdrop/js/DDResize2.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/dragdrop/js/DDSwap.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/dragdrop/js/color.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/dragdrop/js/key.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/dragdrop/js/log.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/slider/js/color.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/slider/js/key.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/slider/js/log.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/slider/js/logger.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/treeview/js/CheckOnClickNode.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/treeview/js/TaskNode.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/treeview/js/dpSyntaxHighlighter.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/treeview/js/json.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/treeview/js/key.js?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/js/yahoo/yui/examples/treeview/js/log.js?cvsroot=phpgwapi&rev=1.1
Patches:
Index: autocomplete/js/json.js
===================================================================
RCS file: autocomplete/js/json.js
diff -N autocomplete/js/json.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ autocomplete/js/json.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,150 @@
+/*
+Copyright (c) 2005 JSON.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The Software shall be used for Good, not Evil.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+/*
+ The global object JSON contains two methods.
+
+ JSON.stringify(value) takes a JavaScript value and produces a JSON text.
+ The value must not be cyclical.
+
+ JSON.parse(text) takes a JSON text and produces a JavaScript value. It will
+ throw a 'JSONError' exception if there is an error.
+*/
+var JSON = {
+ copyright: '(c)2005 JSON.org',
+ license: 'http://www.crockford.com/JSON/license.html',
+/*
+ Stringify a JavaScript value, producing a JSON text.
+*/
+ stringify: function (v) {
+ var a = [];
+
+/*
+ Emit a string.
+*/
+ function e(s) {
+ a[a.length] = s;
+ }
+
+/*
+ Convert a value.
+*/
+ function g(x) {
+ var c, i, l, v;
+
+ switch (typeof x) {
+ case 'object':
+ if (x) {
+ if (x instanceof Array) {
+ e('[');
+ l = a.length;
+ for (i = 0; i < x.length; i += 1) {
+ v = x[i];
+ if (typeof v != 'undefined' &&
+ typeof v != 'function') {
+ if (l < a.length) {
+ e(',');
+ }
+ g(v);
+ }
+ }
+ e(']');
+ return;
+ } else if (typeof x.valueOf == 'function') {
+ e('{');
+ l = a.length;
+ for (i in x) {
+ v = x[i];
+ if (typeof v != 'undefined' &&
+ typeof v != 'function' &&
+ (!v || typeof v != 'object' ||
+ typeof v.valueOf == 'function')) {
+ if (l < a.length) {
+ e(',');
+ }
+ g(i);
+ e(':');
+ g(v);
+ }
+ }
+ return e('}');
+ }
+ }
+ e('null');
+ return;
+ case 'number':
+ e(isFinite(x) ? +x : 'null');
+ return;
+ case 'string':
+ l = x.length;
+ e('"');
+ for (i = 0; i < l; i += 1) {
+ c = x.charAt(i);
+ if (c >= ' ') {
+ if (c == '\\' || c == '"') {
+ e('\\');
+ }
+ e(c);
+ } else {
+ switch (c) {
+ case '\b':
+ e('\\b');
+ break;
+ case '\f':
+ e('\\f');
+ break;
+ case '\n':
+ e('\\n');
+ break;
+ case '\r':
+ e('\\r');
+ break;
+ case '\t':
+ e('\\t');
+ break;
+ default:
+ c = c.charCodeAt();
+ e('\\u00' + Math.floor(c / 16).toString(16) +
+ (c % 16).toString(16));
+ }
+ }
+ }
+ e('"');
+ return;
+ case 'boolean':
+ e(String(x));
+ return;
+ default:
+ e('null');
+ return;
+ }
+ }
+ g(v);
+ return a.join('');
+ },
+/*
+ Parse a JSON text, producing a JavaScript value.
+*/
+ parse: function (text) {
+ return
(/^(\s+|[,:{}\[\]]|"(\\["\\\/bfnrtu]|[^\x00-\x1f"\\]+)*"|-?\d+(\.\d*)?([eE][+-]?\d+)?|true|false|null)+$/.test(text))
&&
+ eval('(' + text + ')');
+ }
+};
Index: autocomplete/js/states_jsfunction.js
===================================================================
RCS file: autocomplete/js/states_jsfunction.js
diff -N autocomplete/js/states_jsfunction.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ autocomplete/js/states_jsfunction.js 25 Sep 2006 11:52:30 -0000
1.1
@@ -0,0 +1,107 @@
+function getStates(sQuery) {
+ aResults = [];
+ if(sQuery.length > 0) {
+ var charKey = sQuery.substring(0,1).toLowerCase();
+ var oResponse = dataset[charKey];
+
+ if(oResponse) {
+ for(var i = oResponse.length-1; i >= 0; i--) {
+ var sKey = oResponse[i].STATE;
+ var sKeyIndex =
encodeURI(sKey.toLowerCase()).indexOf(sQuery.toLowerCase());
+
+ // Query found at the beginning of the key string for
STARTSWITH
+ // returns an array of arrays where STATE is index=0, ABBR is
index=1
+ if(sKeyIndex === 0) {
+ aResults.unshift([sKey, oResponse[i].ABBR]);
+ }
+ }
+ }
+ return aResults;
+ }
+ else { return null; }
+}
+//{"STATE" : "", "ABBR" : ""}
+var dataset =
+ {'a': [{"STATE" : "Alabama", "ABBR" : "AL"},
+ {"STATE" : "Alaska", "ABBR" : "AK"},
+ {"STATE" : "Arizona", "ABBR" : "AZ"},
+ {"STATE" : "Arkansas", "ABBR" : "AR"}],
+ 'b' : [
+ ],
+ 'c' : [
+ {"STATE" : "California", "ABBR" : "CA"},
+ {"STATE" : "Colorado", "ABBR" : "CO"},
+ {"STATE" : "Connecticut", "ABBR" : "CT"}],
+ 'd' : [
+ {"STATE" : "Delaware", "ABBR" : "DE"}],
+ 'e' : [
+ ],
+ 'f' : [
+ {"STATE" : "Florida", "ABBR" : "FL"}],
+ 'g' : [
+ {"STATE" : "Georgia", "ABBR" : "GA"}],
+ 'h' : [
+ {"STATE" : "Hawaii", "ABBR" : "HI"}],
+ 'i' : [
+ {"STATE" : "Idaho", "ABBR" : "ID"},
+ {"STATE" : "Illinois", "ABBR" : "IL"},
+ {"STATE" : "Indiana", "ABBR" : "IN"},
+ {"STATE" : "Iowa", "ABBR" : "IA"}],
+ 'j' : [
+ ],
+ 'k' : [
+ {"STATE" : "Kansas", "ABBR" : "KS"},
+ {"STATE" : "Kentucky", "ABBR" : "KY"}],
+ 'l' : [
+ {"STATE" : "Louisiana", "ABBR" : "LA"}],
+ 'm' : [
+ {"STATE" : "Maine", "ABBR" : "ME"},
+ {"STATE" : "Maryland", "ABBR" : "MD"},
+ {"STATE" : "Massachusetts", "ABBR" : "MA"},
+ {"STATE" : "Michigan", "ABBR" : "MI"},
+ {"STATE" : "Minnesota", "ABBR" : "MN"},
+ {"STATE" : "Mississippi", "ABBR" : "MS"},
+ {"STATE" : "Missouri", "ABBR" : "MO"},
+ {"STATE" : "Montana", "ABBR" : "MT"}],
+ 'n' : [
+ {"STATE" : "Nebraska", "ABBR" : "NE"},
+ {"STATE" : "Nevada", "ABBR" : "NV"},
+ {"STATE" : "New Hampshire", "ABBR" : "NH"},
+ {"STATE" : "New Jersey", "ABBR" : "NJ"},
+ {"STATE" : "New Mexico", "ABBR" : "NM"},
+ {"STATE" : "New York", "ABBR" : "NY"},
+ {"STATE" : "North Dakota", "ABBR" : "ND"},
+ {"STATE" : "North Carolina", "ABBR" : "NC"}],
+ 'o' : [
+ {"STATE" : "Ohio", "ABBR" : "OH"},
+ {"STATE" : "Oklahoma", "ABBR" : "OK"},
+ {"STATE" : "Oregon", "ABBR" : "OR"}],
+ 'p' : [
+ {"STATE" : "Pennsylvania", "ABBR" : "PA"}],
+ 'q' : [
+ ],
+ 'r' : [
+ {"STATE" : "Rhode Island", "ABBR" : "RI"}],
+ 's' : [
+ {"STATE" : "South Carolina", "ABBR" : "SC"},
+ {"STATE" : "South Dakota", "ABBR" : "SD"}],
+ 't' : [
+ {"STATE" : "Tennessee", "ABBR" : "TN"},
+ {"STATE" : "Texas", "ABBR" : "TX"}],
+ 'u' : [
+ {"STATE" : "Utah", "ABBR" : "UT"}],
+ 'v' : [
+ {"STATE" : "Vermont", "ABBR" : "VT"},
+ {"STATE" : "Virginia", "ABBR" : "VA"}],
+ 'w' : [
+ {"STATE" : "Washington", "ABBR" : "WA"},
+ {"STATE" : "West Virginia", "ABBR" : "WV"},
+ {"STATE" : "Wisconsin", "ABBR" : "WI"},
+ {"STATE" : "Wyoming", "ABBR" : "WY"}],
+ 'x' : [
+ ],
+ 'y' : [
+ ],
+ 'z' : [
+ ]
+ };
Index: container/js/PanelEffect.js
===================================================================
RCS file: container/js/PanelEffect.js
diff -N container/js/PanelEffect.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ container/js/PanelEffect.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,202 @@
+/**
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+* @class
+* A collection of ContainerEffect classes specifically used for animating
Panels.
+*/
+YAHOO.widget.PanelEffect = function() { }
+
+/**
+* A pre-configured ContainerEffect instance that can be used for expanding the
Panel body vertically
+* @param {Panel} The Panel object to animate
+* @param {float} The duration of the animation
+* @type ContainerEffect
+*/
+YAHOO.widget.PanelEffect.BODY_EXPAND_V = function(overlay, dur) {
+ var offsetHeight = overlay.body.offsetHeight;
+
+ var padTop = YAHOO.util.Dom.getStyle(overlay.body, "paddingTop");
+ var padBottom = YAHOO.util.Dom.getStyle(overlay.body, "paddingBottom");
+
+
+ var expand = new YAHOO.widget.ContainerEffect(overlay, {
attributes:{height: {from:0,
to:(offsetHeight-parseInt(padTop)-parseInt(padBottom))}}, duration:dur,
method:YAHOO.util.Easing.easeIn }, { attributes:{height: {to:0}}, duration:dur,
method:YAHOO.util.Easing.easeOut}, overlay.body );
+
+ expand.handleTweenAnimateIn = function(type, args, obj) {
+ obj.overlay.cfg.refireEvent("underlay");
+ obj.overlay.cfg.refireEvent("iframe");
+ if (YAHOO.util.Dom.getStyle(obj.overlay.element, "visibility")
== "hidden") {
+ YAHOO.util.Dom.setStyle(obj.overlay.element,
"visibility", "visible");
+ }
+ }
+
+ expand.handleCompleteAnimateOut = function(type, args, obj) {
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility",
"hidden");
+ YAHOO.util.Dom.setStyle(obj.overlay.body, "height", "auto");
+ };
+
+ expand.handleTweenAnimateOut = function(type, args, obj) {
+ obj.overlay.cfg.refireEvent("underlay");
+ obj.overlay.cfg.refireEvent("iframe");
+ }
+
+ expand.init();
+ return expand;
+};
+
+/**
+* A pre-configured ContainerEffect instance that can be used for expanding the
Panel horizontally
+* @param {Panel} The Panel object to animate
+* @param {float} The duration of the animation
+* @type ContainerEffect
+*/
+YAHOO.widget.PanelEffect.EXPAND_H = function(overlay, dur) {
+ var initialWidth = YAHOO.util.Dom.getStyle(overlay.innerElement,
"width");
+
+ var offsetWidth = overlay.innerElement.offsetWidth;
+ var offsetHeight = overlay.innerElement.offsetHeight;
+
+ var expand = new YAHOO.widget.ContainerEffect(overlay, {
attributes:{width: {from:0, to:parseInt(initialWidth), unit:"em" }},
duration:dur, method:YAHOO.util.Easing.easeIn }, { attributes:{width: {to:0,
unit:"em"}}, duration:dur, method:YAHOO.util.Easing.easeOut},
overlay.innerElement );
+
+ expand.handleStartAnimateIn = function(type,args,obj) {
+ var w = obj.cachedOffsetWidth ||
obj.overlay.innerElement.offsetWidth;
+
+ if (obj.overlay.header) {
+ var padLeft =
YAHOO.util.Dom.getStyle(obj.overlay.header, "paddingLeft");
+ var padRight =
YAHOO.util.Dom.getStyle(obj.overlay.header, "paddingRight");
+ obj.overlay.header.style.width =
(w-parseInt(padLeft)-parseInt(padRight)) + "px";
+ }
+ if (obj.overlay.body) {
+ var padLeft = YAHOO.util.Dom.getStyle(obj.overlay.body,
"paddingLeft");
+ var padRight =
YAHOO.util.Dom.getStyle(obj.overlay.body, "paddingRight");
+ obj.overlay.body.style.width =
(w-parseInt(padLeft)-parseInt(padRight)) + "px";
+ }
+ if (obj.overlay.footer) {
+ var padLeft =
YAHOO.util.Dom.getStyle(obj.overlay.footer, "paddingLeft");
+ var padRight =
YAHOO.util.Dom.getStyle(obj.overlay.footer, "paddingRight");
+ obj.overlay.footer.style.width =
(w-parseInt(padLeft)-parseInt(padRight)) + "px";
+ }
+ }
+
+ expand.handleTweenAnimateIn = function(type, args, obj) {
+ obj.overlay.cfg.refireEvent("underlay");
+ obj.overlay.cfg.refireEvent("iframe");
+ if (YAHOO.util.Dom.getStyle(obj.overlay.element, "visibility")
== "hidden") {
+ YAHOO.util.Dom.setStyle(obj.overlay.element,
"visibility", "visible");
+ }
+ }
+
+ expand.handleCompleteAnimateIn = function(type,args,obj) {
+ YAHOO.util.Dom.setStyle(obj.overlay.innerElement, "height",
"auto");
+ YAHOO.util.Dom.setStyle(obj.overlay.innerElement, "width",
initialWidth);
+
+ if (obj.overlay.header) {
+ obj.overlay.header.style.width = "auto";
+ }
+ if (obj.overlay.body) {
+ obj.overlay.body.style.width = "auto";
+ }
+ if (obj.overlay.footer) {
+ obj.overlay.footer.style.width = "auto";
+ }
+ }
+
+ expand.handleStartAnimateOut = function(type,args,obj) {
+ var w = obj.overlay.innerElement.offsetWidth;
+ obj.cachedOffsetWidth = w;
+
+ if (obj.overlay.header) {
+ var padLeft =
YAHOO.util.Dom.getStyle(obj.overlay.header, "paddingLeft");
+ var padRight =
YAHOO.util.Dom.getStyle(obj.overlay.header, "paddingRight");
+ obj.overlay.header.style.width =
(w-parseInt(padLeft)-parseInt(padRight)) + "px";
+ }
+ if (obj.overlay.body) {
+ var padLeft = YAHOO.util.Dom.getStyle(obj.overlay.body,
"paddingLeft");
+ var padRight =
YAHOO.util.Dom.getStyle(obj.overlay.body, "paddingRight");
+ obj.overlay.body.style.width =
(w-parseInt(padLeft)-parseInt(padRight)) + "px";
+ }
+ if (obj.overlay.footer) {
+ var padLeft =
YAHOO.util.Dom.getStyle(obj.overlay.footer, "paddingLeft");
+ var padRight =
YAHOO.util.Dom.getStyle(obj.overlay.footer, "paddingRight");
+ obj.overlay.footer.style.width =
(w-parseInt(padLeft)-parseInt(padRight)) + "px";
+ }
+ }
+
+ expand.handleTweenAnimateOut = function(type, args, obj) {
+ obj.overlay.cfg.refireEvent("underlay");
+ obj.overlay.cfg.refireEvent("iframe");
+ }
+
+ expand.handleCompleteAnimateOut = function(type, args, obj) {
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility",
"hidden");
+ YAHOO.util.Dom.setStyle(obj.overlay.innerElement, "height",
"auto");
+ YAHOO.util.Dom.setStyle(obj.overlay.innerElement, "width",
initialWidth);
+
+ if (obj.overlay.header) {
+ obj.overlay.header.style.width = "auto";
+ }
+ if (obj.overlay.body) {
+ obj.overlay.body.style.width = "auto";
+ }
+ if (obj.overlay.footer) {
+ obj.overlay.footer.style.width = "auto";
+ }
+ };
+
+ expand.init();
+ return expand;
+};
+
+
+/**
+* A pre-configured ContainerEffect instance that can be used for expanding the
Panel vertically
+* @param {Panel} The Panel object to animate
+* @param {float} The duration of the animation
+* @type ContainerEffect
+*/
+YAHOO.widget.PanelEffect.EXPAND_V = function(overlay, dur) {
+ var offsetWidth = overlay.innerElement.offsetWidth;
+ var offsetHeight = overlay.innerElement.offsetHeight;
+
+ var expand = new YAHOO.widget.ContainerEffect(overlay, {
attributes:{height: {from:0, to:offsetHeight}}, duration:dur,
method:YAHOO.util.Easing.easeIn }, { attributes:{height: {to:0}}, duration:dur,
method:YAHOO.util.Easing.easeOut}, overlay.innerElement );
+
+ expand.handleTweenAnimateIn = function(type, args, obj) {
+ obj.overlay.cfg.refireEvent("underlay");
+ obj.overlay.cfg.refireEvent("iframe");
+ if (YAHOO.util.Dom.getStyle(obj.overlay.element, "visibility")
== "hidden") {
+ YAHOO.util.Dom.setStyle(obj.overlay.element,
"visibility", "visible");
+ }
+ }
+
+ expand.handleCompleteAnimateIn = function(type,args,obj) {
+ YAHOO.util.Dom.setStyle(obj.overlay.innerElement, "height",
"auto");
+ }
+
+ expand.handleStartAnimateOut = function(type,args,obj) {
+ var w = obj.overlay.innerElement.offsetWidth;
+ obj.cachedOffsetWidth = w;
+ }
+
+ expand.handleTweenAnimateOut = function(type, args, obj) {
+ obj.overlay.cfg.refireEvent("underlay");
+ obj.overlay.cfg.refireEvent("iframe");
+ }
+
+ expand.handleCompleteAnimateOut = function(type, args, obj) {
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility",
"hidden");
+ YAHOO.util.Dom.setStyle(obj.overlay.innerElement, "height",
"auto");
+
+ if (obj.overlay.header) {
+ obj.overlay.header.style.width = "auto";
+ }
+ if (obj.overlay.body) {
+ obj.overlay.body.style.width = "auto";
+ }
+ if (obj.overlay.footer) {
+ obj.overlay.footer.style.width = "auto";
+ }
+ };
+
+ expand.init();
+ return expand;
+};
\ No newline at end of file
Index: container/js/PhotoBox.js
===================================================================
RCS file: container/js/PhotoBox.js
diff -N container/js/PhotoBox.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ container/js/PhotoBox.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,246 @@
+/**
+Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+Code licensed under the BSD License:
+http://developer.yahoo.net/yui/license.txt
+* @class
+* Panel is an implementation of Overlay that behaves like an OS window, with a
draggable header and an optional close icon at the top right.
+* @param {string} el The element ID representing the Panel
<em>OR</em>
+* @param {Element} el The element representing the Panel
+* @param {object} userConfig The configuration object literal
containing the configuration that should be set for this Panel. See
configuration documentation for more details.
+* @constructor
+*/
+YAHOO.widget.PhotoBox = function(el, userConfig) {
+ if (arguments.length > 0) {
+ YAHOO.widget.PhotoBox.superclass.constructor.call(this, el,
userConfig);
+ }
+}
+
+YAHOO.widget.PhotoBox.prototype = new YAHOO.widget.Panel();
+YAHOO.widget.PhotoBox.prototype.constructor = YAHOO.widget.PhotoBox;
+
+/**
+* Reference to the Panel's superclass, Overlay
+* @type class
+* @final
+*/
+YAHOO.widget.PhotoBox.superclass = YAHOO.widget.Panel.prototype;
+
+/**
+* Constant representing the default CSS class used for a Panel
+* @type string
+* @final
+*/
+YAHOO.widget.PhotoBox.CSS_PHOTOBOX = "photobox";
+
+YAHOO.widget.PhotoBox.NAV_FOOTER_HTML = "<a id=\"$back.id\"
href=\"javascript:void(null)\" class=\"back\"><img src=\"img/ybox-back.gif\"
/></a><a id=\"$next.id\" href=\"javascript:void(null)\" class=\"next\"><img
src=\"img/ybox-next.gif\" /></a>";
+/*
+* The Overlay initialization method, which is executed for Overlay and all of
its subclasses. This method is automatically called by the constructor, and
sets up all DOM references for pre-existing markup, and creates required markup
if it is not already present.
+* @param {string} el The element ID representing the Overlay
<em>OR</em>
+* @param {Element} el The element representing the Overlay
+* @param {object} userConfig The configuration object literal
containing the configuration that should be set for this Overlay. See
configuration documentation for more details.
+*/
+YAHOO.widget.PhotoBox.prototype.init = function(el, userConfig) {
+ YAHOO.widget.PhotoBox.superclass.init.call(this, el/*, userConfig*/);
// Note that we don't pass the user config in here yet because we only want it
executed once, at the lowest subclass level
+
+ this.beforeInitEvent.fire(YAHOO.widget.PhotoBox);
+
+ YAHOO.util.Dom.addClass(this.innerElement,
YAHOO.widget.PhotoBox.CSS_PHOTOBOX);
+
+ if (userConfig) {
+ this.cfg.applyConfig(userConfig, true);
+ }
+
+
this.setFooter(YAHOO.widget.PhotoBox.NAV_FOOTER_HTML.replace("$back.id",this.id+"_back").replace("$next.id",this.id+"_next"));
+
+ this.renderEvent.subscribe(function() {
+ var back = document.getElementById(this.id + "_back");
+ var next = document.getElementById(this.id + "_next");
+
+ YAHOO.util.Event.addListener(back, "click", this.back, this,
true);
+ YAHOO.util.Event.addListener(next, "click", this.next, this,
true);
+
+ }, this, true);
+
+ this.initEvent.fire(YAHOO.widget.PhotoBox);
+}
+
+/**
+* Initializes the custom events for Module which are fired automatically at
appropriate times by the Module class.
+*/
+YAHOO.widget.PhotoBox.prototype.initEvents = function() {
+ YAHOO.widget.PhotoBox.superclass.initEvents.call(this);
+
+ this.showMaskEvent = new YAHOO.util.CustomEvent("showMask");
+ this.hideMaskEvent = new YAHOO.util.CustomEvent("hideMask");
+}
+
+/**
+* Initializes the class's configurable properties which can be changed using
the Panel's Config object (cfg).
+*/
+YAHOO.widget.PhotoBox.prototype.initDefaultConfig = function() {
+ YAHOO.widget.PhotoBox.superclass.initDefaultConfig.call(this);
+
+ this.cfg.addProperty("photos", { handler:this.configPhotos,
suppressEvent:true });
+}
+
+YAHOO.widget.PhotoBox.prototype.images = new Array();
+
+YAHOO.widget.PhotoBox.prototype.configPhotos = function(type, args, obj) {
+ var photos = args[0];
+
+ if (photos) {
+ this.images = new Array();
+
+ if (! (photos instanceof Array)) {
+ photos = [photos];
+ }
+
+ this.currentImage = 0;
+
+ if (photos.length == 1) {
+ this.footer.style.display = "none";
+ }
+
+ for (var p=0;p<photos.length;p++) {
+ var photo = photos[p];
+ var img = new Image();
+ img.src = photo.src;
+ img.title = photo.caption;
+ img.id = this.id + "_img";
+ img.width = 500
+ this.images[this.images.length] = img;
+ }
+
+ this.setImage(0);
+ }
+
+}
+
+YAHOO.widget.PhotoBox.prototype.setImage = function(index) {
+ var photos = this.cfg.getProperty("photos");
+
+ if (photos) {
+ if (! (photos instanceof Array)) {
+ photos = [photos];
+ }
+
+ var back = document.getElementById(this.id + "_back");
+ var next = document.getElementById(this.id + "_next");
+ var img = document.getElementById(this.id + "_img");
+ var title = document.getElementById(this.id + "_title");
+
+ this.currentImage = index;
+
+ var current = this.images[index];
+
+ var imgNode = document.createElement("IMG");
+ imgNode.setAttribute("src",current.src);
+ imgNode.setAttribute("title",current.title);
+ imgNode.setAttribute("width",500);
+ imgNode.setAttribute("id",current.id);
+
+
+ img.parentNode.replaceChild((this.browser ==
"safari"?imgNode:current), img);
+
+ this.body.style.height = "auto";
+
+ //alert(this.body.style.height);
+ //img.src = current.src;
+ //img.title = current.caption;
+
+ title.innerHTML = current.title;
+
+ if (this.currentImage == 0) {
+ back.style.display = "none";
+ } else {
+ back.style.display = "block";
+ }
+
+ if (this.currentImage == (photos.length-1)) {
+ next.style.display = "none";
+ } else {
+ next.style.display = "block";
+ }
+ }
+}
+
+YAHOO.widget.PhotoBox.prototype.next = function() {
+ if (typeof this.currentImage == 'undefined') {
+ this.currentImage = 0;
+ }
+
+ this.setImage(this.currentImage+1);
+}
+
+YAHOO.widget.PhotoBox.prototype.back = function() {
+ if (typeof this.currentImage == 'undefined') {
+ this.currentImage = 0;
+ }
+
+ this.setImage(this.currentImage-1);
+}
+
+YAHOO.widget.PhotoBox.prototype.configModal = function(type, args, obj) {
+ var modal = args[0];
+
+ if (modal) {
+ this.buildMask();
+
+ if (typeof this.maskOpacity == 'undefined') {
+ this.mask.style.visibility = "hidden";
+ this.mask.style.display = "block";
+ this.maskOpacity =
YAHOO.util.Dom.getStyle(this.mask,"opacity");
+ this.mask.style.display = "none";
+ this.mask.style.visibility = "visible";
+ }
+
+ if (! YAHOO.util.Config.alreadySubscribed(
this.beforeShowEvent, this.showMask, this ) ) {
+ this.beforeShowEvent.subscribe(this.showMask, this,
true);
+ }
+ if (! YAHOO.util.Config.alreadySubscribed(
this.beforeHideEvent, this.hideMask, this) ) {
+ this.beforeHideEvent.subscribe(this.hideMask, this,
true);
+ }
+ if (! YAHOO.util.Config.alreadySubscribed(
YAHOO.widget.Overlay.windowResizeEvent, this.sizeMask, this ) ) {
+
YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.sizeMask, this, true);
+ }
+ } else {
+ this.beforeShowEvent.unsubscribe(this.showMask, this);
+ this.beforeHideEvent.unsubscribe(this.hideMask, this);
+
YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.sizeMask);
+ }
+}
+
+YAHOO.widget.PhotoBox.prototype.showMask = function() {
+ if (this.cfg.getProperty("modal") && this.mask) {
+ YAHOO.util.Dom.addClass(document.body, "masked");
+ this.sizeMask();
+
+ var o = this.maskOpacity;
+
+ if (! this.maskAnimIn) {
+ this.maskAnimIn = new YAHOO.util.Anim(this.mask,
{opacity: {to:o}}, 0.25)
+ YAHOO.util.Dom.setStyle(this.mask, "opacity", 0);
+ }
+
+ if (! this.maskAnimOut) {
+ this.maskAnimOut = new YAHOO.util.Anim(this.mask,
{opacity: {to:0}}, 0.25)
+ this.maskAnimOut.onComplete.subscribe(function() {
+
this.mask.tabIndex = -1;
+
this.mask.style.display = "none";
+
this.hideMaskEvent.fire();
+
YAHOO.util.Dom.removeClass(document.body, "masked");
+
}, this, true);
+
+ }
+ this.mask.style.display = "block";
+ this.maskAnimIn.animate();
+ this.mask.tabIndex = 0;
+ this.showMaskEvent.fire();
+ }
+}
+
+YAHOO.widget.PhotoBox.prototype.hideMask = function() {
+ if (this.cfg.getProperty("modal") && this.mask) {
+ this.maskAnimOut.animate();
+ }
+}
\ No newline at end of file
Index: dragdrop/js/DDList.js
===================================================================
RCS file: dragdrop/js/DDList.js
diff -N dragdrop/js/DDList.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dragdrop/js/DDList.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,102 @@
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+/**
+ * @class a YAHOO.util.DDProxy implementation. During the drag over event, the
+ * dragged element is inserted before the dragged-over element.
+ *
+ * @extends YAHOO.util.DDProxy
+ * @constructor
+ * @param {String} id the id of the linked element
+ * @param {String} sGroup the group of related DragDrop objects
+ */
+YAHOO.example.DDList = function(id, sGroup, config) {
+
+ if (id) {
+ this.init(id, sGroup, config);
+ this.initFrame();
+ this.logger = this.logger || YAHOO;
+ }
+
+ var s = this.getDragEl().style;
+ s.borderColor = "transparent";
+ s.backgroundColor = "#f6f5e5";
+ s.opacity = 0.76;
+ s.filter = "alpha(opacity=76)";
+};
+
+// YAHOO.example.DDList.prototype = new YAHOO.util.DDProxy();
+YAHOO.extend(YAHOO.example.DDList, YAHOO.util.DDProxy);
+
+YAHOO.example.DDList.prototype.startDrag = function(x, y) {
+ this.logger.log(this.id + " startDrag");
+
+ var dragEl = this.getDragEl();
+ var clickEl = this.getEl();
+
+ dragEl.innerHTML = clickEl.innerHTML;
+ dragEl.className = clickEl.className;
+ dragEl.style.color = clickEl.style.color;
+ dragEl.style.border = "1px solid blue";
+
+};
+
+YAHOO.example.DDList.prototype.endDrag = function(e) {
+ // disable moving the linked element
+};
+
+YAHOO.example.DDList.prototype.onDrag = function(e, id) {
+
+};
+
+YAHOO.example.DDList.prototype.onDragOver = function(e, id) {
+ // this.logger.log(this.id.toString() + " onDragOver " + id);
+ var el;
+
+ if ("string" == typeof id) {
+ el = YAHOO.util.DDM.getElement(id);
+ } else {
+ el = YAHOO.util.DDM.getBestMatch(id).getEl();
+ }
+
+ var mid = YAHOO.util.DDM.getPosY(el) + ( Math.floor(el.offsetTop / 2));
+ this.logger.log("mid: " + mid);
+
+ if (YAHOO.util.Event.getPageY(e) < mid) {
+ var el2 = this.getEl();
+ var p = el.parentNode;
+ p.insertBefore(el2, el);
+ }
+};
+
+YAHOO.example.DDList.prototype.onDragEnter = function(e, id) {
+ // this.logger.log(this.id.toString() + " onDragEnter " + id);
+ // this.getDragEl().style.border = "1px solid #449629";
+};
+
+YAHOO.example.DDList.prototype.onDragOut = function(e, id) {
+ // I need to know when we are over nothing
+ // this.getDragEl().style.border = "1px solid #964428";
+};
+
+YAHOO.example.DDList.prototype.toString = function() {
+ return "DDList " + this.id;
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+YAHOO.example.DDListBoundary = function(id, sGroup, config) {
+ if (id) {
+ this.init(id, sGroup, config);
+ this.logger = this.logger || YAHOO;
+ this.isBoundary = true;
+ }
+};
+
+// YAHOO.example.DDListBoundary.prototype = new YAHOO.util.DDTarget();
+YAHOO.extend(YAHOO.example.DDListBoundary, YAHOO.util.DDTarget);
+
+YAHOO.example.DDListBoundary.prototype.toString = function() {
+ return "DDListBoundary " + this.id;
+};
+
Index: dragdrop/js/DDMy.js
===================================================================
RCS file: dragdrop/js/DDMy.js
diff -N dragdrop/js/DDMy.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dragdrop/js/DDMy.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,48 @@
+
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+/**
+ * @class a ygDDFramed implementation where the frame only moves vertically,
and
+ * the DOM elements are swapped when one is dropped on another
+ *
+ * @extends YAHOO.util.DDProxy
+ * @constructor
+ * @param {String} id the id of the linked element
+ * @param {String} sGroup the group of related DragDrop objects
+ */
+YAHOO.example.DDMy = function(id, sGroup, config) {
+
+ if (id) {
+ this.init(id, sGroup, config);
+ this.initFrame();
+ this.logger = this.logger || YAHOO;
+ }
+
+ // The frame should only move vertically... this makes it so the user can
+ // only move content channels up and down within a column
+ this.setXConstraint(0, 0);
+};
+
+// YAHOO.example.DDMy.prototype = new YAHOO.util.DDProxy();
+YAHOO.extend(YAHOO.example.DDMy, YAHOO.util.DDProxy);
+
+YAHOO.example.DDMy.prototype.onDragDrop = function(e, id) {
+ this.logger.log(this.id + " onDragDrop");
+
+ var el;
+
+ if ("string" == typeof id) {
+ el = YAHOO.util.DDM.getElement(id);
+ } else {
+ el = YAHOO.util.DDM.getBestMatch(id).getEl();
+ }
+
+ YAHOO.util.DDM.swapNode(this.getEl(), el);
+};
+
+YAHOO.example.DDMy.prototype.endDrag = function(e) {
+ // we default behavior is to move the element to the end point when
+ // the drag is ended. In our case, we only want to move the element
+ // when it is dropped on another dd element. To override the default,
+ // we simply need to create an empty endDrag function.
+};
Index: dragdrop/js/DDMy2.js
===================================================================
RCS file: dragdrop/js/DDMy2.js
diff -N dragdrop/js/DDMy2.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dragdrop/js/DDMy2.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,62 @@
+
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+/**
+ * @class a YAHHO.util.DDProxy implementation like DDMy, but the content
+ * channels are * not restricted to one column, and we drag a miniature
+ * representation of the * content channel rather than a frame of the channel.
+ *
+ * @extends YAHOO.util.DDProxy
+ * @constructor
+ * @param {String} id the id of the linked element
+ * @param {String} sGroup the group of related DragDrop objects
+ */
+YAHOO.example.DDMy2 = function(id, sGroup, config) {
+
+ if (id) {
+ this.init(id, sGroup, config);
+ this.initFrame();
+ this.logger = this.logger || YAHOO;
+ }
+
+ // Change the style of the frame to be a miniature representation of a
+ // content channel
+ var s = this.getDragEl().style;
+ s.background = "url(img/channel.png) 0 0 no-repeat";
+ s.height = "92px";
+ s.width = "100px";
+ // s.opacity = 0.66;
+ // s.filter = "alpha(opacity=66)";
+
+ // Specify that we do not want to resize the drag frame... we want to keep
+ // the drag frame the size of our miniature content channel image
+ this.resizeFrame = false;
+
+ // Specify that we want the drag frame centered around the cursor rather
+ // than relative to the click location so that the miniature content
+ // channel appears in the location that was clicked
+ this.centerFrame = true;
+};
+
+// YAHOO.example.DDMy2.prototype = new YAHOO.util.DDProxy();
+YAHOO.extend(YAHOO.example.DDMy2, YAHOO.util.DDProxy);
+
+YAHOO.example.DDMy2.prototype.onDragDrop = function(e, id) {
+ this.logger.log(this.id + " onDragDrop");
+
+ var el;
+ if ("string" == typeof id) {
+ el = YAHOO.util.DDM.getElement(id);
+ } else {
+ el = YAHOO.util.DDM.getBestMatch(id).getEl();
+ }
+
+ YAHOO.util.DDM.swapNode(this.getEl(), el);
+};
+
+YAHOO.example.DDMy2.prototype.endDrag = function(e) {
+ // we default behavior is to move the element to the end point when
+ // the drag is ended. In our case, we only want to move the element
+ // when it is dropped on another dd element. To override the default,
+ // we simply need to create an empty endDrag function.
+};
Index: dragdrop/js/DDOnTop.js
===================================================================
RCS file: dragdrop/js/DDOnTop.js
diff -N dragdrop/js/DDOnTop.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dragdrop/js/DDOnTop.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,49 @@
+
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+/**
+ * @class a DragDrop implementation that moves the object as it is being
dragged,
+ * and keeps the object being dragged on top. This is a subclass of DD rather
+ * than DragDrop, and inherits the implementation of most of the event
listeners
+ * from that class.
+ *
+ * @extends YAHOO.util.DD
+ * @constructor
+ * @param {String} id the id of the linked element
+ * @param {String} sGroup the group of related DragDrop items
+ */
+YAHOO.example.DDOnTop = function(id, sGroup, config) {
+ if (id) {
+ this.init(id, sGroup, config);
+ this.logger = this.logger || YAHOO;
+ }
+};
+
+// YAHOO.example.DDOnTop.prototype = new YAHOO.util.DD();
+YAHOO.extend(YAHOO.example.DDOnTop, YAHOO.util.DD);
+
+/**
+ * The inital z-index of the element, stored so we can restore it later
+ *
+ * @type int
+ */
+YAHOO.example.DDOnTop.prototype.origZ = 0;
+
+YAHOO.example.DDOnTop.prototype.startDrag = function(x, y) {
+ this.logger.log(this.id + " startDrag");
+
+ var style = this.getEl().style;
+
+ // store the original z-index
+ this.origZ = style.zIndex;
+
+ // The z-index needs to be set very high so the element will indeed be on
top
+ style.zIndex = 999;
+};
+
+YAHOO.example.DDOnTop.prototype.endDrag = function(e) {
+ this.logger.log(this.id + " endDrag");
+
+ // restore the original z-index
+ this.getEl().style.zIndex = this.origZ;
+};
Index: dragdrop/js/DDPlayer.js
===================================================================
RCS file: dragdrop/js/DDPlayer.js
diff -N dragdrop/js/DDPlayer.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dragdrop/js/DDPlayer.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,169 @@
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+/////////////////////////////////////////////////////////////////////////
+
+/**
+ * @class a YAHOO.util.DDFramed implementation. During the drag over event, the
+ * dragged element is inserted before the dragged-over element.
+ *
+ * @extends YAHOO.util.DDProxy
+ * @constructor
+ * @param {String} id the id of the linked element
+ * @param {String} sGroup the group of related DragDrop objects
+ */
+YAHOO.example.DDPlayer = function(id, sGroup, config) {
+ this.initPlayer(id, sGroup);
+};
+
+// YAHOO.example.DDPlayer.prototype = new YAHOO.util.DDProxy();
+YAHOO.extend(YAHOO.example.DDPlayer, YAHOO.util.DDProxy);
+
+YAHOO.example.DDPlayer.TYPE = "DDPlayer";
+
+YAHOO.example.DDPlayer.prototype.initPlayer = function(id, sGroup, config) {
+ if (!id) { return; }
+
+ this.init(id, sGroup, config);
+ this.initFrame();
+
+ this.logger = this.logger || YAHOO;
+ var s = this.getDragEl().style;
+ s.borderColor = "transparent";
+ // s.backgroundColor = "#cccccc";
+ s.opacity = 0.76;
+ s.filter = "alpha(opacity=76)";
+
+ // specify that this is not currently a drop target
+ this.isTarget = false;
+
+ this.originalStyles = [];
+
+ this.type = YAHOO.example.DDPlayer.TYPE;
+ this.slot = null;
+
+ this.startPos = YAHOO.util.Dom.getXY( this.getEl() );
+ this.logger.log(id + " startpos: " + this.startPos);
+};
+
+YAHOO.example.DDPlayer.prototype.startDrag = function(x, y) {
+ this.logger.log(this.id + " startDrag");
+
+ var dragEl = this.getDragEl();
+ var clickEl = this.getEl();
+
+ dragEl.innerHTML = clickEl.innerHTML;
+ dragEl.className = clickEl.className;
+ dragEl.style.color = this.DDM.getStyle(clickEl, "color");;
+ dragEl.style.backgroundColor = this.DDM.getStyle(clickEl,
"backgroundColor");
+
+ var s = clickEl.style;
+ s.opacity = .1;
+ s.filter = "alpha(opacity=10)";
+
+ var targets = YAHOO.util.DDM.getRelated(this, true);
+ this.logger.log(targets.length + " targets");
+ for (var i=0; i<targets.length; i++) {
+
+ var targetEl = this.getTargetDomRef(targets[i]);
+
+ if (!this.originalStyles[targetEl.id]) {
+ this.originalStyles[targetEl.id] = targetEl.className;
+ }
+
+ targetEl.className = "target";
+ }
+};
+
+YAHOO.example.DDPlayer.prototype.getTargetDomRef = function(oDD) {
+ if (oDD.player) {
+ return oDD.player.getEl();
+ } else {
+ return oDD.getEl();
+ }
+};
+
+YAHOO.example.DDPlayer.prototype.endDrag = function(e) {
+ // reset the linked element styles
+ var s = this.getEl().style;
+ s.opacity = 1;
+ s.filter = "alpha(opacity=100)";
+
+ this.resetTargets();
+};
+
+YAHOO.example.DDPlayer.prototype.resetTargets = function() {
+
+ // reset the target styles
+ var targets = YAHOO.util.DDM.getRelated(this, true);
+ for (var i=0; i<targets.length; i++) {
+ var targetEl = this.getTargetDomRef(targets[i]);
+ var oldStyle = this.originalStyles[targetEl.id];
+ if (oldStyle) {
+ targetEl.className = oldStyle;
+ }
+ }
+};
+
+YAHOO.example.DDPlayer.prototype.onDragDrop = function(e, id) {
+ // get the drag and drop object that was targeted
+ var oDD;
+
+ if ("string" == typeof id) {
+ oDD = YAHOO.util.DDM.getDDById(id);
+ } else {
+ oDD = YAHOO.util.DDM.getBestMatch(id);
+ }
+
+ var el = this.getEl();
+
+ // check if the slot has a player in it already
+ if (oDD.player) {
+ // check if the dragged player was already in a slot
+ if (this.slot) {
+ // check to see if the player that is already in the
+ // slot can go to the slot the dragged player is in
+ // YAHOO.util.DDM.isLegalTarget is a new method
+ if ( YAHOO.util.DDM.isLegalTarget(oDD.player, this.slot) ) {
+ this.logger.log("swapping player positions");
+ YAHOO.util.DDM.moveToEl(oDD.player.getEl(), el);
+ this.slot.player = oDD.player;
+ oDD.player.slot = this.slot;
+ } else {
+ this.logger.log("moving player in slot back to start");
+ YAHOO.util.Dom.setXY(oDD.player.getEl(), oDD.player.startPos);
+ this.slot.player = null;
+ oDD.player.slot = null
+ }
+ } else {
+ // the player in the slot will be moved to the dragged
+ // players start position
+ oDD.player.slot = null;
+ YAHOO.util.DDM.moveToEl(oDD.player.getEl(), el);
+ }
+ } else {
+ // Move the player into the emply slot
+ // I may be moving off a slot so I need to clear the player ref
+ if (this.slot) {
+ this.slot.player = null;
+ }
+ }
+
+ YAHOO.util.DDM.moveToEl(el, oDD.getEl());
+ this.resetTargets();
+
+ this.slot = oDD;
+ this.slot.player = this;
+};
+
+YAHOO.example.DDPlayer.prototype.swap = function(el1, el2) {
+ var dom = YAHOO.util.Dom;
+ var pos1 = dom.getXY(el1);
+ var pos2 = dom.getXY(el2);
+ dom.setXY(el1, pos2);
+ dom.setXY(el2, pos1);
+};
+
+YAHOO.example.DDPlayer.prototype.onDragOver = function(e, id) {};
+
+YAHOO.example.DDPlayer.prototype.onDrag = function(e, id) {};
+
Index: dragdrop/js/DDResize.js
===================================================================
RCS file: dragdrop/js/DDResize.js
diff -N dragdrop/js/DDResize.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dragdrop/js/DDResize.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,46 @@
+
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+/**
+ * @extends YAHOO.util.DragDrop
+ * @constructor
+ * @param {String} handle the id of the element that will cause the resize
+ * @param {String} panel id of the element to resize
+ * @param {String} sGroup the group of related DragDrop items
+ */
+YAHOO.example.DDResize = function(panelElId, handleElId, sGroup, config) {
+ if (panelElId) {
+ this.init(panelElId, sGroup, config);
+ this.handleElId = handleElId;
+ this.setHandleElId(handleElId);
+ this.logger = this.logger || YAHOO;
+ }
+};
+
+// YAHOO.example.DDResize.prototype = new YAHOO.util.DragDrop();
+YAHOO.extend(YAHOO.example.DDResize, YAHOO.util.DragDrop);
+
+YAHOO.example.DDResize.prototype.onMouseDown = function(e) {
+ var panel = this.getEl();
+ this.startWidth = panel.offsetWidth;
+ this.startHeight = panel.offsetHeight;
+
+ this.startPos = [YAHOO.util.Event.getPageX(e),
+ YAHOO.util.Event.getPageY(e)];
+};
+
+YAHOO.example.DDResize.prototype.onDrag = function(e) {
+ var newPos = [YAHOO.util.Event.getPageX(e),
+ YAHOO.util.Event.getPageY(e)];
+
+ var offsetX = newPos[0] - this.startPos[0];
+ var offsetY = newPos[1] - this.startPos[1];
+
+ var newWidth = Math.max(this.startWidth + offsetX, 10);
+ var newHeight = Math.max(this.startHeight + offsetY, 10);
+
+ var panel = this.getEl();
+ panel.style.width = newWidth + "px";
+ panel.style.height = newHeight + "px";
+};
+
Index: dragdrop/js/DDResize2.js
===================================================================
RCS file: dragdrop/js/DDResize2.js
diff -N dragdrop/js/DDResize2.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dragdrop/js/DDResize2.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,106 @@
+
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+/**
+ * @extends YAHOO.util.DragDrop
+ * @constructor
+ * @param {String} handle the id of the element that will cause the resize
+ * @param {String} panel id of the element to resize
+ * @param {String} sGroup the group of related DragDrop items
+ */
+YAHOO.example.DDResize = function(panelElId, nwHandle,
+ neHandle, seHandle, swHandle, sGroup, config) {
+ if (panelElId) {
+ this.init(panelElId, sGroup, config);
+ this.nwHandle = nwHandle;
+ this.neHandle = neHandle;
+ this.seHandle = seHandle;
+ this.swHandle = swHandle;
+ this.setHandleElId(nwHandle);
+ this.setHandleElId(neHandle);
+ this.setHandleElId(seHandle);
+ this.setHandleElId(swHandle);
+ this.logger = this.logger || YAHOO;
+ }
+};
+
+// YAHOO.example.DDResize.prototype = new YAHOO.util.DragDrop();
+YAHOO.extend(YAHOO.example.DDResize, YAHOO.util.DragDrop);
+
+YAHOO.example.DDResize.prototype.lockAspectRatio = false;
+
+YAHOO.example.DDResize.prototype.onMouseDown = function(e) {
+ var panel = this.getEl();
+ this.startWidth = panel.offsetWidth;
+ this.startHeight = panel.offsetHeight;
+ this.panelStartPos = YAHOO.util.Dom.getXY(panel);
+
+ this.aspectRatio = this.startWidth/this.startHeight;
+ this.direction = this.getDirection(YAHOO.util.Event.getTarget(e, true).id);
+ this.logger.log("direction " + this.direction);
+
+ this.startPos = [YAHOO.util.Event.getPageX(e),
+ YAHOO.util.Event.getPageY(e)];
+};
+
+YAHOO.example.DDResize.prototype.onDrag = function(e) {
+ var newPos = [YAHOO.util.Event.getPageX(e),
+ YAHOO.util.Event.getPageY(e)];
+
+ var offsetX = newPos[0] - this.startPos[0];
+ var offsetY = (this.lockAspectRatio) ? offsetX : newPos[1] -
this.startPos[1];
+
+ var newWidth = Math.max(this.startWidth + offsetX, 10);
+ var newHeight = Math.max(this.startHeight + offsetY, 10);
+
+ var panel = this.getEl();
+
+
+ var panelPos = YAHOO.util.Dom.getXY(panel);
+ var movePos = [this.panelStartPos[0], this.panelStartPos[1]];
+ var doMove = false;
+
+ if (this.direction == "nw" || this.direction == "sw") {
+ movePos[0] = this.panelStartPos[0] + offsetX;
+ newWidth = Math.max(this.startWidth - offsetX, 10);
+ doMove = true;
+ }
+
+ if (this.direction == "ne" || this.direction == "nw") {
+ offsetY = newPos[1] - this.startPos[1];
+ offsetX = offsetY;
+ movePos[1] = this.panelStartPos[1] + offsetY;
+ newHeight = Math.max(this.startHeight - offsetY, 10);
+ newWidth = Math.max(this.startWidth - offsetX, 10);
+ doMove = true;
+ }
+
+
+ switch (this.direction) {
+ case "nw":
+
+ }
+
+
+ if (doMove) {
+ YAHOO.util.Dom.setXY(panel, movePos);
+ }
+
+ panel.style.width = newWidth + "px";
+ panel.style.height = newHeight + "px";
+};
+
+YAHOO.example.DDResize.prototype.getDirection = function(handle) {
+ if (handle == this.nwHandle) {
+ return "nw";
+ } else if (handle == this.neHandle) {
+ return "ne";
+ } else if (handle == this.seHandle) {
+ return "se";
+ } else if (handle == this.swHandle) {
+ return "sw";
+ } else {
+ return null;
+ }
+}
+
Index: dragdrop/js/DDSwap.js
===================================================================
RCS file: dragdrop/js/DDSwap.js
diff -N dragdrop/js/DDSwap.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dragdrop/js/DDSwap.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,170 @@
+
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+/**
+ * @class a YAHOO.util.DDProxy implementation that swaps positions with the
+ * target when dropped
+ *
+ * @extends YAHOO.util.DDProxy
+ * @constructor
+ * @param {String} id the id of the linked element
+ * @param {String} sGroup the group of related DragDrop items
+ */
+YAHOO.example.DDSwap = function(id, sGroup, config) {
+ this.swapInit(id, sGroup, config);
+};
+
+YAHOO.extend(YAHOO.example.DDSwap, YAHOO.util.DDProxy);
+
+YAHOO.example.DDSwap.prototype.swapInit = function(id, sGroup, config) {
+ if (!id) { return; }
+
+ this.init(id, sGroup, config);
+ this.initFrame();
+ this.logger = this.logger || YAHOO;
+
+ /**
+ * css style to use when items are not being hovered over.
+ */
+ this.offClass = "testSquare";
+
+ /**
+ * css style to use when hovered over
+ */
+ this.onClass = "testSquareOn";
+
+ /**
+ * cache of the elements we have changed the style so we can restore it
+ * later
+ */
+ this.els = [];
+
+};
+
+YAHOO.example.DDSwap.prototype.onDragDrop = function(e, id) {
+ var dd = YAHOO.util.DDM.getDDById(id);
+ this.swap(this.getEl(), dd.getEl());
+ this.resetConstraints();
+ dd.resetConstraints();
+};
+
+YAHOO.example.DDSwap.prototype.swap = function(el1, el2) {
+ this.logger.log(this.id + " onDragDrop swap");
+
+ // Swap out the position of the two objects. This only works for
absolutely
+ // positioned elements. See for an implementation that
+ // works for relatively positioned elements
+ var s1 = el1.style;
+ var s2 = el2.style;
+
+ var l = s1.left;
+ var t = s1.top;
+
+ s1.left = s2.left;
+ s1.top = s2.top;
+
+ s2.left = l;
+ s2.top = t;
+};
+
+YAHOO.example.DDSwap.prototype.onDragEnter = function(e, id) {
+ this.logger.log(this.id + " dragEnter " + id);
+
+ // store a ref so we can restore the style later
+ this.els[id] = true;
+
+ // set the mouseover style
+ var el = YAHOO.util.DDM.getElement(id);
+ if (el.className != this.onClass) {
+ el.className = this.onClass;
+ }
+};
+
+YAHOO.example.DDSwap.prototype.onDragOut = function(e, id) {
+ this.logger.log(this.id + " dragOut " + id);
+
+ // restore the style
+ YAHOO.util.DDM.getElement(id).className = this.offClass;
+};
+
+YAHOO.example.DDSwap.prototype.endDrag = function(e) {
+ this.logger.log(this.id + " endDrag");
+ this.resetStyles();
+
+ /*
+ var el = this.getDragEl();
+ el.style.visibility = ""; // show the element first
+ var position = [100, 100];
+ var duration = 0.4;
+ var oAnim = new YAHOO.util.Motion(
+ el, { points: { to: position } }, duration,
YAHOO.util.Easing.easeOut );
+
+ oAnim.onComplete.subscribe( function() { el.style.visibility = "hidden" }
);
+*/
+
+
+};
+
+YAHOO.example.DDSwap.prototype.resetStyles = function() {
+ // restore all element styles
+ for (var i in this.els) {
+ var el = YAHOO.util.DDM.getElement(i);
+ if (el) { el.className = this.offClass; }
+ }
+};
+
+YAHOO.example.DDSwap.prototype.onDrag = function(e) { };
+
+YAHOO.example.DDSwap.prototype.onDragOver = function(e) { };
+
+
+//-------------------------------------------------------------------------
+// Intersect mode
+//-------------------------------------------------------------------------
+
+
+
+YAHOO.example.DDSwap_i = function(id, sGroup) {
+ this.swapInit(id, sGroup);
+};
+
+YAHOO.example.DDSwap_i.prototype = new YAHOO.example.DDSwap();
+
+YAHOO.example.DDSwap_i.prototype.onDragDrop = function(e, dds) {
+ // this.logger.log(this.id + " onDragDrop swap");
+ var dd = YAHOO.util.DDM.getBestMatch(dds);
+ this.swap(this.getEl(), dd.getEl());
+
+ this.resetConstraints();
+ dd.resetConstraints();
+};
+
+YAHOO.example.DDSwap_i.prototype.onDragEnter = function(e, dds) {
+ // this.logger.log(this.id + " dragEnter " + id);
+};
+
+YAHOO.example.DDSwap_i.prototype.onDragOver = function(e, dds) {
+
+ this.resetStyles();
+
+ var dd = YAHOO.util.DDM.getBestMatch(dds);
+
+ this.els[dd.id] = true;
+
+ // set the mouseover style
+ var el = dd.getEl();
+ if (el.className != this.onClass) {
+ el.className = this.onClass;
+ }
+
+};
+
+YAHOO.example.DDSwap_i.prototype.onDragOut = function(e, dds) {
+ // this.logger.log(this.id + " dragOut " + id);
+
+ // restore the style
+ for (var i=0; i<dds.length; ++i) {
+ dds[i].getEl().className = this.offClass;
+ }
+};
+
Index: dragdrop/js/color.js
===================================================================
RCS file: dragdrop/js/color.js
diff -N dragdrop/js/color.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dragdrop/js/color.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,101 @@
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+YAHOO.util.Color = new function() {
+
+ // Adapted from http://www.easyrgb.com/math.html
+ // hsv values = 0 - 1
+ // rgb values 0 - 255
+ this.hsv2rgb = function (h, s, v) {
+ var r, g, b;
+ if ( s == 0 ) {
+ r = v * 255;
+ g = v * 255;
+ b = v * 255;
+ } else {
+
+ // h must be < 1
+ var var_h = h * 6;
+ if ( var_h == 6 ) {
+ var_h = 0;
+ }
+
+ //Or ... var_i = floor( var_h )
+ var var_i = Math.floor( var_h );
+ var var_1 = v * ( 1 - s );
+ var var_2 = v * ( 1 - s * ( var_h - var_i ) );
+ var var_3 = v * ( 1 - s * ( 1 - ( var_h - var_i ) ) );
+
+ if ( var_i == 0 ) {
+ var_r = v;
+ var_g = var_3;
+ var_b = var_1;
+ } else if ( var_i == 1 ) {
+ var_r = var_2;
+ var_g = v;
+ var_b = var_1;
+ } else if ( var_i == 2 ) {
+ var_r = var_1;
+ var_g = v;
+ var_b = var_3
+ } else if ( var_i == 3 ) {
+ var_r = var_1;
+ var_g = var_2;
+ var_b = v;
+ } else if ( var_i == 4 ) {
+ var_r = var_3;
+ var_g = var_1;
+ var_b = v;
+ } else {
+ var_r = v;
+ var_g = var_1;
+ var_b = var_2
+ }
+
+ r = var_r * 255 //rgb results = 0 ÷ 255
+ g = var_g * 255
+ b = var_b * 255
+
+ }
+ return [Math.round(r), Math.round(g), Math.round(b)];
+ };
+
+ this.rgb2hex = function (r,g,b) {
+ return this.toHex(r) + this.toHex(g) + this.toHex(b);
+ };
+
+ this.hexchars = "0123456789ABCDEF";
+
+ this.toHex = function(n) {
+ n = n || 0;
+ n = parseInt(n, 10);
+ if (isNaN(n)) n = 0;
+ n = Math.round(Math.min(Math.max(0, n), 255));
+
+ return this.hexchars.charAt((n - n % 16) / 16) +
this.hexchars.charAt(n % 16);
+ };
+
+ this.toDec = function(hexchar) {
+ return this.hexchars.indexOf(hexchar.toUpperCase());
+ };
+
+ this.hex2rgb = function(str) {
+ var rgb = [];
+ rgb[0] = (this.toDec(str.substr(0, 1)) * 16) +
+ this.toDec(str.substr(1, 1));
+ rgb[1] = (this.toDec(str.substr(2, 1)) * 16) +
+ this.toDec(str.substr(3, 1));
+ rgb[2] = (this.toDec(str.substr(4, 1)) * 16) +
+ this.toDec(str.substr(5, 1));
+ // gLogger.debug("hex2rgb: " + str + ", " + rgb.toString());
+ return rgb;
+ };
+
+ this.isValidRGB = function(a) {
+ if ((!a[0] && a[0] !=0) || isNaN(a[0]) || a[0] < 0 || a[0] > 255)
return false;
+ if ((!a[1] && a[1] !=0) || isNaN(a[1]) || a[1] < 0 || a[1] > 255)
return false;
+ if ((!a[2] && a[2] !=0) || isNaN(a[2]) || a[2] < 0 || a[2] > 255)
return false;
+
+ return true;
+ };
+}
+
Index: dragdrop/js/key.js
===================================================================
RCS file: dragdrop/js/key.js
diff -N dragdrop/js/key.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dragdrop/js/key.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,34 @@
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+YAHOO.util.Key = new function() {
+ // this.logger = new ygLogger("ygEventUtil");
+ // DOM key constants
+ this.DOM_VK_UNDEFINED = 0x0;
+ this.DOM_VK_RIGHT_ALT = 0x12;
+ this.DOM_VK_LEFT_ALT = 0x12;
+ this.DOM_VK_LEFT_CONTROL = 0x11;
+ this.DOM_VK_RIGHT_CONTROL = 0x11;
+ this.DOM_VK_LEFT_SHIFT = 0x10;
+ this.DOM_VK_RIGHT_SHIFT = 0x10;
+ this.DOM_VK_META = 0x9D;
+ this.DOM_VK_BACK_SPACE = 0x08;
+ this.DOM_VK_CAPS_LOCK = 0x14;
+ this.DOM_VK_DELETE = 0x7F;
+ this.DOM_VK_END = 0x23;
+ this.DOM_VK_ENTER = 0x0D;
+ this.DOM_VK_ESCAPE = 0x1B;
+ this.DOM_VK_HOME = 0x24;
+ this.DOM_VK_NUM_LOCK = 0x90;
+ this.DOM_VK_PAUSE = 0x13;
+ this.DOM_VK_PRINTSCREEN = 0x9A;
+ this.DOM_VK_SCROLL_LOCK = 0x91;
+ this.DOM_VK_SPACE = 0x20;
+ this.DOM_VK_TAB = 0x09;
+ this.DOM_VK_LEFT = 0x25;
+ this.DOM_VK_RIGHT = 0x27;
+ this.DOM_VK_UP = 0x26;
+ this.DOM_VK_DOWN = 0x28;
+ this.DOM_VK_PAGE_DOWN = 0x22;
+ this.DOM_VK_PAGE_UP = 0x21;
+};
+
Index: dragdrop/js/log.js
===================================================================
RCS file: dragdrop/js/log.js
diff -N dragdrop/js/log.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dragdrop/js/log.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,20 @@
+// Adapter for YAHOO.widget.Logger
+
+var ygLogger = function(module) {
+ return new YAHOO.widget.LogWriter(module);
+};
+
+YAHOO.widget.LogWriter.prototype.debug = function() {
+ this.log.apply(this, arguments);
+};
+
+YAHOO.widget.LogWriter.prototype.setModuleName = function(source) {
+ this._source = source;
+};
+
+
+ygLogger.init = function(div) {
+ new YAHOO.widget.LogReader(div, {
+ height: "400px"
+ });
+};
Index: slider/js/color.js
===================================================================
RCS file: slider/js/color.js
diff -N slider/js/color.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ slider/js/color.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,101 @@
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+YAHOO.util.Color = new function() {
+
+ // Adapted from http://www.easyrgb.com/math.html
+ // hsv values = 0 - 1
+ // rgb values 0 - 255
+ this.hsv2rgb = function (h, s, v) {
+ var r, g, b;
+ if ( s == 0 ) {
+ r = v * 255;
+ g = v * 255;
+ b = v * 255;
+ } else {
+
+ // h must be < 1
+ var var_h = h * 6;
+ if ( var_h == 6 ) {
+ var_h = 0;
+ }
+
+ //Or ... var_i = floor( var_h )
+ var var_i = Math.floor( var_h );
+ var var_1 = v * ( 1 - s );
+ var var_2 = v * ( 1 - s * ( var_h - var_i ) );
+ var var_3 = v * ( 1 - s * ( 1 - ( var_h - var_i ) ) );
+
+ if ( var_i == 0 ) {
+ var_r = v;
+ var_g = var_3;
+ var_b = var_1;
+ } else if ( var_i == 1 ) {
+ var_r = var_2;
+ var_g = v;
+ var_b = var_1;
+ } else if ( var_i == 2 ) {
+ var_r = var_1;
+ var_g = v;
+ var_b = var_3
+ } else if ( var_i == 3 ) {
+ var_r = var_1;
+ var_g = var_2;
+ var_b = v;
+ } else if ( var_i == 4 ) {
+ var_r = var_3;
+ var_g = var_1;
+ var_b = v;
+ } else {
+ var_r = v;
+ var_g = var_1;
+ var_b = var_2
+ }
+
+ r = var_r * 255 //rgb results = 0 ÷ 255
+ g = var_g * 255
+ b = var_b * 255
+
+ }
+ return [Math.round(r), Math.round(g), Math.round(b)];
+ };
+
+ this.rgb2hex = function (r,g,b) {
+ return this.toHex(r) + this.toHex(g) + this.toHex(b);
+ };
+
+ this.hexchars = "0123456789ABCDEF";
+
+ this.toHex = function(n) {
+ n = n || 0;
+ n = parseInt(n, 10);
+ if (isNaN(n)) n = 0;
+ n = Math.round(Math.min(Math.max(0, n), 255));
+
+ return this.hexchars.charAt((n - n % 16) / 16) +
this.hexchars.charAt(n % 16);
+ };
+
+ this.toDec = function(hexchar) {
+ return this.hexchars.indexOf(hexchar.toUpperCase());
+ };
+
+ this.hex2rgb = function(str) {
+ var rgb = [];
+ rgb[0] = (this.toDec(str.substr(0, 1)) * 16) +
+ this.toDec(str.substr(1, 1));
+ rgb[1] = (this.toDec(str.substr(2, 1)) * 16) +
+ this.toDec(str.substr(3, 1));
+ rgb[2] = (this.toDec(str.substr(4, 1)) * 16) +
+ this.toDec(str.substr(5, 1));
+ // gLogger.debug("hex2rgb: " + str + ", " + rgb.toString());
+ return rgb;
+ };
+
+ this.isValidRGB = function(a) {
+ if ((!a[0] && a[0] !=0) || isNaN(a[0]) || a[0] < 0 || a[0] > 255)
return false;
+ if ((!a[1] && a[1] !=0) || isNaN(a[1]) || a[1] < 0 || a[1] > 255)
return false;
+ if ((!a[2] && a[2] !=0) || isNaN(a[2]) || a[2] < 0 || a[2] > 255)
return false;
+
+ return true;
+ };
+}
+
Index: slider/js/key.js
===================================================================
RCS file: slider/js/key.js
diff -N slider/js/key.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ slider/js/key.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,34 @@
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+YAHOO.util.Key = new function() {
+ // this.logger = new ygLogger("ygEventUtil");
+ // DOM key constants
+ this.DOM_VK_UNDEFINED = 0x0;
+ this.DOM_VK_RIGHT_ALT = 0x12;
+ this.DOM_VK_LEFT_ALT = 0x12;
+ this.DOM_VK_LEFT_CONTROL = 0x11;
+ this.DOM_VK_RIGHT_CONTROL = 0x11;
+ this.DOM_VK_LEFT_SHIFT = 0x10;
+ this.DOM_VK_RIGHT_SHIFT = 0x10;
+ this.DOM_VK_META = 0x9D;
+ this.DOM_VK_BACK_SPACE = 0x08;
+ this.DOM_VK_CAPS_LOCK = 0x14;
+ this.DOM_VK_DELETE = 0x7F;
+ this.DOM_VK_END = 0x23;
+ this.DOM_VK_ENTER = 0x0D;
+ this.DOM_VK_ESCAPE = 0x1B;
+ this.DOM_VK_HOME = 0x24;
+ this.DOM_VK_NUM_LOCK = 0x90;
+ this.DOM_VK_PAUSE = 0x13;
+ this.DOM_VK_PRINTSCREEN = 0x9A;
+ this.DOM_VK_SCROLL_LOCK = 0x91;
+ this.DOM_VK_SPACE = 0x20;
+ this.DOM_VK_TAB = 0x09;
+ this.DOM_VK_LEFT = 0x25;
+ this.DOM_VK_RIGHT = 0x27;
+ this.DOM_VK_UP = 0x26;
+ this.DOM_VK_DOWN = 0x28;
+ this.DOM_VK_PAGE_DOWN = 0x22;
+ this.DOM_VK_PAGE_UP = 0x21;
+};
+
Index: slider/js/log.js
===================================================================
RCS file: slider/js/log.js
diff -N slider/js/log.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ slider/js/log.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,15 @@
+// Adapter for YAHOO.widget.Logger
+
+var ygLogger = function(module) {
+ return new YAHOO.widget.LogWriter(module);
+};
+
+YAHOO.widget.LogWriter.prototype.debug = function() {
+ this.log.apply(this, arguments);
+};
+
+ygLogger.init = function(div) {
+ new YAHOO.widget.LogReader(div, {
+ height: "400px"
+ });
+};
Index: slider/js/logger.js
===================================================================
RCS file: slider/js/logger.js
diff -N slider/js/logger.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ slider/js/logger.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,1131 @@
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+/**
+ * Singleton providing core logging functionality. Saves logs written through
the
+ * global YAHOO.log function or written by LogWriter. Provides access to logs
+ * for reading by LogReader. Log messages are automatically output to Firebug,
+ * if present.
+ *
+ * requires YAHOO.util.Event Event utility
+ */
+YAHOO.widget.Logger = {
+ // Initialize members
+ loggerEnabled: true,
+ _firebugEnabled: true,
+ categories: ["info","warn","error","time","window"],
+ sources: ["global"],
+ _stack: [], // holds all log msgs
+ _startTime: new Date().getTime(), // static start timestamp
+ _lastTime: this._startTime // timestamp of last logged message
+};
+
+/***************************************************************************
+ * Events
+ ***************************************************************************/
+/**
+ * Fired when a new category has been created. Subscribers receive the
following
+ * array:<br>
+ * - args[0] The category name
+ */
+YAHOO.widget.Logger.categoryCreateEvent = new
YAHOO.util.CustomEvent("categoryCreate", this, true);
+
+/**
+ * Fired when a new source has been named. Subscribers receive the following
+ * array:<br>
+ * - args[0] The source name
+ */
+YAHOO.widget.Logger.sourceCreateEvent = new
YAHOO.util.CustomEvent("sourceCreate", this, true);
+
+/**
+ * Fired when a new log message has been created. Subscribers receive the
+ * following array:<br>
+ * - args[0] The log message
+ */
+YAHOO.widget.Logger.newLogEvent = new YAHOO.util.CustomEvent("newLog", this,
true);
+
+/**
+ * Fired when the Logger has been reset has been created.
+ */
+YAHOO.widget.Logger.logResetEvent = new YAHOO.util.CustomEvent("logReset",
this, true);
+
+/***************************************************************************
+ * Public methods
+ ***************************************************************************/
+/**
+ * Saves a log message to the stack and fires newLogEvent. If the log message
is
+ * assigned to an unknown category, creates a new category. If the log message
is
+ * from an unknown source, creates a new source. If Firebug is enabled,
+ * outputs the log message to Firebug.
+ *
+ * @param {string} sMsg The log message
+ * @param {string} sCategory Category of log message, or null
+ * @param {string} sSource Source of LogWriter, or null if global
+ */
+YAHOO.widget.Logger.log = function(sMsg, sCategory, sSource) {
+ if(this.loggerEnabled) {
+ if(!sCategory) {
+ sCategory = "info"; // default category
+ }
+ else if(this._isNewCategory(sCategory)) {
+ this._createNewCategory(sCategory);
+ }
+ if(!sSource) {
+ sSource = "global"; // default source
+ }
+ else if(this._isNewSource(sSource)) {
+ this._createNewSource(sSource);
+ }
+
+ var timestamp = new Date();
+ var logEntry = {
+ time: timestamp,
+ category: sCategory,
+ source: sSource,
+ msg: sMsg
+ };
+
+ this._stack.push(logEntry);
+ this.newLogEvent.fire(logEntry);
+
+ if(this._firebugEnabled) {
+ this._printToFirebug(logEntry);
+ }
+ return true;
+ }
+ else {
+ return false;
+ }
+};
+
+/**
+ * Resets internal stack and startTime, enables Logger, and fires
logResetEvent.
+ *
+ */
+YAHOO.widget.Logger.reset = function() {
+ this._stack = [];
+ this._startTime = new Date().getTime();
+ this.loggerEnabled = true;
+ this.log(null, "Logger reset");
+ this.logResetEvent.fire();
+};
+
+/**
+ * Public accessor to internal stack of log messages.
+ *
+ * @return {array} Array of log messages.
+ */
+YAHOO.widget.Logger.getStack = function() {
+ return this._stack;
+};
+
+/**
+ * Public accessor to internal start time.
+ *
+ * @return {date} Internal date of when Logger singleton was initialized.
+ */
+YAHOO.widget.Logger.getStartTime = function() {
+ return this._startTime;
+};
+
+/**
+ * Disables output to the Firebug Firefox extension.
+ */
+YAHOO.widget.Logger.disableFirebug = function() {
+ YAHOO.log("YAHOO.Logger output to Firebug has been disabled.");
+ this._firebugEnabled = false;
+}
+
+/**
+ * Enables output to the Firebug Firefox extension.
+ */
+YAHOO.widget.Logger.enableFirebug = function() {
+ this._firebugEnabled = true;
+ YAHOO.log("YAHOO.Logger output to Firebug has been enabled.");
+}
+
+/***************************************************************************
+ * Private methods
+ ***************************************************************************/
+/**
+ * Creates a new category of log messages and fires categoryCreateEvent.
+ *
+ * @param {string} category Category name
+ * @private
+ */
+YAHOO.widget.Logger._createNewCategory = function(category) {
+ this.categories.push(category);
+ this.categoryCreateEvent.fire(category);
+};
+
+/**
+ * Checks to see if a category has already been created.
+ *
+ * @param {string} category Category name
+ * @return {boolean} Returns true if category is unknown, else returns false
+ * @private
+ */
+YAHOO.widget.Logger._isNewCategory = function(category) {
+ for(var i=0; i < this.categories.length; i++) {
+ if(category == this.categories[i]) {
+ return false;
+ }
+ }
+ return true;
+};
+
+/**
+ * Creates a new source of log messages and fires sourceCreateEvent.
+ *
+ * @param {string} source Source name
+ * @private
+ */
+YAHOO.widget.Logger._createNewSource = function(source) {
+ this.sources.push(source);
+ this.sourceCreateEvent.fire(source);
+};
+
+/**
+ * Checks to see if a source has already been created.
+ *
+ * @param {string} source Source name
+ * @return {boolean} Returns true if source is unknown, else returns false
+ * @private
+ */
+YAHOO.widget.Logger._isNewSource = function(source) {
+ if(source) {
+ for(var i=0; i < this.sources.length; i++) {
+ if(source == this.sources[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+};
+
+/**
+ * Outputs a log message to Firebug.
+ *
+ * @param {object} entry Log entry object
+ * @private
+ */
+YAHOO.widget.Logger._printToFirebug = function(entry) {
+ var category = entry.category;
+ var label = entry.category.substring(0,4).toUpperCase();
+
+ var time = entry.time;
+ if (time.toLocaleTimeString) {
+ var localTime = time.toLocaleTimeString();
+ }
+ else {
+ localTime = time.toString();
+ }
+
+ var msecs = time.getTime();
+ var elapsedTime = msecs - this._lastTime;
+ this._lastTime = msecs;
+
+ var output = "<span class='"+category+"'>"+label+"</span> " +
+ localTime + " (" +
+ elapsedTime + "): " +
+ entry.source + ": " +
+ entry.msg;
+
+ this._firebugEnabled = printfire(output);
+};
+
+/**
+ * Firebug integration method. Outputs log message to Firebug.
+ */
+function printfire() {
+ if (window.console && console.log) {
+ for (var i=0;i<arguments.length;++i) {
+ console.log(arguments[i]);
+ }
+ return true;
+ }
+
+ return false;
+}
+
+
+/***************************************************************************
+ * Private event handlers
+ ***************************************************************************/
+/**
+ * Handles logging of messages due to window error events.
+ *
+ * @param {string} msg The error message
+ * @param {string} url URL of the error
+ * @param {string} line Line number of the error
+ * @private
+ */
+YAHOO.widget.Logger._onWindowError = function(msg,url,line) {
+ // Logger is not in scope of this event handler
+ try {
+ YAHOO.widget.Logger.log(msg+' ('+url+', line '+line+')', "window");
+ if(YAHOO.widget.Logger._origOnWindowError) {
+ YAHOO.widget.Logger._origOnWindowError();
+ }
+ }
+ catch(e) {
+ return false;
+ }
+};
+
+/**
+ * Handle native JavaScript errors
+ */
+//NB: Not all browsers support the window.onerror event
+if(window.onerror) {
+ // Save any previously defined handler to call
+ YAHOO.widget.Logger._origOnWindowError = window.onerror;
+}
+window.onerror = YAHOO.widget.Logger._onWindowError;
+
+/**
+ * First log
+ */
+YAHOO.widget.Logger.log("Logger initialized");
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+/**
+ * Class providing ability to log messages through YAHOO.widget.Logger from a
+ * named source.
+ *
+ * @constructor
+ * @param {string} sSource Source of LogWriter instance
+ */
+YAHOO.widget.LogWriter = function(sSource) {
+ this._source = sSource;
+ };
+
+/***************************************************************************
+ * Public methods
+ ***************************************************************************/
+/**
+ * Logs a message attached to the source of the LogWriter.
+ *
+ * @param {string} sMsg The log message
+ * @param {string} sCategory Category name
+ */
+YAHOO.widget.LogWriter.prototype.log = function(sMsg, sCategory) {
+ YAHOO.widget.Logger.log(sMsg, sCategory, this._source);
+};
+
+/***************************************************************************
+ * Private members
+ ***************************************************************************/
+/**
+ * Source of the log writer instance.
+ *
+ * @type string
+ * @private
+ */
+YAHOO.widget.LogWriter.prototype._source = null;
+
+
+
+/****************************************************************************/
+/****************************************************************************/
+/****************************************************************************/
+
+/**
+ * Class providing UI to read messages logged to YAHOO.widget.Logger.
+ *
+ * requires YAHOO.util.Dom DOM utility
+ * requires YAHOO.util.Event Event utility
+ * optional YAHOO.util.DragDrop Drag and drop utility
+ *
+ * @constructor
+ * @param {el or ID} containerEl DOM element object or ID of container to wrap
reader UI
+ * @param {object} oConfig Optional object literal of configuration params
+ */
+YAHOO.widget.LogReader = function(containerEl, oConfig) {
+ var oSelf = this;
+
+ // Parse config vars here
+ if (typeof oConfig == "object") {
+ for(var param in oConfig) {
+ this[param] = oConfig[param];
+ }
+ }
+
+ // Attach container...
+ if(containerEl) {
+ if(typeof containerEl == "string") {
+ this._containerEl = document.getElementById(containerEl);
+ }
+ else if(containerEl.tagName) {
+ this._containerEl = containerEl;
+ }
+ this._containerEl.className = "ylogger";
+ }
+ // ...or create container from scratch
+ if(!this._containerEl) {
+ if(YAHOO.widget.LogReader._defaultContainerEl) {
+ this._containerEl = YAHOO.widget.LogReader._defaultContainerEl;
+ }
+ else {
+ this._containerEl =
document.body.appendChild(document.createElement("div"));
+ this._containerEl.id = "ylogger";
+ this._containerEl.className = "ylogger";
+
+ YAHOO.widget.LogReader._defaultContainerEl = this._containerEl;
+ }
+
+ // If implementer has provided container values, trust and set those
+ if(this.left) {
+ this._containerEl.style.left = this.left;
+ }
+ if(this.right) {
+ this._containerEl.style.right = this.right;
+ }
+ if(this.bottom) {
+ this._containerEl.style.bottom = this.bottom;
+ }
+ if(this.top) {
+ this._containerEl.style.top = this.top;
+ }
+ if(this.fontSize) {
+ this._containerEl.style.fontSize = this.fontSize;
+ }
+ }
+
+ if(this._containerEl) {
+ // Create header
+ if(!this._hdEl) {
+ this._hdEl =
this._containerEl.appendChild(document.createElement("div"));
+ this._hdEl.id = "ylog_hd" + YAHOO.widget.LogReader._index;
+ this._hdEl.className = "ylog_hd";
+
+ this._collapseEl =
this._hdEl.appendChild(document.createElement("div"));
+ this._collapseEl.className = "ylog_btns";
+
+ this._collapseBtn = document.createElement("input");
+ this._collapseBtn.type = "button";
+ this._collapseBtn.style.fontSize =
YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");
+ this._collapseBtn.className = "button";
+ this._collapseBtn.value = "Collapse";
+ this._collapseBtn =
this._collapseEl.appendChild(this._collapseBtn);
+
YAHOO.util.Event.addListener(oSelf._collapseBtn,'click',oSelf._onClickCollapseBtn,oSelf);
+
+ this._title = this._hdEl.appendChild(document.createElement("h4"));
+ this._title.innerHTML = "Logger Console";
+
+ // If Drag and Drop utility is available...
+ // ...and this container was created from scratch...
+ // ...then make the header draggable
+ if(YAHOO.util.DD &&
+ (YAHOO.widget.LogReader._defaultContainerEl == this._containerEl))
{
+ var ylog_dd = new YAHOO.util.DD(this._containerEl.id);
+ ylog_dd.setHandleElId(this._hdEl.id);
+ this._hdEl.style.cursor = "move";
+ }
+ }
+ // Ceate console
+ if(!this._consoleEl) {
+ this._consoleEl =
this._containerEl.appendChild(document.createElement("div"));
+ this._consoleEl.className = "ylog_bd";
+
+ // If implementer has provided console, trust and set those
+ if(this.height) {
+ this._consoleEl.style.height = this.height;
+ }
+ }
+ // Don't create footer if disabled
+ if(!this._ftEl && this.footerEnabled) {
+ this._ftEl =
this._containerEl.appendChild(document.createElement("div"));
+ this._ftEl.className = "ylog_ft";
+
+ this._btnsEl =
this._ftEl.appendChild(document.createElement("div"));
+ this._btnsEl.className = "ylog_btns";
+
+ this._pauseBtn = document.createElement("input");
+ this._pauseBtn.type = "button";
+ this._pauseBtn.style.fontSize =
YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");
+ this._pauseBtn.className = "button";
+ this._pauseBtn.value = "Pause";
+ this._pauseBtn = this._btnsEl.appendChild(this._pauseBtn);
+
YAHOO.util.Event.addListener(oSelf._pauseBtn,'click',oSelf._onClickPauseBtn,oSelf);
+
+ this._clearBtn = document.createElement("input");
+ this._clearBtn.type = "button";
+ this._clearBtn.style.fontSize =
YAHOO.util.Dom.getStyle(this._containerEl,"fontSize");
+ this._clearBtn.className = "button";
+ this._clearBtn.value = "Clear";
+ this._clearBtn = this._btnsEl.appendChild(this._clearBtn);
+
YAHOO.util.Event.addListener(oSelf._clearBtn,'click',oSelf._onClickClearBtn,oSelf);
+
+ this._categoryFiltersEl =
this._ftEl.appendChild(document.createElement("div"));
+ this._categoryFiltersEl.className = "ylog_categoryfilters";
+ this._sourceFiltersEl =
this._ftEl.appendChild(document.createElement("div"));
+ this._sourceFiltersEl.className = "ylog_sourcefilters";
+ }
+ }
+
+ // Initialize buffer
+ if(!this._buffer) {
+ this._buffer = []; // output buffer
+ }
+ YAHOO.widget.Logger.newLogEvent.subscribe(this._onNewLog, this);
+ this._lastTime = YAHOO.widget.Logger.getStartTime(); // timestamp of last
log message to console
+
+ // Initialize category filters
+ this._categoryFilters = [];
+ var catsLen = YAHOO.widget.Logger.categories.length;
+ if(this._categoryFiltersEl) {
+ for(var i=0; i < catsLen; i++) {
+ this._createCategoryCheckbox(YAHOO.widget.Logger.categories[i]);
+ }
+ }
+ // Initialize source filters
+ this._sourceFilters = [];
+ var sourcesLen = YAHOO.widget.Logger.sources.length;
+ if(this._sourceFiltersEl) {
+ for(var j=0; j < sourcesLen; j++) {
+ this._createSourceCheckbox(YAHOO.widget.Logger.sources[j]);
+ }
+ }
+ YAHOO.widget.Logger.categoryCreateEvent.subscribe(this._onCategoryCreate,
this);
+ YAHOO.widget.Logger.sourceCreateEvent.subscribe(this._onSourceCreate,
this);
+
+ YAHOO.widget.LogReader._index++;
+ this._filterLogs();
+};
+
+/***************************************************************************
+ * Public members
+ ***************************************************************************/
+/**
+ * Whether or not the log reader is enabled to output log messages.
+ *
+ * @type boolean
+ */
+YAHOO.widget.LogReader.prototype.logReaderEnabled = true;
+
+/**
+ * CSS width of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.width = null;
+
+/**
+ * CSS height of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.height = null;
+
+/**
+ * CSS top position of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.top = null;
+
+/**
+ * CSS left position of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.left = null;
+
+/**
+ * CSS right position of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.right = null;
+
+/**
+ * CSS bottom position of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.bottom = null;
+
+/**
+ * CSS font size of the log reader container.
+ *
+ * @type string
+ */
+YAHOO.widget.LogReader.prototype.fontSize = null;
+
+/**
+ * Whether or not the footer UI is enabled for the log reader.
+ *
+ * @type boolean
+ */
+YAHOO.widget.LogReader.prototype.footerEnabled = true;
+
+/**
+ * Whether or not output is compact (less readable).
+ *
+ * @type boolean
+ */
+YAHOO.widget.LogReader.prototype.compact = true;
+
+/**
+ * Whether or not newest message is printed on top.
+ *
+ * @type boolean
+ */
+YAHOO.widget.LogReader.prototype.newestOnTop = true;
+
+/***************************************************************************
+ * Public methods
+ ***************************************************************************/
+/**
+ * Pauses output of log messages. While paused, log messages are not lost, but
+ * get saved to a buffer and then output upon resume of log reader.
+ */
+YAHOO.widget.LogReader.prototype.pause = function() {
+ this._timeout = null;
+ this.logReaderEnabled = false;
+};
+
+/**
+ * Resumes output of log messages, including outputting any log messages that
+ * have been saved to buffer while paused.
+ */
+YAHOO.widget.LogReader.prototype.resume = function() {
+ this.logReaderEnabled = true;
+ this._printBuffer();
+};
+
+/**
+ * Hides UI of log reader. Logging functionality is not disrupted.
+ */
+YAHOO.widget.LogReader.prototype.hide = function() {
+ this._containerEl.style.display = "none";
+};
+
+/**
+ * Shows UI of log reader. Logging functionality is not disrupted.
+ */
+YAHOO.widget.LogReader.prototype.show = function() {
+ this._containerEl.style.display = "block";
+};
+
+/**
+ * Updates title to given string.
+ *
+ * @param {string} sTitle String to display in log reader's title bar.
+ */
+YAHOO.widget.LogReader.prototype.setTitle = function(sTitle) {
+ var regEx = />/g;
+ sTitle = sTitle.replace(regEx,">");
+ regEx = /</g;
+ sTitle = sTitle.replace(regEx,"<");
+ this._title.innerHTML = (sTitle);
+};
+ /***************************************************************************
+ * Private members
+ ***************************************************************************/
+/**
+ * Internal class member to index multiple log reader instances.
+ *
+ * @type number
+ * @private
+ */
+YAHOO.widget.LogReader._index = 0;
+
+/**
+ * A class member shared by all log readers if a container needs to be
+ * created during instantiation. Will be null if a container element never
needs to
+ * be created on the fly, such as when the implementer passes in their own
element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader._defaultContainerEl = null;
+
+/**
+ * Buffer of log messages for batch output.
+ *
+ * @type array
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._buffer = null;
+
+/**
+ * Date of last output log message.
+ *
+ * @type date
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._lastTime = null;
+
+/**
+ * Batched output timeout ID.
+ *
+ * @type number
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._timeout = null;
+
+/**
+ * Array of filters for log message categories.
+ *
+ * @type array
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._categoryFilters = null;
+
+/**
+ * Array of filters for log message sources.
+ *
+ * @type array
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._sourceFilters = null;
+
+/**
+ * Log reader container element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._containerEl = null;
+
+/**
+ * Log reader header element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._hdEl = null;
+
+/**
+ * Log reader collapse element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._collapseEl = null;
+
+/**
+ * Log reader collapse button element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._collapseBtn = null;
+
+/**
+ * Log reader title header element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._title = null;
+
+/**
+ * Log reader console element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._consoleEl = null;
+
+/**
+ * Log reader footer element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._ftEl = null;
+
+/**
+ * Log reader buttons container element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._btnsEl = null;
+
+/**
+ * Container element for log reader category filter checkboxes.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._categoryFiltersEl = null;
+
+/**
+ * Container element for log reader source filter checkboxes.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._sourceFiltersEl = null;
+
+/**
+ * Log reader pause button element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._pauseBtn = null;
+
+/**
+ * lear button element.
+ *
+ * @type HTMLElement
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._clearBtn = null;
+/***************************************************************************
+ * Private methods
+ ***************************************************************************/
+/**
+ * Creates the UI for a category filter in the log reader footer element.
+ *
+ * @param {string} category Category name
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._createCategoryCheckbox = function(category) {
+ var oSelf = this;
+
+ if(this._ftEl) {
+ var parentEl = this._categoryFiltersEl;
+ var filters = this._categoryFilters;
+
+ var filterEl = parentEl.appendChild(document.createElement("span"));
+ filterEl.className = "ylog_filtergrp";
+ // Append el at the end so IE 5.5 can set "type" attribute
+ var categoryChk = document.createElement("input");
+ categoryChk.className = "ylog_filter" + category;
+ categoryChk.type = "checkbox";
+ categoryChk.category = category;
+ categoryChk.checked = true;
+ categoryChk = filterEl.appendChild(categoryChk);
+
+ // Add this checked filter to the internal array of filters
+ filters.push(category);
+ // Subscribe to the click event
+
YAHOO.util.Event.addListener(categoryChk,'click',oSelf._onCheckCategory,oSelf);
+
+ // Create and class the text label
+ var categoryChkLbl =
filterEl.appendChild(document.createElement("span"));
+ categoryChkLbl.className = category;
+ categoryChkLbl.innerHTML = category;
+ }
+};
+
+YAHOO.widget.LogReader.prototype._createSourceCheckbox = function(source) {
+ var oSelf = this;
+
+ if(this._ftEl) {
+ var parentEl = this._sourceFiltersEl;
+ var filters = this._sourceFilters;
+
+ var filterEl = parentEl.appendChild(document.createElement("span"));
+ filterEl.className = "ylog_filtergrp";
+
+ // Append el at the end so IE 5.5 can set "type" attribute
+ var sourceChk = document.createElement("input");
+ sourceChk.className = "ylog_filter" + source;
+ sourceChk.type = "checkbox";
+ sourceChk.source = source;
+ sourceChk.checked = true;
+ sourceChk = filterEl.appendChild(sourceChk);
+
+ // Add this checked filter to the internal array of filters
+ filters.push(source);
+ // Subscribe to the click event
+
YAHOO.util.Event.addListener(sourceChk,'click',oSelf._onCheckSource,oSelf);
+
+ // Create and class the text label
+ var sourceChkLbl =
filterEl.appendChild(document.createElement("span"));
+ sourceChkLbl.className = source;
+ sourceChkLbl.innerHTML = source;
+ }
+};
+
+/**
+ * Reprints all log messages in the stack through filters.
+ *
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._filterLogs = function() {
+ // Reprint stack with new filters
+ if (this._consoleEl !== null) {
+ this._clearConsole();
+ this._printToConsole(YAHOO.widget.Logger.getStack());
+ }
+};
+
+/**
+ * Clears all outputted log messages from the console and resets the time of
the
+ * last output log message.
+ *
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._clearConsole = function() {
+ // Clear the buffer of any pending messages
+ this._timeout = null;
+ this._buffer = [];
+
+ // Reset the rolling timer
+ this._lastTime = YAHOO.widget.Logger.getStartTime();
+
+ var consoleEl = this._consoleEl;
+ while(consoleEl.hasChildNodes()) {
+ consoleEl.removeChild(consoleEl.firstChild);
+ }
+};
+
+/**
+ * Sends buffer of log messages to output and clears buffer.
+ *
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._printBuffer = function() {
+ this._timeout = null;
+
+ if (this._consoleEl !== null) {
+ var entries = [];
+ for (var i=0; i<this._buffer.length; i++) {
+ entries[i] = this._buffer[i];
+ }
+ this._buffer = [];
+ this._printToConsole(entries);
+ }
+};
+
+/**
+ * Cycles through an array of log messages, and outputs each one to the console
+ * if its category has not been filtered out.
+ *
+ * @param {array} aEntries
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._printToConsole = function(aEntries) {
+//TODO: much optimization here
+//if !compactOutput, set fixed widths for time output
+ var entriesLen = aEntries.length;
+ var sourceFiltersLen = this._sourceFilters.length;
+ var categoryFiltersLen = this._categoryFilters.length;
+ // Iterate through all log entries to print the ones that filter through
+ for(var i=0; i<entriesLen; i++) {
+ var entry = aEntries[i];
+ var category = entry.category;
+ var source = entry.source;
+ var okToPrint = false;
+ var okToFilterCats = false;
+
+ for(var j=0; j<sourceFiltersLen; j++) {
+ if(source == this._sourceFilters[j]) {
+ okToFilterCats = true;
+ break;
+ }
+ }
+ if(okToFilterCats) {
+ for(var k=0; k<categoryFiltersLen; k++) {
+ if(category == this._categoryFilters[k]) {
+ okToPrint = true;
+ break;
+ }
+ }
+ }
+ if(okToPrint) {
+ // To format for console, calculate the elapsed time
+ // to be from the last item that passed through the filter,
+ // not the absolute previous item in the stack
+ var label = entry.category.substring(0,4).toUpperCase();
+
+ var time = entry.time;
+ if (time.toLocaleTimeString) {
+ var localTime = time.toLocaleTimeString();
+ }
+ else {
+ localTime = time.toString();
+ }
+
+ var msecs = time.getTime();
+ var startTime = YAHOO.widget.Logger.getStartTime();
+ var totalTime = msecs - startTime;
+ var elapsedTime = msecs - this._lastTime;
+ this._lastTime = msecs;
+
+ var compactOutput = (this.compactOutput) ? "" : "<br>";
+
+ var output = "<span class='"+category+"'>"+label+"</span> " +
+ totalTime + " ms (+" +
+ elapsedTime + ") " + localTime + ": " +
+ compactOutput+
+ source + ": "
+ + entry.msg;
+
+ var oNewElement = (this.newestOnTop) ?
+
this._consoleEl.insertBefore(document.createElement("p"),this._consoleEl.firstChild):
+ this._consoleEl.appendChild(document.createElement("p"));
+ oNewElement.innerHTML = output;
+ if(!this.newestOnTop) {
+ this._consoleEl.scrollTop = this._consoleEl.scrollHeight;
+ }
+ }
+ }
+};
+
+/***************************************************************************
+ * Private event handlers
+ ***************************************************************************/
+/**
+ * Handles Logger's categoryCreateEvent.
+ *
+ * @param {string} type The event
+ * @param {array} args Data passed from event firer
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onCategoryCreate = function(type, args,
oSelf) {
+ var category = args[0];
+ if(oSelf._ftEl) {
+ oSelf._createCategoryCheckbox(category);
+ }
+};
+
+/**
+ * Handles Logger's sourceCreateEvent.
+ *
+ * @param {string} type The event
+ * @param {array} args Data passed from event firer
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onSourceCreate = function(type, args, oSelf)
{
+ var source = args[0];
+ if(oSelf._ftEl) {
+ oSelf._createSourceCheckbox(source);
+ }
+};
+
+/**
+ * Handles check events on the category filter checkboxes.
+ *
+ * @param {event} v The click event
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onCheckCategory = function(v, oSelf) {
+ var newFilter = this.category;
+ var filtersArray = oSelf._categoryFilters;
+
+ if(!this.checked) { // Remove category from filters
+ for(var i=0; i<filtersArray.length; i++) {
+ if(newFilter == filtersArray[i]) {
+ filtersArray.splice(i, 1);
+ break;
+ }
+ }
+ }
+ else { // Add category to filters
+ filtersArray.push(newFilter);
+ }
+ oSelf._filterLogs();
+};
+
+/**
+ * Handles check events on the category filter checkboxes.
+ *
+ * @param {event} v The click event
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onCheckSource = function(v, oSelf) {
+ var newFilter = this.source;
+ var filtersArray = oSelf._sourceFilters;
+
+ if(!this.checked) { // Remove category from filters
+ for(var i=0; i<filtersArray.length; i++) {
+ if(newFilter == filtersArray[i]) {
+ filtersArray.splice(i, 1);
+ break;
+ }
+ }
+ }
+ else { // Add category to filters
+ filtersArray.push(newFilter);
+ }
+ oSelf._filterLogs();
+};
+
+/**
+ * Handles click events on the collapse button.
+ *
+ * @param {event} v The click event
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onClickCollapseBtn = function(v, oSelf) {
+ var btn = oSelf._collapseBtn;
+ if(btn.value == "Expand") {
+ oSelf._consoleEl.style.display = "block";
+ if(oSelf._ftEl) {
+ oSelf._ftEl.style.display = "block";
+ }
+ btn.value = "Collapse";
+ }
+ else {
+ oSelf._consoleEl.style.display = "none";
+ if(oSelf._ftEl) {
+ oSelf._ftEl.style.display = "none";
+ }
+ btn.value = "Expand";
+ }
+};
+
+/**
+ * Handles click events on the pause button.
+ *
+ * @param {event} v The click event
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onClickPauseBtn = function(v, oSelf) {
+ var btn = oSelf._pauseBtn;
+ if(btn.value == "Resume") {
+ oSelf.resume();
+ btn.value = "Pause";
+ }
+ else {
+ oSelf.pause();
+ btn.value = "Resume";
+ }
+};
+
+/**
+ * Handles click events on the clear button.
+ *
+ * @param {event} v The click event
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onClickClearBtn = function(v, oSelf) {
+ oSelf._clearConsole();
+};
+
+/**
+ * Handles Logger's onNewEvent.
+ *
+ * @param {string} type The click event
+ * @param {array} args Data passed from event firer
+ * @param {object} oSelf The log reader instance
+ * @private
+ */
+YAHOO.widget.LogReader.prototype._onNewLog = function(type, args, oSelf) {
+ var logEntry = args[0];
+ oSelf._buffer.push(logEntry);
+
+ if (oSelf.logReaderEnabled === true && oSelf._timeout === null) {
+ oSelf._timeout = setTimeout(function(){oSelf._printBuffer();}, 100);
+ }
+};
+
+
Index: treeview/js/CheckOnClickNode.js
===================================================================
RCS file: treeview/js/CheckOnClickNode.js
diff -N treeview/js/CheckOnClickNode.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ treeview/js/CheckOnClickNode.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,23 @@
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+YAHOO.example.CheckOnClickNode = function(oData, oParent, expanded, checked) {
+ if (oParent) {
+ this.init(oData, oParent, expanded);
+ this.setUpLabel(oData);
+ this.checked = checked;
+ }
+};
+
+YAHOO.example.CheckOnClickNode.prototype = new YAHOO.widget.TaskNode();
+
+YAHOO.example.CheckOnClickNode.prototype.getCheckLink = function() {
+ return "var n=YAHOO.widget.TreeView.getNode(\'" + this.tree.id + "\',"
+
+ this.index + "); " +
+ "var r = n.checkClick(); " +
+ "YAHOO.example.customCheckClickFunction(n);" +
+ "return r;";
+};
+
+YAHOO.example.customCheckClickFunction = function(node) {
+ alert(node.checked + "(" + node.checkState + ")");
+};
Index: treeview/js/TaskNode.js
===================================================================
RCS file: treeview/js/TaskNode.js
diff -N treeview/js/TaskNode.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ treeview/js/TaskNode.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,252 @@
+/**
+ * The check box marks a task complete. It is a simulated form field
+ * with three states ...
+ * 0=unchecked, 1=some children checked, 2=all children checked
+ * When a task is clicked, the state of the nodes and parent and children
+ * are updated, and this behavior cascades.
+ *
+ * @extends YAHOO.widget.TextNode
+ * @constructor
+ * @param oData {object} A string or object containing the data that will
+ * be used to render this node.
+ * @param oParent {Node} This node's parent node
+ * @param expanded {boolean} The initial expanded/collapsed state
+ * @param checked {boolean} The initial checked/unchecked state
+ */
+YAHOO.widget.TaskNode = function(oData, oParent, expanded, checked) {
+
+ if (oData) {
+ this.init(oData, oParent, expanded);
+ this.setUpLabel(oData);
+ if (checked && checked === true) {
+ this.check();
+ }
+
+ /*
+ if (!this.tree.checkClickEvent) {
+ this.tree.checkClickEvent =
+ new YAHOO.util.CustomEvent("checkclick", this.tree);
+ }
+ */
+ }
+
+ this.logger = new YAHOO.widget.LogWriter(this.toString());
+};
+
+YAHOO.widget.TaskNode.prototype = new YAHOO.widget.TextNode();
+
+/**
+ * True if checkstate is 1 (some children checked) or 2 (all children checked),
+ * false if 0.
+ * @type boolean
+ */
+YAHOO.widget.TaskNode.prototype.checked = false;
+
+/**
+ * checkState
+ * 0=unchecked, 1=some children checked, 2=all children checked
+ * @type int
+ */
+YAHOO.widget.TaskNode.prototype.checkState = 0;
+
+/**
+ * The id of the check element
+ * @type string
+ */
+YAHOO.widget.TaskNode.prototype.getCheckElId = function() {
+ return "ygtvcheck" + this.index;
+};
+
+/**
+ * Returns the check box element
+ * @return the check html element (img)
+ */
+YAHOO.widget.TaskNode.prototype.getCheckEl = function() {
+ return document.getElementById(this.getCheckElId());
+};
+
+/**
+ * The style of the check element, derived from its current state
+ * @return {string} the css style for the current check state
+ */
+YAHOO.widget.TaskNode.prototype.getCheckStyle = function() {
+ return "ygtvcheck" + this.checkState;
+};
+
+/**
+ * Returns the link that will invoke this node's check toggle
+ * @return {string} returns the link required to adjust the checkbox state
+ */
+YAHOO.widget.TaskNode.prototype.getCheckLink = function() {
+ return "YAHOO.widget.TreeView.getNode(\'" + this.tree.id + "\'," +
+ this.index + ").checkClick()";
+};
+
+/**
+ * Invoked when the user clicks the check box
+ */
+YAHOO.widget.TaskNode.prototype.checkClick = function() {
+ this.logger.log("previous checkstate: " + this.checkState);
+ if (this.checkState === 0) {
+ this.check();
+ } else {
+ this.uncheck();
+ }
+
+ // this.tree.checkClickEvent.fire(this);
+
+ this.onCheckClick();
+};
+
+/**
+ * Override to get the check click event
+ */
+YAHOO.widget.TaskNode.prototype.onCheckClick = function() {
+ this.logger.log("check was clicked");
+}
+
+/**
+ * Refresh the state of this node's parent, and cascade up.
+ */
+YAHOO.widget.TaskNode.prototype.updateParent = function() {
+ var p = this.parent;
+
+ if (!p || !p.updateParent) {
+ this.logger.log("Abort udpate parent: " + this.index);
+ return;
+ }
+
+ var somethingChecked = false;
+ var somethingNotChecked = false;
+
+ for (var i=0;i< p.children.length;++i) {
+ if (p.children[i].checked) {
+ somethingChecked = true;
+ // checkState will be 1 if the child node has unchecked children
+ if (p.children[i].checkState == 1) {
+ somethingNotChecked = true;
+ }
+ } else {
+ somethingNotChecked = true;
+ }
+ }
+
+ if (somethingChecked) {
+ p.setCheckState( (somethingNotChecked) ? 1 : 2 );
+ } else {
+ p.setCheckState(0);
+ }
+
+ p.updateCheckHtml();
+ p.updateParent();
+};
+
+/**
+ * If the node has been rendered, update the html to reflect the current
+ * state of the node.
+ */
+YAHOO.widget.TaskNode.prototype.updateCheckHtml = function() {
+ if (this.parent && this.parent.childrenRendered) {
+ this.getCheckEl().className = this.getCheckStyle();
+ }
+};
+
+/**
+ * Updates the state. The checked property is true if the state is 1 or 2
+ *
+ * @param the new check state
+ */
+YAHOO.widget.TaskNode.prototype.setCheckState = function(state) {
+ this.checkState = state;
+ this.checked = (state > 0);
+};
+
+/**
+ * Check this node
+ */
+YAHOO.widget.TaskNode.prototype.check = function() {
+ this.setCheckState(2);
+ for (var i=0; i<this.children.length; ++i) {
+ this.children[i].check();
+ }
+ this.updateCheckHtml();
+ this.updateParent();
+};
+
+/**
+ * Uncheck this node
+ */
+YAHOO.widget.TaskNode.prototype.uncheck = function() {
+ this.setCheckState(0);
+ for (var i=0; i<this.children.length; ++i) {
+ this.children[i].uncheck();
+ }
+ this.updateCheckHtml();
+ this.updateParent();
+};
+
+// Overrides YAHOO.widget.TextNode
+YAHOO.widget.TaskNode.prototype.getNodeHtml = function() {
+ this.logger.log("Generating html");
+ var sb = new Array();
+
+ sb[sb.length] = '<table border="0" cellpadding="0" cellspacing="0">';
+ sb[sb.length] = '<tr>';
+
+ for (i=0;i<this.depth;++i) {
+ sb[sb.length] = '<td class="' + this.getDepthStyle(i) +
'"> </td>';
+ }
+
+ sb[sb.length] = '<td';
+ sb[sb.length] = ' id="' + this.getToggleElId() + '"';
+ sb[sb.length] = ' class="' + this.getStyle() + '"';
+ if (this.hasChildren(true)) {
+ sb[sb.length] = ' onmouseover="this.className=';
+ sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\'';
+ sb[sb.length] = this.tree.id + '\',' + this.index +
').getHoverStyle()"';
+ sb[sb.length] = ' onmouseout="this.className=';
+ sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\'';
+ sb[sb.length] = this.tree.id + '\',' + this.index + ').getStyle()"';
+ }
+ sb[sb.length] = ' onclick="javascript:' + this.getToggleLink() +
'"> ';
+ sb[sb.length] = '</td>';
+
+ // check box
+ sb[sb.length] = '<td';
+ sb[sb.length] = ' id="' + this.getCheckElId() + '"';
+ sb[sb.length] = ' class="' + this.getCheckStyle() + '"';
+ sb[sb.length] = ' onclick="javascript:' + this.getCheckLink() + '">';
+ sb[sb.length] = ' </td>';
+
+
+ sb[sb.length] = '<td>';
+ sb[sb.length] = '<a';
+ sb[sb.length] = ' id="' + this.labelElId + '"';
+ sb[sb.length] = ' class="' + this.labelStyle + '"';
+ sb[sb.length] = ' href="' + this.href + '"';
+ sb[sb.length] = ' target="' + this.target + '"';
+ if (this.hasChildren(true)) {
+ sb[sb.length] = ' onmouseover="document.getElementById(\'';
+ sb[sb.length] = this.getToggleElId() + '\').className=';
+ sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\'';
+ sb[sb.length] = this.tree.id + '\',' + this.index +
').getHoverStyle()"';
+ sb[sb.length] = ' onmouseout="document.getElementById(\'';
+ sb[sb.length] = this.getToggleElId() + '\').className=';
+ sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\'';
+ sb[sb.length] = this.tree.id + '\',' + this.index + ').getStyle()"';
+ }
+ sb[sb.length] = ' >';
+ sb[sb.length] = this.label;
+ sb[sb.length] = '</a>';
+ sb[sb.length] = '</td>';
+ sb[sb.length] = '</tr>';
+ sb[sb.length] = '</table>';
+
+ return sb.join("");
+
+};
+
+YAHOO.widget.TaskNode.prototype.toString = function() {
+ return "TaskNode (" + this.index + ") " + this.label;
+};
+
Index: treeview/js/dpSyntaxHighlighter.js
===================================================================
RCS file: treeview/js/dpSyntaxHighlighter.js
diff -N treeview/js/dpSyntaxHighlighter.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ treeview/js/dpSyntaxHighlighter.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,736 @@
+/**
+ * Code Syntax Highlighter.
+ * Version 1.2.0
+ * Copyright (C) 2004 Alex Gorbatchev.
+ * http://www.dreamprojections.com/syntaxhighlighter/
+ *
+ * This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General
+ * Public License as published by the Free Software Foundation; either version
2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA
+ */
+
+//
+// create namespaces
+//
+var dp = {
+ sh : // dp.sh
+ {
+ Utils : {}, // dp.sh.Utils
+ Brushes : {}, // dp.sh.Brushes
+ Strings : {}
+ },
+ Version : '1.2.0'
+};
+
+dp.sh.Strings = {
+ AboutDialog : '<html><head><title>About...</title></head><body
class="dp-about"><table cellspacing="0"><tr><td class="copy"><div class="para
title">dp.SyntaxHighlighter</div><div class="para">Version: {V}</div><div
class="para"><a href="http://www.dreamprojections.com/sh/?ref=about"
target="_blank">http://www.dreamprojections.com/SyntaxHighlighter</a></div>©2004-2005
Alex Gorbatchev. All right reserved.</td></tr><tr><td class="footer"><input
type="button" class="close" value="OK"
onClick="window.close()"/></td></tr></table></body></html>',
+
+ // tools
+ ExpandCode : '+ expand code',
+ ViewPlain : 'view plain',
+ Print : '',
+ CopyToClipboard : '',
+ About : '',
+
+ CopiedToClipboard : 'The code is in your clipboard now.'
+};
+
+dp.SyntaxHighlighter = dp.sh;
+
+//
+// Dialog and toolbar functions
+//
+
+dp.sh.Utils.Expand = function(sender)
+{
+ var table = sender;
+ var span = sender;
+
+ // find the span in which the text label and pipe contained so we can
hide it
+ while(span != null && span.tagName != 'SPAN')
+ span = span.parentNode;
+
+ // find the table
+ while(table != null && table.tagName != 'TABLE')
+ table = table.parentNode;
+
+ // remove the 'expand code' button
+ span.parentNode.removeChild(span);
+
+ table.tBodies[0].className = 'show';
+ table.parentNode.style.height = '100%'; // containing div isn't getting
updated properly when the TBODY is shown
+}
+
+// opens a new windows and puts the original unformatted source code inside.
+dp.sh.Utils.ViewSource = function(sender)
+{
+ var code = sender.parentNode.originalCode;
+ var wnd = window.open('', '_blank', 'width=750, height=400, location=0,
resizable=1, menubar=0, scrollbars=1');
+
+ code = code.replace(/</g, '<');
+
+ wnd.document.write('<pre>' + code + '</pre>');
+ wnd.document.close();
+}
+
+// copies the original source code in to the clipboard (IE only)
+dp.sh.Utils.ToClipboard = function(sender)
+{
+ var code = sender.parentNode.originalCode;
+
+ // This works only for IE. There's a way to make it work with Mozilla
as well,
+ // but it requires security settings changed on the client, which isn't
by
+ // default, so 99% of users won't have it working anyways.
+ if(window.clipboardData)
+ {
+ window.clipboardData.setData('text', code);
+
+ alert(dp.sh.Strings.CopiedToClipboard);
+ }
+}
+
+// creates an invisible iframe, puts the original source code inside and
prints it
+dp.sh.Utils.PrintSource = function(sender)
+{
+ var td = sender.parentNode;
+ var code = td.processedCode;
+ var iframe = document.createElement('IFRAME');
+ var doc = null;
+ var wnd =
+
+ // this hides the iframe
+ iframe.style.cssText = 'position:absolute; width:0px; height:0px;
left:-5px; top:-5px;';
+
+ td.appendChild(iframe);
+
+ doc = iframe.contentWindow.document;
+ code = code.replace(/</g, '<');
+
+ doc.open();
+ doc.write('<pre>' + code + '</pre>');
+ doc.close();
+
+ iframe.contentWindow.focus();
+ iframe.contentWindow.print();
+
+ td.removeChild(iframe);
+}
+
+dp.sh.Utils.About = function()
+{
+ var wnd = window.open('', '_blank',
'dialog,width=320,height=150,scrollbars=0');
+ var doc = wnd.document;
+
+ var styles = document.getElementsByTagName('style');
+ var links = document.getElementsByTagName('link');
+
+ doc.write(dp.sh.Strings.AboutDialog.replace('{V}', dp.sh.Version));
+
+ // copy over ALL the styles from the parent page
+ for(var i = 0; i < styles.length; i++)
+ doc.write('<style>' + styles[i].innerHTML + '</style>');
+
+ for(var i = 0; i < links.length; i++)
+ if(links[i].rel.toLowerCase() == 'stylesheet')
+ doc.write('<link type="text/css" rel="stylesheet"
href="' + links[i].href + '"></link>');
+
+ doc.close();
+ wnd.focus();
+}
+
+//
+// Match object
+//
+dp.sh.Match = function(value, index, css)
+{
+ this.value = value;
+ this.index = index;
+ this.length = value.length;
+ this.css = css;
+}
+
+//
+// Highlighter object
+//
+dp.sh.Highlighter = function()
+{
+ this.addGutter = true;
+ this.addControls = true;
+ this.collapse = false;
+ this.tabsToSpaces = true;
+}
+
+// static callback for the match sorting
+dp.sh.Highlighter.SortCallback = function(m1, m2)
+{
+ // sort matches by index first
+ if(m1.index < m2.index)
+ return -1;
+ else if(m1.index > m2.index)
+ return 1;
+ else
+ {
+ // if index is the same, sort by length
+ if(m1.length < m2.length)
+ return -1;
+ else if(m1.length > m2.length)
+ return 1;
+ }
+ return 0;
+}
+
+// gets a list of all matches for a given regular expression
+dp.sh.Highlighter.prototype.GetMatches = function(regex, css)
+{
+ var index = 0;
+ var match = null;
+
+ while((match = regex.exec(this.code)) != null)
+ {
+ this.matches[this.matches.length] = new dp.sh.Match(match[0],
match.index, css);
+ }
+}
+
+dp.sh.Highlighter.prototype.AddBit = function(str, css)
+{
+ var span = document.createElement('span');
+
+ str = str.replace(/&/g, '&');
+ str = str.replace(/ /g, ' ');
+ str = str.replace(/</g, '<');
+ str = str.replace(/\n/gm, ' <br>');
+
+ // when adding a piece of code, check to see if it has line breaks in
it
+ // and if it does, wrap individual line breaks with span tags
+ if(css != null)
+ {
+ var regex = new RegExp('<br>', 'gi');
+
+ if(regex.test(str))
+ {
+ var lines = str.split(' <br>');
+
+ str = '';
+
+ for(var i = 0; i < lines.length; i++)
+ {
+ span =
document.createElement('SPAN');
+ span.className = css;
+ span.innerHTML = lines[i];
+
+ this.div.appendChild(span);
+
+ // don't add a <BR> for the last line
+ if(i + 1 < lines.length)
+
this.div.appendChild(document.createElement('BR'));
+ }
+ }
+ else
+ {
+ span.className = css;
+ span.innerHTML = str;
+ this.div.appendChild(span);
+ }
+ }
+ else
+ {
+ span.innerHTML = str;
+ this.div.appendChild(span);
+ }
+}
+
+// checks if one match is inside any other match
+dp.sh.Highlighter.prototype.IsInside = function(match)
+{
+ if(match == null || match.length == 0)
+ return;
+
+ for(var i = 0; i < this.matches.length; i++)
+ {
+ var c = this.matches[i];
+
+ if(c == null)
+ continue;
+
+ if((match.index > c.index) && (match.index <= c.index +
c.length))
+ return true;
+ }
+
+ return false;
+}
+
+dp.sh.Highlighter.prototype.ProcessRegexList = function()
+{
+ for(var i = 0; i < this.regexList.length; i++)
+ this.GetMatches(this.regexList[i].regex, this.regexList[i].css);
+}
+
+dp.sh.Highlighter.prototype.ProcessSmartTabs = function(code)
+{
+ var lines = code.split('\n');
+ var result = '';
+ var tabSize = 4;
+ var tab = '\t';
+
+ // This function inserts specified amount of spaces in the string
+ // where a tab is while removing that given tab.
+ function InsertSpaces(line, pos, count)
+ {
+ var left = line.substr(0, pos);
+ var right = line.substr(pos + 1, line.length); // pos
+ 1 will get rid of the tab
+ var spaces = '';
+
+ for(var i = 0; i < count; i++)
+ spaces += ' ';
+
+ return left + spaces + right;
+ }
+
+ // This function process one line for 'smart tabs'
+ function ProcessLine(line, tabSize)
+ {
+ if(line.indexOf(tab) == -1)
+ return line;
+
+ var pos = 0;
+
+ while((pos = line.indexOf(tab)) != -1)
+ {
+ // This is pretty much all there is to the 'smart tabs'
logic.
+ // Based on the position within the line and size of a
tab,
+ // calculate the amount of spaces we need to insert.
+ var spaces = tabSize - pos % tabSize;
+
+ line = InsertSpaces(line, pos, spaces);
+ }
+
+ return line;
+ }
+
+ // Go through all the lines and do the 'smart tabs' magic.
+ for(var i = 0; i < lines.length; i++)
+ result += ProcessLine(lines[i], tabSize) + '\n';
+
+ return result;
+}
+
+dp.sh.Highlighter.prototype.SwitchToTable = function()
+{
+ // Safari fix: for some reason lowercase <br> isn't getting picked up,
even though 'i' is set
+ var lines = this.div.innerHTML.split(/<BR>/gi);
+ var row = null;
+ var cell = null;
+ var tBody = null;
+ var html = '';
+ var pipe = ' | ';
+
+ // creates an anchor to a utility
+ function UtilHref(util, text)
+ {
+ return '<a href="#" onclick="dp.sh.Utils.' + util + '(this);
return false;">' + text + '</a>';
+ }
+
+ tBody = document.createElement('TBODY'); // can be created and
all others go to tBodies collection.
+
+ this.table.appendChild(tBody);
+
+ if(this.addGutter == true)
+ {
+ row = tBody.insertRow(-1);
+ cell = row.insertCell(-1);
+ cell.className = 'tools-corner';
+ }
+
+ if(this.addControls == true)
+ {
+ var tHead = document.createElement('THEAD'); // controls
will be placed in here
+ this.table.appendChild(tHead);
+
+ row = tHead.insertRow(-1);
+
+ // add corner if there's a gutter
+ if(this.addGutter == true)
+ {
+ cell = row.insertCell(-1);
+ cell.className = 'tools-corner';
+ }
+
+ cell = row.insertCell(-1);
+
+ // preserve some variables for the controls
+ cell.originalCode = this.originalCode;
+ cell.processedCode = this.code;
+ cell.className = 'tools';
+
+ if(this.collapse == true)
+ {
+ tBody.className = 'hide';
+ cell.innerHTML += '<span><b>' + UtilHref('Expand',
dp.sh.Strings.ExpandCode) + '</b>' + pipe + '</span>';
+ }
+
+ cell.innerHTML += UtilHref('ViewSource',
dp.sh.Strings.ViewPlain) ;
+
+ // IE has this clipboard object which is easy enough to use
+ if(window.clipboardData)
+ cell.innerHTML += pipe + UtilHref('ToClipboard',
dp.sh.Strings.CopyToClipboard);
+ }
+
+ for(var i = 0; i < lines.length - 1; i++)
+ {
+ row = tBody.insertRow(-1);
+
+ if(this.addGutter == true)
+ {
+ cell = row.insertCell(-1);
+ cell.className = 'gutter';
+ cell.innerHTML = i + 1;
+ }
+
+ cell = row.insertCell(-1);
+ cell.className = 'line' + (i % 2 + 1); // uses .line1
and .line2 css styles for alternating lines
+ cell.innerHTML = lines[i];
+ }
+
+ this.div.innerHTML = '';
+}
+
+dp.sh.Highlighter.prototype.Highlight = function(code)
+{
+ function Trim(str)
+ {
+ return str.replace(/^\s*(.*?)[\s\n]*$/g, '$1');
+ }
+
+ function Chop(str)
+ {
+ return str.replace(/\n*$/, '').replace(/^\n*/, '');
+ }
+
+ function Unindent(str)
+ {
+ var lines = str.split('\n');
+ var indents = new Array();
+ var regex = new RegExp('^\\s*', 'g');
+ var min = 1000;
+
+ // go through every line and check for common number of indents
+ for(var i = 0; i < lines.length && min > 0; i++)
+ {
+ if(Trim(lines[i]).length == 0)
+ continue;
+
+ var matches = regex.exec(lines[i]);
+
+ if(matches != null && matches.length > 0)
+ min = Math.min(matches[0].length, min);
+ }
+
+ // trim minimum common number of white space from the begining
of every line
+ if(min > 0)
+ for(var i = 0; i < lines.length; i++)
+ lines[i] = lines[i].substr(min);
+
+ return lines.join('\n');
+ }
+
+ // This function returns a portions of the string from pos1 to pos2
inclusive
+ function Copy(string, pos1, pos2)
+ {
+ return string.substr(pos1, pos2 - pos1);
+ }
+
+ var pos = 0;
+
+ this.originalCode = code;
+ this.code = Chop(Unindent(code));
+ this.div = document.createElement('DIV');
+ this.table = document.createElement('TABLE');
+ this.matches = new Array();
+
+ if(this.CssClass != null)
+ this.table.className = this.CssClass;
+
+ // replace tabs with spaces
+ if(this.tabsToSpaces == true)
+ this.code = this.ProcessSmartTabs(this.code);
+
+ this.table.border = 0;
+ this.table.cellSpacing = 0;
+ this.table.cellPadding = 0;
+
+ this.ProcessRegexList();
+
+ // if no matches found, add entire code as plain text
+ if(this.matches.length == 0)
+ {
+ this.AddBit(this.code, null);
+ this.SwitchToTable();
+ return;
+ }
+
+ // sort the matches
+ this.matches = this.matches.sort(dp.sh.Highlighter.SortCallback);
+
+ // The following loop checks to see if any of the matches are inside
+ // of other matches. This process would get rid of highligting strings
+ // inside comments, keywords inside strings and so on.
+ for(var i = 0; i < this.matches.length; i++)
+ if(this.IsInside(this.matches[i]))
+ this.matches[i] = null;
+
+ // Finally, go through the final list of matches and pull the all
+ // together adding everything in between that isn't a match.
+ for(var i = 0; i < this.matches.length; i++)
+ {
+ var match = this.matches[i];
+
+ if(match == null || match.length == 0)
+ continue;
+
+ this.AddBit(Copy(this.code, pos, match.index), null);
+ this.AddBit(match.value, match.css);
+
+ pos = match.index + match.length;
+ }
+
+ this.AddBit(this.code.substr(pos), null);
+
+ this.SwitchToTable();
+}
+
+dp.sh.Highlighter.prototype.GetKeywords = function(str)
+{
+ return '\\b' + str.replace(/ /g, '\\b|\\b') + '\\b';
+}
+
+// highlightes all elements identified by name and gets source code from
specified property
+dp.sh.HighlightAll = function(name, showGutter /* optional */, showControls /*
optional */, collapseAll /* optional */)
+{
+ function FindValue()
+ {
+ var a = arguments;
+
+ for(var i = 0; i < a.length; i++)
+ {
+ if(a[i] == null)
+ continue;
+
+ if(typeof(a[i]) == 'string' && a[i] != '')
+ return a[i] + '';
+
+ if(typeof(a[i]) == 'object' && a[i].value != '')
+ return a[i].value + '';
+ }
+
+ return null;
+ }
+
+ function IsOptionSet(value, list)
+ {
+ for(var i = 0; i < list.length; i++)
+ if(list[i] == value)
+ return true;
+
+ return false;
+ }
+
+ var elements = document.getElementsByName(name);
+ var highlighter = null;
+ var registered = new Object();
+ var propertyName = 'value';
+
+ // if no code blocks found, leave
+ if(elements == null)
+ return;
+
+ // register all brushes
+ for(var brush in dp.sh.Brushes)
+ {
+ var aliases = dp.sh.Brushes[brush].Aliases;
+
+ if(aliases == null)
+ continue;
+
+ for(var i = 0; i < aliases.length; i++)
+ registered[aliases[i]] = brush;
+ }
+
+ for(var i = 0; i < elements.length; i++)
+ {
+ var element = elements[i];
+ var options = FindValue(
+ element.attributes['class'], element.className,
+ element.attributes['language'], element.language
+ );
+ var language = '';
+
+ if(options == null)
+ continue;
+
+ options = options.split(':');
+
+ language = options[0].toLowerCase();
+
+ if(registered[language] == null)
+ continue;
+
+ // instantiate a brush
+ highlighter = new dp.sh.Brushes[registered[language]]();
+
+ // hide the original element
+ element.style.display = 'none';
+
+ highlighter.addGutter = (showGutter == null) ?
!IsOptionSet('nogutter', options) : showGutter;
+ highlighter.addControls = (showControls == null) ?
!IsOptionSet('nocontrols', options) : showControls;
+ highlighter.collapse = (collapseAll == null) ?
IsOptionSet('collapse', options) : collapseAll;
+
+ highlighter.Highlight(element[propertyName]);
+
+ // place the result table inside a div
+ var div = document.createElement('DIV');
+
+ div.className = 'dp-highlighter';
+ div.appendChild(highlighter.table);
+
+ element.parentNode.insertBefore(div, element);
+ }
+}
+
+
+dp.sh.Brushes.JScript = function()
+{
+ var keywords = 'abstract boolean break byte case catch char class
const continue debugger ' +
+ 'default delete do double else enum
export extends false final finally float ' +
+ 'for function goto if implements import
in instanceof int interface long native ' +
+ 'new null package private protected
public return short static super switch ' +
+ 'synchronized this throw throws
transient true try typeof var void volatile while with';
+
+ this.regexList = [
+ { regex: new RegExp('//.*$', 'gm'),
css: 'comment' }, // one line
comments
+ { regex: new RegExp('/\\*[\\s\\S]*?\\*/', 'g'),
css: 'comment' }, // multiline comments
+ { regex: new RegExp('"(?:[^"\n]|[\"])*"', 'g'),
css: 'string' }, // double quoted strings
+ { regex: new RegExp("'(?:[^'\n]|[\'])*'", 'g'),
css: 'string' }, // single quoted strings
+ { regex: new RegExp('^\\s*#.*', 'gm'),
css: 'preprocessor' }, // preprocessor tags like
#region and #endregion
+ { regex: new RegExp(this.GetKeywords(keywords), 'gm'),
css: 'keyword' } // keywords
+ ];
+
+ this.CssClass = 'dp-c';
+}
+
+dp.sh.Brushes.JScript.prototype = new dp.sh.Highlighter();
+dp.sh.Brushes.JScript.Aliases = ['js', 'jscript', 'javascript'];
+
+
+dp.sh.Brushes.Php = function()
+{
+ var keywords = 'and or xor __FILE__ __LINE__ array as break case ' +
+ 'cfunction class const continue declare
default die do echo else ' +
+ 'elseif empty enddeclare endfor
endforeach endif endswitch endwhile eval exit ' +
+ 'extends for foreach function global if
include include_once isset list ' +
+ 'new old_function print require
require_once return static switch unset use ' +
+ 'var while __FUNCTION__ __CLASS__';
+
+ this.regexList = [
+ { regex: new RegExp('//.*$', 'gm'),
css: 'comment' }, // one line
comments
+ { regex: new RegExp('/\\*[\\s\\S]*?\\*/', 'g'),
css: 'comment' }, // multiline comments
+ { regex: new RegExp('"(?:[^"\n]|[\"])*"', 'g'),
css: 'string' }, // double quoted strings
+ { regex: new RegExp("'(?:[^'\n]|[\'])*'", 'g'),
css: 'string' }, // single quoted strings
+ { regex: new RegExp('\\$\\w+', 'g'),
css: 'vars' }, // variables
+ { regex: new RegExp(this.GetKeywords(keywords), 'gm'),
css: 'keyword' } // keyword
+ ];
+
+ this.CssClass = 'dp-c';
+}
+
+dp.sh.Brushes.Php.prototype = new dp.sh.Highlighter();
+dp.sh.Brushes.Php.Aliases = ['php'];
+
+
+
+dp.sh.Brushes.Xml = function()
+{
+ this.CssClass = 'dp-xml';
+}
+
+dp.sh.Brushes.Xml.prototype = new dp.sh.Highlighter();
+dp.sh.Brushes.Xml.Aliases = ['xml', 'xhtml', 'xslt', 'html', 'xhtml'];
+
+dp.sh.Brushes.Xml.prototype.ProcessRegexList = function()
+{
+ function push(array, value)
+ {
+ array[array.length] = value;
+ }
+
+ /* If only there was a way to get index of a group within a match, the
whole XML
+ could be matched with the expression looking something like that:
+
+ (<!\[CDATA\[\s*.*\s*\]\]>)
+ | (<!--\s*.*\s*?-->)
+ | (<)*(\w+)*\s*(\w+)\s*=\s*(".*?"|'.*?'|\w+)(/*>)*
+ | (</?)(.*?)(/?>)
+ */
+ var index = 0;
+ var match = null;
+ var regex = null;
+
+ // Match CDATA in the following format <![ ... [ ... ]]>
+ // <\!\[[\w\s]*?\[(.|\s)*?\]\]>
+ this.GetMatches(new RegExp('<\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\]>',
'gm'), 'cdata');
+
+ // Match comments
+ // <!--\s*.*\s*?-->
+ this.GetMatches(new RegExp('<!--\\s*.*\\s*?-->', 'gm'), 'comments');
+
+ // Match attributes and their values
+ // (\w+)\s*=\s*(".*?"|\'.*?\'|\w+)*
+ regex = new RegExp('([\\w-\.]+)\\s*=\\s*(".*?"|\'.*?\'|\\w+)*', 'gm');
+ while((match = regex.exec(this.code)) != null)
+ {
+ push(this.matches, new dp.sh.Match(match[1], match.index,
'attribute'));
+
+ // if xml is invalid and attribute has no property value,
ignore it
+ if(match[2] != undefined)
+ {
+ push(this.matches, new dp.sh.Match(match[2],
match.index + match[0].indexOf(match[2]), 'attribute-value'));
+ }
+ }
+
+ // Match opening and closing tag brackets
+ // </*\?*(?!\!)|/*\?*>
+ this.GetMatches(new RegExp('</*\\?*(?!\\!)|/*\\?*>', 'gm'), 'tag');
+
+ // Match tag names
+ // </*\?*\s*(\w+)
+ regex = new RegExp('</*\\?*\\s*([\\w-\.]+)', 'gm');
+ while((match = regex.exec(this.code)) != null)
+ {
+ push(this.matches, new dp.sh.Match(match[1], match.index +
match[0].indexOf(match[1]), 'tag-name'));
+ }
+}
+
+
+dp.sh.Brushes.CSS = function()
+{
+ var keywords = 'link over active visited';
+
+ this.regexList = [
+ { regex: new RegExp('/\\*[\\s\\S]*?\\*/', 'g'),
css: 'comment' }, // multiline comments
+ { regex: new RegExp('"(?:[^"\n]|[\"])*"', 'g'),
css: 'string' }, // double quoted strings
+ { regex: new RegExp("'(?:[^'\n]|[\'])*'", 'g'),
css: 'string' }, // single quoted strings
+ { regex: new RegExp('^\\s*#.*', 'gm'),
css: 'preprocessor' }, // preprocessor tags like
#region and #endregion
+ { regex: new RegExp(this.GetKeywords(keywords), 'gm'),
css: 'keyword' } // keywords
+ ];
+
+ this.CssClass = 'dp-c';
+}
+
+dp.sh.Brushes.CSS.prototype = new dp.sh.Highlighter();
+dp.sh.Brushes.CSS.Aliases = ['css'];
\ No newline at end of file
Index: treeview/js/json.js
===================================================================
RCS file: treeview/js/json.js
diff -N treeview/js/json.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ treeview/js/json.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,150 @@
+/*
+Copyright (c) 2005 JSON.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The Software shall be used for Good, not Evil.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+/*
+ The global object JSON contains two methods.
+
+ JSON.stringify(value) takes a JavaScript value and produces a JSON text.
+ The value must not be cyclical.
+
+ JSON.parse(text) takes a JSON text and produces a JavaScript value. It will
+ throw a 'JSONError' exception if there is an error.
+*/
+var JSON = {
+ copyright: '(c)2005 JSON.org',
+ license: 'http://www.crockford.com/JSON/license.html',
+/*
+ Stringify a JavaScript value, producing a JSON text.
+*/
+ stringify: function (v) {
+ var a = [];
+
+/*
+ Emit a string.
+*/
+ function e(s) {
+ a[a.length] = s;
+ }
+
+/*
+ Convert a value.
+*/
+ function g(x) {
+ var c, i, l, v;
+
+ switch (typeof x) {
+ case 'object':
+ if (x) {
+ if (x instanceof Array) {
+ e('[');
+ l = a.length;
+ for (i = 0; i < x.length; i += 1) {
+ v = x[i];
+ if (typeof v != 'undefined' &&
+ typeof v != 'function') {
+ if (l < a.length) {
+ e(',');
+ }
+ g(v);
+ }
+ }
+ e(']');
+ return;
+ } else if (typeof x.valueOf == 'function') {
+ e('{');
+ l = a.length;
+ for (i in x) {
+ v = x[i];
+ if (typeof v != 'undefined' &&
+ typeof v != 'function' &&
+ (!v || typeof v != 'object' ||
+ typeof v.valueOf == 'function')) {
+ if (l < a.length) {
+ e(',');
+ }
+ g(i);
+ e(':');
+ g(v);
+ }
+ }
+ return e('}');
+ }
+ }
+ e('null');
+ return;
+ case 'number':
+ e(isFinite(x) ? +x : 'null');
+ return;
+ case 'string':
+ l = x.length;
+ e('"');
+ for (i = 0; i < l; i += 1) {
+ c = x.charAt(i);
+ if (c >= ' ') {
+ if (c == '\\' || c == '"') {
+ e('\\');
+ }
+ e(c);
+ } else {
+ switch (c) {
+ case '\b':
+ e('\\b');
+ break;
+ case '\f':
+ e('\\f');
+ break;
+ case '\n':
+ e('\\n');
+ break;
+ case '\r':
+ e('\\r');
+ break;
+ case '\t':
+ e('\\t');
+ break;
+ default:
+ c = c.charCodeAt();
+ e('\\u00' + Math.floor(c / 16).toString(16) +
+ (c % 16).toString(16));
+ }
+ }
+ }
+ e('"');
+ return;
+ case 'boolean':
+ e(String(x));
+ return;
+ default:
+ e('null');
+ return;
+ }
+ }
+ g(v);
+ return a.join('');
+ },
+/*
+ Parse a JSON text, producing a JavaScript value.
+*/
+ parse: function (text) {
+ return
(/^(\s+|[,:{}\[\]]|"(\\["\\\/bfnrtu]|[^\x00-\x1f"\\]+)*"|-?\d+(\.\d*)?([eE][+-]?\d+)?|true|false|null)+$/.test(text))
&&
+ eval('(' + text + ')');
+ }
+};
Index: treeview/js/key.js
===================================================================
RCS file: treeview/js/key.js
diff -N treeview/js/key.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ treeview/js/key.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,34 @@
+/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
+
+YAHOO.util.Key = new function() {
+ // this.logger = new ygLogger("ygEventUtil");
+ // DOM key constants
+ this.DOM_VK_UNDEFINED = 0x0;
+ this.DOM_VK_RIGHT_ALT = 0x12;
+ this.DOM_VK_LEFT_ALT = 0x12;
+ this.DOM_VK_LEFT_CONTROL = 0x11;
+ this.DOM_VK_RIGHT_CONTROL = 0x11;
+ this.DOM_VK_LEFT_SHIFT = 0x10;
+ this.DOM_VK_RIGHT_SHIFT = 0x10;
+ this.DOM_VK_META = 0x9D;
+ this.DOM_VK_BACK_SPACE = 0x08;
+ this.DOM_VK_CAPS_LOCK = 0x14;
+ this.DOM_VK_DELETE = 0x7F;
+ this.DOM_VK_END = 0x23;
+ this.DOM_VK_ENTER = 0x0D;
+ this.DOM_VK_ESCAPE = 0x1B;
+ this.DOM_VK_HOME = 0x24;
+ this.DOM_VK_NUM_LOCK = 0x90;
+ this.DOM_VK_PAUSE = 0x13;
+ this.DOM_VK_PRINTSCREEN = 0x9A;
+ this.DOM_VK_SCROLL_LOCK = 0x91;
+ this.DOM_VK_SPACE = 0x20;
+ this.DOM_VK_TAB = 0x09;
+ this.DOM_VK_LEFT = 0x25;
+ this.DOM_VK_RIGHT = 0x27;
+ this.DOM_VK_UP = 0x26;
+ this.DOM_VK_DOWN = 0x28;
+ this.DOM_VK_PAGE_DOWN = 0x22;
+ this.DOM_VK_PAGE_UP = 0x21;
+};
+
Index: treeview/js/log.js
===================================================================
RCS file: treeview/js/log.js
diff -N treeview/js/log.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ treeview/js/log.js 25 Sep 2006 11:52:30 -0000 1.1
@@ -0,0 +1,15 @@
+// Adapter for YAHOO.widget.Logger
+
+var ygLogger = function(module) {
+ return new YAHOO.widget.LogWriter(module);
+};
+
+YAHOO.widget.LogWriter.prototype.debug = function() {
+ this.log.apply(this, arguments);
+};
+
+ygLogger.init = function(div) {
+ new YAHOO.widget.LogReader(div, {
+ height: "400px"
+ });
+};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] phpgwapi/js/yahoo/yui/examples autocomplete/js/...,
Dave Hall <=