Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial Revision.

  • Loading branch information...
commit de2ba1ef900689362c2e97f855542310b8736f36 0 parents
@zoltan-dulac authored
Showing with 6,836 additions and 0 deletions.
  1. +11 −0 .project
  2. +66 −0 shared/css/reset.css
  3. +441 −0 shared/js/EventHelpers.js
  4. +6 −0 shared/js/cssQuery-p.js
  5. +2,395 −0 shared/js/cssSandpaper.js
  6. +1 −0  shared/js/jcoglan.com/sylvester.js
  7. +45 −0 tests/cssSandpaper/boxShadowTest.html
  8. +12 −0 tests/cssSandpaper/changelog.txt
  9. +125 −0 tests/cssSandpaper/clock.html
  10. +106 −0 tests/cssSandpaper/countdown.html
  11. +55 −0 tests/cssSandpaper/css/boxShadowTest.css
  12. +156 −0 tests/cssSandpaper/css/cube3.css
  13. +102 −0 tests/cssSandpaper/css/example.css
  14. +671 −0 tests/cssSandpaper/css/global.css
  15. +89 −0 tests/cssSandpaper/css/gradientTest.css
  16. +98 −0 tests/cssSandpaper/css/hslBackgroundTest.css
  17. +90 −0 tests/cssSandpaper/css/hslBackgroundTest2.css
  18. +18 −0 tests/cssSandpaper/css/matrixTest.css
  19. +58 −0 tests/cssSandpaper/css/opacityTest.css
  20. +58 −0 tests/cssSandpaper/css/rgbaBackgroundTest.css
  21. +72 −0 tests/cssSandpaper/css/rgbaGradientTest.css
  22. +57 −0 tests/cssSandpaper/css/rotateTest.css
  23. +103 −0 tests/cssSandpaper/css/sample.css
  24. +39 −0 tests/cssSandpaper/css/simpleTranslate.css
  25. +69 −0 tests/cssSandpaper/css/skewTest.css
  26. +32 −0 tests/cssSandpaper/css/starburst.css
  27. +10 −0 tests/cssSandpaper/css/test1.css
  28. +38 −0 tests/cssSandpaper/css/tester.css
  29. +34 −0 tests/cssSandpaper/css/translationTest.css
  30. +252 −0 tests/cssSandpaper/cube3.html
  31. +117 −0 tests/cssSandpaper/example.html
  32. +57 −0 tests/cssSandpaper/failedRotateExample.html
  33. +55 −0 tests/cssSandpaper/fixForBlockyFontsInIE.html
  34. BIN  tests/cssSandpaper/fonts/DroidSans/DroidSans-Bold.ttf
  35. BIN  tests/cssSandpaper/fonts/DroidSans/DroidSans.eot
  36. BIN  tests/cssSandpaper/fonts/DroidSans/DroidSans.ttf
  37. +18 −0 tests/cssSandpaper/fonts/DroidSans/Google Android License.txt
  38. BIN  tests/cssSandpaper/fonts/DroidSansMono/DroidSansMono.eot
  39. BIN  tests/cssSandpaper/fonts/DroidSansMono/DroidSansMono.ttf
  40. +18 −0 tests/cssSandpaper/fonts/DroidSansMono/Google Android License.txt
  41. BIN  tests/cssSandpaper/fonts/GraublauWeb/GraublauWeb-Regular.eot
  42. BIN  tests/cssSandpaper/fonts/GraublauWeb/GraublauWeb-Regular.ttf
  43. BIN  tests/cssSandpaper/fonts/GraublauWeb/GraublauWeb.eot
  44. BIN  tests/cssSandpaper/fonts/GraublauWeb/GraublauWeb.otf
  45. BIN  tests/cssSandpaper/fonts/GraublauWeb/GraublauWebBold.eot
  46. BIN  tests/cssSandpaper/fonts/GraublauWeb/GraublauWebBold.otf
  47. BIN  tests/cssSandpaper/fonts/GraublauWeb/W-EULA.pdf
  48. +85 −0 tests/cssSandpaper/gradient.html
  49. +55 −0 tests/cssSandpaper/gradientTest.html
  50. +69 −0 tests/cssSandpaper/hslBackgroundTest.html
  51. +62 −0 tests/cssSandpaper/hslBackgroundTest2.html
  52. BIN  tests/cssSandpaper/images/TokyoSkaParadise1.jpg
  53. BIN  tests/cssSandpaper/images/background.gif
  54. BIN  tests/cssSandpaper/images/clockface.jpg
  55. BIN  tests/cssSandpaper/images/fringelogo_small.png
  56. BIN  tests/cssSandpaper/images/grid-background-new2.gif
  57. BIN  tests/cssSandpaper/images/hourhand.gif
  58. BIN  tests/cssSandpaper/images/minhand.gif
  59. BIN  tests/cssSandpaper/images/sechand.gif
  60. BIN  tests/cssSandpaper/images/stars.jpg
  61. BIN  tests/cssSandpaper/images/testpattern.png
  62. +46 −0 tests/cssSandpaper/index.html
  63. +42 −0 tests/cssSandpaper/js/clock.js
  64. +42 −0 tests/cssSandpaper/js/countdown.js
  65. +34 −0 tests/cssSandpaper/js/gradient.js
  66. +47 −0 tests/cssSandpaper/js/italics.js
  67. +33 −0 tests/cssSandpaper/js/rgbaGradient.js
  68. +40 −0 tests/cssSandpaper/js/test1.js
  69. +50 −0 tests/cssSandpaper/js/tester.js
  70. +31 −0 tests/cssSandpaper/matrixTest.html
  71. +41 −0 tests/cssSandpaper/opacityTest.html
  72. +50 −0 tests/cssSandpaper/rgbaBackgroundTest.html
  73. +85 −0 tests/cssSandpaper/rgbaGradient.html
  74. +47 −0 tests/cssSandpaper/rgbaGradientTest.html
  75. +43 −0 tests/cssSandpaper/rotateTest.html
  76. +29 −0 tests/cssSandpaper/scripting.html
  77. +41 −0 tests/cssSandpaper/simpleTranslate.html
  78. +47 −0 tests/cssSandpaper/skewTest.html
  79. +71 −0 tests/cssSandpaper/starburst.html
  80. +131 −0 tests/cssSandpaper/tester.html
  81. +41 −0 tests/cssSandpaper/translationTest.html
11 .project
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>cssSandpaper</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
66 shared/css/reset.css
@@ -0,0 +1,66 @@
+/*
+ * CSS Reset based on code from
+ * http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/
+ *
+ * Earlier copy stated:
+ * "If you want to use my reset styles, then feel free! It's all
+ * explicitly in the public domain (I have to formally say that
+ * or else people ask me about licensing)."
+ */
+
+html, body, div, span, applet, object, iframe,
+h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+a, abbr, acronym, address, big, cite, code,
+del, dfn, em, font, img, ins, kbd, q, s, samp,
+small, strike, strong, sub, sup, tt, var,
+dl, dt, dd, ol, ul, li,
+fieldset, form, label, legend,
+table, caption, tbody, tfoot, thead, tr, th, td {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ outline: 0;
+ font-weight: inherit;
+ font-style: inherit;
+ font-size: 100%;
+ font-family: inherit;
+ vertical-align: baseline;
+}
+/* remember to define focus styles! */
+:focus {
+ outline: 0;
+}
+body {
+ line-height: 1;
+ color: black;
+ background: white;
+}
+ol, ul {
+ list-style: none;
+}
+/* tables still need 'cellspacing="0"' in the markup */
+table {
+ border-collapse: separate;
+ border-spacing: 0;
+}
+caption, th, td {
+ text-align: left;
+ font-weight: normal;
+}
+blockquote:before, blockquote:after,
+q:before, q:after {
+ content: "";
+}
+blockquote, q {
+ quotes: "" "";
+}
+
+/*
+ * Added 2009/02/04 to fix IE7's issue with interpolated
+ * scaling not turned on by default. Based on an idea from
+ * http://acidmartin.wordpress.com/2009/01/05/better-image-scaling-and-resampling-in-internet-explorer/
+ */
+img
+{
+ -ms-interpolation-mode: bicubic;
+}
441 shared/js/EventHelpers.js
@@ -0,0 +1,441 @@
+/*******************************************************************************
+ * This notice must be untouched at all times.
+ *
+ * This javascript library contains helper routines to assist with event
+ * handling consinstently among browsers
+ *
+ * EventHelpers.js v.1.3 available at http://www.useragentman.com/
+ *
+ * released under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ *******************************************************************************/
+var EventHelpers = new function(){
+ var me = this;
+
+ var safariTimer;
+ var isSafari = /WebKit/i.test(navigator.userAgent);
+ var globalEvent;
+
+ me.init = function () {
+ if (me.hasPageLoadHappened(arguments)) {
+ return;
+ }
+
+ if (document.createEventObject){
+ // dispatch for IE
+ globalEvent = document.createEventObject();
+ } else if (document.createEvent) {
+ globalEvent = document.createEvent("HTMLEvents");
+ }
+
+ me.docIsLoaded = true;
+ }
+
+ /**
+ * Adds an event to the document. Examples of usage:
+ * me.addEvent(window, "load", myFunction);
+ * me.addEvent(docunent, "keydown", keyPressedFunc);
+ * me.addEvent(document, "keyup", keyPressFunc);
+ *
+ * @author Scott Andrew - http://www.scottandrew.com/weblog/articles/cbs-events
+ * @author John Resig - http://ejohn.org/projects/flexible-javascript-events/
+ * @param {Object} obj - a javascript object.
+ * @param {String} evType - an event to attach to the object.
+ * @param {Function} fn - the function that is attached to the event.
+ */
+ me.addEvent = function(obj, evType, fn){
+
+ if (obj.addEventListener) {
+ obj.addEventListener(evType, fn, false);
+ } else if (obj.attachEvent) {
+ obj['e' + evType + fn] = fn;
+ obj[evType + fn] = function(){
+ obj["e" + evType + fn](self.event);
+ }
+ obj.attachEvent("on" + evType, obj[evType + fn]);
+ }
+ }
+
+
+ /**
+ * Removes an event that is attached to a javascript object.
+ *
+ * @author Scott Andrew - http://www.scottandrew.com/weblog/articles/cbs-events
+ * @author John Resig - http://ejohn.org/projects/flexible-javascript-events/ * @param {Object} obj - a javascript object.
+ * @param {String} evType - an event attached to the object.
+ * @param {Function} fn - the function that is called when the event fires.
+ */
+ me.removeEvent = function(obj, evType, fn){
+
+ if (obj.removeEventListener) {
+ obj.removeEventListener(evType, fn, false);
+ } else if (obj.detachEvent) {
+ try {
+ obj.detachEvent("on" + evType, obj[evType + fn]);
+ obj[evType + fn] = null;
+ obj["e" + evType + fn] = null;
+ }
+ catch (ex) {
+ // do nothing;
+ }
+ }
+ }
+
+ function removeEventAttribute(obj, beginName){
+ var attributes = obj.attributes;
+ for (var i = 0; i < attributes.length; i++) {
+ var attribute = attributes[i]
+ var name = attribute.name
+ if (name.indexOf(beginName) == 0) {
+ //obj.removeAttributeNode(attribute);
+ attribute.specified = false;
+ }
+ }
+ }
+
+ me.addScrollWheelEvent = function(obj, fn){
+ if (obj.addEventListener) {
+ /** DOMMouseScroll is for mozilla. */
+ obj.addEventListener('DOMMouseScroll', fn, true);
+ }
+
+ /** IE/Opera. */
+ if (obj.attachEvent) {
+ obj.attachEvent("onmousewheel", fn);
+ }
+
+ }
+
+ me.removeScrollWheelEvent = function(obj, fn){
+ if (obj.removeEventListener) {
+ /** DOMMouseScroll is for mozilla. */
+ obj.removeEventListener('DOMMouseScroll', fn, true);
+ }
+
+ /** IE/Opera. */
+ if (obj.detachEvent) {
+ obj.detatchEvent("onmousewheel", fn);
+ }
+
+ }
+
+ /**
+ * Given a mouse event, get the mouse pointer's x-coordinate.
+ *
+ * @param {Object} e - a DOM Event object.
+ * @return {int} - the mouse pointer's x-coordinate.
+ */
+ me.getMouseX = function(e){
+ if (!e) {
+ return;
+ }
+ // NS4
+ if (e.pageX != null) {
+ return e.pageX;
+ // IE
+ } else if (window.event != null && window.event.clientX != null &&
+ document.body != null &&
+ document.body.scrollLeft != null)
+ return window.event.clientX + document.body.scrollLeft;
+ // W3C
+ else if (e.clientX != null)
+ return e.clientX;
+ else
+ return null;
+ }
+
+ /**
+ * Given a mouse event, get the mouse pointer's y-coordinate.
+ * @param {Object} e - a DOM Event Object.
+ * @return {int} - the mouse pointer's y-coordinate.
+ */
+ me.getMouseY = function(e){
+ // NS4
+ if (e.pageY != null)
+ return e.pageY;
+ // IE
+ else if (window.event != null && window.event.clientY != null &&
+ document.body != null &&
+ document.body.scrollTop != null)
+ return window.event.clientY + document.body.scrollTop;
+ // W3C
+ else if (e.clientY != null) {
+ return e.clientY;
+ }
+ }
+ /**
+ * Given a mouse scroll wheel event, get the "delta" of how fast it moved.
+ * @param {Object} e - a DOM Event Object.
+ * @return {int} - the mouse wheel's delta. It is greater than 0, the
+ * scroll wheel was spun upwards; if less than 0, downwards.
+ */
+ me.getScrollWheelDelta = function(e){
+ var delta = 0;
+ if (!e) /* For IE. */
+ e = window.event;
+ if (e.wheelDelta) { /* IE/Opera. */
+ delta = e.wheelDelta / 120;
+ /** In Opera 9, delta differs in sign as compared to IE.
+ */
+ if (window.opera) {
+ delta = -delta;
+ }
+ } else if (e.detail) { /** Mozilla case. */
+ /** In Mozilla, sign of delta is different than in IE.
+ * Also, delta is multiple of 3.
+ */
+ delta = -e.detail / 3;
+ }
+ return delta
+ }
+
+ /**
+ * Sets a mouse move event of a document.
+ *
+ * @deprecated - use only if compatibility with IE4 and NS4 is necessary. Otherwise, just
+ * use EventHelpers.addEvent(window, 'mousemove', func) instead. Cannot be used to add
+ * multiple mouse move event handlers.
+ *
+ * @param {Function} func - the function that you want a mouse event to fire.
+ */
+ me.addMouseEvent = function(func){
+
+ if (document.captureEvents) {
+ document.captureEvents(Event.MOUSEMOVE);
+ }
+
+ document.onmousemove = func;
+ window.onmousemove = func;
+ window.onmouseover = func;
+
+ }
+
+
+
+ /**
+ * Find the HTML object that fired an Event.
+ *
+ * @param {Object} e - an HTML object
+ * @return {Object} - the HTML object that fired the event.
+ */
+ me.getEventTarget = function(e){
+ // first, IE method for mouse events(also supported by Safari and Opera)
+ if (e.toElement) {
+ return e.toElement;
+ // W3C
+ } else if (e.currentTarget) {
+ return e.currentTarget;
+
+ // MS way
+ } else if (e.srcElement) {
+ return e.srcElement;
+ } else {
+ return null;
+ }
+ }
+
+
+
+
+ /**
+ * Given an event fired by the keyboard, find the key associated with that event.
+ *
+ * @param {Object} e - an event object.
+ * @return {String} - the ASCII character code representing the key associated with the event.
+ */
+ me.getKey = function(e){
+ if (e.keyCode) {
+ return e.keyCode;
+ } else if (e.event && e.event.keyCode) {
+ return window.event.keyCode;
+ } else if (e.which) {
+ return e.which;
+ }
+ }
+
+
+ /**
+ * Will execute a function when the page's DOM has fully loaded (and before all attached images, iframes,
+ * etc., are).
+ *
+ * Usage:
+ *
+ * EventHelpers.addPageLoadEvent('init');
+ *
+ * where the function init() has this code at the beginning:
+ *
+ * function init() {
+ *
+ * if (EventHelpers.hasPageLoadHappened(arguments)) return;
+ *
+ * // rest of code
+ * ....
+ * }
+ *
+ * @author This code is based off of code from http://dean.edwards.name/weblog/2005/09/busted/ by Dean
+ * Edwards, with a modification by me.
+ *
+ * @param {String} funcName - a string containing the function to be called.
+ */
+ me.addPageLoadEvent = function(funcName){
+
+ var func = eval(funcName);
+
+ // for Internet Explorer (using conditional comments)
+ /*@cc_on @*/
+ /*@if (@_win32)
+ pageLoadEventArray.push(func);
+ return;
+ /*@end @*/
+ if (isSafari) { // sniff
+ pageLoadEventArray.push(func);
+
+ if (!safariTimer) {
+
+ safariTimer = setInterval(function(){
+ if (/loaded|complete/.test(document.readyState)) {
+ clearInterval(safariTimer);
+
+ /*
+ * call the onload handler
+ * func();
+ */
+ me.runPageLoadEvents();
+ return;
+ }
+ set = true;
+ }, 10);
+ }
+ /* for Mozilla */
+ } else if (document.addEventListener) {
+ var x = document.addEventListener("DOMContentLoaded", func, null);
+
+ /* Others */
+ } else {
+ me.addEvent(window, 'load', func);
+ }
+ }
+
+ var pageLoadEventArray = new Array();
+
+ me.runPageLoadEvents = function(e){
+ if (isSafari || e.srcElement.readyState == "complete") {
+
+ for (var i = 0; i < pageLoadEventArray.length; i++) {
+ pageLoadEventArray[i]();
+ }
+ }
+ }
+ /**
+ * Determines if either addPageLoadEvent('funcName') or addEvent(window, 'load', funcName)
+ * has been executed.
+ *
+ * @see addPageLoadEvent
+ * @param {Function} funcArgs - the arguments of the containing. function
+ */
+ me.hasPageLoadHappened = function(funcArgs){
+ // If the function already been called, return true;
+ if (funcArgs.callee.done)
+ return true;
+
+ // flag this function so we don't do the same thing twice
+ funcArgs.callee.done = true;
+ }
+
+
+
+ /**
+ * Used in an event method/function to indicate that the default behaviour of the event
+ * should *not* happen.
+ *
+ * @param {Object} e - an event object.
+ * @return {Boolean} - always false
+ */
+ me.preventDefault = function(e){
+
+ if (e.preventDefault) {
+ e.preventDefault();
+ }
+
+ try {
+ e.returnValue = false;
+ }
+ catch (ex) {
+ // do nothing
+ }
+
+ }
+
+ me.cancelBubble = function(e){
+ if (e.stopPropagation) {
+ e.stopPropagation();
+ }
+
+ try {
+ e.cancelBubble = true;
+ }
+ catch (ex) {
+ // do nothing
+ }
+ }
+
+ /*
+ * Fires an event manually.
+ * @author Scott Andrew - http://www.scottandrew.com/weblog/articles/cbs-events
+ * @author John Resig - http://ejohn.org/projects/flexible-javascript-events/ * @param {Object} obj - a javascript object.
+ * @param {String} evType - an event attached to the object.
+ * @param {Function} fn - the function that is called when the event fires.
+ *
+ */
+ me.fireEvent = function (element,event, options){
+
+ if(!element) {
+ return;
+ }
+
+ if (document.createEventObject){
+ /*
+ var stack = DebugHelpers.getStackTrace();
+ var s = stack.toString();
+ jslog.debug(s);
+ if (s.indexOf('fireEvent') >= 0) {
+ return;
+ }
+ */
+ return element.fireEvent('on' + event, globalEvent)
+ jslog.debug('ss');
+
+ }
+ else{
+ // dispatch for firefox + others
+ globalEvent.initEvent(event, true, true); // event type,bubbling,cancelable
+ return !element.dispatchEvent(globalEvent);
+ }
+}
+
+ /* EventHelpers.init () */
+ function init(){
+ // Conditional comment alert: Do not remove comments. Leave intact.
+ // The detection if the page is secure or not is important. If
+ // this logic is removed, Internet Explorer will give security
+ // alerts.
+ /*@cc_on @*/
+ /*@if (@_win32)
+
+ document.write('<script id="__ie_onload" defer src="' +
+
+ ((location.protocol == 'https:') ? '//0' : 'javascript:void(0)') + '"><\/script>');
+
+ var script = document.getElementById("__ie_onload");
+
+ me.addEvent(script, 'readystatechange', me.runPageLoadEvents);
+
+ /*@end @*/
+
+ }
+
+ init();
+}
+
+EventHelpers.addPageLoadEvent('EventHelpers.init');
6 shared/js/cssQuery-p.js
@@ -0,0 +1,6 @@
+/*
+ cssQuery, version 2.0.2 (2005-08-19)
+ Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
+ License: http://creativecommons.org/licenses/LGPL/2.1/
+*/
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('7 x=6(){7 1D="2.0.2";7 C=/\\s*,\\s*/;7 x=6(s,A){33{7 m=[];7 u=1z.32.2c&&!A;7 b=(A)?(A.31==22)?A:[A]:[1g];7 1E=18(s).1l(C),i;9(i=0;i<1E.y;i++){s=1y(1E[i]);8(U&&s.Z(0,3).2b("")==" *#"){s=s.Z(2);A=24([],b,s[1])}1A A=b;7 j=0,t,f,a,c="";H(j<s.y){t=s[j++];f=s[j++];c+=t+f;a="";8(s[j]=="("){H(s[j++]!=")")a+=s[j];a=a.Z(0,-1);c+="("+a+")"}A=(u&&V[c])?V[c]:21(A,t,f,a);8(u)V[c]=A}m=m.30(A)}2a x.2d;5 m}2Z(e){x.2d=e;5[]}};x.1Z=6(){5"6 x() {\\n [1D "+1D+"]\\n}"};7 V={};x.2c=L;x.2Y=6(s){8(s){s=1y(s).2b("");2a V[s]}1A V={}};7 29={};7 19=L;x.15=6(n,s){8(19)1i("s="+1U(s));29[n]=12 s()};x.2X=6(c){5 c?1i(c):o};7 D={};7 h={};7 q={P:/\\[([\\w-]+(\\|[\\w-]+)?)\\s*(\\W?=)?\\s*([^\\]]*)\\]/};7 T=[];D[" "]=6(r,f,t,n){7 e,i,j;9(i=0;i<f.y;i++){7 s=X(f[i],t,n);9(j=0;(e=s[j]);j++){8(M(e)&&14(e,n))r.z(e)}}};D["#"]=6(r,f,i){7 e,j;9(j=0;(e=f[j]);j++)8(e.B==i)r.z(e)};D["."]=6(r,f,c){c=12 1t("(^|\\\\s)"+c+"(\\\\s|$)");7 e,i;9(i=0;(e=f[i]);i++)8(c.l(e.1V))r.z(e)};D[":"]=6(r,f,p,a){7 t=h[p],e,i;8(t)9(i=0;(e=f[i]);i++)8(t(e,a))r.z(e)};h["2W"]=6(e){7 d=Q(e);8(d.1C)9(7 i=0;i<d.1C.y;i++){8(d.1C[i]==e)5 K}};h["2V"]=6(e){};7 M=6(e){5(e&&e.1c==1&&e.1f!="!")?e:23};7 16=6(e){H(e&&(e=e.2U)&&!M(e))28;5 e};7 G=6(e){H(e&&(e=e.2T)&&!M(e))28;5 e};7 1r=6(e){5 M(e.27)||G(e.27)};7 1P=6(e){5 M(e.26)||16(e.26)};7 1o=6(e){7 c=[];e=1r(e);H(e){c.z(e);e=G(e)}5 c};7 U=K;7 1h=6(e){7 d=Q(e);5(2S d.25=="2R")?/\\.1J$/i.l(d.2Q):2P(d.25=="2O 2N")};7 Q=6(e){5 e.2M||e.1g};7 X=6(e,t){5(t=="*"&&e.1B)?e.1B:e.X(t)};7 17=6(e,t,n){8(t=="*")5 M(e);8(!14(e,n))5 L;8(!1h(e))t=t.2L();5 e.1f==t};7 14=6(e,n){5!n||(n=="*")||(e.2K==n)};7 1e=6(e){5 e.1G};6 24(r,f,B){7 m,i,j;9(i=0;i<f.y;i++){8(m=f[i].1B.2J(B)){8(m.B==B)r.z(m);1A 8(m.y!=23){9(j=0;j<m.y;j++){8(m[j].B==B)r.z(m[j])}}}}5 r};8(![].z)22.2I.z=6(){9(7 i=0;i<1z.y;i++){o[o.y]=1z[i]}5 o.y};7 N=/\\|/;6 21(A,t,f,a){8(N.l(f)){f=f.1l(N);a=f[0];f=f[1]}7 r=[];8(D[t]){D[t](r,A,f,a)}5 r};7 S=/^[^\\s>+~]/;7 20=/[\\s#.:>+~()@]|[^\\s#.:>+~()@]+/g;6 1y(s){8(S.l(s))s=" "+s;5 s.P(20)||[]};7 W=/\\s*([\\s>+~(),]|^|$)\\s*/g;7 I=/([\\s>+~,]|[^(]\\+|^)([#.:@])/g;7 18=6(s){5 s.O(W,"$1").O(I,"$1*$2")};7 1u={1Z:6(){5"\'"},P:/^(\'[^\']*\')|("[^"]*")$/,l:6(s){5 o.P.l(s)},1S:6(s){5 o.l(s)?s:o+s+o},1Y:6(s){5 o.l(s)?s.Z(1,-1):s}};7 1s=6(t){5 1u.1Y(t)};7 E=/([\\/()[\\]?{}|*+-])/g;6 R(s){5 s.O(E,"\\\\$1")};x.15("1j-2H",6(){D[">"]=6(r,f,t,n){7 e,i,j;9(i=0;i<f.y;i++){7 s=1o(f[i]);9(j=0;(e=s[j]);j++)8(17(e,t,n))r.z(e)}};D["+"]=6(r,f,t,n){9(7 i=0;i<f.y;i++){7 e=G(f[i]);8(e&&17(e,t,n))r.z(e)}};D["@"]=6(r,f,a){7 t=T[a].l;7 e,i;9(i=0;(e=f[i]);i++)8(t(e))r.z(e)};h["2G-10"]=6(e){5!16(e)};h["1x"]=6(e,c){c=12 1t("^"+c,"i");H(e&&!e.13("1x"))e=e.1n;5 e&&c.l(e.13("1x"))};q.1X=/\\\\:/g;q.1w="@";q.J={};q.O=6(m,a,n,c,v){7 k=o.1w+m;8(!T[k]){a=o.1W(a,c||"",v||"");T[k]=a;T.z(a)}5 T[k].B};q.1Q=6(s){s=s.O(o.1X,"|");7 m;H(m=s.P(o.P)){7 r=o.O(m[0],m[1],m[2],m[3],m[4]);s=s.O(o.P,r)}5 s};q.1W=6(p,t,v){7 a={};a.B=o.1w+T.y;a.2F=p;t=o.J[t];t=t?t(o.13(p),1s(v)):L;a.l=12 2E("e","5 "+t);5 a};q.13=6(n){1d(n.2D()){F"B":5"e.B";F"2C":5"e.1V";F"9":5"e.2B";F"1T":8(U){5"1U((e.2A.P(/1T=\\\\1v?([^\\\\s\\\\1v]*)\\\\1v?/)||[])[1]||\'\')"}}5"e.13(\'"+n.O(N,":")+"\')"};q.J[""]=6(a){5 a};q.J["="]=6(a,v){5 a+"=="+1u.1S(v)};q.J["~="]=6(a,v){5"/(^| )"+R(v)+"( |$)/.l("+a+")"};q.J["|="]=6(a,v){5"/^"+R(v)+"(-|$)/.l("+a+")"};7 1R=18;18=6(s){5 1R(q.1Q(s))}});x.15("1j-2z",6(){D["~"]=6(r,f,t,n){7 e,i;9(i=0;(e=f[i]);i++){H(e=G(e)){8(17(e,t,n))r.z(e)}}};h["2y"]=6(e,t){t=12 1t(R(1s(t)));5 t.l(1e(e))};h["2x"]=6(e){5 e==Q(e).1H};h["2w"]=6(e){7 n,i;9(i=0;(n=e.1F[i]);i++){8(M(n)||n.1c==3)5 L}5 K};h["1N-10"]=6(e){5!G(e)};h["2v-10"]=6(e){e=e.1n;5 1r(e)==1P(e)};h["2u"]=6(e,s){7 n=x(s,Q(e));9(7 i=0;i<n.y;i++){8(n[i]==e)5 L}5 K};h["1O-10"]=6(e,a){5 1p(e,a,16)};h["1O-1N-10"]=6(e,a){5 1p(e,a,G)};h["2t"]=6(e){5 e.B==2s.2r.Z(1)};h["1M"]=6(e){5 e.1M};h["2q"]=6(e){5 e.1q===L};h["1q"]=6(e){5 e.1q};h["1L"]=6(e){5 e.1L};q.J["^="]=6(a,v){5"/^"+R(v)+"/.l("+a+")"};q.J["$="]=6(a,v){5"/"+R(v)+"$/.l("+a+")"};q.J["*="]=6(a,v){5"/"+R(v)+"/.l("+a+")"};6 1p(e,a,t){1d(a){F"n":5 K;F"2p":a="2n";1a;F"2o":a="2n+1"}7 1m=1o(e.1n);6 1k(i){7 i=(t==G)?1m.y-i:i-1;5 1m[i]==e};8(!Y(a))5 1k(a);a=a.1l("n");7 m=1K(a[0]);7 s=1K(a[1]);8((Y(m)||m==1)&&s==0)5 K;8(m==0&&!Y(s))5 1k(s);8(Y(s))s=0;7 c=1;H(e=t(e))c++;8(Y(m)||m==1)5(t==G)?(c<=s):(s>=c);5(c%m)==s}});x.15("1j-2m",6(){U=1i("L;/*@2l@8(@\\2k)U=K@2j@*/");8(!U){X=6(e,t,n){5 n?e.2i("*",t):e.X(t)};14=6(e,n){5!n||(n=="*")||(e.2h==n)};1h=1g.1I?6(e){5/1J/i.l(Q(e).1I)}:6(e){5 Q(e).1H.1f!="2g"};1e=6(e){5 e.2f||e.1G||1b(e)};6 1b(e){7 t="",n,i;9(i=0;(n=e.1F[i]);i++){1d(n.1c){F 11:F 1:t+=1b(n);1a;F 3:t+=n.2e;1a}}5 t}}});19=K;5 x}();',62,190,'|||||return|function|var|if|for||||||||pseudoClasses||||test|||this||AttributeSelector|||||||cssQuery|length|push|fr|id||selectors||case|nextElementSibling|while||tests|true|false|thisElement||replace|match|getDocument|regEscape||attributeSelectors|isMSIE|cache||getElementsByTagName|isNaN|slice|child||new|getAttribute|compareNamespace|addModule|previousElementSibling|compareTagName|parseSelector|loaded|break|_0|nodeType|switch|getTextContent|tagName|document|isXML|eval|css|_1|split|ch|parentNode|childElements|nthChild|disabled|firstElementChild|getText|RegExp|Quote|x22|PREFIX|lang|_2|arguments|else|all|links|version|se|childNodes|innerText|documentElement|contentType|xml|parseInt|indeterminate|checked|last|nth|lastElementChild|parse|_3|add|href|String|className|create|NS_IE|remove|toString|ST|select|Array|null|_4|mimeType|lastChild|firstChild|continue|modules|delete|join|caching|error|nodeValue|textContent|HTML|prefix|getElementsByTagNameNS|end|x5fwin32|cc_on|standard||odd|even|enabled|hash|location|target|not|only|empty|root|contains|level3|outerHTML|htmlFor|class|toLowerCase|Function|name|first|level2|prototype|item|scopeName|toUpperCase|ownerDocument|Document|XML|Boolean|URL|unknown|typeof|nextSibling|previousSibling|visited|link|valueOf|clearCache|catch|concat|constructor|callee|try'.split('|'),0,{}))
2,395 shared/js/cssSandpaper.js
@@ -0,0 +1,2395 @@
+
+/*******************************************************************************
+ * This notice must be untouched at all times.
+ *
+ * CSS Sandpaper: smooths out differences between CSS implementations.
+ *
+ * This javascript library contains routines to implement the CSS transform,
+ * box-shadow and gradient in IE. It also provides a common syntax for other
+ * browsers that support vendor-specific methods.
+ *
+ * Written by: Zoltan Hawryluk. Version 1.0 beta 1 completed on March 8, 2010.
+ *
+ * Some routines are based on code from CSS Gradients via Canvas v1.2
+ * by Weston Ruter <http://weston.ruter.net/projects/css-gradients-via-canvas/>
+ *
+ * Requires sylvester.js by James Coglan http://sylvester.jcoglan.com/
+ *
+ * cssSandpaper.js v.1.0 beta 1 available at http://www.useragentman.com/
+ *
+ * released under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ ******************************************************************************/
+if (!document.querySelectorAll) {
+ document.querySelectorAll = cssQuery;
+}
+
+var cssSandpaper = new function(){
+ var me = this;
+
+ var styleNodes, styleSheets = new Array();
+
+ var ruleSetRe = /[^\{]*{[^\}]*}/g;
+ var ruleSplitRe = /[\{\}]/g;
+
+ var reGradient = /gradient\([\s\S]*\)/g;
+ var reHSL = /hsl\([\s\S]*\)/g;
+
+ // This regexp from the article
+ // http://james.padolsey.com/javascript/javascript-comment-removal-revisted/
+ var reMultiLineComment = /\/\/.+?(?=\n|\r|$)|\/\*[\s\S]+?\*\//g;
+
+ var reAtRule = /@[^\{\};]*;|@[^\{\};]*\{[^\}]*\}/g;
+
+ var reFunctionSpaces = /\(\s*/g
+
+
+ var ruleLists = new Array();
+ var styleNode;
+
+ var tempObj;
+ var body;
+
+
+ me.init = function(reinit){
+
+ if (EventHelpers.hasPageLoadHappened(arguments) && !reinit) {
+ return;
+ }
+
+ body = document.body;
+
+ tempObj = document.createElement('div');
+
+ getStyleSheets();
+
+ indexRules();
+
+
+ fixTransforms();
+ fixBoxShadow();
+ fixLinearGradients();
+
+ fixBackgrounds();
+ fixColors();
+ fixOpacity();
+ setClasses();
+ //fixBorderRadius();
+
+ }
+
+ me.setOpacity = function(obj, value){
+ var property = CSS3Helpers.findProperty(document.body, 'opacity');
+
+ if (property == "filter") {
+ // IE must have layout, see
+ // http://jszen.blogspot.com/2005/04/ie6-opacity-filter-caveat.html
+ // for details.
+ obj.style.zoom = "100%";
+
+ var filter = CSS3Helpers.addFilter(obj, 'DXImageTransform.Microsoft.Alpha', StringHelpers.sprintf("opacity=%d", ((value) * 100)));
+
+ filter.opacity = value * 100;
+
+
+ } else if (obj.style[property] != null) {
+ obj.style[property] = value;
+ }
+ }
+
+
+ function fixOpacity(){
+
+ var transformRules = getRuleList('opacity').values;
+
+ for (var i in transformRules) {
+ var rule = transformRules[i];
+ var nodes = document.querySelectorAll(rule.selector);
+
+ for (var j = 0; j < nodes.length; j++) {
+ me.setOpacity(nodes[j], rule.value)
+ }
+
+ }
+
+ }
+
+
+
+ me.setTransform = function(obj, transformString){
+ var property = CSS3Helpers.findProperty(obj, 'transform');
+
+ if (property == "filter") {
+ var matrix = CSS3Helpers.getTransformationMatrix(transformString);
+ CSS3Helpers.setMatrixFilter(obj, matrix)
+ } else if (obj.style[property] != null) {
+ obj.style[property] = transformString;
+ }
+ }
+
+ function fixTransforms(){
+
+ var transformRules = getRuleList('-sand-transform').values;
+ var property = CSS3Helpers.findProperty(document.body, 'transform');
+
+
+ for (var i in transformRules) {
+ var rule = transformRules[i];
+ var nodes = document.querySelectorAll(rule.selector);
+
+ for (var j = 0; j < nodes.length; j++) {
+ me.setTransform(nodes[j], rule.value)
+ }
+
+ }
+
+ }
+
+ me.setBoxShadow = function(obj, value){
+ var property = CSS3Helpers.findProperty(obj, 'boxShadow');
+
+ var values = CSS3Helpers.getBoxShadowValues(value);
+
+ if (property == "filter") {
+ var filter = CSS3Helpers.addFilter(obj, 'DXImageTransform.Microsoft.DropShadow', StringHelpers.sprintf("color=%s,offX=%d,offY=%d", values.color, values.offsetX, values.offsetY));
+ filter.color = values.color;
+ filter.offX = values.offsetX;
+ filter.offY = values.offsetY;
+
+ } else if (obj.style[property] != null) {
+ obj.style[property] = value;
+ }
+ }
+
+ function fixBoxShadow(){
+
+ var transformRules = getRuleList('-sand-box-shadow').values;
+
+ //var matrices = new Array();
+
+
+ for (var i in transformRules) {
+ var rule = transformRules[i];
+
+ var nodes = document.querySelectorAll(rule.selector);
+
+
+
+ for (var j = 0; j < nodes.length; j++) {
+ me.setBoxShadow(nodes[j], rule.value)
+
+ }
+
+ }
+
+ }
+
+ function setGradientFilter(node, values){
+
+ if (values.colorStops.length == 2 &&
+ values.colorStops[0].stop == 0.0 &&
+ values.colorStops[1].stop == 1.0) {
+ var startColor = new RGBColor(values.colorStops[0].color);
+ var endColor = new RGBColor(values.colorStops[1].color);
+
+ startColor = startColor.toHex();
+ endColor = endColor.toHex();
+
+ var filter = CSS3Helpers.addFilter(node, 'DXImageTransform.Microsoft.Gradient', StringHelpers.sprintf("GradientType = %s, StartColorStr = '%s', EndColorStr = '%s'", values.IEdir, startColor, endColor));
+
+ filter.GradientType = values.IEdir;
+ filter.StartColorStr = startColor;
+ filter.EndColorStr = endColor;
+ node.style.zoom = 1;
+ }
+ }
+
+ me.setGradient = function(node, value){
+
+ var support = CSS3Helpers.reportGradientSupport();
+
+ var values = CSS3Helpers.getGradient(value);
+
+ if (values == null) {
+ return;
+ }
+
+ if (node.filters) {
+ setGradientFilter(node, values);
+ } else if (support == implementation.MOZILLA) {
+
+ node.style.backgroundImage = StringHelpers.sprintf('-moz-gradient( %s, %s, from(%s), to(%s))', values.dirBegin, values.dirEnd, values.colorStops[0].color, values.colorStops[1].color);
+ } else if (support == implementation.WEBKIT) {
+ var tmp = StringHelpers.sprintf('-webkit-gradient(%s, %s, %s %s, %s %s)', values.type, values.dirBegin, values.r0 ? values.r0 + ", " : "", values.dirEnd, values.r1 ? values.r1 + ", " : "", listColorStops(values.colorStops));
+ node.style.backgroundImage = tmp;
+ } else if (support == implementation.CANVAS_WORKAROUND) {
+ try {
+ CSS3Helpers.applyCanvasGradient(node, values);
+ }
+ catch (ex) {
+ // do nothing (for now).
+ }
+ }
+ }
+
+ me.setRGBABackground = function(node, value){
+
+ var support = CSS3Helpers.reportColorSpaceSupport('RGBA', colorType.BACKGROUND);
+
+ switch (support) {
+ case implementation.NATIVE:
+ node.style.value = value;
+ break;
+ case implementation.FILTER_WORKAROUND:
+ setGradientFilter(node, {
+ IEdir: 0,
+ colorStops: [{
+ stop: 0.0,
+ color: value
+ }, {
+ stop: 1.0,
+ color: value
+ }]
+ });
+
+ break;
+ }
+
+ }
+
+ me.setHSLABackground = function(node, value) {
+ var support = CSS3Helpers.reportColorSpaceSupport('HSLA', colorType.BACKGROUND);
+
+ switch (support) {
+ case implementation.NATIVE:
+ /* node.style.value = value;
+ break; */
+ case implementation.FILTER_WORKAROUND:
+ var rgbColor = new RGBColor(value);
+
+ if (rgbColor.a == 1) {
+ node.style.backgroundColor = rgbColor.toHex();
+ } else {
+ var rgba = rgbColor.toRGBA();
+ setGradientFilter(node, {
+ IEdir: 0,
+ colorStops: [{
+ stop: 0.0,
+ color: rgba
+ }, {
+ stop: 1.0,
+ color: rgba
+ }]
+ });
+ }
+ break;
+ }
+ }
+
+ /**
+ * Convert a hyphenated string to camelized text. For example, the string "font-type" will be converted
+ * to "fontType".
+ *
+ * @param {Object} s - the string that needs to be camelized.
+ * @return {String} - the camelized text.
+ */
+ me.camelize = function (s) {
+ var r="";
+
+ for (var i=0; i<s.length; i++) {
+ if (s.substring(i, i+1) == '-') {
+ i++;
+ r+= s.substring(i, i+1).toUpperCase();
+ } else {
+ r+= s.substring(i, i+1);
+ }
+ }
+
+ return r;
+ }
+
+ me.setHSLColor = function (node, property, value) {
+ var support = CSS3Helpers.reportColorSpaceSupport('HSL', colorType.FOREGROUND);
+
+ switch (support) {
+ case implementation.NATIVE:
+ /* node.style.value = value;
+ break; */
+ case implementation.HEX_WORKAROUND:
+
+ var hslColor = value.match(reHSL)[0];
+ var hexColor = new RGBColor(hslColor).toHex()
+ var newPropertyValue = value.replace(reHSL, hexColor);
+
+
+
+ node.style[me.camelize(property)] = newPropertyValue;
+
+ break;
+ }
+
+ }
+
+
+ function fixLinearGradients(){
+
+ var backgroundRules = getRuleList('background').values.concat(getRuleList('background-image').values);
+
+ for (var i in backgroundRules) {
+ var rule = backgroundRules[i];
+ var nodes = document.querySelectorAll(rule.selector);
+ for (var j = 0; j < nodes.length; j++) {
+ me.setGradient(nodes[j], rule.value)
+ }
+ }
+ }
+
+ function fixBackgrounds(){
+
+ var support = CSS3Helpers.reportColorSpaceSupport('RGBA', colorType.BACKGROUND);
+ if (support == implementation.NATIVE) {
+ return;
+ }
+
+
+ var backgroundRules = getRuleList('background').values.concat(getRuleList('background-color').values);
+
+ for (var i in backgroundRules) {
+ var rule = backgroundRules[i];
+ var nodes = document.querySelectorAll(rule.selector);
+ for (var j = 0; j < nodes.length; j++) {
+ if (rule.value.indexOf('rgba(') == 0) {
+ me.setRGBABackground(nodes[j], rule.value);
+ } else if (rule.value.indexOf('hsla(') == 0 || rule.value.indexOf('hsl(') == 0) {
+
+ me.setHSLABackground(nodes[j], rule.value);
+ }
+ }
+ }
+ }
+
+ me.getProperties = function (obj, objName)
+ {
+ var result = ""
+
+ if (!obj) {
+ return result;
+ }
+
+ for (var i in obj)
+ {
+ try {
+ result += objName + "." + i.toString() + " = " + obj[i] + ", ";
+ } catch (ex) {
+ // nothing
+ }
+ }
+ return result
+ }
+
+ function fixColors() {
+ var support = CSS3Helpers.reportColorSpaceSupport('HSL', colorType.FOREGROUND);
+ if (support == implementation.NATIVE) {
+ return;
+ }
+
+ var colorRules = getRuleList('color').values;
+
+ var properties = ['color', 'border',
+ 'border-left', 'border-right', 'border-bottom', 'border-top',
+ 'border-left-color', 'border-right-color', 'border-bottom-color', 'border-top-color'];
+
+ for (var i=0; i<properties.length; i++) {
+ var rules = getRuleList(properties[i]).values;
+ colorRules = colorRules.concat(rules);
+ }
+
+ for (var i in colorRules) {
+ var rule = colorRules[i];
+
+ var nodes = document.querySelectorAll(rule.selector);
+ for (var j = 0; j < nodes.length; j++) {
+ var isBorder = (rule.name.indexOf('border') == 0);
+ var ruleMatch = rule.value.match(reHSL);
+
+
+ if (ruleMatch) {
+
+ var cssProperty;
+ if (isBorder && rule.name.indexOf('-color') < 0) {
+ cssProperty = rule.name;
+ } else {
+ cssProperty = rule.name;
+ }
+
+ me.setHSLColor(nodes[j], cssProperty, rule.value);
+
+ }
+ }
+ }
+ }
+
+
+
+ function listColorStops(colorStops){
+ var sb = new StringBuffer();
+
+ for (var i = 0; i < colorStops.length; i++) {
+ sb.append(StringHelpers.sprintf("color-stop(%s, %s)", colorStops[i].stop, colorStops[i].color));
+ if (i < colorStops.length - 1) {
+ sb.append(', ');
+ }
+ }
+
+ return sb.toString();
+ }
+
+
+ function getStyleSheet(node){
+ var sheetCssText;
+ switch (node.nodeName.toLowerCase()) {
+ case 'style':
+ sheetCssText = StringHelpers.uncommentHTML(node.innerHTML); //does not work with inline styles because IE doesn't allow you to get the text content of a STYLE element
+ break;
+ case 'link':
+
+ var xhr = XMLHelpers.getXMLHttpRequest(node.href, null, "GET", null, false);
+ sheetCssText = xhr.responseText;
+
+ break;
+ }
+
+ sheetCssText = sheetCssText.replace(reMultiLineComment, '').replace(reAtRule, '');
+
+ return sheetCssText;
+ }
+
+ function getStyleSheets(){
+
+ styleNodes = document.querySelectorAll('style, link[rel="stylesheet"]');
+
+ for (var i = 0; i < styleNodes.length; i++) {
+ if (!CSSHelpers.isMemberOfClass(styleNodes[i], 'cssSandpaper-noIndex')) {
+ styleSheets.push(getStyleSheet(styleNodes[i]))
+ }
+ }
+ }
+
+ function indexRules(){
+
+ for (var i = 0; i < styleSheets.length; i++) {
+ var sheet = styleSheets[i];
+
+ rules = sheet.match(ruleSetRe);
+ if (rules) {
+ for (var j = 0; j < rules.length; j++) {
+ var parsedRule = rules[j].split(ruleSplitRe);
+ var selector = parsedRule[0].trim();
+ var propertiesStr = parsedRule[1];
+ var properties = propertiesStr.split(';');
+ for (var k = 0; k < properties.length; k++) {
+ if (properties[k].trim() != '') {
+ var splitProperty = properties[k].split(':')
+ var name = splitProperty[0].trim().toLowerCase();
+ var value = splitProperty[1];
+ if (!ruleLists[name]) {
+ ruleLists[name] = new RuleList(name);
+ }
+
+ if (value && typeof(ruleLists[name]) == 'object') {
+ ruleLists[name].add(selector, value.trim());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ function getRuleList(name){
+ var list = ruleLists[name];
+ if (!list) {
+ list = new RuleList(name);
+ }
+ return list;
+ }
+
+ function setClasses(){
+
+
+ var htmlNode = document.getElementsByTagName('html')[0];
+ var properties = ['transform', 'opacity'];
+
+ for (var i = 0; i < properties.length; i++) {
+ var prop = properties[i];
+ if (CSS3Helpers.supports(prop)) {
+ CSSHelpers.addClass(htmlNode, 'cssSandpaper-' + prop);
+ }
+ }
+
+ // Now .. remove the initially hidden classes
+ var hiddenNodes = CSSHelpers.getElementsByClassName(document, 'cssSandpaper-initiallyHidden');
+
+ for (var i=0; i<hiddenNodes.length; i++){
+ CSSHelpers.removeClass(hiddenNodes[i], 'cssSandpaper-initiallyHidden');
+ }
+ }
+}
+
+function RuleList(propertyName){
+ var me = this;
+ me.values = new Array();
+ me.propertyName = propertyName;
+ me.add = function(selector, value){
+ me.values.push(new CSSRule(selector, me.propertyName, value));
+ }
+}
+
+function CSSRule(selector, name, value){
+ var me = this;
+ me.selector = selector;
+ me.name = name;
+ me.value = value;
+
+ me.toString = function(){
+ return StringHelpers.sprintf("%s { %s: %s}", me.selector, me.name, me.value);
+ }
+}
+
+var MatrixGenerator = new function(){
+ var me = this;
+ var reUnit = /[a-z]+$/;
+ me.identity = $M([[1, 0, 0], [0, 1, 0], [0, 0, 1]]);
+
+
+ function degreesToRadians(degrees){
+ return (degrees - 360) * Math.PI / 180;
+ }
+
+ function getRadianScalar(angleStr){
+
+ var num = parseFloat(angleStr);
+ var unit = angleStr.match(reUnit);
+
+
+ if (angleStr.trim() == '0') {
+ num = 0;
+ unit = 'rad';
+ }
+
+ if (unit.length != 1 || num == 0) {
+ return 0;
+ }
+
+
+ unit = unit[0];
+
+
+ var rad;
+ switch (unit) {
+ case "deg":
+ rad = degreesToRadians(num);
+ break;
+ case "rad":
+ rad = num;
+ break;
+ default:
+ throw "Not an angle: " + angleStr;
+ }
+ return rad;
+ }
+
+ me.prettyPrint = function(m){
+ return StringHelpers.sprintf('| %s %s %s | - | %s %s %s | - |%s %s %s|', m.e(1, 1), m.e(1, 2), m.e(1, 3), m.e(2, 1), m.e(2, 2), m.e(2, 3), m.e(3, 1), m.e(3, 2), m.e(3, 3))
+ }
+
+ me.rotate = function(angleStr){
+ var num = getRadianScalar(angleStr);
+ return Matrix.RotationZ(num);
+ }
+
+ me.scale = function(sx, sy){
+ sx = parseFloat(sx)
+
+ if (!sy) {
+ sy = sx;
+ } else {
+ sy = parseFloat(sy)
+ }
+
+
+ return $M([[sx, 0, 0], [0, sy, 0], [0, 0, 1]]);
+ }
+
+ me.scaleX = function(sx){
+ return me.scale(sx, 1);
+ }
+
+ me.scaleY = function(sy){
+ return me.scale(1, sy);
+ }
+
+ me.skew = function(ax, ay){
+ var xRad = getRadianScalar(ax);
+ var yRad;
+
+ if (ay != null) {
+ yRad = getRadianScalar(ay)
+ } else {
+ yRad = xRad
+ }
+
+ if (xRad != null && yRad != null) {
+
+ return $M([[1, Math.tan(xRad), 0], [Math.tan(yRad), 1, 0], [0, 0, 1]]);
+ } else {
+ return null;
+ }
+ }
+
+ me.skewX = function(ax){
+
+ return me.skew(ax, "0");
+ }
+
+ me.skewY = function(ay){
+ return me.skew("0", ay);
+ }
+
+ me.translate = function(tx, ty){
+
+ var TX = parseInt(tx);
+ var TY = parseInt(ty)
+
+ //jslog.debug(StringHelpers.sprintf('translate %f %f', TX, TY));
+
+ return $M([[1, 0, TX], [0, 1, TY], [0, 0, 1]]);
+ }
+
+ me.translateX = function(tx){
+ return me.translate(tx, 0);
+ }
+
+ me.translateY = function(ty){
+ return me.translate(0, ty);
+ }
+
+
+ me.matrix = function(a, b, c, d, e, f){
+
+ // for now, e and f are ignored
+ return $M([[a, c, parseInt(e)], [b, d, parseInt(f)], [0, 0, 1]])
+ }
+}
+
+var CSS3Helpers = new function(){
+ var me = this;
+
+
+ var reTransformListSplitter = /[a-zA-Z]+\([^\)]*\)\s*/g;
+
+ var reLeftBracket = /\(/g;
+ var reRightBracket = /\)/g;
+ var reComma = /,/g;
+
+ var reSpaces = /\s+/g
+
+ var reFilterNameSplitter = /progid:([^\(]*)/g;
+
+ var reLinearGradient
+
+ var canvas;
+
+ var cache = new Array();
+
+
+ me.supports = function(cssProperty){
+ if (CSS3Helpers.findProperty(document.body, cssProperty) != null) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ me.getCanvas = function(){
+
+ if (canvas) {
+ return canvas;
+ } else {
+ canvas = document.createElement('canvas');
+ return canvas;
+ }
+ }
+
+ me.getTransformationMatrix = function(CSS3TransformProperty, doThrowIfError){
+
+ var transforms = CSS3TransformProperty.match(reTransformListSplitter);
+
+ /*
+ * Do a check here to see if there is anything in the transformation
+ * besides legit transforms
+ */
+ if (doThrowIfError) {
+ var checkString = transforms.join(" ").replace(/\s*/g, ' ');
+ var normalizedCSSProp = CSS3TransformProperty.replace(/\s*/g, ' ');
+
+ if (checkString != normalizedCSSProp) {
+ throw ("An invalid transform was given.")
+ }
+ }
+
+
+ var resultantMatrix = MatrixGenerator.identity;
+
+ for (var j = 0; j < transforms.length; j++) {
+
+ var transform = transforms[j];
+
+ transform = transform.replace(reLeftBracket, '("').replace(reComma, '", "').replace(reRightBracket, '")');
+
+
+ try {
+ var matrix = eval('MatrixGenerator.' + transform);
+
+
+ //jslog.debug( transform + ': ' + MatrixGenerator.prettyPrint(matrix))
+ resultantMatrix = resultantMatrix.x(matrix);
+ }
+ catch (ex) {
+
+ if (doThrowIfError) {
+ var method = transform.split('(')[0];
+
+ var funcCall = transform.replace(/\"/g, '');
+
+ if (MatrixGenerator[method] == undefined) {
+ throw "Error: invalid tranform function: " + funcCall;
+ } else {
+ throw "Error: Invalid or missing parameters in function call: " + funcCall;
+
+ }
+ }
+ // do nothing;
+ }
+ }
+
+ return resultantMatrix;
+
+ }
+
+ me.getBoxShadowValues = function(propertyValue){
+ var r = new Object();
+
+ var values = propertyValue.split(reSpaces);
+
+ if (values[0] == 'inset') {
+ r.inset = true;
+ values = values.reverse().pop().reverse();
+ } else {
+ r.inset = false;
+ }
+
+ r.offsetX = parseInt(values[0]);
+ r.offsetY = parseInt(values[1]);
+
+ if (values.length > 3) {
+ r.blurRadius = values[2];
+
+ if (values.length > 4) {
+ r.spreadRadius = values[3]
+ }
+ }
+
+ r.color = values[values.length - 1];
+
+ return r;
+ }
+
+ me.getGradient = function(propertyValue){
+ var r = new Object();
+ r.colorStops = new Array();
+
+
+ var substring = me.getBracketedSubstring(propertyValue, '-sand-gradient');
+ if (substring == undefined) {
+ return null;
+ }
+ var parameters = substring.match(/[^\(,]+(\([^\)]*\))?[^,]*/g); //substring.split(reComma);
+ r.type = parameters[0].trim();
+
+ if (r.type == 'linear') {
+ r.dirBegin = parameters[1].trim();
+ r.dirEnd = parameters[2].trim();
+ var beginCoord = r.dirBegin.split(reSpaces);
+ var endCoord = r.dirEnd.split(reSpaces);
+
+ for (var i = 3; i < parameters.length; i++) {
+ r.colorStops.push(parseColorStop(parameters[i].trim(), i - 3));
+ }
+
+
+
+
+ /* The following logic only applies to IE */
+ if (document.body.filters) {
+ if (r.x0 == r.x1) {
+ /* IE only supports "center top", "center bottom", "top left" and "top right" */
+
+ switch (beginCoord[1]) {
+ case 'top':
+ r.IEdir = 0;
+ break;
+ case 'bottom':
+ swapIndices(r.colorStops, 0, 1);
+ r.IEdir = 0;
+ /* r.from = parameters[4].trim();
+ r.to = parameters[3].trim(); */
+ break;
+ }
+ }
+
+ if (r.y0 == r.y1) {
+ switch (beginCoord[0]) {
+ case 'left':
+ r.IEdir = 1;
+ break;
+ case 'right':
+ r.IEdir = 1;
+ swapIndices(r.colorStops, 0, 1);
+
+ break;
+ }
+ }
+ }
+ } else {
+
+ // don't even bother with IE
+ if (document.body.filters) {
+ return null;
+ }
+
+
+ r.dirBegin = parameters[1].trim();
+ r.r0 = parameters[2].trim();
+
+ r.dirEnd = parameters[3].trim();
+ r.r1 = parameters[4].trim();
+
+ var beginCoord = r.dirBegin.split(reSpaces);
+ var endCoord = r.dirEnd.split(reSpaces);
+
+ for (var i = 5; i < parameters.length; i++) {
+ r.colorStops.push(parseColorStop(parameters[i].trim(), i - 5));
+ }
+
+ }
+
+
+ r.x0 = beginCoord[0];
+ r.y0 = beginCoord[1];
+
+ r.x1 = endCoord[0];
+ r.y1 = endCoord[1];
+
+ return r;
+ }
+
+ function swapIndices(array, index1, index2){
+ var tmp = array[index1];
+ array[index1] = array[index2];
+ array[index2] = tmp;
+ }
+
+ function parseColorStop(colorStop, index){
+ var r = new Object();
+ var substring = me.getBracketedSubstring(colorStop, 'color-stop');
+ var from = me.getBracketedSubstring(colorStop, 'from');
+ var to = me.getBracketedSubstring(colorStop, 'to');
+
+
+ if (substring) {
+ //color-stop
+ var parameters = substring.split(',')
+ r.stop = normalizePercentage(parameters[0].trim());
+ r.color = parameters[1].trim();
+ } else if (from) {
+ r.stop = 0.0;
+ r.color = from.trim();
+ } else if (to) {
+ r.stop = 1.0;
+ r.color = to.trim();
+ } else {
+ if (index <= 1) {
+ r.color = colorStop;
+ if (index == 0) {
+ r.stop = 0.0;
+ } else {
+ r.stop = 1.0;
+ }
+ } else {
+ throw (StringHelpers.sprintf('invalid argument "%s"', colorStop));
+ }
+ }
+ return r;
+ }
+
+ function normalizePercentage(s){
+ if (s.substring(s.length - 1, s.length) == '%') {
+ return parseFloat(s) / 100 + "";
+ } else {
+ return s;
+ }
+
+ }
+
+ me.reportGradientSupport = function(){
+
+ if (!cache["gradientSupport"]) {
+ var r;
+ var div = document.createElement('div');
+ div.style.cssText = "background-image:-webkit-gradient(linear, 0% 0%, 0% 100%, from(red), to(blue));";
+
+ if (div.style.backgroundImage) {
+ r = implementation.WEBKIT;
+
+ } else {
+
+ /* div.style.cssText = "background-image:-moz-linear-gradient(top, blue, white 80%, orange);";
+
+ if (div.style.backgroundImage) {
+
+ r = implementation.MOZILLA;
+
+ } else { */
+ var canvas = CSS3Helpers.getCanvas();
+ if (canvas.getContext && canvas.toDataURL) {
+ r = implementation.CANVAS_WORKAROUND;
+
+ } else {
+ r = implementation.NONE;
+ }
+ /* } */
+ }
+
+ cache["gradientSupport"] = r;
+ }
+ return cache["gradientSupport"];
+ }
+
+ me.reportColorSpaceSupport = function(colorSpace, type){
+
+ if (!cache[colorSpace + type]) {
+ var r;
+ var div = document.createElement('div');
+
+ switch (type) {
+
+ case colorType.BACKGROUND:
+
+ switch(colorSpace) {
+ case 'RGBA':
+ div.style.cssText = "background-color: rgba(255, 32, 34, 0.5)";
+ break;
+ case 'HSL':
+ div.style.cssText = "background-color: hsl(0,0%,100%)";
+ break;
+ case 'HSLA':
+ div.style.cssText = "background-color: hsla(0,0%,100%,.5)";
+ break;
+
+ default:
+ break;
+ }
+
+
+
+ var body = document.body;
+
+
+ if (div.style.backgroundColor) {
+ r = implementation.NATIVE;
+
+ } else if (body.filters && body.filters != undefined) {
+ r = implementation.FILTER_WORKAROUND;
+ } else {
+ r = implementation.NONE;
+ }
+ break;
+ case colorType.FOREGROUND:
+ switch(colorSpace) {
+ case 'RGBA':
+ div.style.cssText = "color: rgba(255, 32, 34, 0.5)";
+ break;
+ case 'HSL':
+ div.style.cssText = "color: hsl(0,0%,100%)";
+ break;
+ case 'HSLA':
+ div.style.cssText = "color: hsla(0,0%,100%,.5)";
+ break;
+
+ default:
+ break;
+ }
+
+ if (div.style.color) {
+ r = implementation.NATIVE;
+ } else if (colorSpace == 'HSL') {
+
+ r = implementation.HEX_WORKAROUND;
+ } else {
+ r = implementation.NONE;
+ }
+ break
+ }
+
+
+ cache[colorSpace] = r;
+ }
+ return cache[colorSpace];
+ }
+
+
+
+ me.getBracketedSubstring = function(s, header){
+ var gradientIndex = s.indexOf(header + '(')
+
+ if (gradientIndex != -1) {
+ var substring = s.substring(gradientIndex);
+
+ var openBrackets = 1;
+ for (var i = header.length + 1; i < 100 || i < substring.length; i++) {
+ var c = substring.substring(i, i + 1);
+ switch (c) {
+ case "(":
+ openBrackets++;
+ break;
+ case ")":
+ openBrackets--;
+ break;
+ }
+
+ if (openBrackets == 0) {
+ break;
+ }
+
+ }
+
+ return substring.substring(gradientIndex + header.length + 1, i);
+ }
+
+
+ }
+
+
+ me.setMatrixFilter = function(obj, matrix){
+
+
+ if (!hasIETransformWorkaround(obj)) {
+ addIETransformWorkaround(obj)
+ }
+
+ var container = obj.parentNode;
+ //container.xTransform = degrees;
+
+
+ filter = obj.filters.item('DXImageTransform.Microsoft.Matrix');
+ //jslog.debug(MatrixGenerator.prettyPrint(matrix))
+ filter.M11 = matrix.e(1, 1);
+ filter.M12 = matrix.e(1, 2);
+ filter.M21 = matrix.e(2, 1);
+ filter.M22 = matrix.e(2, 2);
+
+
+ // Now, adjust the margins of the parent object
+ var offsets = me.getIEMatrixOffsets(obj, matrix, container.xOriginalWidth, container.xOriginalHeight);
+ container.style.marginLeft = offsets.x;
+ container.style.marginTop = offsets.y;
+ container.style.marginRight = 0;
+ container.style.marginBottom = 0;
+ }
+
+ me.getTransformedDimensions = function (obj, matrix) {
+ var r = {};
+
+ if (hasIETransformWorkaround(obj)) {
+ r.width = obj.offsetWidth;
+ r.height = obj.offsetHeight;
+ } else {
+ var pts = [
+ matrix.x($V([0, 0, 1])) ,
+ matrix.x($V([0, obj.offsetHeight, 1])),
+ matrix.x($V([obj.offsetWidth, 0, 1])),
+ matrix.x($V([obj.offsetWidth, obj.offsetHeight, 1]))
+ ];
+ var maxX = 0, maxY =0, minX=0, minY=0;
+
+ for (var i = 0; i < pts.length; i++) {
+ var pt = pts[i];
+ var x = pt.e(1), y = pt.e(2);
+ var minX = Math.min(minX, x);
+ var maxX = Math.max(maxX, x);
+ var minY = Math.min(minY, y);
+ var maxY = Math.max(maxY, y);
+ }
+
+
+ r.width = maxX - minX;
+ r.height = maxY - minY;
+
+ }
+
+ return r;
+ }
+
+ me.getIEMatrixOffsets = function (obj, matrix, width, height) {
+ var r = {};
+
+ var originalWidth = parseFloat(width);
+ var originalHeight = parseFloat(height);
+
+
+ var offset;
+ if (CSSHelpers.getComputedStyle(obj, 'display') == 'inline') {
+ offset = 0;
+ } else {
+ offset = 13; // This works ... don't know why.
+ }
+ var transformedDimensions = me.getTransformedDimensions(obj, matrix);
+
+ r.x = (((originalWidth - transformedDimensions.width) / 2) - offset + matrix.e(1, 3)) + 'px';
+ r.y = (((originalHeight - transformedDimensions.height) / 2) - offset + matrix.e(2, 3)) + 'px';
+
+ return r;
+ }
+
+ function hasIETransformWorkaround(obj){
+
+ return CSSHelpers.isMemberOfClass(obj.parentNode, 'IETransformContainer');
+ }
+
+ function addIETransformWorkaround(obj){
+ if (!hasIETransformWorkaround(obj)) {
+ var parentNode = obj.parentNode;
+ var filter;
+
+ // This is the container to offset the strange rotation behavior
+ var container = document.createElement('div');
+ CSSHelpers.addClass(container, 'IETransformContainer');
+
+
+ container.style.width = obj.offsetWidth + 'px';
+ container.style.height = obj.offsetHeight + 'px';
+
+ container.xOriginalWidth = obj.offsetWidth;
+ container.xOriginalHeight = obj.offsetHeight;
+ container.style.position = 'absolute'
+ container.style.zIndex = obj.currentStyle.zIndex;
+
+
+ var horizPaddingFactor = 0; //parseInt(obj.currentStyle.paddingLeft);
+ var vertPaddingFactor = 0; //parseInt(obj.currentStyle.paddingTop);
+ if (obj.currentStyle.display == 'block') {
+ container.style.left = obj.offsetLeft + 13 - horizPaddingFactor + "px";
+ container.style.top = obj.offsetTop + 13 + -vertPaddingFactor + 'px';
+ } else {
+ container.style.left = obj.offsetLeft + "px";
+ container.style.top = obj.offsetTop + 'px';
+
+ }
+ //container.style.float = obj.currentStyle.float;
+
+
+ obj.style.top = "auto";
+ obj.style.left = "auto"
+ obj.style.bottom = "auto";
+ obj.style.right = "auto";
+ // This is what we need in order to insert to keep the document
+ // flow ok
+ var replacement = obj.cloneNode(true);
+ replacement.style.visibility = 'hidden';
+
+ obj.replaceNode(replacement);
+
+ // now, wrap container around the original node ...
+
+ obj.style.position = 'absolute';
+ container.appendChild(obj);
+ parentNode.insertBefore(container, replacement);
+ container.style.backgroundColor = 'transparent';
+
+ container.style.padding = '0';
+
+ filter = me.addFilter(obj, 'DXImageTransform.Microsoft.Matrix', "M11=1, M12=0, M21=0, M22=1, sizingMethod='auto expand'")
+ var bgImage = obj.currentStyle.backgroundImage.split("\"")[1];
+ /*
+
+
+
+ if (bgImage) {
+
+
+
+ var alphaFilter = me.addFilter(obj, "DXImageTransform.Microsoft.AlphaImageLoader", "src='" + bgImage + "', sizingMethod='scale'");
+
+
+
+ alert(bgImage)
+
+
+
+ alphaFilter.src = bgImage;
+
+
+
+ sizingMethod = 'scale';
+
+
+
+ obj.style.background = 'none';
+
+
+
+ obj.style.backgroundImage = 'none';
+
+
+
+ }
+
+
+
+ */
+
+ }
+
+ }
+
+ me.addFilter = function(obj, filterName, filterValue){
+ // now ... insert the filter so we can exploit its wonders
+
+ var filter;
+ try {
+ filter = obj.filters.item(filterName);
+ }
+ catch (ex) {
+ // dang! We have to go through all of them and make sure filter
+ // is set right before we add the new one.
+
+
+ var filterList = new MSFilterList(obj)
+
+ filterList.fixFilterStyle();
+
+ var comma = ", ";
+
+ if (obj.filters.length == 0) {
+ comma = "";
+ }
+
+ obj.style.filter += StringHelpers.sprintf("%sprogid:%s(%s)", comma, filterName, filterValue);
+
+ filter = obj.filters.item(filterName);
+
+ }
+
+ return filter;
+ }
+
+
+ function degreesToRadians(degrees){
+ return (degrees - 360) * Math.PI / 180;
+ }
+
+ me.findProperty = function(obj, type){
+ capType = type.capitalize();
+
+ var r = cache[type]
+ if (!r) {
+
+
+ var style = obj.style;
+
+
+ var properties = [type, 'Moz' + capType, 'Webkit' + capType, 'O' + capType, 'filter'];
+ for (var i = 0; i < properties.length; i++) {
+ if (style[properties[i]] != null) {
+ r = properties[i];
+ break;
+ }
+ }
+
+ if (r == 'filter' && document.body.filters == undefined) {
+ r = null;
+ }
+ cache[type] = r;
+ }
+ return r;
+ }
+
+ /*
+ * "A point is a pair of space-separated values. The syntax supports numbers,
+ * percentages or the keywords top, bottom, left and right for point values."
+ * This keywords and percentages into pixel equivalents
+ */
+ me.parseCoordinate = function(value, max){
+ //Convert keywords
+ switch (value) {
+ case 'top':
+ case 'left':
+ return 0;
+ case 'bottom':
+ case 'right':
+ return max;
+ case 'center':
+ return max / 2;
+ }
+
+ //Convert percentage
+ if (value.indexOf('%') != -1)
+ value = parseFloat(value.substr(0, value.length - 1)) / 100 * max;
+ //Convert bare number (a pixel value)
+ else
+ value = parseFloat(value);
+ if (isNaN(value))
+ throw Error("Unable to parse coordinate: " + value);
+ return value;
+ }
+
+ me.applyCanvasGradient = function(el, gradient){
+
+ var canvas = me.getCanvas();
+ var computedStyle = document.defaultView.getComputedStyle(el, null);
+
+ canvas.width = parseInt(computedStyle.width) + parseInt(computedStyle.paddingLeft) + parseInt(computedStyle.paddingRight) + 1; // inserted by Zoltan
+ canvas.height = parseInt(computedStyle.height) + parseInt(computedStyle.paddingTop) + parseInt(computedStyle.paddingBottom) + 2; // 1 inserted by Zoltan
+ var ctx = canvas.getContext('2d');
+
+ //Iterate over the gradients and build them up
+
+ var canvasGradient;
+ // Linear gradient
+ if (gradient.type == 'linear') {
+
+
+ canvasGradient = ctx.createLinearGradient(me.parseCoordinate(gradient.x0, canvas.width), me.parseCoordinate(gradient.y0, canvas.height), me.parseCoordinate(gradient.x1, canvas.width), me.parseCoordinate(gradient.y1, canvas.height));
+ } // Radial gradient
+ else /*if(gradient.type == 'radial')*/ {
+ canvasGradient = ctx.createRadialGradient(me.parseCoordinate(gradient.x0, canvas.width), me.parseCoordinate(gradient.y0, canvas.height), gradient.r0, me.parseCoordinate(gradient.x1, canvas.width), me.parseCoordinate(gradient.y1, canvas.height), gradient.r1);
+ }
+
+ //Add each of the color stops to the gradient
+ for (var i = 0; i < gradient.colorStops.length; i++) {
+ var cs = gradient.colorStops[i];
+
+ canvasGradient.addColorStop(cs.stop, cs.color);
+ };
+
+ //Paint the gradient
+ ctx.fillStyle = canvasGradient;
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+
+
+ //Apply the gradient to the selectedElement
+ el.style.backgroundImage = "url('" + canvas.toDataURL() + "')";
+
+ }
+
+}
+
+function MSFilterList(node){
+ var me = this;
+
+ me.list = new Array();
+ me.node = node;
+
+ var reFilterListSplitter = /[\s\S]*\([\s\S]*\)/g;
+
+ var styleAttr = node.style;
+
+ function init(){
+
+ var filterCalls = styleAttr.filter.match(reFilterListSplitter);
+
+ if (filterCalls != null) {
+
+ for (var i = 0; i < filterCalls.length; i++) {
+ var call = filterCalls[i];
+
+ me.list.push(new MSFilter(node, call));
+
+ }
+ }
+
+
+ }
+
+ me.toString = function(){
+ var sb = new StringBuffer();
+
+ for (var i = 0; i < me.list.length; i++) {
+
+ sb.append(me.list[i].toString());
+ if (i < me.list.length - 1) {
+ sb.append(',')
+ }
+ }
+ return sb.toString();
+ }
+
+
+ me.fixFilterStyle = function(){
+
+ try {
+ me.node.style.filter = me.toString();
+ }
+ catch (ex) {
+ // do nothing.
+ }
+
+ }
+
+ init();
+}
+
+function MSFilter(node, filterCall){
+ var me = this;
+
+ me.node = node;
+ me.filterCall = filterCall;
+
+ var reFilterNameSplitter = /progid:([^\(]*)/g;
+ var reParameterName = /([a-zA-Z0-9]+\s*)=/g;
+
+
+ function init(){
+ me.name = me.filterCall.match(reFilterNameSplitter)[0].replace('progid:', '');
+
+ //This may not be the best way to do this.
+ var parameterString = filterCall.split('(')[1].replace(')', '');
+ me.parameters = parameterString.match(reParameterName);
+
+ for (var i = 0; i < me.parameters.length; i++) {
+ me.parameters[i] = me.parameters[i].replace('=', '');
+ }
+
+ }
+
+ me.toString = function(){
+
+ var sb = new StringBuffer();
+
+ sb.append(StringHelpers.sprintf('progid:%s(', me.name));
+
+ for (var i = 0; i < me.parameters.length; i++) {
+ var param = me.parameters[i];
+ var filterObj = me.node.filters.item(me.name);
+ var paramValue = filterObj[param];
+ if (typeof(paramValue) == 'string') {
+ sb.append(StringHelpers.sprintf('%s="%s"', param, filterObj[param]));
+ } else {
+ sb.append(StringHelpers.sprintf('%s=%s', param, filterObj[param]));
+ }
+
+ if (i != me.parameters.length - 1) {
+ sb.append(', ')
+ }
+ }
+ sb.append(')');
+
+ return sb.toString();
+ }
+
+
+
+ init();
+}
+
+var implementation = new function(){
+ this.NONE = 0;
+
+ // Native Support.
+ this.NATIVE = 1;
+
+ // Vendor specific prefix implementations
+ this.MOZILLA = 2;
+ this.WEBKIT = 3;
+ this.IE = 4;
+ this.OPERA = 5;
+
+ // Non CSS3 Workarounds
+ this.CANVAS_WORKAROUND = 6;
+ this.FILTER_WORKAROUND = 7;
+ this.HEX_WORKAROUND = 8;
+}
+
+var colorType = new function () {
+ this.BACKGROUND = 0;
+ this.FOREGROUND = 1;
+}
+
+/*
+ * Extra helper routines
+ */
+if (!window.StringHelpers) {
+StringHelpers = new function(){
+ var me = this;
+
+ // used by the String.prototype.trim()
+ me.initWhitespaceRe = /^\s\s*/;
+ me.endWhitespaceRe = /\s\s*$/;
+ me.whitespaceRe = /\s/;
+
+ /*******************************************************************************
+ * Function sprintf(format_string,arguments...) Javascript emulation of the C
+ * printf function (modifiers and argument types "p" and "n" are not supported
+ * due to language restrictions)
+ *
+ * Copyright 2003 K&L Productions. All rights reserved
+ * http://www.klproductions.com
+ *
+ * Terms of use: This function can be used free of charge IF this header is not
+ * modified and remains with the function code.
+ *
+ * Legal: Use this code at your own risk. K&L Productions assumes NO
+ * resposibility for anything.
+ ******************************************************************************/
+ me.sprintf = function(fstring){
+ var pad = function(str, ch, len){
+ var ps = '';
+ for (var i = 0; i < Math.abs(len); i++)
+ ps += ch;
+ return len > 0 ? str + ps : ps + str;
+ }
+ var processFlags = function(flags, width, rs, arg){
+ var pn = function(flags, arg, rs){
+ if (arg >= 0) {
+ if (flags.indexOf(' ') >= 0)
+ rs = ' ' + rs;
+ else if (flags.indexOf('+') >= 0)
+ rs = '+' + rs;
+ } else
+ rs = '-' + rs;
+ return rs;
+ }
+ var iWidth = parseInt(width, 10);
+ if (width.charAt(0) == '0') {
+ var ec = 0;
+ if (flags.indexOf(' ') >= 0 || flags.indexOf('+') >= 0)
+ ec++;
+ if (rs.length < (iWidth - ec))
+ rs = pad(rs, '0', rs.length - (iWidth - ec));
+ return pn(flags, arg, rs);
+ }
+ rs = pn(flags, arg, rs);
+ if (rs.length < iWidth) {
+ if (flags.indexOf('-') < 0)
+ rs = pad(rs, ' ', rs.length - iWidth);
+ else
+ rs = pad(rs, ' ', iWidth - rs.length);
+ }
+ return rs;
+ }
+ var converters = new Array();
+ converters['c'] = function(flags, width, precision, arg){
+ if (typeof(arg) == 'number')
+ return String.fromCharCode(arg);
+ if (typeof(arg) == 'string')
+ return arg.charAt(0);
+ return '';
+ }
+ converters['d'] = function(flags, width, precision, arg){
+ return converters['i'](flags, width, precision, arg);
+ }
+ converters['u'] = function(flags, width, precision, arg){
+ return converters['i'](flags, width, precision, Math.abs(arg));
+ }
+ converters['i'] = function(flags, width, precision, arg){
+ var iPrecision = parseInt(precision);
+ var rs = ((Math.abs(arg)).toString().split('.'))[0];
+ if (rs.length < iPrecision)
+ rs = pad(rs, ' ', iPrecision - rs.length);
+ return processFlags(flags, width, rs, arg);
+ }
+ converters['E'] = function(flags, width, precision, arg){
+ return (converters['e'](flags, width, precision, arg)).toUpperCase();
+ }
+ converters['e'] = function(flags, width, precision, arg){
+ iPrecision = parseInt(precision);
+ if (isNaN(iPrecision))
+ iPrecision = 6;
+ rs = (Math.abs(arg)).toExponential(iPrecision);
+ if (rs.indexOf('.') < 0 && flags.indexOf('#') >= 0)
+ rs = rs.replace(/^(.*)(e.*)$/, '$1.$2');
+ return processFlags(flags, width, rs, arg);
+ }
+ converters['f'] = function(flags, width, precision, arg){
+ iPrecision = parseInt(precision);
+ if (isNaN(iPrecision))
+ iPrecision = 6;
+ rs = (Math.abs(arg)).toFixed(iPrecision);
+ if (rs.indexOf('.') < 0 && flags.indexOf('#') >= 0)
+ rs = rs + '.';
+ return processFlags(flags, width, rs, arg);
+ }
+ converters['G'] = function(flags, width, precision, arg){
+ return (converters['g'](flags, width, precision, arg)).toUpperCase();
+ }
+ converters['g'] = function(flags, width, precision, arg){
+ iPrecision = parseInt(precision);
+ absArg = Math.abs(arg);
+ rse = absArg.toExponential();
+ rsf = absArg.toFixed(6);
+ if (!isNaN(iPrecision)) {
+ rsep = absArg.toExponential(iPrecision);
+ rse = rsep.length < rse.length ? rsep : rse;
+ rsfp = absArg.toFixed(iPrecision);
+ rsf = rsfp.length < rsf.length ? rsfp : rsf;
+ }
+ if (rse.indexOf('.') < 0 && flags.indexOf('#') >= 0)
+ rse = rse.replace(/^(.*)(e.*)$/, '$1.$2');
+ if (rsf.indexOf('.') < 0 && flags.indexOf('#') >= 0)
+ rsf = rsf + '.';
+ rs = rse.length < rsf.length ? rse : rsf;
+ return processFlags(flags, width, rs, arg);
+ }
+ converters['o'] = function(flags, width, precision, arg){
+ var iPrecision = parseInt(precision);
+ var rs = Math.round(Math.abs(arg)).toString(8);
+ if (rs.length < iPrecision)
+ rs = pad(rs, ' ', iPrecision - rs.length);
+ if (flags.indexOf('#') >= 0)
+ rs = '0' + rs;
+ return processFlags(flags, width, rs, arg);
+ }
+ converters['X'] = function(flags, width, precision, arg){
+ return (converters['x'](flags, width, precision, arg)).toUpperCase();
+ }
+ converters['x'] = function(flags, width, precision, arg){
+ var iPrecision = parseInt(precision);
+ arg = Math.abs(arg);
+ var rs = Math.round(arg).toString(16);
+ if (rs.length < iPrecision)
+ rs = pad(rs, ' ', iPrecision - rs.length);
+ if (flags.indexOf('#') >= 0)
+ rs = '0x' + rs;
+ return processFlags(flags, width, rs, arg);
+ }
+ converters['s'] = function(flags, width, precision, arg){
+ var iPrecision = parseInt(precision);
+ var rs = arg;
+ if (rs.length > iPrecision)
+ rs = rs.substring(0, iPrecision);
+ return processFlags(flags, width, rs, 0);
+ }
+ farr = fstring.split('%');
+ retstr = farr[0];
+ fpRE = /^([-+ #]*)(\d*)\.?(\d*)([cdieEfFgGosuxX])(.*)$/;
+ for (var i = 1; i < farr.length; i++) {
+ fps = fpRE.exec(farr[i]);
+ if (!fps)
+ continue;
+ if (arguments[i] != null)
+ retstr += converters[fps[4]](fps[1], fps[2], fps[3], arguments[i]);
+ retstr += fps[5];
+ }
+ return retstr;
+ }
+
+ /**
+ * Take out the first comment inside a block of HTML
+ *
+ * @param {String} s - an HTML block
+ * @return {String} s - the HTML block uncommented.
+ */
+ me.uncommentHTML = function(s){
+ if (s.indexOf('-->') != -1 && s.indexOf('<!--') != -1) {
+ return s.replace("<!--", "").replace("-->", "");
+ } else {
+ return s;
+ }
+ }
+}
+}
+
+if (!window.XMLHelpers) {
+
+XMLHelpers = new function(){
+
+ var me = this;
+
+ /**
+ * Wrapper for XMLHttpRequest Object. Grabbing data (XML and/or text) from a URL.
+ * Grabbing data from a URL. Input is one parameter, url. It returns a request
+ * object. Based on code from
+ * http://www.xml.com/pub/a/2005/02/09/xml-http-request.html. IE caching problem
+ * fix from Wikipedia article http://en.wikipedia.org/wiki/XMLHttpRequest
+ *
+ * @param {String} url - the URL to retrieve
+ * @param {Function} processReqChange - the function/method to call at key events of the URL retrieval.
+ * @param {String} method - (optional) "GET" or "POST" (default "GET")
+ * @param {String} data - (optional) the CGI data to pass. Default null.
+ * @param {boolean} isAsync - (optional) is this call asyncronous. Default true.
+ *
+ * @return {Object} a XML request object.
+ */
+ me.getXMLHttpRequest = function(url, processReqChange) //, method, data, isAsync)
+ {
+ var argv = me.getXMLHttpRequest.arguments;
+ var argc = me.getXMLHttpRequest.arguments.length;
+ var httpMethod = (argc > 2) ? argv[2] : 'GET';
+ var data = (argc > 3) ? argv[3] : "";
+ var isAsync = (argc > 4) ? argv[4] : true;
+
+ var req;
+ // branch for native XMLHttpRequest object
+ if (window.XMLHttpRequest) {
+ req = new XMLHttpRequest();
+ // branch for IE/Windows ActiveX version
+ } else if (window.ActiveXObject) {
+ try {
+ req = new ActiveXObject('Msxml2.XMLHTTP');
+ }
+ catch (ex) {
+ req = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ // the browser doesn't support XML HttpRequest. Return null;
+ } else {
+ return null;
+ }
+
+ if (isAsync) {
+ req.onreadystatechange = processReqChange;
+ }
+
+ if (httpMethod == "GET" && data != "") {
+ url += "?" + data;
+ }
+