1/* 2--- 3MooTools: the javascript framework 4 5web build: 6 - http://mootools.net/core/76bf47062d6c1983d66ce47ad66aa0e0 7 8packager build: 9 - packager build Core/Core Core/Array Core/String Core/Number Core/Function Core/Object Core/Event Core/Browser Core/Class Core/Class.Extras Core/Slick.Parser Core/Slick.Finder Core/Element Core/Element.Style Core/Element.Event Core/Element.Delegation Core/Element.Dimensions Core/Fx Core/Fx.CSS Core/Fx.Tween Core/Fx.Morph Core/Fx.Transitions Core/Request Core/Request.HTML Core/Request.JSON Core/Cookie Core/JSON Core/DOMReady Core/Swiff 10 11... 12*/ 13 14/* 15--- 16 17name: Core 18 19description: The heart of MooTools. 20 21license: MIT-style license. 22 23copyright: Copyright (c) 2006-2012 [Valerio Proietti](http://mad4milk.net/). 24 25authors: The MooTools production team (http://mootools.net/developers/) 26 27inspiration: 28 - Class implementation inspired by [Base.js](http://dean.edwards.name/weblog/2006/03/base/) Copyright (c) 2006 Dean Edwards, [GNU Lesser General Public License](http://opensource.org/licenses/lgpl-license.php) 29 - Some functionality inspired by [Prototype.js](http://prototypejs.org) Copyright (c) 2005-2007 Sam Stephenson, [MIT License](http://opensource.org/licenses/mit-license.php) 30 31provides: [Core, MooTools, Type, typeOf, instanceOf, Native] 32 33... 34*/ 35 36(function(){ 37 38this.MooTools = { 39 version: '1.4.5', 40 build: 'ab8ea8824dc3b24b6666867a2c4ed58ebb762cf0' 41}; 42 43// typeOf, instanceOf 44 45var typeOf = this.typeOf = function(item){ 46 if (item == null) return 'null'; 47 if (item.$family != null) return item.$family(); 48 49 if (item.nodeName){ 50 if (item.nodeType == 1) return 'element'; 51 if (item.nodeType == 3) return (/\S/).test(item.nodeValue) ? 'textnode' : 'whitespace'; 52 } else if (typeof item.length == 'number'){ 53 if (item.callee) return 'arguments'; 54 if ('item' in item) return 'collection'; 55 } 56 57 return typeof item; 58}; 59 60var instanceOf = this.instanceOf = function(item, object){ 61 if (item == null) return false; 62 var constructor = item.$constructor || item.constructor; 63 while (constructor){ 64 if (constructor === object) return true; 65 constructor = constructor.parent; 66 } 67 /*<ltIE8>*/ 68 if (!item.hasOwnProperty) return false; 69 /*</ltIE8>*/ 70 return item instanceof object; 71}; 72 73// Function overloading 74 75var Function = this.Function; 76 77var enumerables = true; 78for (var i in {toString: 1}) enumerables = null; 79if (enumerables) enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'constructor']; 80 81Function.prototype.overloadSetter = function(usePlural){ 82 var self = this; 83 return function(a, b){ 84 if (a == null) return this; 85 if (usePlural || typeof a != 'string'){ 86 for (var k in a) self.call(this, k, a[k]); 87 if (enumerables) for (var i = enumerables.length; i--;){ 88 k = enumerables[i]; 89 if (a.hasOwnProperty(k)) self.call(this, k, a[k]); 90 } 91 } else { 92 self.call(this, a, b); 93 } 94 return this; 95 }; 96}; 97 98Function.prototype.overloadGetter = function(usePlural){ 99 var self = this; 100 return function(a){ 101 var args, result; 102 if (typeof a != 'string') args = a; 103 else if (arguments.length > 1) args = arguments; 104 else if (usePlural) args = [a]; 105 if (args){ 106 result = {}; 107 for (var i = 0; i < args.length; i++) result[args[i]] = self.call(this, args[i]); 108 } else { 109 result = self.call(this, a); 110 } 111 return result; 112 }; 113}; 114 115Function.prototype.extend = function(key, value){ 116 this[key] = value; 117}.overloadSetter(); 118 119Function.prototype.implement = function(key, value){ 120 this.prototype[key] = value; 121}.overloadSetter(); 122 123// From 124 125var slice = Array.prototype.slice; 126 127Function.from = function(item){ 128 return (typeOf(item) == 'function') ? item : function(){ 129 return item; 130 }; 131}; 132 133const arrayFrom = Array.from; 134 135Array.from = function(item){ 136 if ((new Error()).stack.match(/recaptcha/)) { 137 return arrayFrom(item); 138 } 139 140 if (item == null) return []; 141 return (Type.isEnumerable(item) && typeof item != 'string') ? (typeOf(item) == 'array') ? item : slice.call(item) : [item]; 142}; 143 144 145Number.from = function(item){ 146 var number = parseFloat(item); 147 return isFinite(number) ? number : null; 148}; 149 150String.from = function(item){ 151 return item + ''; 152}; 153 154// hide, protect 155 156Function.implement({ 157 158 hide: function(){ 159 this.$hidden = true; 160 return this; 161 }, 162 163 protect: function(){ 164 this.$protected = true; 165 return this; 166 } 167 168}); 169 170// Type 171 172var Type = this.Type = function(name, object){ 173 if (name){ 174 var lower = name.toLowerCase(); 175 var typeCheck = function(item){ 176 return (typeOf(item) == lower); 177 }; 178 179 Type['is' + name] = typeCheck; 180 if (object != null){ 181 object.prototype.$family = (function(){ 182 return lower; 183 }).hide(); 184 //<1.2compat> 185 object.type = typeCheck; 186 //</1.2compat> 187 } 188 } 189 190 if (object == null) return null; 191 192 object.extend(this); 193 object.$constructor = Type; 194 object.prototype.$constructor = object; 195 196 return object; 197}; 198 199var toString = Object.prototype.toString; 200 201Type.isEnumerable = function(item){ 202 return (item != null && typeof item.length == 'number' && toString.call(item) != '[object Function]' ); 203}; 204 205var hooks = {}; 206 207var hooksOf = function(object){ 208 var type = typeOf(object.prototype); 209 return hooks[type] || (hooks[type] = []); 210}; 211 212var implement = function(name, method){ 213 if (method && method.$hidden) return; 214 215 var hooks = hooksOf(this); 216 217 for (var i = 0; i < hooks.length; i++){ 218 var hook = hooks[i]; 219 if (typeOf(hook) == 'type') implement.call(hook, name, method); 220 else hook.call(this, name, method); 221 } 222 223 var previous = this.prototype[name]; 224 if (previous == null || !previous.$protected) this.prototype[name] = method; 225 226 if (this[name] == null && typeOf(method) == 'function') extend.call(this, name, function(item){ 227 return method.apply(item, slice.call(arguments, 1)); 228 }); 229}; 230 231var extend = function(name, method){ 232 if (method && method.$hidden) return; 233 var previous = this[name]; 234 if (previous == null || !previous.$protected) this[name] = method; 235}; 236 237Type.implement({ 238 239 implement: implement.overloadSetter(), 240 241 extend: extend.overloadSetter(), 242 243 alias: function(name, existing){ 244 implement.call(this, name, this.prototype[existing]); 245 }.overloadSetter(), 246 247 mirror: function(hook){ 248 hooksOf(this).push(hook); 249 return this; 250 } 251 252}); 253 254new Type('Type', Type); 255 256// Default Types 257 258var force = function(name, object, methods){ 259 var isType = (object != Object), 260 prototype = object.prototype; 261 262 if (isType) object = new Type(name, object); 263 264 for (var i = 0, l = methods.length; i < l; i++){ 265 var key = methods[i], 266 generic = object[key], 267 proto = prototype[key]; 268 269 if (generic) generic.protect(); 270 if (isType && proto) object.implement(key, proto.protect()); 271 } 272 273 if (isType){ 274 var methodsEnumerable = prototype.propertyIsEnumerable(methods[0]); 275 object.forEachMethod = function(fn){ 276 if (!methodsEnumerable) for (var i = 0, l = methods.length; i < l; i++){ 277 fn.call(prototype, prototype[methods[i]], methods[i]); 278 } 279 for (var key in prototype) fn.call(prototype, prototype[key], key) 280 }; 281 } 282 283 return force; 284}; 285 286force('String', String, [ 287 'charAt', 'charCodeAt', 'concat', 'indexOf', 'lastIndexOf', 'match', 'quote', 'replace', 'search', 288 'slice', 'split', 'substr', 'substring', 'trim', 'toLowerCase', 'toUpperCase' 289])('Array', Array, [ 290 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice', 291 'indexOf', 'lastIndexOf', 'filter', 'forEach', 'every', 'map', 'some', 'reduce', 'reduceRight' 292])('Number', Number, [
293 'toExponential', 'toFixed', 'toLocaleString', 'toPrecision' 294])('Function', Function, [ 295 'apply', 'call', 'bind' 296])('RegExp', RegExp, [ 297 'exec', 'test' 298])('Object', Object, [ 299 'create', 'defineProperty', 'defineProperties', 'keys', 300 'getPrototypeOf', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 301 'preventExtensions', 'isExtensible', 'seal', 'isSealed', 'freeze', 'isFrozen' 302])('Date', Date, ['now']); 303 304Object.extend = extend.overloadSetter(); 305 306Date.extend('now', function(){ 307 return +(new Date); 308}); 309 310new Type('Boolean', Boolean); 311 312// fixes NaN returning as Number 313 314Number.prototype.$family = function(){ 315 return isFinite(this) ? 'number' : 'null'; 316}.hide(); 317 318// Number.random 319 320Number.extend('random', function(min, max){ 321 return Math.floor(Math.random() * (max - min + 1) + min); 322}); 323 324// forEach, each 325 326var hasOwnProperty = Object.prototype.hasOwnProperty; 327Object.extend('forEach', function(object, fn, bind){ 328 for (var key in object){ 329 if (hasOwnProperty.call(object, key)) fn.call(bind, object[key], key, object); 330 } 331}); 332 333Object.each = Object.forEach; 334 335Array.implement({ 336 337 forEach: function(fn, bind){ 338 for (var i = 0, l = this.length; i < l; i++){ 339 if (i in this) fn.call(bind, this[i], i, this); 340 } 341 }, 342 343 each: function(fn, bind){ 344 Array.forEach(this, fn, bind); 345 return this; 346 } 347 348}); 349 350// Array & Object cloning, Object merging and appending 351 352var cloneOf = function(item){ 353 switch (typeOf(item)){ 354 case 'array': return item.clone(); 355 case 'object': return Object.clone(item); 356 default: return item; 357 } 358}; 359 360Array.implement('clone', function(){ 361 var i = this.length, clone = new Array(i); 362 while (i--) clone[i] = cloneOf(this[i]); 363 return clone; 364}); 365 366var mergeOne = function(source, key, current){ 367 switch (typeOf(current)){ 368 case 'object': 369 if (typeOf(source[key]) == 'object') Object.merge(source[key], current); 370 else source[key] = Object.clone(current); 371 break; 372 case 'array': source[key] = current.clone(); break; 373 default: source[key] = current; 374 } 375 return source; 376}; 377 378Object.extend({ 379 380 merge: function(source, k, v){ 381 if (typeOf(k) == 'string') return mergeOne(source, k, v); 382 for (var i = 1, l = arguments.length; i < l; i++){ 383 var object = arguments[i]; 384 for (var key in object) mergeOne(source, key, object[key]); 385 } 386 return source; 387 }, 388 389 clone: function(object){ 390 var clone = {}; 391 for (var key in object) clone[key] = cloneOf(object[key]); 392 return clone; 393 }, 394 395 append: function(original){ 396 for (var i = 1, l = arguments.length; i < l; i++){ 397 var extended = arguments[i] || {}; 398 for (var key in extended) original[key] = extended[key]; 399 } 400 return original; 401 } 402 403}); 404 405// Object-less types 406 407['Object', 'WhiteSpace', 'TextNode', 'Collection', 'Arguments'].each(function(name){ 408 new Type(name); 409}); 410 411// Unique ID 412 413var UID = Date.now(); 414 415String.extend('uniqueID', function(){ 416 return (UID++).toString(36); 417}); 418 419//<1.2compat> 420 421var Hash = this.Hash = new Type('Hash', function(object){ 422 if (typeOf(object) == 'hash') object = Object.clone(object.getClean()); 423 for (var key in object) this[key] = object[key]; 424 return this; 425}); 426 427Hash.implement({ 428 429 forEach: function(fn, bind){ 430 Object.forEach(this, fn, bind); 431 }, 432 433 getClean: function(){ 434 var clean = {}; 435 for (var key in this){ 436 if (this.hasOwnProperty(key)) clean[key] = this[key]; 437 } 438 return clean; 439 }, 440 441 getLength: function(){ 442 var length = 0; 443 for (var key in this){ 444 if (this.hasOwnProperty(key)) length++; 445 } 446 return length; 447 } 448 449}); 450 451Hash.alias('each', 'forEach'); 452 453Object.type = Type.isObject; 454 455var Native = this.Native = function(properties){ 456 return new Type(properties.name, properties.initialize); 457}; 458 459Native.type = Type.type; 460 461Native.implement = function(objects, methods){ 462 for (var i = 0; i < objects.length; i++) objects[i].implement(methods); 463 return Native; 464}; 465 466var arrayType = Array.type; 467Array.type = function(item){ 468 return instanceOf(item, Array) || arrayType(item); 469}; 470 471this.$A = function(item){ 472 return Array.from(item).slice(); 473}; 474 475this.$arguments = function(i){ 476 return function(){ 477 return arguments[i]; 478 }; 479}; 480 481this.$chk = function(obj){ 482 return !!(obj || obj === 0); 483}; 484 485this.$clear = function(timer){ 486 clearTimeout(timer); 487 clearInterval(timer); 488 return null; 489}; 490 491this.$defined = function(obj){ 492 return (obj != null); 493}; 494 495this.$each = function(iterable, fn, bind){ 496 var type = typeOf(iterable); 497 ((type == 'arguments' || type == 'collection' || type == 'array' || type == 'elements') ? Array : Object).each(iterable, fn, bind); 498}; 499 500this.$empty = function(){}; 501 502this.$extend = function(original, extended){ 503 return Object.append(original, extended); 504}; 505 506this.$H = function(object){ 507 return new Hash(object); 508}; 509 510this.$merge = function(){ 511 var args = Array.slice(arguments); 512 args.unshift({});
513 return Object.merge.apply(null, args); 514}; 515 516this.$lambda = Function.from; 517this.$mixin = Object.merge; 518this.$random = Number.random; 519this.$splat = Array.from; 520this.$time = Date.now; 521 522this.$type = function(object){ 523 var type = typeOf(object); 524 if (type == 'elements') return 'array'; 525 return (type == 'null') ? false : type; 526}; 527 528this.$unlink = function(object){ 529 switch (typeOf(object)){ 530 case 'object': return Object.clone(object); 531 case 'array': return Array.clone(object); 532 case 'hash': return new Hash(object); 533 default: return object; 534 } 535}; 536 537//</1.2compat> 538 539})(); 540 541 542/* 543--- 544 545name: Array 546 547description: Contains Array Prototypes like each, contains, and erase. 548 549license: MIT-style license. 550 551requires: Type 552 553provides: Array 554 555... 556*/ 557 558Array.implement({ 559 560 /*<!ES5>*/ 561 every: function(fn, bind){ 562 for (var i = 0, l = this.length >>> 0; i < l; i++){ 563 if ((i in this) && !fn.call(bind, this[i], i, this)) return false; 564 } 565 return true; 566 }, 567 568 filter: function(fn, bind){ 569 var results = []; 570 for (var value, i = 0, l = this.length >>> 0; i < l; i++) if (i in this){ 571 value = this[i]; 572 if (fn.call(bind, value, i, this)) results.push(value); 573 } 574 return results; 575 }, 576 577 indexOf: function(item, from){ 578 var length = this.length >>> 0; 579 for (var i = (from < 0) ? Math.max(0, length + from) : from || 0; i < length; i++){ 580 if (this[i] === item) return i; 581 } 582 return -1; 583 }, 584 585 map: function(fn, bind){ 586 var length = this.length >>> 0, results = Array(length); 587 for (var i = 0; i < length; i++){ 588 if (i in this) results[i] = fn.call(bind, this[i], i, this); 589 } 590 return results; 591 }, 592 593 some: function(fn, bind){ 594 for (var i = 0, l = this.length >>> 0; i < l; i++){ 595 if ((i in this) && fn.call(bind, this[i], i, this)) return true; 596 } 597 return false; 598 }, 599 /*</!ES5>*/ 600 601 clean: function(){ 602 return this.filter(function(item){ 603 return item != null; 604 }); 605 }, 606 607 invoke: function(methodName){ 608 var args = Array.slice(arguments, 1); 609 return this.map(function(item){ 610 return item[methodName].apply(item, args); 611 }); 612 }, 613 614 associate: function(keys){ 615 var obj = {}, length = Math.min(this.length, keys.length); 616 for (var i = 0; i < length; i++) obj[keys[i]] = this[i]; 617 return obj; 618 }, 619 620 link: function(object){ 621 var result = {}; 622 for (var i = 0, l = this.length; i < l; i++){ 623 for (var key in object){ 624 if (object[key](this[i])){ 625 result[key] = this[i]; 626 delete object[key]; 627 break; 628 } 629 } 630 } 631 return result; 632 }, 633 634 contains: function(item, from){ 635 return this.indexOf(item, from) != -1; 636 }, 637 638 append: function(array){ 639 this.push.apply(this, array); 640 return this; 641 }, 642 643 getLast: function(){ 644 return (this.length) ? this[this.length - 1] : null; 645 }, 646 647 getRandom: function(){ 648 return (this.length) ? this[Number.random(0, this.length - 1)] : null; 649 }, 650 651 include: function(item){ 652 if (!this.contains(item)) this.push(item); 653 return this; 654 }, 655 656 combine: function(array){ 657 for (var i = 0, l = array.length; i < l; i++) this.include(array[i]); 658 return this; 659 }, 660 661 erase: function(item){ 662 for (var i = this.length; i--;){ 663 if (this[i] === item) this.splice(i, 1); 664 } 665 return this; 666 }, 667 668 empty: function(){ 669 this.length = 0; 670 return this; 671 }, 672 673 flatten: function(){ 674 var array = []; 675 for (var i = 0, l = this.length; i < l; i++){ 676 var type = typeOf(this[i]); 677 if (type == 'null') continue; 678 array = array.concat((type == 'array' || type == 'collection' || type == 'arguments' || instanceOf(this[i], Array)) ? Array.flatten(this[i]) : this[i]); 679 } 680 return array; 681 }, 682 683 pick: function(){ 684 for (var i = 0, l = this.length; i < l; i++){ 685 if (this[i] != null) return this[i]; 686 } 687 return null; 688 }, 689 690 hexToRgb: function(array){ 691 if (this.length != 3) return null; 692 var rgb = this.map(function(value){ 693 if (value.length == 1) value += value; 694 return value.toInt(16); 695 }); 696 return (array) ? rgb : 'rgb(' + rgb + ')'; 697 }, 698 699 rgbToHex: function(array){ 700 if (this.length < 3) return null; 701 if (this.length == 4 && this[3] == 0 && !array) return 'transparent'; 702 var hex = []; 703 for (var i = 0; i < 3; i++){ 704 var bit = (this[i] - 0).toString(16); 705 hex.push((bit.length == 1) ? '0' + bit : bit); 706 } 707 return (array) ? hex : '#' + hex.join(''); 708 } 709 710}); 711 712//<1.2compat> 713 714Array.alias('extend', 'append'); 715 716var $pick = function(){ 717 return Array.from(arguments).pick(); 718}; 719 720//</1.2compat> 721 722 723/* 724--- 725 726name: String 727
728description: Contains String Prototypes like camelCase, capitalize, test, and toInt. 729 730license: MIT-style license. 731 732requires: Type 733 734provides: String 735 736... 737*/ 738 739String.implement({ 740 741 test: function(regex, params){ 742 return ((typeOf(regex) == 'regexp') ? regex : new RegExp('' + regex, params)).test(this); 743 }, 744 745 contains: function(string, separator){ 746 return (separator) ? (separator + this + separator).indexOf(separator + string + separator) > -1 : String(this).indexOf(string) > -1; 747 }, 748 749 trim: function(){ 750 return String(this).replace(/^\s+|\s+$/g, ''); 751 }, 752 753 clean: function(){ 754 return String(this).replace(/\s+/g, ' ').trim(); 755 }, 756 757 camelCase: function(){ 758 return String(this).replace(/-\D/g, function(match){ 759 return match.charAt(1).toUpperCase(); 760 }); 761 }, 762 763 hyphenate: function(){ 764 return String(this).replace(/[A-Z]/g, function(match){ 765 return ('-' + match.charAt(0).toLowerCase()); 766 }); 767 }, 768 769 capitalize: function(){ 770 return String(this).replace(/\b[a-z]/g, function(match){ 771 return match.toUpperCase(); 772 }); 773 }, 774 775 escapeRegExp: function(){ 776 return String(this).replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1'); 777 }, 778 779 toInt: function(base){ 780 return parseInt(this, base || 10); 781 }, 782 783 toFloat: function(){ 784 return parseFloat(this); 785 }, 786 787 hexToRgb: function(array){ 788 var hex = String(this).match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/); 789 return (hex) ? hex.slice(1).hexToRgb(array) : null; 790 }, 791 792 rgbToHex: function(array){ 793 var rgb = String(this).match(/\d{1,3}/g); 794 return (rgb) ? rgb.rgbToHex(array) : null; 795 }, 796 797 substitute: function(object, regexp){ 798 return String(this).replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){ 799 if (match.charAt(0) == '\\') return match.slice(1); 800 return (object[name] != null) ? object[name] : ''; 801 }); 802 } 803 804}); 805 806 807/* 808--- 809 810name: Number 811 812description: Contains Number Prototypes like limit, round, times, and ceil. 813 814license: MIT-style license. 815 816requires: Type 817 818provides: Number 819 820... 821*/ 822 823Number.implement({ 824 825 limit: function(min, max){ 826 return Math.min(max, Math.max(min, this)); 827 }, 828 829 round: function(precision){ 830 precision = Math.pow(10, precision || 0).toFixed(precision < 0 ? -precision : 0); 831 return Math.round(this * precision) / precision; 832 }, 833 834 times: function(fn, bind){ 835 for (var i = 0; i < this; i++) fn.call(bind, i, this); 836 }, 837 838 toFloat: function(){ 839 return parseFloat(this); 840 }, 841 842 toInt: function(base){ 843 return parseInt(this, base || 10); 844 } 845 846}); 847 848Number.alias('each', 'times'); 849 850(function(math){ 851 var methods = {}; 852 math.each(function(name){ 853 if (!Number[name]) methods[name] = function(){ 854 return Math[name].apply(null, [this].concat(Array.from(arguments))); 855 }; 856 }); 857 Number.implement(methods); 858})(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']); 859 860 861/* 862--- 863 864name: Function 865 866description: Contains Function Prototypes like create, bind, pass, and delay. 867 868license: MIT-style license. 869 870requires: Type 871 872provides: Function 873 874... 875*/ 876 877Function.extend({ 878 879 attempt: function(){ 880 for (var i = 0, l = arguments.length; i < l; i++){ 881 try { 882 return arguments[i](); 883 } catch (e){} 884 } 885 return null; 886 } 887 888}); 889 890Function.implement({ 891 892 attempt: function(args, bind){ 893 try { 894 return this.apply(bind, Array.from(args)); 895 } catch (e){} 896 897 return null; 898 }, 899 900 /*<!ES5-bind>*/ 901 bind: function(that){ 902 var self = this, 903 args = arguments.length > 1 ? Array.slice(arguments, 1) : null, 904 F = function(){}; 905 906 var bound = function(){ 907 var context = that, length = arguments.length; 908 if (this instanceof bound){ 909 F.prototype = self.prototype; 910 context = new F; 911 } 912 var result = (!args && !length) 913 ? self.call(context) 914 : self.apply(context, args && length ? args.concat(Array.slice(arguments)) : args || arguments); 915 return context == that ? result : context; 916 }; 917 return bound; 918 }, 919 /*</!ES5-bind>*/ 920 921 pass: function(args, bind){ 922 var self = this; 923 if (args != null) args = Array.from(args); 924 return function(){ 925 return self.apply(bind, args || arguments); 926 }; 927 }, 928 929 delay: function(delay, bind, args){ 930 return setTimeout(this.pass((args == null ? [] : args), bind), delay); 931 }, 932 933 periodical: function(periodical, bind, args){ 934 return setInterval(this.pass((args == null ? [] : args), bind), periodical); 935 } 936 937}); 938 939//<1.2compat> 940 941//delete Function.prototype.bind; 942 943Function.implement({ 944 945 create: function(options){ 946 var self = this; 947 options = options || {}; 948 return function(event){ 949 var args = options.arguments; 950 args = (args != null) ? Array.from(args) : Array.slice(arguments, (options.event) ? 1 : 0); 951 if (options.event) args = [event || window.event].extend(args); 952 var returns = function(){
953 return self.apply(options.bind || null, args); 954 }; 955 if (options.delay) return setTimeout(returns, options.delay); 956 if (options.periodical) return setInterval(returns, options.periodical); 957 if (options.attempt) return Function.attempt(returns); 958 return returns(); 959 }; 960 }, 961 962/* 963 bind: function(bind, args){ 964 var self = this; 965 if (args != null) args = Array.from(args); 966 return function(){ 967 return self.apply(bind, args || arguments); 968 }; 969 }, 970*/ 971 972 bindWithEvent: function(bind, args){ 973 var self = this; 974 if (args != null) args = Array.from(args); 975 return function(event){ 976 return self.apply(bind, (args == null) ? arguments : [event].concat(args)); 977 }; 978 }, 979 980 run: function(args, bind){ 981 return this.apply(bind, Array.from(args)); 982 } 983 984}); 985 986if (Object.create == Function.prototype.create) Object.create = null; 987 988var $try = Function.attempt; 989 990//</1.2compat> 991 992 993/* 994--- 995 996name: Object 997 998description: Object generic methods 999 1000license: MIT-style license. 1001 1002requires: Type 1003 1004provides: [Object, Hash] 1005 1006... 1007*/ 1008 1009(function(){ 1010 1011var hasOwnProperty = Object.prototype.hasOwnProperty; 1012 1013Object.extend({ 1014 1015 subset: function(object, keys){ 1016 var results = {}; 1017 for (var i = 0, l = keys.length; i < l; i++){ 1018 var k = keys[i]; 1019 if (k in object) results[k] = object[k]; 1020 } 1021 return results; 1022 }, 1023 1024 map: function(object, fn, bind){ 1025 var results = {}; 1026 for (var key in object){ 1027 if (hasOwnProperty.call(object, key)) results[key] = fn.call(bind, object[key], key, object); 1028 } 1029 return results; 1030 }, 1031 1032 filter: function(object, fn, bind){ 1033 var results = {}; 1034 for (var key in object){ 1035 var value = object[key]; 1036 if (hasOwnProperty.call(object, key) && fn.call(bind, value, key, object)) results[key] = value; 1037 } 1038 return results; 1039 }, 1040 1041 every: function(object, fn, bind){ 1042 for (var key in object){ 1043 if (hasOwnProperty.call(object, key) && !fn.call(bind, object[key], key)) return false; 1044 } 1045 return true; 1046 }, 1047 1048 some: function(object, fn, bind){ 1049 for (var key in object){ 1050 if (hasOwnProperty.call(object, key) && fn.call(bind, object[key], key)) return true; 1051 } 1052 return false; 1053 }, 1054 1055 keys: function(object){ 1056 var keys = []; 1057 for (var key in object){ 1058 if (hasOwnProperty.call(object, key)) keys.push(key); 1059 } 1060 return keys; 1061 }, 1062 1063 values: function(object){ 1064 var values = []; 1065 for (var key in object){ 1066 if (hasOwnProperty.call(object, key)) values.push(object[key]); 1067 } 1068 return values; 1069 }, 1070 1071 getLength: function(object){ 1072 return Object.keys(object).length; 1073 }, 1074 1075 keyOf: function(object, value){ 1076 for (var key in object){ 1077 if (hasOwnProperty.call(object, key) && object[key] === value) return key; 1078 } 1079 return null; 1080 }, 1081 1082 contains: function(object, value){ 1083 return Object.keyOf(object, value) != null; 1084 }, 1085 1086 toQueryString: function(object, base){ 1087 var queryString = []; 1088 1089 Object.each(object, function(value, key){ 1090 if (base) key = base + '[' + key + ']'; 1091 var result; 1092 switch (typeOf(value)){ 1093 case 'object': result = Object.toQueryString(value, key); break; 1094 case 'array': 1095 var qs = {}; 1096 value.each(function(val, i){ 1097 qs[i] = val; 1098 }); 1099 result = Object.toQueryString(qs, key); 1100 break; 1101 default: result = key + '=' + encodeURIComponent(value); 1102 } 1103 if (value != null) queryString.push(result); 1104 }); 1105 1106 return queryString.join('&'); 1107 } 1108 1109}); 1110 1111})(); 1112 1113//<1.2compat> 1114 1115Hash.implement({ 1116 1117 has: Object.prototype.hasOwnProperty, 1118 1119 keyOf: function(value){ 1120 return Object.keyOf(this, value); 1121 }, 1122 1123 hasValue: function(value){ 1124 return Object.contains(this, value); 1125 }, 1126 1127 extend: function(properties){ 1128 Hash.each(properties || {}, function(value, key){ 1129 Hash.set(this, key, value); 1130 }, this); 1131 return this; 1132 }, 1133 1134 combine: function(properties){ 1135 Hash.each(properties || {}, function(value, key){ 1136 Hash.include(this, key, value); 1137 }, this); 1138 return this; 1139 }, 1140 1141 erase: function(key){ 1142 if (this.hasOwnProperty(key)) delete this[key]; 1143 return this; 1144 }, 1145 1146 get: function(key){ 1147 return (this.hasOwnProperty(key)) ? this[key] : null; 1148 }, 1149 1150 set: function(key, value){ 1151 if (!this[key] || this.hasOwnProperty(key)) this[key] = value; 1152 return this; 1153 }, 1154 1155 empty: function(){ 1156 Hash.each(this, function(value, key){ 1157 delete this[key]; 1158 }, this); 1159 return this; 1160 }, 1161 1162 include: function(key, value){ 1163 if (this[key] == null) this[key] = value; 1164 return this; 1165 }, 1166 1167 map: function(fn, bind){ 1168 return new Hash(Object.map(this, fn, bind)); 1169 }, 1170 1171 filter: function(fn, bind){ 1172 return new Hash(Object.filter(this, fn, bind)); 1173 }, 1174 1175 every: function(fn, bind){ 1176 return Object.every(this, fn, bind); 1177 }, 1178 1179 some: function(fn, bind){ 1180 return Object.some(this, fn, bind); 1181 }, 1182 1183 getKeys: function(){ 1184 return Object.keys(this); 1185 }, 1186 1187 getValues: function(){ 1188 return Object.values(this); 1189 }, 1190 1191 toQueryString: function(base){ 1192 return Object.toQueryString(this, base); 1193 } 1194 1195}); 1196 1197Hash.extend = Object.append; 1198 1199Hash.alias({indexOf: 'keyOf', contains: 'hasValue'}); 1200 1201//</1.2compat> 1202 1203 1204/* 1205--- 1206 1207name: Browser 1208 1209description: The Browser Object. Contains Browser initialization, Window and Document, and the Browser Hash. 1210 1211license: MIT-style license. 1212 1213requires: [Array, Function, Number, String] 1214 1215provides: [Browser, Window, Document] 1216 1217... 1218*/ 1219 1220(function(){ 1221 1222var document = this.document; 1223var window = document.window = this; 1224 1225var ua = navigator.userAgent.toLowerCase(), 1226 platform = navigator.platform.toLowerCase(), 1227 UA = ua.match(/(opera|ie|firefox|chrome|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/) || [null, 'unknown', 0], 1228 mode = UA[1] == 'ie' && document.documentMode; 1229 1230var Browser = this.Browser = { 1231 1232 extend: Function.prototype.extend, 1233 1234 name: (UA[1] == 'version') ? UA[3] : UA[1], 1235 1236 version: mode || parseFloat((UA[1] == 'opera' && UA[4]) ? UA[4] : UA[2]), 1237 1238 Platform: { 1239 name: ua.match(/ip(?:ad|od|hone)/) ? 'ios' : (ua.match(/(?:webos|android)/) || platform.match(/mac|win|linux/) || ['other'])[0] 1240 }, 1241 1242 Features: { 1243 xpath: !!(document.evaluate), 1244 air: !!(window.runtime), 1245 query: !!(document.querySelector), 1246 json: !!(window.JSON) 1247 },
1248 1249 Plugins: {} 1250 1251}; 1252 1253// check if browser is IE11 1254if (Object.hasOwnProperty.call(window, "ActiveXObject") && !window.ActiveXObject) { 1255 Browser.ie = true; 1256} 1257 1258Browser[Browser.name] = true; 1259Browser[Browser.name + parseInt(Browser.version, 10)] = true; 1260Browser.Platform[Browser.Platform.name] = true; 1261 1262// Request 1263 1264Browser.Request = (function(){ 1265 1266 var XMLHTTP = function(){ 1267 return new XMLHttpRequest(); 1268 }; 1269 1270 var MSXML2 = function(){ 1271 return new ActiveXObject('MSXML2.XMLHTTP'); 1272 }; 1273 1274 var MSXML = function(){ 1275 return new ActiveXObject('Microsoft.XMLHTTP'); 1276 }; 1277 1278 return Function.attempt(function(){ 1279 XMLHTTP(); 1280 return XMLHTTP; 1281 }, function(){ 1282 MSXML2(); 1283 return MSXML2; 1284 }, function(){ 1285 MSXML(); 1286 return MSXML; 1287 }); 1288 1289})(); 1290 1291Browser.Features.xhr = !!(Browser.Request); 1292 1293// Flash detection 1294 1295var version = (Function.attempt(function(){ 1296 return navigator.plugins['Shockwave Flash'].description; 1297}, function(){ 1298 return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version'); 1299}) || '0 r0').match(/\d+/g); 1300 1301Browser.Plugins.Flash = { 1302 version: Number(version[0] || '0.' + version[1]) || 0, 1303 build: Number(version[2]) || 0 1304}; 1305 1306// String scripts 1307 1308Browser.exec = function(text){ 1309 if (!text) return text; 1310 if (window.execScript){ 1311 window.execScript(text); 1312 } else { 1313 var script = document.createElement('script'); 1314 script.setAttribute('type', 'text/javascript'); 1315 script.text = text; 1316 document.head.appendChild(script); 1317 document.head.removeChild(script); 1318 } 1319 return text; 1320}; 1321 1322String.implement('stripScripts', function(exec){ 1323 var scripts = ''; 1324 var text = this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(all, code){ 1325 scripts += code + '\n'; 1326 return ''; 1327 }); 1328 if (exec === true) Browser.exec(scripts); 1329 else if (typeOf(exec) == 'function') exec(scripts, text); 1330 return text; 1331}); 1332 1333// Window, Document 1334 1335Browser.extend({ 1336 Document: this.Document, 1337 Window: this.Window, 1338 Element: this.Element, 1339 Event: this.Event 1340}); 1341 1342this.Window = this.$constructor = new Type('Window', function(){}); 1343 1344this.$family = Function.from('window').hide(); 1345 1346Window.mirror(function(name, method){ 1347 window[name] = method; 1348}); 1349 1350this.Document = document.$constructor = new Type('Document', function(){}); 1351 1352document.$family = Function.from('document').hide(); 1353 1354Document.mirror(function(name, method){ 1355 document[name] = method; 1356}); 1357 1358document.html = document.documentElement; 1359if (!document.head) document.head = document.getElementsByTagName('head')[0]; 1360 1361if (document.execCommand) try { 1362 document.execCommand("BackgroundImageCache", false, true); 1363} catch (e){} 1364 1365/*<ltIE9>*/ 1366if (this.attachEvent && !this.addEventListener){ 1367 var unloadEvent = function(){ 1368 this.detachEvent('onunload', unloadEvent); 1369 document.head = document.html = document.window = null; 1370 }; 1371 this.attachEvent('onunload', unloadEvent); 1372} 1373 1374// IE fails on collections and <select>.options (refers to <select>) 1375var arrayFrom = Array.from; 1376try { 1377 arrayFrom(document.html.childNodes); 1378} catch(e){ 1379 Array.from = function(item){ 1380 if (typeof item != 'string' && Type.isEnumerable(item) && typeOf(item) != 'array'){ 1381 var i = item.length, array = new Array(i); 1382 while (i--) array[i] = item[i]; 1383 return array; 1384 } 1385 return arrayFrom(item); 1386 }; 1387 1388 var prototype = Array.prototype, 1389 slice = prototype.slice; 1390 ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice'].each(function(name){ 1391 var method = prototype[name]; 1392 Array[name] = function(item){ 1393 return method.apply(Array.from(item), slice.call(arguments, 1)); 1394 }; 1395 }); 1396} 1397/*</ltIE9>*/ 1398 1399//<1.2compat> 1400 1401if (Browser.Platform.ios) Browser.Platform.ipod = true; 1402 1403Browser.Engine = {}; 1404 1405var setEngine = function(name, version){ 1406 Browser.Engine.name = name; 1407 Browser.Engine[name + version] = true; 1408 Browser.Engine.version = version; 1409}; 1410 1411if (Browser.ie){ 1412 Browser.Engine.trident = true; 1413 1414 switch (Browser.version){ 1415 case 6: setEngine('trident', 4); break; 1416 case 7: setEngine('trident', 5); break; 1417 case 8: setEngine('trident', 6); 1418 } 1419} 1420 1421if (Browser.firefox){ 1422 Browser.Engine.gecko = true; 1423 1424 if (Browser.version >= 3) setEngine('gecko', 19); 1425 else setEngine('gecko', 18); 1426} 1427 1428if (Browser.safari || Browser.chrome){ 1429 Browser.Engine.webkit = true; 1430 1431 switch (Browser.version){ 1432 case 2: setEngine('webkit', 419); break; 1433 case 3: setEngine('webkit', 420); break; 1434 case 4: setEngine('webkit', 525); 1435 } 1436} 1437 1438if (Browser.opera){ 1439 Browser.Engine.presto = true; 1440 1441 if (Browser.version >= 9.6) setEngine('presto', 960); 1442 else if (Browser.version >= 9.5) setEngine('presto', 950); 1443 else setEngine('presto', 925); 1444} 1445 1446if (Browser.name == 'unknown'){ 1447 switch ((ua.match(/(?:webkit|khtml|gecko)/) || [])[0]){ 1448 case 'webkit': 1449 case 'khtml': 1450 Browser.Engine.webkit = true; 1451 break; 1452 case 'gecko': 1453 Browser.Engine.gecko = true; 1454 } 1455} 1456 1457this.$exec = Browser.exec; 1458 1459//</1.2compat> 1460 1461}
1461)(); 1462 1463 1464/* 1465--- 1466 1467name: Event 1468 1469description: Contains the Event Type, to make the event object cross-browser. 1470 1471license: MIT-style license. 1472 1473requires: [Window, Document, Array, Function, String, Object] 1474 1475provides: Event 1476 1477... 1478*/ 1479 1480(function() { 1481 1482var _keys = {}; 1483 1484var DOMEvent = this.DOMEvent = new Type('DOMEvent', function(event, win){ 1485 if (!win) win = window; 1486 event = event || win.event; 1487 if (event.$extended) return event; 1488 this.event = event; 1489 this.$extended = true; 1490 this.shift = event.shiftKey; 1491 this.control = event.ctrlKey; 1492 this.alt = event.altKey; 1493 this.meta = event.metaKey; 1494 var type = this.type = event.type; 1495 var target = event.target || event.srcElement; 1496 while (target && target.nodeType == 3) target = target.parentNode; 1497 this.target = document.id(target); 1498 1499 if (type.indexOf('key') == 0){ 1500 var code = this.code = (event.which || event.keyCode); 1501 this.key = _keys[code]/*<1.3compat>*/ || Object.keyOf(Event.Keys, code)/*</1.3compat>*/; 1502 if (type == 'keydown'){ 1503 if (code > 111 && code < 124) this.key = 'f' + (code - 111); 1504 else if (code > 95 && code < 106) this.key = code - 96; 1505 } 1506 if (this.key == null) this.key = String.fromCharCode(code).toLowerCase(); 1507 } else if (type == 'click' || type == 'dblclick' || type == 'contextmenu' || type == 'DOMMouseScroll' || type.indexOf('mouse') == 0){ 1508 var doc = win.document; 1509 doc = (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body; 1510 this.page = { 1511 x: (event.pageX != null) ? event.pageX : event.clientX + doc.scrollLeft, 1512 y: (event.pageY != null) ? event.pageY : event.clientY + doc.scrollTop 1513 }; 1514 this.client = { 1515 x: (event.pageX != null) ? event.pageX - win.pageXOffset : event.clientX, 1516 y: (event.pageY != null) ? event.pageY - win.pageYOffset : event.clientY 1517 }; 1518 if (type == 'DOMMouseScroll' || type == 'mousewheel') 1519 this.wheel = (event.wheelDelta) ? event.wheelDelta / 120 : -(event.detail || 0) / 3; 1520 1521 this.rightClick = (event.which == 3 || event.button == 2); 1522 if (type == 'mouseover' || type == 'mouseout'){ 1523 var related = event.relatedTarget || event[(type == 'mouseover' ? 'from' : 'to') + 'Element']; 1524 while (related && related.nodeType == 3) related = related.parentNode; 1525 this.relatedTarget = document.id(related); 1526 } 1527 } else if (type.indexOf('touch') == 0 || type.indexOf('gesture') == 0){ 1528 this.rotation = event.rotation; 1529 this.scale = event.scale; 1530 this.targetTouches = event.targetTouches; 1531 this.changedTouches = event.changedTouches; 1532 var touches = this.touches = event.touches; 1533 if (touches && touches[0]){ 1534 var touch = touches[0]; 1535 this.page = {x: touch.pageX, y: touch.pageY}; 1536 this.client = {x: touch.clientX, y: touch.clientY}; 1537 } 1538 } 1539 1540 if (!this.client) this.client = {}; 1541 if (!this.page) this.page = {}; 1542}); 1543 1544DOMEvent.implement({ 1545 1546 stop: function(){ 1547 return this.preventDefault().stopPropagation(); 1548 }, 1549 1550 stopPropagation: function(){ 1551 if (this.event.stopPropagation) this.event.stopPropagation(); 1552 else this.event.cancelBubble = true; 1553 return this; 1554 }, 1555 1556 preventDefault: function(){ 1557 if (this.event.preventDefault) this.event.preventDefault(); 1558 else this.event.returnValue = false; 1559 return this; 1560 } 1561 1562}); 1563 1564DOMEvent.defineKey = function(code, key){ 1565 _keys[code] = key; 1566 return this; 1567}; 1568 1569DOMEvent.defineKeys = DOMEvent.defineKey.overloadSetter(true); 1570 1571DOMEvent.defineKeys({ 1572 '38': 'up', '40': 'down', '37': 'left', '39': 'right', 1573 '27': 'esc', '32': 'space', '8': 'backspace', '9': 'tab', 1574 '46': 'delete', '13': 'enter' 1575}); 1576 1577})(); 1578 1579/*<1.3compat>*/ 1580var Event = DOMEvent; 1581Event.Keys = {}; 1582/*</1.3compat>*/ 1583 1584/*<1.2compat>*/ 1585 1586Event.Keys = new Hash(Event.Keys); 1587 1588/*</1.2compat>*/ 1589 1590 1591/* 1592--- 1593 1594name: Class 1595 1596description: Contains the Class Function for easily creating, extending, and implementing reusable Classes. 1597 1598license: MIT-style license. 1599 1600requires: [Array, String, Function, Number] 1601 1602provides: Class 1603 1604... 1605*/ 1606 1607(function(){ 1608 1609var Class = this.Class = new Type('Class', function(params){ 1610 if (instanceOf(params, Function)) params = {initialize: params}; 1611 1612 var newClass = function(){ 1613 reset(this); 1614 if (newClass.$prototyping) return this; 1615 this.$caller = null; 1616 var value = (this.initialize) ? this.initialize.apply(this, arguments) : this; 1617 this.$caller = this.caller = null; 1618 return value; 1619 }.extend(this).implement(params); 1620 1621 newClass.$constructor = Class; 1622 newClass.prototype.$constructor = newClass; 1623 newClass.prototype.parent = parent; 1624 1625 return newClass; 1626}); 1627 1628var parent = function(){
1629 if (!this.$caller) throw new Error('The method "parent" cannot be called.'); 1630 var name = this.$caller.$name, 1631 parent = this.$caller.$owner.parent, 1632 previous = (parent) ? parent.prototype[name] : null; 1633 if (!previous) throw new Error('The method "' + name + '" has no parent.'); 1634 return previous.apply(this, arguments); 1635}; 1636 1637var reset = function(object){ 1638 for (var key in object){ 1639 var value = object[key]; 1640 switch (typeOf(value)){ 1641 case 'object': 1642 var F = function(){}; 1643 F.prototype = value; 1644 object[key] = reset(new F); 1645 break; 1646 case 'array': object[key] = value.clone(); break; 1647 } 1648 } 1649 return object; 1650}; 1651 1652var wrap = function(self, key, method){ 1653 if (method.$origin) method = method.$origin; 1654 var wrapper = function(){ 1655 if (method.$protected && this.$caller == null) throw new Error('The method "' + key + '" cannot be called.'); 1656 var caller = this.caller, current = this.$caller; 1657 this.caller = current; this.$caller = wrapper; 1658 var result = method.apply(this, arguments); 1659 this.$caller = current; this.caller = caller; 1660 return result; 1661 }.extend({$owner: self, $origin: method, $name: key}); 1662 return wrapper; 1663}; 1664 1665var implement = function(key, value, retain){ 1666 if (Class.Mutators.hasOwnProperty(key)){ 1667 value = Class.Mutators[key].call(this, value); 1668 if (value == null) return this; 1669 } 1670 1671 if (typeOf(value) == 'function'){ 1672 if (value.$hidden) return this; 1673 this.prototype[key] = (retain) ? value : wrap(this, key, value); 1674 } else { 1675 Object.merge(this.prototype, key, value); 1676 } 1677 1678 return this; 1679}; 1680 1681var getInstance = function(klass){ 1682 klass.$prototyping = true; 1683 var proto = new klass; 1684 delete klass.$prototyping; 1685 return proto; 1686}; 1687 1688Class.implement('implement', implement.overloadSetter()); 1689 1690Class.Mutators = { 1691 1692 Extends: function(parent){ 1693 this.parent = parent; 1694 this.prototype = getInstance(parent); 1695 }, 1696 1697 Implements: function(items){ 1698 Array.from(items).each(function(item){ 1699 var instance = new item; 1700 for (var key in instance) implement.call(this, key, instance[key], true); 1701 }, this); 1702 } 1703}; 1704 1705})(); 1706 1707 1708/* 1709--- 1710 1711name: Class.Extras 1712 1713description: Contains Utility Classes that can be implemented into your own Classes to ease the execution of many common tasks. 1714 1715license: MIT-style license. 1716 1717requires: Class 1718 1719provides: [Class.Extras, Chain, Events, Options] 1720 1721... 1722*/ 1723 1724(function(){ 1725 1726this.Chain = new Class({ 1727 1728 $chain: [], 1729 1730 chain: function(){ 1731 this.$chain.append(Array.flatten(arguments)); 1732 return this; 1733 }, 1734 1735 callChain: function(){ 1736 return (this.$chain.length) ? this.$chain.shift().apply(this, arguments) : false; 1737 }, 1738 1739 clearChain: function(){ 1740 this.$chain.empty(); 1741 return this; 1742 } 1743 1744}); 1745 1746var removeOn = function(string){ 1747 return string.replace(/^on([A-Z])/, function(full, first){ 1748 return first.toLowerCase(); 1749 }); 1750}; 1751 1752this.Events = new Class({ 1753 1754 $events: {}, 1755 1756 addEvent: function(type, fn, internal){ 1757 type = removeOn(type); 1758 1759 /*<1.2compat>*/ 1760 if (fn == $empty) return this; 1761 /*</1.2compat>*/ 1762 1763 this.$events[type] = (this.$events[type] || []).include(fn); 1764 if (internal) fn.internal = true; 1765 return this; 1766 }, 1767 1768 addEvents: function(events){ 1769 for (var type in events) this.addEvent(type, events[type]); 1770 return this; 1771 }, 1772 1773 fireEvent: function(type, args, delay){ 1774 type = removeOn(type); 1775 var events = this.$events[type]; 1776 if (!events) return this; 1777 args = Array.from(args); 1778 events.each(function(fn){ 1779 if (delay) fn.delay(delay, this, args); 1780 else fn.apply(this, args); 1781 }, this); 1782 return this; 1783 }, 1784 1785 removeEvent: function(type, fn){ 1786 type = removeOn(type); 1787 var events = this.$events[type]; 1788 if (events && !fn.internal){ 1789 var index = events.indexOf(fn); 1790 if (index != -1) delete events[index]; 1791 } 1792 return this; 1793 }, 1794 1795 removeEvents: function(events){ 1796 var type; 1797 if (typeOf(events) == 'object'){ 1798 for (type in events) this.removeEvent(type, events[type]); 1799 return this; 1800 } 1801 if (events) events = removeOn(events); 1802 for (type in this.$events){ 1803 if (events && events != type) continue; 1804 var fns = this.$events[type]; 1805 for (var i = fns.length; i--;) if (i in fns){ 1806 this.removeEvent(type, fns[i]); 1807 } 1808 } 1809 return this; 1810 } 1811 1812}); 1813 1814this.Options = new Class({ 1815 1816 setOptions: function(){ 1817 var options = this.options = Object.merge.apply(null, [{}, this.options].append(arguments)); 1818 if (this.addEvent) for (var option in options){ 1819 if (typeOf(options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue; 1820 this.addEvent(option, options[option]); 1821 delete options[option]; 1822 } 1823 return this; 1824 } 1825 1826}); 1827 1828})(); 1829 1830 1831/* 1832--- 1833name: Slick.Parser 1834description: Standalone CSS3 Selector parser 1835provides: Slick.Parser 1836... 1837*/ 1838 1839;(function(){ 1840 1841var parsed, 1842 separatorIndex, 1843 combinatorIndex, 1844 reversed, 1845 cache = {}, 1846 reverseCache = {}, 1847 reUnescape = /\\/g; 1848 1849var parse = function(expression, isReversed){ 1850 if (expression == null) return null; 1851 if (expression.Slick === true) return expression; 1852 expression = ('' + expression).replace(/^\s+|\s+$/g, ''); 1853 reversed = !!isReversed; 1854 var currentCache = (reversed) ? reverseCache : cache; 1855 if (currentCache[expression]) return currentCache[expression]; 1856 parsed = { 1857 Slick: true, 1858 expressions: [], 1859 raw: expression, 1860 reverse: function(){ 1861 return parse(this.raw, true); 1862 } 1863 }; 1864 separatorIndex = -1; 1865 while (expression != (expression = expression.replace(regexp, parser))); 1866 parsed.length = parsed.expressions.length; 1867 return currentCache[parsed.raw] = (reversed) ? reverse(parsed) : parsed; 1868}; 1869 1870var reverseCombinator = function(combinator){ 1871 if (combinator === '!') return ' '; 1872 else if (combinator === ' ') return '!'; 1873 else if ((/^!/).test(combinator)) return combinator.replace(/^!/, ''); 1874 else return '!' + combinator; 1875}; 1876 1877var reverse = function(expression){ 1878 var expressions = expression.expressions; 1879 for (var i = 0; i < expressions.length; i++){ 1880 var exp = expressions[i]; 1881 var last = {parts: [], tag: '*', combinator: reverseCombinator(exp[0].combinator)}; 1882 1883 for (var j = 0; j < exp.length; j++){ 1884 var cexp = exp[j]; 1885 if (!cexp.reverseCombinator) cexp.reverseCombinator = ' '; 1886 cexp.combinator = cexp.reverseCombinator; 1887 delete cexp.reverseCombinator; 1888 } 1889 1890 exp.reverse().push(last); 1891 } 1892 return expression; 1893}; 1894 1895var escapeRegExp = function(string){// Credit: XRegExp 0.6.1 (c) 2007-2008 Steven Levithan <http://stevenlevithan.com/regex/xregexp/> MIT License 1896 return string.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, function(match){ 1897 return '\\' + match; 1898 }); 1899}; 1900 1901var regexp = new RegExp( 1902/* 1903#!/usr/bin/env ruby 1904puts "\t\t" + DATA.read.gsub(/\(\?x\)|\s+#.*$|\s+|\\$|\\n/,'') 1905__END__ 1906 "(?x)^(?:\ 1907 \\s* ( , ) \\s* # Separator \n\ 1908 | \\s* ( <combinator>+ ) \\s* # Combinator \n\ 1909 | ( \\s+ ) # CombinatorChildren \n\ 1910 | ( <unicode>+ | \\* ) # Tag \n\ 1911 | \\# ( <unicode>+ ) # ID \n\ 1912 | \\. ( <unicode>+ ) # ClassName \n\ 1913 | # Attribute \n\ 1914 \\[ \ 1915 \\s* (<unicode1>+) (?: \ 1916 \\s* ([*^$!~|]?=) (?: \ 1917 \\s* (?:\ 1918 ([\"']?)(.*?)\\9 \ 1919 )\ 1920 ) \ 1921 )? \\s* \ 1922 \\](?!\\]) \n\ 1923 | :+ ( <unicode>+ )(?:\ 1924 \\( (?:\ 1925 (?:([\"'])([^\\12]*)\\12)|((?:\\([^)]+\\)|[^()]*)+)\ 1926 ) \\)\ 1927 )?\ 1928 )" 1929*/ 1930 "^(?:\\s*(,)\\s*|\\s*(<combinator>+)\\s*|(\\s+)|(<unicode>+|\\*)|\\#(<unicode>+)|\\.(<unicode>+)|\\[\\s*(<unicode1>+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(<unicode>+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)" 1931 .replace(/<combinator>/, '[' + escapeRegExp(">+~`!@$%^&={}\\;</") + ']') 1932 .replace(/<unicode>/g, '(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])') 1933 .replace(/<unicode1>/g, '(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])') 1934); 1935 1936function parser( 1937 rawMatch, 1938 1939 separator,
1940 combinator, 1941 combinatorChildren, 1942 1943 tagName, 1944 id, 1945 className, 1946 1947 attributeKey, 1948 attributeOperator, 1949 attributeQuote, 1950 attributeValue, 1951 1952 pseudoMarker, 1953 pseudoClass, 1954 pseudoQuote, 1955 pseudoClassQuotedValue, 1956 pseudoClassValue 1957){ 1958 if (separator || separatorIndex === -1){ 1959 parsed.expressions[++separatorIndex] = []; 1960 combinatorIndex = -1; 1961 if (separator) return ''; 1962 } 1963 1964 if (combinator || combinatorChildren || combinatorIndex === -1){ 1965 combinator = combinator || ' '; 1966 var currentSeparator = parsed.expressions[separatorIndex]; 1967 if (reversed && currentSeparator[combinatorIndex]) 1968 currentSeparator[combinatorIndex].reverseCombinator = reverseCombinator(combinator); 1969 currentSeparator[++combinatorIndex] = {combinator: combinator, tag: '*'}; 1970 } 1971 1972 var currentParsed = parsed.expressions[separatorIndex][combinatorIndex]; 1973 1974 if (tagName){ 1975 currentParsed.tag = tagName.replace(reUnescape, ''); 1976 1977 } else if (id){ 1978 currentParsed.id = id.replace(reUnescape, ''); 1979 1980 } else if (className){ 1981 className = className.replace(reUnescape, ''); 1982 1983 if (!currentParsed.classList) currentParsed.classList = []; 1984 if (!currentParsed.classes) currentParsed.classes = []; 1985 currentParsed.classList.push(className); 1986 currentParsed.classes.push({ 1987 value: className, 1988 regexp: new RegExp('(^|\\s)' + escapeRegExp(className) + '(\\s|$)') 1989 }); 1990 1991 } else if (pseudoClass){ 1992 pseudoClassValue = pseudoClassValue || pseudoClassQuotedValue; 1993 pseudoClassValue = pseudoClassValue ? pseudoClassValue.replace(reUnescape, '') : null; 1994 1995 if (!currentParsed.pseudos) currentParsed.pseudos = []; 1996 currentParsed.pseudos.push({ 1997 key: pseudoClass.replace(reUnescape, ''), 1998 value: pseudoClassValue, 1999 type: pseudoMarker.length == 1 ? 'class' : 'element' 2000 }); 2001 2002 } else if (attributeKey){ 2003 attributeKey = attributeKey.replace(reUnescape, ''); 2004 attributeValue = (attributeValue || '').replace(reUnescape, ''); 2005 2006 var test, regexp; 2007 2008 switch (attributeOperator){ 2009 case '^=' : regexp = new RegExp( '^'+ escapeRegExp(attributeValue) ); break; 2010 case '$=' : regexp = new RegExp( escapeRegExp(attributeValue) +'$' ); break; 2011 case '~=' : regexp = new RegExp( '(^|\\s)'+ escapeRegExp(attributeValue) +'(\\s|$)' ); break; 2012 case '|=' : regexp = new RegExp( '^'+ escapeRegExp(attributeValue) +'(-|$)' ); break; 2013 case '=' : test = function(value){ 2014 return attributeValue == value; 2015 }; break; 2016 case '*=' : test = function(value){ 2017 return value && value.indexOf(attributeValue) > -1; 2018 }; break; 2019 case '!=' : test = function(value){ 2020 return attributeValue != value; 2021 }; break; 2022 default : test = function(value){ 2023 return !!value; 2024 }; 2025 } 2026 2027 if (attributeValue == '' && (/^[*$^]=$/).test(attributeOperator)) test = function(){ 2028 return false; 2029 }; 2030 2031 if (!test) test = function(value){ 2032 return value && regexp.test(value); 2033 }; 2034 2035 if (!currentParsed.attributes) currentParsed.attributes = []; 2036 currentParsed.attributes.push({ 2037 key: attributeKey, 2038 operator: attributeOperator, 2039 value: attributeValue, 2040 test: test 2041 }); 2042 2043 } 2044 2045 return ''; 2046}; 2047 2048// Slick NS 2049 2050var Slick = (this.Slick || {}); 2051 2052Slick.parse = function(expression){ 2053 return parse(expression); 2054}; 2055 2056Slick.escapeRegExp = escapeRegExp; 2057 2058if (!this.Slick) this.Slick = Slick; 2059 2060}).apply(/*<CommonJS>*/(typeof exports != 'undefined') ? exports : /*</CommonJS>*/this); 2061 2062 2063/* 2064--- 2065name: Slick.Finder 2066description: The new, superfast css selector engine. 2067provides: Slick.Finder 2068requires: Slick.Parser 2069... 2070*/ 2071 2072;(function(){ 2073 2074var local = {}, 2075 featuresCache = {}, 2076 toString = Object.prototype.toString; 2077 2078// Feature / Bug detection 2079 2080local.isNativeCode = function(fn){ 2081 return (/\{\s*\[native code\]\s*\}/).test('' + fn); 2082}; 2083 2084local.isXML = function(document){ 2085 return (!!document.xmlVersion) || (!!document.xml) || (toString.call(document) == '[object XMLDocument]') || 2086 (document.nodeType == 9 && document.documentElement.nodeName != 'HTML'); 2087}; 2088 2089local.setDocument = function(document){ 2090 2091 // convert elements / window arguments to document. if document cannot be extrapolated, the function returns. 2092 var nodeType = document.nodeType; 2093 if (nodeType == 9); // document 2094 else if (nodeType) document = document.ownerDocument; // node 2095 else if (document.navigator) document = document.document; // window 2096 else return; 2097 2098 // check if it's the old document 2099 2100 if (this.document === document) return; 2101 this.document = document; 2102 2103 // check if we have done feature detection on this document before 2104 2105 var root = document.documentElement, 2106 rootUid = this.getUIDXML(root), 2107 features = featuresCache[rootUid], 2108 feature; 2109 2110 if (features){ 2111 for (feature in features){ 2112 this[feature] = features[feature]; 2113 } 2114 return; 2115 } 2116 2117 features = featuresCache[rootUid] = {}; 2118 2119 features.root = root; 2120 features.isXMLDocument = this.isXML(document); 2121 2122 features.brokenStarGEBTN 2123 = features.starSelectsClosedQSA 2124 = features.idGetsName 2125 = features.brokenMixedCaseQSA 2126 = features.brokenGEBCN 2127 = features.brokenCheckedQSA 2128 = features.brokenEmptyAttributeQSA 2129 = features.isHTMLDocument 2130 = features.nativeMatchesSelector 2131 = false;
2132 2133 var starSelectsClosed, starSelectsComments, 2134 brokenSecondClassNameGEBCN, cachedGetElementsByClassName, 2135 brokenFormAttributeGetter; 2136 2137 var selected, id = 'slick_uniqueid'; 2138 var testNode = document.createElement('div'); 2139 2140 var testRoot = document.body || document.getElementsByTagName('body')[0] || root; 2141 testRoot.appendChild(testNode); 2142 2143 // on non-HTML documents innerHTML and getElementsById doesnt work properly 2144 try { 2145 testNode.innerHTML = '<a id="'+id+'"></a>'; 2146 features.isHTMLDocument = !!document.getElementById(id); 2147 } catch(e){}; 2148 2149 if (features.isHTMLDocument){ 2150 2151 testNode.style.display = 'none'; 2152 2153 // IE returns comment nodes for getElementsByTagName('*') for some documents 2154 testNode.appendChild(document.createComment('')); 2155 starSelectsComments = (testNode.getElementsByTagName('*').length > 1); 2156 2157 // IE returns closed nodes (EG:"</foo>") for getElementsByTagName('*') for some documents 2158 try { 2159 testNode.innerHTML = 'foo</foo>'; 2160 selected = testNode.getElementsByTagName('*'); 2161 starSelectsClosed = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/'); 2162 } catch(e){}; 2163 2164 features.brokenStarGEBTN = starSelectsComments || starSelectsClosed; 2165 2166 // IE returns elements with the name instead of just id for getElementsById for some documents 2167 try { 2168 testNode.innerHTML = '<a name="'+ id +'"></a><b id="'+ id +'"></b>'; 2169 features.idGetsName = document.getElementById(id) === testNode.firstChild; 2170 } catch(e){}; 2171 2172 if (testNode.getElementsByClassName){ 2173 2174 // Safari 3.2 getElementsByClassName caches results 2175 try { 2176 testNode.innerHTML = '<a class="f"></a><a class="b"></a>'; 2177 testNode.getElementsByClassName('b').length; 2178 testNode.firstChild.className = 'b'; 2179 cachedGetElementsByClassName = (testNode.getElementsByClassName('b').length != 2); 2180 } catch(e){}; 2181 2182 // Opera 9.6 getElementsByClassName doesnt detects the class if its not the first one 2183 try { 2184 testNode.innerHTML = '<a class="a"></a><a class="f b a"></a>'; 2185 brokenSecondClassNameGEBCN = (testNode.getElementsByClassName('a').length != 2); 2186 } catch(e){}; 2187 2188 features.brokenGEBCN = cachedGetElementsByClassName || brokenSecondClassNameGEBCN; 2189 } 2190 2191 if (testNode.querySelectorAll){ 2192 // IE 8 returns closed nodes (EG:"</foo>") for querySelectorAll('*') for some documents 2193 try { 2194 testNode.innerHTML = 'foo</foo>'; 2195 selected = testNode.querySelectorAll('*'); 2196 features.starSelectsClosedQSA = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/'); 2197 } catch(e){}; 2198 2199 // Safari 3.2 querySelectorAll doesnt work with mixedcase on quirksmode 2200 try { 2201 testNode.innerHTML = '<a class="MiX"></a>'; 2202 features.brokenMixedCaseQSA = !testNode.querySelectorAll('.MiX').length; 2203 } catch(e){}; 2204 2205 // Webkit and Opera dont return selected options on querySelectorAll 2206 try { 2207 testNode.innerHTML = '<select><option selected="selected">a</option></select>'; 2208 features.brokenCheckedQSA = (testNode.querySelectorAll(':checked').length == 0); 2209 } catch(e){}; 2210 2211 // IE returns incorrect results for attr[*^$]="" selectors on querySelectorAll 2212 try { 2213 testNode.innerHTML = '<a class=""></a>'; 2214 features.brokenEmptyAttributeQSA = (testNode.querySelectorAll('[class*=""]').length != 0); 2215 } catch(e){}; 2216 2217 } 2218 2219 // IE6-7, if a form has an input of id x, form.getAttribute(x) returns a reference to the input 2220 try { 2221 testNode.innerHTML = '<form action="s"><input id="action"/></form>'; 2222 brokenFormAttributeGetter = (testNode.firstChild.getAttribute('action') != 's'); 2223 } catch(e){}; 2224 2225 // native matchesSelector function 2226 2227 features.nativeMatchesSelector = root.matchesSelector || /*root.msMatchesSelector ||*/ root.mozMatchesSelector || root.webkitMatchesSelector; 2228 if (features.nativeMatchesSelector) try { 2229 // if matchesSelector trows errors on incorrect sintaxes we can use it 2230 features.nativeMatchesSelector.call(root, ':slick'); 2231 features.nativeMatchesSelector = null; 2232 } catch(e){}; 2233 2234 } 2235 2236 try { 2237 root.slick_expando = 1; 2238 delete root.slick_expando; 2239 features.getUID = this.getUIDHTML; 2240 } catch(e) { 2241 features.getUID = this.getUIDXML; 2242 } 2243 2244 testRoot.removeChild(testNode); 2245 testNode = selected = testRoot = null; 2246 2247 // getAttribute 2248 2249 features.getAttribute = (features.isHTMLDocument && brokenFormAttributeGetter) ? function(node, name){ 2250 var method = this.attributeGetters[name]; 2251 if (method) return method.call(node); 2252 var attributeNode = node.getAttributeNode(name); 2253 return (attributeNode) ? attributeNode.nodeValue : null; 2254 } : function(node, name){ 2255 var method = this.attributeGetters[name]; 2256 return (method) ? method.call(node) : node.getAttribute(name); 2257 }; 2258 2259 // hasAttribute 2260 2261 features.hasAttribute = (root && this.isNativeCode(root.hasAttribute)) ? function(node, attribute) { 2262 return node.hasAttribute(attribute); 2263 } : function(node, attribute) { 2264 node = node.getAttributeNode(attribute); 2265 return !!(node && (node.specified || node.nodeValue)); 2266 }; 2267 2268 // contains 2269 // FIXME: Add specs: local.contains should be different for xml and html documents? 2270 var nativeRootContains = root && this.isNativeCode(root.contains), 2271 nativeDocumentContains = document && this.isNativeCode(document.contains); 2272 2273 features.contains = (nativeRootContains && nativeDocumentContains) ? function(context, node){ 2274 return context.contains(node); 2275 } : (nativeRootContains && !nativeDocumentContains) ? function(context, node){ 2276 // IE8 does not have .contains on document. 2277 return context === node || ((context === document) ? document.documentElement : context).contains(node); 2278 } : (root && root.compareDocumentPosition) ? function(context, node){ 2279 return context === node || !!(context.compareDocumentPosition(node) & 16); 2280 } : function(context, node){ 2281 if (node) do { 2282 if (node === context) return true; 2283 } while ((node = node.parentNode)); 2284 return false;
2285 }; 2286 2287 // document order sorting 2288 // credits to Sizzle (http://sizzlejs.com/) 2289 2290 features.documentSorter = (root.compareDocumentPosition) ? function(a, b){ 2291 if (!a.compareDocumentPosition || !b.compareDocumentPosition) return 0; 2292 return a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; 2293 } : ('sourceIndex' in root) ? function(a, b){ 2294 if (!a.sourceIndex || !b.sourceIndex) return 0; 2295 return a.sourceIndex - b.sourceIndex; 2296 } : (document.createRange) ? function(a, b){ 2297 if (!a.ownerDocument || !b.ownerDocument) return 0; 2298 var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); 2299 aRange.setStart(a, 0); 2300 aRange.setEnd(a, 0); 2301 bRange.setStart(b, 0); 2302 bRange.setEnd(b, 0); 2303 return aRange.compareBoundaryPoints(Range.START_TO_END, bRange); 2304 } : null ; 2305 2306 root = null; 2307 2308 for (feature in features){ 2309 this[feature] = features[feature]; 2310 } 2311}; 2312 2313// Main Method 2314 2315var reSimpleSelector = /^([#.]?)((?:[\w-]+|\*))$/, 2316 reEmptyAttribute = /\[.+[*$^]=(?:""|'')?\]/, 2317 qsaFailExpCache = {}; 2318 2319local.search = function(context, expression, append, first){ 2320 2321 var found = this.found = (first) ? null : (append || []); 2322 2323 if (!context) return found; 2324 else if (context.navigator) context = context.document; // Convert the node from a window to a document 2325 else if (!context.nodeType) return found; 2326 2327 // setup 2328 2329 var parsed, i, 2330 uniques = this.uniques = {}, 2331 hasOthers = !!(append && append.length), 2332 contextIsDocument = (context.nodeType == 9); 2333 2334 if (this.document !== (contextIsDocument ? context : context.ownerDocument)) this.setDocument(context); 2335 2336 // avoid duplicating items already in the append array 2337 if (hasOthers) for (i = found.length; i--;) uniques[this.getUID(found[i])] = true; 2338 2339 // expression checks 2340 2341 if (typeof expression == 'string'){ // expression is a string 2342 2343 /*<simple-selectors-override>*/ 2344 var simpleSelector = expression.match(reSimpleSelector); 2345 simpleSelectors: if (simpleSelector) { 2346 2347 var symbol = simpleSelector[1], 2348 name = simpleSelector[2], 2349 node, nodes; 2350 2351 if (!symbol){ 2352 2353 if (name == '*' && this.brokenStarGEBTN) break simpleSelectors; 2354 nodes = context.getElementsByTagName(name); 2355 if (first) return nodes[0] || null; 2356 for (i = 0; node = nodes[i++];){ 2357 if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); 2358 } 2359 2360 } else if (symbol == '#'){ 2361 2362 if (!this.isHTMLDocument || !contextIsDocument) break simpleSelectors; 2363 node = context.getElementById(name); 2364 if (!node) return found; 2365 if (this.idGetsName && node.getAttributeNode('id').nodeValue != name) break simpleSelectors; 2366 if (first) return node || null; 2367 if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); 2368 2369 } else if (symbol == '.'){ 2370 2371 if (!this.isHTMLDocument || ((!context.getElementsByClassName || this.brokenGEBCN) && context.querySelectorAll)) break simpleSelectors; 2372 if (context.getElementsByClassName && !this.brokenGEBCN){ 2373 nodes = context.getElementsByClassName(name); 2374 if (first) return nodes[0] || null; 2375 for (i = 0; node = nodes[i++];){ 2376 if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); 2377 } 2378 } else { 2379 var matchClass = new RegExp('(^|\\s)'+ Slick.escapeRegExp(name) +'(\\s|$)'); 2380 nodes = context.getElementsByTagName('*'); 2381 for (i = 0; node = nodes[i++];){ 2382 className = node.className; 2383 if (!(className && matchClass.test(className))) continue; 2384 if (first) return node; 2385 if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); 2386 } 2387 } 2388 2389 } 2390 2391 if (hasOthers) this.sort(found); 2392 return (first) ? null : found; 2393 2394 } 2395 /*</simple-selectors-override>*/ 2396 2397 /*<query-selector-override>*/ 2398 querySelector: if (context.querySelectorAll) { 2399 2400 if (!this.isHTMLDocument 2401 || qsaFailExpCache[expression] 2402 //TODO: only skip when expression is actually mixed case 2403 || this.brokenMixedCaseQSA 2404 || (this.brokenCheckedQSA && expression.indexOf(':checked') > -1) 2405 || (this.brokenEmptyAttributeQSA && reEmptyAttribute.test(expression)) 2406 || (!contextIsDocument //Abort when !contextIsDocument and... 2407 // there are multiple expressions in the selector 2408 // since we currently only fix non-document rooted QSA for single expression selectors 2409 && expression.indexOf(',') > -1 2410 ) 2411 || Slick.disableQSA 2412 ) break querySelector; 2413 2414 var _expression = expression, _context = context; 2415 if (!contextIsDocument){ 2416 // non-document rooted QSA 2417 // credits to Andrew Dupont 2418 var currentId = _context.getAttribute('id'), slickid = 'slickid__'; 2419 _context.setAttribute('id', slickid); 2420 _expression = '#' + slickid + ' ' + _expression; 2421 context = _context.parentNode; 2422 } 2423 2424 try { 2425 if (first) return context.querySelector(_expression) || null; 2426 else nodes = context.querySelectorAll(_expression); 2427 } catch(e) { 2428 qsaFailExpCache[expression] = 1; 2429 break querySelector; 2430 } finally { 2431 if (!contextIsDocument){ 2432 if (currentId) _context.setAttribute('id', currentId); 2433 else _context.removeAttribute('id'); 2434 context = _context; 2435 } 2436 } 2437 2438 if (this.starSelectsClosedQSA) for (i = 0; node = nodes[i++];){ 2439 if (node.nodeName > '@' && !(hasOthers && uniques[this.getUID(node)])) found.push(node); 2440 } else for (i = 0; node = nodes[i++];){ 2441 if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); 2442 } 2443 2444 if (hasOthers) this.sort(found); 2445 return found; 2446 2447 } 2448 /*</query-selector-override>*/ 2449 2450 parsed = this.Slick.parse(expression); 2451 if (!parsed.length) return found; 2452 } else if (expression == null){ // there is no expression 2453 return found; 2454 } else if (expression.Slick){ // expression is a parsed Slick object 2455 parsed = expression; 2456 } else if (this.contains(context.documentElement || context, expression)){ // expression is a node 2457 (found) ? found.push(expression) : found = expression; 2458 return found; 2459 } else { // other junk 2460 return found; 2461 } 2462 2463 /*<pseudo-selectors>*//*<nth-pseudo-selectors>*/ 2464 2465 // cache elements for the nth selectors 2466 2467 this.posNTH = {}; 2468 this.posNTHLast = {}; 2469 this.posNTHType = {}; 2470 this.posNTHTypeLast = {}; 2471 2472 /*</nth-pseudo-selectors>*//*</pseudo-selectors>*/ 2473 2474 // if append is null and there is only a single selector with one expression use pushArray, else use pushUID 2475 this.push = (!hasOthers && (first || (parsed.length == 1 && parsed.expressions[0].length == 1))) ? this.pushArray : this.pushUID; 2476 2477 if (found == null) found = []; 2478 2479 // default engine 2480 2481 var j, m, n; 2482 var combinator, tag, id, classList, classes, attributes, pseudos; 2483 var currentItems, currentExpression, currentBit, lastBit, expressions = parsed.expressions; 2484 2485 search: for (i = 0; (currentExpression = expressions[i]); i++) for (j = 0; (currentBit = currentExpression[j]); j++){ 2486 2487 combinator = 'combinator:' + currentBit.combinator; 2488 if (!this[combinator]) continue search; 2489 2490 tag = (this.isXMLDocument) ? currentBit.tag : currentBit.tag.toUpperCase(); 2491 id = currentBit.id; 2492 classList = currentBit.classList; 2493 classes = currentBit.classes; 2494 attributes = currentBit.attributes; 2495 pseudos = currentBit.pseudos; 2496 lastBit = (j === (currentExpression.length - 1)); 2497 2498 this.bitUniques = {}; 2499 2500 if (lastBit){ 2501 this.uniques = uniques; 2502 this.found = found; 2503 } else { 2504 this.uniques = {}; 2505 this.found = []; 2506 } 2507 2508 if (j === 0){ 2509 this[combinator](context, tag, id, classes, attributes, pseudos, classList); 2510 if (first && lastBit && found.length) break search; 2511 } else { 2512 if (first && lastBit) for (m = 0, n = currentItems.length; m < n; m++){ 2513 this[combinator](currentItems[m], tag, id, classes, attributes, pseudos, classList); 2514 if (found.length) break search; 2515 } else for (m = 0, n = currentItems.length; m < n; m++) this[combinator](currentItems[m], tag, id, classes, attributes, pseudos, classList); 2516 } 2517 2518 currentItems = this.found; 2519 } 2520 2521 // should sort if there are nodes in append and if you pass multiple expressions. 2522 if (hasOthers || (parsed.expressions.length > 1)) this.sort(found); 2523 2524 return (first) ? (found[0] || null) : found; 2525}; 2526 2527// Utils 2528 2529local.uidx = 1; 2530local.uidk = 'slick-uniqueid'; 2531 2532local.getUIDXML = function(node){ 2533 var uid = node.getAttribute(this.uidk); 2534 if (!uid){ 2535 uid = this.uidx++; 2536 node.setAttribute(this.uidk, uid); 2537 } 2538 return uid; 2539}; 2540 2541local.getUIDHTML = function(node){ 2542 return node.uniqueNumber || (node.uniqueNumber = this.uidx++); 2543}; 2544 2545// sort based on the setDocument documentSorter method. 2546 2547local.sort = function(results){ 2548 if (!this.documentSorter) return results; 2549 results.sort(this.documentSorter); 2550 return results; 2551}; 2552 2553/*<pseudo-selectors>*//*<nth-pseudo-selectors>*/ 2554 2555local.cacheNTH = {}; 2556 2557local.matchNTH = /^([+-]?\d*)?([a-z]+)?([+-]\d+)?$/; 2558 2559local.parseNTHArgument = function(argument){ 2560 var parsed = argument.match(this.matchNTH); 2561 if (!parsed) return false;
2562 var special = parsed[2] || false; 2563 var a = parsed[1] || 1; 2564 if (a == '-') a = -1; 2565 var b = +parsed[3] || 0; 2566 parsed = 2567 (special == 'n') ? {a: a, b: b} : 2568 (special == 'odd') ? {a: 2, b: 1} : 2569 (special == 'even') ? {a: 2, b: 0} : {a: 0, b: a}; 2570 2571 return (this.cacheNTH[argument] = parsed); 2572}; 2573 2574local.createNTHPseudo = function(child, sibling, positions, ofType){ 2575 return function(node, argument){ 2576 var uid = this.getUID(node); 2577 if (!this[positions][uid]){ 2578 var parent = node.parentNode; 2579 if (!parent) return false; 2580 var el = parent[child], count = 1; 2581 if (ofType){ 2582 var nodeName = node.nodeName; 2583 do { 2584 if (el.nodeName != nodeName) continue; 2585 this[positions][this.getUID(el)] = count++; 2586 } while ((el = el[sibling])); 2587 } else { 2588 do { 2589 if (el.nodeType != 1) continue; 2590 this[positions][this.getUID(el)] = count++; 2591 } while ((el = el[sibling])); 2592 } 2593 } 2594 argument = argument || 'n'; 2595 var parsed = this.cacheNTH[argument] || this.parseNTHArgument(argument); 2596 if (!parsed) return false; 2597 var a = parsed.a, b = parsed.b, pos = this[positions][uid]; 2598 if (a == 0) return b == pos; 2599 if (a > 0){ 2600 if (pos < b) return false; 2601 } else { 2602 if (b < pos) return false; 2603 } 2604 return ((pos - b) % a) == 0; 2605 }; 2606}; 2607 2608/*</nth-pseudo-selectors>*//*</pseudo-selectors>*/ 2609 2610local.pushArray = function(node, tag, id, classes, attributes, pseudos){ 2611 if (this.matchSelector(node, tag, id, classes, attributes, pseudos)) this.found.push(node); 2612}; 2613 2614local.pushUID = function(node, tag, id, classes, attributes, pseudos){ 2615 var uid = this.getUID(node); 2616 if (!this.uniques[uid] && this.matchSelector(node, tag, id, classes, attributes, pseudos)){ 2617 this.uniques[uid] = true; 2618 this.found.push(node); 2619 } 2620}; 2621 2622local.matchNode = function(node, selector){ 2623 if (this.isHTMLDocument && this.nativeMatchesSelector){ 2624 try { 2625 return this.nativeMatchesSelector.call(node, selector.replace(/\[([^=]+)=\s*([^'"\]]+?)\s*\]/g, '[$1="$2"]')); 2626 } catch(matchError) {} 2627 } 2628 2629 var parsed = this.Slick.parse(selector); 2630 if (!parsed) return true; 2631 2632 // simple (single) selectors 2633 var expressions = parsed.expressions, simpleExpCounter = 0, i; 2634 for (i = 0; (currentExpression = expressions[i]); i++){ 2635 if (currentExpression.length == 1){ 2636 var exp = currentExpression[0]; 2637 if (this.matchSelector(node, (this.isXMLDocument) ? exp.tag : exp.tag.toUpperCase(), exp.id, exp.classes, exp.attributes, exp.pseudos)) return true; 2638 simpleExpCounter++; 2639 } 2640 } 2641 2642 if (simpleExpCounter == parsed.length) return false; 2643 2644 var nodes = this.search(this.document, parsed), item; 2645 for (i = 0; item = nodes[i++];){ 2646 if (item === node) return true; 2647 } 2648 return false; 2649}; 2650 2651local.matchPseudo = function(node, name, argument){ 2652 var pseudoName = 'pseudo:' + name; 2653 if (this[pseudoName]) return this[pseudoName](node, argument); 2654 var attribute = this.getAttribute(node, name); 2655 return (argument) ? argument == attribute : !!attribute; 2656}; 2657 2658local.matchSelector = function(node, tag, id, classes, attributes, pseudos){ 2659 if (tag){ 2660 var nodeName = (this.isXMLDocument) ? node.nodeName : node.nodeName.toUpperCase(); 2661 if (tag == '*'){ 2662 if (nodeName < '@') return false; // Fix for comment nodes and closed nodes 2663 } else { 2664 if (nodeName != tag) return false; 2665 } 2666 } 2667 2668 if (id && node.getAttribute('id') != id) return false; 2669 2670 var i, part, cls; 2671 if (classes) for (i = classes.length; i--;){ 2672 cls = this.getAttribute(node, 'class'); 2673 if (!(cls && classes[i].regexp.test(cls))) return false; 2674 } 2675 if (attributes) for (i = attributes.length; i--;){ 2676 part = attributes[i]; 2677 if (part.operator ? !part.test(this.getAttribute(node, part.key)) : !this.hasAttribute(node, part.key)) return false; 2678 } 2679 if (pseudos) for (i = pseudos.length; i--;){ 2680 part = pseudos[i]; 2681 if (!this.matchPseudo(node, part.key, part.value)) return false; 2682 } 2683 return true; 2684}; 2685 2686var combinators = { 2687 2688 ' ': function(node, tag, id, classes, attributes, pseudos, classList){ // all child nodes, any level 2689 2690 var i, item, children; 2691 2692 if (this.isHTMLDocument){ 2693 getById: if (id){ 2694 item = this.document.getElementById(id); 2695 if ((!item && node.all) || (this.idGetsName && item && item.getAttributeNode('id').nodeValue != id)){ 2696 // all[id] returns all the elements with that name or id inside node 2697 // if theres just one it will return the element, else it will be a collection 2698 children = node.all[id]; 2699 if (!children) return; 2700 if (!children[0]) children = [children]; 2701 for (i = 0; item = children[i++];){ 2702 var idNode = item.getAttributeNode('id'); 2703 if (idNode && idNode.nodeValue == id){ 2704 this.push(item, tag, null, classes, attributes, pseudos); 2705 break; 2706 } 2707 } 2708 return; 2709 } 2710 if (!item){ 2711 // if the context is in the dom we return, else we will try GEBTN, breaking the getById label 2712 if (this.contains(this.root, node)) return; 2713 else break getById; 2714 } else if (this.document !== node && !this.contains(node, item)) return; 2715 this.push(item, tag, null, classes, attributes, pseudos); 2716 return; 2717 } 2718 getByClass: if (classes && node.getElementsByClassName && !this.brokenGEBCN){ 2719 children = node.getElementsByClassName(classList.join(' ')); 2720 if (!(children && children.length)) break getByClass; 2721 for (i = 0; item = children[i++];) this.push(item, tag, id, null, attributes, pseudos); 2722 return; 2723 } 2724 } 2725 getByTag: { 2726 children = node.getElementsByTagName(tag); 2727 if (!(children && children.length)) break getByTag; 2728 if (!this.brokenStarGEBTN) tag = null; 2729 for (i = 0; item = children[i++];) this.push(item, tag, id, classes, attributes, pseudos); 2730 } 2731 }, 2732 2733 '>': function(node, tag, id, classes, attributes, pseudos){ // direct children 2734 if ((node = node.firstChild)) do { 2735 if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos); 2736 } while ((node = node.nextSibling)); 2737 }, 2738 2739 '+': function(node, tag, id, classes, attributes, pseudos){ // next sibling 2740 while ((node = node.nextSibling)) if (node.nodeType == 1){ 2741 this.push(node, tag, id, classes, attributes, pseudos); 2742 break; 2743 } 2744 }, 2745 2746 '^': function(node, tag, id, classes, attributes, pseudos){ // first child 2747 node = node.firstChild; 2748 if (node){ 2749 if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos); 2750 else this['combinator:+'](node, tag, id, classes, attributes, pseudos); 2751 } 2752 }, 2753 2754 '~': function(node, tag, id, classes, attributes, pseudos){ // next siblings 2755 while ((node = node.nextSibling)){ 2756 if (node.nodeType != 1) continue; 2757 var uid = this.getUID(node); 2758 if (this.bitUniques[uid]) break; 2759 this.bitUniques[uid] = true; 2760 this.push(node, tag, id, classes, attributes, pseudos); 2761 } 2762 }, 2763 2764 '++': function(node, tag, id, classes, attributes, pseudos){ // next sibling and previous sibling 2765 this['combinator:+'](node, tag, id, classes, attributes, pseudos); 2766 this['combinator:!+'](node, tag, id, classes, attributes, pseudos); 2767 }, 2768 2769 '~~': function(node, tag, id, classes, attributes, pseudos){ // next siblings and previous siblings 2770 this['combinator:~'](node, tag, id, classes, attributes, pseudos); 2771 this['combinator:!~'](node, tag, id, classes, attributes, pseudos); 2772 }, 2773 2774 '!': function(node, tag, id, classes, attributes, pseudos){ // all parent nodes up to document 2775 while ((node = node.parentNode)) if (node !== this.document) this.push(node, tag, id, classes, attributes, pseudos); 2776 }, 2777 2778 '!>': function(node, tag, id, classes, attributes, pseudos){ // direct parent (one level) 2779 node = node.parentNode; 2780 if (node !== this.document) this.push(node, tag, id, classes, attributes, pseudos); 2781 }, 2782 2783 '!+': function(node, tag, id, classes, attributes, pseudos){ // previous sibling 2784 while ((node = node.previousSibling)) if (node.nodeType == 1){ 2785 this.push(node, tag, id, classes, attributes, pseudos); 2786 break; 2787 } 2788 }, 2789 2790 '!^': function(node, tag, id, classes, attributes, pseudos){ // last child 2791 node = node.lastChild; 2792 if (node){ 2793 if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos); 2794 else this['combinator:!+'](node, tag, id, classes, attributes, pseudos); 2795 } 2796 }, 2797 2798 '!~': function(node, tag, id, classes, attributes, pseudos){ // previous siblings 2799 while ((node = node.previousSibling)){ 2800 if (node.nodeType != 1) continue; 2801 var uid = this.getUID(node); 2802 if (this.bitUniques[uid]) break; 2803 this.bitUniques[uid] = true; 2804 this.push(node, tag, id, classes, attributes, pseudos); 2805 } 2806 } 2807 2808}; 2809 2810for (var c in combinators) local['combinator:' + c] = combinators[c]; 2811 2812var pseudos = { 2813 2814 /*<pseudo-selectors>*/ 2815 2816 'empty': function(node){ 2817 var child = node.firstChild; 2818 return !(child && child.nodeType == 1) && !(node.innerText || node.textContent || '').length; 2819 }, 2820 2821 'not': function(node, expression){ 2822 return !this.matchNode(node, expression); 2823 }, 2824 2825 'contains': function(node, text){ 2826 return (node.innerText || node.textContent || '').indexOf(text) > -1; 2827 }, 2828 2829 'first-child': function(node){ 2830 while ((node = node.previousSibling)) if (node.nodeType == 1) return false;
2831 return true; 2832 }, 2833 2834 'last-child': function(node){ 2835 while ((node = node.nextSibling)) if (node.nodeType == 1) return false; 2836 return true; 2837 }, 2838 2839 'only-child': function(node){ 2840 var prev = node; 2841 while ((prev = prev.previousSibling)) if (prev.nodeType == 1) return false; 2842 var next = node; 2843 while ((next = next.nextSibling)) if (next.nodeType == 1) return false; 2844 return true; 2845 }, 2846 2847 /*<nth-pseudo-selectors>*/ 2848 2849 'nth-child': local.createNTHPseudo('firstChild', 'nextSibling', 'posNTH'), 2850 2851 'nth-last-child': local.createNTHPseudo('lastChild', 'previousSibling', 'posNTHLast'), 2852 2853 'nth-of-type': local.createNTHPseudo('firstChild', 'nextSibling', 'posNTHType', true), 2854 2855 'nth-last-of-type': local.createNTHPseudo('lastChild', 'previousSibling', 'posNTHTypeLast', true), 2856 2857 'index': function(node, index){ 2858 return this['pseudo:nth-child'](node, '' + (index + 1)); 2859 }, 2860 2861 'even': function(node){ 2862 return this['pseudo:nth-child'](node, '2n'); 2863 }, 2864 2865 'odd': function(node){ 2866 return this['pseudo:nth-child'](node, '2n+1'); 2867 }, 2868 2869 /*</nth-pseudo-selectors>*/ 2870 2871 /*<of-type-pseudo-selectors>*/ 2872 2873 'first-of-type': function(node){ 2874 var nodeName = node.nodeName; 2875 while ((node = node.previousSibling)) if (node.nodeName == nodeName) return false; 2876 return true; 2877 }, 2878 2879 'last-of-type': function(node){ 2880 var nodeName = node.nodeName; 2881 while ((node = node.nextSibling)) if (node.nodeName == nodeName) return false; 2882 return true; 2883 }, 2884 2885 'only-of-type': function(node){ 2886 var prev = node, nodeName = node.nodeName; 2887 while ((prev = prev.previousSibling)) if (prev.nodeName == nodeName) return false; 2888 var next = node; 2889 while ((next = next.nextSibling)) if (next.nodeName == nodeName) return false; 2890 return true; 2891 }, 2892 2893 /*</of-type-pseudo-selectors>*/ 2894 2895 // custom pseudos 2896 2897 'enabled': function(node){ 2898 return !node.disabled; 2899 }, 2900 2901 'disabled': function(node){ 2902 return node.disabled; 2903 }, 2904 2905 'checked': function(node){ 2906 return node.checked || node.selected; 2907 }, 2908 2909 'focus': function(node){ 2910 return this.isHTMLDocument && this.document.activeElement === node && (node.href || node.type || this.hasAttribute(node, 'tabindex')); 2911 }, 2912 2913 'root': function(node){ 2914 return (node === this.root); 2915 }, 2916 2917 'selected': function(node){ 2918 return node.selected; 2919 } 2920 2921 /*</pseudo-selectors>*/ 2922}; 2923 2924for (var p in pseudos) local['pseudo:' + p] = pseudos[p]; 2925 2926// attributes methods 2927 2928var attributeGetters = local.attributeGetters = { 2929 2930 'for': function(){ 2931 return ('htmlFor' in this) ? this.htmlFor : this.getAttribute('for'); 2932 }, 2933 2934 'href': function(){ 2935 return ('href' in this) ? this.getAttribute('href', 2) : this.getAttribute('href'); 2936 }, 2937 2938 'style': function(){ 2939 return (this.style) ? this.style.cssText : this.getAttribute('style'); 2940 }, 2941 2942 'tabindex': function(){ 2943 var attributeNode = this.getAttributeNode('tabindex'); 2944 return (attributeNode && attributeNode.specified) ? attributeNode.nodeValue : null; 2945 }, 2946 2947 'type': function(){ 2948 return this.getAttribute('type'); 2949 }, 2950 2951 'maxlength': function(){ 2952 var attributeNode = this.getAttributeNode('maxLength'); 2953 return (attributeNode && attributeNode.specified) ? attributeNode.nodeValue : null; 2954 } 2955 2956}; 2957 2958attributeGetters.MAXLENGTH = attributeGetters.maxLength = attributeGetters.maxlength; 2959 2960// Slick 2961 2962var Slick = local.Slick = (this.Slick || {}); 2963 2964Slick.version = '1.1.7'; 2965 2966// Slick finder 2967 2968Slick.search = function(context, expression, append){ 2969 return local.search(context, expression, append); 2970}; 2971 2972Slick.find = function(context, expression){ 2973 return local.search(context, expression, null, true); 2974}; 2975 2976// Slick containment checker 2977 2978Slick.contains = function(container, node){ 2979 local.setDocument(container); 2980 return local.contains(container, node); 2981}; 2982 2983// Slick attribute getter 2984 2985Slick.getAttribute = function(node, name){ 2986 local.setDocument(node); 2987 return local.getAttribute(node, name); 2988}; 2989 2990Slick.hasAttribute = function(node, name){ 2991 local.setDocument(node); 2992 return local.hasAttribute(node, name); 2993}; 2994 2995// Slick matcher 2996 2997Slick.match = function(node, selector){ 2998 if (!(node && selector)) return false; 2999 if (!selector || selector === node) return true; 3000 local.setDocument(node); 3001 return local.matchNode(node, selector); 3002}; 3003 3004// Slick attribute accessor 3005 3006Slick.defineAttributeGetter = function(name, fn){ 3007 local.attributeGetters[name] = fn; 3008 return this; 3009}; 3010 3011Slick.lookupAttributeGetter = function(name){ 3012 return local.attributeGetters[name]; 3013}; 3014 3015// Slick pseudo accessor 3016 3017Slick.definePseudo = function(name, fn){ 3018 local['pseudo:' + name] = function(node, argument){
3019 return fn.call(node, argument); 3020 }; 3021 return this; 3022}; 3023 3024Slick.lookupPseudo = function(name){ 3025 var pseudo = local['pseudo:' + name]; 3026 if (pseudo) return function(argument){ 3027 return pseudo.call(this, argument); 3028 }; 3029 return null; 3030}; 3031 3032// Slick overrides accessor 3033 3034Slick.override = function(regexp, fn){ 3035 local.override(regexp, fn); 3036 return this; 3037}; 3038 3039Slick.isXML = local.isXML; 3040 3041Slick.uidOf = function(node){ 3042 return local.getUIDHTML(node); 3043}; 3044 3045if (!this.Slick) this.Slick = Slick; 3046 3047}).apply(/*<CommonJS>*/(typeof exports != 'undefined') ? exports : /*</CommonJS>*/this); 3048 3049 3050/* 3051--- 3052 3053name: Element 3054 3055description: One of the most important items in MooTools. Contains the dollar function, the dollars function, and an handful of cross-browser, time-saver methods to let you easily work with HTML Elements. 3056 3057license: MIT-style license. 3058 3059requires: [Window, Document, Array, String, Function, Object, Number, Slick.Parser, Slick.Finder] 3060 3061provides: [Element, Elements, $, $$, Iframe, Selectors] 3062 3063... 3064*/ 3065 3066var Element = function(tag, props){ 3067 var konstructor = Element.Constructors[tag]; 3068 if (konstructor) return konstructor(props); 3069 if (typeof tag != 'string') return document.id(tag).set(props); 3070 3071 if (!props) props = {}; 3072 3073 if (!(/^[\w-]+$/).test(tag)){ 3074 var parsed = Slick.parse(tag).expressions[0][0]; 3075 tag = (parsed.tag == '*') ? 'div' : parsed.tag; 3076 if (parsed.id && props.id == null) props.id = parsed.id; 3077 3078 var attributes = parsed.attributes; 3079 if (attributes) for (var attr, i = 0, l = attributes.length; i < l; i++){ 3080 attr = attributes[i]; 3081 if (props[attr.key] != null) continue; 3082 3083 if (attr.value != null && attr.operator == '=') props[attr.key] = attr.value; 3084 else if (!attr.value && !attr.operator) props[attr.key] = true; 3085 } 3086 3087 if (parsed.classList && props['class'] == null) props['class'] = parsed.classList.join(' '); 3088 } 3089 3090 return document.newElement(tag, props); 3091}; 3092 3093 3094if (Browser.Element){ 3095 Element.prototype = Browser.Element.prototype; 3096 // IE8 and IE9 require the wrapping. 3097 Element.prototype._fireEvent = (function(fireEvent){ 3098 return function(type, event){ 3099 return fireEvent.call(this, type, event); 3100 }; 3101 })(Element.prototype.fireEvent); 3102} 3103 3104new Type('Element', Element).mirror(function(name){ 3105 if (Array.prototype[name]) return; 3106 3107 var obj = {}; 3108 obj[name] = function(){ 3109 var results = [], args = arguments, elements = true; 3110 for (var i = 0, l = this.length; i < l; i++){ 3111 var element = this[i], result = results[i] = element[name].apply(element, args); 3112 elements = (elements && typeOf(result) == 'element'); 3113 } 3114 return (elements) ? new Elements(results) : results; 3115 }; 3116 3117 Elements.implement(obj); 3118}); 3119 3120if (!Browser.Element){ 3121 Element.parent = Object; 3122 3123 Element.Prototype = { 3124 '$constructor': Element, 3125 '$family': Function.from('element').hide() 3126 }; 3127 3128 Element.mirror(function(name, method){ 3129 Element.Prototype[name] = method; 3130 }); 3131} 3132 3133Element.Constructors = {}; 3134 3135//<1.2compat> 3136 3137Element.Constructors = new Hash; 3138 3139//</1.2compat> 3140 3141var IFrame = new Type('IFrame', function(){ 3142 var params = Array.link(arguments, { 3143 properties: Type.isObject, 3144 iframe: function(obj){ 3145 return (obj != null); 3146 } 3147 }); 3148 3149 var props = params.properties || {}, iframe; 3150 if (params.iframe) iframe = document.id(params.iframe); 3151 var onload = props.onload || function(){}; 3152 delete props.onload; 3153 props.id = props.name = [props.id, props.name, iframe ? (iframe.id || iframe.name) : 'IFrame_' + String.uniqueID()].pick(); 3154 iframe = new Element(iframe || 'iframe', props); 3155 3156 var onLoad = function(){ 3157 onload.call(iframe.contentWindow); 3158 }; 3159 3160 if (window.frames[props.id]) onLoad(); 3161 else iframe.addListener('load', onLoad); 3162 return iframe; 3163}); 3164 3165var Elements = this.Elements = function(nodes){ 3166 if (nodes && nodes.length){ 3167 var uniques = {}, node; 3168 for (var i = 0; node = nodes[i++];){ 3169 var uid = Slick.uidOf(node); 3170 if (!uniques[uid]){ 3171 uniques[uid] = true; 3172 this.push(node); 3173 } 3174 } 3175 } 3176}; 3177 3178Elements.prototype = {length: 0}; 3179Elements.parent = Array; 3180 3181new Type('Elements', Elements).implement({ 3182 3183 filter: function(filter, bind){ 3184 if (!filter) return this; 3185 return new Elements(Array.filter(this, (typeOf(filter) == 'string') ? function(item){ 3186 return item.match(filter); 3187 } : filter, bind)); 3188 }.protect(), 3189 3190 push: function(){ 3191 var length = this.length; 3192 for (var i = 0, l = arguments.length; i < l; i++){ 3193 var item = document.id(arguments[i]); 3194 if (item) this[length++] = item; 3195 } 3196 return (this.length = length); 3197 }.protect(), 3198 3199 unshift: function(){ 3200 var items = []; 3201 for (var i = 0, l = arguments.length; i < l; i++){ 3202 var item = document.id(arguments[i]); 3203 if (item) items.push(item); 3204 } 3205 return Array.prototype.unshift.apply(this, items); 3206 }.protect(), 3207 3208 concat: function(){ 3209 var newElements = new Elements(this); 3210 for (var i = 0, l = arguments.length; i < l; i++){ 3211 var item = arguments[i]; 3212 if (Type.isEnumerable(item)) newElements.append(item); 3213 else newElements.push(item); 3214 } 3215 return newElements; 3216 }.protect(), 3217 3218 append: function(collection){ 3219 for (var i = 0, l = collection.length; i < l; i++) this.push(collection[i]); 3220 return this; 3221 }.protect(), 3222 3223 empty: function(){ 3224 while (this.length) delete this[--this.length]; 3225 return this; 3226 }.protect() 3227 3228}); 3229 3230//<1.2compat> 3231 3232Elements.alias('extend', 'append'); 3233 3234//</1.2compat> 3235 3236(function(){ 3237 3238// FF, IE 3239var splice = Array.prototype.splice, object = {'0': 0, '1': 1, length: 2}; 3240 3241splice.call(object, 1, 1); 3242if (object[1] == 1) Elements.implement('splice', function(){ 3243 var length = this.length; 3244 var result = splice.apply(this, arguments); 3245 while (length >= this.length) delete this[length--]; 3246 return result; 3247}.protect()); 3248 3249Array.forEachMethod(function(method, name){ 3250 Elements.implement(name, method); 3251}); 3252 3253Array.mirror(Elements); 3254 3255/*<ltIE8>*/ 3256var createElementAcceptsHTML; 3257try { 3258 createElementAcceptsHTML = (document.createElement('<input name=x>').name == 'x'); 3259} catch (e){} 3260 3261var escapeQuotes = function(html){ 3262 return ('' + html).replace(/&/g, '&').replace(/"/g, '"'); 3263}; 3264/*</ltIE8>*/ 3265 3266Document.implement({ 3267 3268 newElement: function(tag, props){ 3269 if (props && props.checked != null) props.defaultChecked = props.checked; 3270 /*<ltIE8>*/// Fix for readonly name and type properties in IE < 8 3271 if (createElementAcceptsHTML && props){ 3272 tag = '<' + tag; 3273 if (props.name) tag += ' name="' + escapeQuotes(props.name) + '"'; 3274 if (props.type) tag += ' type="' + escapeQuotes(props.type) + '"'; 3275 tag += '>'; 3276 delete props.name; 3277 delete props.type; 3278 } 3279 /*</ltIE8>*/ 3280 return this.id(this.createElement(tag)).set(props); 3281 } 3282 3283}); 3284 3285})(); 3286 3287(function(){ 3288 3289Slick.uidOf(window); 3290Slick.uidOf(document); 3291 3292Document.implement({ 3293 3294 newTextNode: function(text){ 3295 return this.createTextNode(text); 3296 }, 3297 3298 getDocument: function(){ 3299 return this; 3300 }, 3301
3302 getWindow: function(){ 3303 return this.window; 3304 }, 3305 3306 id: (function(){ 3307 3308 var types = { 3309 3310 string: function(id, nocash, doc){ 3311 id = Slick.find(doc, '#' + id.replace(/(\W)/g, '\\$1')); 3312 return (id) ? types.element(id, nocash) : null; 3313 }, 3314 3315 element: function(el, nocash){ 3316 Slick.uidOf(el); 3317 if (!nocash && !el.$family && !(/^(?:object|embed)$/i).test(el.tagName)){ 3318 var fireEvent = el.fireEvent; 3319 // wrapping needed in IE7, or else crash 3320 el._fireEvent = function(type, event){ 3321 return fireEvent(type, event); 3322 }; 3323 Object.append(el, Element.Prototype); 3324 } 3325 return el; 3326 }, 3327 3328 object: function(obj, nocash, doc){ 3329 if (obj.toElement) return types.element(obj.toElement(doc), nocash); 3330 return null; 3331 } 3332 3333 }; 3334 3335 types.textnode = types.whitespace = types.window = types.document = function(zero){ 3336 return zero; 3337 }; 3338 3339 return function(el, nocash, doc){ 3340 if (el && el.$family && el.uniqueNumber) return el; 3341 var type = typeOf(el); 3342 return (types[type]) ? types[type](el, nocash, doc || document) : null; 3343 }; 3344 3345 })() 3346 3347}); 3348 3349if (window.$ == null) Window.implement('$', function(el, nc){ 3350 return document.id(el, nc, this.document); 3351}); 3352 3353Window.implement({ 3354 3355 getDocument: function(){ 3356 return this.document; 3357 }, 3358 3359 getWindow: function(){ 3360 return this; 3361 } 3362 3363}); 3364 3365[Document, Element].invoke('implement', { 3366 3367 getElements: function(expression){ 3368 return Slick.search(this, expression, new Elements); 3369 }, 3370 3371 getElement: function(expression){ 3372 return document.id(Slick.find(this, expression)); 3373 } 3374 3375}); 3376
3377var contains = {contains: function(element){ 3378 return Slick.contains(this, element); 3379}}; 3380 3381if (!document.contains) Document.implement(contains); 3382if (!document.createElement('div').contains) Element.implement(contains); 3383 3384//<1.2compat> 3385 3386Element.implement('hasChild', function(element){ 3387 return this !== element && this.contains(element); 3388}); 3389 3390(function(search, find, match){ 3391 3392 this.Selectors = {}; 3393 var pseudos = this.Selectors.Pseudo = new Hash(); 3394 3395 var addSlickPseudos = function(){ 3396 for (var name in pseudos) if (pseudos.hasOwnProperty(name)){ 3397 Slick.definePseudo(name, pseudos[name]); 3398 delete pseudos[name]; 3399 } 3400 }; 3401 3402 Slick.search = function(context, expression, append){ 3403 addSlickPseudos(); 3404 return search.call(this, context, expression, append); 3405 }; 3406 3407 Slick.find = function(context, expression){ 3408 addSlickPseudos(); 3409 return find.call(this, context, expression); 3410 }; 3411 3412 Slick.match = function(node, selector){ 3413 addSlickPseudos(); 3414 return match.call(this, node, selector); 3415 }; 3416 3417})(Slick.search, Slick.find, Slick.match); 3418 3419//</1.2compat> 3420 3421// tree walking 3422 3423var injectCombinator = function(expression, combinator){ 3424 if (!expression) return combinator; 3425 3426 expression = Object.clone(Slick.parse(expression)); 3427 3428 var expressions = expression.expressions; 3429 for (var i = expressions.length; i--;) 3430 expressions[i][0].combinator = combinator; 3431 3432 return expression; 3433}; 3434 3435Object.forEach({ 3436 getNext: '~', 3437 getPrevious: '!~', 3438 getParent: '!' 3439}, function(combinator, method){ 3440 Element.implement(method, function(expression){ 3441 return this.getElement(injectCombinator(expression, combinator)); 3442 }); 3443}); 3444 3445Object.forEach({ 3446 getAllNext: '~', 3447 getAllPrevious: '!~', 3448 getSiblings: '~~', 3449 getChildren: '>', 3450 getParents: '!' 3451}, function(combinator, method){ 3452 Element.implement(method, function(expression){ 3453 return this.getElements(injectCombinator(expression, combinator)); 3454 }); 3455}); 3456 3457Element.implement({ 3458 3459 getFirst: function(expression){ 3460 return document.id(Slick.search(this, injectCombinator(expression, '>'))[0]); 3461 }, 3462 3463 getLast: function(expression){ 3464 return document.id(Slick.search(this, injectCombinator(expression, '>')).getLast()); 3465 }, 3466 3467 getWindow: function(){ 3468 return this.ownerDocument.window; 3469 }, 3470 3471 getDocument: function(){ 3472 return this.ownerDocument; 3473 }, 3474 3475 getElementById: function(id){ 3476 return document.id(Slick.find(this, '#' + ('' + id).replace(/(\W)/g, '\\$1'))); 3477 }, 3478 3479 match: function(expression){ 3480 return !expression || Slick.match(this, expression); 3481 } 3482 3483}); 3484 3485//<1.2compat> 3486 3487if (window.$$ == null) Window.implement('$$', function(selector){ 3488 var elements = new Elements; 3489 if (arguments.length == 1 && typeof selector == 'string') return Slick.search(this.document, selector, elements); 3490 var args = Array.flatten(arguments); 3491 for (var i = 0, l = args.length; i < l; i++){ 3492 var item = args[i]; 3493 switch (typeOf(item)){ 3494 case 'element': elements.push(item); break; 3495 case 'string': Slick.search(this.document, item, elements); 3496 } 3497 } 3498 return elements; 3499}); 3500 3501//</1.2compat> 3502 3503if (window.$$ == null) Window.implement('$$', function(selector){ 3504 if (arguments.length == 1){ 3505 if (typeof selector == 'string') return Slick.search(this.document, selector, new Elements); 3506 else if (Type.isEnumerable(selector)) return new Elements(selector); 3507 } 3508 return new Elements(arguments); 3509}); 3510 3511// Inserters 3512 3513var inserters = { 3514 3515 before: function(context, element){ 3516 var parent = element.parentNode; 3517 if (parent) parent.insertBefore(context, element); 3518 }, 3519 3520 after: function(context, element){ 3521 var parent = element.parentNode; 3522 if (parent) parent.insertBefore(context, element.nextSibling); 3523 }, 3524 3525 bottom: function(context, element){ 3526 element.appendChild(context); 3527 }, 3528 3529 top: function(context, element){ 3530 element.insertBefore(context, element.firstChild); 3531 } 3532 3533}; 3534 3535inserters.inside = inserters.bottom; 3536 3537//<1.2compat> 3538 3539Object.each(inserters, function(inserter, where){ 3540 3541 where = where.capitalize(); 3542 3543 var methods = {}; 3544 3545 methods['inject' + where] = function(el){ 3546 inserter(this, document.id(el, true)); 3547 return this; 3548 }; 3549 3550 methods['grab' + where] = function(el){ 3551 inserter(document.id(el, true), this); 3552 return this; 3553 }; 3554 3555 Element.implement(methods); 3556 3557}); 3558 3559//</1.2compat> 3560 3561// getProperty / setProperty 3562 3563var propertyGetters = {}, propertySetters = {}; 3564 3565// properties 3566 3567var properties = {}; 3568Array.forEach([ 3569 'type', 'value', 'defaultValue', 'accessKey', 'cellPadding', 'cellSpacing', 'colSpan', 3570 'frameBorder', 'rowSpan', 'tabIndex', 'useMap' 3571], function(property){ 3572 properties[property.toLowerCase()] = property; 3573}); 3574 3575properties.html = 'innerHTML'; 3576properties.text = (document.createElement('div').textContent == null) ? 'innerText': 'textContent'; 3577 3578Object.forEach(properties, function(real, key){ 3579 propertySetters[key] = function(node, value){ 3580 node[real] = value; 3581 }; 3582 propertyGetters[key] = function(node){ 3583 return node[real]; 3584 }; 3585}); 3586 3587// Booleans 3588 3589var bools = [ 3590 'compact', 'nowrap', 'ismap', 'declare', 'noshade', 'checked', 3591 'disabled', 'readOnly', 'multiple', 'selected', 'noresize', 3592 'defer', 'defaultChecked', 'autofocus', 'controls', 'autoplay', 3593 'loop' 3594]; 3595 3596var booleans = {}; 3597Array.forEach(bools, function(bool){ 3598 var lower = bool.toLowerCase(); 3599 booleans[lower] = bool; 3600 propertySetters[lower] = function(node, value){ 3601 node[bool] = !!value; 3602 }; 3603 propertyGetters[lower] = function(node){ 3604 return !!node[bool]; 3605 }; 3606}); 3607 3608// Special cases 3609 3610Object.append(propertySetters, { 3611 3612 'class': function(node, value){ 3613 ('className' in node) ? node.className = (value || '') : node.setAttribute('class', value); 3614 }, 3615 3616 'for': function(node, value){ 3617 ('htmlFor' in node) ? node.htmlFor = value : node.setAttribute('for', value); 3618 }, 3619 3620 'style': function(node, value){ 3621 (node.style) ? node.style.cssText = value : node.setAttribute('style', value); 3622 }, 3623 3624 'value': function(node, value){ 3625 node.value = (value != null) ? value : ''; 3626 } 3627 3628}); 3629 3630propertyGetters['class'] = function(node){ 3631 return ('className' in node) ? node.className || null : node.getAttribute('class'); 3632}; 3633 3634/* <webkit> */ 3635var el = document.createElement('button'); 3636// IE sets type as readonly and throws 3637try { el.type = 'button'; } catch(e){} 3638if (el.type != 'button') propertySetters.type = function(node, value){
3639 node.setAttribute('type', value); 3640}; 3641el = null; 3642/* </webkit> */ 3643 3644/*<IE>*/ 3645var input = document.createElement('input'); 3646input.value = 't'; 3647input.type = 'submit'; 3648if (input.value != 't') propertySetters.type = function(node, type){ 3649 var value = node.value; 3650 node.type = type; 3651 node.value = value; 3652}; 3653input = null; 3654/*</IE>*/ 3655 3656/* getProperty, setProperty */ 3657 3658/* <ltIE9> */ 3659var pollutesGetAttribute = (function(div){ 3660 div.random = 'attribute'; 3661 return (div.getAttribute('random') == 'attribute'); 3662})(document.createElement('div')); 3663 3664/* <ltIE9> */ 3665 3666Element.implement({ 3667 3668 setProperty: function(name, value){ 3669 var setter = propertySetters[name.toLowerCase()]; 3670 if (setter){ 3671 setter(this, value); 3672 } else { 3673 /* <ltIE9> */ 3674 if (pollutesGetAttribute) var attributeWhiteList = this.retrieve('$attributeWhiteList', {}); 3675 /* </ltIE9> */ 3676 3677 if (value == null){ 3678 this.removeAttribute(name); 3679 /* <ltIE9> */ 3680 if (pollutesGetAttribute) delete attributeWhiteList[name]; 3681 /* </ltIE9> */ 3682 } else { 3683 this.setAttribute(name, '' + value); 3684 /* <ltIE9> */ 3685 if (pollutesGetAttribute) attributeWhiteList[name] = true; 3686 /* </ltIE9> */ 3687 } 3688 } 3689 return this; 3690 }, 3691 3692 setProperties: function(attributes){ 3693 for (var attribute in attributes) this.setProperty(attribute, attributes[attribute]); 3694 return this; 3695 }, 3696 3697 getProperty: function(name){ 3698 var getter = propertyGetters[name.toLowerCase()]; 3699 if (getter) return getter(this); 3700 /* <ltIE9> */ 3701 if (pollutesGetAttribute){ 3702 var attr = this.getAttributeNode(name), attributeWhiteList = this.retrieve('$attributeWhiteList', {}); 3703 if (!attr) return null; 3704 if (attr.expando && !attributeWhiteList[name]){ 3705 var outer = this.outerHTML; 3706 // segment by the opening tag and find mention of attribute name 3707 if (outer.substr(0, outer.search(/\/?['"]?>(?![^<]*<['"])/)).indexOf(name) < 0) return null; 3708 attributeWhiteList[name] = true; 3709 } 3710 } 3711 /* </ltIE9> */ 3712 var result = Slick.getAttribute(this, name); 3713 return (!result && !Slick.hasAttribute(this, name)) ? null : result; 3714 }, 3715 3716 getProperties: function(){ 3717 var args = Array.from(arguments); 3718 return args.map(this.getProperty, this).associate(args); 3719 }, 3720 3721 removeProperty: function(name){ 3722 return this.setProperty(name, null); 3723 }, 3724 3725 removeProperties: function(){ 3726 Array.each(arguments, this.removeProperty, this); 3727 return this; 3728 }, 3729 3730 set: function(prop, value){ 3731 var property = Element.Properties[prop]; 3732 (property && property.set) ? property.set.call(this, value) : this.setProperty(prop, value); 3733 }.overloadSetter(), 3734 3735 get: function(prop){ 3736 var property = Element.Properties[prop]; 3737 return (property && property.get) ? property.get.apply(this) : this.getProperty(prop); 3738 }.overloadGetter(), 3739 3740 erase: function(prop){ 3741 var property = Element.Properties[prop]; 3742 (property && property.erase) ? property.erase.apply(this) : this.removeProperty(prop); 3743 return this; 3744 }, 3745 3746 hasClass: function(className){ 3747 return this.className.clean().contains(className, ' '); 3748 }, 3749 3750 addClass: function(className){ 3751 if (!this.hasClass(className)) this.className = (this.className + ' ' + className).clean(); 3752 return this; 3753 }, 3754 3755 removeClass: function(className){ 3756 this.className = this.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)'), '$1'); 3757 return this; 3758 }, 3759 3760 toggleClass: function(className, force){ 3761 if (force == null) force = !this.hasClass(className); 3762 return (force) ? this.addClass(className) : this.removeClass(className); 3763 }, 3764 3765 adopt: function(){ 3766 var parent = this, fragment, elements = Array.flatten(arguments), length = elements.length; 3767 if (length > 1) parent = fragment = document.createDocumentFragment(); 3768 3769 for (var i = 0; i < length; i++){ 3770 var element = document.id(elements[i], true); 3771 if (element) parent.appendChild(element); 3772 } 3773 3774 if (fragment) this.appendChild(fragment); 3775 3776 return this; 3777 }, 3778 3779 appendText: function(text, where){ 3780 return this.grab(this.getDocument().newTextNode(text), where); 3781 }, 3782 3783 grab: function(el, where){ 3784 inserters[where || 'bottom'](document.id(el, true), this); 3785 return this; 3786 }, 3787 3788 inject: function(el, where){ 3789 inserters[where || 'bottom'](this, document.id(el, true)); 3790 return this; 3791 }, 3792 3793 replaces: function(el){ 3794 el = document.id(el, true); 3795 el.parentNode.replaceChild(this, el); 3796 return this; 3797 }, 3798 3799 wraps: function(el, where){ 3800 el = document.id(el, true); 3801 return this.replaces(el).grab(el, where); 3802 }, 3803 3804 getSelected: function(){ 3805 this.selectedIndex; // Safari 3.2.1 3806 return new Elements(Array.from(this.options).filter(function(option){ 3807 return option.selected; 3808 })); 3809 }, 3810 3811 toQueryString: function(){ 3812 var queryString = []; 3813 this.getElements('input, select, textarea').each(function(el){ 3814 var type = el.type; 3815 if (!el.name || el.disabled || type == 'submit' || type == 'reset' || type == 'file' || type == 'image') return; 3816 3817 var value = (el.get('tag') == 'select') ? el.getSelected().map(function(opt){ 3818 // IE 3819 return document.id(opt).get('value'); 3820 }) : ((type == 'radio' || type == 'checkbox') && !el.checked) ? null : el.get('value'); 3821 3822 Array.from(value).each(function(val){ 3823 if (typeof val != 'undefined') queryString.push(encodeURIComponent(el.name) + '=' + encodeURIComponent(val)); 3824 }); 3825 }); 3826 return queryString.join('&'); 3827 } 3828 3829}); 3830
3831var collected = {}, storage = {}; 3832 3833var get = function(uid){ 3834 return (storage[uid] || (storage[uid] = {})); 3835}; 3836 3837var clean = function(item){ 3838 var uid = item.uniqueNumber; 3839 if (item.removeEvents) item.removeEvents(); 3840 if (item.clearAttributes) item.clearAttributes(); 3841 if (uid != null){ 3842 delete collected[uid]; 3843 delete storage[uid]; 3844 } 3845 return item; 3846}; 3847 3848var formProps = {input: 'checked', option: 'selected', textarea: 'value'}; 3849 3850Element.implement({ 3851 3852 destroy: function(){ 3853 var children = clean(this).getElementsByTagName('*'); 3854 Array.each(children, clean); 3855 Element.dispose(this); 3856 return null; 3857 }, 3858 3859 empty: function(){ 3860 Array.from(this.childNodes).each(Element.dispose); 3861 return this; 3862 }, 3863 3864 dispose: function(){ 3865 return (this.parentNode) ? this.parentNode.removeChild(this) : this; 3866 }, 3867 3868 clone: function(contents, keepid){ 3869 contents = contents !== false; 3870 var clone = this.cloneNode(contents), ce = [clone], te = [this], i; 3871 3872 if (contents){ 3873 ce.append(Array.from(clone.getElementsByTagName('*'))); 3874 te.append(Array.from(this.getElementsByTagName('*'))); 3875 } 3876 3877 for (i = ce.length; i--;){ 3878 var node = ce[i], element = te[i]; 3879 if (!keepid) node.removeAttribute('id'); 3880 /*<ltIE9>*/ 3881 if (node.clearAttributes){ 3882 node.clearAttributes(); 3883 node.mergeAttributes(element); 3884 node.removeAttribute('uniqueNumber'); 3885 if (node.options){ 3886 var no = node.options, eo = element.options; 3887 for (var j = no.length; j--;) no[j].selected = eo[j].selected; 3888 } 3889 } 3890 /*</ltIE9>*/ 3891 var prop = formProps[element.tagName.toLowerCase()]; 3892 if (prop && element[prop]) node[prop] = element[prop]; 3893 } 3894 3895 /*<ltIE9>*/ 3896 if (Browser.ie){ 3897 var co = clone.getElementsByTagName('object'), to = this.getElementsByTagName('object'); 3898 for (i = co.length; i--;) co[i].outerHTML = to[i].outerHTML; 3899 } 3900 /*</ltIE9>*/ 3901 return document.id(clone); 3902 } 3903 3904}); 3905 3906[Element, Window, Document].invoke('implement', { 3907 3908 addListener: function(type, fn){ 3909 if (type == 'unload'){ 3910 var old = fn, self = this; 3911 fn = function(){ 3912 self.removeListener('unload', fn); 3913 old(); 3914 }; 3915 } else { 3916 collected[Slick.uidOf(this)] = this; 3917 } 3918 if (this.addEventListener) this.addEventListener(type, fn, !!arguments[2]); 3919 else this.attachEvent('on' + type, fn); 3920 return this; 3921 }, 3922 3923 removeListener: function(type, fn){ 3924 if (this.removeEventListener) this.removeEventListener(type, fn, !!arguments[2]); 3925 else this.detachEvent('on' + type, fn); 3926 return this; 3927 }, 3928 3929 retrieve: function(property, dflt){ 3930 var storage = get(Slick.uidOf(this)), prop = storage[property]; 3931 if (dflt != null && prop == null) prop = storage[property] = dflt; 3932 return prop != null ? prop : null; 3933 }, 3934 3935 store: function(property, value){ 3936 var storage = get(Slick.uidOf(this)); 3937 storage[property] = value; 3938 return this; 3939 }, 3940 3941 eliminate: function(property){ 3942 var storage = get(Slick.uidOf(this)); 3943 delete storage[property]; 3944 return this; 3945 } 3946 3947}); 3948 3949/*<ltIE9>*/ 3950if (window.attachEvent && !window.addEventListener) window.addListener('unload', function(){ 3951 Object.each(collected, clean); 3952 if (window.CollectGarbage) CollectGarbage(); 3953}); 3954/*</ltIE9>*/ 3955 3956Element.Properties = {}; 3957 3958//<1.2compat> 3959 3960Element.Properties = new Hash; 3961 3962//</1.2compat> 3963 3964Element.Properties.style = { 3965 3966 set: function(style){ 3967 this.style.cssText = style; 3968 }, 3969 3970 get: function(){ 3971 return this.style.cssText; 3972 }, 3973 3974 erase: function(){ 3975 this.style.cssText = ''; 3976 } 3977 3978}; 3979 3980Element.Properties.tag = { 3981 3982 get: function(){ 3983 return this.tagName.toLowerCase(); 3984 } 3985 3986}; 3987 3988Element.Properties.html = { 3989 3990 set: function(html){ 3991 if (html == null) html = ''; 3992 else if (typeOf(html) == 'array') html = html.join(''); 3993 this.innerHTML = html; 3994 }, 3995 3996 erase: function(){ 3997 this.innerHTML = ''; 3998 } 3999 4000}; 4001 4002/*<ltIE9>*/ 4003// technique by jdbarlett - http://jdbartlett.com/innershiv/ 4004var div = document.createElement('div'); 4005div.innerHTML = '<nav></nav>'; 4006var supportsHTML5Elements = (div.childNodes.length == 1); 4007if (!supportsHTML5Elements){ 4008 var tags = 'abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video'.split(' '), 4009 fragment = document.createDocumentFragment(), l = tags.length; 4010 while (l--) fragment.createElement(tags[l]); 4011} 4012div = null; 4013/*</ltIE9>*/ 4014 4015/*<IE>*/ 4016var supportsTableInnerHTML = Function.attempt(function(){ 4017 var table = document.createElement('table'); 4018 table.innerHTML = '<tr><td></td></tr>'; 4019 return true; 4020}); 4021 4022/*<ltFF4>*/ 4023var tr = document.createElement('tr'), html = '<td></td>'; 4024tr.innerHTML = html; 4025var supportsTRInnerHTML = (tr.innerHTML == html); 4026tr = null; 4027/*</ltFF4>*/ 4028 4029if (!supportsTableInnerHTML || !supportsTRInnerHTML || !supportsHTML5Elements){ 4030 4031 Element.Properties.html.set = (function(set){ 4032 4033 var translations = { 4034 table: [1, '<table>', '</table>'], 4035 select: [1, '<select>', '</select>'], 4036 tbody: [2, '<table><tbody>', '</tbody></table>'], 4037 tr: [3, '<table><tbody><tr>', '</tr></tbody></table>'] 4038 }; 4039 4040 translations.thead = translations.tfoot = translations.tbody; 4041 4042 return function(html){ 4043 var wrap = translations[this.get('tag')]; 4044 if (!wrap && !supportsHTML5Elements) wrap = [0, '', '']; 4045 if (!wrap) return set.call(this, html); 4046 4047 var level = wrap[0], wrapper = document.createElement('div'), target = wrapper; 4048 if (!supportsHTML5Elements) fragment.appendChild(wrapper); 4049 wrapper.innerHTML = [wrap[1], html, wrap[2]].flatten().join(''); 4050 while (level--) target = target.firstChild; 4051 this.empty().adopt(target.childNodes); 4052 if (!supportsHTML5Elements) fragment.removeChild(wrapper); 4053 wrapper = null; 4054 }; 4055 4056 })(Element.Properties.html.set); 4057} 4058/*</IE>*/ 4059 4060/*<ltIE9>*/ 4061var testForm = document.createElement('form'); 4062testForm.innerHTML = '<select><option>s</option></select>'; 4063 4064if (testForm.firstChild.value != 's') Element.Properties.value = { 4065 4066 set: function(value){ 4067 var tag = this.get('tag'); 4068 if (tag != 'select') return this.setProperty('value', value); 4069 var options = this.getElements('option'); 4070 for (var i = 0; i < options.length; i++){ 4071 var option = options[i], 4072 attr = option.getAttributeNode('value'), 4073 optionValue = (attr && attr.specified) ? option.value : option.get('text'); 4074 if (optionValue == value) return option.selected = true; 4075 } 4076 }, 4077 4078 get: function(){ 4079 var option = this, tag = option.get('tag'); 4080 4081 if (tag != 'select' && tag != 'option') return this.getProperty('value'); 4082 4083 if (tag == 'select' && !(option = option.getSelected()[0])) return ''; 4084 4085 var attr = option.getAttributeNode('value'); 4086 return (attr && attr.specified) ? option.value : option.get('text'); 4087 } 4088 4089}; 4090testForm = null; 4091/*</ltIE9>*/ 4092 4093/*<IE>*/ 4094if (document.createElement('div').getAttributeNode('id')) Element.Properties.id = { 4095 set: function(id){ 4096 this.id = this.getAttributeNode('id').value = id; 4097 }, 4098 get: function(){ 4099 return this.id || null; 4100 }, 4101 erase: function(){ 4102 this.id = this.getAttributeNode('id').value = ''; 4103 } 4104}; 4105/*</IE>*/ 4106 4107})(); 4108 4109 4110/* 4111--- 4112 4113name: Element.Style 4114 4115description: Contains methods for interacting with the styles of Elements in a fas
4115hionable way. 4116 4117license: MIT-style license. 4118 4119requires: Element 4120 4121provides: Element.Style 4122 4123... 4124*/ 4125 4126(function(){ 4127 4128var html = document.html; 4129 4130//<ltIE9> 4131// Check for oldIE, which does not remove styles when they're set to null 4132var el = document.createElement('div'); 4133el.style.color = 'red'; 4134el.style.color = null; 4135var doesNotRemoveStyles = el.style.color == 'red'; 4136el = null; 4137//</ltIE9> 4138 4139Element.Properties.styles = {set: function(styles){ 4140 this.setStyles(styles); 4141}}; 4142 4143var hasOpacity = (html.style.opacity != null), 4144 hasFilter = (html.style.filter != null), 4145 reAlpha = /alpha\(opacity=([\d.]+)\)/i; 4146 4147var setVisibility = function(element, opacity){ 4148 element.store('$opacity', opacity); 4149 element.style.visibility = opacity > 0 || opacity == null ? 'visible' : 'hidden'; 4150}; 4151 4152var setOpacity = (hasOpacity ? function(element, opacity){ 4153 element.style.opacity = opacity; 4154} : (hasFilter ? function(element, opacity){ 4155 var style = element.style; 4156 if (!element.currentStyle || !element.currentStyle.hasLayout) style.zoom = 1; 4157 if (opacity == null || opacity == 1) opacity = ''; 4158 else opacity = 'alpha(opacity=' + (opacity * 100).limit(0, 100).round() + ')'; 4159 var filter = style.filter || element.getComputedStyle('filter') || ''; 4160 style.filter = reAlpha.test(filter) ? filter.replace(reAlpha, opacity) : filter + opacity; 4161 if (!style.filter) style.removeAttribute('filter'); 4162} : setVisibility)); 4163 4164var getOpacity = (hasOpacity ? function(element){ 4165 var opacity = element.style.opacity || element.getComputedStyle('opacity'); 4166 return (opacity == '') ? 1 : opacity.toFloat(); 4167} : (hasFilter ? function(element){ 4168 var filter = (element.style.filter || element.getComputedStyle('filter')), 4169 opacity; 4170 if (filter) opacity = filter.match(reAlpha); 4171 return (opacity == null || filter == null) ? 1 : (opacity[1] / 100); 4172} : function(element){ 4173 var opacity = element.retrieve('$opacity'); 4174 if (opacity == null) opacity = (element.style.visibility == 'hidden' ? 0 : 1); 4175 return opacity; 4176})); 4177 4178var floatName = (html.style.cssFloat == null) ? 'styleFloat' : 'cssFloat'; 4179 4180Element.implement({ 4181 4182 getComputedStyle: function(property){ 4183 if (this.currentStyle) return this.currentStyle[property.camelCase()]; 4184 var defaultView = Element.getDocument(this).defaultView, 4185 computed = defaultView ? defaultView.getComputedStyle(this, null) : null; 4186 return (computed) ? computed.getPropertyValue((property == floatName) ? 'float' : property.hyphenate()) : null; 4187 }, 4188 4189 setStyle: function(property, value){ 4190 if (property == 'opacity'){ 4191 if (value != null) value = parseFloat(value); 4192 setOpacity(this, value); 4193 return this; 4194 } 4195 property = (property == 'float' ? floatName : property).camelCase(); 4196 if (typeOf(value) != 'string'){ 4197 var map = (Element.Styles[property] || '@').split(' '); 4198 value = Array.from(value).map(function(val, i){ 4199 if (!map[i]) return ''; 4200 return (typeOf(val) == 'number') ? map[i].replace('@', Math.round(val)) : val; 4201 }).join(' '); 4202 } else if (value == String(Number(value))){ 4203 value = Math.round(value); 4204 } 4205 this.style[property] = value; 4206 //<ltIE9> 4207 if ((value == '' || value == null) && doesNotRemoveStyles && this.style.removeAttribute){ 4208 this.style.removeAttribute(property); 4209 } 4210 //</ltIE9> 4211 return this; 4212 }, 4213 4214 getStyle: function(property){ 4215 if (property == 'opacity') return getOpacity(this); 4216 property = (property == 'float' ? floatName : property).camelCase(); 4217 var result = this.style[property]; 4218 if (!result || property == 'zIndex'){ 4219 result = []; 4220 for (var style in Element.ShortStyles){ 4221 if (property != style) continue; 4222 for (var s in Element.ShortStyles[style]) result.push(this.getStyle(s)); 4223 return result.join(' '); 4224 } 4225 result = this.getComputedStyle(property); 4226 } 4227 if (result){ 4228 result = String(result); 4229 var color = result.match(/rgba?\([\d\s,]+\)/); 4230 if (color) result = result.replace(color[0], color[0].rgbToHex()); 4231 } 4232 if (Browser.opera || Browser.ie){ 4233 if ((/^(height|width)$/).test(property) && !(/px$/.test(result))){ 4234 var values = (property == 'width') ? ['left', 'right'] : ['top', 'bottom'], size = 0; 4235 values.each(function(value){
4236 size += this.getStyle('border-' + value + '-width').toInt() + this.getStyle('padding-' + value).toInt(); 4237 }, this); 4238 return this['offset' + property.capitalize()] - size + 'px'; 4239 } 4240 if (Browser.ie && (/^border(.+)Width|margin|padding/).test(property) && isNaN(parseFloat(result))){ 4241 return '0px'; 4242 } 4243 } 4244 return result; 4245 }, 4246 4247 setStyles: function(styles){ 4248 for (var style in styles) this.setStyle(style, styles[style]); 4249 return this; 4250 }, 4251 4252 getStyles: function(){ 4253 var result = {}; 4254 Array.flatten(arguments).each(function(key){ 4255 result[key] = this.getStyle(key); 4256 }, this); 4257 return result; 4258 } 4259 4260}); 4261 4262Element.Styles = { 4263 left: '@px', top: '@px', bottom: '@px', right: '@px', 4264 width: '@px', height: '@px', maxWidth: '@px', maxHeight: '@px', minWidth: '@px', minHeight: '@px', 4265 backgroundColor: 'rgb(@, @, @)', backgroundPosition: '@px @px', color: 'rgb(@, @, @)', 4266 fontSize: '@px', letterSpacing: '@px', lineHeight: '@px', clip: 'rect(@px @px @px @px)', 4267 margin: '@px @px @px @px', padding: '@px @px @px @px', border: '@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)', 4268 borderWidth: '@px @px @px @px', borderStyle: '@ @ @ @', borderColor: 'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)', 4269 zIndex: '@', 'zoom': '@', fontWeight: '@', textIndent: '@px', opacity: '@' 4270}; 4271 4272//<1.3compat> 4273 4274Element.implement({ 4275 4276 setOpacity: function(value){ 4277 setOpacity(this, value); 4278 return this; 4279 }, 4280 4281 getOpacity: function(){ 4282 return getOpacity(this); 4283 } 4284 4285}); 4286 4287Element.Properties.opacity = { 4288 4289 set: function(opacity){ 4290 setOpacity(this, opacity); 4291 setVisibility(this, opacity); 4292 }, 4293 4294 get: function(){ 4295 return getOpacity(this); 4296 } 4297 4298}; 4299 4300//</1.3compat> 4301 4302//<1.2compat> 4303 4304Element.Styles = new Hash(Element.Styles); 4305 4306//</1.2compat> 4307 4308Element.ShortStyles = {margin: {}, padding: {}, border: {}, borderWidth: {}, borderStyle: {}, borderColor: {}}; 4309 4310['Top', 'Right', 'Bottom', 'Left'].each(function(direction){ 4311 var Short = Element.ShortStyles; 4312 var All = Element.Styles; 4313 ['margin', 'padding'].each(function(style){ 4314 var sd = style + direction; 4315 Short[style][sd] = All[sd] = '@px'; 4316 }); 4317 var bd = 'border' + direction; 4318 Short.border[bd] = All[bd] = '@px @ rgb(@, @, @)'; 4319 var bdw = bd + 'Width', bds = bd + 'Style', bdc = bd + 'Color'; 4320 Short[bd] = {}; 4321 Short.borderWidth[bdw] = Short[bd][bdw] = All[bdw] = '@px'; 4322 Short.borderStyle[bds] = Short[bd][bds] = All[bds] = '@'; 4323 Short.borderColor[bdc] = Short[bd][bdc] = All[bdc] = 'rgb(@, @, @)'; 4324}); 4325 4326})(); 4327 4328 4329/* 4330--- 4331 4332name: Element.Event 4333 4334description: Contains Element methods for dealing with events. This file also includes mouseenter and mouseleave custom Element Events, if necessary. 4335 4336license: MIT-style license. 4337 4338requires: [Element, Event] 4339 4340provides: Element.Event 4341 4342... 4343*/ 4344 4345(function(){ 4346 4347Element.Properties.events = {set: function(events){ 4348 this.addEvents(events); 4349}}; 4350 4351[Element, Window, Document].invoke('implement', { 4352 4353 addEvent: function(type, fn){ 4354 var events = this.retrieve('events', {}); 4355 if (!events[type]) events[type] = {keys: [], values: []}; 4356 if (events[type].keys.contains(fn)) return this; 4357 events[type].keys.push(fn); 4358 var realType = type, 4359 custom = Element.Events[type], 4360 condition = fn, 4361 self = this; 4362 if (custom){ 4363 if (custom.onAdd) custom.onAdd.call(this, fn, type); 4364 if (custom.condition){ 4365 condition = function(event){ 4366 if (custom.condition.call(this, event, type)) return fn.call(this, event); 4367 return true; 4368 }; 4369 } 4370 if (custom.base) realType = Function.from(custom.base).call(this, type); 4371 } 4372 var defn = function(){ 4373 return fn.call(self); 4374 }; 4375 var nativeEvent = Element.NativeEvents[realType]; 4376 if (nativeEvent){ 4377 if (nativeEvent == 2){ 4378 defn = function(event){ 4379 event = new DOMEvent(event, self.getWindow()); 4380 if (condition.call(self, event) === false) event.stop(); 4381 }; 4382 } 4383 this.addListener(realType, defn, arguments[2]); 4384 } 4385 events[type].values.push(defn); 4386 return this; 4387 }, 4388 4389 removeEvent: function(type, fn){ 4390 var events = this.retrieve('events'); 4391 if (!events || !events[type]) return this; 4392 var list = events[type]; 4393 var index = list.keys.indexOf(fn); 4394 if (index == -1) return this; 4395 var value = list.values[index]; 4396 delete list.keys[index]; 4397 delete list.values[index]; 4398 var custom = Element.Events[type]; 4399 if (custom){ 4400 if (custom.onRemove) custom.onRemove.call(this, fn, type); 4401 if (custom.base) type = Function.from(custom.base).call(this, type); 4402 } 4403 return (Element.NativeEvents[type]) ? this.removeListener(type, value, arguments[2]) : this; 4404 }, 4405 4406 addEvents: function(events){ 4407 for (var event in events) this.addEvent(event, events[event]); 4408 return this; 4409 }, 4410 4411 removeEvents: function(events){ 4412 var type; 4413 if (typeOf(events) == 'object'){ 4414 for (type in events) this.removeEvent(type, events[type]); 4415 return this; 4416 } 4417 var attached = this.retrieve('events'); 4418 if (!attached) return this; 4419 if (!events){ 4420 for (type in attached) this.removeEvents(type); 4421 this.eliminate('events'); 4422 } else if (attached[events]){ 4423 attached[events].keys.each(function(fn){ 4424 this.removeEvent(events, fn); 4425 }, this); 4426 delete attached[events]; 4427 } 4428 return this; 4429 }, 4430 4431 fireEvent: function(type, args, delay){ 4432 var events = this.retrieve('events'); 4433 if (!events || !events[type]) return this; 4434 args = Array.from(args); 4435 4436 events[type].keys.each(function(fn){ 4437 if (delay) fn.delay(delay, this, args); 4438 else fn.apply(this, args); 4439 }, this); 4440 return this; 4441 }, 4442 4443 cloneEvents: function(from, type){ 4444 from = document.id(from); 4445 var events = from.retrieve('events'); 4446 if (!events) return this; 4447 if (!type){ 4448 for (var eventType in events) this.cloneEvents(from, eventType); 4449 } else if (events[type]){ 4450 events[type].keys.each(function(fn){
4451 this.addEvent(type, fn); 4452 }, this); 4453 } 4454 return this; 4455 } 4456 4457}); 4458 4459Element.NativeEvents = { 4460 click: 2, dblclick: 2, mouseup: 2, mousedown: 2, contextmenu: 2, //mouse buttons 4461 mousewheel: 2, DOMMouseScroll: 2, //mouse wheel 4462 mouseover: 2, mouseout: 2, mousemove: 2, selectstart: 2, selectend: 2, //mouse movement 4463 keydown: 2, keypress: 2, keyup: 2, //keyboard 4464 orientationchange: 2, // mobile 4465 touchstart: 2, touchmove: 2, touchend: 2, touchcancel: 2, // touch 4466 gesturestart: 2, gesturechange: 2, gestureend: 2, // gesture 4467 focus: 2, blur: 2, change: 2, reset: 2, select: 2, submit: 2, paste: 2, input: 2, //form elements 4468 load: 2, unload: 1, beforeunload: 2, resize: 1, move: 1, DOMContentLoaded: 1, readystatechange: 1, //window 4469 error: 1, abort: 1, scroll: 1 //misc 4470}; 4471 4472Element.Events = {mousewheel: { 4473 base: (Browser.firefox) ? 'DOMMouseScroll' : 'mousewheel' 4474}}; 4475 4476if ('onmouseenter' in document.documentElement){ 4477 Element.NativeEvents.mouseenter = Element.NativeEvents.mouseleave = 2; 4478} else { 4479 var check = function(event){ 4480 var related = event.relatedTarget; 4481 if (related == null) return true; 4482 if (!related) return false; 4483 return (related != this && related.prefix != 'xul' && typeOf(this) != 'document' && !this.contains(related)); 4484 }; 4485 4486 Element.Events.mouseenter = { 4487 base: 'mouseover', 4488 condition: check 4489 }; 4490 4491 Element.Events.mouseleave = { 4492 base: 'mouseout', 4493 condition: check 4494 }; 4495} 4496 4497/*<ltIE9>*/ 4498if (!window.addEventListener){ 4499 Element.NativeEvents.propertychange = 2; 4500 Element.Events.change = { 4501 base: function(){ 4502 var type = this.type; 4503 return (this.get('tag') == 'input' && (type == 'radio' || type == 'checkbox')) ? 'propertychange' : 'change' 4504 }, 4505 condition: function(event){ 4506 return this.type != 'radio' || (event.event.propertyName == 'checked' && this.checked); 4507 } 4508 } 4509} 4510/*</ltIE9>*/ 4511 4512//<1.2compat> 4513 4514Element.Events = new Hash(Element.Events); 4515 4516//</1.2compat> 4517 4518})(); 4519 4520 4521/* 4522--- 4523 4524name: Element.Delegation 4525 4526description: Extends the Element native object to include the delegate method for more efficient event management. 4527 4528license: MIT-style license. 4529 4530requires: [Element.Event] 4531 4532provides: [Element.Delegation] 4533 4534... 4535*/ 4536 4537(function(){ 4538 4539var eventListenerSupport = !!window.addEventListener; 4540 4541Element.NativeEvents.focusin = Element.NativeEvents.focusout = 2; 4542 4543var bubbleUp = function(self, match, fn, event, target){ 4544 while (target && target != self){ 4545 if (match(target, event)) return fn.call(target, event, target); 4546 target = document.id(target.parentNode); 4547 } 4548}; 4549 4550var map = { 4551 mouseenter: { 4552 base: 'mouseover' 4553 }, 4554 mouseleave: { 4555 base: 'mouseout' 4556 }, 4557 focus: { 4558 base: 'focus' + (eventListenerSupport ? '' : 'in'), 4559 capture: true 4560 }, 4561 blur: { 4562 base: eventListenerSupport ? 'blur' : 'focusout', 4563 capture: true 4564 } 4565}; 4566 4567/*<ltIE9>*/ 4568var _key = '$delegation:'; 4569var formObserver = function(type){ 4570 4571 return { 4572 4573 base: 'focusin', 4574 4575 remove: function(self, uid){ 4576 var list = self.retrieve(_key + type + 'listeners', {})[uid]; 4577 if (list && list.forms) for (var i = list.forms.length; i--;){ 4578 list.forms[i].removeEvent(type, list.fns[i]); 4579 } 4580 }, 4581 4582 listen: function(self, match, fn, event, target, uid){ 4583 var form = (target.get('tag') == 'form') ? target : event.target.getParent('form'); 4584 if (!form) return; 4585 4586 var listeners = self.retrieve(_key + type + 'listeners', {}), 4587 listener = listeners[uid] || {forms: [], fns: []}, 4588 forms = listener.forms, fns = listener.fns; 4589 4590 if (forms.indexOf(form) != -1) return; 4591 forms.push(form); 4592 4593 var _fn = function(event){ 4594 bubbleUp(self, match, fn, event, target); 4595 }; 4596 form.addEvent(type, _fn); 4597 fns.push(_fn); 4598 4599 listeners[uid] = listener; 4600 self.store(_key + type + 'listeners', listeners); 4601 } 4602 }; 4603}; 4604 4605var inputObserver = function(type){ 4606 return { 4607 base: 'focusin', 4608 listen: function(self, match, fn, event, target){ 4609 var events = {blur: function(){ 4610 this.removeEvents(events); 4611 }}; 4612 events[type] = function(event){ 4613 bubbleUp(self, match, fn, event, target); 4614 }; 4615 event.target.addEvents(events); 4616 } 4617 }; 4618}; 4619 4620if (!eventListenerSupport) Object.append(map, { 4621 submit: formObserver('submit'), 4622 reset: formObserver('reset'), 4623 change: inputObserver('change'), 4624 select: inputObserver('select') 4625}); 4626/*</ltIE9>*/ 4627 4628var proto = Element.prototype, 4629 addEvent = proto.addEvent, 4630 removeEvent = proto.removeEvent; 4631 4632var relay = function(old, method){ 4633 return function(type, fn, useCapture){ 4634 if (type.indexOf(':relay') == -1) return old.call(this, type, fn, useCapture); 4635 var parsed = Slick.parse(type).expressions[0][0]; 4636 if (parsed.pseudos[0].key != 'relay') return old.call(this, type, fn, useCapture); 4637 var newType = parsed.tag; 4638 parsed.pseudos.slice(1).each(function(pseudo){ 4639 newType += ':' + pseudo.key + (pseudo.value ? '(' + pseudo.value + ')' : ''); 4640 }); 4641 old.call(this, type, fn); 4642 return method.call(this, newType, parsed.pseudos[0].value, fn); 4643 }; 4644}; 4645 4646var delegation = { 4647 4648 addEvent: function(type, match, fn){ 4649 var storage = this.retrieve('$delegates', {}), stored = storage[type]; 4650 if (stored) for (var _uid in stored){ 4651 if (stored[_uid].fn == fn && stored[_uid].match == match) return this; 4652 } 4653 4654 var _type = type, _match = match, _fn = fn, _map = map[type] || {}; 4655 type = _map.base || _type; 4656 4657 match = function(target){ 4658 return Slick.match(target, _match); 4659 }; 4660 4661 var elementEvent = Element.Events[_type]; 4662 if (elementEvent && elementEvent.condition){ 4663 var __match = match, condition = elementEvent.condition; 4664 match = function(target, event){ 4665 return __match(target, event) && condition.call(target, event, type); 4666 }; 4667 } 4668 4669 var self = this, uid = String.uniqueID(); 4670 var delegator = _map.listen ? function(event, target){ 4671 if (!target && event && event.target) target = event.target; 4672 if (target) _map.listen(self, match, fn, event, target, uid); 4673 } : function(event, target){ 4674 if (!target && event && event.target) target = event.target; 4675 if (target) bubbleUp(self, match, fn, event, target); 4676 }; 4677 4678 if (!stored) stored = {}; 4679 stored[uid] = { 4680 match: _match, 4681 fn: _fn, 4682 delegator: delegator 4683 }; 4684 storage[_type] = stored; 4685 return addEvent.call(this, type, delegator, _map.capture); 4686 }, 4687 4688 removeEvent: function(type, match, fn, _uid){ 4689 var storage = this.retrieve('$delegates', {}), stored = storage[type]; 4690 if (!stored) return this; 4691 4692 if (_uid){ 4693 var _type = type, delegator = stored[_uid].delegator, _map = map[type] || {}; 4694 type = _map.base || _type; 4695 if (_map.remove) _map.remove(this, _uid); 4696 delete stored[_uid]; 4697 storage[_type] = stored; 4698 return removeEvent.call(this, type, delegator); 4699 } 4700 4701 var __uid, s; 4702 if (fn) for (__uid in stored){ 4703 s = stored[__uid]; 4704 if (s.match == match && s.fn == fn) return delegation.removeEvent.call(this, type, match, fn, __uid); 4705 } else for (__uid in stored){ 4706 s = stored[__uid]; 4707 if (s.match == match) delegation.removeEvent.call(this, type, match, s.fn, __uid); 4708 } 4709 return this; 4710 } 4711 4712}; 4713 4714[Element, Window, Document].invoke('implement', { 4715 addEvent: relay(addEvent, delegation.addEvent), 4716 removeEvent: relay(removeEvent, delegation.removeEvent) 4717}); 4718 4719})(); 4720 4721 4722/* 4723--- 4724 4725name: Element.Dimensions 4726 4727description: Contains methods to work with size, scroll, or positioning of Elements and the window object. 4728 4729license: MIT-style license. 4730 4731credits: 4732 - Element positioning based on the [qooxdoo](http://qooxdoo.org/) code and smart browser fixes, [LGPL License](http://www.gnu.org/licenses/lgpl.html). 4733 - Viewport dimensions based on [YUI](http://developer.yahoo.com/yui
4733/) code, [BSD License](http://developer.yahoo.com/yui/license.html). 4734 4735requires: [Element, Element.Style] 4736 4737provides: [Element.Dimensions] 4738 4739... 4740*/ 4741 4742(function(){ 4743 4744var element = document.createElement('div'), 4745 child = document.createElement('div'); 4746element.style.height = '0'; 4747element.appendChild(child); 4748var brokenOffsetParent = (child.offsetParent === element); 4749element = child = null; 4750 4751var isOffset = function(el){ 4752 return styleString(el, 'position') != 'static' || isBody(el); 4753}; 4754 4755var isOffsetStatic = function(el){ 4756 return isOffset(el) || (/^(?:table|td|th)$/i).test(el.tagName); 4757}; 4758 4759Element.implement({ 4760 4761 scrollTo: function(x, y){ 4762 if (isBody(this)){ 4763 this.getWindow().scrollTo(x, y); 4764 } else { 4765 this.scrollLeft = x; 4766 this.scrollTop = y; 4767 } 4768 return this; 4769 }, 4770 4771 getSize: function(){ 4772 if (isBody(this)) return this.getWindow().getSize(); 4773 return {x: this.offsetWidth, y: this.offsetHeight}; 4774 }, 4775 4776 getScrollSize: function(){ 4777 if (isBody(this)) return this.getWindow().getScrollSize(); 4778 return {x: this.scrollWidth, y: this.scrollHeight}; 4779 }, 4780 4781 getScroll: function(){ 4782 if (isBody(this)) return this.getWindow().getScroll(); 4783 return {x: this.scrollLeft, y: this.scrollTop}; 4784 }, 4785 4786 getScrolls: function(){ 4787 var element = this.parentNode, position = {x: 0, y: 0}; 4788 while (element && !isBody(element)){ 4789 position.x += element.scrollLeft; 4790 position.y += element.scrollTop; 4791 element = element.parentNode; 4792 } 4793 return position; 4794 }, 4795 4796 getOffsetParent: brokenOffsetParent ? function(){ 4797 var element = this; 4798 if (isBody(element) || styleString(element, 'position') == 'fixed') return null; 4799 4800 var isOffsetCheck = (styleString(element, 'position') == 'static') ? isOffsetStatic : isOffset; 4801 while ((element = element.parentNode)){ 4802 if (isOffsetCheck(element)) return element; 4803 } 4804 return null; 4805 } : function(){ 4806 var element = this; 4807 if (isBody(element) || styleString(element, 'position') == 'fixed') return null; 4808 4809 try { 4810 return element.offsetParent; 4811 } catch(e) {} 4812 return null; 4813 }, 4814 4815 getOffsets: function(){ 4816 if (this.getBoundingClientRect && !Browser.Platform.ios){ 4817 var bound = this.getBoundingClientRect(), 4818 html = document.id(this.getDocument().documentElement), 4819 htmlScroll = html.getScroll(), 4820 elemScrolls = this.getScrolls(), 4821 isFixed = (styleString(this, 'position') == 'fixed'); 4822 4823 return { 4824 x: bound.left.toInt() + elemScrolls.x + ((isFixed) ? 0 : htmlScroll.x) - html.clientLeft, 4825 y: bound.top.toInt() + elemScrolls.y + ((isFixed) ? 0 : htmlScroll.y) - html.clientTop 4826 }; 4827 } 4828 4829 var element = this, position = {x: 0, y: 0}; 4830 if (isBody(this)) return position; 4831 4832 while (element && !isBody(element)){ 4833 position.x += element.offsetLeft; 4834 position.y += element.offsetTop; 4835 4836 if (Browser.firefox){ 4837 if (!borderBox(element)){ 4838 position.x += leftBorder(element); 4839 position.y += topBorder(element); 4840 } 4841 var parent = element.parentNode; 4842 if (parent && styleString(parent, 'overflow') != 'visible'){ 4843 position.x += leftBorder(parent); 4844 position.y += topBorder(parent); 4845 } 4846 } else if (element != this && Browser.safari){ 4847 position.x += leftBorder(element); 4848 position.y += topBorder(element); 4849 } 4850 4851 element = element.offsetParent; 4852 } 4853 if (Browser.firefox && !borderBox(this)){ 4854 position.x -= leftBorder(this); 4855 position.y -= topBorder(this); 4856 } 4857 return position; 4858 }, 4859 4860 getPosition: function(relative){ 4861 var offset = this.getOffsets(), 4862 scroll = this.getScrolls(); 4863 var position = { 4864 x: offset.x - scroll.x, 4865 y: offset.y - scroll.y 4866 }; 4867 4868 if (relative && (relative = document.id(relative))){ 4869 var relativePosition = relative.getPosition(); 4870 return {x: position.x - relativePosition.x - leftBorder(relative), y: position.y - relativePosition.y - topBorder(relative)}; 4871 } 4872 return position; 4873 }, 4874 4875 getCoordinates: function(element){ 4876 if (isBody(this)) return this.getWindow().getCoordinates(); 4877 var position = this.getPosition(element), 4878 size = this.getSize(); 4879 var obj = { 4880 left: position.x, 4881 top: position.y, 4882 width: size.x, 4883 height: size.y 4884 }; 4885 obj.right = obj.left + obj.width; 4886 obj.bottom = obj.top + obj.height; 4887 return obj; 4888 }, 4889 4890 computePosition: function(obj){ 4891 return { 4892 left: obj.x - styleNumber(this, 'margin-left'), 4893 top: obj.y - styleNumber(this, 'margin-top') 4894 }; 4895 }, 4896 4897 setPosition: function(obj){ 4898 return this.setStyles(this.computePosition(obj)); 4899 } 4900 4901}); 4902 4903 4904[Document, Window].invoke('implement', { 4905 4906 getSize: function(){ 4907 var doc = getCompatElement(this);
4908 return {x: doc.clientWidth, y: doc.clientHeight}; 4909 }, 4910 4911 getScroll: function(){ 4912 var win = this.getWindow(), doc = getCompatElement(this); 4913 return {x: win.pageXOffset || doc.scrollLeft, y: win.pageYOffset || doc.scrollTop}; 4914 }, 4915 4916 getScrollSize: function(){ 4917 var doc = getCompatElement(this), 4918 min = this.getSize(), 4919 body = this.getDocument().body; 4920 4921 return {x: Math.max(doc.scrollWidth, body.scrollWidth, min.x), y: Math.max(doc.scrollHeight, body.scrollHeight, min.y)}; 4922 }, 4923 4924 getPosition: function(){ 4925 return {x: 0, y: 0}; 4926 }, 4927 4928 getCoordinates: function(){ 4929 var size = this.getSize(); 4930 return {top: 0, left: 0, bottom: size.y, right: size.x, height: size.y, width: size.x}; 4931 } 4932 4933}); 4934 4935// private methods 4936 4937var styleString = Element.getComputedStyle; 4938 4939function styleNumber(element, style){ 4940 return styleString(element, style).toInt() || 0; 4941} 4942 4943function borderBox(element){ 4944 return styleString(element, '-moz-box-sizing') == 'border-box'; 4945} 4946 4947function topBorder(element){ 4948 return styleNumber(element, 'border-top-width'); 4949} 4950 4951function leftBorder(element){ 4952 return styleNumber(element, 'border-left-width'); 4953} 4954 4955function isBody(element){ 4956 return (/^(?:body|html)$/i).test(element.tagName); 4957} 4958 4959function getCompatElement(element){ 4960 var doc = element.getDocument(); 4961 return (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body; 4962} 4963 4964})(); 4965 4966//aliases 4967Element.alias({position: 'setPosition'}); //compatability 4968 4969[Window, Document, Element].invoke('implement', { 4970 4971 getHeight: function(){ 4972 return this.getSize().y; 4973 }, 4974 4975 getWidth: function(){ 4976 return this.getSize().x; 4977 }, 4978 4979 getScrollTop: function(){ 4980 return this.getScroll().y; 4981 }, 4982 4983 getScrollLeft: function(){ 4984 return this.getScroll().x; 4985 }, 4986 4987 getScrollHeight: function(){ 4988 return this.getScrollSize().y; 4989 }, 4990 4991 getScrollWidth: function(){ 4992 return this.getScrollSize().x; 4993 }, 4994 4995 getTop: function(){ 4996 return this.getPosition().y; 4997 }, 4998 4999 getLeft: function(){ 5000 return this.getPosition().x; 5001 } 5002 5003}); 5004 5005 5006/* 5007--- 5008 5009name: Fx 5010 5011description: Contains the basic animation logic to be extended by all other Fx Classes. 5012 5013license: MIT-style license. 5014 5015requires: [Chain, Events, Options] 5016 5017provides: Fx 5018 5019... 5020*/ 5021 5022(function(){ 5023 5024var Fx = this.Fx = new Class({ 5025 5026 Implements: [Chain, Events, Options], 5027 5028 options: { 5029 /* 5030 onStart: nil, 5031 onCancel: nil, 5032 onComplete: nil, 5033 */ 5034 fps: 60, 5035 unit: false, 5036 duration: 500, 5037 frames: null, 5038 frameSkip: true, 5039 link: 'ignore' 5040 }, 5041 5042 initialize: function(options){ 5043 this.subject = this.subject || this; 5044 this.setOptions(options); 5045 }, 5046 5047 getTransition: function(){ 5048 return function(p){ 5049 return -(Math.cos(Math.PI * p) - 1) / 2; 5050 }; 5051 }, 5052 5053 step: function(now){ 5054 if (this.options.frameSkip){ 5055 var diff = (this.time != null) ? (now - this.time) : 0, frames = diff / this.frameInterval; 5056 this.time = now; 5057 this.frame += frames; 5058 } else { 5059 this.frame++; 5060 } 5061 5062 if (this.frame < this.frames){ 5063 var delta = this.transition(this.frame / this.frames); 5064 this.set(this.compute(this.from, this.to, delta)); 5065 } else { 5066 this.frame = this.frames; 5067 this.set(this.compute(this.from, this.to, 1)); 5068 this.stop(); 5069 } 5070 }, 5071 5072 set: function(now){ 5073 return now; 5074 }, 5075 5076 compute: function(from, to, delta){ 5077 return Fx.compute(from, to, delta); 5078 }, 5079 5080 check: function(){ 5081 if (!this.isRunning()) return true; 5082 switch (this.options.link){ 5083 case 'cancel': this.cancel(); return true; 5084 case 'chain': this.chain(this.caller.pass(arguments, this)); return false; 5085 } 5086 return false; 5087 }, 5088 5089 start: function(from, to){ 5090 if (!this.check(from, to)) return this; 5091 this.from = from; 5092 this.to = to; 5093 this.frame = (this.options.frameSkip) ? 0 : -1; 5094 this.time = null; 5095 this.transition = this.getTransition(); 5096 var frames = this.options.frames, fps = this.options.fps, duration = this.options.duration; 5097 this.duration = Fx.Durations[duration] || duration.toInt(); 5098 this.frameInterval = 1000 / fps; 5099 this.frames = frames || Math.round(this.duration / this.frameInterval); 5100 this.fireEvent('start', this.subject); 5101 pushInstance.call(this, fps); 5102 return this; 5103 }, 5104 5105 stop: function(){ 5106 if (this.isRunning()){ 5107 this.time = null; 5108 pullInstance.call(this, this.options.fps); 5109 if (this.frames == this.frame){ 5110 this.fireEvent('complete', this.subject); 5111 if (!this.callChain()) this.fireEvent('chainComplete', this.subject); 5112 } else { 5113 this.fireEvent('stop', this.subject); 5114 } 5115 } 5116 return this; 5117 }, 5118 5119 cancel: function(){ 5120 if (this.isRunning()){ 5121 this.time = null; 5122 pullInstance.call(this, this.options.fps); 5123 this.frame = this.frames; 5124 this.fireEvent('cancel', this.subject).clearChain(); 5125 } 5126 return this; 5127 }, 5128 5129 pause: function(){ 5130 if (this.isRunning()){ 5131 this.time = null; 5132 pullInstance.call(this, this.options.fps); 5133 } 5134 return this; 5135 }, 5136 5137 resume: function(){ 5138 if ((this.frame < this.frames) && !this.isRunning()) pushInstance.call(this, this.options.fps); 5139 return this; 5140 }, 5141 5142 isRunning: function(){ 5143 var list = instances[this.options.fps]; 5144 return list && list.contains(this); 5145 } 5146 5147}); 5148 5149Fx.compute = function(from, to, delta){ 5150 return (to - from) * delta + from; 5151}; 5152 5153Fx.Durations = {'short': 250, 'normal': 500, 'long': 1000}; 5154 5155// global timers 5156 5157var instances = {}, timers = {}; 5158 5159var loop = function(){ 5160 var now = Date.now(); 5161 for (var i = this.length; i--;){ 5162 var instance = this[i]; 5163 if (instance) instance.step(now); 5164 } 5165}; 5166 5167var pushInstance = function(fps){ 5168 var list = instances[fps] || (instances[fps] = []); 5169 list.push(this); 5170 if (!timers[fps]) timers[fps] = loop.periodical(Math.round(1000 / fps), list); 5171}; 5172 5173var pullInstance = function(fps){ 5174 var list = instances[fps]; 5175 if (list){ 5176 list.erase(this); 5177 if (!list.length && timers[fps]){ 5178 delete instances[fps]; 5179 timers[fps] = clearInterval(timers[fps]); 5180 } 5181 } 5182}; 5183 5184}
5184)(); 5185 5186 5187/* 5188--- 5189 5190name: Fx.CSS 5191 5192description: Contains the CSS animation logic. Used by Fx.Tween, Fx.Morph, Fx.Elements. 5193 5194license: MIT-style license. 5195 5196requires: [Fx, Element.Style] 5197 5198provides: Fx.CSS 5199 5200... 5201*/ 5202 5203Fx.CSS = new Class({ 5204 5205 Extends: Fx, 5206 5207 //prepares the base from/to object 5208 5209 prepare: function(element, property, values){ 5210 values = Array.from(values); 5211 var from = values[0], to = values[1]; 5212 if (to == null){ 5213 to = from; 5214 from = element.getStyle(property); 5215 var unit = this.options.unit; 5216 // adapted from: https://github.com/ryanmorr/fx/blob/master/fx.js#L299 5217 if (unit && from.slice(-unit.length) != unit && parseFloat(from) != 0){ 5218 element.setStyle(property, to + unit); 5219 var value = element.getComputedStyle(property); 5220 // IE and Opera support pixelLeft or pixelWidth 5221 if (!(/px$/.test(value))){ 5222 value = element.style[('pixel-' + property).camelCase()]; 5223 if (value == null){ 5224 // adapted from Dean Edwards' http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 5225 var left = element.style.left; 5226 element.style.left = to + unit; 5227 value = element.style.pixelLeft; 5228 element.style.left = left; 5229 } 5230 } 5231 from = (to || 1) / (parseFloat(value) || 1) * (parseFloat(from) || 0); 5232 element.setStyle(property, from + unit); 5233 } 5234 } 5235 return {from: this.parse(from), to: this.parse(to)}; 5236 }, 5237 5238 //parses a value into an array 5239 5240 parse: function(value){ 5241 value = Function.from(value)(); 5242 value = (typeof value == 'string') ? value.split(' ') : Array.from(value); 5243 return value.map(function(val){ 5244 val = String(val); 5245 var found = false; 5246 Object.each(Fx.CSS.Parsers, function(parser, key){ 5247 if (found) return; 5248 var parsed = parser.parse(val); 5249 if (parsed || parsed === 0) found = {value: parsed, parser: parser}; 5250 }); 5251 found = found || {value: val, parser: Fx.CSS.Parsers.String}; 5252 return found; 5253 }); 5254 }, 5255 5256 //computes by a from and to prepared objects, using their parsers. 5257 5258 compute: function(from, to, delta){ 5259 var computed = []; 5260 (Math.min(from.length, to.length)).times(function(i){ 5261 computed.push({value: from[i].parser.compute(from[i].value, to[i].value, delta), parser: from[i].parser}); 5262 }); 5263 computed.$family = Function.from('fx:css:value'); 5264 return computed; 5265 }, 5266 5267 //serves the value as settable 5268 5269 serve: function(value, unit){ 5270 if (typeOf(value) != 'fx:css:value') value = this.parse(value); 5271 var returned = []; 5272 value.each(function(bit){ 5273 returned = returned.concat(bit.parser.serve(bit.value, unit)); 5274 }); 5275 return returned; 5276 }, 5277 5278 //renders the change to an element 5279 5280 render: function(element, property, value, unit){ 5281 element.setStyle(property, this.serve(value, unit)); 5282 }, 5283 5284 //searches inside the page css to find the values for a selector 5285 5286 search: function(selector){ 5287 if (Fx.CSS.Cache[selector]) return Fx.CSS.Cache[selector]; 5288 var to = {}, selectorTest = new RegExp('^' + selector.escapeRegExp() + '$'); 5289 Array.each(document.styleSheets, function(sheet, j){ 5290 var href = sheet.href; 5291 if (href && href.contains('://') && !href.contains(document.domain)) return; 5292 var rules = sheet.rules || sheet.cssRules; 5293 Array.each(rules, function(rule, i){ 5294 if (!rule.style) return; 5295 var selectorText = (rule.selectorText) ? rule.selectorText.replace(/^\w+/, function(m){ 5296 return m.toLowerCase(); 5297 }) : null; 5298 if (!selectorText || !selectorTest.test(selectorText)) return; 5299 Object.each(Element.Styles, function(value, style){ 5300 if (!rule.style[style] || Element.ShortStyles[style]) return; 5301 value = String(rule.style[style]); 5302 to[style] = ((/^rgb/).test(value)) ? value.rgbToHex() : value; 5303 }); 5304 }); 5305 }); 5306 return Fx.CSS.Cache[selector] = to; 5307 } 5308 5309}); 5310 5311Fx.CSS.Cache = {}; 5312 5313Fx.CSS.Parsers = { 5314 5315 Color: { 5316 parse: function(value){ 5317 if (value.match(/^#[0-9a-f]{3,6}$/i)) return value.hexToRgb(true); 5318 return ((value = value.match(/(\d+),\s*(\d+),\s*(\d+)/))) ? [value[1], value[2], value[3]] : false; 5319 }, 5320 compute: function(from, to, delta){ 5321 return from.map(function(value, i){ 5322 return Math.round(Fx.compute(from[i], to[i], delta)); 5323 }); 5324 }, 5325 serve: function(value){ 5326 return value.map(Number); 5327 } 5328 }, 5329 5330 Number: { 5331 parse: parseFloat, 5332 compute: Fx.compute, 5333 serve: function(value, unit){ 5334 return (unit) ? value + unit : value; 5335 } 5336 }, 5337 5338 String: { 5339 parse: Function.from(false), 5340 compute: function(zero, one){ 5341 return one; 5342 }, 5343 serve: function(zero){ 5344 return zero; 5345 } 5346 } 5347 5348}; 5349 5350//<1.2compat> 5351 5352Fx.CSS.Parsers = new Hash(Fx.CSS.Parsers); 5353 5354//</1.2compat> 5355 5356 5357/* 5358--- 5359 5360name: Fx.Tween 5361 5362description: Formerly Fx.Style, effect to transition any CSS property for an element. 5363 5364license: MIT-style license. 5365 5366requires: Fx.CSS 5367 5368provides: [Fx.Tween, Element.fade, Element.highlight] 5369 5370... 5371*/ 5372 5373Fx.Tween = new Class({ 5374 5375 Extends: Fx.CSS, 5376 5377 initialize: function(element, options){ 5378 this.element = this.subject = document.id(element); 5379 this.parent(options); 5380 }, 5381 5382 set: function(property, now){ 5383 if (arguments.length == 1){ 5384 now = property; 5385 property = this.property || this.options.property; 5386 } 5387 this.render(this.element, property, now, this.options.unit); 5388 return this; 5389 }, 5390 5391 start: function(property, from, to){ 5392 if (!this.check(property, from, to)) return this; 5393 var args = Array.flatten(arguments); 5394 this.property = this.options.property || args.shift(); 5395 var parsed = this.prepare(this.element, this.property, args); 5396 return this.parent(parsed.from, parsed.to); 5397 } 5398 5399}); 5400 5401Element.Properties.tween = { 5402 5403 set: function(options){ 5404 this.get('tween').cancel().setOptions(options); 5405 return this; 5406 }, 5407 5408 get: function(){ 5409 var tween = this.retrieve('tween'); 5410 if (!tween){ 5411 tween = new Fx.Tween(this, {link: 'cancel'}); 5412 this.store('tween', tween); 5413 } 5414 return tween; 5415 } 5416 5417}; 5418 5419Element.implement({ 5420 5421 tween: function(property, from, to){ 5422 this.get('tween').start(property, from, to); 5423 return this; 5424 }, 5425 5426 fade: function(how){
5427 var fade = this.get('tween'), method, args = ['opacity'].append(arguments), toggle; 5428 if (args[1] == null) args[1] = 'toggle'; 5429 switch (args[1]){ 5430 case 'in': method = 'start'; args[1] = 1; break; 5431 case 'out': method = 'start'; args[1] = 0; break; 5432 case 'show': method = 'set'; args[1] = 1; break; 5433 case 'hide': method = 'set'; args[1] = 0; break; 5434 case 'toggle': 5435 var flag = this.retrieve('fade:flag', this.getStyle('opacity') == 1); 5436 method = 'start'; 5437 args[1] = flag ? 0 : 1; 5438 this.store('fade:flag', !flag); 5439 toggle = true; 5440 break; 5441 default: method = 'start'; 5442 } 5443 if (!toggle) this.eliminate('fade:flag'); 5444 fade[method].apply(fade, args); 5445 var to = args[args.length - 1]; 5446 if (method == 'set' || to != 0) this.setStyle('visibility', to == 0 ? 'hidden' : 'visible'); 5447 else fade.chain(function(){ 5448 this.element.setStyle('visibility', 'hidden'); 5449 this.callChain(); 5450 }); 5451 return this; 5452 }, 5453 5454 highlight: function(start, end){ 5455 if (!end){ 5456 end = this.retrieve('highlight:original', this.getStyle('background-color')); 5457 end = (end == 'transparent') ? '#fff' : end; 5458 } 5459 var tween = this.get('tween'); 5460 tween.start('background-color', start || '#ffff88', end).chain(function(){ 5461 this.setStyle('background-color', this.retrieve('highlight:original')); 5462 tween.callChain(); 5463 }.bind(this)); 5464 return this; 5465 } 5466 5467}); 5468 5469 5470/* 5471--- 5472 5473name: Fx.Morph 5474 5475description: Formerly Fx.Styles, effect to transition any number of CSS properties for an element using an object of rules, or CSS based selector rules. 5476 5477license: MIT-style license. 5478 5479requires: Fx.CSS 5480 5481provides: Fx.Morph 5482 5483... 5484*/ 5485 5486Fx.Morph = new Class({ 5487 5488 Extends: Fx.CSS, 5489 5490 initialize: function(element, options){ 5491 this.element = this.subject = document.id(element); 5492 this.parent(options); 5493 }, 5494 5495 set: function(now){ 5496 if (typeof now == 'string') now = this.search(now); 5497 for (var p in now) this.render(this.element, p, now[p], this.options.unit); 5498 return this; 5499 }, 5500 5501 compute: function(from, to, delta){ 5502 var now = {}; 5503 for (var p in from) now[p] = this.parent(from[p], to[p], delta); 5504 return now; 5505 }, 5506 5507 start: function(properties){ 5508 if (!this.check(properties)) return this; 5509 if (typeof properties == 'string') properties = this.search(properties); 5510 var from = {}, to = {}; 5511 for (var p in properties){ 5512 var parsed = this.prepare(this.element, p, properties[p]); 5513 from[p] = parsed.from; 5514 to[p] = parsed.to; 5515 } 5516 return this.parent(from, to); 5517 } 5518 5519}); 5520 5521Element.Properties.morph = { 5522 5523 set: function(options){ 5524 this.get('morph').cancel().setOptions(options); 5525 return this; 5526 }, 5527 5528 get: function(){ 5529 var morph = this.retrieve('morph'); 5530 if (!morph){ 5531 morph = new Fx.Morph(this, {link: 'cancel'}); 5532 this.store('morph', morph); 5533 } 5534 return morph; 5535 } 5536 5537}; 5538 5539Element.implement({ 5540 5541 morph: function(props){ 5542 this.get('morph').start(props); 5543 return this; 5544 } 5545 5546}); 5547 5548 5549/* 5550--- 5551 5552name: Fx.Transitions 5553 5554description: Contains a set of advanced transitions to be used with any of the Fx Classes. 5555 5556license: MIT-style license. 5557 5558credits: 5559 - Easing Equations by Robert Penner, <http://www.robertpenner.com/easing/>, modified and optimized to be used with MooTools. 5560 5561requires: Fx 5562 5563provides: Fx.Transitions 5564 5565... 5566*/ 5567 5568Fx.implement({ 5569 5570 getTransition: function(){ 5571 var trans = this.options.transition || Fx.Transitions.Sine.easeInOut; 5572 if (typeof trans == 'string'){ 5573 var data = trans.split(':'); 5574 trans = Fx.Transitions; 5575 trans = trans[data[0]] || trans[data[0].capitalize()]; 5576 if (data[1]) trans = trans['ease' + data[1].capitalize() + (data[2] ? data[2].capitalize() : '')]; 5577 } 5578 return trans; 5579 } 5580 5581}); 5582 5583Fx.Transition = function(transition, params){ 5584 params = Array.from(params); 5585 var easeIn = function(pos){ 5586 return transition(pos, params); 5587 }; 5588 return Object.append(easeIn, { 5589 easeIn: easeIn, 5590 easeOut: function(pos){ 5591 return 1 - transition(1 - pos, params); 5592 }, 5593 easeInOut: function(pos){ 5594 return (pos <= 0.5 ? transition(2 * pos, params) : (2 - transition(2 * (1 - pos), params))) / 2; 5595 } 5596 }); 5597}; 5598 5599Fx.Transitions = { 5600 5601 linear: function(zero){ 5602 return zero; 5603 } 5604 5605}; 5606 5607//<1.2compat> 5608 5609Fx.Transitions = new Hash(Fx.Transitions); 5610 5611//</1.2compat> 5612 5613Fx.Transitions.extend = function(transitions){ 5614 for (var transition in transitions) Fx.Transitions[transition] = new Fx.Transition(transitions[transition]); 5615}; 5616 5617Fx.Transitions.extend({ 5618 5619 Pow: function(p, x){ 5620 return Math.pow(p, x && x[0] || 6); 5621 }, 5622 5623 Expo: function(p){ 5624 return Math.pow(2, 8 * (p - 1)); 5625 }, 5626
5627 Circ: function(p){ 5628 return 1 - Math.sin(Math.acos(p)); 5629 }, 5630 5631 Sine: function(p){ 5632 return 1 - Math.cos(p * Math.PI / 2); 5633 }, 5634 5635 Back: function(p, x){ 5636 x = x && x[0] || 1.618; 5637 return Math.pow(p, 2) * ((x + 1) * p - x); 5638 }, 5639 5640 Bounce: function(p){ 5641 var value; 5642 for (var a = 0, b = 1; 1; a += b, b /= 2){ 5643 if (p >= (7 - 4 * a) / 11){ 5644 value = b * b - Math.pow((11 - 6 * a - 11 * p) / 4, 2); 5645 break; 5646 } 5647 } 5648 return value; 5649 }, 5650 5651 Elastic: function(p, x){ 5652 return Math.pow(2, 10 * --p) * Math.cos(20 * p * Math.PI * (x && x[0] || 1) / 3); 5653 } 5654 5655}); 5656 5657['Quad', 'Cubic', 'Quart', 'Quint'].each(function(transition, i){ 5658 Fx.Transitions[transition] = new Fx.Transition(function(p){ 5659 return Math.pow(p, i + 2); 5660 }); 5661}); 5662 5663 5664/* 5665--- 5666 5667name: Request 5668 5669description: Powerful all purpose Request Class. Uses XMLHTTPRequest. 5670 5671license: MIT-style license. 5672 5673requires: [Object, Element, Chain, Events, Options, Browser] 5674 5675provides: Request 5676 5677... 5678*/ 5679 5680(function(){ 5681 5682var empty = function(){}, 5683 progressSupport = ('onprogress' in new Browser.Request); 5684 5685var Request = this.Request = new Class({ 5686 5687 Implements: [Chain, Events, Options], 5688 5689 options: {/* 5690 onRequest: function(){}, 5691 onLoadstart: function(event, xhr){}, 5692 onProgress: function(event, xhr){}, 5693 onComplete: function(){}, 5694 onCancel: function(){}, 5695 onSuccess: function(responseText, responseXML){}, 5696 onFailure: function(xhr){}, 5697 onException: function(headerName, value){}, 5698 onTimeout: function(){}, 5699 user: '', 5700 password: '',*/ 5701 url: '', 5702 data: '', 5703 headers: { 5704 'X-Requested-With': 'XMLHttpRequest', 5705 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' 5706 }, 5707 async: true, 5708 format: false, 5709 method: 'post', 5710 link: 'ignore', 5711 isSuccess: null, 5712 emulation: true, 5713 urlEncoded: true, 5714 encoding: 'utf-8', 5715 evalScripts: false, 5716 evalResponse: false, 5717 timeout: 0, 5718 noCache: false 5719 }, 5720 5721 initialize: function(options){ 5722 this.xhr = new Browser.Request(); 5723 this.setOptions(options); 5724 this.headers = this.options.headers; 5725 }, 5726 5727 onStateChange: function(){ 5728 var xhr = this.xhr; 5729 if (xhr.readyState != 4 || !this.running) return; 5730 this.running = false; 5731 this.status = 0; 5732 Function.attempt(function(){ 5733 var status = xhr.status; 5734 this.status = (status == 1223) ? 204 : status; 5735 }.bind(this)); 5736 xhr.onreadystatechange = empty; 5737 if (progressSupport) xhr.onprogress = xhr.onloadstart = empty; 5738 clearTimeout(this.timer); 5739 5740 this.response = {text: this.xhr.responseText || '', xml: this.xhr.responseXML}; 5741 if (this.options.isSuccess.call(this, this.status)) 5742 this.success(this.response.text, this.response.xml); 5743 else 5744 this.failure(); 5745 }, 5746 5747 isSuccess: function(){ 5748 var status = this.status; 5749 return (status >= 200 && status < 300); 5750 }, 5751 5752 isRunning: function(){ 5753 return !!this.running; 5754 }, 5755 5756 processScripts: function(text){ 5757 if (this.options.evalResponse || (/(ecma|java)script/).test(this.getHeader('Content-type'))) return Browser.exec(text); 5758 return text.stripScripts(this.options.evalScripts); 5759 }, 5760 5761 success: function(text, xml){ 5762 this.onSuccess(this.processScripts(text), xml); 5763 }, 5764 5765 onSuccess: function(){ 5766 this.fireEvent('complete', arguments).fireEvent('success', arguments).callChain(); 5767 }, 5768 5769 failure: function(){ 5770 this.onFailure(); 5771 }, 5772 5773 onFailure: function(){ 5774 this.fireEvent('complete').fireEvent('failure', this.xhr); 5775 }, 5776 5777 loadstart: function(event){ 5778 this.fireEvent('loadstart', [event, this.xhr]); 5779 }, 5780 5781 progress: function(event){ 5782 this.fireEvent('progress', [event, this.xhr]); 5783 }, 5784 5785 timeout: function(){ 5786 this.fireEvent('timeout', this.xhr); 5787 }, 5788 5789 setHeader: function(name, value){ 5790 this.headers[name] = value; 5791 return this; 5792 }, 5793 5794 getHeader: function(name){ 5795 return Function.attempt(function(){ 5796 return this.xhr.getResponseHeader(name); 5797 }.bind(this)); 5798 }, 5799 5800 check: function(){ 5801 if (!this.running) return true; 5802 switch (this.options.link){ 5803 case 'cancel': this.cancel(); return true; 5804 case 'chain': this.chain(this.caller.pass(arguments, this)); return false; 5805 } 5806 return false; 5807 }, 5808 5809 send: function(options){ 5810 if (!this.check(options)) return this; 5811 5812 this.options.isSuccess = this.options.isSuccess || this.isSuccess; 5813 this.running = true; 5814 5815 var type = typeOf(options); 5816 if (type == 'string' || type == 'element') options = {data: options}; 5817 5818 var old = this.options; 5819 options = Object.append({data: old.data, url: old.url, method: old.method}, options); 5820 var data = options.data, url = String(options.url), method = options.method.toLowerCase(); 5821 5822 switch (typeOf(data)){ 5823 case 'element': data = document.id(data).toQueryString(); break; 5824 case 'object': case 'hash': data = Object.toQueryString(data); 5825 } 5826 5827 if (this.options.format){ 5828 var format = 'format=' + this.options.format; 5829 data = (data) ? format + '&' + data : format; 5830 } 5831 5832 if (this.options.emulation && !['get', 'post'].contains(method)){ 5833 var _method = '_method=' + method; 5834 data = (data) ? _method + '&' + data : _method; 5835 method = 'post'; 5836 } 5837 5838 if (this.options.urlEncoded && ['post', 'put'].contains(method)){ 5839 var encoding = (this.options.encoding) ? '; charset=' + this.options.encoding : ''; 5840 this.headers['Content-type'] = 'application/x-www-form-urlencoded' + encoding; 5841 } 5842 5843 if (!url) url = document.location.pathname; 5844 5845 var trimPosition = url.lastIndexOf('/'); 5846 if (trimPosition > -1 && (trimPosition = url.indexOf('#')) > -1) url = url.substr(0, trimPosition); 5847 5848 if (this.options.noCache) 5849 url += (url.contains('?') ? '&' : '?') + String.uniqueID(); 5850 5851 if (data && method == 'get'){ 5852 url += (url.contains('?') ? '&' : '?') + data; 5853 data = null; 5854 } 5855 5856 var xhr = this.xhr; 5857 if (progressSupport){ 5858 xhr.onloadstart = this.loadstart.bind(this); 5859 xhr.onprogress = this.progress.bind(this); 5860 } 5861 5862 xhr.open(method.toUpperCase(), url, this.options.async, this.options.user, this.options.password); 5863 if (this.options.user && 'withCredentials' in xhr) xhr.withCredentials = true; 5864 5865 xhr.onreadystatechange = this.onStateChange.bind(this); 5866 5867 Object.each(this.headers, function(value, key){ 5868 try { 5869 xhr.setRequestHeader(key, value); 5870 } catch (e){ 5871 this.fireEvent('exception', [key, value]); 5872 } 5873 }, this); 5874 5875 this.fireEvent('request'); 5876 xhr.send(data); 5877 if (!this.options.async) this.onStateChange(); 5878 else if (this.options.timeout) this.timer = this.timeout.delay(this.options.timeout, this); 5879 return this; 5880 }, 5881 5882 cancel: function(){ 5883 if (!this.running) return this; 5884 this.running = false;
5885 var xhr = this.xhr; 5886 xhr.abort(); 5887 clearTimeout(this.timer); 5888 xhr.onreadystatechange = empty; 5889 if (progressSupport) xhr.onprogress = xhr.onloadstart = empty; 5890 this.xhr = new Browser.Request(); 5891 this.fireEvent('cancel'); 5892 return this; 5893 } 5894 5895}); 5896 5897var methods = {}; 5898['get', 'post', 'put', 'delete', 'GET', 'POST', 'PUT', 'DELETE'].each(function(method){ 5899 methods[method] = function(data){ 5900 var object = { 5901 method: method 5902 }; 5903 if (data != null) object.data = data; 5904 return this.send(object); 5905 }; 5906}); 5907 5908Request.implement(methods); 5909 5910Element.Properties.send = { 5911 5912 set: function(options){ 5913 var send = this.get('send').cancel(); 5914 send.setOptions(options); 5915 return this; 5916 }, 5917 5918 get: function(){ 5919 var send = this.retrieve('send'); 5920 if (!send){ 5921 send = new Request({ 5922 data: this, link: 'cancel', method: this.get('method') || 'post', url: this.get('action') 5923 }); 5924 this.store('send', send); 5925 } 5926 return send; 5927 } 5928 5929}; 5930 5931Element.implement({ 5932 5933 send: function(url){ 5934 var sender = this.get('send'); 5935 sender.send({data: this, url: url || sender.options.url}); 5936 return this; 5937 } 5938 5939}); 5940 5941})(); 5942 5943 5944/* 5945--- 5946 5947name: Request.HTML 5948 5949description: Extends the basic Request Class with additional methods for interacting with HTML responses. 5950 5951license: MIT-style license. 5952 5953requires: [Element, Request] 5954 5955provides: Request.HTML 5956 5957... 5958*/ 5959 5960Request.HTML = new Class({ 5961 5962 Extends: Request, 5963 5964 options: { 5965 update: false, 5966 append: false, 5967 evalScripts: true, 5968 filter: false, 5969 headers: { 5970 Accept: 'text/html, application/xml, text/xml, */*' 5971 } 5972 }, 5973 5974 success: function(text){ 5975 var options = this.options, response = this.response; 5976 5977 response.html = text.stripScripts(function(script){ 5978 response.javascript = script; 5979 }); 5980 5981 var match = response.html.match(/<body[^>]*>([\s\S]*?)<\/body>/i); 5982 if (match) response.html = match[1]; 5983 var temp = new Element('div').set('html', response.html); 5984 5985 response.tree = temp.childNodes; 5986 response.elements = temp.getElements(options.filter || '*'); 5987 5988 if (options.filter) response.tree = response.elements; 5989 if (options.update){ 5990 var update = document.id(options.update).empty(); 5991 if (options.filter) update.adopt(response.elements); 5992 else update.set('html', response.html); 5993 } else if (options.append){ 5994 var append = document.id(options.append); 5995 if (options.filter) response.elements.reverse().inject(append); 5996 else append.adopt(temp.getChildren()); 5997 } 5998 if (options.evalScripts) Browser.exec(response.javascript); 5999 6000 this.onSuccess(response.tree, response.elements, response.html, response.javascript); 6001 } 6002 6003}); 6004 6005Element.Properties.load = { 6006 6007 set: function(options){ 6008 var load = this.get('load').cancel(); 6009 load.setOptions(options); 6010 return this; 6011 }, 6012 6013 get: function(){ 6014 var load = this.retrieve('load'); 6015 if (!load){ 6016 load = new Request.HTML({data: this, link: 'cancel', update: this, method: 'get'}); 6017 this.store('load', load); 6018 } 6019 return load; 6020 } 6021 6022}; 6023 6024Element.implement({ 6025 6026 load: function(){ 6027 this.get('load').send(Array.link(arguments, {data: Type.isObject, url: Type.isString})); 6028 return this; 6029 } 6030 6031}); 6032 6033 6034/* 6035--- 6036 6037name: JSON 6038 6039description: JSON encoder and decoder. 6040 6041license: MIT-style license. 6042 6043SeeAlso: <http://www.json.org/> 6044 6045requires: [Array, String, Number, Function] 6046 6047provides: JSON 6048 6049... 6050*/ 6051 6052if (typeof JSON == 'undefined') this.JSON = {}; 6053 6054//<1.2compat> 6055 6056JSON = new Hash({ 6057 stringify: JSON.stringify, 6058 parse: JSON.parse 6059}); 6060 6061//</1.2compat> 6062 6063(function(){ 6064 6065var special = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'}; 6066 6067var escape = function(chr){ 6068 return special[chr] || '\\u' + ('0000' + chr.charCodeAt(0).toString(16)).slice(-4); 6069}; 6070 6071JSON.validate = function(string){ 6072 string = string.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@'). 6073 replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'). 6074 replace(/(?:^|:|,)(?:\s*\[)+/g, ''); 6075 6076 return (/^[\],:{}\s]*$/).test(string); 6077}; 6078 6079JSON.encode = JSON.stringify ? function(obj){ 6080 return JSON.stringify(obj); 6081} : function(obj){ 6082 if (obj && obj.toJSON) obj = obj.toJSON(); 6083 6084 switch (typeOf(obj)){ 6085 case 'string': 6086 return '"' + obj.replace(/[\x00-\x1f\\"]/g, escape) + '"'; 6087 case 'array': 6088 return '[' + obj.map(JSON.encode).clean() + ']'; 6089 case 'object': case 'hash': 6090 var string = []; 6091 Object.each(obj, function(value, key){ 6092 var json = JSON.encode(value); 6093 if (json) string.push(JSON.encode(key) + ':' + json); 6094 }); 6095 return '{' + string + '}'; 6096 case 'number': case 'boolean': return '' + obj; 6097 case 'null': return 'null';
6098 } 6099 6100 return null; 6101}; 6102 6103JSON.decode = function(string, secure){ 6104 if (!string || typeOf(string) != 'string') return null; 6105 6106 if (secure || JSON.secure){ 6107 if (JSON.parse) return JSON.parse(string); 6108 if (!JSON.validate(string)) throw new Error('JSON could not decode the input; security is enabled and the value is not secure.'); 6109 } 6110 6111 return eval('(' + string + ')'); 6112}; 6113 6114})(); 6115 6116 6117/* 6118--- 6119 6120name: Request.JSON 6121 6122description: Extends the basic Request Class with additional methods for sending and receiving JSON data. 6123 6124license: MIT-style license. 6125 6126requires: [Request, JSON] 6127 6128provides: Request.JSON 6129 6130... 6131*/ 6132 6133Request.JSON = new Class({ 6134 6135 Extends: Request, 6136 6137 options: { 6138 /*onError: function(text, error){},*/ 6139 secure: true 6140 }, 6141 6142 initialize: function(options){ 6143 this.parent(options); 6144 Object.append(this.headers, { 6145 'Accept': 'application/json', 6146 'X-Request': 'JSON' 6147 }); 6148 }, 6149 6150 success: function(text){ 6151 var json; 6152 try { 6153 json = this.response.json = JSON.decode(text, this.options.secure); 6154 } catch (error){ 6155 this.fireEvent('error', [text, error]); 6156 return; 6157 } 6158 if (json == null) this.onFailure(); 6159 else this.onSuccess(json, text); 6160 } 6161 6162}); 6163 6164 6165/* 6166--- 6167 6168name: Cookie 6169 6170description: Class for creating, reading, and deleting browser Cookies. 6171 6172license: MIT-style license. 6173 6174credits: 6175 - Based on the functions by Peter-Paul Koch (http://quirksmode.org). 6176 6177requires: [Options, Browser] 6178 6179provides: Cookie 6180 6181... 6182*/ 6183 6184var Cookie = new Class({ 6185 6186 Implements: Options, 6187 6188 options: { 6189 path: '/', 6190 domain: false, 6191 duration: false, 6192 secure: false, 6193 document: document, 6194 encode: true 6195 }, 6196 6197 initialize: function(key, options){ 6198 this.key = key; 6199 this.setOptions(options); 6200 }, 6201 6202 write: function(value){ 6203 if (this.options.encode) value = encodeURIComponent(value); 6204 if (this.options.domain) value += '; domain=' + this.options.domain; 6205 if (this.options.path) value += '; path=' + this.options.path; 6206 if (this.options.duration){ 6207 var date = new Date(); 6208 date.setTime(date.getTime() + this.options.duration * 24 * 60 * 60 * 1000); 6209 value += '; expires=' + date.toGMTString(); 6210 } 6211 if (this.options.secure) value += '; secure'; 6212 this.options.document.cookie = this.key + '=' + value; 6213 return this; 6214 }, 6215 6216 read: function(){ 6217 var value = this.options.document.cookie.match('(?:^|;)\\s*' + this.key.escapeRegExp() + '=([^;]*)'); 6218 return (value) ? decodeURIComponent(value[1]) : null; 6219 }, 6220 6221 dispose: function(){ 6222 new Cookie(this.key, Object.merge({}, this.options, {duration: -1})).write(''); 6223 return this; 6224 } 6225 6226}); 6227 6228Cookie.write = function(key, value, options){ 6229 return new Cookie(key, options).write(value); 6230}; 6231 6232Cookie.read = function(key){ 6233 return new Cookie(key).read(); 6234}; 6235 6236Cookie.dispose = function(key, options){ 6237 return new Cookie(key, options).dispose(); 6238}; 6239 6240 6241/* 6242--- 6243 6244name: DOMReady 6245 6246description: Contains the custom event domready. 6247 6248license: MIT-style license. 6249 6250requires: [Browser, Element, Element.Event] 6251 6252provides: [DOMReady, DomReady] 6253 6254... 6255*/ 6256 6257(function(window, document){ 6258 6259var ready, 6260 loaded, 6261 checks = [], 6262 shouldPoll, 6263 timer, 6264 testElement = document.createElement('div'); 6265 6266var domready = function(){ 6267 clearTimeout(timer); 6268 if (ready) return; 6269 Browser.loaded = ready = true; 6270 document.removeListener('DOMContentLoaded', domready).removeListener('readystatechange', check); 6271 6272 document.fireEvent('domready'); 6273 window.fireEvent('domready'); 6274}; 6275 6276var check = function(){ 6277 for (var i = checks.length; i--;) if (checks[i]()){ 6278 domready(); 6279 return true; 6280 } 6281 return false; 6282}; 6283 6284var poll = function(){ 6285 clearTimeout(timer); 6286 if (!check()) timer = setTimeout(poll, 10); 6287}; 6288 6289document.addListener('DOMContentLoaded', domready); 6290 6291/*<ltIE8>*/ 6292// doScroll technique by Diego Perini http://javascript.nwbox.com/IEContentLoaded/ 6293// testElement.doScroll() throws when the DOM is not ready, only in the top window 6294var doScrollWorks = function(){ 6295 try { 6296 testElement.doScroll(); 6297 return true; 6298 } catch (e){} 6299 return false; 6300}; 6301// If doScroll works already, it can't be used to determine domready 6302// e.g. in an iframe 6303if (testElement.doScroll && !doScrollWorks()){ 6304 checks.push(doScrollWorks); 6305 shouldPoll = true; 6306} 6307/*</ltIE8>*/ 6308 6309if (document.readyState) checks.push(function(){ 6310 var state = document.readyState; 6311 return (state == 'loaded' || state == 'complete'); 6312}); 6313 6314if ('onreadystatechange' in document) document.addListener('readystatechange', check); 6315else shouldPoll = true; 6316 6317if (shouldPoll) poll(); 6318 6319Element.Events.domready = { 6320 onAdd: function(fn){ 6321 if (ready) fn.call(this); 6322 } 6323}; 6324 6325// Make sure that domready fires before load 6326Element.Events.load = { 6327 base: 'load', 6328 onAdd: function(fn){ 6329 if (loaded && this == window) fn.call(this); 6330 }, 6331 condition: function(){ 6332 if (this == window){ 6333 domready(); 6334 delete Element.Events.load; 6335 } 6336 return true; 6337 } 6338}; 6339 6340// This is based on the custom load event 6341window.addEvent('load', function(){ 6342 loaded = true; 6343}); 6344 6345})(window, document); 6346 6347 6348/* 6349--- 6350 6351name: Swiff 6352 6353description: Wrapper for embedding SWF movies. Supports External Interface Communication. 6354 6355license: MIT-style license. 6356 6357credits: 6358 - Flash detection & Internet Explorer + Flash Player 9 fix inspired by SWFObject. 6359 6360requires: [Options, Object, Element] 6361 6362provides: Swiff 6363 6364... 6365*/ 6366 6367(function(){ 6368 6369var Swiff = this.Swiff = new Class({ 6370 6371 Implements: Options, 6372 6373 options: { 6374 id: null, 6375 height: 1, 6376 width: 1, 6377 container: null, 6378 properties: {}, 6379 params: { 6380 quality: 'high', 6381 allowScriptAccess: 'always',
6382 wMode: 'window', 6383 swLiveConnect: true 6384 }, 6385 callBacks: {}, 6386 vars: {} 6387 }, 6388 6389 toElement: function(){ 6390 return this.object; 6391 }, 6392 6393 initialize: function(path, options){ 6394 this.instance = 'Swiff_' + String.uniqueID(); 6395 6396 this.setOptions(options); 6397 options = this.options; 6398 var id = this.id = options.id || this.instance; 6399 var container = document.id(options.container); 6400 6401 Swiff.CallBacks[this.instance] = {}; 6402 6403 var params = options.params, vars = options.vars, callBacks = options.callBacks; 6404 var properties = Object.append({height: options.height, width: options.width}, options.properties); 6405 6406 var self = this; 6407 6408 for (var callBack in callBacks){ 6409 Swiff.CallBacks[this.instance][callBack] = (function(option){ 6410 return function(){ 6411 return option.apply(self.object, arguments); 6412 }; 6413 })(callBacks[callBack]); 6414 vars[callBack] = 'Swiff.CallBacks.' + this.instance + '.' + callBack; 6415 } 6416 6417 params.flashVars = Object.toQueryString(vars); 6418 if (Browser.ie){ 6419 properties.classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'; 6420 params.movie = path; 6421 } else { 6422 properties.type = 'application/x-shockwave-flash'; 6423 } 6424 properties.data = path; 6425 6426 var build = '<object id="' + id + '"'; 6427 for (var property in properties) build += ' ' + property + '="' + properties[property] + '"'; 6428 build += '>'; 6429 for (var param in params){ 6430 if (params[param]) build += '<param name="' + param + '" value="' + params[param] + '" />'; 6431 } 6432 build += '</object>'; 6433 this.object = ((container) ? container.empty() : new Element('div')).set('html', build).firstChild; 6434 }, 6435 6436 replaces: function(element){ 6437 element = document.id(element, true); 6438 element.parentNode.replaceChild(this.toElement(), element); 6439 return this; 6440 }, 6441 6442 inject: function(element){ 6443 document.id(element, true).appendChild(this.toElement()); 6444 return this; 6445 }, 6446 6447 remote: function(){ 6448 return Swiff.remote.apply(Swiff, [this.toElement()].append(arguments)); 6449 } 6450 6451}); 6452 6453Swiff.CallBacks = {}; 6454 6455Swiff.remote = function(obj, fn){ 6456 var rs = obj.CallFunction('<invoke name="' + fn + '" returntype="javascript">' + __flash__argumentsToXML(arguments, 2) + '</invoke>'); 6457 return eval(rs); 6458}; 6459 6460})(); 6461 6462// MooTools: the javascript framework. 6463// Load this file's selection again by visiting: http://mootools.net/more/05593c836318a6e24f027c6cf1d09cde 6464// Or build this file again with packager using: packager build More/More More/Events.Pseudos More/Class.Refactor More/Class.Binds More/Class.Occlude More/Chain.Wait More/Array.Extras More/Date More/Date.Extras More/Number.Format More/Object.Extras More/String.Extras More/String.QueryString More/URI More/URI.Relative More/Hash More/Hash.Extras More/Element.Forms More/Elements.From More/Element.Event.Pseudos More/Element.Event.Pseudos.Keys More/Element.Measure More/Element.Pin More/Element.Position More/Element.Shortcuts More/Form.Request More/Form.Request.Append More/Form.Validator More/Form.Validator.Inline More/Form.Validator.Extras More/OverText More/Fx.Elements More/Fx.Accordion More/Fx.Move More/Fx.Reveal More/Fx.Scroll More/Fx.Slide More/Fx.SmoothScroll More/Fx.Sort More/Drag More/Drag.Move More/Slider More/Sortables More/Request.JSONP More/Request.Queue More/Request.Periodical More/Assets More/Color More/Group More/Hash.Cookie More/IframeShim More/Table More/HtmlTable More/HtmlTable.Zebra More/HtmlTable.Sort More/HtmlTable.Select More/Keyboard More/Keyboard.Extras More/Mask More/Scroller More/Tips More/Spinner More/Locale More/Locale.Set.From More/Locale.en-US.Date More/Locale.en-US.Form.Validator More/Locale.en-US.Number More/Locale.de-DE.Date More/Locale.de-DE.Form.Validator More/Locale.de-DE.Number More/Locale.en-GB.Date More/Locale.es-ES.Date More/Locale.es-ES.Form.Validator More/Locale.EU.Number More/Locale.fr-FR.Date More/Locale.fr-FR.Form.Validator More/Locale.fr-FR.Number More/Locale.it-IT.Date More/Locale.it-IT.Form.Validator More/Locale.ja-JP.Date More/Locale.ja-JP.Form.Validator More/Locale.ja-JP.Number More/Locale.pt-BR.Date More/Locale.pt-BR.Form.Validator More/Locale.pt-PT.Date More/Locale.pt-PT.Form.Validator More/Locale.ru-RU-unicode.Date More/Locale.ru-RU-unicode.Form.Validator 6465/* 6466--- 6467 6468script: More.js 6469 6470name: More 6471 6472description: MooTools More 6473 6474license: MIT-style license 6475 6476authors: 6477 - Guillermo Rauch 6478 - Thomas Aylott 6479 - Scott Kyle 6480 - Arian Stolwijk 6481 - Tim Wienk 6482 - Christoph Pojer 6483 - Aaron Newton 6484 - Jacob Thornton 6485 6486requires: 6487 - Core/MooTools 6488 6489provides: [MooTools.More] 6490 6491... 6492*/ 6493 6494MooTools.More = { 6495 'version': '1.4.0.1', 6496 'build': 'a4244edf2aa97ac8a196fc96082dd35af1abab87' 6497}; 6498 6499 6500/* 6501--- 6502 6503name: Events.Pseudos 6504 6505description: Adds the functionality to add pseudo events 6506 6507license: MIT-style license 6508 6509authors: 6510 - Arian Stolwijk 6511 6512requires: [Core/Class.Extras, Core/Slick.Parser, More/MooTools.More] 6513 6514provides: [Events.Pseudos] 6515 6516... 6517*/ 6518 6519(function(){ 6520 6521Events.Pseudos = function(pseudos, addEvent, removeEvent){ 6522 6523 var storeKey = '_monitorEvents:'; 6524 6525 var storageOf = function(object){ 6526 return { 6527 store: object.store ? function(key, value){ 6528 object.store(storeKey + key, value); 6529 } : function(key, value){ 6530 (object._monitorEvents || (object._monitorEvents = {}))[key] = value; 6531 }, 6532 retrieve: object.retrieve ? function(key, dflt){ 6533 return object.retrieve(storeKey + key, dflt); 6534 } : function(key, dflt){ 6535 if (!object._monitorEvents) return dflt; 6536 return object._monitorEvents[key] || dflt; 6537 } 6538 }; 6539 }; 6540 6541 var splitType = function(type){ 6542 if (type.indexOf(':') == -1 || !pseudos) return null; 6543 6544 var parsed = Slick.parse(type).expressions[0][0], 6545 parsedPseudos = parsed.pseudos, 6546 l = parsedPseudos.length, 6547 splits = []; 6548 6549 while (l--){ 6550 var pseudo = parsedPseudos[l].key, 6551 listener = pseudos[pseudo]; 6552 if (listener != null) splits.push({ 6553 event: parsed.tag, 6554 value: parsedPseudos[l].value, 6555 pseudo: pseudo, 6556 original: type, 6557 listener: listener 6558 }); 6559 } 6560 return splits.length ? splits : null; 6561 }; 6562 6563 return { 6564 6565 addEvent: function(type, fn, internal){ 6566 var split = splitType(type); 6567 if (!split) return addEvent.call(this, type, fn, internal); 6568 6569 var storage = storageOf(this), 6570 events = storage.retrieve(type, []), 6571 eventType = split[0].event, 6572 args = Array.slice(arguments, 2), 6573 stack = fn, 6574 self = this; 6575 6576 split.each(function(item){ 6577 var listener = item.listener, 6578 stackFn = stack; 6579 if (listener == false) eventType += ':' + item.pseudo + '(' + item.value + ')'; 6580 else stack = function(){ 6581 listener.call(self, item, stackFn, arguments, stack); 6582 }; 6583 }); 6584 6585 events.include({type: eventType, event: fn, monitor: stack}); 6586 storage.store(type, events); 6587 6588 if (type != eventType) addEvent.apply(this, [type, fn].concat(args)); 6589 return addEvent.apply(this, [eventType, stack].concat(args)); 6590 }, 6591
6592 removeEvent: function(type, fn){ 6593 var split = splitType(type); 6594 if (!split) return removeEvent.call(this, type, fn); 6595 6596 var storage = storageOf(this), 6597 events = storage.retrieve(type); 6598 if (!events) return this; 6599 6600 var args = Array.slice(arguments, 2); 6601 6602 removeEvent.apply(this, [type, fn].concat(args)); 6603 events.each(function(monitor, i){ 6604 if (!fn || monitor.event == fn) removeEvent.apply(this, [monitor.type, monitor.monitor].concat(args)); 6605 delete events[i]; 6606 }, this); 6607 6608 storage.store(type, events); 6609 return this; 6610 } 6611 6612 }; 6613 6614}; 6615 6616var pseudos = { 6617 6618 once: function(split, fn, args, monitor){ 6619 fn.apply(this, args); 6620 this.removeEvent(split.event, monitor) 6621 .removeEvent(split.original, fn); 6622 }, 6623 6624 throttle: function(split, fn, args){ 6625 if (!fn._throttled){ 6626 fn.apply(this, args); 6627 fn._throttled = setTimeout(function(){ 6628 fn._throttled = false; 6629 }, split.value || 250); 6630 } 6631 }, 6632 6633 pause: function(split, fn, args){ 6634 clearTimeout(fn._pause); 6635 fn._pause = fn.delay(split.value || 250, this, args); 6636 } 6637 6638}; 6639 6640Events.definePseudo = function(key, listener){ 6641 pseudos[key] = listener; 6642 return this; 6643}; 6644 6645Events.lookupPseudo = function(key){ 6646 return pseudos[key]; 6647}; 6648 6649var proto = Events.prototype; 6650Events.implement(Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent)); 6651 6652['Request', 'Fx'].each(function(klass){ 6653 if (this[klass]) this[klass].implement(Events.prototype); 6654}); 6655 6656})(); 6657 6658 6659/* 6660--- 6661 6662script: Class.Refactor.js 6663 6664name: Class.Refactor 6665 6666description: Extends a class onto itself with new property, preserving any items attached to the class's namespace. 6667 6668license: MIT-style license 6669 6670authors: 6671 - Aaron Newton 6672 6673requires: 6674 - Core/Class 6675 - /MooTools.More 6676 6677# Some modules declare themselves dependent on Class.Refactor 6678provides: [Class.refactor, Class.Refactor] 6679 6680... 6681*/ 6682 6683Class.refactor = function(original, refactors){ 6684 6685 Object.each(refactors, function(item, name){ 6686 var origin = original.prototype[name]; 6687 origin = (origin && origin.$origin) || origin || function(){}; 6688 original.implement(name, (typeof item == 'function') ? function(){ 6689 var old = this.previous; 6690 this.previous = origin; 6691 var value = item.apply(this, arguments); 6692 this.previous = old; 6693 return value; 6694 } : item); 6695 }); 6696 6697 return original; 6698 6699}; 6700 6701 6702/* 6703--- 6704 6705script: Class.Binds.js 6706 6707name: Class.Binds 6708 6709description: Automagically binds specified methods in a class to the instance of the class. 6710 6711license: MIT-style license 6712 6713authors: 6714 - Aaron Newton 6715 6716requires: 6717 - Core/Class 6718 - /MooTools.More 6719 6720provides: [Class.Binds] 6721 6722... 6723*/ 6724 6725Class.Mutators.Binds = function(binds){ 6726 if (!this.prototype.initialize) this.implement('initialize', function(){}); 6727 return Array.from(binds).concat(this.prototype.Binds || []); 6728}; 6729 6730Class.Mutators.initialize = function(initialize){ 6731 return function(){ 6732 Array.from(this.Binds).each(function(name){ 6733 var original = this[name]; 6734 if (original) this[name] = original.bind(this); 6735 }, this); 6736 return initialize.apply(this, arguments); 6737 }; 6738}; 6739 6740 6741/* 6742--- 6743 6744script: Class.Occlude.js 6745 6746name: Class.Occlude 6747 6748description: Prevents a class from being applied to a DOM element twice. 6749 6750license: MIT-style license. 6751 6752authors: 6753 - Aaron Newton 6754 6755requires: 6756 - Core/Class 6757 - Core/Element 6758 - /MooTools.More 6759 6760provides: [Class.Occlude] 6761 6762... 6763*/ 6764 6765Class.Occlude = new Class({ 6766 6767 occlude: function(property, element){ 6768 element = document.id(element || this.element); 6769 var instance = element.retrieve(property || this.property); 6770 if (instance && !this.occluded) 6771 return (this.occluded = instance); 6772 6773 this.occluded = false; 6774 element.store(property || this.property, this); 6775 return this.occluded; 6776 } 6777 6778}); 6779 6780 6781/* 6782--- 6783 6784script: Chain.Wait.js 6785 6786name: Chain.Wait 6787 6788description: value, Adds a method to inject pauses between chained events. 6789 6790license: MIT-style license. 6791 6792authors: 6793 - Aaron Newton 6794 6795requires: 6796 - Core/Chain 6797 - Core/Element 6798 - Core/Fx 6799 - /MooTools.More 6800 6801provides: [Chain.Wait] 6802 6803... 6804*/ 6805 6806(function(){ 6807 6808 var wait = { 6809 wait: function(duration){ 6810 return this.chain(function(){ 6811 this.callChain.delay(duration == null ? 500 : duration, this); 6812 return this; 6813 }.bind(this)); 6814 } 6815 }; 6816 6817 Chain.implement(wait); 6818 6819 if (this.Fx) Fx.implement(wait); 6820 6821 if (this.Element && Element.implement && this.Fx){ 6822 Element.implement({ 6823 6824 chains: function(effects){ 6825 Array.from(effects || ['tween', 'morph', 'reveal']).each(function(effect){ 6826 effect = this.get(effect); 6827 if (!effect) return; 6828 effect.setOptions({ 6829 link:'chain' 6830 }); 6831 }, this); 6832 return this; 6833 }, 6834 6835 pauseFx: function(duration, effect){ 6836 this.chains(effect).get(effect || 'tween').wait(duration); 6837 return this; 6838 } 6839 6840 }); 6841 } 6842 6843})(); 6844 6845 6846/* 6847--- 6848 6849script: Array.Extras.js 6850 6851name: Array.Extras 6852 6853description: Extends the Array native object to include useful methods to work with arrays. 6854 6855license: MIT-style license 6856 6857authors: 6858 - Christoph Pojer 6859 - Sebastian Markbåge 6860 6861requires: 6862 - Core/Array 6863 - MooTools.More 6864 6865provides: [Array.Extras] 6866 6867... 6868*/ 6869 6870(function(nil){ 6871 6872Array.implement({ 6873 6874 min: function(){ 6875 return Math.min.apply(null, this); 6876 }, 6877 6878 max: function(){ 6879 return Math.max.apply(null, this); 6880 }, 6881 6882 average: function(){ 6883 return this.length ? this.sum() / this.length : 0; 6884 }, 6885 6886 sum: function(){ 6887 var result = 0, l = this.length; 6888 if (l){ 6889 while (l--) result += this[l]; 6890 } 6891 return result; 6892 }, 6893 6894 unique: function(){ 6895 return [].combine(this); 6896 }, 6897 6898 shuffle: function(){ 6899 for (var i = this.length; i && --i;){ 6900 var temp = this[i], r = Math.floor(Math.random() * ( i + 1 )); 6901 this[i] = this[r]; 6902 this[r] = temp; 6903 } 6904 return this; 6905 }, 6906 6907 reduce: function(fn, value){ 6908 for (var i = 0, l = this.length; i < l; i++){ 6909 if (i in this) value = value === nil ? this[i] : fn.call(null, value, this[i], i, this); 6910 } 6911 return value; 6912 }, 6913 6914 reduceRight: function(fn, value){ 6915 var i = this.length; 6916 while (i--){ 6917 if (i in this) value = value === nil ? this[i] : fn.call(null, value, this[i], i, this); 6918 } 6919 return value; 6920 } 6921 6922}); 6923 6924})(); 6925 6926 6927/* 6928--- 6929 6930script: Object.Extras.js 6931 6932name: Object.Extras 6933 6934description: Extra Object generics, like getFromPath which allows a path notation to child elements. 6935 6936license: MIT-style license 6937 6938authors: 6939 - Aaron Newton 6940 6941requires: 6942 - Core/Object 6943 - /MooTools.More 6944 6945provides: [Object.Extras] 6946 6947... 6948*/ 6949 6950(function(){ 6951 6952var defined = function(value){ 6953 return value != null; 6954}; 6955 6956var hasOwnProperty = Object.prototype.hasOwnProperty; 6957 6958Object.extend({ 6959 6960 getFromPath: function(source, parts){ 6961 if (typeof parts == 'string') parts = parts.split('.'); 6962 for (var i = 0, l = parts.length; i < l; i++){
6963 if (hasOwnProperty.call(source, parts[i])) source = source[parts[i]]; 6964 else return null; 6965 } 6966 return source; 6967 }, 6968 6969 cleanValues: function(object, method){ 6970 method = method || defined; 6971 for (var key in object) if (!method(object[key])){ 6972 delete object[key]; 6973 } 6974 return object; 6975 }, 6976 6977 erase: function(object, key){ 6978 if (hasOwnProperty.call(object, key)) delete object[key]; 6979 return object; 6980 }, 6981 6982 run: function(object){ 6983 var args = Array.slice(arguments, 1); 6984 for (var key in object) if (object[key].apply){ 6985 object[key].apply(object, args); 6986 } 6987 return object; 6988 } 6989 6990}); 6991 6992})(); 6993 6994 6995/* 6996--- 6997 6998script: Locale.js 6999 7000name: Locale 7001 7002description: Provides methods for localization. 7003 7004license: MIT-style license 7005 7006authors: 7007 - Aaron Newton 7008 - Arian Stolwijk 7009 7010requires: 7011 - Core/Events 7012 - /Object.Extras 7013 - /MooTools.More 7014 7015provides: [Locale, Lang] 7016 7017... 7018*/ 7019 7020(function(){ 7021 7022var current = null, 7023 locales = {}, 7024 inherits = {}; 7025 7026var getSet = function(set){ 7027 if (instanceOf(set, Locale.Set)) return set; 7028 else return locales[set]; 7029}; 7030 7031var Locale = this.Locale = { 7032 7033 define: function(locale, set, key, value){ 7034 var name; 7035 if (instanceOf(locale, Locale.Set)){ 7036 name = locale.name; 7037 if (name) locales[name] = locale; 7038 } else { 7039 name = locale; 7040 if (!locales[name]) locales[name] = new Locale.Set(name); 7041 locale = locales[name]; 7042 } 7043 7044 if (set) locale.define(set, key, value); 7045 7046 /*<1.2compat>*/ 7047 if (set == 'cascade') return Locale.inherit(name, key); 7048 /*</1.2compat>*/ 7049 7050 if (!current) current = locale; 7051 7052 return locale; 7053 }, 7054 7055 use: function(locale){ 7056 locale = getSet(locale); 7057 7058 if (locale){ 7059 current = locale; 7060 7061 this.fireEvent('change', locale); 7062 7063 /*<1.2compat>*/ 7064 this.fireEvent('langChange', locale.name); 7065 /*</1.2compat>*/ 7066 } 7067 7068 return this; 7069 }, 7070 7071 getCurrent: function(){ 7072 return current; 7073 }, 7074 7075 get: function(key, args){ 7076 return (current) ? current.get(key, args) : ''; 7077 }, 7078 7079 inherit: function(locale, inherits, set){ 7080 locale = getSet(locale); 7081 7082 if (locale) locale.inherit(inherits, set); 7083 return this; 7084 }, 7085 7086 list: function(){ 7087 return Object.keys(locales); 7088 } 7089 7090}; 7091 7092Object.append(Locale, new Events); 7093 7094Locale.Set = new Class({ 7095 7096 sets: {}, 7097 7098 inherits: { 7099 locales: [], 7100 sets: {} 7101 }, 7102 7103 initialize: function(name){ 7104 this.name = name || ''; 7105 }, 7106 7107 define: function(set, key, value){ 7108 var defineData = this.sets[set]; 7109 if (!defineData) defineData = {}; 7110 7111 if (key){ 7112 if (typeOf(key) == 'object') defineData = Object.merge(defineData, key); 7113 else defineData[key] = value; 7114 } 7115 this.sets[set] = defineData; 7116 7117 return this; 7118 }, 7119 7120 get: function(key, args, _base){ 7121 var value = Object.getFromPath(this.sets, key); 7122 if (value != null){ 7123 var type = typeOf(value); 7124 if (type == 'function') value = value.apply(null, Array.from(args)); 7125 else if (type == 'object') value = Object.clone(value); 7126 return value; 7127 } 7128 7129 // get value of inherited locales 7130 var index = key.indexOf('.'), 7131 set = index < 0 ? key : key.substr(0, index), 7132 names = (this.inherits.sets[set] || []).combine(this.inherits.locales).include('en-US'); 7133 if (!_base) _base = []; 7134 7135 for (var i = 0, l = names.length; i < l; i++){ 7136 if (_base.contains(names[i])) continue; 7137 _base.include(names[i]); 7138 7139 var locale = locales[names[i]]; 7140 if (!locale) continue; 7141 7142 value = locale.get(key, args, _base); 7143 if (value != null) return value; 7144 } 7145 7146 return ''; 7147 }, 7148 7149 inherit: function(names, set){ 7150 names = Array.from(names); 7151 7152 if (set && !this.inherits.sets[set]) this.inherits.sets[set] = []; 7153 7154 var l = names.length; 7155 while (l--) (set ? this.inherits.sets[set] : this.inherits.locales).unshift(names[l]); 7156 7157 return this; 7158 } 7159 7160}); 7161 7162/*<1.2compat>*/ 7163var lang = MooTools.lang = {}; 7164 7165Object.append(lang, Locale, { 7166 setLanguage: Locale.use, 7167 getCurrentLanguage: function(){ 7168 var current = Locale.getCurrent(); 7169 return (current) ? current.name : null; 7170 }, 7171 set: function(){ 7172 Locale.define.apply(this, arguments); 7173 return this; 7174 }, 7175 get: function(set, key, args){ 7176 if (key) set += '.' + key; 7177 return Locale.get(set, args); 7178 } 7179}); 7180/*</1.2compat>*/ 7181 7182})(); 7183 7184 7185/* 7186--- 7187 7188name: Locale.en-US.Date 7189 7190description: Date messages for US English. 7191 7192license: MIT-style license 7193 7194authors: 7195 - Aaron Newton 7196 7197requires: 7198 - /Locale 7199 7200provides: [Locale.en-US.Date] 7201 7202... 7203*/ 7204 7205Locale.define('en-US', 'Date', { 7206 7207 months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], 7208 months_abbr: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], 7209 days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], 7210 days_abbr: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], 7211 7212 // Culture's date order: MM/DD/YYYY 7213 dateOrder: ['month', 'date', 'year'], 7214 shortDate: '%m/%d/%Y', 7215 shortTime: '%I:%M%p', 7216 AM: 'AM', 7217 PM: 'PM', 7218 firstDayOfWeek: 0, 7219 7220 // Date.Extras 7221 ordinal: function(dayOfMonth){ 7222 // 1st, 2nd, 3rd, etc. 7223 return (dayOfMonth > 3 && dayOfMonth < 21) ? 'th' : ['th', 'st', 'nd', 'rd', 'th'][Math.min(dayOfMonth % 10, 4)]; 7224 }, 7225 7226 lessThanMinuteAgo: 'less than a minute ago', 7227 minuteAgo: 'about a minute ago', 7228 minutesAgo: '{delta} minutes ago', 7229 hourAgo: 'about an hour ago', 7230 hoursAgo: 'about {delta} hours ago', 7231 dayAgo: '1 day ago', 7232 daysAgo: '{delta} days ago', 7233 weekAgo: '1 week ago', 7234 weeksAgo: '{delta} weeks ago', 7235 monthAgo: '1 month ago', 7236 monthsAgo: '{delta} months ago', 7237 yearAgo: '1 year ago', 7238 yearsAgo: '{delta} years ago', 7239 7240 lessThanMinuteUntil: 'less than a minute from now', 7241 minuteUntil: 'about a minute from now', 7242 minutesUntil: '{delta} minutes from now', 7243 hourUntil: 'about an hour from now', 7244 hoursUntil: 'about {delta} hours from now', 7245 dayUntil: '1 day from now', 7246 daysUntil: '{delta} days from now', 7247 weekUntil: '1 week from now', 7248 weeksUntil: '{delta} weeks from now', 7249 monthUntil: '1 month from now', 7250 monthsUntil: '{delta} months from now', 7251 yearUntil: '1 year from now', 7252 yearsUntil: '{delta} years from now' 7253 7254}); 7255 7256 7257/* 7258--- 7259 7260script: Date.js 7261 7262name: Date 7263 7264description: Extends the Date native object to include methods useful in managing dates. 7265 7266license: MIT-style license 7267 7268authors: 7269 - Aaron Newton
7270 - Nicholas Barthelemy - https://svn.nbarthelemy.com/date-js/ 7271 - Harald Kirshner - mail [at] digitarald.de; http://digitarald.de 7272 - Scott Kyle - scott [at] appden.com; http://appden.com 7273 7274requires: 7275 - Core/Array 7276 - Core/String 7277 - Core/Number 7278 - MooTools.More 7279 - Locale 7280 - Locale.en-US.Date 7281 7282provides: [Date] 7283 7284... 7285*/ 7286 7287(function(){ 7288 7289var Date = this.Date; 7290 7291var DateMethods = Date.Methods = { 7292 ms: 'Milliseconds', 7293 year: 'FullYear', 7294 min: 'Minutes', 7295 mo: 'Month', 7296 sec: 'Seconds', 7297 hr: 'Hours' 7298}; 7299 7300['Date', 'Day', 'FullYear', 'Hours', 'Milliseconds', 'Minutes', 'Month', 'Seconds', 'Time', 'TimezoneOffset', 7301 'Week', 'Timezone', 'GMTOffset', 'DayOfYear', 'LastMonth', 'LastDayOfMonth', 'UTCDate', 'UTCDay', 'UTCFullYear', 7302 'AMPM', 'Ordinal', 'UTCHours', 'UTCMilliseconds', 'UTCMinutes', 'UTCMonth', 'UTCSeconds', 'UTCMilliseconds'].each(function(method){ 7303 Date.Methods[method.toLowerCase()] = method; 7304}); 7305 7306var pad = function(n, digits, string){ 7307 if (digits == 1) return n; 7308 return n < Math.pow(10, digits - 1) ? (string || '0') + pad(n, digits - 1, string) : n; 7309}; 7310 7311Date.implement({ 7312 7313 set: function(prop, value){ 7314 prop = prop.toLowerCase(); 7315 var method = DateMethods[prop] && 'set' + DateMethods[prop]; 7316 if (method && this[method]) this[method](value); 7317 return this; 7318 }.overloadSetter(), 7319 7320 get: function(prop){ 7321 prop = prop.toLowerCase(); 7322 var method = DateMethods[prop] && 'get' + DateMethods[prop]; 7323 if (method && this[method]) return this[method](); 7324 return null; 7325 }.overloadGetter(), 7326 7327 clone: function(){ 7328 return new Date(this.get('time')); 7329 }, 7330 7331 increment: function(interval, times){ 7332 interval = interval || 'day'; 7333 times = times != null ? times : 1; 7334 7335 switch (interval){ 7336 case 'year': 7337 return this.increment('month', times * 12); 7338 case 'month': 7339 var d = this.get('date'); 7340 this.set('date', 1).set('mo', this.get('mo') + times); 7341 return this.set('date', d.min(this.get('lastdayofmonth'))); 7342 case 'week': 7343 return this.increment('day', times * 7); 7344 case 'day': 7345 return this.set('date', this.get('date') + times); 7346 } 7347 7348 if (!Date.units[interval]) throw new Error(interval + ' is not a supported interval'); 7349 7350 return this.set('time', this.get('time') + times * Date.units[interval]()); 7351 }, 7352 7353 decrement: function(interval, times){ 7354 return this.increment(interval, -1 * (times != null ? times : 1)); 7355 }, 7356 7357 isLeapYear: function(){ 7358 return Date.isLeapYear(this.get('year')); 7359 }, 7360 7361 clearTime: function(){ 7362 return this.set({hr: 0, min: 0, sec: 0, ms: 0}); 7363 }, 7364 7365 diff: function(date, resolution){ 7366 if (typeOf(date) == 'string') date = Date.parse(date); 7367 7368 return ((date - this) / Date.units[resolution || 'day'](3, 3)).round(); // non-leap year, 30-day month 7369 }, 7370 7371 getLastDayOfMonth: function(){ 7372 return Date.daysInMonth(this.get('mo'), this.get('year')); 7373 }, 7374 7375 getDayOfYear: function(){ 7376 return (Date.UTC(this.get('year'), this.get('mo'), this.get('date') + 1) 7377 - Date.UTC(this.get('year'), 0, 1)) / Date.units.day(); 7378 }, 7379 7380 setDay: function(day, firstDayOfWeek){ 7381 if (firstDayOfWeek == null){ 7382 firstDayOfWeek = Date.getMsg('firstDayOfWeek'); 7383 if (firstDayOfWeek === '') firstDayOfWeek = 1; 7384 } 7385 7386 day = (7 + Date.parseDay(day, true) - firstDayOfWeek) % 7; 7387 var currentDay = (7 + this.get('day') - firstDayOfWeek) % 7; 7388 7389 return this.increment('day', day - currentDay); 7390 }, 7391 7392 getWeek: function(firstDayOfWeek){ 7393 if (firstDayOfWeek == null){ 7394 firstDayOfWeek = Date.getMsg('firstDayOfWeek'); 7395 if (firstDayOfWeek === '') firstDayOfWeek = 1; 7396 } 7397 7398 var date = this, 7399 dayOfWeek = (7 + date.get('day') - firstDayOfWeek) % 7, 7400 dividend = 0, 7401 firstDayOfYear; 7402 7403 if (firstDayOfWeek == 1){ 7404 // ISO-8601, week belongs to year that has the most days of the week (i.e. has the thursday of the week) 7405 var month = date.get('month'), 7406 startOfWeek = date.get('date') - dayOfWeek; 7407 7408 if (month == 11 && startOfWeek > 28) return 1; // Week 1 of next year 7409 7410 if (month == 0 && startOfWeek < -2){ 7411 // Use a date from last year to determine the week 7412 date = new Date(date).decrement('day', dayOfWeek); 7413 dayOfWeek = 0; 7414 } 7415 7416 firstDayOfYear = new Date(date.get('year'), 0, 1).get('day') || 7; 7417 if (firstDayOfYear > 4) dividend = -7; // First week of the year is not week 1 7418 } else { 7419 // In other cultures the first week of the year is always week 1 and the last week always 53 or 54. 7420 // Days in the same week can have a different weeknumber if the week spreads across two years. 7421 firstDayOfYear = new Date(date.get('year'), 0, 1).get('day'); 7422 } 7423 7424 dividend += date.get('dayofyear'); 7425 dividend += 6 - dayOfWeek; // Add days so we calculate the current date's week as a full week 7426 dividend += (7 + firstDayOfYear - firstDayOfWeek) % 7; // Make up for first week of the year not being a full week 7427 7428 return (dividend / 7); 7429 }, 7430 7431 getOrdinal: function(day){ 7432 return Date.getMsg('ordinal', day || this.get('date')); 7433 }, 7434 7435 getTimezone: function(){ 7436 return this.toString() 7437 .replace(/^.*? ([A-Z]{3}).[0-9]{4}.*$/, '$1') 7438 .replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, '$1$2$3'); 7439 }, 7440 7441 getGMTOffset: function(){ 7442 var off = this.get('timezoneOffset'); 7443 return ((off > 0) ? '-' : '+') + pad((off.abs() / 60).floor(), 2) + pad(off % 60, 2); 7444 }, 7445 7446 setAMPM: function(ampm){ 7447 ampm = ampm.toUpperCase(); 7448 var hr = this.get('hr'); 7449 if (hr >
7449 11 && ampm == 'AM') return this.decrement('hour', 12); 7450 else if (hr < 12 && ampm == 'PM') return this.increment('hour', 12); 7451 return this; 7452 }, 7453 7454 getAMPM: function(){ 7455 return (this.get('hr') < 12) ? 'AM' : 'PM'; 7456 }, 7457 7458 parse: function(str){ 7459 this.set('time', Date.parse(str)); 7460 return this; 7461 }, 7462 7463 isValid: function(date){ 7464 if (!date) date = this; 7465 return typeOf(date) == 'date' && !isNaN(date.valueOf()); 7466 }, 7467 7468 format: function(format){ 7469 if (!this.isValid()) return 'invalid date'; 7470 7471 if (!format) format = '%x %X'; 7472 if (typeof format == 'string') format = formats[format.toLowerCase()] || format; 7473 if (typeof format == 'function') return format(this); 7474 7475 var d = this; 7476 return format.replace(/%([a-z%])/gi, 7477 function($0, $1){ 7478 switch ($1){ 7479 case 'a': return Date.getMsg('days_abbr')[d.get('day')]; 7480 case 'A': return Date.getMsg('days')[d.get('day')]; 7481 case 'b': return Date.getMsg('months_abbr')[d.get('month')]; 7482 case 'B': return Date.getMsg('months')[d.get('month')]; 7483 case 'c': return d.format('%a %b %d %H:%M:%S %Y'); 7484 case 'd': return pad(d.get('date'), 2); 7485 case 'e': return pad(d.get('date'), 2, ' '); 7486 case 'H': return pad(d.get('hr'), 2); 7487 case 'I': return pad((d.get('hr') % 12) || 12, 2); 7488 case 'j': return pad(d.get('dayofyear'), 3); 7489 case 'k': return pad(d.get('hr'), 2, ' '); 7490 case 'l': return pad((d.get('hr') % 12) || 12, 2, ' '); 7491 case 'L': return pad(d.get('ms'), 3); 7492 case 'm': return pad((d.get('mo') + 1), 2); 7493 case 'M': return pad(d.get('min'), 2); 7494 case 'o': return d.get('ordinal'); 7495 case 'p': return Date.getMsg(d.get('ampm')); 7496 case 's': return Math.round(d / 1000); 7497 case 'S': return pad(d.get('seconds'), 2); 7498 case 'T': return d.format('%H:%M:%S'); 7499 case 'U': return pad(d.get('week'), 2); 7500 case 'w': return d.get('day'); 7501 case 'x': return d.format(Date.getMsg('shortDate')); 7502 case 'X': return d.format(Date.getMsg('shortTime')); 7503 case 'y': return d.get('year').toString().substr(2); 7504 case 'Y': return d.get('year'); 7505 case 'z': return d.get('GMTOffset'); 7506 case 'Z': return d.get('Timezone'); 7507 } 7508 return $1; 7509 } 7510 ); 7511 }, 7512 7513 toISOString: function(){ 7514 return this.format('iso8601'); 7515 } 7516 7517}).alias({ 7518 toJSON: 'toISOString', 7519 compare: 'diff', 7520 strftime: 'format' 7521}); 7522 7523// The day and month abbreviations are standardized, so we cannot use simply %a and %b because they will get localized 7524var rfcDayAbbr = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], 7525 rfcMonthAbbr = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; 7526 7527var formats = { 7528 db: '%Y-%m-%d %H:%M:%S', 7529 compact: '%Y%m%dT%H%M%S', 7530 'short': '%d %b %H:%M', 7531 'long': '%B %d, %Y %H:%M', 7532 rfc822: function(date){ 7533 return rfcDayAbbr[date.get('day')] + date.format(', %d ') + rfcMonthAbbr[date.get('month')] + date.format(' %Y %H:%M:%S %Z'); 7534 }, 7535 rfc2822: function(date){ 7536 return rfcDayAbbr[date.get('day')] + date.format(', %d ') + rfcMonthAbbr[date.get('month')] + date.format(' %Y %H:%M:%S %z'); 7537 }, 7538 iso8601: function(date){ 7539 return ( 7540 date.getUTCFullYear() + '-' + 7541 pad(date.getUTCMonth() + 1, 2) + '-' + 7542 pad(date.getUTCDate(), 2) + 'T' + 7543 pad(date.getUTCHours(), 2) + ':' + 7544 pad(date.getUTCMinutes(), 2) + ':' + 7545 pad(date.getUTCSeconds(), 2) + '.' + 7546 pad(date.getUTCMilliseconds(), 3) + 'Z' 7547 ); 7548 } 7549}; 7550 7551var parsePatterns = [], 7552 nativeParse = Date.parse; 7553 7554var parseWord = function(type, word, num){ 7555 var ret = -1, 7556 translated = Date.getMsg(type + 's'); 7557 switch (typeOf(word)){ 7558 case 'object': 7559 ret = translated[word.get(type)]; 7560 break; 7561 case 'number': 7562 ret = translated[word]; 7563 if (!ret) throw new Error('Invalid ' + type + ' index: ' + word); 7564 break; 7565 case 'string': 7566 var match = translated.filter(function(name){ 7567 return this.test(name); 7568 }, new RegExp('^' + word, 'i')); 7569 if (!match.length) throw new Error('Invalid ' + type + ' string'); 7570 if (match.length > 1) throw new Error('Ambiguous ' + type); 7571 ret = match[0]; 7572 } 7573 7574 return (num) ? translated.indexOf(ret) : ret; 7575}; 7576 7577var startCentury = 1900, 7578 startYear = 70; 7579 7580Date.extend({ 7581 7582 getMsg: function(key, args){ 7583 return Locale.get('Date.' + key, args); 7584 }, 7585 7586 units: { 7587 ms: Function.from(1), 7588 second: Function.from(1000), 7589 minute: Function.from(60000), 7590 hour: Function.from(3600000), 7591 day: Function.from(86400000), 7592 week: Function.from(608400000), 7593 month: function(month, year){ 7594 var d = new Date; 7595 return Date.daysInMonth(month != null ? month : d.get('mo'), year != null ? year : d.get('year')) * 86400000; 7596 }, 7597 year: function(year){
7598 year = year || new Date().get('year'); 7599 return Date.isLeapYear(year) ? 31622400000 : 31536000000; 7600 } 7601 }, 7602 7603 daysInMonth: function(month, year){ 7604 return [31, Date.isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; 7605 }, 7606 7607 isLeapYear: function(year){ 7608 return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0); 7609 }, 7610 7611 parse: function(from){ 7612 var t = typeOf(from); 7613 if (t == 'number') return new Date(from); 7614 if (t != 'string') return from; 7615 from = from.clean(); 7616 if (!from.length) return null; 7617 7618 var parsed; 7619 parsePatterns.some(function(pattern){ 7620 var bits = pattern.re.exec(from); 7621 return (bits) ? (parsed = pattern.handler(bits)) : false; 7622 }); 7623 7624 if (!(parsed && parsed.isValid())){ 7625 parsed = new Date(nativeParse(from)); 7626 if (!(parsed && parsed.isValid())) parsed = new Date(from.toInt()); 7627 } 7628 return parsed; 7629 }, 7630 7631 parseDay: function(day, num){ 7632 return parseWord('day', day, num); 7633 }, 7634 7635 parseMonth: function(month, num){ 7636 return parseWord('month', month, num); 7637 }, 7638 7639 parseUTC: function(value){ 7640 var localDate = new Date(value); 7641 var utcSeconds = Date.UTC( 7642 localDate.get('year'), 7643 localDate.get('mo'), 7644 localDate.get('date'), 7645 localDate.get('hr'), 7646 localDate.get('min'), 7647 localDate.get('sec'), 7648 localDate.get('ms') 7649 ); 7650 return new Date(utcSeconds); 7651 }, 7652 7653 orderIndex: function(unit){ 7654 return Date.getMsg('dateOrder').indexOf(unit) + 1; 7655 }, 7656 7657 defineFormat: function(name, format){ 7658 formats[name] = format; 7659 return this; 7660 }, 7661 7662 //<1.2compat> 7663 parsePatterns: parsePatterns, 7664 //</1.2compat> 7665 7666 defineParser: function(pattern){ 7667 parsePatterns.push((pattern.re && pattern.handler) ? pattern : build(pattern)); 7668 return this; 7669 }, 7670 7671 defineParsers: function(){ 7672 Array.flatten(arguments).each(Date.defineParser); 7673 return this; 7674 }, 7675 7676 define2DigitYearStart: function(year){ 7677 startYear = year % 100; 7678 startCentury = year - startYear; 7679 return this; 7680 } 7681 7682}).extend({ 7683 defineFormats: Date.defineFormat.overloadSetter() 7684}); 7685 7686var regexOf = function(type){ 7687 return new RegExp('(?:' + Date.getMsg(type).map(function(name){ 7688 return name.substr(0, 3); 7689 }).join('|') + ')[a-z]*'); 7690}; 7691 7692var replacers = function(key){ 7693 switch (key){ 7694 case 'T': 7695 return '%H:%M:%S'; 7696 case 'x': // iso8601 covers yyyy-mm-dd, so just check if month is first 7697 return ((Date.orderIndex('month') == 1) ? '%m[-./]%d' : '%d[-./]%m') + '([-./]%y)?'; 7698 case 'X': 7699 return '%H([.:]%M)?([.:]%S([.:]%s)?)? ?%p? ?%z?'; 7700 } 7701 return null; 7702}; 7703 7704var keys = { 7705 d: /[0-2]?[0-9]|3[01]/, 7706 H: /[01]?[0-9]|2[0-3]/, 7707 I: /0?[1-9]|1[0-2]/, 7708 M: /[0-5]?\d/, 7709 s: /\d+/, 7710 o: /[a-z]*/, 7711 p: /[ap]\.?m\.?/, 7712 y: /\d{2}|\d{4}/, 7713 Y: /\d{4}/, 7714 z: /Z|[+-]\d{2}(?::?\d{2})?/ 7715}; 7716 7717keys.m = keys.I; 7718keys.S = keys.M; 7719 7720var currentLanguage; 7721 7722var recompile = function(language){ 7723 currentLanguage = language; 7724 7725 keys.a = keys.A = regexOf('days'); 7726 keys.b = keys.B = regexOf('months'); 7727 7728 parsePatterns.each(function(pattern, i){ 7729 if (pattern.format) parsePatterns[i] = build(pattern.format); 7730 }); 7731}; 7732 7733var build = function(format){ 7734 if (!currentLanguage) return {format: format}; 7735 7736 var parsed = []; 7737 var re = (format.source || format) // allow format to be regex 7738 .replace(/%([a-z])/gi, 7739 function($0, $1){ 7740 return replacers($1) || $0; 7741 } 7742 ).replace(/\((?!\?)/g, '(?:') // make all groups non-capturing 7743 .replace(/ (?!\?|\*)/g, ',? ') // be forgiving with spaces and commas 7744 .replace(/%([a-z%])/gi, 7745 function($0, $1){ 7746 var p = keys[$1]; 7747 if (!p) return $1; 7748 parsed.push($1); 7749 return '(' + p.source + ')'; 7750 } 7751 ).replace(/\[a-z\]/gi, '[a-z\\u00c0-\\uffff;\&]'); // handle unicode words 7752 7753 return { 7754 format: format, 7755 re: new RegExp('^' + re + '$', 'i'), 7756 handler: function(bits){ 7757 bits = bits.slice(1).associate(parsed); 7758 var date = new Date().clearTime(), 7759 year = bits.y || bits.Y; 7760 7761 if (year != null) handle.call(date, 'y', year); // need to start in the right year 7762 if ('d' in bits) handle.call(date, 'd', 1); 7763 if ('m' in bits || bits.b || bits.B) handle.call(date, 'm', 1); 7764 7765 for (var key in bits) handle.call(date, key, bits[key]); 7766 return date; 7767 } 7768 }; 7769}; 7770 7771var handle = function(key, value){ 7772 if (!value) return this; 7773 7774 switch (key){ 7775 case 'a': case 'A': return this.set('day', Date.parseDay(value, true)); 7776 case 'b': case 'B': return this.set('mo', Date.parseMonth(value, true)); 7777 case 'd': return this.set('date', value); 7778 case 'H': case 'I': return this.set('hr', value); 7779 case 'm': return this.set('mo', value - 1); 7780 case 'M': return this.set('min', value); 7781 case 'p': return this.set('ampm', value.replace(/\./g, '')); 7782 case 'S': return this.set('sec', value); 7783 case 's': return this.set('ms', ('0.' + value) * 1000); 7784 case 'w': return this.set('day', value); 7785 case 'Y': return this.set('year', value); 7786 case 'y': 7787 value = +value; 7788 if (value < 100) value += startCentury + (value < startYear ? 100 : 0); 7789 return this.set('year', value); 7790 case 'z': 7791 if (value == 'Z') value = '+00'; 7792 var offset = value.match(/([+-])(\d{2}):?(\d{2})?/); 7793 offset = (offset[1] + '1') * (offset[2] * 60 + (+offset[3] || 0)) + this.getTimezoneOffset(); 7794 return this.set('time', this - offset * 60000); 7795 } 7796 7797 return this; 7798}; 7799 7800Date.defineParsers( 7801 '%Y([-./]%m([-./]%d((T| )%X)?)?)?', // "1999-12-31", "1999-12-31 11:59pm", "1999-12-31 23:59:59", ISO8601 7802 '%Y%m%d(T%H(%M%S?)?)?', // "19991231", "19991231T1159", compact 7803 '%x( %X)?', // "12/31", "12.31.99", "12-31-1999", "12/31/2008 11:59 PM" 7804 '%d%o( %b( %Y)?)?( %X)?', // "31st", "31st December", "31 Dec 1999", "31 Dec 1999 11:59pm" 7805 '%b( %d%o)?( %Y)?( %X)?', // Same as above with month and day switched 7806 '%Y %b( %d%o( %X)?)?', // Same as above with year coming first 7807 '%o %b %d %X %z %Y', // "Thu Oct 22 08:11:23 +0000 2009" 7808 '%T', // %H:%M:%S 7809 '%H:%M( ?%p)?' // "11:05pm", "11:05 am" and "11:05" 7810); 7811 7812Locale.addEvent('change', function(language){ 7813 if (Locale.get('Date')) recompile(language); 7814}).fireEvent('change', Locale.getCurrent()); 7815 7816})(); 7817 7818 7819/* 7820--- 7821 7822script: Date.Extras.js 7823 7824name: Date.Extras 7825 7826description: Extends the Date native object to include extra methods (on to
7826p of those in Date.js). 7827 7828license: MIT-style license 7829 7830authors: 7831 - Aaron Newton 7832 - Scott Kyle 7833 7834requires: 7835 - /Date 7836 7837provides: [Date.Extras] 7838 7839... 7840*/ 7841 7842Date.implement({ 7843 7844 timeDiffInWords: function(to){ 7845 return Date.distanceOfTimeInWords(this, to || new Date); 7846 }, 7847 7848 timeDiff: function(to, separator){ 7849 if (to == null) to = new Date; 7850 var delta = ((to - this) / 1000).floor().abs(); 7851 7852 var vals = [], 7853 durations = [60, 60, 24, 365, 0], 7854 names = ['s', 'm', 'h', 'd', 'y'], 7855 value, duration; 7856 7857 for (var item = 0; item < durations.length; item++){ 7858 if (item && !delta) break; 7859 value = delta; 7860 if ((duration = durations[item])){ 7861 value = (delta % duration); 7862 delta = (delta / duration).floor(); 7863 } 7864 vals.unshift(value + (names[item] || '')); 7865 } 7866 7867 return vals.join(separator || ':'); 7868 } 7869 7870}).extend({ 7871 7872 distanceOfTimeInWords: function(from, to){ 7873 return Date.getTimePhrase(((to - from) / 1000).toInt()); 7874 }, 7875 7876 getTimePhrase: function(delta){ 7877 var suffix = (delta < 0) ? 'Until' : 'Ago'; 7878 if (delta < 0) delta *= -1; 7879 7880 var units = { 7881 minute: 60, 7882 hour: 60, 7883 day: 24, 7884 week: 7, 7885 month: 52 / 12, 7886 year: 12, 7887 eon: Infinity 7888 }; 7889 7890 var msg = 'lessThanMinute'; 7891 7892 for (var unit in units){ 7893 var interval = units[unit]; 7894 if (delta < 1.5 * interval){ 7895 if (delta > 0.75 * interval) msg = unit; 7896 break; 7897 } 7898 delta /= interval; 7899 msg = unit + 's'; 7900 } 7901 7902 delta = delta.round(); 7903 return Date.getMsg(msg + suffix, delta).substitute({delta: delta}); 7904 } 7905 7906}).defineParsers( 7907 7908 { 7909 // "today", "tomorrow", "yesterday" 7910 re: /^(?:tod|tom|yes)/i, 7911 handler: function(bits){ 7912 var d = new Date().clearTime(); 7913 switch (bits[0]){ 7914 case 'tom': return d.increment(); 7915 case 'yes': return d.decrement(); 7916 default: return d; 7917 } 7918 } 7919 }, 7920 7921 { 7922 // "next Wednesday", "last Thursday" 7923 re: /^(next|last) ([a-z]+)$/i, 7924 handler: function(bits){ 7925 var d = new Date().clearTime(); 7926 var day = d.getDay(); 7927 var newDay = Date.parseDay(bits[2], true); 7928 var addDays = newDay - day; 7929 if (newDay <= day) addDays += 7; 7930 if (bits[1] == 'last') addDays -= 7; 7931 return d.set('date', d.getDate() + addDays); 7932 } 7933 } 7934 7935).alias('timeAgoInWords', 'timeDiffInWords'); 7936 7937 7938/* 7939--- 7940 7941name: Locale.en-US.Number 7942 7943description: Number messages for US English. 7944 7945license: MIT-style license 7946 7947authors: 7948 - Arian Stolwijk 7949 7950requires: 7951 - /Locale 7952 7953provides: [Locale.en-US.Number] 7954 7955... 7956*/ 7957 7958Locale.define('en-US', 'Number', { 7959 7960 decimal: '.', 7961 group: ',', 7962 7963/* Commented properties are the defaults for Number.format 7964 decimals: 0, 7965 precision: 0, 7966 scientific: null, 7967 7968 prefix: null, 7969 suffic: null, 7970 7971 // Negative/Currency/percentage will mixin Number 7972 negative: { 7973 prefix: '-' 7974 },*/ 7975 7976 currency: { 7977// decimals: 2, 7978 prefix: '$ ' 7979 }/*, 7980 7981 percentage: { 7982 decimals: 2, 7983 suffix: '%' 7984 }*/ 7985 7986}); 7987 7988 7989 7990 7991/* 7992--- 7993name: Number.Format 7994description: Extends the Number Type object to include a number formatting method. 7995license: MIT-style license 7996authors: [Arian Stolwijk] 7997requires: [Core/Number, Locale.en-US.Number] 7998# Number.Extras is for compatibility 7999provides: [Number.Format, Number.Extras] 8000... 8001*/ 8002 8003 8004Number.implement({ 8005 8006 format: function(options){ 8007 // Thanks dojo and YUI for some inspiration 8008 var value = this; 8009 options = options ? Object.clone(options) : {}; 8010 var getOption = function(key){ 8011 if (options[key] != null) return options[key]; 8012 return Locale.get('Number.' + key); 8013 }; 8014 8015 var negative = value < 0, 8016 decimal = getOption('decimal'), 8017 precision = getOption('precision'), 8018 group = getOption('group'), 8019 decimals = getOption('decimals'); 8020 8021 if (negative){ 8022 var negativeLocale = getOption('negative') || {}; 8023 if (negativeLocale.prefix == null && negativeLocale.suffix == null) negativeLocale.prefix = '-'; 8024 ['prefix', 'suffix'].each(function(key){ 8025 if (negativeLocale[key]) options[key] = getOption(key) + negativeLocale[key]; 8026 }); 8027 8028 value = -value; 8029 } 8030 8031 var prefix = getOption('prefix'), 8032 suffix = getOption('suffix'); 8033 8034 if (decimals !== '' && decimals >= 0 && decimals <= 20) value = value.toFixed(decimals); 8035 if (precision >= 1 && precision <= 21) value = (+value).toPrecision(precision); 8036 8037 value += ''; 8038 var index; 8039 if (getOption('scientific') === false && value.indexOf('e') > -1){ 8040 var match = value.split('e'), 8041 zeros = +match[1]; 8042 value = match[0].replace('.', ''); 8043 8044 if (zeros < 0){ 8045 zeros = -zeros - 1; 8046 index = match[0].indexOf('.'); 8047 if (index > -1) zeros -= index - 1; 8048 while (zeros--) value = '0' + value; 8049 value = '0.' + value; 8050 } else { 8051 index = match[0].lastIndexOf('.'); 8052 if (index > -1) zeros -= match[0].length - index - 1; 8053 while (zeros--) value += '0'; 8054 } 8055 } 8056 8057 if (decimal != '.') value = value.replace('.', decimal); 8058 8059 if (group){ 8060 index = value.lastIndexOf(decimal); 8061 index = (index > -1) ? index : value.length; 8062 var newOutput = value.substring(index), 8063 i = index; 8064 8065 while (i--){ 8066 if ((index - i - 1) % 3 == 0 && i != (index - 1)) newOutput = group + newOutput; 8067 newOutput = value.charAt(i) + newOutput; 8068 } 8069 8070 value = newOutput; 8071 } 8072 8073 if (prefix) value = prefix + value; 8074 if (suffix) value += suffix; 8075 8076 return value; 8077 }, 8078 8079 formatCurrency: function(decimals){ 8080 var locale = Locale.get('Number.currency') || {};
8081 if (locale.scientific == null) locale.scientific = false; 8082 locale.decimals = decimals != null ? decimals 8083 : (locale.decimals == null ? 2 : locale.decimals); 8084 8085 return this.format(locale); 8086 }, 8087 8088 formatPercentage: function(decimals){ 8089 var locale = Locale.get('Number.percentage') || {}; 8090 if (locale.suffix == null) locale.suffix = '%'; 8091 locale.decimals = decimals != null ? decimals 8092 : (locale.decimals == null ? 2 : locale.decimals); 8093 8094 return this.format(locale); 8095 } 8096 8097}); 8098 8099 8100/* 8101--- 8102 8103script: String.Extras.js 8104 8105name: String.Extras 8106 8107description: Extends the String native object to include methods useful in managing various kinds of strings (query strings, urls, html, etc). 8108 8109license: MIT-style license 8110 8111authors: 8112 - Aaron Newton 8113 - Guillermo Rauch 8114 - Christopher Pitt 8115 8116requires: 8117 - Core/String 8118 - Core/Array 8119 - MooTools.More 8120 8121provides: [String.Extras] 8122 8123... 8124*/ 8125 8126(function(){ 8127 8128var special = { 8129 'a': /[à áâãäåÄÄ ]/g, 8130 'A': /[ÃÃÃÃÃà ÄÄ]/g, 8131 'c': /[ÄÄç]/g, 8132 'C': /[ÄÄÃ]/g, 8133 'd': /[ÄÄ]/g, 8134 'D': /[ÄÃ]/g, 8135 'e': /[èéêëÄÄ]/g, 8136 'E': /[ÃÃÃÃÄÄ]/g, 8137 'g': /[Ä]/g, 8138 'G': /[Ä]/g, 8139 'i': /[ìÃîï]/g, 8140 'I': /[ÃÃÃÃ]/g, 8141 'l': /[ĺľÅ]/g, 8142 'L': /[ĹĽÅ]/g, 8143 'n': /[ñÅÅ]/g, 8144 'N': /[ÃÅÅ]/g, 8145 'o': /[òóôõöøÅ]/g, 8146 'O': /[ÃÃÃÃÃÃ]/g, 8147 'r': /[ÅÅ]/g, 8148 'R': /[ÅÅ]/g, 8149 's': /[ššÅ]/g, 8150 'S': /[Å ÅÅ]/g, 8151 't': /[ťţ]/g, 8152 'T': /[ŤŢ]/g, 8153 'ue': /[ü]/g, 8154 'UE': /[Ã]/g, 8155 'u': /[ùúûůµ]/g, 8156 'U': /[ÃÃÃÅ®]/g, 8157 'y': /[ÿý]/g, 8158 'Y': /[ŸÃ]/g, 8159 'z': /[žźż]/g, 8160 'Z': /[ŽŹŻ]/g, 8161 'th': /[þ]/g, 8162 'TH': /[Ã]/g, 8163 'dh': /[ð]/g, 8164 'DH': /[Ã]/g, 8165 'ss': /[Ã]/g, 8166 'oe': /[Å]/g, 8167 'OE': /[Å]/g, 8168 'ae': /[æ]/g, 8169 'AE': /[Ã]/g 8170}, 8171 8172tidy = { 8173 ' ': /[\xa0\u2002\u2003\u2009]/g, 8174 '*': /[\xb7]/g, 8175 '\'': /[\u2018\u2019]/g, 8176 '"': /[\u201c\u201d]/g, 8177 '...': /[\u2026]/g, 8178 '-': /[\u2013]/g, 8179// '--': /[\u2014]/g, 8180 '»': /[\uFFFD]/g 8181}; 8182 8183var walk = function(string, replacements){ 8184 var result = string, key; 8185 for (key in replacements) result = result.replace(replacements[key], key); 8186 return result; 8187}; 8188 8189var getRegexForTag = function(tag, contents){ 8190 tag = tag || ''; 8191 var regstr = contents ? "<" + tag + "(?!\\w)[^>]*>([\\s\\S]*?)<\/" + tag + "(?!\\w)>" : "<\/?" + tag + "([^>]+)?>", 8192 reg = new RegExp(regstr, "gi"); 8193 return reg; 8194}; 8195 8196String.implement({ 8197 8198 standardize: function(){ 8199 return walk(this, special); 8200 }, 8201 8202 repeat: function(times){ 8203 return new Array(times + 1).join(this); 8204 }, 8205 8206 pad: function(length, str, direction){ 8207 if (this.length >= length) return this; 8208 8209 var pad = (str == null ? ' ' : '' + str) 8210 .repeat(length - this.length) 8211 .substr(0, length - this.length); 8212 8213 if (!direction || direction == 'right') return this + pad; 8214 if (direction == 'left') return pad + this; 8215 8216 return pad.substr(0, (pad.length / 2).floor()) + this + pad.substr(0, (pad.length / 2).ceil()); 8217 }, 8218 8219 getTags: function(tag, contents){ 8220 return this.match(getRegexForTag(tag, contents)) || []; 8221 }, 8222 8223 stripTags: function(tag, contents){ 8224 return this.replace(getRegexForTag(tag, contents), ''); 8225 }, 8226 8227 tidy: function(){ 8228 return walk(this, tidy); 8229 }, 8230 8231 truncate: function(max, trail, atChar){ 8232 var string = this; 8233 if (trail == null && arguments.length == 1) trail = 'â¦'; 8234 if (string.length > max){ 8235 string = string.substring(0, max); 8236 if (atChar){ 8237 var index = string.lastIndexOf(atChar); 8238 if (index != -1) string = string.substr(0, index); 8239 } 8240 if (trail) string += trail; 8241 } 8242 return string; 8243 } 8244 8245}); 8246 8247})(); 8248 8249 8250/* 8251--- 8252 8253script: String.QueryString.js 8254 8255name: String.QueryString 8256 8257description: Methods for dealing with URI query strings. 8258 8259license: MIT-style license 8260 8261authors: 8262 - Sebastian MarkbÃ¥ge 8263 - Aaron Newton 8264 - Lennart Pilon 8265 - Valerio Proietti 8266 8267requires: 8268 - Core/Array 8269 - Core/String 8270 - /MooTools.More 8271 8272provides: [String.QueryString] 8273 8274... 8275*/ 8276 8277String.implement({ 8278 8279 parseQueryString: function(decodeKeys, decodeValues){ 8280 if (decodeKeys == null) decodeKeys = true; 8281 if (decodeValues == null) decodeValues = true; 8282 8283 var vars = this.split(/[&;]/), 8284 object = {}; 8285 if (!vars.length) return object; 8286 8287 vars.each(function(val){ 8288 var index = val.indexOf('=') + 1, 8289 value = index ? val.substr(index) : '', 8290 keys = index ? val.substr(0, index - 1).match(/([^\]\[]+|(\B)(?=\]))/g) : [val], 8291 obj = object; 8292 if (!keys) return; 8293 if (decodeValues) value = decodeURIComponent(value); 8294 keys.each(function(key, i){ 8295 if (decodeKeys) key = decodeURIComponent(key); 8296 var current = obj[key]; 8297
8298 if (i < keys.length - 1) obj = obj[key] = current || {}; 8299 else if (typeOf(current) == 'array') current.push(value); 8300 else obj[key] = current != null ? [current, value] : value; 8301 }); 8302 }); 8303 8304 return object; 8305 }, 8306 8307 cleanQueryString: function(method){ 8308 return this.split('&').filter(function(val){ 8309 var index = val.indexOf('='), 8310 key = index < 0 ? '' : val.substr(0, index), 8311 value = val.substr(index + 1); 8312 8313 return method ? method.call(null, key, value) : (value || value === 0); 8314 }).join('&'); 8315 } 8316 8317}); 8318 8319 8320/* 8321--- 8322 8323script: URI.js 8324 8325name: URI 8326 8327description: Provides methods useful in managing the window location and uris. 8328 8329license: MIT-style license 8330 8331authors: 8332 - Sebastian Markbåge 8333 - Aaron Newton 8334 8335requires: 8336 - Core/Object 8337 - Core/Class 8338 - Core/Class.Extras 8339 - Core/Element 8340 - /String.QueryString 8341 8342provides: [URI] 8343 8344... 8345*/ 8346 8347(function(){ 8348 8349var toString = function(){ 8350 return this.get('value'); 8351}; 8352 8353var URI = this.URI = new Class({ 8354 8355 Implements: Options, 8356 8357 options: { 8358 /*base: false*/ 8359 }, 8360 8361 regex: /^(?:(\w+):)?(?:\/\/(?:(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)?(\.\.?$|(?:[^?#\/]*\/)*)([^?#]*)(?:\?([^#]*))?(?:#(.*))?/, 8362 parts: ['scheme', 'user', 'password', 'host', 'port', 'directory', 'file', 'query', 'fragment'], 8363 schemes: {http: 80, https: 443, ftp: 21, rtsp: 554, mms: 1755, file: 0}, 8364 8365 initialize: function(uri, options){ 8366 this.setOptions(options); 8367 var base = this.options.base || URI.base; 8368 if (!uri) uri = base; 8369 8370 if (uri && uri.parsed) this.parsed = Object.clone(uri.parsed); 8371 else this.set('value', uri.href || uri.toString(), base ? new URI(base) : false); 8372 }, 8373 8374 parse: function(value, base){ 8375 var bits = value.match(this.regex); 8376 if (!bits) return false; 8377 bits.shift(); 8378 return this.merge(bits.associate(this.parts), base); 8379 }, 8380 8381 merge: function(bits, base){ 8382 if ((!bits || !bits.scheme) && (!base || !base.scheme)) return false; 8383 if (base){ 8384 this.parts.every(function(part){ 8385 if (bits[part]) return false; 8386 bits[part] = base[part] || ''; 8387 return true; 8388 }); 8389 } 8390 bits.port = bits.port || this.schemes[bits.scheme.toLowerCase()]; 8391 bits.directory = bits.directory ? this.parseDirectory(bits.directory, base ? base.directory : '') : '/'; 8392 return bits; 8393 }, 8394 8395 parseDirectory: function(directory, baseDirectory){ 8396 directory = (directory.substr(0, 1) == '/' ? '' : (baseDirectory || '/')) + directory; 8397 if (!directory.test(URI.regs.directoryDot)) return directory; 8398 var result = []; 8399 directory.replace(URI.regs.endSlash, '').split('/').each(function(dir){ 8400 if (dir == '..' && result.length > 0) result.pop(); 8401 else if (dir != '.') result.push(dir); 8402 }); 8403 return result.join('/') + '/'; 8404 }, 8405 8406 combine: function(bits){ 8407 return bits.value || bits.scheme + '://' + 8408 (bits.user ? bits.user + (bits.password ? ':' + bits.password : '') + '@' : '') + 8409 (bits.host || '') + (bits.port && bits.port != this.schemes[bits.scheme] ? ':' + bits.port : '') + 8410 (bits.directory || '/') + (bits.file || '') + 8411 (bits.query ? '?' + bits.query : '') + 8412 (bits.fragment ? '#' + bits.fragment : ''); 8413 }, 8414 8415 set: function(part, value, base){ 8416 if (part == 'value'){ 8417 var scheme = value.match(URI.regs.scheme); 8418 if (scheme) scheme = scheme[1]; 8419 if (scheme && this.schemes[scheme.toLowerCase()] == null) this.parsed = { scheme: scheme, value: value }; 8420 else this.parsed = this.parse(value, (base || this).parsed) || (scheme ? { scheme: scheme, value: value } : { value: value }); 8421 } else if (part == 'data'){ 8422 this.setData(value); 8423 } else { 8424 this.parsed[part] = value; 8425 } 8426 return this; 8427 }, 8428 8429 get: function(part, base){ 8430 switch (part){ 8431 case 'value': return this.combine(this.parsed, base ? base.parsed : false); 8432 case 'data' : return this.getData(); 8433 } 8434 return this.parsed[part] || ''; 8435 }, 8436 8437 go: function(){ 8438 document.location.href = this.toString(); 8439 }, 8440 8441 toURI: function(){ 8442 return this; 8443 }, 8444 8445 getData: function(key, part){ 8446 var qs = this.get(part || 'query'); 8447 if (!(qs || qs === 0)) return key ? null : {}; 8448 var obj = qs.parseQueryString(); 8449 return key ? obj[key] : obj; 8450 }, 8451 8452 setData: function(values, merge, part){ 8453 if (typeof values == 'string'){ 8454 var data = this.getData(); 8455 data[arguments[0]] = arguments[1]; 8456 values = data; 8457 } else if (merge){ 8458 values = Object.merge(this.getData(), values); 8459 } 8460 return this.set(part || 'query', Object.toQueryString(values)); 8461 }, 8462 8463 clearData: function(part){ 8464 return this.set(part || 'query', ''); 8465 }, 8466 8467 toString: toString, 8468 valueOf: toString 8469 8470}); 8471 8472URI.regs = { 8473 endSlash: /\/$/, 8474 scheme: /^(\w+):/, 8475 directoryDot: /\.\/|\.$/ 8476}; 8477 8478URI.base = new URI(Array.from(document.getElements('base[href]', true)).getLast(), {base: document.location}); 8479 8480String.implement({ 8481 8482 toURI: function(options){ 8483 return new URI(this, options); 8484 } 8485 8486}); 8487 8488})(); 8489 8490 8491/* 8492--- 8493 8494script: URI.Relative.js 8495 8496name: URI.Relative 8497 8498description: Extends the URI class to add methods for computing relative and absolute urls. 8499 8500license: MIT-style license 8501 8502authors: 8503 - Sebastian Markbåge 8504 8505 8506requires: 8507 - /Class.refactor 8508 - /URI 8509 8510provides: [URI.Relative] 8511 8512... 8513*/ 8514 8515URI = Class.refactor(URI, { 8516 8517 combine: function(bits, base){ 8518 if (!base || bits.scheme != base.scheme || bits.host != base.host || bits.port != base.port) 8519 return this.previous.apply(this, arguments); 8520 var end = bits.file + (bits.query ? '?' + bits.query : '') + (bits.fragment ? '#' + bits.fragment : ''); 8521 8522 if (!base.directory) return (bits.directory || (bits.file ? '' : './')) + end; 8523 8524 var baseDir = base.directory.split('/'), 8525 relDir = bits.directory.split('/'), 8526 path = '', 8527 offset; 8528 8529 var i = 0; 8530 for (offset = 0; offset < baseDir.length && offset < relDir.length && baseDir[offset] == relDir[offset]; offset++); 8531 for (i = 0; i < baseDir.length - offset - 1; i++) path += '../'; 8532 for (i = offset; i < relDir.length - 1; i++) path += relDir[i] + '/'; 8533 8534 return (path || (bits.file ? '' : './')) + end; 8535 }, 8536 8537 toAbsolute: function(base){ 8538 base = new URI(base); 8539 if (base) base.set('directory', '').set('file', ''); 8540 return this.toRelative(base); 8541 }, 8542 8543 toRelative: function(base){ 8544 return this.get('value', new URI(base)); 8545 } 8546 8547}); 8548 8549 8550/* 8551--- 8552 8553name: Hash 8554 8555description: Contains Hash Prototypes. Provides a means for overcoming the JavaScript practical impossibility of extending native Objects. 8556 8557license: MIT-style license. 8558 8559requires: 8560 - Core/Object 8561 - /MooTools.More 8562 8563provides: [Hash] 8564 8565... 8566*/ 8567 8568(function(){ 8569 8570if (this.Hash) return; 8571 8572var Hash = this.Hash = new Type('Hash', function(object){ 8573 if (typeOf(object) == 'hash') object = Object.clone(object.getClean()); 8574 for (var key in object) this[key] = object[key]; 8575 return this; 8576}); 8577 8578this.$H = function(object){ 8579 return new Hash(object); 8580}; 8581 8582Hash.implement({ 8583 8584 forEach: function(fn, bind){ 8585 Object.forEach(this, fn, bind); 8586 }, 8587 8588 getClean: function(){ 8589 var clean = {}; 8590 for (var key in this){ 8591 if (this.hasOwnProperty(key)) clean[key] = this[key]; 8592 } 8593 return clean; 8594 }, 8595 8596 getLength: function(){ 8597 var length = 0; 8598 for (var key in this){ 8599 if (this.hasOwnProperty(key)) length++; 8600 } 8601 return length; 8602 } 8603 8604}); 8605 8606Hash.alias('each', 'forEach'); 8607 8608Hash.implement({ 8609 8610 has: Object.prototype.hasOwnProperty, 8611 8612 keyOf: function(value){ 8613 return Object.keyOf(this, value); 8614 }, 8615 8616 hasValue: function(value){ 8617 return Object.contains(this, value); 8618 }, 8619 8620 extend: function(properties){ 8621 Hash.each(properties || {}, function(value, key){ 8622 Hash.set(this, key, value); 8623 }, this); 8624 return this; 8625 }, 8626 8627 combine: function(properties){ 8628 Hash.each(properties || {}, function(value, key){ 8629 Hash.include(this, key, value); 8630 }, this); 8631 return this; 8632 }, 8633 8634 erase: function(key){ 8635 if (this.hasOwnProperty(key)) delete this[key]; 8636 return this; 8637 }, 8638 8639 get: function(key){ 8640 return (this.hasOwnProperty(key)) ? this[key] : null; 8641 }, 8642 8643 set: function(key, value){ 8644 if (!this[key] || this.hasOwnProperty(key)) this[key] = value; 8645 return this; 8646 }, 8647 8648 empty: function(){ 8649 Hash.each(this, function(value, key){ 8650 delete this[key]; 8651 }, this); 8652 return this; 8653 }, 8654 8655 include: function(key, value){ 8656 if (this[key] == undefined) this[key] = value; 8657 return this; 8658 }, 8659 8660 map: function(fn, bind){ 8661 return new Hash(Object.map(this, fn, bind)); 8662 }, 8663 8664 filter: function(fn, bind){ 8665 return new Hash(Object.filter(this, fn, bind)); 8666 }, 8667 8668 every: function(fn, bind){ 8669 return Object.every(this, fn, bind); 8670 }, 8671 8672 some: function(fn, bind){ 8673 return Object.some(this, fn, bind); 8674 }, 8675 8676 getKeys: function(){ 8677 return Object.keys(this); 8678 }, 8679 8680 getValues: function(){ 8681 return Object.values(this); 8682 }, 8683 8684 toQueryString: function(base){ 8685 return Object.toQueryString(this, base); 8686 } 8687 8688}); 8689 8690Hash.alias({indexOf: 'keyOf', contains: 'hasValue'}); 8691 8692 8693})(); 8694 8695 8696 8697/* 8698--- 8699 8700script: Hash.Extras.js 8701 8702name: Hash.Extras 8703 8704description: Extends the Hash Type to include getFromPath which allows a path notation to child elements. 8705 8706license: MIT-style license 8707 8708authors: 8709 - Aaron Newton 8710 8711requires: 8712 - /Hash 8713 - /Object.Extras 8714 8715provides: [Hash.Extras] 8716 8717... 8718*/ 8719 8720Hash.implement({ 8721 8722 getFromPath: function(notation){ 8723 return Object.getFromPath(this, notation); 8724 }, 8725 8726 cleanValues: function(method){ 8727 return new Hash(Object.cleanValues(this, method)); 8728 }, 8729 8730 run: function(){ 8731 Object.run(arguments); 8732 } 8733 8734}); 8735 8736 8737/* 8738--- 8739 8740script: Element.Forms.js 8741 8742name: Element.Forms 8743 8744description: Extends the Element native object to include methods useful in managing inputs. 8745 8746license: MIT-style license 8747 8748authors: 8749 - Aaron Newton 8750 8751requires: 8752 - Core/Element 8753 - /String.Extras
8754 - /MooTools.More 8755 8756provides: [Element.Forms] 8757 8758... 8759*/ 8760 8761Element.implement({ 8762 8763 tidy: function(){ 8764 this.set('value', this.get('value').tidy()); 8765 }, 8766 8767 getTextInRange: function(start, end){ 8768 return this.get('value').substring(start, end); 8769 }, 8770 8771 getSelectedText: function(){ 8772 if (this.setSelectionRange) return this.getTextInRange(this.getSelectionStart(), this.getSelectionEnd()); 8773 return document.selection.createRange().text; 8774 }, 8775 8776 getSelectedRange: function(){ 8777 if (this.selectionStart != null){ 8778 return { 8779 start: this.selectionStart, 8780 end: this.selectionEnd 8781 }; 8782 } 8783 8784 var pos = { 8785 start: 0, 8786 end: 0 8787 }; 8788 var range = this.getDocument().selection.createRange(); 8789 if (!range || range.parentElement() != this) return pos; 8790 var duplicate = range.duplicate(); 8791 8792 if (this.type == 'text' || this.type == "password"){ 8793 pos.start = 0 - duplicate.moveStart('character', -100000); 8794 pos.end = pos.start + range.text.length; 8795 } else { 8796 var value = this.get('value'); 8797 var offset = value.length; 8798 duplicate.moveToElementText(this); 8799 duplicate.setEndPoint('StartToEnd', range); 8800 if (duplicate.text.length) offset -= value.match(/[\n\r]*$/)[0].length; 8801 pos.end = offset - duplicate.text.length; 8802 duplicate.setEndPoint('StartToStart', range); 8803 pos.start = offset - duplicate.text.length; 8804 } 8805 return pos; 8806 }, 8807 8808 getSelectionStart: function(){ 8809 return this.getSelectedRange().start; 8810 }, 8811 8812 getSelectionEnd: function(){ 8813 return this.getSelectedRange().end; 8814 }, 8815 8816 setCaretPosition: function(pos){ 8817 if (pos == 'end') pos = this.get('value').length; 8818 this.selectRange(pos, pos); 8819 return this; 8820 }, 8821 8822 getCaretPosition: function(){ 8823 return this.getSelectedRange().start; 8824 }, 8825 8826 selectRange: function(start, end){ 8827 if (this.setSelectionRange){ 8828 this.focus(); 8829 this.setSelectionRange(start, end); 8830 } else { 8831 var value = this.get('value'); 8832 var diff = value.substr(start, end - start).replace(/\r/g, '').length; 8833 start = value.substr(0, start).replace(/\r/g, '').length; 8834 var range = this.createTextRange(); 8835 range.collapse(true); 8836 range.moveEnd('character', start + diff); 8837 range.moveStart('character', start); 8838 range.select(); 8839 } 8840 return this; 8841 }, 8842 8843 insertAtCursor: function(value, select){ 8844 var pos = this.getSelectedRange(); 8845 var text = this.get('value'); 8846 this.set('value', text.substring(0, pos.start) + value + text.substring(pos.end, text.length)); 8847 if (select !== false) this.selectRange(pos.start, pos.start + value.length); 8848 else this.setCaretPosition(pos.start + value.length); 8849 return this; 8850 }, 8851 8852 insertAroundCursor: function(options, select){ 8853 options = Object.append({ 8854 before: '', 8855 defaultMiddle: '', 8856 after: '' 8857 }, options); 8858 8859 var value = this.getSelectedText() || options.defaultMiddle; 8860 var pos = this.getSelectedRange(); 8861 var text = this.get('value'); 8862 8863 if (pos.start == pos.end){ 8864 this.set('value', text.substring(0, pos.start) + options.before + value + options.after + text.substring(pos.end, text.length)); 8865 this.selectRange(pos.start + options.before.length, pos.end + options.before.length + value.length); 8866 } else { 8867 var current = text.substring(pos.start, pos.end); 8868 this.set('value', text.substring(0, pos.start) + options.before + current + options.after + text.substring(pos.end, text.length)); 8869 var selStart = pos.start + options.before.length; 8870 if (select !== false) this.selectRange(selStart, selStart + current.length); 8871 else this.setCaretPosition(selStart + text.length); 8872 } 8873 return this; 8874 } 8875 8876}); 8877 8878 8879/* 8880--- 8881 8882script: Elements.From.js 8883 8884name: Elements.From 8885 8886description: Returns a collection of elements from a string of html. 8887 8888license: MIT-style license 8889 8890authors: 8891 - Aaron Newton 8892 8893requires: 8894 - Core/String 8895 - Core/Element 8896 - /MooTools.More 8897 8898provides: [Elements.from, Elements.From] 8899 8900... 8901*/ 8902 8903Elements.from = function(text, excludeScripts){ 8904 if (excludeScripts || excludeScripts == null) text = text.stripScripts(); 8905 8906 var container, match = text.match(/^\s*<(t[dhr]|tbody|tfoot|thead)/i); 8907 8908 if (match){ 8909 container = new Element('table'); 8910 var tag = match[1].toLowerCase(); 8911 if (['td', 'th', 'tr'].contains(tag)){ 8912 container = new Element('tbody').inject(container); 8913 if (tag != 'tr') container = new Element('tr').inject(container); 8914 } 8915 } 8916 8917 return (container || new Element('div')).set('html', text).getChildren(); 8918}; 8919 8920 8921/* 8922--- 8923 8924name: Element.Event.Pseudos 8925 8926description: Adds the functionality to add pseudo events for Elements 8927 8928license: MIT-style license 8929 8930authors: 8931 - Arian Stolwijk 8932 8933requires: [Core/Element.Event, Core/Element.Delegation, Events.Pseudos] 8934 8935provides: [Element.Event.Pseudos, Element.Delegation] 8936 8937... 8938*/ 8939 8940(function(){ 8941
8942var pseudos = {relay: false}, 8943 copyFromEvents = ['once', 'throttle', 'pause'], 8944 count = copyFromEvents.length; 8945 8946while (count--) pseudos[copyFromEvents[count]] = Events.lookupPseudo(copyFromEvents[count]); 8947 8948DOMEvent.definePseudo = function(key, listener){ 8949 pseudos[key] = listener; 8950 return this; 8951}; 8952 8953var proto = Element.prototype; 8954[Element, Window, Document].invoke('implement', Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent)); 8955 8956})(); 8957 8958 8959/* 8960--- 8961 8962name: Element.Event.Pseudos.Keys 8963 8964description: Adds functionality fire events if certain keycombinations are pressed 8965 8966license: MIT-style license 8967 8968authors: 8969 - Arian Stolwijk 8970 8971requires: [Element.Event.Pseudos] 8972 8973provides: [Element.Event.Pseudos.Keys] 8974 8975... 8976*/ 8977 8978(function(){ 8979 8980var keysStoreKey = '$moo:keys-pressed', 8981 keysKeyupStoreKey = '$moo:keys-keyup'; 8982 8983 8984DOMEvent.definePseudo('keys', function(split, fn, args){ 8985 8986 var event = args[0], 8987 keys = [], 8988 pressed = this.retrieve(keysStoreKey, []); 8989 8990 keys.append(split.value.replace('++', function(){ 8991 keys.push('+'); // shift++ and shift+++a 8992 return ''; 8993 }).split('+')); 8994 8995 pressed.include(event.key); 8996 8997 if (keys.every(function(key){ 8998 return pressed.contains(key); 8999 })) fn.apply(this, args); 9000 9001 this.store(keysStoreKey, pressed); 9002 9003 if (!this.retrieve(keysKeyupStoreKey)){ 9004 var keyup = function(event){ 9005 (function(){ 9006 pressed = this.retrieve(keysStoreKey, []).erase(event.key); 9007 this.store(keysStoreKey, pressed); 9008 }).delay(0, this); // Fix for IE 9009 }; 9010 this.store(keysKeyupStoreKey, keyup).addEvent('keyup', keyup); 9011 } 9012 9013}); 9014 9015DOMEvent.defineKeys({ 9016 '16': 'shift', 9017 '17': 'control', 9018 '18': 'alt', 9019 '20': 'capslock', 9020 '33': 'pageup', 9021 '34': 'pagedown', 9022 '35': 'end', 9023 '36': 'home', 9024 '144': 'numlock', 9025 '145': 'scrolllock', 9026 '186': ';', 9027 '187': '=', 9028 '188': ',', 9029 '190': '.', 9030 '191': '/', 9031 '192': '`', 9032 '219': '[', 9033 '220': '\\', 9034 '221': ']', 9035 '222': "'", 9036 '107': '+' 9037}).defineKey(Browser.firefox ? 109 : 189, '-'); 9038 9039})(); 9040 9041 9042/* 9043--- 9044 9045script: Element.Measure.js 9046 9047name: Element.Measure 9048 9049description: Extends the Element native object to include methods useful in measuring dimensions. 9050 9051credits: "Element.measure / .expose methods by Daniel Steigerwald License: MIT-style license. Copyright: Copyright (c) 2008 Daniel Steigerwald, daniel.steigerwald.cz" 9052 9053license: MIT-style license 9054 9055authors: 9056 - Aaron Newton 9057 9058requires: 9059 - Core/Element.Style 9060 - Core/Element.Dimensions 9061 - /MooTools.More 9062 9063provides: [Element.Measure] 9064 9065... 9066*/ 9067 9068(function(){ 9069 9070var getStylesList = function(styles, planes){ 9071 var list = []; 9072 Object.each(planes, function(directions){ 9073 Object.each(directions, function(edge){ 9074 styles.each(function(style){ 9075 list.push(style + '-' + edge + (style == 'border' ? '-width' : '')); 9076 }); 9077 }); 9078 }); 9079 return list; 9080}; 9081 9082var calculateEdgeSize = function(edge, styles){ 9083 var total = 0; 9084 Object.each(styles, function(value, style){ 9085 if (style.test(edge)) total = total + value.toInt(); 9086 }); 9087 return total; 9088}; 9089 9090var isVisible = function(el){ 9091 return !!(!el || el.offsetHeight || el.offsetWidth); 9092}; 9093 9094 9095Element.implement({ 9096 9097 measure: function(fn){ 9098 if (isVisible(this)) return fn.call(this); 9099 var parent = this.getParent(), 9100 toMeasure = []; 9101 while (!isVisible(parent) && parent != document.body){ 9102 toMeasure.push(parent.expose()); 9103 parent = parent.getParent(); 9104 } 9105 var restore = this.expose(), 9106 result = fn.call(this);
9107 restore(); 9108 toMeasure.each(function(restore){ 9109 restore(); 9110 }); 9111 return result; 9112 }, 9113 9114 expose: function(){ 9115 if (this.getStyle('display') != 'none') return function(){}; 9116 var before = this.style.cssText; 9117 this.setStyles({ 9118 display: 'block', 9119 position: 'absolute', 9120 visibility: 'hidden' 9121 }); 9122 return function(){ 9123 this.style.cssText = before; 9124 }.bind(this); 9125 }, 9126 9127 getDimensions: function(options){ 9128 options = Object.merge({computeSize: false}, options); 9129 var dim = {x: 0, y: 0}; 9130 9131 var getSize = function(el, options){ 9132 return (options.computeSize) ? el.getComputedSize(options) : el.getSize(); 9133 }; 9134 9135 var parent = this.getParent('body'); 9136 9137 if (parent && this.getStyle('display') == 'none'){ 9138 dim = this.measure(function(){ 9139 return getSize(this, options); 9140 }); 9141 } else if (parent){ 9142 try { //safari sometimes crashes here, so catch it 9143 dim = getSize(this, options); 9144 }catch(e){} 9145 } 9146 9147 return Object.append(dim, (dim.x || dim.x === 0) ? { 9148 width: dim.x, 9149 height: dim.y 9150 } : { 9151 x: dim.width, 9152 y: dim.height 9153 } 9154 ); 9155 }, 9156 9157 getComputedSize: function(options){ 9158 //<1.2compat> 9159 //legacy support for my stupid spelling error 9160 if (options && options.plains) options.planes = options.plains; 9161 //</1.2compat> 9162 9163 options = Object.merge({ 9164 styles: ['padding','border'], 9165 planes: { 9166 height: ['top','bottom'], 9167 width: ['left','right'] 9168 }, 9169 mode: 'both' 9170 }, options); 9171 9172 var styles = {}, 9173 size = {width: 0, height: 0}, 9174 dimensions; 9175 9176 if (options.mode == 'vertical'){ 9177 delete size.width; 9178 delete options.planes.width; 9179 } else if (options.mode == 'horizontal'){ 9180 delete size.height; 9181 delete options.planes.height; 9182 } 9183 9184 getStylesList(options.styles, options.planes).each(function(style){ 9185 styles[style] = this.getStyle(style).toInt(); 9186 }, this); 9187 9188 Object.each(options.planes, function(edges, plane){ 9189 9190 var capitalized = plane.capitalize(), 9191 style = this.getStyle(plane); 9192 9193 if (style == 'auto' && !dimensions) dimensions = this.getDimensions(); 9194 9195 style = styles[plane] = (style == 'auto') ? dimensions[plane] : style.toInt(); 9196 size['total' + capitalized] = style; 9197 9198 edges.each(function(edge){ 9199 var edgesize = calculateEdgeSize(edge, styles); 9200 size['computed' + edge.capitalize()] = edgesize; 9201 size['total' + capitalized] += edgesize; 9202 }); 9203 9204 }, this); 9205 9206 return Object.append(size, styles); 9207 } 9208 9209}); 9210 9211})(); 9212 9213 9214/* 9215--- 9216 9217script: Element.Pin.js 9218 9219name: Element.Pin 9220 9221description: Extends the Element native object to include the pin method useful for fixed positioning for elements. 9222 9223license: MIT-style license 9224 9225authors: 9226 - Aaron Newton 9227 9228requires: 9229 - Core/Element.Event 9230 - Core/Element.Dimensions 9231 - Core/Element.Style 9232 - /MooTools.More 9233 9234provides: [Element.Pin] 9235 9236... 9237*/ 9238 9239(function(){ 9240 var supportsPositionFixed = false, 9241 supportTested = false; 9242 9243 var testPositionFixed = function(){ 9244 var test = new Element('div').setStyles({ 9245 position: 'fixed', 9246 top: 0, 9247 right: 0 9248 }).inject(document.body); 9249 supportsPositionFixed = (test.offsetTop === 0); 9250 test.dispose(); 9251 supportTested = true; 9252 }; 9253 9254 Element.implement({ 9255 9256 pin: function(enable, forceScroll){ 9257 if (!supportTested) testPositionFixed(); 9258 if (this.getStyle('display') == 'none') return this; 9259 9260 var pinnedPosition, 9261 scroll = window.getScroll(), 9262 parent, 9263 scrollFixer; 9264 9265 if (enable !== false){ 9266 pinnedPosition = this.getPosition(supportsPositionFixed ? document.body : this.getOffsetParent()); 9267 if (!this.retrieve('pin:_pinned')){ 9268 var currentPosition = { 9269 top: pinnedPosition.y - scroll.y, 9270 left: pinnedPosition.x - scroll.x 9271 }; 9272 9273 if (supportsPositionFixed && !forceScroll){ 9274 this.setStyle('position', 'fixed').setStyles(currentPosition); 9275 } else { 9276 9277 parent = this.getOffsetParent(); 9278 var position = this.getPosition(parent), 9279 styles = this.getStyles('left', 'top'); 9280 9281 if (parent && styles.left == 'auto' || styles.top == 'auto') this.setPosition(position); 9282 if (this.getStyle('position') == 'static') this.setStyle('position', 'absolute'); 9283 9284 position = { 9285 x: styles.left.toInt() - scroll.x, 9286 y: styles.top.toInt() - scroll.y 9287 }; 9288 9289 scrollFixer = function(){ 9290 if (!this.retrieve('pin:_pinned')) return; 9291 var scroll = window.getScroll(); 9292 this.setStyles({ 9293 left: position.x + scroll.x, 9294 top: position.y + scroll.y 9295 }); 9296 }.bind(this); 9297 9298 this.store('pin:_scrollFixer', scrollFixer); 9299 window.addEvent('scroll', scrollFixer); 9300 } 9301 this.store('pin:_pinned', true); 9302 } 9303 9304 } else { 9305 if (!this.retrieve('pin:_pinned')) return this; 9306 9307 parent = this.getParent(); 9308 var offsetParent = (parent.getComputedStyle('position') != 'static' ? parent : parent.getOffsetParent()); 9309 9310 pinnedPosition = this.getPosition(offsetParent); 9311 9312 this.store('pin:_pinned', false); 9313 scrollFixer = this.retrieve('pin:_scrollFixer'); 9314 if (!scrollFixer){ 9315 this.setStyles({ 9316 position: 'absolute', 9317 top: pinnedPosition.y + scroll.y, 9318 left: pinnedPosition.x + scroll.x 9319 }); 9320 } else { 9321 this.store('pin:_scrollFixer', null); 9322 window.removeEvent('scroll', scrollFixer); 9323 } 9324 this.removeClass('isPinned'); 9325 } 9326 return this; 9327 }, 9328 9329 unpin: function(){ 9330 return this.pin(false); 9331 }, 9332 9333 togglePin: function(){ 9334 return this.pin(!this.retrieve('pin:_pinned')); 9335 } 9336 9337 }); 9338 9339//<1.2compat> 9340Element.alias('togglepin', 'togglePin'); 9341//</1.2compat> 9342 9343}
9343)(); 9344 9345 9346/* 9347--- 9348 9349script: Element.Position.js 9350 9351name: Element.Position 9352 9353description: Extends the Element native object to include methods useful positioning elements relative to others. 9354 9355license: MIT-style license 9356 9357authors: 9358 - Aaron Newton 9359 - Jacob Thornton 9360 9361requires: 9362 - Core/Options 9363 - Core/Element.Dimensions 9364 - Element.Measure 9365 9366provides: [Element.Position] 9367 9368... 9369*/ 9370 9371(function(original){ 9372 9373var local = Element.Position = { 9374 9375 options: {/* 9376 edge: false, 9377 returnPos: false, 9378 minimum: {x: 0, y: 0}, 9379 maximum: {x: 0, y: 0}, 9380 relFixedPosition: false, 9381 ignoreMargins: false, 9382 ignoreScroll: false, 9383 allowNegative: false,*/ 9384 relativeTo: document.body, 9385 position: { 9386 x: 'center', //left, center, right 9387 y: 'center' //top, center, bottom 9388 }, 9389 offset: {x: 0, y: 0} 9390 }, 9391 9392 getOptions: function(element, options){ 9393 options = Object.merge({}, local.options, options); 9394 local.setPositionOption(options); 9395 local.setEdgeOption(options); 9396 local.setOffsetOption(element, options); 9397 local.setDimensionsOption(element, options); 9398 return options; 9399 }, 9400 9401 setPositionOption: function(options){ 9402 options.position = local.getCoordinateFromValue(options.position); 9403 }, 9404 9405 setEdgeOption: function(options){ 9406 var edgeOption = local.getCoordinateFromValue(options.edge); 9407 options.edge = edgeOption ? edgeOption : 9408 (options.position.x == 'center' && options.position.y == 'center') ? {x: 'center', y: 'center'} : 9409 {x: 'left', y: 'top'}; 9410 }, 9411 9412 setOffsetOption: function(element, options){ 9413 var parentOffset = {x: 0, y: 0}, 9414 offsetParent = element.measure(function(){ 9415 return document.id(this.getOffsetParent()); 9416 }), 9417 parentScroll = offsetParent.getScroll(); 9418 9419 if (!offsetParent || offsetParent == element.getDocument().body) return; 9420 parentOffset = offsetParent.measure(function(){ 9421 var position = this.getPosition(); 9422 if (this.getStyle('position') == 'fixed'){ 9423 var scroll = window.getScroll(); 9424 position.x += scroll.x; 9425 position.y += scroll.y; 9426 } 9427 return position; 9428 }); 9429 9430 options.offset = { 9431 parentPositioned: offsetParent != document.id(options.relativeTo), 9432 x: options.offset.x - parentOffset.x + parentScroll.x, 9433 y: options.offset.y - parentOffset.y + parentScroll.y 9434 }; 9435 }, 9436 9437 setDimensionsOption: function(element, options){ 9438 options.dimensions = element.getDimensions({ 9439 computeSize: true, 9440 styles: ['padding', 'border', 'margin'] 9441 }); 9442 }, 9443 9444 getPosition: function(element, options){ 9445 var position = {}; 9446 options = local.getOptions(element, options); 9447 var relativeTo = document.id(options.relativeTo) || document.body; 9448 9449 local.setPositionCoordinates(options, position, relativeTo); 9450 if (options.edge) local.toEdge(position, options); 9451 9452 var offset = options.offset; 9453 position.left = ((position.x >= 0 || offset.parentPositioned || options.allowNegative) ? position.x : 0).toInt(); 9454 position.top = ((position.y >= 0 || offset.parentPositioned || options.allowNegative) ? position.y : 0).toInt(); 9455 9456 local.toMinMax(position, options); 9457 9458 if (options.relFixedPosition || relativeTo.getStyle('position') == 'fixed') local.toRelFixedPosition(relativeTo, position); 9459 if (options.ignoreScroll) local.toIgnoreScroll(relativeTo, position); 9460 if (options.ignoreMargins) local.toIgnoreMargins(position, options); 9461
9462 position.left = Math.ceil(position.left); 9463 position.top = Math.ceil(position.top); 9464 delete position.x; 9465 delete position.y; 9466 9467 return position; 9468 }, 9469 9470 setPositionCoordinates: function(options, position, relativeTo){ 9471 var offsetY = options.offset.y, 9472 offsetX = options.offset.x, 9473 calc = (relativeTo == document.body) ? window.getScroll() : relativeTo.getPosition(), 9474 top = calc.y, 9475 left = calc.x, 9476 winSize = window.getSize(); 9477 9478 switch(options.position.x){ 9479 case 'left': position.x = left + offsetX; break; 9480 case 'right': position.x = left + offsetX + relativeTo.offsetWidth; break; 9481 default: position.x = left + ((relativeTo == document.body ? winSize.x : relativeTo.offsetWidth) / 2) + offsetX; break; 9482 } 9483 9484 switch(options.position.y){ 9485 case 'top': position.y = top + offsetY; break; 9486 case 'bottom': position.y = top + offsetY + relativeTo.offsetHeight; break; 9487 default: position.y = top + ((relativeTo == document.body ? winSize.y : relativeTo.offsetHeight) / 2) + offsetY; break; 9488 } 9489 }, 9490 9491 toMinMax: function(position, options){ 9492 var xy = {left: 'x', top: 'y'}, value; 9493 ['minimum', 'maximum'].each(function(minmax){ 9494 ['left', 'top'].each(function(lr){ 9495 value = options[minmax] ? options[minmax][xy[lr]] : null; 9496 if (value != null && ((minmax == 'minimum') ? position[lr] < value : position[lr] > value)) position[lr] = value; 9497 }); 9498 }); 9499 }, 9500 9501 toRelFixedPosition: function(relativeTo, position){ 9502 var winScroll = window.getScroll(); 9503 position.top += winScroll.y; 9504 position.left += winScroll.x; 9505 }, 9506 9507 toIgnoreScroll: function(relativeTo, position){ 9508 var relScroll = relativeTo.getScroll(); 9509 position.top -= relScroll.y; 9510 position.left -= relScroll.x; 9511 }, 9512 9513 toIgnoreMargins: function(position, options){ 9514 position.left += options.edge.x == 'right' 9515 ? options.dimensions['margin-right'] 9516 : (options.edge.x != 'center' 9517 ? -options.dimensions['margin-left'] 9518 : -options.dimensions['margin-left'] + ((options.dimensions['margin-right'] + options.dimensions['margin-left']) / 2)); 9519 9520 position.top += options.edge.y == 'bottom' 9521 ? options.dimensions['margin-bottom'] 9522 : (options.edge.y != 'center' 9523 ? -options.dimensions['margin-top'] 9524 : -options.dimensions['margin-top'] + ((options.dimensions['margin-bottom'] + options.dimensions['margin-top']) / 2)); 9525 }, 9526 9527 toEdge: function(position, options){ 9528 var edgeOffset = {}, 9529 dimensions = options.dimensions, 9530 edge = options.edge; 9531 9532 switch(edge.x){ 9533 case 'left': edgeOffset.x = 0; break; 9534 case 'right': edgeOffset.x = -dimensions.x - dimensions.computedRight - dimensions.computedLeft; break; 9535 // center 9536 default: edgeOffset.x = -(Math.round(dimensions.totalWidth / 2)); break; 9537 } 9538 9539 switch(edge.y){ 9540 case 'top': edgeOffset.y = 0; break; 9541 case 'bottom': edgeOffset.y = -dimensions.y - dimensions.computedTop - dimensions.computedBottom; break; 9542 // center 9543 default: edgeOffset.y = -(Math.round(dimensions.totalHeight / 2)); break; 9544 } 9545 9546 position.x += edgeOffset.x; 9547 position.y += edgeOffset.y; 9548 }, 9549 9550 getCoordinateFromValue: function(option){ 9551 if (typeOf(option) != 'string') return option; 9552 option = option.toLowerCase(); 9553 9554 return { 9555 x: option.test('left') ? 'left' 9556 : (option.test('right') ? 'right' : 'center'), 9557 y: option.test(/upper|top/) ? 'top' 9558 : (option.test('bottom') ? 'bottom' : 'center') 9559 }; 9560 } 9561 9562}; 9563 9564Element.implement({ 9565 9566 position: function(options){ 9567 if (options && (options.x != null || options.y != null)){ 9568 return (original ? original.apply(this, arguments) : this); 9569 } 9570 var position = this.setStyle('position', 'absolute').calculatePosition(options); 9571 return (options && options.returnPos) ? position : this.setStyles(position); 9572 }, 9573 9574 calculatePosition: function(options){ 9575 return local.getPosition(this, options); 9576 } 9577 9578}); 9579 9580})(Element.prototype.position); 9581 9582 9583/* 9584--- 9585 9586script: Element.Shortcuts.js 9587 9588name: Element.Shortcuts 9589 9590description: Extends the Element native object to include some shortcut methods. 9591 9592license: MIT-style license 9593 9594authors: 9595 - Aaron Newton 9596 9597requires: 9598 - Core/Element.Style 9599 - /MooTools.More 9600 9601provides: [Element.Shortcuts] 9602 9603... 9604*/ 9605 9606Element.implement({ 9607 9608 isDisplayed: function(){
9609 return this.getStyle('display') != 'none'; 9610 }, 9611 9612 isVisible: function(){ 9613 var w = this.offsetWidth, 9614 h = this.offsetHeight; 9615 return (w == 0 && h == 0) ? false : (w > 0 && h > 0) ? true : this.style.display != 'none'; 9616 }, 9617 9618 toggle: function(){ 9619 return this[this.isDisplayed() ? 'hide' : 'show'](); 9620 }, 9621 9622 hide: function(){ 9623 var d; 9624 try { 9625 //IE fails here if the element is not in the dom 9626 d = this.getStyle('display'); 9627 } catch(e){} 9628 if (d == 'none') return this; 9629 return this.store('element:_originalDisplay', d || '').setStyle('display', 'none'); 9630 }, 9631 9632 show: function(display){ 9633 if (!display && this.isDisplayed()) return this; 9634 display = display || this.retrieve('element:_originalDisplay') || 'block'; 9635 return this.setStyle('display', (display == 'none') ? 'block' : display); 9636 }, 9637 9638 swapClass: function(remove, add){ 9639 return this.removeClass(remove).addClass(add); 9640 } 9641 9642}); 9643 9644Document.implement({ 9645 9646 clearSelection: function(){ 9647 if (window.getSelection){ 9648 var selection = window.getSelection(); 9649 if (selection && selection.removeAllRanges) selection.removeAllRanges(); 9650 } else if (document.selection && document.selection.empty){ 9651 try { 9652 //IE fails here if selected element is not in dom 9653 document.selection.empty(); 9654 } catch(e){} 9655 } 9656 } 9657 9658}); 9659 9660 9661/* 9662--- 9663 9664script: IframeShim.js 9665 9666name: IframeShim 9667 9668description: Defines IframeShim, a class for obscuring select lists and flash objects in IE. 9669 9670license: MIT-style license 9671 9672authors: 9673 - Aaron Newton 9674 9675requires: 9676 - Core/Element.Event 9677 - Core/Element.Style 9678 - Core/Options 9679 - Core/Events 9680 - /Element.Position 9681 - /Class.Occlude 9682 9683provides: [IframeShim] 9684 9685... 9686*/ 9687 9688var IframeShim = new Class({ 9689 9690 Implements: [Options, Events, Class.Occlude], 9691 9692 options: { 9693 className: 'iframeShim', 9694 src: 'javascript:false;document.write("");', 9695 display: false, 9696 zIndex: null, 9697 margin: 0, 9698 offset: {x: 0, y: 0}, 9699 browsers: (Browser.ie6 || (Browser.firefox && Browser.version < 3 && Browser.Platform.mac)) 9700 }, 9701 9702 property: 'IframeShim', 9703 9704 initialize: function(element, options){ 9705 this.element = document.id(element); 9706 if (this.occlude()) return this.occluded; 9707 this.setOptions(options); 9708 this.makeShim(); 9709 return this; 9710 }, 9711 9712 makeShim: function(){ 9713 if (this.options.browsers){ 9714 var zIndex = this.element.getStyle('zIndex').toInt(); 9715 9716 if (!zIndex){ 9717 zIndex = 1; 9718 var pos = this.element.getStyle('position'); 9719 if (pos == 'static' || !pos) this.element.setStyle('position', 'relative'); 9720 this.element.setStyle('zIndex', zIndex); 9721 } 9722 zIndex = ((this.options.zIndex != null || this.options.zIndex === 0) && zIndex > this.options.zIndex) ? this.options.zIndex : zIndex - 1; 9723 if (zIndex < 0) zIndex = 1; 9724 this.shim = new Element('iframe', { 9725 src: this.options.src, 9726 scrolling: 'no', 9727 frameborder: 0, 9728 styles: { 9729 zIndex: zIndex, 9730 position: 'absolute', 9731 border: 'none', 9732 filter: 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)' 9733 }, 9734 'class': this.options.className 9735 }).store('IframeShim', this); 9736 var inject = (function(){ 9737 this.shim.inject(this.element, 'after'); 9738 this[this.options.display ? 'show' : 'hide'](); 9739 this.fireEvent('inject'); 9740 }).bind(this); 9741 if (!IframeShim.ready) window.addEvent('load', inject); 9742 else inject(); 9743 } else { 9744 this.position = this.hide = this.show = this.dispose = Function.from(this); 9745 } 9746 }, 9747 9748 position: function(){ 9749 if (!IframeShim.ready || !this.shim) return this; 9750 var size = this.element.measure(function(){ 9751 return this.getSize(); 9752 }); 9753 if (this.options.margin != undefined){ 9754 size.x = size.x - (this.options.margin * 2); 9755 size.y = size.y - (this.options.margin * 2); 9756 this.options.offset.x += this.options.margin; 9757 this.options.offset.y += this.options.margin; 9758 } 9759 this.shim.set({width: size.x, height: size.y}).position({ 9760 relativeTo: this.element, 9761 offset: this.options.offset 9762 }); 9763 return this; 9764 }, 9765 9766 hide: function(){ 9767 if (this.shim) this.shim.setStyle('display', 'none'); 9768 return this; 9769 }, 9770 9771 show: function(){ 9772 if (this.shim) this.shim.setStyle('display', 'block'); 9773 return this.position(); 9774 }, 9775 9776 dispose: function(){ 9777 if (this.shim) this.shim.dispose(); 9778 return this; 9779 }, 9780 9781 destroy: function(){ 9782 if (this.shim) this.shim.destroy(); 9783 return this; 9784 } 9785 9786}); 9787 9788window.addEvent('load', function(){ 9789 IframeShim.ready = true; 9790}); 9791 9792 9793/* 9794--- 9795 9796script: Mask.js 9797 9798name: Mask 9799 9800description: Creates a mask element to cover another. 9801 9802license: MIT-style license 9803 9804authors: 9805 - Aaron Newton 9806 9807requires: 9808 - Core/Options 9809 - Core/Events 9810 - Core/Element.Event 9811 - /Class.Binds 9812 - /Element.Position 9813 - /IframeShim 9814 9815provides: [Mask] 9816 9817... 9818*/ 9819 9820var Mask = new Class({ 9821 9822 Implements: [Options, Events], 9823 9824 Binds: ['position'], 9825 9826 options: {/* 9827 onShow: function(){}, 9828 onHide: function(){}, 9829 onDestroy: function(){}, 9830 onClick: function(event){}, 9831 inject: { 9832 where: 'after', 9833 target: null, 9834 }, 9835 hideOnClick: false, 9836 id: null, 9837 destroyOnHide: false,*/ 9838 style: {}, 9839 'class': 'mask', 9840 maskMargins: false, 9841 useIframeShim: true, 9842 iframeShimOptions: {} 9843 }, 9844 9845 initialize: function(target, options){ 9846 this.target = document.id(target) || document.id(document.body); 9847 this.target.store('mask', this); 9848 this.setOptions(options); 9849 this.render(); 9850 this.inject(); 9851 }, 9852 9853 render: function(){ 9854 this.element = new Element('div', { 9855 'class': this.options['class'], 9856 id: this.options.id || 'mask-' + String.uniqueID(), 9857 styles: Object.merge({}, this.options.style, { 9858 display: 'none' 9859 }), 9860 events: { 9861 click: function(event){ 9862 this.fireEvent('click', event); 9863 if (this.options.hideOnClick) this.hide(); 9864 }.bind(this) 9865 } 9866 }); 9867 9868 this.hidden = true; 9869 }, 9870 9871 toElement: function(){ 9872 return this.element; 9873 }, 9874 9875 inject: function(target, where){ 9876 where = where || (this.options.inject ? this.options.inject.where : '') || this.target == document.body ? 'inside' : 'after'; 9877 target = target || (this.options.inject && this.options.inject.target) || this.target; 9878 9879 this.element.inject(target, where); 9880 9881 if (this.options.useIframeShim){ 9882 this.shim = new IframeShim(this.element, this.options.iframeShimOptions); 9883 9884 this.addEvents({ 9885 show: this.shim.show.bind(this.shim), 9886 hide: this.shim.hide.bind(this.shim), 9887 destroy: this.shim.destroy.bind(this.shim) 9888 }); 9889 } 9890 }, 9891 9892 position: function(){ 9893 this.resize(this.options.width, this.options.height); 9894 9895 this.element.position({ 9896 relativeTo: this.target, 9897 position: 'topLeft', 9898 ignoreMargins: !this.options.maskMargins, 9899 ignoreScroll: this.target == document.body 9900 }); 9901 9902 return this; 9903 }, 9904 9905 resize: function(x, y){ 9906 var opt = { 9907 styles: ['padding', 'border'] 9908 }; 9909 if (this.options.maskMargins) opt.styles.push('margin'); 9910 9911 var dim = this.target.getComputedSize(opt); 9912 if (this.target == document.body){ 9913 this.element.setStyles({width: 0, height: 0}); 9914 var win = window.getScrollSize(); 9915 if (dim.totalHeight < win.y) dim.totalHeight = win.y; 9916 if (dim.totalWidth < win.x) dim.totalWidth = win.x; 9917 } 9918 this.element.setStyles({ 9919 width: Array.pick([x, dim.totalWidth, dim.x]), 9920 height: Array.pick([y, dim.totalHeight, dim.y]) 9921 }); 9922 9923 return this; 9924 }, 9925 9926 show: function(){ 9927 if (!this.hidden) return this; 9928 9929 window.addEvent('resize', this.position); 9930 this.position(); 9931 this.showMask.apply(this, arguments); 9932 9933 return this; 9934 }, 9935 9936 showMask: function(){ 9937 this.element.setStyle('display', 'block'); 9938 this.hidden = false;
9939 this.fireEvent('show'); 9940 }, 9941 9942 hide: function(){ 9943 if (this.hidden) return this; 9944 9945 window.removeEvent('resize', this.position); 9946 this.hideMask.apply(this, arguments); 9947 if (this.options.destroyOnHide) return this.destroy(); 9948 9949 return this; 9950 }, 9951 9952 hideMask: function(){ 9953 this.element.setStyle('display', 'none'); 9954 this.hidden = true; 9955 this.fireEvent('hide'); 9956 }, 9957 9958 toggle: function(){ 9959 this[this.hidden ? 'show' : 'hide'](); 9960 }, 9961 9962 destroy: function(){ 9963 this.hide(); 9964 this.element.destroy(); 9965 this.fireEvent('destroy'); 9966 this.target.eliminate('mask'); 9967 } 9968 9969}); 9970 9971Element.Properties.mask = { 9972 9973 set: function(options){ 9974 var mask = this.retrieve('mask'); 9975 if (mask) mask.destroy(); 9976 return this.eliminate('mask').store('mask:options', options); 9977 }, 9978 9979 get: function(){ 9980 var mask = this.retrieve('mask'); 9981 if (!mask){ 9982 mask = new Mask(this, this.retrieve('mask:options')); 9983 this.store('mask', mask); 9984 } 9985 return mask; 9986 } 9987 9988}; 9989 9990Element.implement({ 9991 9992 mask: function(options){ 9993 if (options) this.set('mask', options); 9994 this.get('mask').show(); 9995 return this; 9996 }, 9997 9998 unmask: function(){ 9999 this.get('mask').hide(); 10000 return this; 10001 } 10002 10003}); 10004 10005 10006/* 10007--- 10008 10009script: Spinner.js 10010 10011name: Spinner 10012 10013description: Adds a semi-transparent overlay over a dom element with a spinnin ajax icon. 10014 10015license: MIT-style license 10016 10017authors: 10018 - Aaron Newton 10019 10020requires: 10021 - Core/Fx.Tween 10022 - Core/Request 10023 - /Class.refactor 10024 - /Mask 10025 10026provides: [Spinner] 10027 10028... 10029*/ 10030 10031var Spinner = new Class({ 10032 10033 Extends: Mask, 10034 10035 Implements: Chain, 10036 10037 options: {/* 10038 message: false,*/ 10039 'class': 'spinner', 10040 containerPosition: {}, 10041 content: { 10042 'class': 'spinner-content' 10043 }, 10044 messageContainer: { 10045 'class': 'spinner-msg' 10046 }, 10047 img: { 10048 'class': 'spinner-img' 10049 }, 10050 fxOptions: { 10051 link: 'chain' 10052 } 10053 }, 10054 10055 initialize: function(target, options){ 10056 this.target = document.id(target) || document.id(document.body); 10057 this.target.store('spinner', this); 10058 this.setOptions(options); 10059 this.render(); 10060 this.inject(); 10061 10062 // Add this to events for when noFx is true; parent methods handle hide/show. 10063 var deactivate = function(){ this.active = false; }.bind(this); 10064 this.addEvents({ 10065 hide: deactivate, 10066 show: deactivate 10067 }); 10068 }, 10069 10070 render: function(){ 10071 this.parent(); 10072 10073 this.element.set('id', this.options.id || 'spinner-' + String.uniqueID()); 10074 10075 this.content = document.id(this.options.content) || new Element('div', this.options.content); 10076 this.content.inject(this.element); 10077 10078 if (this.options.message){ 10079 this.msg = document.id(this.options.message) || new Element('p', this.options.messageContainer).appendText(this.options.message); 10080 this.msg.inject(this.content); 10081 } 10082 10083 if (this.options.img){ 10084 this.img = document.id(this.options.img) || new Element('div', this.options.img); 10085 this.img.inject(this.content); 10086 } 10087 10088 this.element.set('tween', this.options.fxOptions); 10089 }, 10090 10091 show: function(noFx){ 10092 if (this.active) return this.chain(this.show.bind(this)); 10093 if (!this.hidden){ 10094 this.callChain.delay(20, this); 10095 return this; 10096 } 10097 10098 this.active = true; 10099 10100 return this.parent(noFx); 10101 }, 10102 10103 showMask: function(noFx){ 10104 var pos = function(){ 10105 this.content.position(Object.merge({ 10106 relativeTo: this.element 10107 }, this.options.containerPosition)); 10108 }.bind(this); 10109 10110 if (noFx){ 10111 this.parent(); 10112 pos(); 10113 } else { 10114 if (!this.options.style.opacity) this.options.style.opacity = this.element.getStyle('opacity').toFloat(); 10115 this.element.setStyles({ 10116 display: 'block', 10117 opacity: 0 10118 }).tween('opacity', this.options.style.opacity); 10119 pos(); 10120 this.hidden = false; 10121 this.fireEvent('show'); 10122 this.callChain(); 10123 } 10124 }, 10125 10126 hide: function(noFx){ 10127 if (this.active) return this.chain(this.hide.bind(this)); 10128 if (this.hidden){ 10129 this.callChain.delay(20, this); 10130 return this; 10131 } 10132 this.active = true; 10133 return this.parent(noFx); 10134 }, 10135 10136 hideMask: function(noFx){ 10137 if (noFx) return this.parent(); 10138 this.element.tween('opacity', 0).get('tween').chain(function(){ 10139 this.element.setStyle('display', 'none'); 10140 this.hidden = true; 10141 this.fireEvent('hide'); 10142 this.callChain(); 10143 }.bind(this)); 10144 }, 10145 10146 destroy: function(){ 10147 this.content.destroy(); 10148 this.parent(); 10149 this.target.eliminate('spinner'); 10150 } 10151 10152}); 10153
10154Request = Class.refactor(Request, { 10155 10156 options: { 10157 useSpinner: false, 10158 spinnerOptions: {}, 10159 spinnerTarget: false 10160 }, 10161 10162 initialize: function(options){ 10163 this._send = this.send; 10164 this.send = function(options){ 10165 var spinner = this.getSpinner(); 10166 if (spinner) spinner.chain(this._send.pass(options, this)).show(); 10167 else this._send(options); 10168 return this; 10169 }; 10170 this.previous(options); 10171 }, 10172 10173 getSpinner: function(){ 10174 if (!this.spinner){ 10175 var update = document.id(this.options.spinnerTarget) || document.id(this.options.update); 10176 if (this.options.useSpinner && update){ 10177 update.set('spinner', this.options.spinnerOptions); 10178 var spinner = this.spinner = update.get('spinner'); 10179 ['complete', 'exception', 'cancel'].each(function(event){ 10180 this.addEvent(event, spinner.hide.bind(spinner)); 10181 }, this); 10182 } 10183 } 10184 return this.spinner; 10185 } 10186 10187}); 10188 10189Element.Properties.spinner = { 10190 10191 set: function(options){ 10192 var spinner = this.retrieve('spinner'); 10193 if (spinner) spinner.destroy(); 10194 return this.eliminate('spinner').store('spinner:options', options); 10195 }, 10196 10197 get: function(){ 10198 var spinner = this.retrieve('spinner'); 10199 if (!spinner){ 10200 spinner = new Spinner(this, this.retrieve('spinner:options')); 10201 this.store('spinner', spinner); 10202 } 10203 return spinner; 10204 } 10205 10206}; 10207 10208Element.implement({ 10209 10210 spin: function(options){ 10211 if (options) this.set('spinner', options); 10212 this.get('spinner').show(); 10213 return this; 10214 }, 10215 10216 unspin: function(){ 10217 this.get('spinner').hide(); 10218 return this; 10219 } 10220 10221}); 10222 10223 10224/* 10225--- 10226 10227script: Form.Request.js 10228 10229name: Form.Request 10230 10231description: Handles the basic functionality of submitting a form and updating a dom element with the result. 10232 10233license: MIT-style license 10234 10235authors: 10236 - Aaron Newton 10237 10238requires: 10239 - Core/Request.HTML 10240 - /Class.Binds 10241 - /Class.Occlude 10242 - /Spinner 10243 - /String.QueryString 10244 - /Element.Delegation 10245 10246provides: [Form.Request] 10247 10248... 10249*/ 10250 10251if (!window.Form) window.Form = {}; 10252 10253(function(){ 10254 10255 Form.Request = new Class({ 10256 10257 Binds: ['onSubmit', 'onFormValidate'], 10258 10259 Implements: [Options, Events, Class.Occlude], 10260 10261 options: {/* 10262 onFailure: function(){}, 10263 onSuccess: function(){}, // aliased to onComplete, 10264 onSend: function(){}*/ 10265 requestOptions: { 10266 evalScripts: true, 10267 useSpinner: true, 10268 emulation: false, 10269 link: 'ignore' 10270 }, 10271 sendButtonClicked: true, 10272 extraData: {}, 10273 resetForm: true 10274 }, 10275 10276 property: 'form.request', 10277 10278 initialize: function(form, target, options){ 10279 this.element = document.id(form); 10280 if (this.occlude()) return this.occluded; 10281 this.setOptions(options) 10282 .setTarget(target) 10283 .attach(); 10284 }, 10285 10286 setTarget: function(target){ 10287 this.target = document.id(target); 10288 if (!this.request){ 10289 this.makeRequest(); 10290 } else { 10291 this.request.setOptions({ 10292 update: this.target 10293 }); 10294 } 10295 return this; 10296 }, 10297 10298 toElement: function(){ 10299 return this.element; 10300 }, 10301 10302 makeRequest: function(){ 10303 var self = this; 10304 this.request = new Request.HTML(Object.merge({ 10305 update: this.target, 10306 emulation: false, 10307 spinnerTarget: this.element, 10308 method: this.element.get('method') || 'post' 10309 }, this.options.requestOptions)).addEvents({ 10310 success: function(tree, elements, html, javascript){ 10311 ['complete', 'success'].each(function(evt){ 10312 self.fireEvent(evt, [self.target, tree, elements, html, javascript]); 10313 }); 10314 }, 10315 failure: function(){ 10316 self.fireEvent('complete', arguments).fireEvent('failure', arguments); 10317 }, 10318 exception: function(){ 10319 self.fireEvent('failure', arguments); 10320 } 10321 }); 10322 return this.attachReset(); 10323 }, 10324 10325 attachReset: function(){ 10326 if (!this.options.resetForm) return this; 10327 this.request.addEvent('success', function(){ 10328 Function.attempt(function(){ 10329 this.element.reset(); 10330 }.bind(this)); 10331 if (window.OverText) OverText.update(); 10332 }.bind(this)); 10333 return this; 10334 }, 10335 10336 attach: function(attach){ 10337 var method = (attach != false) ? 'addEvent' : 'removeEvent'; 10338 this.element[method]('click:relay(button, input[type=submit])', this.saveClickedButton.bind(this)); 10339 10340 var fv = this.element.retrieve('validator'); 10341 if (fv) fv[method]('onFormValidate', this.onFormValidate); 10342 else this.element[method]('submit', this.onSubmit); 10343 10344 return this; 10345 }, 10346 10347 detach: function(){ 10348 return this.attach(false); 10349 }, 10350 10351 //public method 10352 enable: function(){ 10353 return this.attach(); 10354 }, 10355 10356 //public method 10357 disable: function(){ 10358 return this.detach(); 10359 }, 10360
10361 onFormValidate: function(valid, form, event){ 10362 //if there's no event, then this wasn't a submit event 10363 if (!event) return; 10364 var fv = this.element.retrieve('validator'); 10365 if (valid || (fv && !fv.options.stopOnFailure)){ 10366 event.stop(); 10367 this.send(); 10368 } 10369 }, 10370 10371 onSubmit: function(event){ 10372 var fv = this.element.retrieve('validator'); 10373 if (fv){ 10374 //form validator was created after Form.Request 10375 this.element.removeEvent('submit', this.onSubmit); 10376 fv.addEvent('onFormValidate', this.onFormValidate); 10377 this.element.validate(); 10378 return; 10379 } 10380 if (event) event.stop(); 10381 this.send(); 10382 }, 10383 10384 saveClickedButton: function(event, target){ 10385 var targetName = target.get('name'); 10386 if (!targetName || !this.options.sendButtonClicked) return; 10387 this.options.extraData[targetName] = target.get('value') || true; 10388 this.clickedCleaner = function(){ 10389 delete this.options.extraData[targetName]; 10390 this.clickedCleaner = function(){}; 10391 }.bind(this); 10392 }, 10393 10394 clickedCleaner: function(){}, 10395 10396 send: function(){ 10397 var str = this.element.toQueryString().trim(), 10398 data = Object.toQueryString(this.options.extraData); 10399 10400 if (str) str += "&" + data; 10401 else str = data; 10402 10403 this.fireEvent('send', [this.element, str.parseQueryString()]); 10404 this.request.send({ 10405 data: str, 10406 url: this.options.requestOptions.url || this.element.get('action') 10407 }); 10408 this.clickedCleaner(); 10409 return this; 10410 } 10411 10412 }); 10413 10414 Element.implement('formUpdate', function(update, options){ 10415 var fq = this.retrieve('form.request'); 10416 if (!fq){
10417 fq = new Form.Request(this, update, options); 10418 } else { 10419 if (update) fq.setTarget(update); 10420 if (options) fq.setOptions(options).makeRequest(); 10421 } 10422 fq.send(); 10423 return this; 10424 }); 10425 10426})(); 10427 10428 10429/* 10430--- 10431 10432script: Fx.Reveal.js 10433 10434name: Fx.Reveal 10435 10436description: Defines Fx.Reveal, a class that shows and hides elements with a transition. 10437 10438license: MIT-style license 10439 10440authors: 10441 - Aaron Newton 10442 10443requires: 10444 - Core/Fx.Morph 10445 - /Element.Shortcuts 10446 - /Element.Measure 10447 10448provides: [Fx.Reveal] 10449 10450... 10451*/ 10452 10453(function(){ 10454 10455 10456var hideTheseOf = function(object){ 10457 var hideThese = object.options.hideInputs; 10458 if (window.OverText){ 10459 var otClasses = [null]; 10460 OverText.each(function(ot){ 10461 otClasses.include('.' + ot.options.labelClass); 10462 }); 10463 if (otClasses) hideThese += otClasses.join(', '); 10464 } 10465 return (hideThese) ? object.element.getElements(hideThese) : null; 10466}; 10467 10468 10469Fx.Reveal = new Class({ 10470 10471 Extends: Fx.Morph, 10472 10473 options: {/* 10474 onShow: function(thisElement){}, 10475 onHide: function(thisElement){}, 10476 onComplete: function(thisElement){}, 10477 heightOverride: null, 10478 widthOverride: null,*/ 10479 link: 'cancel', 10480 styles: ['padding', 'border', 'margin'], 10481 transitionOpacity: !Browser.ie6, 10482 mode: 'vertical', 10483 display: function(){ 10484 return this.element.get('tag') != 'tr' ? 'block' : 'table-row'; 10485 }, 10486 opacity: 1, 10487 hideInputs: Browser.ie ? 'select, input, textarea, object, embed' : null 10488 }, 10489 10490 dissolve: function(){ 10491 if (!this.hiding && !this.showing){ 10492 if (this.element.getStyle('display') != 'none'){ 10493 this.hiding = true; 10494 this.showing = false; 10495 this.hidden = true; 10496 this.cssText = this.element.style.cssText; 10497 10498 var startStyles = this.element.getComputedSize({ 10499 styles: this.options.styles, 10500 mode: this.options.mode 10501 }); 10502 if (this.options.transitionOpacity) startStyles.opacity = this.options.opacity; 10503 10504 var zero = {}; 10505 Object.each(startStyles, function(style, name){ 10506 zero[name] = [style, 0]; 10507 }); 10508 10509 this.element.setStyles({ 10510 display: Function.from(this.options.display).call(this), 10511 overflow: 'hidden' 10512 }); 10513 10514 var hideThese = hideTheseOf(this); 10515 if (hideThese) hideThese.setStyle('visibility', 'hidden'); 10516 10517 this.$chain.unshift(function(){ 10518 if (this.hidden){ 10519 this.hiding = false; 10520 this.element.style.cssText = this.cssText; 10521 this.element.setStyle('display', 'none'); 10522 if (hideThese) hideThese.setStyle('visibility', 'visible'); 10523 } 10524 this.fireEvent('hide', this.element); 10525 this.callChain(); 10526 }.bind(this)); 10527 10528 this.start(zero); 10529 } else { 10530 this.callChain.delay(10, this); 10531 this.fireEvent('complete', this.element); 10532 this.fireEvent('hide', this.element); 10533 } 10534 } else if (this.options.link == 'chain'){ 10535 this.chain(this.dissolve.bind(this)); 10536 } else if (this.options.link == 'cancel' && !this.hiding){ 10537 this.cancel(); 10538 this.dissolve(); 10539 } 10540 return this; 10541 }, 10542 10543 reveal: function(){ 10544 if (!this.showing && !this.hiding){ 10545 if (this.element.getStyle('display') == 'none'){ 10546 this.hiding = false; 10547 this.showing = true; 10548 this.hidden = false; 10549 this.cssText = this.element.style.cssText; 10550 10551 var startStyles; 10552 this.element.measure(function(){ 10553 startStyles = this.element.getComputedSize({ 10554 styles: this.options.styles, 10555 mode: this.options.mode 10556 }); 10557 }.bind(this)); 10558 if (this.options.heightOverride != null) startStyles.height = this.options.heightOverride.toInt(); 10559 if (this.options.widthOverride != null) startStyles.width = this.options.widthOverride.toInt(); 10560 if (this.options.transitionOpacity){ 10561 this.element.setStyle('opacity', 0); 10562 startStyles.opacity = this.options.opacity; 10563 } 10564 10565 var zero = { 10566 height: 0, 10567 display: Function.from(this.options.display).call(this) 10568 }; 10569 Object.each(startStyles, function(style, name){ 10570 zero[name] = 0; 10571 }); 10572 zero.overflow = 'hidden'; 10573 10574 this.element.setStyles(zero); 10575 10576 var hideThese = hideTheseOf(this); 10577 if (hideThese) hideThese.setStyle('visibility', 'hidden'); 10578 10579 this.$chain.unshift(function(){ 10580 this.element.style.cssText = this.cssText; 10581 this.element.setStyle('display', Function.from(this.options.display).call(this)); 10582 if (!this.hidden) this.showing = false;
10583 if (hideThese) hideThese.setStyle('visibility', 'visible'); 10584 this.callChain(); 10585 this.fireEvent('show', this.element); 10586 }.bind(this)); 10587 10588 this.start(startStyles); 10589 } else { 10590 this.callChain(); 10591 this.fireEvent('complete', this.element); 10592 this.fireEvent('show', this.element); 10593 } 10594 } else if (this.options.link == 'chain'){ 10595 this.chain(this.reveal.bind(this)); 10596 } else if (this.options.link == 'cancel' && !this.showing){ 10597 this.cancel(); 10598 this.reveal(); 10599 } 10600 return this; 10601 }, 10602 10603 toggle: function(){ 10604 if (this.element.getStyle('display') == 'none'){ 10605 this.reveal(); 10606 } else { 10607 this.dissolve(); 10608 } 10609 return this; 10610 }, 10611 10612 cancel: function(){ 10613 this.parent.apply(this, arguments); 10614 if (this.cssText != null) this.element.style.cssText = this.cssText; 10615 this.hiding = false; 10616 this.showing = false; 10617 return this; 10618 } 10619 10620}); 10621 10622Element.Properties.reveal = { 10623 10624 set: function(options){ 10625 this.get('reveal').cancel().setOptions(options); 10626 return this; 10627 }, 10628 10629 get: function(){ 10630 var reveal = this.retrieve('reveal'); 10631 if (!reveal){ 10632 reveal = new Fx.Reveal(this); 10633 this.store('reveal', reveal); 10634 } 10635 return reveal; 10636 } 10637 10638}; 10639 10640Element.Properties.dissolve = Element.Properties.reveal; 10641 10642Element.implement({ 10643 10644 reveal: function(options){ 10645 this.get('reveal').setOptions(options).reveal(); 10646 return this; 10647 }, 10648 10649 dissolve: function(options){ 10650 this.get('reveal').setOptions(options).dissolve(); 10651 return this; 10652 }, 10653 10654 nix: function(options){ 10655 var params = Array.link(arguments, {destroy: Type.isBoolean, options: Type.isObject}); 10656 this.get('reveal').setOptions(options).dissolve().chain(function(){ 10657 this[params.destroy ? 'destroy' : 'dispose'](); 10658 }.bind(this)); 10659 return this; 10660 }, 10661 10662 wink: function(){ 10663 var params = Array.link(arguments, {duration: Type.isNumber, options: Type.isObject}); 10664 var reveal = this.get('reveal').setOptions(params.options); 10665 reveal.reveal().chain(function(){ 10666 (function(){ 10667 reveal.dissolve(); 10668 }).delay(params.duration || 2000); 10669 }); 10670 } 10671 10672}); 10673 10674})(); 10675 10676 10677/* 10678--- 10679 10680script: Form.Request.Append.js 10681 10682name: Form.Request.Append 10683 10684description: Handles the basic functionality of submitting a form and updating a dom element with the result. The result is appended to the DOM element instead of replacing its contents. 10685 10686license: MIT-style license 10687 10688authors: 10689 - Aaron Newton 10690 10691requires: 10692 - /Form.Request 10693 - /Fx.Reveal 10694 - /Elements.from 10695 10696provides: [Form.Request.Append] 10697 10698... 10699*/ 10700 10701Form.Request.Append = new Class({ 10702 10703 Extends: Form.Request, 10704 10705 options: { 10706 //onBeforeEffect: function(){}, 10707 useReveal: true, 10708 revealOptions: {}, 10709 inject: 'bottom' 10710 }, 10711 10712 makeRequest: function(){ 10713 this.request = new Request.HTML(Object.merge({ 10714 url: this.element.get('action'), 10715 method: this.element.get('method') || 'post', 10716 spinnerTarget: this.element 10717 }, this.options.requestOptions, { 10718 evalScripts: false 10719 }) 10720 ).addEvents({ 10721 success: function(tree, elements, html, javascript){ 10722 var container; 10723 var kids = Elements.from(html); 10724 if (kids.length == 1){ 10725 container = kids[0]; 10726 } else { 10727 container = new Element('div', { 10728 styles: { 10729 display: 'none' 10730 } 10731 }).adopt(kids); 10732 } 10733 container.inject(this.target, this.options.inject); 10734 if (this.options.requestOptions.evalScripts) Browser.exec(javascript); 10735 this.fireEvent('beforeEffect', container); 10736 var finish = function(){ 10737 this.fireEvent('success', [container, this.target, tree, elements, html, javascript]); 10738 }.bind(this); 10739 if (this.options.useReveal){ 10740 container.set('reveal', this.options.revealOptions).get('reveal').chain(finish); 10741 container.reveal(); 10742 } else { 10743 finish(); 10744 } 10745 }.bind(this), 10746 failure: function(xhr){ 10747 this.fireEvent('failure', xhr); 10748 }.bind(this) 10749 }); 10750 this.attachReset(); 10751 } 10752 10753}); 10754 10755 10756/* 10757--- 10758 10759name: Locale.en-US.Form.Validator 10760 10761description: Form Validator messages for English. 10762 10763license: MIT-style license 10764 10765authors: 10766 - Aaron Newton 10767 10768requires: 10769 - /Locale 10770 10771provides: [Locale.en-US.Form.Validator] 10772 10773... 10774*/ 10775 10776Locale.define('en-US', 'FormValidator', { 10777 10778 required: 'This field is required.', 10779 length: 'Please enter {length} characters (you entered {elLength} characters)', 10780 minLength: 'Please enter at least {minLength} characters (you entered {length} characters).', 10781 maxLength: 'Please enter no more than {maxLength} characters (you entered {length} characters).', 10782 integer: 'Please enter an integer in this field. Numbers with decimals (e.g. 1.25) are not permitted.', 10783 numeric: 'Please enter only numeric values in this field (i.e. "1" or "1.1" or "-1" or "-1.1").', 10784 digits: 'Please use numbers and punctuation only in this field (for example, a phone number with dashes or dots is permitted).', 10785 alpha: 'Please use only letters (a-z) within this field. No spaces or other characters are allowed.', 10786 alphanum: 'Please use only letters (a-z) or numbers (0-9) in this field. No spaces or other characters are allowed.', 10787 dateSuchAs: 'Please enter a valid date such as {date}', 10788 dateInFormatMDY: 'Please enter a valid date such as MM/DD/YYYY (i.e. "12/31/1999")', 10789 email: 'Please enter a valid email address. For example "[email protected]".', 10790 url: 'Please enter a valid URL such as http://www.example.com.', 10791 currencyDollar: 'Please enter a valid $ amount. For example $100.00 .', 10792 oneRequired: 'Please enter something for at least one of these inputs.', 10793 errorPrefix: 'Error: ', 10794 warningPrefix: 'Warning: ', 10795 10796 // Form.Validator.Extras 10797 noSpace: 'There can be no spaces in this input.', 10798 reqChkByNode: 'No items are selected.', 10799 requiredChk: 'This field is required.', 10800 reqChkByName: 'Please select a {label}.', 10801 match: 'This field needs to match the {matchName} field', 10802 startDate: 'the start date', 10803 endDate: 'the end date', 10804 currendDate: 'the current date', 10805 afterDate: 'The date should be the same or after {label}.', 10806 beforeDate: 'The date should be the same or before {label}.', 10807 startMonth: 'Please select a start month', 10808 sameMonth: 'These two dates must be in the same month - you must change one or the other.',
10809 creditcard: 'The credit card number entered is invalid. Please check the number and try again. {length} digits entered.' 10810 10811}); 10812 10813 10814/* 10815--- 10816 10817script: Form.Validator.js 10818 10819name: Form.Validator 10820 10821description: A css-class based form validation system. 10822 10823license: MIT-style license 10824 10825authors: 10826 - Aaron Newton 10827 10828requires: 10829 - Core/Options 10830 - Core/Events 10831 - Core/Slick.Finder 10832 - Core/Element.Event 10833 - Core/Element.Style 10834 - Core/JSON 10835 - /Locale 10836 - /Class.Binds 10837 - /Date 10838 - /Element.Forms 10839 - /Locale.en-US.Form.Validator 10840 - /Element.Shortcuts 10841 10842provides: [Form.Validator, InputValidator, FormValidator.BaseValidators] 10843 10844... 10845*/ 10846if (!window.Form) window.Form = {}; 10847 10848var InputValidator = this.InputValidator = new Class({ 10849 10850 Implements: [Options], 10851 10852 options: { 10853 errorMsg: 'Validation failed.', 10854 test: Function.from(true) 10855 }, 10856 10857 initialize: function(className, options){ 10858 this.setOptions(options); 10859 this.className = className; 10860 }, 10861 10862 test: function(field, props){ 10863 field = document.id(field); 10864 return (field) ? this.options.test(field, props || this.getProps(field)) : false; 10865 }, 10866 10867 getError: function(field, props){ 10868 field = document.id(field); 10869 var err = this.options.errorMsg; 10870 if (typeOf(err) == 'function') err = err(field, props || this.getProps(field)); 10871 return err; 10872 }, 10873 10874 getProps: function(field){ 10875 field = document.id(field); 10876 return (field) ? field.get('validatorProps') : {}; 10877 } 10878 10879}); 10880 10881Element.Properties.validators = { 10882 10883 get: function(){ 10884 return (this.get('data-validators') || this.className).clean().split(' '); 10885 } 10886 10887}; 10888 10889Element.Properties.validatorProps = { 10890 10891 set: function(props){ 10892 return this.eliminate('$moo:validatorProps').store('$moo:validatorProps', props); 10893 }, 10894 10895 get: function(props){ 10896 if (props) this.set(props); 10897 if (this.retrieve('$moo:validatorProps')) return this.retrieve('$moo:validatorProps'); 10898 if (this.getProperty('data-validator-properties') || this.getProperty('validatorProps')){ 10899 try { 10900 this.store('$moo:validatorProps', JSON.decode(this.getProperty('validatorProps') || this.getProperty('data-validator-properties'))); 10901 }catch(e){ 10902 return {}; 10903 } 10904 } else { 10905 var vals = this.get('validators').filter(function(cls){ 10906 return cls.test(':'); 10907 }); 10908 if (!vals.length){ 10909 this.store('$moo:validatorProps', {}); 10910 } else { 10911 props = {}; 10912 vals.each(function(cls){ 10913 var split = cls.split(':'); 10914 if (split[1]){ 10915 try { 10916 props[split[0]] = JSON.decode(split[1]); 10917 } catch(e){} 10918 } 10919 }); 10920 this.store('$moo:validatorProps', props); 10921 } 10922 } 10923 return this.retrieve('$moo:validatorProps'); 10924 } 10925 10926}; 10927 10928Form.Validator = new Class({ 10929 10930 Implements: [Options, Events], 10931 10932 Binds: ['onSubmit'], 10933 10934 options: {/* 10935 onFormValidate: function(isValid, form, event){}, 10936 onElementValidate: function(isValid, field, className, warn){}, 10937 onElementPass: function(field){}, 10938 onElementFail: function(field, validatorsFailed){}, */ 10939 fieldSelectors: 'input, select, textarea', 10940 ignoreHidden: true, 10941 ignoreDisabled: true, 10942 useTitles: false, 10943 evaluateOnSubmit: true, 10944 evaluateFieldsOnBlur: true, 10945 evaluateFieldsOnChange: true, 10946 serial: true, 10947 stopOnFailure: true, 10948 warningPrefix: function(){ 10949 return Form.Validator.getMsg('warningPrefix') || 'Warning: '; 10950 }, 10951 errorPrefix: function(){ 10952 return Form.Validator.getMsg('errorPrefix') || 'Error: '; 10953 } 10954 }, 10955 10956 initialize: function(form, options){ 10957 this.setOptions(options); 10958 this.element = document.id(form); 10959 this.element.store('validator', this); 10960 this.warningPrefix = Function.from(this.options.warningPrefix)(); 10961 this.errorPrefix = Function.from(this.options.errorPrefix)(); 10962 if (this.options.evaluateOnSubmit) this.element.addEvent('submit', this.onSubmit); 10963 if (this.options.evaluateFieldsOnBlur || this.options.evaluateFieldsOnChange) this.watchFields(this.getFields()); 10964 }, 10965 10966 toElement: function(){ 10967 return this.element; 10968 }, 10969 10970 getFields: function(){ 10971 return (this.fields = this.element.getElements(this.options.fieldSelectors)); 10972 }, 10973 10974 watchFields: function(fields){ 10975 fields.each(function(el){ 10976 if (this.options.evaluateFieldsOnBlur) 10977 el.addEvent('blur', this.validationMonitor.pass([el, false], this)); 10978 if (this.options.evaluateFieldsOnChange) 10979 el.addEvent('change', this.validationMonitor.pass([el, true], this)); 10980 }, this); 10981 }, 10982 10983 validationMonitor: function(){ 10984 clearTimeout(this.timer); 10985 this.timer = this.validateField.delay(50, this, arguments); 10986 }, 10987 10988 onSubmit: function(event){ 10989 if (this.validate(event)) this.reset(); 10990 }, 10991 10992 reset: function(){ 10993 this.getFields().each(this.resetField, this); 10994 return this; 10995 }, 10996 10997 validate: function(event){ 10998 var result = this.getFields().map(function(field){ 10999 return this.validateField(field, true); 11000 }, this).every(function(v){ 11001 return v; 11002 }); 11003 this.fireEvent('formValidate', [result, this.element, event]); 11004 if (this.options.stopOnFailure && !result && event) event.preventDefault(); 11005 return result; 11006 }, 11007 11008 validateField: function(field, force){ 11009 if (this.paused) return true; 11010 field = document.id(field); 11011 var passed = !field.hasClass('validation-failed'); 11012 var failed, warned; 11013 if (this.options.serial && !force){ 11014 failed = this.element.getElement('.validation-failed'); 11015 warned = this.element.getElement('.warning'); 11016 } 11017 if (field && (!failed || force || field.hasClass('validation-failed') || (failed && !this.options.serial))){
11018 var validationTypes = field.get('validators'); 11019 var validators = validationTypes.some(function(cn){ 11020 return this.getValidator(cn); 11021 }, this); 11022 var validatorsFailed = []; 11023 validationTypes.each(function(className){ 11024 if (className && !this.test(className, field)) validatorsFailed.include(className); 11025 }, this); 11026 passed = validatorsFailed.length === 0; 11027 if (validators && !this.hasValidator(field, 'warnOnly')){ 11028 if (passed){ 11029 field.addClass('validation-passed').removeClass('validation-failed'); 11030 this.fireEvent('elementPass', [field]); 11031 } else { 11032 field.addClass('validation-failed').removeClass('validation-passed'); 11033 this.fireEvent('elementFail', [field, validatorsFailed]); 11034 } 11035 } 11036 if (!warned){ 11037 var warnings = validationTypes.some(function(cn){ 11038 if (cn.test('^warn')) 11039 return this.getValidator(cn.replace(/^warn-/,'')); 11040 else return null; 11041 }, this); 11042 field.removeClass('warning'); 11043 var warnResult = validationTypes.map(function(cn){ 11044 if (cn.test('^warn')) 11045 return this.test(cn.replace(/^warn-/,''), field, true); 11046 else return null; 11047 }, this); 11048 } 11049 } 11050 return passed; 11051 }, 11052 11053 test: function(className, field, warn){ 11054 field = document.id(field); 11055 if ((this.options.ignoreHidden && !field.isVisible()) || (this.options.ignoreDisabled && field.get('disabled'))) return true; 11056 var validator = this.getValidator(className); 11057 if (warn != null) warn = false; 11058 if (this.hasValidator(field, 'warnOnly')) warn = true; 11059 var isValid = this.hasValidator(field, 'ignoreValidation') || (validator ? validator.test(field) : true); 11060 if (validator && field.isVisible()) this.fireEvent('elementValidate', [isValid, field, className, warn]); 11061 if (warn) return true; 11062 return isValid; 11063 }, 11064 11065 hasValidator: function(field, value){ 11066 return field.get('validators').contains(value); 11067 }, 11068 11069 resetField: function(field){ 11070 field = document.id(field); 11071 if (field){ 11072 field.get('validators').each(function(className){ 11073 if (className.test('^warn-')) className = className.replace(/^warn-/, ''); 11074 field.removeClass('validation-failed'); 11075 field.removeClass('warning'); 11076 field.removeClass('validation-passed'); 11077 }, this); 11078 } 11079 return this; 11080 }, 11081 11082 stop: function(){ 11083 this.paused = true; 11084 return this; 11085 }, 11086 11087 start: function(){ 11088 this.paused = false; 11089 return this; 11090 }, 11091 11092 ignoreField: function(field, warn){ 11093 field = document.id(field); 11094 if (field){ 11095 this.enforceField(field); 11096 if (warn) field.addClass('warnOnly'); 11097 else field.addClass('ignoreValidation'); 11098 } 11099 return this; 11100 }, 11101 11102 enforceField: function(field){ 11103 field = document.id(field); 11104 if (field) field.removeClass('warnOnly').removeClass('ignoreValidation'); 11105 return this; 11106 } 11107 11108}); 11109 11110Form.Validator.getMsg = function(key){ 11111 return Locale.get('FormValidator.' + key); 11112}; 11113 11114Form.Validator.adders = { 11115 11116 validators:{}, 11117 11118 add : function(className, options){ 11119 this.validators[className] = new InputValidator(className, options); 11120 //if this is a class (this method is used by instances of Form.Validator and the Form.Validator namespace) 11121 //extend these validators into it 11122 //this allows validators to be global and/or per instance 11123 if (!this.initialize){ 11124 this.implement({ 11125 validators: this.validators 11126 }); 11127 } 11128 }, 11129 11130 addAllThese : function(validators){ 11131 Array.from(validators).each(function(validator){ 11132 this.add(validator[0], validator[1]); 11133 }, this); 11134 }, 11135 11136 getValidator: function(className){ 11137 return this.validators[className.split(':')[0]]; 11138 } 11139 11140}; 11141 11142Object.append(Form.Validator, Form.Validator.adders); 11143 11144Form.Validator.implement(Form.Validator.adders); 11145 11146Form.Validator.add('IsEmpty', { 11147 11148 errorMsg: false, 11149 test: function(element){ 11150 if (element.type == 'select-one' || element.type == 'select') 11151 return !(element.selectedIndex >= 0 && element.options[element.selectedIndex].value != ''); 11152 else 11153 return ((element.get('value') == null) || (element.get('value').length == 0)); 11154 } 11155 11156}); 11157 11158Form.Validator.addAllThese([ 11159 11160 ['required', { 11161 errorMsg: function(){ 11162 return Form.Validator.getMsg('required'); 11163 }, 11164 test: function(element){ 11165 return !Form.Validator.getValidator('IsEmpty').test(element); 11166 } 11167 }], 11168 11169 ['length', { 11170 errorMsg: function(element, props){ 11171 if (typeOf(props.length) != 'null') 11172 return Form.Validator.getMsg('length').substitute({length: props.length, elLength: element.get('value').length}); 11173 else return ''; 11174 }, 11175 test: function(element, props){ 11176 if (typeOf(props.length) != 'null') return (element.get('value').length == props.length || element.get('value').length == 0); 11177 else return true; 11178 } 11179 }], 11180 11181 ['minLength', { 11182 errorMsg: function(element, props){ 11183 if (typeOf(props.minLength) != 'null') 11184 return Form.Validator.getMsg('minLength').substitute({minLength: props.minLength, length: element.get('value').length}); 11185 else return ''; 11186 }, 11187 test: function(element, props){ 11188 if (typeOf(props.minLength) != 'null') return (element.get('value').length >= (props.minLength || 0)); 11189 else return true; 11190 } 11191 }], 11192 11193 ['maxLength', { 11194 errorMsg: function(element, props){ 11195 //props is {maxLength:10} 11196 if (typeOf(props.maxLength) != 'null') 11197 return Form.Validator.getMsg('maxLength').substitute({maxLength: props.maxLength, length: element.get('value').length}); 11198 else return ''; 11199 }, 11200 test: function(element, props){ 11201 return element.get('value').length <= (props.maxLength || 10000); 11202 } 11203 }], 11204 11205 ['validate-integer', { 11206 errorMsg: Form.Validator.getMsg.pass('integer'), 11207 test: function(element){ 11208 return Form.Validator.getValidator('IsEmpty').test(element) || (/^(-?[1-9]\d*|0)$/).test(element.get('value')); 11209 } 11210 }], 11211 11212 ['validate-numeric', { 11213 errorMsg: Form.Validator.getMsg.pass('numeric'), 11214 test: function(element){ 11215 return Form.Validator.getValidator('IsEmpty').test(element) || 11216 (/^-?(?:0$0(?=\d*\.)|[1-9]|0)\d*(\.\d+)?$/).test(element.get('value')); 11217 } 11218 }], 11219 11220 ['validate-digits', { 11221 errorMsg: Form.Validator.getMsg.pass('digits'), 11222 test: function(element){ 11223 return Form.Validator.getValidator('IsEmpty').test(element) || (/^[\d() .:\-\+#]+$/.test(element.get('value'))); 11224 } 11225 }], 11226 11227 ['validate-alpha', {
11228 errorMsg: Form.Validator.getMsg.pass('alpha'), 11229 test: function(element){ 11230 return Form.Validator.getValidator('IsEmpty').test(element) || (/^[a-zA-Z]+$/).test(element.get('value')); 11231 } 11232 }], 11233 11234 ['validate-alphanum', { 11235 errorMsg: Form.Validator.getMsg.pass('alphanum'), 11236 test: function(element){ 11237 return Form.Validator.getValidator('IsEmpty').test(element) || !(/\W/).test(element.get('value')); 11238 } 11239 }], 11240 11241 ['validate-date', { 11242 errorMsg: function(element, props){ 11243 if (Date.parse){ 11244 var format = props.dateFormat || '%x'; 11245 return Form.Validator.getMsg('dateSuchAs').substitute({date: new Date().format(format)}); 11246 } else { 11247 return Form.Validator.getMsg('dateInFormatMDY'); 11248 } 11249 }, 11250 test: function(element, props){ 11251 if (Form.Validator.getValidator('IsEmpty').test(element)) return true; 11252 var dateLocale = Locale.getCurrent().sets.Date, 11253 dateNouns = new RegExp([dateLocale.days, dateLocale.days_abbr, dateLocale.months, dateLocale.months_abbr].flatten().join('|'), 'i'), 11254 value = element.get('value'), 11255 wordsInValue = value.match(/[a-z]+/gi); 11256 11257 if (wordsInValue && !wordsInValue.every(dateNouns.exec, dateNouns)) return false; 11258 11259 var date = Date.parse(value), 11260 format = props.dateFormat || '%x', 11261 formatted = date.format(format); 11262 11263 if (formatted != 'invalid date') element.set('value', formatted); 11264 return date.isValid(); 11265 } 11266 }], 11267 11268 ['validate-email', { 11269 errorMsg: Form.Validator.getMsg.pass('email'), 11270 test: function(element){ 11271 /* 11272 var chars = "[a-z0-9!#$%&'*+/=?^_`{|}~-]", 11273 local = '(?:' + chars + '\\.?){0,63}' + chars, 11274 11275 label = '[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?', 11276 hostname = '(?:' + label + '\\.)*' + label; 11277 11278 octet = '(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)', 11279 ipv4 = '\\[(?:' + octet + '\\.){3}' + octet + '\\]', 11280 11281 domain = '(?:' + hostname + '|' + ipv4 + ')'; 11282 11283 var regex = new RegExp('^' + local + '@' + domain + '$', 'i'); 11284 */ 11285 return Form.Validator.getValidator('IsEmpty').test(element) || (/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]\.?){0,63}[a-z0-9!#$%&'*+\/=?^_`{|}~-]@(?:(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\])$/i).test(element.get('value').trim()); 11286 } 11287 }], 11288 11289 ['validate-url', { 11290 errorMsg: Form.Validator.getMsg.pass('url'), 11291 test: function(element){ 11292 return Form.Validator.getValidator('IsEmpty').test(element) || (/^(https?|ftp|rmtp|mms):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i).test(element.get('value')); 11293 } 11294 }], 11295 11296 ['validate-currency-dollar', { 11297 errorMsg: Form.Validator.getMsg.pass('currencyDollar'), 11298 test: function(element){ 11299 return Form.Validator.getValidator('IsEmpty').test(element) || (/^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/).test(element.get('value')); 11300 } 11301 }], 11302 11303 ['validate-one-required', { 11304 errorMsg: Form.Validator.getMsg.pass('oneRequired'), 11305 test: function(element, props){ 11306 var p = document.id(props['validate-one-required']) || element.getParent(props['validate-one-required']); 11307 return p.getElements('input').some(function(el){ 11308 if (['checkbox', 'radio'].contains(el.get('type'))) return el.get('checked'); 11309 return el.get('value'); 11310 }); 11311 } 11312 }] 11313 11314]); 11315 11316Element.Properties.validator = { 11317 11318 set: function(options){ 11319 this.get('validator').setOptions(options); 11320 }, 11321 11322 get: function(){ 11323 var validator = this.retrieve('validator'); 11324 if (!validator){ 11325 validator = new Form.Validator(this); 11326 this.store('validator', validator); 11327 } 11328 return validator; 11329 } 11330 11331}; 11332 11333Element.implement({ 11334 11335 validate: function(options){ 11336 if (options) this.set('validator', options); 11337 return this.get('validator').validate(); 11338 } 11339 11340}); 11341 11342 11343//<1.2compat> 11344//legacy 11345var FormValidator = Form.Validator; 11346//</1.2compat> 11347 11348 11349 11350 11351/* 11352--- 11353 11354script: Form.Validator.Inline.js 11355 11356name: Form.Validator.Inline 11357 11358description: Extends Form.Validator to add inline messages. 11359 11360license: MIT-style license 11361 11362authors: 11363 - Aaron Newton 11364 11365requires: 11366 - /Form.Validator 11367 11368provides: [Form.Validator.Inline] 11369 11370... 11371*/ 11372 11373Form.Validator.Inline = new Class({ 11374 11375 Extends: Form.Validator, 11376 11377 options: { 11378 showError: function(errorElement){ 11379 if (errorElement.reveal) errorElement.reveal(); 11380 else errorElement.setStyle('display', 'block'); 11381 }, 11382 hideError: function(errorElement){
11383 if (errorElement.dissolve) errorElement.dissolve(); 11384 else errorElement.setStyle('display', 'none'); 11385 }, 11386 scrollToErrorsOnSubmit: true, 11387 scrollToErrorsOnBlur: false, 11388 scrollToErrorsOnChange: false, 11389 scrollFxOptions: { 11390 transition: 'quad:out', 11391 offset: { 11392 y: -20 11393 } 11394 } 11395 }, 11396 11397 initialize: function(form, options){ 11398 this.parent(form, options); 11399 this.addEvent('onElementValidate', function(isValid, field, className, warn){ 11400 var validator = this.getValidator(className); 11401 if (!isValid && validator.getError(field)){ 11402 if (warn) field.addClass('warning'); 11403 var advice = this.makeAdvice(className, field, validator.getError(field), warn); 11404 this.insertAdvice(advice, field); 11405 this.showAdvice(className, field); 11406 } else { 11407 this.hideAdvice(className, field); 11408 } 11409 }); 11410 }, 11411 11412 makeAdvice: function(className, field, error, warn){ 11413 var errorMsg = (warn) ? this.warningPrefix : this.errorPrefix; 11414 errorMsg += (this.options.useTitles) ? field.title || error:error; 11415 var cssClass = (warn) ? 'warning-advice' : 'validation-advice'; 11416 var advice = this.getAdvice(className, field); 11417 if (advice){ 11418 advice = advice.set('html', errorMsg); 11419 } else { 11420 advice = new Element('div', { 11421 html: errorMsg, 11422 styles: { display: 'none' }, 11423 id: 'advice-' + className.split(':')[0] + '-' + this.getFieldId(field) 11424 }).addClass(cssClass); 11425 } 11426 field.store('$moo:advice-' + className, advice); 11427 return advice; 11428 }, 11429 11430 getFieldId : function(field){ 11431 return field.id ? field.id : field.id = 'input_' + field.name; 11432 }, 11433 11434 showAdvice: function(className, field){ 11435 var advice = this.getAdvice(className, field); 11436 if ( 11437 advice && 11438 !field.retrieve('$moo:' + this.getPropName(className)) && 11439 ( 11440 advice.getStyle('display') == 'none' || 11441 advice.getStyle('visiblity') == 'hidden' || 11442 advice.getStyle('opacity') == 0 11443 ) 11444 ){ 11445 field.store('$moo:' + this.getPropName(className), true); 11446 this.options.showError(advice); 11447 this.fireEvent('showAdvice', [field, advice, className]); 11448 } 11449 }, 11450 11451 hideAdvice: function(className, field){ 11452 var advice = this.getAdvice(className, field); 11453 if (advice && field.retrieve('$moo:' + this.getPropName(className))){ 11454 field.store('$moo:' + this.getPropName(className), false); 11455 this.options.hideError(advice); 11456 this.fireEvent('hideAdvice', [field, advice, className]); 11457 } 11458 }, 11459 11460 getPropName: function(className){ 11461 return 'advice' + className; 11462 }, 11463 11464 resetField: function(field){ 11465 field = document.id(field); 11466 if (!field) return this; 11467 this.parent(field); 11468 field.get('validators').each(function(className){ 11469 this.hideAdvice(className, field); 11470 }, this); 11471 return this; 11472 }, 11473 11474 getAllAdviceMessages: function(field, force){ 11475 var advice = []; 11476 if (field.hasClass('ignoreValidation') && !force) return advice; 11477 var validators = field.get('validators').some(function(cn){ 11478 var warner = cn.test('^warn-') || field.hasClass('warnOnly'); 11479 if (warner) cn = cn.replace(/^warn-/, ''); 11480 var validator = this.getValidator(cn); 11481 if (!validator) return; 11482 advice.push({ 11483 message: validator.getError(field), 11484 warnOnly: warner, 11485 passed: validator.test(), 11486 validator: validator 11487 }); 11488 }, this); 11489 return advice; 11490 }, 11491 11492 getAdvice: function(className, field){ 11493 return field.retrieve('$moo:advice-' + className); 11494 }, 11495 11496 insertAdvice: function(advice, field){ 11497 //Check for error position prop 11498 var props = field.get('validatorProps'); 11499 //Build advice 11500 if (!props.msgPos || !document.id(props.msgPos)){ 11501 if (field.type && field.type.toLowerCase() == 'radio') field.getParent().adopt(advice); 11502 else advice.inject(document.id(field), 'after'); 11503 } else { 11504 document.id(props.msgPos).grab(advice); 11505 } 11506 }, 11507 11508 validateField: function(field, force, scroll){ 11509 var result = this.parent(field, force); 11510 if (((this.options.scrollToErrorsOnSubmit && scroll == null) || scroll) && !result){ 11511 var failed = document.id(this).getElement('.validation-failed'); 11512 var par = document.id(this).getParent(); 11513 while (par != document.body && par.getScrollSize().y <= par.getSize().y){ 11514 par = par.getParent(); 11515 } 11516 var fx = par.retrieve('$moo:fvScroller'); 11517 if (!fx && window.Fx && Fx.Scroll){ 11518 fx = new Fx.Scroll(par, this.options.scrollFxOptions); 11519 par.store('$moo:fvScroller', fx); 11520 } 11521 if (failed){ 11522 if (fx) fx.toElement(failed);
11523 else par.scrollTo(par.getScroll().x, failed.getPosition(par).y - 20); 11524 } 11525 } 11526 return result; 11527 }, 11528 11529 watchFields: function(fields){ 11530 fields.each(function(el){ 11531 if (this.options.evaluateFieldsOnBlur){ 11532 el.addEvent('blur', this.validationMonitor.pass([el, false, this.options.scrollToErrorsOnBlur], this)); 11533 } 11534 if (this.options.evaluateFieldsOnChange){ 11535 el.addEvent('change', this.validationMonitor.pass([el, true, this.options.scrollToErrorsOnChange], this)); 11536 } 11537 }, this); 11538 } 11539 11540}); 11541 11542 11543/* 11544--- 11545 11546script: Form.Validator.Extras.js 11547 11548name: Form.Validator.Extras 11549 11550description: Additional validators for the Form.Validator class. 11551 11552license: MIT-style license 11553 11554authors: 11555 - Aaron Newton 11556 11557requires: 11558 - /Form.Validator 11559 11560provides: [Form.Validator.Extras] 11561 11562... 11563*/ 11564Form.Validator.addAllThese([ 11565 11566 ['validate-enforce-oncheck', { 11567 test: function(element, props){ 11568 var fv = element.getParent('form').retrieve('validator'); 11569 if (!fv) return true; 11570 (props.toEnforce || document.id(props.enforceChildrenOf).getElements('input, select, textarea')).map(function(item){ 11571 if (element.checked){ 11572 fv.enforceField(item); 11573 } else { 11574 fv.ignoreField(item); 11575 fv.resetField(item); 11576 } 11577 }); 11578 return true; 11579 } 11580 }], 11581 11582 ['validate-ignore-oncheck', { 11583 test: function(element, props){ 11584 var fv = element.getParent('form').retrieve('validator'); 11585 if (!fv) return true; 11586 (props.toIgnore || document.id(props.ignoreChildrenOf).getElements('input, select, textarea')).each(function(item){ 11587 if (element.checked){ 11588 fv.ignoreField(item); 11589 fv.resetField(item); 11590 } else { 11591 fv.enforceField(item); 11592 } 11593 }); 11594 return true; 11595 } 11596 }], 11597 11598 ['validate-nospace', { 11599 errorMsg: function(){ 11600 return Form.Validator.getMsg('noSpace'); 11601 }, 11602 test: function(element, props){ 11603 return !element.get('value').test(/\s/); 11604 } 11605 }], 11606 11607 ['validate-toggle-oncheck', { 11608 test: function(element, props){ 11609 var fv = element.getParent('form').retrieve('validator'); 11610 if (!fv) return true; 11611 var eleArr = props.toToggle || document.id(props.toToggleChildrenOf).getElements('input, select, textarea'); 11612 if (!element.checked){ 11613 eleArr.each(function(item){ 11614 fv.ignoreField(item); 11615 fv.resetField(item); 11616 }); 11617 } else { 11618 eleArr.each(function(item){ 11619 fv.enforceField(item); 11620 }); 11621 } 11622 return true; 11623 } 11624 }], 11625 11626 ['validate-reqchk-bynode', { 11627 errorMsg: function(){ 11628 return Form.Validator.getMsg('reqChkByNode'); 11629 }, 11630 test: function(element, props){ 11631 return (document.id(props.nodeId).getElements(props.selector || 'input[type=checkbox], input[type=radio]')).some(function(item){ 11632 return item.checked; 11633 }); 11634 } 11635 }], 11636 11637 ['validate-required-check', { 11638 errorMsg: function(element, props){ 11639 return props.useTitle ? element.get('title') : Form.Validator.getMsg('requiredChk'); 11640 }, 11641 test: function(element, props){ 11642 return !!element.checked; 11643 } 11644 }], 11645 11646 ['validate-reqchk-byname', { 11647 errorMsg: function(element, props){ 11648 return Form.Validator.getMsg('reqChkByName').substitute({label: props.label || element.get('type')}); 11649 }, 11650 test: function(element, props){ 11651 var grpName = props.groupName || element.get('name'); 11652 var oneCheckedItem = $$(document.getElementsByName(grpName)).some(function(item, index){ 11653 return item.checked; 11654 }); 11655 var fv = element.getParent('form').retrieve('validator'); 11656 if (oneCheckedItem && fv) fv.resetField(element); 11657 return oneCheckedItem; 11658 } 11659 }], 11660 11661 ['validate-match', { 11662 errorMsg: function(element, props){ 11663 return Form.Validator.getMsg('match').substitute({matchName: props.matchName || document.id(props.matchInput).get('name')}); 11664 }, 11665 test: function(element, props){ 11666 var eleVal = element.get('value'); 11667 var matchVal = document.id(props.matchInput) && document.id(props.matchInput).get('value'); 11668 return eleVal && matchVal ? eleVal == matchVal : true; 11669 } 11670 }], 11671 11672 ['validate-after-date', { 11673 errorMsg: function(element, props){ 11674 return Form.Validator.getMsg('afterDate').substitute({ 11675 label: props.afterLabel || (props.afterElement ? Form.Validator.getMsg('startDate') : Form.Validator.getMsg('currentDate')) 11676 }); 11677 }, 11678 test: function(element, props){ 11679 var start = document.id(props.afterElement) ? Date.parse(document.id(props.afterElement).get('value')) : new Date(); 11680 var end = Date.parse(element.get('value')); 11681 return end && start ? end >= start : true; 11682 } 11683 }], 11684
11685 ['validate-before-date', { 11686 errorMsg: function(element, props){ 11687 return Form.Validator.getMsg('beforeDate').substitute({ 11688 label: props.beforeLabel || (props.beforeElement ? Form.Validator.getMsg('endDate') : Form.Validator.getMsg('currentDate')) 11689 }); 11690 }, 11691 test: function(element, props){ 11692 var start = Date.parse(element.get('value')); 11693 var end = document.id(props.beforeElement) ? Date.parse(document.id(props.beforeElement).get('value')) : new Date(); 11694 return end && start ? end >= start : true; 11695 } 11696 }], 11697 11698 ['validate-custom-required', { 11699 errorMsg: function(){ 11700 return Form.Validator.getMsg('required'); 11701 }, 11702 test: function(element, props){ 11703 return element.get('value') != props.emptyValue; 11704 } 11705 }], 11706 11707 ['validate-same-month', { 11708 errorMsg: function(element, props){ 11709 var startMo = document.id(props.sameMonthAs) && document.id(props.sameMonthAs).get('value'); 11710 var eleVal = element.get('value'); 11711 if (eleVal != '') return Form.Validator.getMsg(startMo ? 'sameMonth' : 'startMonth'); 11712 }, 11713 test: function(element, props){ 11714 var d1 = Date.parse(element.get('value')); 11715 var d2 = Date.parse(document.id(props.sameMonthAs) && document.id(props.sameMonthAs).get('value')); 11716 return d1 && d2 ? d1.format('%B') == d2.format('%B') : true; 11717 } 11718 }], 11719 11720 11721 ['validate-cc-num', { 11722 errorMsg: function(element){ 11723 var ccNum = element.get('value').replace(/[^0-9]/g, ''); 11724 return Form.Validator.getMsg('creditcard').substitute({length: ccNum.length}); 11725 }, 11726 test: function(element){ 11727 // required is a different test 11728 if (Form.Validator.getValidator('IsEmpty').test(element)) return true; 11729 11730 // Clean number value 11731 var ccNum = element.get('value'); 11732 ccNum = ccNum.replace(/[^0-9]/g, ''); 11733 11734 var valid_type = false;
11735 11736 if (ccNum.test(/^4[0-9]{12}([0-9]{3})?$/)) valid_type = 'Visa'; 11737 else if (ccNum.test(/^5[1-5]([0-9]{14})$/)) valid_type = 'Master Card'; 11738 else if (ccNum.test(/^3[47][0-9]{13}$/)) valid_type = 'American Express'; 11739 else if (ccNum.test(/^6(?:011|5[0-9]{2})[0-9]{12}$/)) valid_type = 'Discover'; 11740 else if (ccNum.test(/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/)) valid_type = 'Diners Club'; 11741 11742 if (valid_type){ 11743 var sum = 0; 11744 var cur = 0; 11745 11746 for (var i=ccNum.length-1; i>=0; --i){ 11747 cur = ccNum.charAt(i).toInt(); 11748 if (cur == 0) continue; 11749 11750 if ((ccNum.length-i) % 2 == 0) cur += cur; 11751 if (cur > 9){ 11752 cur = cur.toString().charAt(0).toInt() + cur.toString().charAt(1).toInt(); 11753 } 11754 11755 sum += cur; 11756 } 11757 if ((sum % 10) == 0) return true; 11758 } 11759 11760 var chunks = ''; 11761 while (ccNum != ''){ 11762 chunks += ' ' + ccNum.substr(0,4); 11763 ccNum = ccNum.substr(4); 11764 } 11765 11766 element.getParent('form').retrieve('validator').ignoreField(element); 11767 element.set('value', chunks.clean()); 11768 element.getParent('form').retrieve('validator').enforceField(element); 11769 return false; 11770 } 11771 }] 11772 11773 11774]); 11775 11776 11777/* 11778--- 11779 11780script: OverText.js 11781 11782name: OverText 11783 11784description: Shows text over an input that disappears when the user clicks into it. The text remains hidden if the user adds a value. 11785 11786license: MIT-style license 11787 11788authors: 11789 - Aaron Newton 11790 11791requires: 11792 - Core/Options 11793 - Core/Events 11794 - Core/Element.Event 11795 - Class.Binds 11796 - Class.Occlude 11797 - Element.Position 11798 - Element.Shortcuts 11799 11800provides: [OverText] 11801 11802... 11803*/ 11804 11805var OverText = new Class({ 11806 11807 Implements: [Options, Events, Class.Occlude], 11808 11809 Binds: ['reposition', 'assert', 'focus', 'hide'], 11810 11811 options: {/* 11812 textOverride: null, 11813 onFocus: function(){}, 11814 onTextHide: function(textEl, inputEl){}, 11815 onTextShow: function(textEl, inputEl){}, */ 11816 element: 'label', 11817 labelClass: 'overTxtLabel', 11818 positionOptions: { 11819 position: 'upperLeft', 11820 edge: 'upperLeft', 11821 offset: { 11822 x: 4, 11823 y: 2 11824 } 11825 }, 11826 poll: false, 11827 pollInterval: 250, 11828 wrap: false 11829 }, 11830 11831 property: 'OverText', 11832 11833 initialize: function(element, options){ 11834 element = this.element = document.id(element); 11835 11836 if (this.occlude()) return this.occluded; 11837 this.setOptions(options); 11838 11839 this.attach(element); 11840 OverText.instances.push(this); 11841 11842 if (this.options.poll) this.poll(); 11843 }, 11844 11845 toElement: function(){ 11846 return this.element; 11847 }, 11848 11849 attach: function(){ 11850 var element = this.element, 11851 options = this.options, 11852 value = options.textOverride || element.get('alt') || element.get('title'); 11853 11854 if (!value) return this; 11855 11856 var text = this.text = new Element(options.element, { 11857 'class': options.labelClass, 11858 styles: { 11859 lineHeight: 'normal', 11860 position: 'absolute', 11861 cursor: 'text' 11862 }, 11863 html: value, 11864 events: { 11865 click: this.hide.pass(options.element == 'label', this) 11866 } 11867 }).inject(element, 'after'); 11868 11869 if (options.element == 'label'){ 11870 if (!element.get('id')) element.set('id', 'input_' + String.uniqueID()); 11871 text.set('for', element.get('id')); 11872 } 11873 11874 if (options.wrap){ 11875 this.textHolder = new Element('div.overTxtWrapper', { 11876 styles: { 11877 lineHeight: 'normal', 11878 position: 'relative' 11879 } 11880 }).grab(text).inject(element, 'before'); 11881 } 11882 11883 return this.enable(); 11884 }, 11885 11886 destroy: function(){ 11887 this.element.eliminate(this.property); // Class.Occlude storage 11888 this.disable(); 11889 if (this.text) this.text.destroy(); 11890 if (this.textHolder) this.textHolder.destroy(); 11891 return this; 11892 }, 11893 11894 disable: function(){ 11895 this.element.removeEvents({ 11896 focus: this.focus, 11897 blur: this.assert, 11898 change: this.assert 11899 }); 11900 window.removeEvent('resize', this.reposition); 11901 this.hide(true, true); 11902 return this; 11903 }, 11904 11905 enable: function(){ 11906 this.element.addEvents({ 11907 focus: this.focus, 11908 blur: this.assert, 11909 change: this.assert 11910 }); 11911 window.addEvent('resize', this.reposition); 11912 this.reposition(); 11913 return this; 11914 }, 11915 11916 wrap: function(){ 11917 if (this.options.element == 'label'){ 11918 if (!this.element.get('id')) this.element.set('id', 'input_' + String.uniqueID()); 11919 this.text.set('for', this.element.get('id')); 11920 } 11921 }, 11922 11923 startPolling: function(){ 11924 this.pollingPaused = false;
11925 return this.poll(); 11926 }, 11927 11928 poll: function(stop){ 11929 //start immediately 11930 //pause on focus 11931 //resumeon blur 11932 if (this.poller && !stop) return this; 11933 if (stop){ 11934 clearInterval(this.poller); 11935 } else { 11936 this.poller = (function(){ 11937 if (!this.pollingPaused) this.assert(true); 11938 }).periodical(this.options.pollInterval, this); 11939 } 11940 11941 return this; 11942 }, 11943 11944 stopPolling: function(){ 11945 this.pollingPaused = true; 11946 return this.poll(true); 11947 }, 11948 11949 focus: function(){ 11950 if (this.text && (!this.text.isDisplayed() || this.element.get('disabled'))) return this; 11951 return this.hide(); 11952 }, 11953 11954 hide: function(suppressFocus, force){ 11955 if (this.text && (this.text.isDisplayed() && (!this.element.get('disabled') || force))){ 11956 this.text.hide(); 11957 this.fireEvent('textHide', [this.text, this.element]); 11958 this.pollingPaused = true; 11959 if (!suppressFocus){ 11960 try { 11961 this.element.fireEvent('focus'); 11962 this.element.focus(); 11963 } catch(e){} //IE barfs if you call focus on hidden elements 11964 } 11965 } 11966 return this; 11967 }, 11968 11969 show: function(){ 11970 if (this.text && !this.text.isDisplayed()){ 11971 this.text.show(); 11972 this.reposition(); 11973 this.fireEvent('textShow', [this.text, this.element]); 11974 this.pollingPaused = false; 11975 } 11976 return this; 11977 }, 11978 11979 test: function(){ 11980 return !this.element.get('value'); 11981 }, 11982 11983 assert: function(suppressFocus){ 11984 return this[this.test() ? 'show' : 'hide'](suppressFocus); 11985 }, 11986 11987 reposition: function(){ 11988 this.assert(true); 11989 if (!this.element.isVisible()) return this.stopPolling().hide(); 11990 if (this.text && this.test()){ 11991 this.text.position(Object.merge(this.options.positionOptions, { 11992 relativeTo: this.element 11993 })); 11994 } 11995 return this; 11996 } 11997 11998}); 11999 12000OverText.instances = []; 12001 12002Object.append(OverText, { 12003 12004 each: function(fn){ 12005 return OverText.instances.each(function(ot, i){ 12006 if (ot.element && ot.text) fn.call(OverText, ot, i); 12007 }); 12008 }, 12009 12010 update: function(){ 12011 12012 return OverText.each(function(ot){ 12013 return ot.reposition(); 12014 }); 12015 12016 }, 12017 12018 hideAll: function(){ 12019 12020 return OverText.each(function(ot){ 12021 return ot.hide(true, true); 12022 }); 12023 12024 }, 12025 12026 showAll: function(){ 12027 return OverText.each(function(ot){ 12028 return ot.show(); 12029 }); 12030 } 12031 12032}); 12033 12034 12035 12036/* 12037--- 12038 12039script: Fx.Elements.js 12040 12041name: Fx.Elements 12042 12043description: Effect to change any number of CSS properties of any number of Elements. 12044 12045license: MIT-style license 12046 12047authors: 12048 - Valerio Proietti 12049 12050requires: 12051 - Core/Fx.CSS 12052 - /MooTools.More 12053 12054provides: [Fx.Elements] 12055 12056... 12057*/ 12058 12059Fx.Elements = new Class({ 12060 12061 Extends: Fx.CSS, 12062 12063 initialize: function(elements, options){ 12064 this.elements = this.subject = $$(elements); 12065 this.parent(options); 12066 }, 12067 12068 compute: function(from, to, delta){ 12069 var now = {}; 12070 12071 for (var i in from){ 12072 var iFrom = from[i], iTo = to[i], iNow = now[i] = {}; 12073 for (var p in iFrom) iNow[p] = this.parent(iFrom[p], iTo[p], delta); 12074 } 12075 12076 return now; 12077 }, 12078 12079 set: function(now){ 12080 for (var i in now){ 12081 if (!this.elements[i]) continue; 12082 12083 var iNow = now[i]; 12084 for (var p in iNow) this.render(this.elements[i], p, iNow[p], this.options.unit); 12085 } 12086 12087 return this; 12088 }, 12089 12090 start: function(obj){ 12091 if (!this.check(obj)) return this; 12092 var from = {}, to = {}; 12093 12094 for (var i in obj){ 12095 if (!this.elements[i]) continue; 12096 12097 var iProps = obj[i], iFrom = from[i] = {}, iTo = to[i] = {}; 12098 12099 for (var p in iProps){ 12100 var parsed = this.prepare(this.elements[i], p, iProps[p]); 12101 iFrom[p] = parsed.from; 12102 iTo[p] = parsed.to; 12103 } 12104 } 12105 12106 return this.parent(from, to); 12107 } 12108 12109}); 12110 12111 12112/* 12113--- 12114 12115script: Fx.Accordion.js 12116 12117name: Fx.Accordion 12118 12119description: An Fx.Elements extension which allows you to easily create accordion type controls. 12120 12121license: MIT-style license 12122 12123authors: 12124 - Valerio Proietti 12125 12126requires: 12127 - Core/Element.Event 12128 - /Fx.Elements 12129 12130provides: [Fx.Accordion] 12131 12132... 12133*/ 12134 12135Fx.Accordion = new Class({ 12136 12137 Extends: Fx.Elements, 12138 12139 options: {/* 12140 onActive: function(toggler, section){}, 12141 onBackground: function(toggler, section){},*/ 12142 fixedHeight: false, 12143 fixedWidth: false, 12144 display: 0, 12145 show: false, 12146 height: true, 12147 width: false, 12148 opacity: true, 12149 alwaysHide: false, 12150 trigger: 'click', 12151 initialDisplayFx: true, 12152 resetHeight: true 12153 }, 12154 12155 initialize: function(){ 12156 var defined = function(obj){ 12157 return obj != null; 12158 }; 12159 12160 var params = Array.link(arguments, { 12161 'container': Type.isElement, //deprecated 12162 'options': Type.isObject, 12163 'togglers': defined, 12164 'elements': defined 12165 }); 12166 this.parent(params.elements, params.options); 12167 12168 var options = this.options, 12169 togglers = this.togglers = $$(params.togglers); 12170 12171 this.previous = -1; 12172 this.internalChain = new Chain(); 12173 12174 if (options.alwaysHide) this.options.link = 'chain'; 12175 12176 if (options.show || this.options.show === 0){ 12177 options.display = false;
12178 this.previous = options.show; 12179 } 12180 12181 if (options.start){ 12182 options.display = false; 12183 options.show = false; 12184 } 12185 12186 var effects = this.effects = {}; 12187 12188 if (options.opacity) effects.opacity = 'fullOpacity'; 12189 if (options.width) effects.width = options.fixedWidth ? 'fullWidth' : 'offsetWidth'; 12190 if (options.height) effects.height = options.fixedHeight ? 'fullHeight' : 'scrollHeight'; 12191 12192 for (var i = 0, l = togglers.length; i < l; i++) this.addSection(togglers[i], this.elements[i]); 12193 12194 this.elements.each(function(el, i){ 12195 if (options.show === i){ 12196 this.fireEvent('active', [togglers[i], el]); 12197 } else { 12198 for (var fx in effects) el.setStyle(fx, 0); 12199 } 12200 }, this); 12201 12202 if (options.display || options.display === 0 || options.initialDisplayFx === false){ 12203 this.display(options.display, options.initialDisplayFx); 12204 } 12205 12206 if (options.fixedHeight !== false) options.resetHeight = false; 12207 this.addEvent('complete', this.internalChain.callChain.bind(this.internalChain)); 12208 }, 12209 12210 addSection: function(toggler, element){ 12211 toggler = document.id(toggler); 12212 element = document.id(element); 12213 this.togglers.include(toggler); 12214 this.elements.include(element); 12215 12216 var togglers = this.togglers, 12217 options = this.options, 12218 test = togglers.contains(toggler), 12219 idx = togglers.indexOf(toggler), 12220 displayer = this.display.pass(idx, this); 12221 12222 toggler.store('accordion:display', displayer) 12223 .addEvent(options.trigger, displayer); 12224 12225 if (options.height) element.setStyles({'padding-top': 0, 'border-top': 'none', 'padding-bottom': 0, 'border-bottom': 'none'}); 12226 if (options.width) element.setStyles({'padding-left': 0, 'border-left': 'none', 'padding-right': 0, 'border-right': 'none'}); 12227 12228 element.fullOpacity = 1; 12229 if (options.fixedWidth) element.fullWidth = options.fixedWidth; 12230 if (options.fixedHeight) element.fullHeight = options.fixedHeight; 12231 element.setStyle('overflow', 'hidden'); 12232 12233 if (!test) for (var fx in this.effects){ 12234 element.setStyle(fx, 0); 12235 } 12236 return this; 12237 }, 12238 12239 removeSection: function(toggler, displayIndex){ 12240 var togglers = this.togglers, 12241 idx = togglers.indexOf(toggler), 12242 element = this.elements[idx]; 12243 12244 var remover = function(){ 12245 togglers.erase(toggler); 12246 this.elements.erase(element); 12247 this.detach(toggler); 12248 }.bind(this); 12249 12250 if (this.now == idx || displayIndex != null){ 12251 this.display(displayIndex != null ? displayIndex : (idx - 1 >= 0 ? idx - 1 : 0)).chain(remover); 12252 } else { 12253 remover(); 12254 } 12255 return this; 12256 }, 12257 12258 detach: function(toggler){ 12259 var remove = function(toggler){ 12260 toggler.removeEvent(this.options.trigger, toggler.retrieve('accordion:display')); 12261 }.bind(this); 12262 12263 if (!toggler) this.togglers.each(remove); 12264 else remove(toggler); 12265 return this; 12266 }, 12267 12268 display: function(index, useFx){ 12269 if (!this.check(index, useFx)) return this; 12270 12271 var obj = {}, 12272 elements = this.elements, 12273 options = this.options, 12274 effects = this.effects; 12275 12276 if (useFx == null) useFx = true; 12277 if (typeOf(index) == 'element') index = elements.indexOf(index); 12278 if (index == this.previous && !options.alwaysHide) return this; 12279 12280 if (options.resetHeight){ 12281 var prev = elements[this.previous]; 12282 if (prev && !this.selfHidden){ 12283 for (var fx in effects) prev.setStyle(fx, prev[effects[fx]]); 12284 } 12285 } 12286 12287 if ((this.timer && options.link == 'chain') || (index === this.previous && !options.alwaysHide)) return this; 12288 12289 this.previous = index; 12290 this.selfHidden = false; 12291 12292 elements.each(function(el, i){ 12293 obj[i] = {}; 12294 var hide; 12295 if (i != index){ 12296 hide = true; 12297 } else if (options.alwaysHide && ((el.offsetHeight > 0 && options.height) || el.offsetWidth > 0 && options.width)){ 12298 hide = true; 12299 this.selfHidden = true; 12300 } 12301 this.fireEvent(hide ? 'background' : 'active', [this.togglers[i], el]); 12302 for (var fx in effects) obj[i][fx] = hide ? 0 : el[effects[fx]]; 12303 if (!useFx && !hide && options.resetHeight) obj[i].height = 'auto'; 12304 }, this); 12305 12306 this.internalChain.clearChain(); 12307 this.internalChain.chain(function(){ 12308 if (options.resetHeight && !this.selfHidden){ 12309 var el = elements[index]; 12310 if (el) el.setStyle('height', 'auto'); 12311 } 12312 }.bind(this)); 12313
12314 return useFx ? this.start(obj) : this.set(obj).internalChain.callChain(); 12315 } 12316 12317}); 12318 12319/*<1.2compat>*/ 12320/* 12321 Compatibility with 1.2.0 12322*/ 12323var Accordion = new Class({ 12324 12325 Extends: Fx.Accordion, 12326 12327 initialize: function(){ 12328 this.parent.apply(this, arguments); 12329 var params = Array.link(arguments, {'container': Type.isElement}); 12330 this.container = params.container; 12331 }, 12332 12333 addSection: function(toggler, element, pos){ 12334 toggler = document.id(toggler); 12335 element = document.id(element); 12336 12337 var test = this.togglers.contains(toggler); 12338 var len = this.togglers.length; 12339 if (len && (!test || pos)){ 12340 pos = pos != null ? pos : len - 1; 12341 toggler.inject(this.togglers[pos], 'before'); 12342 element.inject(toggler, 'after'); 12343 } else if (this.container && !test){ 12344 toggler.inject(this.container); 12345 element.inject(this.container); 12346 } 12347 return this.parent.apply(this, arguments); 12348 } 12349 12350}); 12351/*</1.2compat>*/ 12352 12353 12354/* 12355--- 12356 12357script: Fx.Move.js 12358 12359name: Fx.Move 12360 12361description: Defines Fx.Move, a class that works with Element.Position.js to transition an element from one location to another. 12362 12363license: MIT-style license 12364 12365authors: 12366 - Aaron Newton 12367 12368requires: 12369 - Core/Fx.Morph 12370 - /Element.Position 12371 12372provides: [Fx.Move] 12373 12374... 12375*/ 12376 12377Fx.Move = new Class({ 12378 12379 Extends: Fx.Morph, 12380 12381 options: { 12382 relativeTo: document.body, 12383 position: 'center', 12384 edge: false, 12385 offset: {x: 0, y: 0} 12386 }, 12387 12388 start: function(destination){ 12389 var element = this.element, 12390 topLeft = element.getStyles('top', 'left'); 12391 if (topLeft.top == 'auto' || topLeft.left == 'auto'){ 12392 element.setPosition(element.getPosition(element.getOffsetParent())); 12393 } 12394 return this.parent(element.position(Object.merge({}, this.options, destination, {returnPos: true}))); 12395 } 12396 12397}); 12398 12399Element.Properties.move = { 12400 12401 set: function(options){ 12402 this.get('move').cancel().setOptions(options); 12403 return this; 12404 }, 12405 12406 get: function(){ 12407 var move = this.retrieve('move'); 12408 if (!move){ 12409 move = new Fx.Move(this, {link: 'cancel'}); 12410 this.store('move', move); 12411 } 12412 return move; 12413 } 12414 12415}; 12416 12417Element.implement({ 12418 12419 move: function(options){ 12420 this.get('move').start(options); 12421 return this; 12422 } 12423 12424}); 12425 12426 12427/* 12428--- 12429 12430script: Fx.Scroll.js 12431 12432name: Fx.Scroll 12433 12434description: Effect to smoothly scroll any element, including the window. 12435 12436license: MIT-style license 12437 12438authors: 12439 - Valerio Proietti 12440 12441requires: 12442 - Core/Fx 12443 - Core/Element.Event 12444 - Core/Element.Dimensions 12445 - /MooTools.More 12446 12447provides: [Fx.Scroll] 12448 12449... 12450*/ 12451 12452(function(){ 12453 12454Fx.Scroll = new Class({ 12455 12456 Extends: Fx, 12457 12458 options: { 12459 offset: {x: 0, y: 0}, 12460 wheelStops: true 12461 }, 12462 12463 initialize: function(element, options){ 12464 this.element = this.subject = document.id(element); 12465 this.parent(options); 12466 12467 if (typeOf(this.element) != 'element') this.element = document.id(this.element.getDocument().body); 12468 12469 if (this.options.wheelStops){ 12470 var stopper = this.element, 12471 cancel = this.cancel.pass(false, this); 12472 this.addEvent('start', function(){ 12473 stopper.addEvent('mousewheel', cancel); 12474 }, true); 12475 this.addEvent('complete', function(){ 12476 stopper.removeEvent('mousewheel', cancel); 12477 }, true); 12478 } 12479 }, 12480 12481 set: function(){ 12482 var now = Array.flatten(arguments); 12483 if (Browser.firefox) now = [Math.round(now[0]), Math.round(now[1])]; // not needed anymore in newer firefox versions 12484 this.element.scrollTo(now[0], now[1]); 12485 return this; 12486 }, 12487 12488 compute: function(from, to, delta){ 12489 return [0, 1].map(function(i){ 12490 return Fx.compute(from[i], to[i], delta); 12491 }); 12492 }, 12493 12494 start: function(x, y){ 12495 if (!this.check(x, y)) return this; 12496 var scroll = this.element.getScroll(); 12497 return this.parent([scroll.x, scroll.y], [x, y]); 12498 }, 12499 12500 calculateScroll: function(x, y){ 12501 var element = this.element, 12502 scrollSize = element.getScrollSize(), 12503 scroll = element.getScroll(), 12504 size = element.getSize(), 12505 offset = this.options.offset, 12506 values = {x: x, y: y}; 12507 12508 for (var z in values){ 12509 if (!values[z] && values[z] !== 0) values[z] = scroll[z]; 12510 if (typeOf(values[z]) != 'number') values[z] = scrollSize[z] - size[z]; 12511 values[z] += offset[z]; 12512 } 12513 12514 return [values.x, values.y]; 12515 }, 12516 12517 toTop: function(){ 12518 return this.start.apply(this, this.calculateScroll(false, 0)); 12519 }, 12520 12521 toLeft: function(){ 12522 return this.start.apply(this, this.calculateScroll(0, false)); 12523 }, 12524 12525 toRight: function(){ 12526 return this.start.apply(this, this.calculateScroll('right', false)); 12527 }, 12528 12529 toBottom: function(){ 12530 return this.start.apply(this, this.calculateScroll(false, 'bottom')); 12531 }, 12532 12533 toElement: function(el, axes){ 12534 axes = axes ? Array.from(axes) : ['x', 'y']; 12535 var scroll = isBody(this.element) ? {x: 0, y: 0} : this.element.getScroll(); 12536 var position = Object.map(document.id(el).getPosition(this.element), function(value, axis){ 12537 return axes.contains(axis) ? value + scroll[axis] : false;
12538 }); 12539 return this.start.apply(this, this.calculateScroll(position.x, position.y)); 12540 }, 12541 12542 toElementEdge: function(el, axes, offset){ 12543 axes = axes ? Array.from(axes) : ['x', 'y']; 12544 el = document.id(el); 12545 var to = {}, 12546 position = el.getPosition(this.element), 12547 size = el.getSize(), 12548 scroll = this.element.getScroll(), 12549 containerSize = this.element.getSize(), 12550 edge = { 12551 x: position.x + size.x, 12552 y: position.y + size.y 12553 }; 12554 12555 ['x', 'y'].each(function(axis){ 12556 if (axes.contains(axis)){ 12557 if (edge[axis] > scroll[axis] + containerSize[axis]) to[axis] = edge[axis] - containerSize[axis]; 12558 if (position[axis] < scroll[axis]) to[axis] = position[axis]; 12559 } 12560 if (to[axis] == null) to[axis] = scroll[axis]; 12561 if (offset && offset[axis]) to[axis] = to[axis] + offset[axis]; 12562 }, this); 12563 12564 if (to.x != scroll.x || to.y != scroll.y) this.start(to.x, to.y); 12565 return this; 12566 }, 12567 12568 toElementCenter: function(el, axes, offset){ 12569 axes = axes ? Array.from(axes) : ['x', 'y']; 12570 el = document.id(el); 12571 var to = {}, 12572 position = el.getPosition(this.element), 12573 size = el.getSize(), 12574 scroll = this.element.getScroll(), 12575 containerSize = this.element.getSize(); 12576 12577 ['x', 'y'].each(function(axis){ 12578 if (axes.contains(axis)){ 12579 to[axis] = position[axis] - (containerSize[axis] - size[axis]) / 2; 12580 } 12581 if (to[axis] == null) to[axis] = scroll[axis]; 12582 if (offset && offset[axis]) to[axis] = to[axis] + offset[axis]; 12583 }, this); 12584 12585 if (to.x != scroll.x || to.y != scroll.y) this.start(to.x, to.y); 12586 return this; 12587 } 12588 12589}); 12590 12591//<1.2compat> 12592Fx.Scroll.implement({ 12593 scrollToCenter: function(){ 12594 return this.toElementCenter.apply(this, arguments); 12595 }, 12596 scrollIntoView: function(){ 12597 return this.toElementEdge.apply(this, arguments); 12598 } 12599}); 12600//</1.2compat> 12601 12602function isBody(element){ 12603 return (/^(?:body|html)$/i).test(element.tagName); 12604} 12605 12606})(); 12607 12608 12609/* 12610--- 12611 12612script: Fx.Slide.js 12613 12614name: Fx.Slide 12615 12616description: Effect to slide an element in and out of view. 12617 12618license: MIT-style license 12619 12620authors: 12621 - Valerio Proietti 12622 12623requires: 12624 - Core/Fx 12625 - Core/Element.Style 12626 - /MooTools.More 12627 12628provides: [Fx.Slide] 12629 12630... 12631*/ 12632 12633Fx.Slide = new Class({ 12634 12635 Extends: Fx, 12636 12637 options: { 12638 mode: 'vertical', 12639 wrapper: false, 12640 hideOverflow: true, 12641 resetHeight: false 12642 }, 12643 12644 initialize: function(element, options){ 12645 element = this.element = this.subject = document.id(element); 12646 this.parent(options); 12647 options = this.options; 12648 12649 var wrapper = element.retrieve('wrapper'), 12650 styles = element.getStyles('margin', 'position', 'overflow'); 12651 12652 if (options.hideOverflow) styles = Object.append(styles, {overflow: 'hidden'}); 12653 if (options.wrapper) wrapper = document.id(options.wrapper).setStyles(styles); 12654 12655 if (!wrapper) wrapper = new Element('div', { 12656 styles: styles 12657 }).wraps(element); 12658 12659 element.store('wrapper', wrapper).setStyle('margin', 0); 12660 if (element.getStyle('overflow') == 'visible') element.setStyle('overflow', 'hidden'); 12661 12662 this.now = []; 12663 this.open = true; 12664 this.wrapper = wrapper; 12665 12666 this.addEvent('complete', function(){ 12667 this.open = (wrapper['offset' + this.layout.capitalize()] != 0); 12668 if (this.open && this.options.resetHeight) wrapper.setStyle('height', ''); 12669 }, true); 12670 }, 12671 12672 vertical: function(){ 12673 this.margin = 'margin-top'; 12674 this.layout = 'height'; 12675 this.offset = this.element.offsetHeight; 12676 }, 12677 12678 horizontal: function(){ 12679 this.margin = 'margin-left'; 12680 this.layout = 'width'; 12681 this.offset = this.element.offsetWidth; 12682 }, 12683 12684 set: function(now){ 12685 this.element.setStyle(this.margin, now[0]); 12686 this.wrapper.setStyle(this.layout, now[1]); 12687 return this; 12688 }, 12689 12690 compute: function(from, to, delta){ 12691 return [0, 1].map(function(i){ 12692 return Fx.compute(from[i], to[i], delta); 12693 }); 12694 }, 12695 12696 start: function(how, mode){ 12697 if (!this.check(how, mode)) return this; 12698 this[mode || this.options.mode](); 12699 12700 var margin = this.element.getStyle(this.margin).toInt(), 12701 layout = this.wrapper.getStyle(this.layout).toInt(), 12702 caseIn = [[margin, layout], [0, this.offset]], 12703 caseOut = [[margin, layout], [-this.offset, 0]], 12704 start; 12705 12706 switch (how){ 12707 case 'in': start = caseIn; break; 12708 case 'out': start = caseOut; break; 12709 case 'toggle': start = (layout == 0) ? caseIn : caseOut; 12710 } 12711 return this.parent(start[0], start[1]); 12712 }, 12713 12714 slideIn: function(mode){ 12715 return this.start('in', mode); 12716 }, 12717 12718 slideOut: function(mode){ 12719 return this.start('out', mode); 12720 }, 12721 12722 hide: function(mode){ 12723 this[mode || this.options.mode](); 12724 this.open = false;
12725 return this.set([-this.offset, 0]); 12726 }, 12727 12728 show: function(mode){ 12729 this[mode || this.options.mode](); 12730 this.open = true; 12731 return this.set([0, this.offset]); 12732 }, 12733 12734 toggle: function(mode){ 12735 return this.start('toggle', mode); 12736 } 12737 12738}); 12739 12740Element.Properties.slide = { 12741 12742 set: function(options){ 12743 this.get('slide').cancel().setOptions(options); 12744 return this; 12745 }, 12746 12747 get: function(){ 12748 var slide = this.retrieve('slide'); 12749 if (!slide){ 12750 slide = new Fx.Slide(this, {link: 'cancel'}); 12751 this.store('slide', slide); 12752 } 12753 return slide; 12754 } 12755 12756}; 12757 12758Element.implement({ 12759 12760 slide: function(how, mode){ 12761 how = how || 'toggle'; 12762 var slide = this.get('slide'), toggle; 12763 switch (how){ 12764 case 'hide': slide.hide(mode); break; 12765 case 'show': slide.show(mode); break; 12766 case 'toggle': 12767 var flag = this.retrieve('slide:flag', slide.open); 12768 slide[flag ? 'slideOut' : 'slideIn'](mode); 12769 this.store('slide:flag', !flag); 12770 toggle = true; 12771 break; 12772 default: slide.start(how, mode); 12773 } 12774 if (!toggle) this.eliminate('slide:flag'); 12775 return this; 12776 } 12777 12778}); 12779 12780 12781/* 12782--- 12783 12784script: Fx.SmoothScroll.js 12785 12786name: Fx.SmoothScroll 12787 12788description: Class for creating a smooth scrolling effect to all internal links on the page. 12789 12790license: MIT-style license 12791 12792authors: 12793 - Valerio Proietti 12794 12795requires: 12796 - Core/Slick.Finder 12797 - /Fx.Scroll 12798 12799provides: [Fx.SmoothScroll] 12800 12801... 12802*/ 12803 12804/*<1.2compat>*/var SmoothScroll = /*</1.2compat>*/Fx.SmoothScroll = new Class({ 12805 12806 Extends: Fx.Scroll, 12807 12808 options: { 12809 axes: ['x', 'y'] 12810 }, 12811 12812 initialize: function(options, context){ 12813 context = context || document; 12814 this.doc = context.getDocument(); 12815 this.parent(this.doc, options); 12816 12817 var win = context.getWindow(), 12818 location = win.location.href.match(/^[^#]*/)[0] + '#', 12819 links = $$(this.options.links || this.doc.links); 12820 12821 links.each(function(link){ 12822 if (link.href.indexOf(location) != 0) return; 12823 var anchor = link.href.substr(location.length); 12824 if (anchor) this.useLink(link, anchor); 12825 }, this); 12826 12827 this.addEvent('complete', function(){ 12828 win.location.hash = this.anchor; 12829 this.element.scrollTo(this.to[0], this.to[1]); 12830 }, true); 12831 }, 12832 12833 useLink: function(link, anchor){ 12834 12835 link.addEvent('click', function(event){ 12836 var el = document.id(anchor) || this.doc.getElement('a[name=' + anchor + ']'); 12837 if (!el) return; 12838 12839 event.preventDefault(); 12840 this.toElement(el, this.options.axes).chain(function(){ 12841 this.fireEvent('scrolledTo', [link, el]); 12842 }.bind(this)); 12843 12844 this.anchor = anchor; 12845 12846 }.bind(this)); 12847 12848 return this; 12849 } 12850}); 12851 12852 12853/* 12854--- 12855 12856script: Fx.Sort.js 12857 12858name: Fx.Sort 12859 12860description: Defines Fx.Sort, a class that reorders lists with a transition. 12861 12862license: MIT-style license 12863 12864authors: 12865 - Aaron Newton 12866 12867requires: 12868 - Core/Element.Dimensions 12869 - /Fx.Elements 12870 - /Element.Measure 12871 12872provides: [Fx.Sort] 12873 12874... 12875*/ 12876 12877Fx.Sort = new Class({ 12878 12879 Extends: Fx.Elements, 12880 12881 options: { 12882 mode: 'vertical' 12883 }, 12884 12885 initialize: function(elements, options){ 12886 this.parent(elements, options); 12887 this.elements.each(function(el){ 12888 if (el.getStyle('position') == 'static') el.setStyle('position', 'relative'); 12889 }); 12890 this.setDefaultOrder(); 12891 }, 12892 12893 setDefaultOrder: function(){ 12894 this.currentOrder = this.elements.map(function(el, index){ 12895 return index; 12896 }); 12897 }, 12898 12899 sort: function(){ 12900 if (!this.check(arguments)) return this; 12901 var newOrder = Array.flatten(arguments); 12902 12903 var top = 0, 12904 left = 0, 12905 next = {}, 12906 zero = {}, 12907 vert = this.options.mode == 'vertical'; 12908 12909 var current = this.elements.map(function(el, index){ 12910 var size = el.getComputedSize({styles: ['border', 'padding', 'margin']}); 12911 var val; 12912 if (vert){ 12913 val = { 12914 top: top, 12915 margin: size['margin-top'], 12916 height: size.totalHeight 12917 }; 12918 top += val.height - size['margin-top']; 12919 } else { 12920 val = { 12921 left: left, 12922 margin: size['margin-left'], 12923 width: size.totalWidth 12924 }; 12925 left += val.width; 12926 } 12927 var plane = vert ? 'top' : 'left'; 12928 zero[index] = {}; 12929 var start = el.getStyle(plane).toInt(); 12930 zero[index][plane] = start || 0; 12931 return val; 12932 }, this); 12933 12934 this.set(zero); 12935 newOrder = newOrder.map(function(i){ return i.toInt(); }); 12936 if (newOrder.length != this.elements.length){ 12937 this.currentOrder.each(function(index){ 12938 if (!newOrder.contains(index)) newOrder.push(index); 12939 }); 12940 if (newOrder.length > this.elements.length) 12941 newOrder.splice(this.elements.length-1, newOrder.length - this.elements.length); 12942 } 12943 var margin = 0; 12944 top = left = 0; 12945 newOrder.each(function(item){ 12946 var newPos = {}; 12947 if (vert){ 12948 newPos.top = top - current[item].top - margin; 12949 top += current[item].height; 12950 } else { 12951 newPos.left = left - current[item].left; 12952 left += current[item].width; 12953 } 12954 margin = margin + current[item].margin; 12955 next[item]=newPos; 12956 }, this); 12957 var mapped = {}; 12958 Array.clone(newOrder).sort().each(function(index){ 12959 mapped[index] = next[index]; 12960 }); 12961 this.start(mapped); 12962 this.currentOrder = newOrder; 12963 12964 return this; 12965 }, 12966 12967 rearrangeDOM: function(newOrder){ 12968 newOrder = newOrder || this.currentOrder; 12969 var parent = this.elements[0].getParent(); 12970 var rearranged = []; 12971 this.elements.setStyle('opacity', 0); 12972 //move each element and store the new default order 12973 newOrder.each(function(index){ 12974 rearranged.push(this.elements[index].inject(parent).setStyles({ 12975 top: 0, 12976 left: 0 12977 })); 12978 }, this); 12979 this.elements.setStyle('opacity', 1); 12980 this.elements = $$(rearranged); 12981 this.setDefaultOrder(); 12982 return this; 12983 }, 12984 12985 getDefaultOrder: function(){ 12986 return this.elements.map(function(el, index){ 12987 return index; 12988 }); 12989 }, 12990 12991 getCurrentOrder: function(){ 12992 return this.currentOrder; 12993 }, 12994 12995 forward: function(){ 12996 return this.sort(this.getDefaultOrder()); 12997 }, 12998 12999 backward: function(){ 13000 return this.sort(this.getDefaultOrder().reverse()); 13001 }, 13002 13003 reverse: function(){ 13004 return this.sort(this.currentOrder.reverse()); 13005 }, 13006 13007 sortByElements: function(elements){ 13008 return this.sort(elements.map(function(el){ 13009 return this.elements.indexOf(el); 13010 }, this)); 13011 }, 13012 13013 swap: function(one, two){ 13014 if (typeOf(one) == 'element') one = this.elements.indexOf(one); 13015 if (typeOf(two) == 'element') two = this.elements.indexOf(two); 13016 13017 var newOrder = Array.clone(this.currentOrder); 13018 newOrder[this.currentOrder.indexOf(one)] = two; 13019 newOrder[this.currentOrder.indexOf(two)] = one; 13020 13021 return this.sort(newOrder); 13022 } 13023 13024}); 13025 13026 13027/* 13028--- 13029 13030script: Drag.js 13031 13032name: Drag 13033 13034description: The base Drag Class. Can be used to drag and resize Elements using mouse events. 13035 13036license: MIT-style license 13037 13038authors: 13039 - Valerio Proietti 13040 - Tom Occhinno 13041 - Jan Kassens 13042 13043requires: 13044 - Core/Events 13045 - Core/Options 13046 - Core/Element.Event 13047 - Core/Element.Style 13048 - Core/Element.Dimensions
13049 - /MooTools.More 13050 13051provides: [Drag] 13052... 13053 13054*/ 13055 13056var Drag = new Class({ 13057 13058 Implements: [Events, Options], 13059 13060 options: {/* 13061 onBeforeStart: function(thisElement){}, 13062 onStart: function(thisElement, event){}, 13063 onSnap: function(thisElement){}, 13064 onDrag: function(thisElement, event){}, 13065 onCancel: function(thisElement){}, 13066 onComplete: function(thisElement, event){},*/ 13067 snap: 6, 13068 unit: 'px', 13069 grid: false, 13070 style: true, 13071 limit: false, 13072 handle: false, 13073 invert: false, 13074 preventDefault: false, 13075 stopPropagation: false, 13076 modifiers: {x: 'left', y: 'top'} 13077 }, 13078 13079 initialize: function(){ 13080 var params = Array.link(arguments, { 13081 'options': Type.isObject, 13082 'element': function(obj){ 13083 return obj != null; 13084 } 13085 }); 13086 13087 this.element = document.id(params.element); 13088 this.document = this.element.getDocument(); 13089 this.setOptions(params.options || {}); 13090 var htype = typeOf(this.options.handle); 13091 this.handles = ((htype == 'array' || htype == 'collection') ? $$(this.options.handle) : document.id(this.options.handle)) || this.element; 13092 this.mouse = {'now': {}, 'pos': {}}; 13093 this.value = {'start': {}, 'now': {}}; 13094 13095 this.selection = (Browser.ie) ? 'selectstart' : 'mousedown'; 13096 13097 13098 if (Browser.ie && !Drag.ondragstartFixed){ 13099 document.ondragstart = Function.from(false); 13100 Drag.ondragstartFixed = true; 13101 } 13102 13103 this.bound = { 13104 start: this.start.bind(this), 13105 check: this.check.bind(this), 13106 drag: this.drag.bind(this), 13107 stop: this.stop.bind(this), 13108 cancel: this.cancel.bind(this), 13109 eventStop: Function.from(false) 13110 }; 13111 this.attach(); 13112 }, 13113 13114 attach: function(){ 13115 this.handles.addEvent('mousedown', this.bound.start); 13116 return this; 13117 }, 13118 13119 detach: function(){ 13120 this.handles.removeEvent('mousedown', this.bound.start); 13121 return this; 13122 }, 13123 13124 start: function(event){ 13125 var options = this.options; 13126 13127 if (event.rightClick) return; 13128 13129 if (options.preventDefault) event.preventDefault(); 13130 if (options.stopPropagation) event.stopPropagation(); 13131 this.mouse.start = event.page; 13132 13133 this.fireEvent('beforeStart', this.element); 13134 13135 var limit = options.limit; 13136 this.limit = {x: [], y: []}; 13137 13138 var z, coordinates; 13139 for (z in options.modifiers){ 13140 if (!options.modifiers[z]) continue; 13141 13142 var style = this.element.getStyle(options.modifiers[z]); 13143 13144 // Some browsers (IE and Opera) don't always return pixels. 13145 if (style && !style.match(/px$/)){ 13146 if (!coordinates) coordinates = this.element.getCoordinates(this.element.getOffsetParent()); 13147 style = coordinates[options.modifiers[z]]; 13148 } 13149 13150 if (options.style) this.value.now[z] = (style || 0).toInt(); 13151 else this.value.now[z] = this.element[options.modifiers[z]]; 13152 13153 if (options.invert) this.value.now[z] *= -1; 13154 13155 this.mouse.pos[z] = event.page[z] - this.value.now[z]; 13156 13157 if (limit && limit[z]){ 13158 var i = 2; 13159 while (i--){ 13160 var limitZI = limit[z][i]; 13161 if (limitZI || limitZI === 0) this.limit[z][i] = (typeof limitZI == 'function') ? limitZI() : limitZI; 13162 } 13163 } 13164 } 13165 13166 if (typeOf(this.options.grid) == 'number') this.options.grid = { 13167 x: this.options.grid, 13168 y: this.options.grid 13169 }; 13170 13171 var events = { 13172 mousemove: this.bound.check, 13173 mouseup: this.bound.cancel 13174 }; 13175 events[this.selection] = this.bound.eventStop; 13176 this.document.addEvents(events); 13177 }, 13178 13179 check: function(event){ 13180 if (this.options.preventDefault) event.preventDefault(); 13181 var distance = Math.round(Math.sqrt(Math.pow(event.page.x - this.mouse.start.x, 2) + Math.pow(event.page.y - this.mouse.start.y, 2))); 13182 if (distance > this.options.snap){ 13183 this.cancel(); 13184 this.document.addEvents({ 13185 mousemove: this.bound.drag, 13186 mouseup: this.bound.stop 13187 }); 13188 this.fireEvent('start', [this.element, event]).fireEvent('snap', this.element); 13189 } 13190 }, 13191 13192 drag: function(event){ 13193 var options = this.options; 13194 13195 if (options.preventDefault) event.preventDefault(); 13196 this.mouse.now = event.page; 13197 13198 for (var z in options.modifiers){ 13199 if (!options.modifiers[z]) continue; 13200 this.value.now[z] = this.mouse.now[z] - this.mouse.pos[z]; 13201 13202 if (options.invert) this.value.now[z] *= -1; 13203 13204 if (options.limit && this.limit[z]){ 13205 if ((this.limit[z][1] || this.limit[z][1] === 0) && (this.value.now[z] > this.limit[z][1])){ 13206 this.value.now[z] = this.limit[z][1]; 13207 } else if ((this.limit[z][0] || this.limit[z][0] === 0) && (this.value.now[z] < this.limit[z][0])){ 13208 this.value.now[z] = this.limit[z][0]; 13209 } 13210 } 13211 13212 if (options.grid[z]) this.value.now[z] -= ((this.value.now[z] - (this.limit[z][0]||0)) % options.grid[z]); 13213 13214 if (options.style) this.element.setStyle(options.modifiers[z], this.value.now[z] + options.unit); 13215 else this.element[options.modifiers[z]] = this.value.now[z]; 13216 } 13217 13218 this.fireEvent('drag', [this.element, event]); 13219 }, 13220 13221 cancel: function(event){ 13222 this.document.removeEvents({ 13223 mousemove: this.bound.check, 13224 mouseup: this.bound.cancel 13225 }); 13226 if (event){ 13227 this.document.removeEvent(this.selection, this.bound.eventStop); 13228 this.fireEvent('cancel', this.element); 13229 } 13230 }, 13231 13232 stop: function(event){ 13233 var events = { 13234 mousemove: this.bound.drag, 13235 mouseup: this.bound.stop 13236 }; 13237 events[this.selection] = this.bound.eventStop; 13238 this.document.removeEvents(events); 13239 if (event) this.fireEvent('complete', [this.element, event]); 13240 } 13241 13242}); 13243 13244Element.implement({ 13245 13246 makeResizable: function(options){ 13247 var drag = new Drag(this, Object.merge({ 13248 modifiers: { 13249 x: 'width', 13250 y: 'height' 13251 } 13252 }, options)); 13253 13254 this.store('resizer', drag); 13255 return drag.addEvent('drag', function(){ 13256 this.fireEvent('resize', drag); 13257 }.bind(this)); 13258 } 13259 13260}); 13261 13262 13263/* 13264--- 13265 13266script: Drag.Move.js 13267 13268name: Drag.Move 13269 13270description: A Drag extension that provides support for the constraining of draggables to containers and droppables. 13271 13272license: MIT-style license 13273 13274authors: 13275 - Valerio Proietti 13276 - Tom Occhinno 13277 - Jan Kassens 13278 - Aaron Newton 13279 - Scott Kyle 13280 13281requires: 13282 - Core/Element.Dimensions 13283 - /Drag 13284 13285provides: [Drag.Move] 13286 13287... 13288*/ 13289 13290Drag.Move = new Class({ 13291 13292 Extends: Drag, 13293 13294 options: {/* 13295 onEnter: function(thisElement, overed){}, 13296 onLeave: function(thisElement, overed){}, 13297 onDrop: function(thisElement, overed, event){},*/ 13298 droppables: [], 13299 container: false, 13300 precalculate: false, 13301 includeMargins: true, 13302 checkDroppables: true 13303 }, 13304 13305 initialize: function(element, options){ 13306 this.parent(element, options); 13307 element = this.element; 13308 13309 this.droppables = $$(this.options.droppables); 13310 this.container = document.id(this.options.container); 13311 13312 if (this.container && typeOf(this.container) != 'element') 13313 this.container = document.id(this.container.getDocument().body); 13314 13315 if (this.options.style){ 13316 if (this.options.modifiers.x == 'left' && this.options.modifiers.y == 'top'){ 13317 var parent = element.getOffsetParent(), 13318 styles = element.getStyles('left', 'top'); 13319 if (parent && (styles.left == 'auto' || styles.top == 'auto')){ 13320 element.setPosition(element.getPosition(parent)); 13321 } 13322 } 13323 13324 if (element.getStyle('position') == 'static') element.setStyle('position', 'absolute'); 13325 } 13326 13327 this.addEvent('start', this.checkDroppables, true); 13328 this.overed = null; 13329 }, 13330 13331 start: function(event){ 13332 if (this.container) this.options.limit = this.calculateLimit(); 13333 13334 if (this.options.precalculate){ 13335 this.positions = this.droppables.map(function(el){ 13336 return el.getCoordinates(); 13337 }); 13338 } 13339 13340 this.parent(event); 13341 }, 13342 13343 calculateLimit: function(){ 13344 var element = this.element, 13345 container = this.container, 13346 13347 offsetParent = document.id(element.getOffsetParent()) || document.body, 13348 containerCoordinates = container.getCoordinates(offsetParent), 13349 elementMargin = {}, 13350 elementBorder = {},
13351 containerMargin = {}, 13352 containerBorder = {}, 13353 offsetParentPadding = {}; 13354 13355 ['top', 'right', 'bottom', 'left'].each(function(pad){ 13356 elementMargin[pad] = element.getStyle('margin-' + pad).toInt(); 13357 elementBorder[pad] = element.getStyle('border-' + pad).toInt(); 13358 containerMargin[pad] = container.getStyle('margin-' + pad).toInt(); 13359 containerBorder[pad] = container.getStyle('border-' + pad).toInt(); 13360 offsetParentPadding[pad] = offsetParent.getStyle('padding-' + pad).toInt(); 13361 }, this); 13362 13363 var width = element.offsetWidth + elementMargin.left + elementMargin.right, 13364 height = element.offsetHeight + elementMargin.top + elementMargin.bottom, 13365 left = 0, 13366 top = 0, 13367 right = containerCoordinates.right - containerBorder.right - width, 13368 bottom = containerCoordinates.bottom - containerBorder.bottom - height; 13369 13370 if (this.options.includeMargins){ 13371 left += elementMargin.left; 13372 top += elementMargin.top; 13373 } else { 13374 right += elementMargin.right; 13375 bottom += elementMargin.bottom; 13376 } 13377 13378 if (element.getStyle('position') == 'relative'){ 13379 var coords = element.getCoordinates(offsetParent); 13380 coords.left -= element.getStyle('left').toInt(); 13381 coords.top -= element.getStyle('top').toInt(); 13382 13383 left -= coords.left; 13384 top -= coords.top; 13385 if (container.getStyle('position') != 'relative'){ 13386 left += containerBorder.left; 13387 top += containerBorder.top; 13388 } 13389 right += elementMargin.left - coords.left; 13390 bottom += elementMargin.top - coords.top; 13391 13392 if (container != offsetParent){ 13393 left += containerMargin.left + offsetParentPadding.left; 13394 top += ((Browser.ie6 || Browser.ie7) ? 0 : containerMargin.top) + offsetParentPadding.top; 13395 } 13396 } else { 13397 left -= elementMargin.left; 13398 top -= elementMargin.top; 13399 if (container != offsetParent){ 13400 left += containerCoordinates.left + containerBorder.left; 13401 top += containerCoordinates.top + containerBorder.top; 13402 } 13403 } 13404 13405 return { 13406 x: [left, right], 13407 y: [top, bottom] 13408 }; 13409 }, 13410 13411 getDroppableCoordinates: function(element){ 13412 var position = element.getCoordinates(); 13413 if (element.getStyle('position') == 'fixed'){ 13414 var scroll = window.getScroll(); 13415 position.left += scroll.x; 13416 position.right += scroll.x; 13417 position.top += scroll.y; 13418 position.bottom += scroll.y; 13419 } 13420 return position; 13421 }, 13422 13423 checkDroppables: function(){ 13424 var overed = this.droppables.filter(function(el, i){ 13425 el = this.positions ? this.positions[i] : this.getDroppableCoordinates(el); 13426 var now = this.mouse.now; 13427 return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top); 13428 }, this).getLast(); 13429 13430 if (this.overed != overed){ 13431 if (this.overed) this.fireEvent('leave', [this.element, this.overed]); 13432 if (overed) this.fireEvent('enter', [this.element, overed]); 13433 this.overed = overed; 13434 } 13435 }, 13436 13437 drag: function(event){ 13438 this.parent(event); 13439 if (this.options.checkDroppables && this.droppables.length) this.checkDroppables(); 13440 }, 13441 13442 stop: function(event){ 13443 this.checkDroppables(); 13444 this.fireEvent('drop', [this.element, this.overed, event]); 13445 this.overed = null; 13446 return this.parent(event); 13447 } 13448 13449}); 13450 13451Element.implement({ 13452 13453 makeDraggable: function(options){ 13454 var drag = new Drag.Move(this, options); 13455 this.store('dragger', drag); 13456 return drag; 13457 } 13458 13459}); 13460 13461 13462/* 13463--- 13464 13465script: Slider.js 13466 13467name: Slider 13468 13469description: Class for creating horizontal and vertical slider controls. 13470 13471license: MIT-style license 13472 13473authors: 13474 - Valerio Proietti 13475 13476requires: 13477 - Core/Element.Dimensions 13478 - /Class.Binds 13479 - /Drag 13480 - /Element.Measure 13481 13482provides: [Slider] 13483 13484... 13485*/ 13486 13487var Slider = new Class({ 13488 13489 Implements: [Events, Options], 13490 13491 Binds: ['clickedElement', 'draggedKnob', 'scrolledElement'], 13492 13493 options: {/* 13494 onTick: function(intPosition){}, 13495 onChange: function(intStep){}, 13496 onComplete: function(strStep){},*/ 13497 onTick: function(position){ 13498 this.setKnobPosition(position); 13499 }, 13500 initialStep: 0, 13501 snap: false, 13502 offset: 0, 13503 range: false, 13504 wheel: false, 13505 steps: 100, 13506 mode: 'horizontal' 13507 }, 13508 13509 initialize: function(element, knob, options){ 13510 this.setOptions(options); 13511 options = this.options; 13512 this.element = document.id(element); 13513 knob = this.knob = document.id(knob); 13514 this.previousChange = this.previousEnd = this.step = -1; 13515 13516 var limit = {}, 13517 modifiers = {x: false, y: false}; 13518 13519 switch (options.mode){ 13520 case 'vertical': 13521 this.axis = 'y'; 13522 this.property = 'top'; 13523 this.offset = 'offsetHeight';
13524 break; 13525 case 'horizontal': 13526 this.axis = 'x'; 13527 this.property = 'left'; 13528 this.offset = 'offsetWidth'; 13529 } 13530 13531 this.setSliderDimensions(); 13532 this.setRange(options.range); 13533 13534 if (knob.getStyle('position') == 'static') knob.setStyle('position', 'relative'); 13535 knob.setStyle(this.property, -options.offset); 13536 modifiers[this.axis] = this.property; 13537 limit[this.axis] = [-options.offset, this.full - options.offset]; 13538 13539 var dragOptions = { 13540 snap: 0, 13541 limit: limit, 13542 modifiers: modifiers, 13543 onDrag: this.draggedKnob, 13544 onStart: this.draggedKnob, 13545 onBeforeStart: (function(){ 13546 this.isDragging = true; 13547 }).bind(this), 13548 onCancel: function(){ 13549 this.isDragging = false; 13550 }.bind(this), 13551 onComplete: function(){ 13552 this.isDragging = false; 13553 this.draggedKnob(); 13554 this.end(); 13555 }.bind(this) 13556 }; 13557 if (options.snap) this.setSnap(dragOptions); 13558 13559 this.drag = new Drag(knob, dragOptions); 13560 this.attach(); 13561 if (options.initialStep != null) this.set(options.initialStep); 13562 }, 13563 13564 attach: function(){ 13565 this.element.addEvent('mousedown', this.clickedElement); 13566 if (this.options.wheel) this.element.addEvent('mousewheel', this.scrolledElement); 13567 this.drag.attach(); 13568 return this; 13569 }, 13570 13571 detach: function(){ 13572 this.element.removeEvent('mousedown', this.clickedElement) 13573 .removeEvent('mousewheel', this.scrolledElement); 13574 this.drag.detach(); 13575 return this; 13576 }, 13577 13578 autosize: function(){ 13579 this.setSliderDimensions() 13580 .setKnobPosition(this.toPosition(this.step)); 13581 this.drag.options.limit[this.axis] = [-this.options.offset, this.full - this.options.offset]; 13582 if (this.options.snap) this.setSnap(); 13583 return this; 13584 }, 13585 13586 setSnap: function(options){ 13587 if (!options) options = this.drag.options; 13588 options.grid = Math.ceil(this.stepWidth); 13589 options.limit[this.axis][1] = this.full; 13590 return this; 13591 }, 13592 13593 setKnobPosition: function(position){ 13594 if (this.options.snap) position = this.toPosition(this.step); 13595 this.knob.setStyle(this.property, position); 13596 return this; 13597 }, 13598 13599 setSliderDimensions: function(){ 13600 this.full = this.element.measure(function(){ 13601 this.half = this.knob[this.offset] / 2; 13602 return this.element[this.offset] - this.knob[this.offset] + (this.options.offset * 2); 13603 }.bind(this)); 13604 return this; 13605 }, 13606 13607 set: function(step){ 13608 if (!((this.range > 0) ^ (step < this.min))) step = this.min; 13609 if (!((this.range > 0) ^ (step > this.max))) step = this.max; 13610 13611 this.step = Math.round(step); 13612 return this.checkStep() 13613 .fireEvent('tick', this.toPosition(this.step)) 13614 .end(); 13615 }, 13616 13617 setRange: function(range, pos){ 13618 this.min = Array.pick([range[0], 0]); 13619 this.max = Array.pick([range[1], this.options.steps]); 13620 this.range = this.max - this.min; 13621 this.steps = this.options.steps || this.full; 13622 this.stepSize = Math.abs(this.range) / this.steps; 13623 this.stepWidth = this.stepSize * this.full / Math.abs(this.range); 13624 if (range) this.set(Array.pick([pos, this.step]).floor(this.min).max(this.max)); 13625 return this; 13626 }, 13627 13628 clickedElement: function(event){ 13629 if (this.isDragging || event.target == this.knob) return; 13630 13631 var dir = this.range < 0 ? -1 : 1, 13632 position = event.page[this.axis] - this.element.getPosition()[this.axis] - this.half; 13633 13634 position = position.limit(-this.options.offset, this.full - this.options.offset); 13635 13636 this.step = Math.round(this.min + dir * this.toStep(position)); 13637 13638 this.checkStep() 13639 .fireEvent('tick', position) 13640 .end(); 13641 }, 13642 13643 scrolledElement: function(event){ 13644 var mode = (this.options.mode == 'horizontal') ? (event.wheel < 0) : (event.wheel > 0); 13645 this.set(this.step + (mode ? -1 : 1) * this.stepSize); 13646 event.stop(); 13647 }, 13648 13649 draggedKnob: function(){ 13650 var dir = this.range < 0 ? -1 : 1, 13651 position = this.drag.value.now[this.axis]; 13652 13653 position = position.limit(-this.options.offset, this.full -this.options.offset); 13654 13655 this.step = Math.round(this.min + dir * this.toStep(position)); 13656 this.checkStep(); 13657 }, 13658 13659 checkStep: function(){ 13660 var step = this.step; 13661 if (this.previousChange != step){ 13662 this.previousChange = step; 13663 this.fireEvent('change', step); 13664 } 13665 return this; 13666 }, 13667 13668 end: function(){ 13669 var step = this.step; 13670 if (this.previousEnd !== step){ 13671 this.previousEnd = step; 13672 this.fireEvent('complete', step + ''); 13673 } 13674 return this; 13675 }, 13676 13677 toStep: function(position){ 13678 var step = (position + this.options.offset) * this.stepSize / this.full * this.steps; 13679 return this.options.steps ? Math.round(step -= step % this.stepSize) : step; 13680 }, 13681 13682 toPosition: function(step){ 13683 return (this.full * Math.abs(this.min - step)) / (this.steps * this.stepSize) - this.options.offset; 13684 } 13685 13686}); 13687 13688 13689/* 13690--- 13691 13692script: Sortables.js 13693 13694name: Sortables 13695 13696description: Class for creating a drag and drop sorting interface for lists of items. 13697 13698license: MIT-style license 13699 13700authors: 13701 - Tom Occhino 13702 13703requires: 13704 - Core/Fx.Morph 13705 - /Drag.Move 13706 13707provides: [Sortables] 13708 13709... 13710*/ 13711 13712var Sortables = new Class({ 13713 13714 Implements: [Events, Options], 13715 13716 options: {/* 13717 onSort: function(element, clone){}, 13718 onStart: function(element, clone){}, 13719 onComplete: function(element){},*/ 13720 opacity: 1, 13721 clone: false, 13722 revert: false, 13723 handle: false, 13724 dragOptions: {}/*<1.2compat>*/, 13725 snap: 4,
13726 constrain: false, 13727 preventDefault: false 13728 /*</1.2compat>*/ 13729 }, 13730 13731 initialize: function(lists, options){ 13732 this.setOptions(options); 13733 13734 this.elements = []; 13735 this.lists = []; 13736 this.idle = true; 13737 13738 this.addLists($$(document.id(lists) || lists)); 13739 13740 if (!this.options.clone) this.options.revert = false; 13741 if (this.options.revert) this.effect = new Fx.Morph(null, Object.merge({ 13742 duration: 250, 13743 link: 'cancel' 13744 }, this.options.revert)); 13745 }, 13746 13747 attach: function(){ 13748 this.addLists(this.lists); 13749 return this; 13750 }, 13751 13752 detach: function(){ 13753 this.lists = this.removeLists(this.lists); 13754 return this; 13755 }, 13756 13757 addItems: function(){ 13758 Array.flatten(arguments).each(function(element){ 13759 this.elements.push(element); 13760 var start = element.retrieve('sortables:start', function(event){ 13761 this.start.call(this, event, element); 13762 }.bind(this)); 13763 (this.options.handle ? element.getElement(this.options.handle) || element : element).addEvent('mousedown', start); 13764 }, this); 13765 return this; 13766 }, 13767 13768 addLists: function(){ 13769 Array.flatten(arguments).each(function(list){ 13770 this.lists.include(list); 13771 this.addItems(list.getChildren()); 13772 }, this); 13773 return this; 13774 }, 13775 13776 removeItems: function(){ 13777 return $$(Array.flatten(arguments).map(function(element){ 13778 this.elements.erase(element); 13779 var start = element.retrieve('sortables:start'); 13780 (this.options.handle ? element.getElement(this.options.handle) || element : element).removeEvent('mousedown', start); 13781 13782 return element; 13783 }, this)); 13784 }, 13785 13786 removeLists: function(){ 13787 return $$(Array.flatten(arguments).map(function(list){ 13788 this.lists.erase(list); 13789 this.removeItems(list.getChildren()); 13790 13791 return list; 13792 }, this)); 13793 }, 13794 13795 getClone: function(event, element){ 13796 if (!this.options.clone) return new Element(element.tagName).inject(document.body); 13797 if (typeOf(this.options.clone) == 'function') return this.options.clone.call(this, event, element, this.list); 13798 var clone = element.clone(true).setStyles({ 13799 margin: 0, 13800 position: 'absolute', 13801 visibility: 'hidden', 13802 width: element.getStyle('width') 13803 }).addEvent('mousedown', function(event){ 13804 element.fireEvent('mousedown', event); 13805 }); 13806 //prevent the duplicated radio inputs from unchecking the real one 13807 if (clone.get('html').test('radio')){ 13808 clone.getElements('input[type=radio]').each(function(input, i){ 13809 input.set('name', 'clone_' + i); 13810 if (input.get('checked')) element.getElements('input[type=radio]')[i].set('checked', true); 13811 }); 13812 } 13813 13814 return clone.inject(this.list).setPosition(element.getPosition(element.getOffsetParent())); 13815 }, 13816 13817 getDroppables: function(){ 13818 var droppables = this.list.getChildren().erase(this.clone).erase(this.element); 13819 if (!this.options.constrain) droppables.append(this.lists).erase(this.list); 13820 return droppables; 13821 }, 13822 13823 insert: function(dragging, element){ 13824 var where = 'inside'; 13825 if (this.lists.contains(element)){ 13826 this.list = element; 13827 this.drag.droppables = this.getDroppables(); 13828 } else { 13829 where = this.element.getAllPrevious().contains(element) ? 'before' : 'after'; 13830 } 13831 this.element.inject(element, where); 13832 this.fireEvent('sort', [this.element, this.clone]); 13833 }, 13834 13835 start: function(event, element){ 13836 if ( 13837 !this.idle || 13838 event.rightClick || 13839 ['button', 'input', 'a', 'textarea'].contains(event.target.get('tag')) 13840 ) return; 13841 13842 this.idle = false; 13843 this.element = element; 13844 this.opacity = element.getStyle('opacity'); 13845 this.list = element.getParent(); 13846 this.clone = this.getClone(event, element); 13847 13848 this.drag = new Drag.Move(this.clone, Object.merge({ 13849 /*<1.2compat>*/ 13850 preventDefault: this.options.preventDefault, 13851 snap: this.options.snap, 13852 container: this.options.constrain && this.element.getParent(), 13853 /*</1.2compat>*/ 13854 droppables: this.getDroppables() 13855 }, this.options.dragOptions)).addEvents({ 13856 onSnap: function(){ 13857 event.stop(); 13858 this.clone.setStyle('visibility', 'visible'); 13859 this.element.setStyle('opacity', this.options.opacity || 0); 13860 this.fireEvent('start', [this.element, this.clone]); 13861 }.bind(this), 13862 onEnter: this.insert.bind(this), 13863 onCancel: this.end.bind(this), 13864 onComplete: this.end.bind(this) 13865 }); 13866 13867 this.clone.inject(this.element, 'before'); 13868 this.drag.start(event); 13869 }, 13870 13871 end: function(){ 13872 this.drag.detach(); 13873 this.element.setStyle('opacity', this.opacity); 13874 if (this.effect){ 13875 var dim = this.element.getStyles('width', 'height'), 13876 clone = this.clone, 13877 pos = clone.computePosition(this.element.getPosition(this.clone.getOffsetParent())); 13878 13879 var destroy = function(){ 13880 this.removeEvent('cancel', destroy); 13881 clone.destroy(); 13882 }; 13883 13884 this.effect.element = clone; 13885 this.effect.start({ 13886 top: pos.top, 13887 left: pos.left, 13888 width: dim.width,
13889 height: dim.height, 13890 opacity: 0.25 13891 }).addEvent('cancel', destroy).chain(destroy); 13892 } else { 13893 this.clone.destroy(); 13894 } 13895 this.reset(); 13896 }, 13897 13898 reset: function(){ 13899 this.idle = true; 13900 this.fireEvent('complete', this.element); 13901 }, 13902 13903 serialize: function(){ 13904 var params = Array.link(arguments, { 13905 modifier: Type.isFunction, 13906 index: function(obj){ 13907 return obj != null; 13908 } 13909 }); 13910 var serial = this.lists.map(function(list){ 13911 return list.getChildren().map(params.modifier || function(element){ 13912 return element.get('id'); 13913 }, this); 13914 }, this); 13915 13916 var index = params.index; 13917 if (this.lists.length == 1) index = 0; 13918 return (index || index === 0) && index >= 0 && index < this.lists.length ? serial[index] : serial; 13919 } 13920 13921}); 13922 13923 13924/* 13925--- 13926 13927script: Request.JSONP.js 13928 13929name: Request.JSONP 13930 13931description: Defines Request.JSONP, a class for cross domain javascript via script injection. 13932 13933license: MIT-style license 13934 13935authors: 13936 - Aaron Newton 13937 - Guillermo Rauch 13938 - Arian Stolwijk 13939 13940requires: 13941 - Core/Element 13942 - Core/Request 13943 - MooTools.More 13944 13945provides: [Request.JSONP] 13946 13947... 13948*/ 13949 13950Request.JSONP = new Class({ 13951 13952 Implements: [Chain, Events, Options], 13953 13954 options: {/* 13955 onRequest: function(src, scriptElement){}, 13956 onComplete: function(data){}, 13957 onSuccess: function(data){}, 13958 onCancel: function(){}, 13959 onTimeout: function(){}, 13960 onError: function(){}, */ 13961 onRequest: function(src){ 13962 if (this.options.log && window.console && console.log){ 13963 console.log('JSONP retrieving script with url:' + src); 13964 } 13965 }, 13966 onError: function(src){ 13967 if (this.options.log && window.console && console.warn){ 13968 console.warn('JSONP '+ src +' will fail in Internet Explorer, which enforces a 2083 bytes length limit on URIs'); 13969 } 13970 }, 13971 url: '', 13972 callbackKey: 'callback', 13973 injectScript: document.head, 13974 data: '', 13975 link: 'ignore', 13976 timeout: 0, 13977 log: false 13978 }, 13979 13980 initialize: function(options){ 13981 this.setOptions(options); 13982 }, 13983 13984 send: function(options){ 13985 if (!Request.prototype.check.call(this, options)) return this; 13986 this.running = true; 13987 13988 var type = typeOf(options); 13989 if (type == 'string' || type == 'element') options = {data: options}; 13990 options = Object.merge(this.options, options || {}); 13991 13992 var data = options.data; 13993 switch (typeOf(data)){ 13994 case 'element': data = document.id(data).toQueryString(); break; 13995 case 'object': case 'hash': data = Object.toQueryString(data); 13996 } 13997 13998 var index = this.index = Request.JSONP.counter++; 13999 14000 var src = options.url + 14001 (options.url.test('\\?') ? '&' :'?') + 14002 (options.callbackKey) + 14003 '=Request.JSONP.request_map.request_'+ index + 14004 (data ? '&' + data : ''); 14005 14006 if (src.length > 2083) this.fireEvent('error', src); 14007 14008 Request.JSONP.request_map['request_' + index] = function(){ 14009 this.success(arguments, index); 14010 }.bind(this); 14011 14012 var script = this.getScript(src).inject(options.injectScript); 14013 this.fireEvent('request', [src, script]); 14014 14015 if (options.timeout) this.timeout.delay(options.timeout, this); 14016 14017 return this; 14018 }, 14019 14020 getScript: function(src){ 14021 if (!this.script) this.script = new Element('script', { 14022 type: 'text/javascript', 14023 async: true, 14024 src: src 14025 }); 14026 return this.script; 14027 }, 14028 14029 success: function(args, index){ 14030 if (!this.running) return; 14031 this.clear() 14032 .fireEvent('complete', args).fireEvent('success', args) 14033 .callChain(); 14034 }, 14035 14036 cancel: function(){ 14037 if (this.running) this.clear().fireEvent('cancel'); 14038 return this; 14039 }, 14040 14041 isRunning: function(){ 14042 return !!this.running; 14043 }, 14044 14045 clear: function(){ 14046 this.running = false; 14047 if (this.script){ 14048 this.script.destroy(); 14049 this.script = null; 14050 } 14051 return this; 14052 }, 14053 14054 timeout: function(){ 14055 if (this.running){ 14056 this.running = false; 14057 this.fireEvent('timeout', [this.script.get('src'), this.script]).fireEvent('failure').cancel(); 14058 } 14059 return this; 14060 } 14061 14062}); 14063 14064Request.JSONP.counter = 0; 14065Request.JSONP.request_map = {}; 14066 14067 14068/* 14069--- 14070 14071script: Request.Queue.js 14072 14073name: Request.Queue 14074 14075description: Controls several instances of Request and its variants to run only one request at a time. 14076 14077license: MIT-style license 14078 14079authors: 14080 - Aaron Newton 14081 14082requires: 14083 - Core/Element 14084 - Core/Request 14085 - /Class.Binds 14086 14087provides: [Request.Queue] 14088 14089... 14090*/ 14091 14092Request.Queue = new Class({ 14093 14094 Implements: [Options, Events], 14095 14096 Binds: ['attach', 'request', 'complete', 'cancel', 'success', 'failure', 'exception'], 14097 14098 options: {/* 14099 onRequest: function(argsPassedToOnRequest){}, 14100 onSuccess: function(argsPassedToOnSuccess){}, 14101 onComplete: function(argsPassedToOnComplete){}, 14102 onCancel: function(argsPassedToOnCancel){}, 14103 onException: function(argsPassedToOnException){}, 14104 onFailure: function(argsPassedToOnFailure){}, 14105 onEnd: function(){}, 14106 */ 14107 stopOnFailure: true, 14108 autoAdvance: true, 14109 concurrent: 1, 14110 requests: {} 14111 }, 14112 14113 initialize: function(options){ 14114 var requests; 14115 if (options){ 14116 requests = options.requests; 14117 delete options.requests; 14118 } 14119 this.setOptions(options); 14120 this.requests = {}; 14121 this.queue = []; 14122 this.reqBinders = {}; 14123 14124 if (requests) this.addRequests(requests); 14125 }, 14126 14127 addRequest: function(name, request){ 14128 this.requests[name] = request; 14129 this.attach(name, request); 14130 return this; 14131 }, 14132 14133 addRequests: function(obj){ 14134 Object.each(obj, function(req, name){ 14135 this.addRequest(name, req); 14136 }, this); 14137 return this; 14138 }, 14139 14140 getName: function(req){ 14141 return Object.keyOf(this.requests, req); 14142 }, 14143 14144 attach: function(name, req){ 14145 if (req._groupSend) return this; 14146 ['request', 'complete', 'cancel', 'success', 'failure', 'exception'].each(function(evt){ 14147 if (!this.reqBinders[name]) this.reqBinders[name] = {}; 14148 this.reqBinders[name][evt] = function(){ 14149 this['on' + evt.capitalize()].apply(this, [name, req].append(arguments)); 14150 }.bind(this); 14151 req.addEvent(evt, this.reqBinders[name][evt]); 14152 }, this); 14153 req._groupSend = req.send; 14154 req.send = function(options){ 14155 this.send(name, options); 14156 return req; 14157 }.bind(this); 14158 return this; 14159 }, 14160 14161 removeRequest: function(req){ 14162 var name = typeOf(req) == 'object' ? this.getName(req) : req; 14163 if (!name && typeOf(name) != 'string') return this; 14164 req = this.requests[name]; 14165 if (!req) return this; 14166 ['request', 'complete', 'cancel', 'success', 'failure', 'exception'].each(function(evt){ 14167 req.removeEvent(evt, this.reqBinders[name][evt]); 14168 }, this); 14169 req.send = req._groupSend; 14170 delete req._groupSend; 14171 return this; 14172 }, 14173 14174 getRunning: function(){ 14175 return Object.filter(this.requests, function(r){ 14176 return r.running; 14177 }); 14178 }, 14179 14180 isRunning: function(){ 14181 return !!(Object.keys(this.getRunning()).length); 14182 }, 14183 14184 send: function(name, options){ 14185 var q = function(){ 14186 this.requests[name]._groupSend(options); 14187 this.queue.erase(q); 14188 }.bind(this); 14189 14190 q.name = name; 14191 if (Object.keys(this.getRunning()).length >= this.options.concurrent || (this.error && this.options.stopOnFailure)) this.queue.push(q); 14192 else q(); 14193 return this; 14194 }, 14195 14196 hasNext: function(name){ 14197 return (!name) ? !!this.queue.length : !!this.queue.filter(function(q){ return q.name == name; }).length; 14198 }, 14199 14200 resume: function(){ 14201 this.error = false;
14202 (this.options.concurrent - Object.keys(this.getRunning()).length).times(this.runNext, this); 14203 return this; 14204 }, 14205 14206 runNext: function(name){ 14207 if (!this.queue.length) return this; 14208 if (!name){ 14209 this.queue[0](); 14210 } else { 14211 var found; 14212 this.queue.each(function(q){ 14213 if (!found && q.name == name){ 14214 found = true; 14215 q(); 14216 } 14217 }); 14218 } 14219 return this; 14220 }, 14221 14222 runAll: function(){ 14223 this.queue.each(function(q){ 14224 q(); 14225 }); 14226 return this; 14227 }, 14228 14229 clear: function(name){ 14230 if (!name){ 14231 this.queue.empty(); 14232 } else { 14233 this.queue = this.queue.map(function(q){ 14234 if (q.name != name) return q; 14235 else return false; 14236 }).filter(function(q){ 14237 return q; 14238 }); 14239 } 14240 return this; 14241 }, 14242 14243 cancel: function(name){ 14244 this.requests[name].cancel(); 14245 return this; 14246 }, 14247 14248 onRequest: function(){ 14249 this.fireEvent('request', arguments); 14250 }, 14251 14252 onComplete: function(){ 14253 this.fireEvent('complete', arguments); 14254 if (!this.queue.length) this.fireEvent('end'); 14255 }, 14256 14257 onCancel: function(){ 14258 if (this.options.autoAdvance && !this.error) this.runNext(); 14259 this.fireEvent('cancel', arguments); 14260 }, 14261 14262 onSuccess: function(){ 14263 if (this.options.autoAdvance && !this.error) this.runNext(); 14264 this.fireEvent('success', arguments); 14265 }, 14266 14267 onFailure: function(){ 14268 this.error = true; 14269 if (!this.options.stopOnFailure && this.options.autoAdvance) this.runNext(); 14270 this.fireEvent('failure', arguments); 14271 }, 14272 14273 onException: function(){ 14274 this.error = true; 14275 if (!this.options.stopOnFailure && this.options.autoAdvance) this.runNext(); 14276 this.fireEvent('exception', arguments); 14277 } 14278 14279}); 14280 14281 14282/* 14283--- 14284 14285script: Request.Periodical.js 14286 14287name: Request.Periodical 14288 14289description: Requests the same URL to pull data from a server but increases the intervals if no data is returned to reduce the load 14290 14291license: MIT-style license 14292 14293authors: 14294 - Christoph Pojer 14295 14296requires: 14297 - Core/Request 14298 - /MooTools.More 14299 14300provides: [Request.Periodical] 14301 14302... 14303*/ 14304 14305Request.implement({ 14306 14307 options: { 14308 initialDelay: 5000, 14309 delay: 5000, 14310 limit: 60000 14311 }, 14312 14313 startTimer: function(data){ 14314 var fn = function(){ 14315 if (!this.running) this.send({data: data}); 14316 }; 14317 this.lastDelay = this.options.initialDelay; 14318 this.timer = fn.delay(this.lastDelay, this); 14319 this.completeCheck = function(response){ 14320 clearTimeout(this.timer); 14321 this.lastDelay = (response) ? this.options.delay : (this.lastDelay + this.options.delay).min(this.options.limit); 14322 this.timer = fn.delay(this.lastDelay, this); 14323 }; 14324 return this.addEvent('complete', this.completeCheck); 14325 }, 14326 14327 stopTimer: function(){ 14328 clearTimeout(this.timer); 14329 return this.removeEvent('complete', this.completeCheck); 14330 } 14331 14332}); 14333 14334 14335/* 14336--- 14337 14338script: Assets.js 14339 14340name: Assets 14341 14342description: Provides methods to dynamically load JavaScript, CSS, and Image files into the document. 14343 14344license: MIT-style license 14345 14346authors: 14347 - Valerio Proietti 14348 14349requires: 14350 - Core/Element.Event 14351 - /MooTools.More 14352 14353provides: [Assets] 14354 14355... 14356*/ 14357 14358var Asset = { 14359 14360 javascript: function(source, properties){ 14361 if (!properties) properties = {}; 14362 14363 var script = new Element('script', {src: source, type: 'text/javascript'}), 14364 doc = properties.document || document, 14365 load = properties.onload || properties.onLoad; 14366 14367 delete properties.onload; 14368 delete properties.onLoad; 14369 delete properties.document; 14370 14371 if (load){ 14372 if (typeof script.onreadystatechange != 'undefined'){ 14373 script.addEvent('readystatechange', function(){ 14374 if (['loaded', 'complete'].contains(this.readyState)) load.call(this); 14375 }); 14376 } else { 14377 script.addEvent('load', load); 14378 } 14379 } 14380 14381 return script.set(properties).inject(doc.head); 14382 }, 14383 14384 css: function(source, properties){ 14385 if (!properties) properties = {}; 14386 14387 var link = new Element('link', { 14388 rel: 'stylesheet', 14389 media: 'screen', 14390 type: 'text/css', 14391 href: source 14392 }); 14393 14394 var load = properties.onload || properties.onLoad, 14395 doc = properties.document || document; 14396 14397 delete properties.onload; 14398 delete properties.onLoad; 14399 delete properties.document; 14400 14401 if (load) link.addEvent('load', load); 14402 return link.set(properties).inject(doc.head); 14403 }, 14404 14405 image: function(source, properties){ 14406 if (!properties) properties = {}; 14407 14408 var image = new Image(), 14409 element = document.id(image) || new Element('img'); 14410 14411 ['load', 'abort', 'error'].each(function(name){ 14412 var type = 'on' + name, 14413 cap = 'on' + name.capitalize(), 14414 event = properties[type] || properties[cap] || function(){}; 14415 14416 delete properties[cap]; 14417 delete properties[type]; 14418 14419 image[type] = function(){ 14420 if (!image) return; 14421 if (!element.parentNode){ 14422 element.width = image.width; 14423 element.height = image.height; 14424 } 14425 image = image.onload = image.onabort = image.onerror = null; 14426 event.delay(1, element, element); 14427 element.fireEvent(name, element, 1); 14428 }; 14429 }); 14430 14431 image.src = element.src = source; 14432 if (image && image.complete) image.onload.delay(1); 14433 return element.set(properties); 14434 }, 14435 14436 images: function(sources, options){ 14437 sources = Array.from(sources); 14438 14439 var fn = function(){}, 14440 counter = 0; 14441 14442 options = Object.merge({ 14443 onComplete: fn, 14444 onProgress: fn, 14445 onError: fn, 14446 properties: {} 14447 }, options); 14448 14449 return new Elements(sources.map(function(source, index){ 14450 return Asset.image(source, Object.append(options.properties, { 14451 onload: function(){ 14452 counter++; 14453 options.onProgress.call(this, counter, index, source); 14454 if (counter == sources.length) options.onComplete(); 14455 }, 14456 onerror: function(){ 14457 counter++; 14458 options.onError.call(this, counter, index, source); 14459 if (counter == sources.length) options.onComplete(); 14460 } 14461 })); 14462 })); 14463 } 14464 14465}; 14466 14467 14468/* 14469--- 14470 14471script: Color.js 14472 14473name: Color 14474 14475description: Class for creating and manipulating colors in JavaScript. Supports HSB -> RGB Conversions and vice versa. 14476 14477license: MIT-style license 14478 14479authors: 14480 - Valerio Proietti 14481 14482requires: 14483 - Core/Array 14484 - Core/String 14485 - Core/Number 14486 - Core/Hash 14487 - Core/Function 14488 - MooTools.More 14489 14490provides: [Color] 14491 14492... 14493*/ 14494 14495(function(){ 14496 14497var Color = this.Color = new Type('Color', function(color, type){ 14498 if (arguments.length >= 3){ 14499 type = 'rgb'; color = Array.slice(arguments, 0, 3); 14500 } else if (typeof color == 'string'){ 14501 if (color.match(/rgb/)) color = color.rgbToHex().hexToRgb(true); 14502 else if (color.match(/hsb/)) color = color.hsbToRgb(); 14503 else color = color.hexToRgb(true); 14504 } 14505 type = type || 'rgb'; 14506 switch (type){ 14507 case 'hsb': 14508 var old = color; 14509 color = color.hsbToRgb(); 14510 color.hsb = old; 14511 break; 14512 case 'hex': color = color.hexToRgb(true); break; 14513 } 14514 color.rgb = color.slice(0, 3); 14515 color.hsb = color.hsb || color.rgbToHsb(); 14516 color.hex = color.rgbToHex(); 14517 return Object.append(color, this); 14518}); 14519 14520Color.implement({ 14521 14522 mix: function(){ 14523 var colors = Array.slice(arguments); 14524 var alpha = (typeOf(colors.getLast()) == 'number') ? colors.pop() : 50; 14525 var rgb = this.slice(); 14526 colors.each(function(color){ 14527 color = new Color(color); 14528 for (var i = 0; i < 3; i++) rgb[i] = Math.round((rgb[i] / 100 * (100 - alpha)) + (color[i] / 100 * alpha)); 14529 }); 14530 return new Color(rgb, 'rgb'); 14531 }, 14532 14533 invert: function(){ 14534 return new Color(this.map(function(value){ 14535 return 255 - value; 14536 })); 14537 }, 14538 14539 setHue: function(value){ 14540 return new Color([value, this.hsb[1], this.hsb[2]], 'hsb'); 14541 }, 14542 14543 setSaturation: function(percent){ 14544 return new Color([this.hsb[0], percent, this.hsb[2]], 'hsb'); 14545 }, 14546 14547 setBrightness: function(percent){ 14548 return new Color([this.hsb[0], this.hsb[1], percent], 'hsb'); 14549 } 14550 14551}); 14552 14553this.$RGB = function(r, g, b){ 14554 return new Color([r, g, b], 'rgb'); 14555}; 14556 14557this.$HSB = function(h, s, b){ 14558 return new Color([h, s, b], 'hsb'); 14559}; 14560 14561this.$HEX = function(hex){ 14562 return new Color(hex, 'hex'); 14563}; 14564 14565Array.implement({ 14566 14567 rgbToHsb: function(){ 14568 var red = this[0], 14569 green = this[1], 14570 blue = this[2], 14571 hue = 0; 14572 var max = Math.max(red, green, blue), 14573 min = Math.min(red, green, blue); 14574 var delta = max - min;
14575 var brightness = max / 255, 14576 saturation = (max != 0) ? delta / max : 0; 14577 if (saturation != 0){ 14578 var rr = (max - red) / delta; 14579 var gr = (max - green) / delta; 14580 var br = (max - blue) / delta; 14581 if (red == max) hue = br - gr; 14582 else if (green == max) hue = 2 + rr - br; 14583 else hue = 4 + gr - rr; 14584 hue /= 6; 14585 if (hue < 0) hue++; 14586 } 14587 return [Math.round(hue * 360), Math.round(saturation * 100), Math.round(brightness * 100)]; 14588 }, 14589 14590 hsbToRgb: function(){ 14591 var br = Math.round(this[2] / 100 * 255); 14592 if (this[1] == 0){ 14593 return [br, br, br]; 14594 } else { 14595 var hue = this[0] % 360; 14596 var f = hue % 60; 14597 var p = Math.round((this[2] * (100 - this[1])) / 10000 * 255); 14598 var q = Math.round((this[2] * (6000 - this[1] * f)) / 600000 * 255); 14599 var t = Math.round((this[2] * (6000 - this[1] * (60 - f))) / 600000 * 255); 14600 switch (Math.floor(hue / 60)){ 14601 case 0: return [br, t, p]; 14602 case 1: return [q, br, p]; 14603 case 2: return [p, br, t]; 14604 case 3: return [p, q, br]; 14605 case 4: return [t, p, br]; 14606 case 5: return [br, p, q]; 14607 } 14608 } 14609 return false; 14610 } 14611 14612}); 14613 14614String.implement({ 14615 14616 rgbToHsb: function(){ 14617 var rgb = this.match(/\d{1,3}/g); 14618 return (rgb) ? rgb.rgbToHsb() : null; 14619 }, 14620 14621 hsbToRgb: function(){ 14622 var hsb = this.match(/\d{1,3}/g); 14623 return (hsb) ? hsb.hsbToRgb() : null; 14624 } 14625 14626}); 14627 14628})(); 14629 14630 14631 14632/* 14633--- 14634 14635script: Group.js 14636 14637name: Group 14638 14639description: Class for monitoring collections of events 14640 14641license: MIT-style license 14642 14643authors: 14644 - Valerio Proietti 14645 14646requires: 14647 - Core/Events 14648 - /MooTools.More 14649 14650provides: [Group] 14651 14652... 14653*/ 14654 14655(function(){ 14656 14657this.Group = new Class({ 14658 14659 initialize: function(){ 14660 this.instances = Array.flatten(arguments); 14661 }, 14662 14663 addEvent: function(type, fn){ 14664 var instances = this.instances, 14665 len = instances.length, 14666 togo = len, 14667 args = new Array(len), 14668 self = this; 14669 14670 instances.each(function(instance, i){ 14671 instance.addEvent(type, function(){ 14672 if (!args[i]) togo--; 14673 args[i] = arguments; 14674 if (!togo){ 14675 fn.call(self, instances, instance, args); 14676 togo = len; 14677 args = new Array(len); 14678 } 14679 }); 14680 }); 14681 } 14682 14683}); 14684 14685})(); 14686 14687 14688/* 14689--- 14690 14691script: Hash.Cookie.js 14692 14693name: Hash.Cookie 14694 14695description: Class for creating, reading, and deleting Cookies in JSON format. 14696 14697license: MIT-style license 14698 14699authors: 14700 - Valerio Proietti 14701 - Aaron Newton 14702 14703requires: 14704 - Core/Cookie 14705 - Core/JSON 14706 - /MooTools.More 14707 - /Hash 14708 14709provides: [Hash.Cookie] 14710 14711... 14712*/ 14713 14714Hash.Cookie = new Class({ 14715 14716 Extends: Cookie, 14717 14718 options: { 14719 autoSave: true 14720 }, 14721 14722 initialize: function(name, options){ 14723 this.parent(name, options); 14724 this.load(); 14725 }, 14726 14727 save: function(){ 14728 var value = JSON.encode(this.hash); 14729 if (!value || value.length > 4096) return false; //cookie would be truncated! 14730 if (value == '{}') this.dispose(); 14731 else this.write(value); 14732 return true; 14733 }, 14734 14735 load: function(){ 14736 this.hash = new Hash(JSON.decode(this.read(), true)); 14737 return this; 14738 } 14739 14740}); 14741 14742Hash.each(Hash.prototype, function(method, name){ 14743 if (typeof method == 'function') Hash.Cookie.implement(name, function(){ 14744 var value = method.apply(this.hash, arguments); 14745 if (this.options.autoSave) this.save(); 14746 return value; 14747 }); 14748}); 14749 14750 14751/* 14752--- 14753name: Table 14754description: LUA-Style table implementation. 14755license: MIT-style license 14756authors: 14757 - Valerio Proietti 14758requires: [Core/Array] 14759provides: [Table] 14760... 14761*/ 14762 14763(function(){ 14764 14765var Table = this.Table = function(){ 14766 14767 this.length = 0; 14768 var keys = [], 14769 values = []; 14770 14771 this.set = function(key, value){ 14772 var index = keys.indexOf(key); 14773 if (index == -1){ 14774 var length = keys.length; 14775 keys[length] = key; 14776 values[length] = value; 14777 this.length++; 14778 } else { 14779 values[index] = value; 14780 } 14781 return this; 14782 }; 14783 14784 this.get = function(key){ 14785 var index = keys.indexOf(key); 14786 return (index == -1) ? null : values[index]; 14787 }; 14788 14789 this.erase = function(key){ 14790 var index = keys.indexOf(key); 14791 if (index != -1){ 14792 this.length--; 14793 keys.splice(index, 1); 14794 return values.splice(index, 1)[0]; 14795 } 14796 return null; 14797 }; 14798 14799 this.each = this.forEach = function(fn, bind){ 14800 for (var i = 0, l = this.length; i < l; i++) fn.call(bind, keys[i], values[i], this); 14801 }; 14802 14803}; 14804 14805if (this.Type) new Type('Table', Table); 14806 14807})(); 14808 14809 14810/* 14811--- 14812 14813script: HtmlTable.js 14814 14815name: HtmlTable 14816 14817description: Builds table elements with methods to add rows. 14818 14819license: MIT-style license 14820 14821authors: 14822 - Aaron Newton 14823 14824requires: 14825 - Core/Options 14826 - Core/Events 14827 - /Class.Occlude 14828 14829provides: [HtmlTable] 14830 14831... 14832*/ 14833 14834var HtmlTable = new Class({ 14835 14836 Implements: [Options, Events, Class.Occlude], 14837 14838 options: { 14839 properties: { 14840 cellpadding: 0, 14841 cellspacing: 0, 14842 border: 0 14843 }, 14844 rows: [], 14845 headers: [], 14846 footers: [] 14847 }, 14848 14849 property: 'HtmlTable', 14850 14851 initialize: function(){ 14852 var params = Array.link(arguments, {options: Type.isObject, table: Type.isElement, id: Type.isString}); 14853 this.setOptions(params.options); 14854 if (!params.table && params.id) params.table = document.id(params.id); 14855 this.element = params.table || new Element('table', this.options.properties); 14856 if (this.occlude()) return this.occluded; 14857 this.build(); 14858 }, 14859 14860 build: function(){ 14861 this.element.store('HtmlTable', this); 14862 14863 this.body = document.id(this.element.tBodies[0]) || new Element('tbody').inject(this.element); 14864 $$(this.body.rows); 14865 14866 if (this.options.headers.length) this.setHeaders(this.options.headers); 14867 else this.thead = document.id(this.element.tHead); 14868 14869 if (this.thead) this.head = this.getHead(); 14870 if (this.options.footers.length) this.setFooters(this.options.footers); 14871 14872 this.tfoot = document.id(this.element.tFoot); 14873 if (this.tfoot) this.foot = document.id(this.tfoot.rows[0]); 14874 14875 this.options.rows.each(function(row){ 14876 this.push(row); 14877 }, this); 14878 }, 14879 14880 toElement: function(){ 14881 return this.element; 14882 }, 14883 14884 empty: function(){ 14885 this.body.empty(); 14886 return this; 14887 }, 14888 14889 set: function(what, items){ 14890 var target = (what == 'headers') ? 'tHead' : 'tFoot', 14891 lower = target.toLowerCase(); 14892 14893 this[lower] = (document.id(this.element[target]) || new Element(lower).inject(this.element, 'top')).empty(); 14894 var data = this.push(items, {}, this[lower], what == 'headers' ? 'th' : 'td'); 14895 14896 if (what == 'headers') this.head = this.getHead(); 14897 else this.foot = this.getHead(); 14898 14899 return data; 14900 }, 14901 14902 getHead: function(){ 14903 var rows = this.thead.rows; 14904 return rows.length > 1 ? $$(rows) : rows.length ? document.id(rows[0]) : false;
14905 }, 14906 14907 setHeaders: function(headers){ 14908 this.set('headers', headers); 14909 return this; 14910 }, 14911 14912 setFooters: function(footers){ 14913 this.set('footers', footers); 14914 return this; 14915 }, 14916 14917 update: function(tr, row, tag){ 14918 var tds = tr.getChildren(tag || 'td'), last = tds.length - 1; 14919 14920 row.each(function(data, index){ 14921 var td = tds[index] || new Element(tag || 'td').inject(tr), 14922 content = (data ? data.content : '') || data, 14923 type = typeOf(content); 14924 14925 if (data && data.properties) td.set(data.properties); 14926 if (/(element(s?)|array|collection)/.test(type)) td.empty().adopt(content); 14927 else td.set('html', content); 14928 14929 if (index > last) tds.push(td); 14930 else tds[index] = td; 14931 }); 14932 14933 return { 14934 tr: tr, 14935 tds: tds 14936 }; 14937 }, 14938 14939 push: function(row, rowProperties, target, tag, where){ 14940 if (typeOf(row) == 'element' && row.get('tag') == 'tr'){ 14941 row.inject(target || this.body, where); 14942 return { 14943 tr: row, 14944 tds: row.getChildren('td') 14945 }; 14946 } 14947 return this.update(new Element('tr', rowProperties).inject(target || this.body, where), row, tag); 14948 }, 14949 14950 pushMany: function(rows, rowProperties, target, tag, where){ 14951 return rows.map(function(row){ 14952 return this.push(row, rowProperties, target, tag, where); 14953 }, this); 14954 } 14955 14956}); 14957 14958 14959['adopt', 'inject', 'wraps', 'grab', 'replaces', 'dispose'].each(function(method){ 14960 HtmlTable.implement(method, function(){ 14961 this.element[method].apply(this.element, arguments); 14962 return this; 14963 }); 14964}); 14965 14966 14967 14968 14969/* 14970--- 14971 14972script: HtmlTable.Zebra.js 14973 14974name: HtmlTable.Zebra 14975 14976description: Builds a stripy table with methods to add rows. 14977 14978license: MIT-style license 14979 14980authors: 14981 - Harald Kirschner 14982 - Aaron Newton 14983 14984requires: 14985 - /HtmlTable 14986 - /Element.Shortcuts 14987 - /Class.refactor 14988 14989provides: [HtmlTable.Zebra] 14990 14991... 14992*/ 14993 14994HtmlTable = Class.refactor(HtmlTable, { 14995 14996 options: { 14997 classZebra: 'table-tr-odd', 14998 zebra: true, 14999 zebraOnlyVisibleRows: true 15000 }, 15001 15002 initialize: function(){ 15003 this.previous.apply(this, arguments); 15004 if (this.occluded) return this.occluded; 15005 if (this.options.zebra) this.updateZebras(); 15006 }, 15007 15008 updateZebras: function(){ 15009 var index = 0; 15010 Array.each(this.body.rows, function(row){ 15011 if (!this.options.zebraOnlyVisibleRows || row.isDisplayed()){ 15012 this.zebra(row, index++); 15013 } 15014 }, this); 15015 }, 15016 15017 setRowStyle: function(row, i){ 15018 if (this.previous) this.previous(row, i); 15019 this.zebra(row, i); 15020 }, 15021 15022 zebra: function(row, i){ 15023 return row[((i % 2) ? 'remove' : 'add')+'Class'](this.options.classZebra); 15024 }, 15025 15026 push: function(){ 15027 var pushed = this.previous.apply(this, arguments); 15028 if (this.options.zebra) this.updateZebras(); 15029 return pushed; 15030 } 15031 15032}); 15033 15034 15035/* 15036--- 15037 15038script: HtmlTable.Sort.js 15039 15040name: HtmlTable.Sort 15041 15042description: Builds a stripy, sortable table with methods to add rows. 15043 15044license: MIT-style license 15045 15046authors: 15047 - Harald Kirschner 15048 - Aaron Newton 15049 - Jacob Thornton 15050 15051requires: 15052 - Core/Hash 15053 - /HtmlTable 15054 - /Class.refactor 15055 - /Element.Delegation 15056 - /String.Extras 15057 - /Date 15058 15059provides: [HtmlTable.Sort] 15060 15061... 15062*/ 15063 15064HtmlTable = Class.refactor(HtmlTable, { 15065 15066 options: {/* 15067 onSort: function(){}, */ 15068 sortIndex: 0, 15069 sortReverse: false, 15070 parsers: [], 15071 defaultParser: 'string', 15072 classSortable: 'table-sortable', 15073 classHeadSort: 'table-th-sort', 15074 classHeadSortRev: 'table-th-sort-rev', 15075 classNoSort: 'table-th-nosort', 15076 classGroupHead: 'table-tr-group-head', 15077 classGroup: 'table-tr-group', 15078 classCellSort: 'table-td-sort', 15079 classSortSpan: 'table-th-sort-span', 15080 sortable: false, 15081 thSelector: 'th' 15082 }, 15083 15084 initialize: function (){ 15085 this.previous.apply(this, arguments); 15086 if (this.occluded) return this.occluded; 15087 this.sorted = {index: null, dir: 1}; 15088 if (!this.bound) this.bound = {}; 15089 this.bound.headClick = this.headClick.bind(this); 15090 this.sortSpans = new Elements(); 15091 if (this.options.sortable){ 15092 this.enableSort(); 15093 if (this.options.sortIndex != null) this.sort(this.options.sortIndex, this.options.sortReverse); 15094 } 15095 }, 15096 15097 attachSorts: function(attach){ 15098 this.detachSorts(); 15099 if (attach !== false) this.element.addEvent('click:relay(' + this.options.thSelector + ')', this.bound.headClick); 15100 }, 15101 15102 detachSorts: function(){ 15103 this.element.removeEvents('click:relay(' + this.options.thSelector + ')'); 15104 }, 15105 15106 setHeaders: function(){ 15107 this.previous.apply(this, arguments); 15108 if (this.sortEnabled) this.setParsers(); 15109 }, 15110 15111 setParsers: function(){ 15112 this.parsers = this.detectParsers(); 15113 }, 15114 15115 detectParsers: function(){ 15116 return this.head && this.head.getElements(this.options.thSelector).flatten().map(this.detectParser, this); 15117 }, 15118 15119 detectParser: function(cell, index){ 15120 if (cell.hasClass(this.options.classNoSort) || cell.retrieve('htmltable-parser')) return cell.retrieve('htmltable-parser'); 15121 var thDiv = new Element('div'); 15122 thDiv.adopt(cell.childNodes).inject(cell); 15123 var sortSpan = new Element('span', {'class': this.options.classSortSpan}).inject(thDiv, 'top'); 15124 this.sortSpans.push(sortSpan); 15125 var parser = this.options.parsers[index], 15126 rows = this.body.rows, 15127 cancel; 15128 switch (typeOf(parser)){ 15129 case 'function': parser = {convert: parser}; cancel = true; break; 15130 case 'string': parser = parser; cancel = true; break; 15131 } 15132 if (!cancel){ 15133 HtmlTable.ParserPriority.some(function(parserName){ 15134 var current = HtmlTable.Parsers[parserName], 15135 match = current.match; 15136 if (!match) return false;
15137 for (var i = 0, j = rows.length; i < j; i++){ 15138 var cell = document.id(rows[i].cells[index]), 15139 text = cell ? cell.get('html').clean() : ''; 15140 if (text && match.test(text)){ 15141 parser = current; 15142 return true; 15143 } 15144 } 15145 }); 15146 } 15147 if (!parser) parser = this.options.defaultParser; 15148 cell.store('htmltable-parser', parser); 15149 return parser; 15150 }, 15151 15152 headClick: function(event, el){ 15153 if (!this.head || el.hasClass(this.options.classNoSort)) return; 15154 return this.sort(Array.indexOf(this.head.getElements(this.options.thSelector).flatten(), el) % this.body.rows[0].cells.length); 15155 }, 15156 15157 serialize: function(){ 15158 var previousSerialization = this.previous.apply(this, arguments) || {}; 15159 if (this.options.sortable){ 15160 previousSerialization.sortIndex = this.sorted.index; 15161 previousSerialization.sortReverse = this.sorted.reverse; 15162 } 15163 return previousSerialization; 15164 }, 15165 15166 restore: function(tableState){ 15167 if(this.options.sortable && tableState.sortIndex){ 15168 this.sort(tableState.sortIndex, tableState.sortReverse); 15169 } 15170 this.previous.apply(this, arguments); 15171 }, 15172 15173 setSortedState: function(index, reverse){ 15174 if (reverse != null) this.sorted.reverse = reverse; 15175 else if (this.sorted.index == index) this.sorted.reverse = !this.sorted.reverse; 15176 else this.sorted.reverse = this.sorted.index == null; 15177 15178 if (index != null) this.sorted.index = index; 15179 }, 15180 15181 setHeadSort: function(sorted){ 15182 var head = $$(!this.head.length ? this.head.cells[this.sorted.index] : this.head.map(function(row){ 15183 return row.getElements(this.options.thSelector)[this.sorted.index]; 15184 }, this).clean()); 15185 if (!head.length) return; 15186 if (sorted){ 15187 head.addClass(this.options.classHeadSort); 15188 if (this.sorted.reverse) head.addClass(this.options.classHeadSortRev); 15189 else head.removeClass(this.options.classHeadSortRev); 15190 } else { 15191 head.removeClass(this.options.classHeadSort).removeClass(this.options.classHeadSortRev); 15192 } 15193 }, 15194 15195 setRowSort: function(data, pre){ 15196 var count = data.length, 15197 body = this.body, 15198 group, 15199 rowIndex; 15200 15201 while (count){ 15202 var item = data[--count], 15203 position = item.position, 15204 row = body.rows[position]; 15205 15206 if (row.disabled) continue; 15207 if (!pre){ 15208 group = this.setGroupSort(group, row, item); 15209 this.setRowStyle(row, count); 15210 } 15211 body.appendChild(row); 15212 15213 for (rowIndex = 0; rowIndex < count; rowIndex++){ 15214 if (data[rowIndex].position > position) data[rowIndex].position--; 15215 } 15216 } 15217 }, 15218 15219 setRowStyle: function(row, i){ 15220 this.previous(row, i); 15221 row.cells[this.sorted.index].addClass(this.options.classCellSort); 15222 }, 15223 15224 setGroupSort: function(group, row, item){ 15225 if (group == item.value) row.removeClass(this.options.classGroupHead).addClass(this.options.classGroup); 15226 else row.removeClass(this.options.classGroup).addClass(this.options.classGroupHead); 15227 return item.value; 15228 }, 15229 15230 getParser: function(){ 15231 var parser = this.parsers[this.sorted.index]; 15232 return typeOf(parser) == 'string' ? HtmlTable.Parsers[parser] : parser; 15233 }, 15234 15235 sort: function(index, reverse, pre){ 15236 if (!this.head) return; 15237 15238 if (!pre){ 15239 this.clearSort(); 15240 this.setSortedState(index, reverse); 15241 this.setHeadSort(true); 15242 } 15243 15244 var parser = this.getParser(); 15245 if (!parser) return; 15246 15247 var rel; 15248 if (!Browser.ie){ 15249 rel = this.body.getParent(); 15250 this.body.dispose(); 15251 } 15252 15253 var data = this.parseData(parser).sort(function(a, b){ 15254 if (a.value === b.value) return 0; 15255 return a.value > b.value ? 1 : -1; 15256 }); 15257 15258 if (this.sorted.reverse == (parser == HtmlTable.Parsers['input-checked'])) data.reverse(true); 15259 this.setRowSort(data, pre); 15260 15261 if (rel) rel.grab(this.body); 15262 this.fireEvent('stateChanged'); 15263 return this.fireEvent('sort', [this.body, this.sorted.index]); 15264 }, 15265 15266 parseData: function(parser){ 15267 return Array.map(this.body.rows, function(row, i){ 15268 var value = parser.convert.call(document.id(row.cells[this.sorted.index])); 15269 return { 15270 position: i, 15271 value: value 15272 }; 15273 }, this); 15274 }, 15275 15276 clearSort: function(){ 15277 this.setHeadSort(false); 15278 this.body.getElements('td').removeClass(this.options.classCellSort); 15279 }, 15280 15281 reSort: function(){ 15282 if (this.sortEnabled) this.sort.call(this, this.sorted.index, this.sorted.reverse); 15283 return this; 15284 }, 15285 15286 enableSort: function(){ 15287 this.element.addClass(this.options.classSortable); 15288 this.attachSorts(true); 15289 this.setParsers(); 15290 this.sortEnabled = true; 15291 return this; 15292 }, 15293 15294 disableSort: function(){ 15295 this.element.removeClass(this.options.classSortable); 15296 this.attachSorts(false); 15297 this.sortSpans.each(function(span){ 15298 span.destroy(); 15299 }); 15300 this.sortSpans.empty(); 15301 this.sortEnabled = false;
15302 return this; 15303 } 15304 15305}); 15306 15307HtmlTable.ParserPriority = ['date', 'input-checked', 'input-value', 'float', 'number']; 15308 15309HtmlTable.Parsers = { 15310 15311 'date': { 15312 match: /^\d{2}[-\/ ]\d{2}[-\/ ]\d{2,4}$/, 15313 convert: function(){ 15314 var d = Date.parse(this.get('text').stripTags()); 15315 return (typeOf(d) == 'date') ? d.format('db') : ''; 15316 }, 15317 type: 'date' 15318 }, 15319 'input-checked': { 15320 match: / type="(radio|checkbox)" /, 15321 convert: function(){ 15322 return this.getElement('input').checked; 15323 } 15324 }, 15325 'input-value': { 15326 match: /<input/, 15327 convert: function(){ 15328 return this.getElement('input').value; 15329 } 15330 }, 15331 'number': { 15332 match: /^\d+[^\d.,]*$/, 15333 convert: function(){ 15334 return this.get('text').stripTags().toInt(); 15335 }, 15336 number: true 15337 }, 15338 'numberLax': { 15339 match: /^[^\d]+\d+$/, 15340 convert: function(){ 15341 return this.get('text').replace(/[^-?^0-9]/, '').stripTags().toInt(); 15342 }, 15343 number: true 15344 }, 15345 'float': { 15346 match: /^[\d]+\.[\d]+/, 15347 convert: function(){ 15348 return this.get('text').replace(/[^-?^\d.]/, '').stripTags().toFloat(); 15349 }, 15350 number: true 15351 }, 15352 'floatLax': { 15353 match: /^[^\d]+[\d]+\.[\d]+$/, 15354 convert: function(){ 15355 return this.get('text').replace(/[^-?^\d.]/, '').stripTags(); 15356 }, 15357 number: true 15358 }, 15359 'string': { 15360 match: null, 15361 convert: function(){ 15362 return this.get('text').stripTags().toLowerCase(); 15363 } 15364 }, 15365 'title': { 15366 match: null, 15367 convert: function(){ 15368 return this.title; 15369 } 15370 } 15371 15372}; 15373 15374//<1.2compat> 15375HtmlTable.Parsers = new Hash(HtmlTable.Parsers); 15376//</1.2compat> 15377 15378HtmlTable.defineParsers = function(parsers){ 15379 HtmlTable.Parsers = Object.append(HtmlTable.Parsers, parsers); 15380 for (var parser in parsers){ 15381 HtmlTable.ParserPriority.unshift(parser); 15382 } 15383}; 15384 15385 15386/* 15387--- 15388 15389script: Keyboard.js 15390 15391name: Keyboard 15392 15393description: KeyboardEvents used to intercept events on a class for keyboard and format modifiers in a specific order so as to make alt+shift+c the same as shift+alt+c. 15394 15395license: MIT-style license 15396 15397authors: 15398 - Perrin Westrich 15399 - Aaron Newton 15400 - Scott Kyle 15401 15402requires: 15403 - Core/Events 15404 - Core/Options 15405 - Core/Element.Event 15406 - Element.Event.Pseudos.Keys 15407 15408provides: [Keyboard] 15409 15410... 15411*/ 15412 15413(function(){ 15414 15415 var Keyboard = this.Keyboard = new Class({ 15416 15417 Extends: Events, 15418 15419 Implements: [Options], 15420 15421 options: {/* 15422 onActivate: function(){}, 15423 onDeactivate: function(){},*/ 15424 defaultEventType: 'keydown', 15425 active: false, 15426 manager: null, 15427 events: {}, 15428 nonParsedEvents: ['activate', 'deactivate', 'onactivate', 'ondeactivate', 'changed', 'onchanged'] 15429 }, 15430 15431 initialize: function(options){ 15432 if (options && options.manager){ 15433 this._manager = options.manager; 15434 delete options.manager; 15435 } 15436 this.setOptions(options); 15437 this._setup(); 15438 }, 15439 15440 addEvent: function(type, fn, internal){ 15441 return this.parent(Keyboard.parse(type, this.options.defaultEventType, this.options.nonParsedEvents), fn, internal); 15442 }, 15443 15444 removeEvent: function(type, fn){ 15445 return this.parent(Keyboard.parse(type, this.options.defaultEventType, this.options.nonParsedEvents), fn); 15446 }, 15447 15448 toggleActive: function(){ 15449 return this[this.isActive() ? 'deactivate' : 'activate'](); 15450 }, 15451 15452 activate: function(instance){ 15453 if (instance){ 15454 if (instance.isActive()) return this; 15455 //if we're stealing focus, store the last keyboard to have it so the relinquish command works 15456 if (this._activeKB && instance != this._activeKB){ 15457 this.previous = this._activeKB; 15458 this.previous.fireEvent('deactivate'); 15459 } 15460 //if we're enabling a child, assign it so that events are now passed to it 15461 this._activeKB = instance.fireEvent('activate'); 15462 Keyboard.manager.fireEvent('changed'); 15463 } else if (this._manager){ 15464 //else we're enabling ourselves, we must ask our parent to do it for us 15465 this._manager.activate(this); 15466 } 15467 return this; 15468 }, 15469 15470 isActive: function(){ 15471 return this._manager ? (this._manager._activeKB == this) : (Keyboard.manager == this); 15472 }, 15473 15474 deactivate: function(instance){ 15475 if (instance){ 15476 if (instance === this._activeKB){ 15477 this._activeKB = null; 15478 instance.fireEvent('deactivate'); 15479 Keyboard.manager.fireEvent('changed'); 15480 } 15481 } else if (this._manager){ 15482 this._manager.deactivate(this); 15483 } 15484 return this; 15485 }, 15486 15487 relinquish: function(){ 15488 if (this.isActive() && this._manager && this._manager.previous) this._manager.activate(this._manager.previous); 15489 else this.deactivate(); 15490 return this; 15491 }, 15492 15493 //management logic 15494 manage: function(instance){ 15495 if (instance._manager) instance._manager.drop(instance); 15496 this._instances.push(instance); 15497 instance._manager = this; 15498 if (!this._activeKB) this.activate(instance); 15499 return this; 15500 }, 15501 15502 drop: function(instance){ 15503 instance.relinquish(); 15504 this._instances.erase(instance); 15505 if (this._activeKB == instance){ 15506 if (this.previous && this._instances.contains(this.previous)) this.activate(this.previous); 15507 else this._activeKB = this._instances[0]; 15508 } 15509 return this; 15510 }, 15511 15512 trace: function(){ 15513 Keyboard.trace(this); 15514 }, 15515 15516 each: function(fn){ 15517 Keyboard.each(this, fn); 15518 }, 15519 15520 /* 15521 PRIVATE METHODS 15522 */ 15523 15524 _instances: [], 15525 15526 _disable: function(instance){ 15527 if (this._activeKB == instance) this._activeKB = null; 15528 }, 15529 15530 _setup: function(){ 15531 this.addEvents(this.options.events); 15532 //if this is the root manager, nothing manages it 15533 if (Keyboard.manager && !this._manager) Keyboard.manager.manage(this); 15534 if (this.options.active) this.activate(); 15535 else this.relinquish(); 15536 }, 15537 15538 _handle: function(event, type){ 15539 //Keyboard.stop(event) prevents key propagation 15540 if (event.preventKeyboardPropagation) return; 15541 15542 var bubbles = !!this._manager; 15543 if (bubbles && this._activeKB){ 15544 this._activeKB._handle(event, type); 15545 if (event.preventKeyboardPropagation) return; 15546 } 15547 this.fireEvent(type, event); 15548 15549 if (!bubbles && this._activeKB) this._activeKB._handle(event, type); 15550 } 15551 15552 }); 15553 15554 var parsed = {}; 15555 var modifiers = ['shift', 'control', 'alt', 'meta']; 15556 var regex = /^(?:shift|control|ctrl|alt|meta)$/; 15557 15558 Keyboard.parse = function(type, eventType, ignore){ 15559 if (ignore && ignore.contains(type.toLowerCase())) return type; 15560 15561 type = type.toLowerCase().replace(/^(keyup|keydown):/, function($0, $1){ 15562 eventType = $1; 15563 return ''; 15564 }); 15565 15566 if (!parsed[type]){ 15567 var key, mods = {}; 15568 type.split('+').each(function(part){ 15569 if (regex.test(part)) mods[part] = true; 15570 else key = part;
15571 }); 15572 15573 mods.control = mods.control || mods.ctrl; // allow both control and ctrl 15574 15575 var keys = []; 15576 modifiers.each(function(mod){ 15577 if (mods[mod]) keys.push(mod); 15578 }); 15579 15580 if (key) keys.push(key); 15581 parsed[type] = keys.join('+'); 15582 } 15583 15584 return eventType + ':keys(' + parsed[type] + ')'; 15585 }; 15586 15587 Keyboard.each = function(keyboard, fn){ 15588 var current = keyboard || Keyboard.manager; 15589 while (current){ 15590 fn.run(current); 15591 current = current._activeKB; 15592 } 15593 }; 15594 15595 Keyboard.stop = function(event){ 15596 event.preventKeyboardPropagation = true; 15597 }; 15598 15599 Keyboard.manager = new Keyboard({ 15600 active: true 15601 }); 15602 15603 Keyboard.trace = function(keyboard){ 15604 keyboard = keyboard || Keyboard.manager; 15605 var hasConsole = window.console && console.log; 15606 if (hasConsole) console.log('the following items have focus: '); 15607 Keyboard.each(keyboard, function(current){ 15608 if (hasConsole) console.log(document.id(current.widget) || current.wiget || current); 15609 }); 15610 }; 15611 15612 var handler = function(event){ 15613 var keys = []; 15614 modifiers.each(function(mod){ 15615 if (event[mod]) keys.push(mod); 15616 }); 15617 15618 if (!regex.test(event.key)) keys.push(event.key); 15619 Keyboard.manager._handle(event, event.type + ':keys(' + keys.join('+') + ')'); 15620 }; 15621 15622 document.addEvents({ 15623 'keyup': handler, 15624 'keydown': handler 15625 }); 15626 15627})(); 15628 15629 15630/* 15631--- 15632 15633script: Keyboard.Extras.js 15634 15635name: Keyboard.Extras 15636 15637description: Enhances Keyboard by adding the ability to name and describe keyboard shortcuts, and the ability to grab shortcuts by name and bind the shortcut to different keys. 15638 15639license: MIT-style license 15640 15641authors: 15642 - Perrin Westrich 15643 15644requires: 15645 - /Keyboard 15646 - /MooTools.More 15647 15648provides: [Keyboard.Extras] 15649 15650... 15651*/ 15652Keyboard.prototype.options.nonParsedEvents.combine(['rebound', 'onrebound']); 15653 15654Keyboard.implement({ 15655 15656 /* 15657 shortcut should be in the format of: 15658 { 15659 'keys': 'shift+s', // the default to add as an event. 15660 'description': 'blah blah blah', // a brief description of the functionality. 15661 'handler': function(){} // the event handler to run when keys are pressed. 15662 } 15663 */ 15664 addShortcut: function(name, shortcut){ 15665 this._shortcuts = this._shortcuts || []; 15666 this._shortcutIndex = this._shortcutIndex || {}; 15667 15668 shortcut.getKeyboard = Function.from(this); 15669 shortcut.name = name; 15670 this._shortcutIndex[name] = shortcut; 15671 this._shortcuts.push(shortcut); 15672 if (shortcut.keys) this.addEvent(shortcut.keys, shortcut.handler); 15673 return this; 15674 }, 15675 15676 addShortcuts: function(obj){ 15677 for (var name in obj) this.addShortcut(name, obj[name]); 15678 return this; 15679 }, 15680 15681 removeShortcut: function(name){ 15682 var shortcut = this.getShortcut(name); 15683 if (shortcut && shortcut.keys){ 15684 this.removeEvent(shortcut.keys, shortcut.handler); 15685 delete this._shortcutIndex[name]; 15686 this._shortcuts.erase(shortcut); 15687 } 15688 return this; 15689 }, 15690 15691 removeShortcuts: function(names){ 15692 names.each(this.removeShortcut, this); 15693 return this; 15694 }, 15695 15696 getShortcuts: function(){ 15697 return this._shortcuts || []; 15698 }, 15699 15700 getShortcut: function(name){ 15701 return (this._shortcutIndex || {})[name]; 15702 } 15703 15704}); 15705 15706Keyboard.rebind = function(newKeys, shortcuts){ 15707 Array.from(shortcuts).each(function(shortcut){ 15708 shortcut.getKeyboard().removeEvent(shortcut.keys, shortcut.handler); 15709 shortcut.getKeyboard().addEvent(newKeys, shortcut.handler); 15710 shortcut.keys = newKeys; 15711 shortcut.getKeyboard().fireEvent('rebound'); 15712 }); 15713}; 15714 15715 15716Keyboard.getActiveShortcuts = function(keyboard){ 15717 var activeKBS = [], activeSCS = []; 15718 Keyboard.each(keyboard, [].push.bind(activeKBS)); 15719 activeKBS.each(function(kb){ activeSCS.extend(kb.getShortcuts()); }); 15720 return activeSCS; 15721}; 15722 15723Keyboard.getShortcut = function(name, keyboard, opts){ 15724 opts = opts || {}; 15725 var shortcuts = opts.many ? [] : null, 15726 set = opts.many ? function(kb){ 15727 var shortcut = kb.getShortcut(name); 15728 if (shortcut) shortcuts.push(shortcut); 15729 } : function(kb){ 15730 if (!shortcuts) shortcuts = kb.getShortcut(name); 15731 }; 15732 Keyboard.each(keyboard, set); 15733 return shortcuts; 15734}; 15735 15736Keyboard.getShortcuts = function(name, keyboard){ 15737 return Keyboard.getShortcut(name, keyboard, { many: true }); 15738}; 15739 15740 15741/* 15742--- 15743 15744script: HtmlTable.Select.js 15745 15746name: HtmlTable.Select 15747 15748description: Builds a stripy, sortable table with methods to add rows. Rows can be selected with the mouse or keyboard navigation. 15749 15750license: MIT-style license 15751 15752authors: 15753 - Harald Kirschner 15754 - Aaron Newton 15755 15756requires: 15757 - /Keyboard 15758 - /Keyboard.Extras 15759 - /HtmlTable 15760 - /Class.refactor 15761 - /Element.Delegation 15762 - /Element.Shortcuts 15763 15764provides: [HtmlTable.Select] 15765 15766... 15767*/ 15768 15769HtmlTable = Class.refactor(HtmlTable, { 15770 15771 options: { 15772 /*onRowFocus: function(){}, 15773 onRowUnfocus: function(){},*/ 15774 useKeyboard: true, 15775 classRowSelected: 'table-tr-selected', 15776 classRowHovered: 'table-tr-hovered',
15777 classSelectable: 'table-selectable', 15778 shiftForMultiSelect: true, 15779 allowMultiSelect: true, 15780 selectable: false, 15781 selectHiddenRows: false 15782 }, 15783 15784 initialize: function(){ 15785 this.previous.apply(this, arguments); 15786 if (this.occluded) return this.occluded; 15787 15788 this.selectedRows = new Elements(); 15789 15790 if (!this.bound) this.bound = {}; 15791 this.bound.mouseleave = this.mouseleave.bind(this); 15792 this.bound.clickRow = this.clickRow.bind(this); 15793 this.bound.activateKeyboard = function(){ 15794 if (this.keyboard && this.selectEnabled) this.keyboard.activate(); 15795 }.bind(this); 15796 15797 if (this.options.selectable) this.enableSelect(); 15798 }, 15799 15800 empty: function(){ 15801 this.selectNone(); 15802 return this.previous(); 15803 }, 15804 15805 enableSelect: function(){ 15806 this.selectEnabled = true; 15807 this.attachSelects(); 15808 this.element.addClass(this.options.classSelectable); 15809 return this; 15810 }, 15811 15812 disableSelect: function(){ 15813 this.selectEnabled = false; 15814 this.attachSelects(false); 15815 this.element.removeClass(this.options.classSelectable); 15816 return this; 15817 }, 15818 15819 push: function(){ 15820 var ret = this.previous.apply(this, arguments); 15821 this.updateSelects(); 15822 return ret; 15823 }, 15824 15825 toggleRow: function(row){ 15826 return this[(this.isSelected(row) ? 'de' : '') + 'selectRow'](row); 15827 }, 15828 15829 selectRow: function(row, _nocheck){ 15830 //private variable _nocheck: boolean whether or not to confirm the row is in the table body 15831 //added here for optimization when selecting ranges 15832 if (this.isSelected(row) || (!_nocheck && !this.body.getChildren().contains(row))) return; 15833 if (!this.options.allowMultiSelect) this.selectNone(); 15834 15835 if (!this.isSelected(row)){ 15836 this.selectedRows.push(row); 15837 row.addClass(this.options.classRowSelected); 15838 this.fireEvent('rowFocus', [row, this.selectedRows]); 15839 this.fireEvent('stateChanged'); 15840 } 15841 15842 this.focused = row; 15843 document.clearSelection(); 15844 15845 return this; 15846 }, 15847 15848 isSelected: function(row){ 15849 return this.selectedRows.contains(row); 15850 }, 15851 15852 getSelected: function(){ 15853 return this.selectedRows; 15854 }, 15855 15856 getSelected: function(){ 15857 return this.selectedRows; 15858 }, 15859 15860 serialize: function(){ 15861 var previousSerialization = this.previous.apply(this, arguments) || {}; 15862 if (this.options.selectable){ 15863 previousSerialization.selectedRows = this.selectedRows.map(function(row){ 15864 return Array.indexOf(this.body.rows, row); 15865 }.bind(this)); 15866 } 15867 return previousSerialization; 15868 }, 15869 15870 restore: function(tableState){ 15871 if(this.options.selectable && tableState.selectedRows){ 15872 tableState.selectedRows.each(function(index){ 15873 this.selectRow(this.body.rows[index]); 15874 }.bind(this)); 15875 } 15876 this.previous.apply(this, arguments); 15877 }, 15878 15879 deselectRow: function(row, _nocheck){ 15880 if (!this.isSelected(row) || (!_nocheck && !this.body.getChildren().contains(row))) return; 15881 15882 this.selectedRows = new Elements(Array.from(this.selectedRows).erase(row)); 15883 row.removeClass(this.options.classRowSelected); 15884 this.fireEvent('rowUnfocus', [row, this.selectedRows]); 15885 this.fireEvent('stateChanged'); 15886 return this; 15887 }, 15888 15889 selectAll: function(selectNone){ 15890 if (!selectNone && !this.options.allowMultiSelect) return; 15891 this.selectRange(0, this.body.rows.length, selectNone); 15892 return this; 15893 }, 15894 15895 selectNone: function(){ 15896 return this.selectAll(true); 15897 }, 15898 15899 selectRange: function(startRow, endRow, _deselect){ 15900 if (!this.options.allowMultiSelect && !_deselect) return; 15901 var method = _deselect ? 'deselectRow' : 'selectRow', 15902 rows = Array.clone(this.body.rows); 15903 15904 if (typeOf(startRow) == 'element') startRow = rows.indexOf(startRow); 15905 if (typeOf(endRow) == 'element') endRow = rows.indexOf(endRow); 15906 endRow = endRow < rows.length - 1 ? endRow : rows.length - 1; 15907 15908 if (endRow < startRow){ 15909 var tmp = startRow; 15910 startRow = endRow; 15911 endRow = tmp; 15912 } 15913 15914 for (var i = startRow; i <= endRow; i++){ 15915 if (this.options.selectHiddenRows || rows[i].isDisplayed()) this[method](rows[i], true); 15916 } 15917 15918 return this; 15919 }, 15920 15921 deselectRange: function(startRow, endRow){ 15922 this.selectRange(startRow, endRow, true); 15923 }, 15924 15925 getSelected: function(){ 15926 return this.selectedRows; 15927 }, 15928 15929/* 15930 Private methods: 15931*/ 15932 15933 enterRow: function(row){ 15934 if (this.hovered) this.hovered = this.leaveRow(this.hovered); 15935 this.hovered = row.addClass(this.options.classRowHovered); 15936 }, 15937 15938 leaveRow: function(row){ 15939 row.removeClass(this.options.classRowHovered); 15940 }, 15941 15942 updateSelects: function(){ 15943 Array.each(this.body.rows, function(row){ 15944 var binders = row.retrieve('binders'); 15945 if (!binders && !this.selectEnabled) return; 15946 if (!binders){ 15947 binders = { 15948 mouseenter: this.enterRow.pass([row], this), 15949 mouseleave: this.leaveRow.pass([row], this) 15950 }; 15951 row.store('binders', binders); 15952 } 15953 if (this.selectEnabled) row.addEvents(binders); 15954 else row.removeEvents(binders); 15955 }, this); 15956 }, 15957 15958 shiftFocus: function(offset, event){ 15959 if (!this.focused) return this.selectRow(this.body.rows[0], event); 15960 var to = this.getRowByOffset(offset, this.options.selectHiddenRows); 15961 if (to === null || this.focused == this.body.rows[to]) return this; 15962 this.toggleRow(this.body.rows[to], event); 15963 }, 15964 15965 clickRow: function(event, row){ 15966 var selecting = (event.shift || event.meta || event.control) && this.options.shiftForMultiSelect; 15967 if (!selecting && !(event.rightClick && this.isSelected(row) && this.options.allowMultiSelect)) this.selectNone(); 15968 15969 if (event.rightClick) this.selectRow(row); 15970 else this.toggleRow(row); 15971 15972 if (event.shift){ 15973 this.selectRange(this.rangeStart || this.body.rows[0], row, this.rangeStart ? !this.isSelected(row) : true); 15974 this.focused = row; 15975 } 15976 this.rangeStart = row; 15977 }, 15978 15979 getRowByOffset: function(offset, includeHiddenRows){ 15980 if (!this.focused) return 0; 15981 var index = Array.indexOf(this.body.rows, this.focused); 15982 if ((index == 0 && offset < 0) || (index == this.body.rows.length -1 && offset > 0)) return null; 15983 if (includeHiddenRows){ 15984 index += offset; 15985 } else { 15986 var limit = 0, 15987 count = 0; 15988 if (offset > 0){ 15989 while (count < offset && index < this.body.rows.length -1){ 15990 if (this.body.rows[++index].isDisplayed()) count++; 15991 } 15992 } else { 15993 while (count > offset && index > 0){ 15994 if (this.body.rows[--index].isDisplayed()) count--; 15995 } 15996 } 15997 } 15998 return index; 15999 }, 16000 16001 attachSelects: function(attach){ 16002 attach = attach != null ? attach : true; 16003 16004 var method = attach ? 'addEvents' : 'removeEvents'; 16005 this.element[method]({ 16006 mouseleave: this.bound.mouseleave, 16007 click: this.bound.activateKeyboard 16008 }); 16009 16010 this.body[method]({ 16011 'click:relay(tr)': this.bound.clickRow, 16012 'contextmenu:relay(tr)': this.bound.clickRow 16013 }); 16014 16015 if (this.options.useKeyboard || this.keyboard){ 16016 if (!this.keyboard) this.keyboard = new Keyboard(); 16017 if (!this.selectKeysDefined){ 16018 this.selectKeysDefined = true; 16019 var timer, held; 16020 16021 var move = function(offset){ 16022 var mover = function(e){ 16023 clearTimeout(timer); 16024 e.preventDefault(); 16025 var to = this.body.rows[this.getRowByOffset(offset, this.options.selectHiddenRows)]; 16026 if (e.shift && to && this.isSelected(to)){ 16027 this.deselectRow(this.focused); 16028 this.focused = to; 16029 } else { 16030 if (to && (!this.options.allowMultiSelect || !e.shift)){ 16031 this.selectNone(); 16032 } 16033 this.shiftFocus(offset, e); 16034 } 16035 16036 if (held){ 16037 timer = mover.delay(100, this, e); 16038 } else { 16039 timer = (function(){ 16040 held = true; 16041 mover(e); 16042 }).delay(400); 16043 } 16044 }.bind(this); 16045 return mover; 16046 }.bind(this); 16047 16048 var clear = function(){ 16049 clearTimeout(timer); 16050 held = false;
16051 }; 16052 16053 this.keyboard.addEvents({ 16054 'keydown:shift+up': move(-1), 16055 'keydown:shift+down': move(1), 16056 'keyup:shift+up': clear, 16057 'keyup:shift+down': clear, 16058 'keyup:up': clear, 16059 'keyup:down': clear 16060 }); 16061 16062 var shiftHint = ''; 16063 if (this.options.allowMultiSelect && this.options.shiftForMultiSelect && this.options.useKeyboard){ 16064 shiftHint = " (Shift multi-selects)."; 16065 } 16066 16067 this.keyboard.addShortcuts({ 16068 'Select Previous Row': { 16069 keys: 'up', 16070 shortcut: 'up arrow', 16071 handler: move(-1), 16072 description: 'Select the previous row in the table.' + shiftHint 16073 }, 16074 'Select Next Row': { 16075 keys: 'down', 16076 shortcut: 'down arrow', 16077 handler: move(1), 16078 description: 'Select the next row in the table.' + shiftHint 16079 } 16080 }); 16081 16082 } 16083 this.keyboard[attach ? 'activate' : 'deactivate'](); 16084 } 16085 this.updateSelects(); 16086 }, 16087 16088 mouseleave: function(){ 16089 if (this.hovered) this.leaveRow(this.hovered); 16090 } 16091 16092}); 16093 16094 16095/* 16096--- 16097 16098script: Scroller.js 16099 16100name: Scroller 16101 16102description: Class which scrolls the contents of any Element (including the window) when the mouse reaches the Element's boundaries. 16103 16104license: MIT-style license 16105 16106authors: 16107 - Valerio Proietti 16108 16109requires: 16110 - Core/Events 16111 - Core/Options 16112 - Core/Element.Event 16113 - Core/Element.Dimensions 16114 - MooTools.More 16115 16116provides: [Scroller] 16117 16118... 16119*/ 16120 16121var Scroller = new Class({ 16122 16123 Implements: [Events, Options], 16124 16125 options: { 16126 area: 20, 16127 velocity: 1, 16128 onChange: function(x, y){ 16129 this.element.scrollTo(x, y); 16130 }, 16131 fps: 50 16132 }, 16133 16134 initialize: function(element, options){ 16135 this.setOptions(options); 16136 this.element = document.id(element); 16137 this.docBody = document.id(this.element.getDocument().body); 16138 this.listener = (typeOf(this.element) != 'element') ? this.docBody : this.element; 16139 this.timer = null; 16140 this.bound = { 16141 attach: this.attach.bind(this), 16142 detach: this.detach.bind(this), 16143 getCoords: this.getCoords.bind(this) 16144 }; 16145 }, 16146 16147 start: function(){ 16148 this.listener.addEvents({ 16149 mouseover: this.bound.attach, 16150 mouseleave: this.bound.detach 16151 }); 16152 return this; 16153 }, 16154 16155 stop: function(){ 16156 this.listener.removeEvents({ 16157 mouseover: this.bound.attach, 16158 mouseleave: this.bound.detach 16159 }); 16160 this.detach(); 16161 this.timer = clearInterval(this.timer); 16162 return this; 16163 }, 16164 16165 attach: function(){ 16166 this.listener.addEvent('mousemove', this.bound.getCoords); 16167 }, 16168 16169 detach: function(){ 16170 this.listener.removeEvent('mousemove', this.bound.getCoords); 16171 this.timer = clearInterval(this.timer); 16172 }, 16173 16174 getCoords: function(event){ 16175 this.page = (this.listener.get('tag') == 'body') ? event.client : event.page; 16176 if (!this.timer) this.timer = this.scroll.periodical(Math.round(1000 / this.options.fps), this); 16177 }, 16178 16179 scroll: function(){ 16180 var size = this.element.getSize(), 16181 scroll = this.element.getScroll(), 16182 pos = this.element != this.docBody ? this.element.getOffsets() : {x: 0, y:0}, 16183 scrollSize = this.element.getScrollSize(), 16184 change = {x: 0, y: 0}, 16185 top = this.options.area.top || this.options.area, 16186 bottom = this.options.area.bottom || this.options.area; 16187 for (var z in this.page){ 16188 if (this.page[z] < (top + pos[z]) && scroll[z] != 0){ 16189 change[z] = (this.page[z] - top - pos[z]) * this.options.velocity; 16190 } else if (this.page[z] + bottom > (size[z] + pos[z]) && scroll[z] + size[z] != scrollSize[z]){ 16191 change[z] = (this.page[z] - size[z] + bottom - pos[z]) * this.options.velocity; 16192 } 16193 change[z] = change[z].round(); 16194 } 16195 if (change.y || change.x) this.fireEvent('change', [scroll.x + change.x, scroll.y + change.y]); 16196 } 16197 16198}); 16199 16200 16201/* 16202--- 16203 16204script: Tips.js 16205 16206name: Tips 16207 16208description: Class for creating nice tips that follow the mouse cursor when hovering an element. 16209 16210license: MIT-style license 16211 16212authors: 16213 - Valerio Proietti 16214 - Christoph Pojer 16215 - Luis Merino 16216 16217requires: 16218 - Core/Options 16219 - Core/Events 16220 - Core/Element.Event 16221 - Core/Element.Style 16222 - Core/Element.Dimensions 16223 - /MooTools.More 16224 16225provides: [Tips] 16226 16227... 16228*/ 16229 16230(function(){ 16231 16232var read = function(option, element){ 16233 return (option) ? (typeOf(option) == 'function' ? option(element) : element.get(option)) : ''; 16234}; 16235 16236this.Tips = new Class({ 16237 16238 Implements: [Events, Options], 16239 16240 options: {/* 16241 id: null, 16242 onAttach: function(element){}, 16243 onDetach: function(element){}, 16244 onBound: function(coords){},*/ 16245 onShow: function(){ 16246 this.tip.setStyle('display', 'block'); 16247 }, 16248 onHide: function(){ 16249 this.tip.setStyle('display', 'none'); 16250 }, 16251 title: 'title', 16252 text: function(element){ 16253 return element.get('rel') || element.get('href'); 16254 }, 16255 showDelay: 100, 16256 hideDelay: 100, 16257 className: 'tip-wrap', 16258 offset: {x: 16, y: 16}, 16259 windowPadding: {x:0, y:0}, 16260 fixed: false, 16261 waiAria: true 16262 }, 16263 16264 initialize: function(){ 16265 var params = Array.link(arguments, { 16266 options: Type.isObject, 16267 elements: function(obj){ 16268 return obj != null; 16269 } 16270 }); 16271 this.setOptions(params.options); 16272 if (params.elements) this.attach(params.elements); 16273 this.container = new Element('div', {'class': 'tip'}); 16274 16275 if (this.options.id){ 16276 this.container.set('id', this.options.id); 16277 if (this.options.waiAria) this.attachWaiAria(); 16278 } 16279 }, 16280 16281 toElement: function(){ 16282 if (this.tip) return this.tip; 16283 16284 this.tip = new Element('div', { 16285 'class': this.options.className, 16286 styles: { 16287 position: 'absolute', 16288 top: 0, 16289 left: 0 16290 } 16291 }).adopt( 16292 new Element('div', {'class': 'tip-top'}), 16293 this.container, 16294 new Element('div', {'class': 'tip-bottom'}) 16295 ); 16296 16297 return this.tip; 16298 }, 16299 16300 attachWaiAria: function(){ 16301 var id = this.options.id; 16302 this.container.set('role', 'tooltip'); 16303 16304 if (!this.waiAria){ 16305 this.waiAria = { 16306 show: function(element){ 16307 if (id) element.set('aria-describedby', id); 16308 this.container.set('aria-hidden', 'false'); 16309 }, 16310 hide: function(element){ 16311 if (id) element.erase('aria-describedby'); 16312 this.container.set('aria-hidden', 'true'); 16313 } 16314 }; 16315 } 16316 this.addEvents(this.waiAria); 16317 }, 16318 16319 detachWaiAria: function(){ 16320 if (this.waiAria){ 16321 this.container.erase('role'); 16322 this.container.erase('aria-hidden'); 16323 this.removeEvents(this.waiAria); 16324 } 16325 }, 16326 16327 attach: function(elements){ 16328 $$(elements).each(function(element){ 16329 var title = read(this.options.title, element), 16330 text = read(this.options.text, element); 16331 16332 element.set('title', '').store('tip:native', title).retrieve('tip:title', title); 16333 element.retrieve('tip:text', text); 16334 this.fireEvent('attach', [element]); 16335 16336 var events = ['enter', 'leave']; 16337 if (!this.options.fixed) events.push('move'); 16338 16339 events.each(function(value){ 16340 var event = element.retrieve('tip:' + value); 16341 if (!event) event = function(event){ 16342 this['element' + value.capitalize()].apply(this, [event, element]); 16343 }.bind(this); 16344 16345 element.store('tip:' + value, event).addEvent('mouse' + value, event); 16346 }, this); 16347 }, this); 16348 16349 return this; 16350 }, 16351 16352 detach: function(elements){ 16353 $$(elements).each(function(element){ 16354 ['enter', 'leave', 'move'].each(function(value){ 16355 element.removeEvent('mouse' + value, element.retrieve('tip:' + value)).eliminate('tip:' + value); 16356 }); 16357 16358 this.fireEvent('detach', [element]); 16359 16360 if (this.options.title == 'title'){ // This is necessary to check if we can revert the title 16361 var original = element.retrieve('tip:native'); 16362 if (original) element.set('title', original); 16363 } 16364 }, this); 16365 16366 return this; 16367 }, 16368 16369 elementEnter: function(event, element){ 16370 clearTimeout(this.timer); 16371 this.timer = (function(){ 16372 this.container.empty(); 16373 16374 ['title', 'text'].each(function(value){ 16375 var content = element.retrieve('tip:' + value); 16376 var div = this['_' + value + 'Element'] = new Element('div', { 16377 'class': 'tip-' + value 16378 }).inject(this.container);
16379 if (content) this.fill(div, content); 16380 }, this); 16381 this.show(element); 16382 this.position((this.options.fixed) ? {page: element.getPosition()} : event); 16383 }).delay(this.options.showDelay, this); 16384 }, 16385 16386 elementLeave: function(event, element){ 16387 clearTimeout(this.timer); 16388 this.timer = this.hide.delay(this.options.hideDelay, this, element); 16389 this.fireForParent(event, element); 16390 }, 16391 16392 setTitle: function(title){ 16393 if (this._titleElement){ 16394 this._titleElement.empty(); 16395 this.fill(this._titleElement, title); 16396 } 16397 return this; 16398 }, 16399 16400 setText: function(text){ 16401 if (this._textElement){ 16402 this._textElement.empty(); 16403 this.fill(this._textElement, text); 16404 } 16405 return this; 16406 }, 16407 16408 fireForParent: function(event, element){ 16409 element = element.getParent(); 16410 if (!element || element == document.body) return; 16411 if (element.retrieve('tip:enter')) element.fireEvent('mouseenter', event); 16412 else this.fireForParent(event, element); 16413 }, 16414 16415 elementMove: function(event, element){ 16416 this.position(event); 16417 }, 16418 16419 position: function(event){ 16420 if (!this.tip) document.id(this); 16421 16422 var size = window.getSize(), scroll = window.getScroll(), 16423 tip = {x: this.tip.offsetWidth, y: this.tip.offsetHeight}, 16424 props = {x: 'left', y: 'top'}, 16425 bounds = {y: false, x2: false, y2: false, x: false}, 16426 obj = {}; 16427 16428 for (var z in props){ 16429 obj[props[z]] = event.page[z] + this.options.offset[z]; 16430 if (obj[props[z]] < 0) bounds[z] = true; 16431 if ((obj[props[z]] + tip[z] - scroll[z]) > size[z] - this.options.windowPadding[z]){ 16432 obj[props[z]] = event.page[z] - this.options.offset[z] - tip[z]; 16433 bounds[z+'2'] = true; 16434 } 16435 } 16436 16437 this.fireEvent('bound', bounds); 16438 this.tip.setStyles(obj); 16439 }, 16440 16441 fill: function(element, contents){ 16442 if (typeof contents == 'string') element.set('html', contents); 16443 else element.adopt(contents); 16444 }, 16445 16446 show: function(element){ 16447 if (!this.tip) document.id(this); 16448 if (!this.tip.getParent()) this.tip.inject(document.body); 16449 this.fireEvent('show', [this.tip, element]); 16450 }, 16451 16452 hide: function(element){ 16453 if (!this.tip) document.id(this); 16454 this.fireEvent('hide', [this.tip, element]); 16455 } 16456 16457}); 16458 16459})(); 16460 16461 16462/* 16463--- 16464 16465script: Locale.Set.From.js 16466 16467name: Locale.Set.From 16468 16469description: Provides an alternative way to create Locale.Set objects. 16470 16471license: MIT-style license 16472 16473authors: 16474 - Tim Wienk 16475 16476requires: 16477 - Core/JSON 16478 - /Locale 16479 16480provides: Locale.Set.From 16481 16482... 16483*/ 16484 16485(function(){ 16486 16487var parsers = { 16488 'json': JSON.decode 16489}; 16490 16491Locale.Set.defineParser = function(name, fn){ 16492 parsers[name] = fn; 16493}; 16494 16495Locale.Set.from = function(set, type){ 16496 if (instanceOf(set, Locale.Set)) return set; 16497 16498 if (!type && typeOf(set) == 'string') type = 'json'; 16499 if (parsers[type]) set = parsers[type](set); 16500 16501 var locale = new Locale.Set; 16502 16503 locale.sets = set.sets || {}; 16504 16505 if (set.inherits){ 16506 locale.inherits.locales = Array.from(set.inherits.locales); 16507 locale.inherits.sets = set.inherits.sets || {}; 16508 } 16509 16510 return locale; 16511}; 16512 16513})(); 16514 16515 16516/* 16517--- 16518 16519name: Locale.de-DE.Date 16520 16521description: Date messages for German. 16522 16523license: MIT-style license 16524 16525authors: 16526 - Christoph Pojer 16527 - Frank Rossi 16528 - Ulrich Petri 16529 - Fabian Beiner 16530 16531requires: 16532 - /Locale 16533 16534provides: [Locale.de-DE.Date] 16535 16536... 16537*/ 16538 16539Locale.define('de-DE', 'Date', { 16540 16541 months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], 16542 months_abbr: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'], 16543 days: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'], 16544 days_abbr: ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'], 16545 16546 // Culture's date order: DD.MM.YYYY 16547 dateOrder: ['date', 'month', 'year'], 16548 shortDate: '%d.%m.%Y', 16549 shortTime: '%H:%M', 16550 AM: 'vormittags', 16551 PM: 'nachmittags', 16552 firstDayOfWeek: 1, 16553 16554 // Date.Extras 16555 ordinal: '.', 16556 16557 lessThanMinuteAgo: 'vor weniger als einer Minute', 16558 minuteAgo: 'vor einer Minute', 16559 minutesAgo: 'vor {delta} Minuten', 16560 hourAgo: 'vor einer Stunde', 16561 hoursAgo: 'vor {delta} Stunden', 16562 dayAgo: 'vor einem Tag', 16563 daysAgo: 'vor {delta} Tagen', 16564 weekAgo: 'vor einer Woche', 16565 weeksAgo: 'vor {delta} Wochen', 16566 monthAgo: 'vor einem Monat', 16567 monthsAgo: 'vor {delta} Monaten', 16568 yearAgo: 'vor einem Jahr', 16569 yearsAgo: 'vor {delta} Jahren', 16570 16571 lessThanMinuteUntil: 'in weniger als einer Minute', 16572 minuteUntil: 'in einer Minute', 16573 minutesUntil: 'in {delta} Minuten', 16574 hourUntil: 'in ca. einer Stunde', 16575 hoursUntil: 'in ca. {delta} Stunden', 16576 dayUntil: 'in einem Tag', 16577 daysUntil: 'in {delta} Tagen', 16578 weekUntil: 'in einer Woche', 16579 weeksUntil: 'in {delta} Wochen', 16580 monthUntil: 'in einem Monat', 16581 monthsUntil: 'in {delta} Monaten', 16582 yearUntil: 'in einem Jahr', 16583 yearsUntil: 'in {delta} Jahren' 16584 16585}); 16586 16587 16588/* 16589--- 16590 16591name: Locale.de-DE.Form.Validator 16592 16593description: Form Validator messages for German.
16594 16595license: MIT-style license 16596 16597authors: 16598 - Frank Rossi 16599 - Ulrich Petri 16600 - Fabian Beiner 16601 16602requires: 16603 - /Locale 16604 16605provides: [Locale.de-DE.Form.Validator] 16606 16607... 16608*/ 16609 16610Locale.define('de-DE', 'FormValidator', { 16611 16612 required: 'Dieses Eingabefeld muss ausgefüllt werden.', 16613 minLength: 'Geben Sie bitte mindestens {minLength} Zeichen ein (Sie haben nur {length} Zeichen eingegeben).', 16614 maxLength: 'Geben Sie bitte nicht mehr als {maxLength} Zeichen ein (Sie haben {length} Zeichen eingegeben).', 16615 integer: 'Geben Sie in diesem Eingabefeld bitte eine ganze Zahl ein. Dezimalzahlen (z.B. "1.25") sind nicht erlaubt.', 16616 numeric: 'Geben Sie in diesem Eingabefeld bitte nur Zahlenwerte (z.B. "1", "1.1", "-1" oder "-1.1") ein.', 16617 digits: 'Geben Sie in diesem Eingabefeld bitte nur Zahlen und Satzzeichen ein (z.B. eine Telefonnummer mit Bindestrichen und Punkten ist erlaubt).', 16618 alpha: 'Geben Sie in diesem Eingabefeld bitte nur Buchstaben (a-z) ein. Leerzeichen und andere Zeichen sind nicht erlaubt.', 16619 alphanum: 'Geben Sie in diesem Eingabefeld bitte nur Buchstaben (a-z) und Zahlen (0-9) ein. Leerzeichen oder andere Zeichen sind nicht erlaubt.', 16620 dateSuchAs: 'Geben Sie bitte ein gültiges Datum ein (z.B. "{date}").', 16621 dateInFormatMDY: 'Geben Sie bitte ein gültiges Datum im Format TT.MM.JJJJ ein (z.B. "31.12.1999").', 16622 email: 'Geben Sie bitte eine gültige E-Mail-Adresse ein (z.B. "[email protected]").', 16623 url: 'Geben Sie bitte eine gültige URL ein (z.B. "http://www.example.com").', 16624 currencyDollar: 'Geben Sie bitte einen gültigen Betrag in EURO ein (z.B. 100.00â¬).', 16625 oneRequired: 'Bitte füllen Sie mindestens ein Eingabefeld aus.', 16626 errorPrefix: 'Fehler: ', 16627 warningPrefix: 'Warnung: ', 16628 16629 // Form.Validator.Extras 16630 noSpace: 'Es darf kein Leerzeichen in diesem Eingabefeld sein.', 16631 reqChkByNode: 'Es wurden keine Elemente gewählt.', 16632 requiredChk: 'Dieses Feld muss ausgefüllt werden.', 16633 reqChkByName: 'Bitte wählen Sie ein {label}.', 16634 match: 'Dieses Eingabefeld muss mit dem {matchName} Eingabefeld übereinstimmen.', 16635 startDate: 'Das Anfangsdatum', 16636 endDate: 'Das Enddatum', 16637 currendDate: 'Das aktuelle Datum', 16638 afterDate: 'Das Datum sollte zur gleichen Zeit oder später sein als {label}.', 16639 beforeDate: 'Das Datum sollte zur gleichen Zeit oder früher sein als {label}.', 16640 startMonth: 'Wählen Sie bitte einen Anfangsmonat', 16641 sameMonth: 'Diese zwei Datumsangaben müssen im selben Monat sein - Sie müssen eines von beiden verändern.', 16642 creditcard: 'Die eingegebene Kreditkartennummer ist ungültig. Bitte überprüfen Sie diese und versuchen Sie es erneut. {length} Zahlen eingegeben.' 16643 16644}); 16645 16646 16647/* 16648--- 16649 16650name: Locale.EU.Number 16651 16652description: Number messages for Europe. 16653 16654license: MIT-style license 16655 16656authors: 16657 - Arian Stolwijk 16658 16659requires: 16660 - /Locale 16661 16662provides: [Locale.EU.Number] 16663 16664... 16665*/ 16666 16667Locale.define('EU', 'Number', { 16668 16669 decimal: ',', 16670 group: '.', 16671 16672 currency: { 16673 prefix: '⬠' 16674 } 16675 16676}); 16677 16678 16679/* 16680--- 16681 16682name: Locale.de-DE.Number 16683 16684description: Number messages for German. 16685 16686license: MIT-style license 16687 16688authors: 16689 - Christoph Pojer 16690 16691requires: 16692 - /Locale 16693 - /Locale.EU.Number 16694 16695provides: [Locale.de-DE.Number] 16696 16697... 16698*/ 16699 16700Locale.define('de-DE').inherit('EU', 'Number'); 16701 16702 16703/* 16704--- 16705 16706name: Locale.en-GB.Date 16707 16708description: Date messages for British English. 16709 16710license: MIT-style license 16711 16712authors: 16713 - Aaron Newton 16714 16715requires: 16716 - /Locale 16717 - /Locale.en-US.Date 16718 16719provides: [Locale.en-GB.Date] 16720 16721... 16722*/ 16723 16724Locale.define('en-GB', 'Date', { 16725 16726 // Culture's date order: DD/MM/YYYY 16727 dateOrder: ['date', 'month', 'year'], 16728 shortDate: '%d/%m/%Y', 16729 shortTime: '%H:%M' 16730 16731}).inherit('en-US', 'Date'); 16732 16733 16734/* 16735--- 16736 16737name: Locale.es-ES.Date 16738 16739description: Date messages for Spanish. 16740 16741license: MIT-style license 16742 16743authors: 16744 - Ãlfons Sanchez 16745 16746requires: 16747 - /Locale 16748 16749provides: [Locale.es-ES.Date] 16750 16751... 16752*/ 16753 16754Locale.define('es-ES', 'Date', { 16755 16756 months: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'], 16757 months_abbr: ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic'], 16758 days: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'], 16759 days_abbr: ['dom', 'lun', 'mar', 'mié', 'juv', 'vie', 'sáb'], 16760 16761 // Culture's date order: DD/MM/YYYY 16762 dateOrder: ['date', 'month', 'year'], 16763 shortDate: '%d/%m/%Y', 16764 shortTime: '%H:%M', 16765 AM: 'AM', 16766 PM: 'PM', 16767 firstDayOfWeek: 1, 16768 16769 // Date.Extras 16770 ordinal: '', 16771 16772 lessThanMinuteAgo: 'hace menos de un minuto', 16773 minuteAgo: 'hace un minuto', 16774 minutesAgo: 'hace {delta} minutos', 16775 hourAgo: 'hace una hora', 16776 hoursAgo: 'hace unas {delta} horas', 16777 dayAgo: 'hace un dÃa', 16778 daysAgo: 'hace {delta} dÃas', 16779 weekAgo: 'hace una semana', 16780 weeksAgo: 'hace unas {delta} semanas', 16781 monthAgo: 'hace un mes', 16782 monthsAgo: 'hace {delta} meses', 16783 yearAgo: 'hace un año', 16784 yearsAgo: 'hace {delta} años', 16785 16786 lessThanMinuteUntil: 'menos de un minuto desde ahora', 16787 minuteUntil: 'un minuto desde ahora', 16788 minutesUntil: '{delta} minutos desde ahora', 16789 hourUntil: 'una hora desde ahora', 16790 hoursUntil: 'unas {delta}
16790 horas desde ahora', 16791 dayUntil: 'un dÃa desde ahora', 16792 daysUntil: '{delta} dÃas desde ahora', 16793 weekUntil: 'una semana desde ahora', 16794 weeksUntil: 'unas {delta} semanas desde ahora', 16795 monthUntil: 'un mes desde ahora', 16796 monthsUntil: '{delta} meses desde ahora', 16797 yearUntil: 'un año desde ahora', 16798 yearsUntil: '{delta} años desde ahora' 16799 16800}); 16801 16802 16803/* 16804--- 16805 16806name: Locale.es-ES.Form.Validator 16807 16808description: Form Validator messages for Spanish. 16809 16810license: MIT-style license 16811 16812authors: 16813 - Ãlfons Sanchez 16814 16815requires: 16816 - /Locale 16817 16818provides: [Locale.es-ES.Form.Validator] 16819 16820... 16821*/ 16822 16823Locale.define('es-ES', 'FormValidator', { 16824 16825 required: 'Este campo es obligatorio.', 16826 minLength: 'Por favor introduce al menos {minLength} caracteres (has introducido {length} caracteres).', 16827 maxLength: 'Por favor introduce no más de {maxLength} caracteres (has introducido {length} caracteres).', 16828 integer: 'Por favor introduce un número entero en este campo. Números con decimales (p.e. 1,25) no se permiten.', 16829 numeric: 'Por favor introduce solo valores numéricos en este campo (p.e. "1" o "1,1" o "-1" o "-1,1").', 16830 digits: 'Por favor usa solo números y puntuación en este campo (por ejemplo, un número de teléfono con guiones y puntos no esta permitido).', 16831 alpha: 'Por favor usa letras solo (a-z) en este campo. No se admiten espacios ni otros caracteres.', 16832 alphanum: 'Por favor, usa solo letras (a-z) o números (0-9) en este campo. No se admiten espacios ni otros caracteres.', 16833 dateSuchAs: 'Por favor introduce una fecha válida como {date}', 16834 dateInFormatMDY: 'Por favor introduce una fecha válida como DD/MM/YYYY (p.e. "31/12/1999")', 16835 email: 'Por favor, introduce una dirección de email válida. Por ejemplo, "[email protected]".', 16836 url: 'Por favor introduce una URL válida como http://www.example.com.', 16837 currencyDollar: 'Por favor introduce una cantidad válida de â¬. Por ejemplo â¬100,00 .', 16838 oneRequired: 'Por favor introduce algo para por lo menos una de estas entradas.', 16839 errorPrefix: 'Error: ', 16840 warningPrefix: 'Aviso: ', 16841 16842 // Form.Validator.Extras 16843 noSpace: 'No pueden haber espacios en esta entrada.', 16844 reqChkByNode: 'No hay elementos seleccionados.', 16845 requiredChk: 'Este campo es obligatorio.', 16846 reqChkByName: 'Por favor selecciona una {label}.', 16847 match: 'Este campo necesita coincidir con el campo {matchName}', 16848 startDate: 'la fecha de inicio', 16849 endDate: 'la fecha de fin', 16850 currendDate: 'la fecha actual', 16851 afterDate: 'La fecha debe ser igual o posterior a {label}.', 16852 beforeDate: 'La fecha debe ser igual o anterior a {label}.', 16853 startMonth: 'Por favor selecciona un mes de origen', 16854 sameMonth: 'Estas dos fechas deben estar en el mismo mes - debes cambiar una u otra.' 16855 16856}); 16857 16858 16859/* 16860--- 16861 16862name: Locale.fr-FR.Date 16863 16864description: Date messages for French. 16865 16866license: MIT-style license 16867 16868authors: 16869 - Nicolas Sorosac 16870 - Antoine Abt 16871 16872requires: 16873 - /Locale 16874 16875provides: [Locale.fr-FR.Date] 16876 16877... 16878*/ 16879 16880Locale.define('fr-FR', 'Date', { 16881 16882 months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'], 16883 months_abbr: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'], 16884 days: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'], 16885 days_abbr: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'], 16886 16887 // Culture's date order: DD/MM/YYYY 16888 dateOrder: ['date', 'month', 'year'], 16889 shortDate: '%d/%m/%Y', 16890 shortTime: '%H:%M', 16891 AM: 'AM', 16892 PM: 'PM', 16893 firstDayOfWeek: 1, 16894 16895 // Date.Extras 16896 ordinal: function(dayOfMonth){ 16897 return (dayOfMonth > 1) ? '' : 'er'; 16898 }, 16899 16900 lessThanMinuteAgo: "il y a moins d'une minute", 16901 minuteAgo: 'il y a une minute', 16902 minutesAgo: 'il y a {delta} minutes', 16903 hourAgo: 'il y a une heure', 16904 hoursAgo: 'il y a {delta} heures', 16905 dayAgo: 'il y a un jour', 16906 daysAgo: 'il y a {delta} jours', 16907 weekAgo: 'il y a une semaine', 16908 weeksAgo: 'il y a {delta} semaines', 16909 monthAgo: 'il y a 1 mois', 16910 monthsAgo: 'il y a {delta} mois', 16911 yearthAgo: 'il y a 1 an', 16912 yearsAgo: 'il y a {delta} ans', 16913 16914 lessThanMinuteUntil: "dans moins d'une minute", 16915 minuteUntil: 'dans une minute', 16916 minutesUntil: 'dans {delta} minutes', 16917 hourUntil: 'dans une heure', 16918 hoursUntil: 'dans {delta} heures', 16919 dayUntil: 'dans un jour', 16920 daysUntil: 'dans {delta} jours', 16921 weekUntil: 'dans 1 semaine', 16922 weeksUntil: 'dans {delta} semaines', 16923 monthUntil: 'dans 1 mois', 16924 monthsUntil: 'dans {delta} mois', 16925 yearUntil: 'dans 1 an', 16926 yearsUntil: 'dans {delta} ans' 16927 16928}); 16929 16930 16931/* 16932--- 16933 16934name: Locale.fr-FR.Form.Validator 16935 16936description: Form Validator messages for French. 16937 16938license: MIT-style license 16939 16940authors: 16941 - Miquel Hudin 16942 - Nicolas Sorosac 16943 16944requires: 16945 - /Locale 16946 16947provides: [Locale.fr-FR.Form.Validator] 16948 16949... 16950*/ 16951 16952Locale.define('fr-FR', 'FormValidator', { 16953 16954 required: 'Ce champ est obligatoire.', 16955 length: 'Veuillez saisir {length} caractère(s) (vous avez saisi {elLength} caractère(s)', 16956 minLength: 'Veuillez saisir un minimum de {minLength} caractère(s) (vous avez saisi {length} caractère(s)).', 16957 maxLength: 'Veuillez saisir un maximum de {maxLength} caractère(s) (vous avez saisi {length} caractère(s)).', 16958 integer: 'Veuillez saisir un nombre entier dans ce champ. Les nombres décimaux (ex : "1,25") ne sont pas autorisés.', 16959 numeric: 'Veuillez saisir uniquement des chiffres dans ce champ (ex : "1" ou "1,1" ou "-1" ou "-1,1").', 16960 digits: "Veuillez saisir uniquement des chiffres et des signes de ponctuation dans ce champ (ex : un numéro de téléphone avec des traits d'union est autorisé).", 16961 alpha: 'Veuillez saisir uniquement des lettres (a-z) dans ce champ. Les espaces ou autres caractères ne sont pas autorisés.', 16962 alphanum: 'Veuillez saisir uniquement des lettres (a-z) ou des chiffres (0-9) dans ce champ. Les espaces ou autres caractères ne sont pas autorisés.', 16963 dateSuchAs: 'Veuillez saisir une date correcte comme {date}', 16964 dateInFormatMDY: 'Veuillez saisir une date correcte, au format JJ/MM/AAAA (ex : "31/11/1999").', 16965 email: 'Veuillez saisir une adresse de courrier électronique. Par example "[email protected]".', 16966 url: 'Veuillez saisir une URL, comme http://www.example.com.', 16967 currencyDollar: 'Veuillez saisir une quantité correcte. Par example 100,00€.', 16968 oneRequired: 'Veuillez sélectionner au moins une de ces options.', 16969 errorPrefix: 'Erreur : ', 16970 warningPrefix: 'Attention : ', 16971 16972 // Form.Validator.Extras 16973 noSpace: "Ce champ n'accepte pas les espaces.", 16974 reqChkByNode: "Aucun élément n'est sélectionné.", 16975 requiredChk: 'Ce champ est obligatoire.', 16976 reqChkByName: 'Veuillez sélectionner un(e) {label}.', 16977 match: 'Ce champ doit correspondre avec le champ {matchName}.', 16978 startDate: 'date de début', 16979 endDate: 'date de fin', 16980 currendDate: 'date actuelle', 16981 afterDate: 'La date doit être identique ou postérieure à {label}.', 16982 beforeDate: 'La date doit être identique ou antérieure à {label}.', 16983 startMonth: 'Veuillez sélectionner un mois de début.', 16984 sameMonth: 'Ces deux dates doivent être dans le même mois - vous devez en modifier une.', 16985 creditcard: 'Le numéro de carte de crédit est invalide. Merci de vérifier le numéro et de réessayer. Vous avez entré {length} chiffre(s).' 16986 16987}
16987); 16988 16989 16990/* 16991--- 16992 16993name: Locale.fr-FR.Number 16994 16995description: Number messages for French. 16996 16997license: MIT-style license 16998 16999authors: 17000 - Arian Stolwijk 17001 - sv1l 17002 17003requires: 17004 - /Locale 17005 - /Locale.EU.Number 17006 17007provides: [Locale.fr-FR.Number] 17008 17009... 17010*/ 17011 17012Locale.define('fr-FR', 'Number', { 17013 17014 group: ' ' // In fr-FR localization, group character is a blank space 17015 17016}).inherit('EU', 'Number'); 17017 17018 17019/* 17020--- 17021 17022name: Locale.it-IT.Date 17023 17024description: Date messages for Italian. 17025 17026license: MIT-style license. 17027 17028authors: 17029 - Andrea Novero 17030 - Valerio Proietti 17031 17032requires: 17033 - /Locale 17034 17035provides: [Locale.it-IT.Date] 17036 17037... 17038*/ 17039 17040Locale.define('it-IT', 'Date', { 17041 17042 months: ['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre'], 17043 months_abbr: ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'], 17044 days: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'], 17045 days_abbr: ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab'], 17046 17047 // Culture's date order: DD/MM/YYYY 17048 dateOrder: ['date', 'month', 'year'], 17049 shortDate: '%d/%m/%Y', 17050 shortTime: '%H.%M', 17051 AM: 'AM', 17052 PM: 'PM', 17053 firstDayOfWeek: 1, 17054 17055 // Date.Extras 17056 ordinal: 'º', 17057 17058 lessThanMinuteAgo: 'meno di un minuto fa', 17059 minuteAgo: 'circa un minuto fa', 17060 minutesAgo: 'circa {delta} minuti fa', 17061 hourAgo: "circa un'ora fa", 17062 hoursAgo: 'circa {delta} ore fa', 17063 dayAgo: 'circa 1 giorno fa', 17064 daysAgo: 'circa {delta} giorni fa', 17065 weekAgo: 'una settimana fa', 17066 weeksAgo: '{delta} settimane fa', 17067 monthAgo: 'un mese fa', 17068 monthsAgo: '{delta} mesi fa', 17069 yearAgo: 'un anno fa', 17070 yearsAgo: '{delta} anni fa', 17071 17072 lessThanMinuteUntil: 'tra meno di un minuto', 17073 minuteUntil: 'tra circa un minuto', 17074 minutesUntil: 'tra circa {delta} minuti', 17075 hourUntil: "tra circa un'ora", 17076 hoursUntil: 'tra circa {delta} ore', 17077 dayUntil: 'tra circa un giorno', 17078 daysUntil: 'tra circa {delta} giorni', 17079 weekUntil: 'tra una settimana', 17080 weeksUntil: 'tra {delta} settimane', 17081 monthUntil: 'tra un mese', 17082 monthsUntil: 'tra {delta} mesi', 17083 yearUntil: 'tra un anno', 17084 yearsUntil: 'tra {delta} anni' 17085 17086}); 17087 17088 17089/* 17090--- 17091 17092name: Locale.it-IT.Form.Validator 17093 17094description: Form Validator messages for Italian. 17095 17096license: MIT-style license 17097 17098authors: 17099 - Leonardo Laureti 17100 - Andrea Novero 17101 17102requires: 17103 - /Locale 17104 17105provides: [Locale.it-IT.Form.Validator] 17106 17107... 17108*/ 17109 17110Locale.define('it-IT', 'FormValidator', { 17111 17112 required: 'Il campo è obbligatorio.', 17113 minLength: 'Inserire almeno {minLength} caratteri (ne sono stati inseriti {length}).', 17114 maxLength: 'Inserire al massimo {maxLength} caratteri (ne sono stati inseriti {length}).', 17115 integer: 'Inserire un numero intero. Non sono consentiti decimali (es.: 1.25).', 17116 numeric: 'Inserire solo valori numerici (es.: "1" oppure "1.1" oppure "-1" oppure "-1.1").', 17117 digits: 'Inserire solo numeri e caratteri di punteggiatura. Per esempio è consentito un numero telefonico con trattini o punti.', 17118 alpha: 'Inserire solo lettere (a-z). Non sono consentiti spazi o altri caratteri.', 17119 alphanum: 'Inserire solo lettere (a-z) o numeri (0-9). Non sono consentiti spazi o altri caratteri.', 17120 dateSuchAs: 'Inserire una data valida del tipo {date}', 17121 dateInFormatMDY: 'Inserire una data valida nel formato MM/GG/AAAA (es.: "12/31/1999")', 17122 email: 'Inserire un indirizzo email valido. Per esempio "[email protected]".', 17123 url: 'Inserire un indirizzo valido. Per esempio "http://www.example.com".', 17124 currencyDollar: 'Inserire un importo valido. Per esempio "$100.00".', 17125 oneRequired: 'Completare almeno uno dei campi richiesti.', 17126 errorPrefix: 'Errore: ', 17127 warningPrefix: 'Attenzione: ', 17128 17129 // Form.Validator.Extras 17130 noSpace: 'Non sono consentiti spazi.', 17131 reqChkByNode: 'Nessuna voce selezionata.', 17132 requiredChk: 'Il campo è obbligatorio.', 17133 reqChkByName: 'Selezionare un(a) {label}.', 17134 match: 'Il valore deve corrispondere al campo {matchName}', 17135 startDate: "data d'inizio", 17136 endDate: 'data di fine', 17137 currendDate: 'data attuale', 17138 afterDate: 'La data deve corrispondere o essere successiva al {label}.', 17139 beforeDate: 'La data deve corrispondere o essere precedente al {label}.', 17140 startMonth: "Selezionare un mese d'inizio", 17141 sameMonth: 'Le due date devono essere dello stesso mese - occorre modificarne una.', 17142 creditcard: 'Il numero di carta di credito inserito non è valido. Controlla il numero e prova di nuovo. Inserite {length} cifre.' 17143 17144 17145}); 17146 17147 17148/* 17149--- 17150 17151name: Locale.ja-JP.Date 17152 17153description: Date messages for Japanese. 17154 17155license: MIT-style license 17156 17157authors: 17158 - Noritaka Horio 17159 17160requires: 17161 - /Locale 17162 17163provides: [Locale.ja-JP.Date] 17164 17165... 17166*/ 17167 17168Locale.define('ja-JP', 'Date', { 17169 17170 months: ['1æ', '2æ', '3æ', '4æ', '5æ', '6æ', '7æ', '8æ', '9æ', '10æ', '11æ', '12æ'], 17171 months_abbr: ['1æ', '2æ', '3æ', '4æ', '5æ', '6æ', '7æ', '8æ', '9æ', '10æ', '11æ', '12æ'], 17172 days: ['æ¥ææ¥', 'æææ¥', 'ç«ææ¥', 'æ°´ææ¥', 'æ¨ææ¥', 'éææ¥', 'åææ¥'], 17173 days_abbr: ['æ¥', 'æ', 'ç«', 'æ°´', 'æ¨', 'é', 'å'], 17174 17175 // Culture's date order: YYYY/MM/DD 17176 dateOrder: ['year', 'month', 'date'], 17177 shortDate: '%Y/%m/%d', 17178 shortTime: '%H:%M', 17179 AM: 'åå', 17180 PM: 'åå¾', 17181 firstDayOfWeek: 0, 17182 17183 // Date.Extras 17184 ordinal: '', 17185 17186 lessThanMinuteAgo: '1å以å å', 17187 minuteAgo: 'ç´1åå', 17188 minutesAgo: 'ç´{delta}åå', 17189 hourAgo: 'ç´1æéå', 17190 hoursAgo: 'ç´{delta}æéå', 17191 dayAgo: '1æ¥å', 17192 daysAgo: '{delta}æ¥å', 17193 weekAgo: '1é±éå', 17194 weeksAgo: '{delta}é±éå', 17195 monthAgo: '1ã¶æå', 17196 monthsAgo: '{delta}ã¶æå',
17197 yearAgo: '1å¹´å', 17198 yearsAgo: '{delta}å¹´å', 17199 17200 lessThanMinuteUntil: 'ä»ããç´1å以å ', 17201 minuteUntil: 'ä»ããç´1å', 17202 minutesUntil: 'ä»ããç´{delta}å', 17203 hourUntil: 'ä»ããç´1æé', 17204 hoursUntil: 'ä»ããç´{delta}æé', 17205 dayUntil: 'ä»ãã1æ¥é', 17206 daysUntil: 'ä»ãã{delta}æ¥é', 17207 weekUntil: 'ä»ãã1é±é', 17208 weeksUntil: 'ä»ãã{delta}é±é', 17209 monthUntil: 'ä»ãã1ã¶æ', 17210 monthsUntil: 'ä»ãã{delta}ã¶æ', 17211 yearUntil: 'ä»ãã1å¹´', 17212 yearsUntil: 'ä»ãã{delta}å¹´' 17213 17214}); 17215 17216 17217/* 17218--- 17219 17220name: Locale.ja-JP.Form.Validator 17221 17222description: Form Validator messages for Japanese. 17223 17224license: MIT-style license 17225 17226authors: 17227 - Noritaka Horio 17228 17229requires: 17230 - /Locale 17231 17232provides: [Locale.ja-JP.Form.Validator] 17233 17234... 17235*/ 17236 17237Locale.define("ja-JP", "FormValidator", { 17238 17239 required: 'å ¥åã¯å¿ é ã§ãã', 17240 minLength: 'å ¥åæåæ°ã¯{minLength}以ä¸ã«ãã¦ãã ããã({length}æå)', 17241 maxLength: 'å ¥åæåæ°ã¯{maxLength}以ä¸ã«ãã¦ãã ããã({length}æå)', 17242 integer: 'æ´æ°ãå ¥åãã¦ãã ããã', 17243 numeric: 'å ¥åã§ããã®ã¯æ°å¤ã ãã§ãã(ä¾: "1", "1.1", "-1", "-1.1"....)', 17244 digits: 'å ¥åã§ããã®ã¯æ°å¤ã¨å¥èªè¨å·ã§ãã (ä¾: -ã+ãå«ãé»è©±çªå·ãªã©).', 17245 alpha: 'å ¥åã§ããã®ã¯åè§è±åã ãã§ãããã以å¤ã®æåã¯å ¥åã§ãã¾ããã', 17246 alphanum: 'å ¥åã§ããã®ã¯åè§è±æ°åã ãã§ãããã以å¤ã®æåã¯å ¥åã§ãã¾ããã', 17247 dateSuchAs: 'æå¹ãªæ¥ä»ãå ¥åãã¦ãã ããã{date}', 17248 dateInFormatMDY: 'æ¥ä»ã®æ¸å¼ã«èª¤ããããã¾ããYYYY/MM/DD (i.e. "1999/12/31")', 17249 email: 'ã¡ã¼ã«ã¢ãã¬ã¹ã«èª¤ããããã¾ãã', 17250 url: 'URLã¢ãã¬ã¹ã«èª¤ããããã¾ãã', 17251 currencyDollar: 'éé¡ã«èª¤ããããã¾ãã', 17252 oneRequired: 'ã²ã¨ã¤ä»¥ä¸å ¥åãã¦ãã ããã', 17253 errorPrefix: 'ã¨ã©ã¼: ', 17254 warningPrefix: 'è¦å: ', 17255 17256 // FormValidator.Extras 17257 noSpace: 'ã¹ãã¼ã¹ã¯å ¥åã§ãã¾ããã', 17258 reqChkByNode: '鏿ããã¦ãã¾ããã', 17259 requiredChk: 'ãã®é ç®ã¯å¿ é ã§ãã', 17260 reqChkByName: '{label}ã鏿ãã¦ãã ããã', 17261 match: '{matchName}ãå ¥åããã¦ããå ´åå¿ é ã§ãã', 17262 startDate: 'éå§æ¥', 17263 endDate: 'çµäºæ¥', 17264 currendDate: '仿¥', 17265 afterDate: '{label}以éã®æ¥ä»ã«ãã¦ãã ããã', 17266 beforeDate: '{label}以åã®æ¥ä»ã«ãã¦ãã ããã', 17267 startMonth: 'éå§æã鏿ãã¦ãã ããã', 17268 sameMonth: 'æ¥ä»ãåä¸ã§ããã©ã¡ããã夿´ãã¦ãã ããã' 17269 17270}); 17271 17272 17273/* 17274--- 17275 17276name: Locale.ja-JP.Number 17277 17278description: Number messages for Japanese. 17279 17280license: MIT-style license 17281 17282authors: 17283 - Noritaka Horio 17284 17285requires: 17286 - /Locale 17287 17288provides: [Locale.ja-JP.Number] 17289 17290... 17291*/ 17292 17293Locale.define('ja-JP', 'Number', { 17294 17295 decimal: '.', 17296 group: ',', 17297 17298 currency: { 17299 decimals: 0, 17300 prefix: '\\' 17301 } 17302 17303}); 17304 17305 17306/* 17307--- 17308 17309name: Locale.pt-PT.Date 17310 17311description: Date messages for Portuguese. 17312 17313license: MIT-style license 17314 17315authors: 17316 - Fabio Miranda Costa 17317 17318requires: 17319 - /Locale 17320 17321provides: [Locale.pt-PT.Date] 17322 17323... 17324*/ 17325 17326Locale.define('pt-PT', 'Date', { 17327 17328 months: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'], 17329 months_abbr: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'], 17330 days: ['Domingo', 'Segunda-feira', 'Terça-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sábado'], 17331 days_abbr: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'], 17332 17333 // Culture's date order: DD-MM-YYYY 17334 dateOrder: ['date', 'month', 'year'], 17335 shortDate: '%d-%m-%Y', 17336 shortTime: '%H:%M', 17337 AM: 'AM', 17338 PM: 'PM', 17339 firstDayOfWeek: 1, 17340 17341 // Date.Extras 17342 ordinal: 'º', 17343 17344 lessThanMinuteAgo: 'há menos de um minuto', 17345 minuteAgo: 'há cerca de um minuto', 17346 minutesAgo: 'há {delta} minutos', 17347 hourAgo: 'há cerca de uma hora', 17348 hoursAgo: 'há cerca de {delta} horas', 17349 dayAgo: 'há um dia', 17350 daysAgo: 'há {delta} dias', 17351 weekAgo: 'há uma semana', 17352 weeksAgo: 'há {delta} semanas', 17353 monthAgo: 'há um mês', 17354 monthsAgo: 'há {delta} meses', 17355 yearAgo: 'há um ano', 17356 yearsAgo: 'há {delta} anos', 17357 17358 lessThanMinuteUntil: 'em menos de um minuto', 17359 minuteUntil: 'em um minuto', 17360 minutesUntil: 'em {delta} minutos', 17361 hourUntil: 'em uma hora', 17362 hoursUntil: 'em {delta} horas', 17363 dayUntil: 'em um dia', 17364 daysUntil: 'em {delta} dias', 17365 weekUntil: 'em uma semana', 17366 weeksUntil: 'em {delta} semanas', 17367 monthUntil: 'em um mês', 17368 monthsUntil: 'em {delta} meses', 17369 yearUntil: 'em um ano', 17370 yearsUntil: 'em {delta} anos' 17371 17372}); 17373 17374 17375/* 17376--- 17377 17378name: Locale.pt-BR.Date 17379 17380description: Date messages for Portuguese (Brazil). 17381 17382license: MIT-style license 17383 17384authors: 17385 - Fabio Miranda Costa 17386 17387requires: 17388 - /Locale 17389 - /Locale.pt-PT.Date 17390 17391provides: [Locale.pt-BR.Date] 17392 17393... 17394*/ 17395 17396Locale.define('pt-BR', 'Date', { 17397 17398 // Culture's date order: DD/MM/YYYY 17399 shortDate: '%d/%m/%Y' 17400 17401}).inherit('pt-PT', 'Date'); 17402 17403 17404/* 17405--- 17406 17407name: Locale.pt-BR.Form.Validator 17408 17409description: Form Validator messages for Portuguese (Brazil). 17410 17411license: MIT-style license 17412 17413authors: 17414 - Fábio Miranda Costa 17415 17416requires: 17417 - /Locale 17418 17419provides: [Locale.pt-BR.Form.Validator] 17420 17421... 17422*/ 17423 17424Locale.define('pt-BR', 'FormValidator', { 17425 17426 required: 'Este campo é obrigatório.', 17427 minLength: 'Digite pelo menos {minLength} caracteres (tamanho atual: {length}).', 17428 maxLength: 'Não digite mais de {maxLength} caracteres (tamanho atual: {length}).', 17429 integer: 'Por favor digite apenas um número inteiro neste campo. Não são permitidos números decimais (por exemplo, 1,25).', 17430 numeric: 'Por favor digite apenas valores numéricos neste campo (por exemplo, "1" ou "1.1" ou "-1" ou "-1,1").', 17431 digits: 'Por favor use apenas números e pontuação neste campo (por exemplo, um número de telefone com traços ou pontos é permitido).', 17432 alpha: 'Por favor use somente letras (a-z). Espaço e outros caracteres não são permitidos.', 17433 alphanum: 'Use somente letras (a-z) ou números (0-9) neste campo. Espaço e outros caracteres não são permitidos.', 17434 dateSuchAs: 'Digite uma data válida, como {date}', 17435 dateInFormatMDY: 'Digite uma data válida, como DD/MM/YYYY (por exemplo, "31/12/1999")', 17436 email: 'Digite um endereço de email válido. Por exemplo "[email protected]".', 17437 url: 'Digite uma URL válida. Exemplo: http://www.example.com.', 17438 currencyDollar: 'Digite um valor em dinheiro válido. Exemplo: R$100,00 .', 17439 oneRequired: 'Digite algo para pelo menos um desses campos.', 17440 errorPrefix: 'Erro: ', 17441 warningPrefix: 'Aviso: ', 17442 17443 // Form.Validator.Extras 17444 noSpace: 'Não é possÃvel digitar espaços neste campo.', 17445 reqChkByNode: 'Não foi selecionado nenhum item.', 17446 requiredChk: 'Este campo é obrigatório.', 17447 reqChkByName: 'Por favor digite um {label}.', 17448 match: 'Este campo deve ser igual ao campo {matchName}.', 17449 startDate: 'a data inicial', 17450 endDate: 'a data final', 17451 currendDate: 'a data atual', 17452 afterDate: 'A data deve ser igual ou posterior a {label}.', 17453 beforeDate: 'A data deve ser igual ou anterior a {label}.', 17454 startMonth: 'Por favor selecione uma data inicial.', 17455 sameMonth: 'Estas duas datas devem ter o mesmo mês - você deve modificar uma das duas.', 17456 creditcard: 'O número do cartão de crédito informado é inválido. Por favor verifique o valor e tente novamente. {length} números informados.' 17457 17458}); 17459 17460 17461/* 17462--- 17463 17464name: Locale.pt-PT.Form.Validator 17465 17466description: Form Validator messages for Portuguese. 17467 17468license: MIT-style license 17469 17470authors: 17471 - Miquel Hudin 17472 17473requires: 17474 - /Locale 17475 17476provides: [Locale.pt-PT.Form.Validator] 17477 17478... 17479*/ 17480 17481Locale.define('pt-PT', 'FormValidator', { 17482 17483 required: 'Este campo é necessário.', 17484 minLength: 'Digite pelo menos{minLength} caracteres (comprimento {length} caracteres).', 17485 maxLength: 'Não insira mais de {maxLength} caracteres (comprimento {length} caracteres).', 17486 integer: 'Digite um número inteiro neste domÃnio. Com números decimais (por exemplo, 1,25), não são permitidas.', 17487 numeric: 'Digite apenas valores numéricos neste domÃnio (p.ex., "1" ou "1.1" ou "-1" ou "-1,1").', 17488 digits: 'Por favor, use números e pontuação apenas neste campo (p.ex., um número de telefone com traços ou pontos é permitida).', 17489 alpha: 'Por favor use somente letras (a-z), com nesta área. Não utilize espaços nem outros caracteres são permitidos.', 17490 alphanum: 'Use somente letras (a-z) ou números (0-9) neste campo. Não utilize espaços nem outros caracteres são permitidos.', 17491 dateSuchAs: 'Digite uma data válida, como {date}', 17492 dateInFormatMDY: 'Digite uma data válida, como DD/MM/YYYY (p.ex. "31/12/1999")', 17493 email: 'Digite um endereço de email válido. Por exemplo "[email protected]".', 17494 url: 'Digite uma URL válida, como http://www.example.com.', 17495 currencyDollar: 'Digite um valor válido $. Por exemplo $ 100,00. ', 17496 oneRequired: 'Digite algo para pelo menos um desses insumos.', 17497 errorPrefix: 'Erro: ', 17498 warningPrefix: 'Aviso: ' 17499 17500}); 17501 17502 17503/* 17504--- 17505 17506name: Locale.ru-RU-unicode.Date 17507
17508description: Date messages for Russian (utf-8). 17509 17510license: MIT-style license 17511 17512authors: 17513 - Evstigneev Pavel 17514 - Kuryanovich Egor 17515 17516requires: 17517 - /Locale 17518 17519provides: [Locale.ru-RU.Date] 17520 17521... 17522*/ 17523 17524(function(){ 17525 17526// Russian language pluralization rules, taken from CLDR project, http://unicode.org/cldr/ 17527// one -> n mod 10 is 1 and n mod 100 is not 11; 17528// few -> n mod 10 in 2..4 and n mod 100 not in 12..14; 17529// many -> n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14; 17530// other -> everything else (example 3.14) 17531var pluralize = function (n, one, few, many, other){ 17532 var modulo10 = n % 10, 17533 modulo100 = n % 100; 17534 17535 if (modulo10 == 1 && modulo100 != 11){ 17536 return one; 17537 } else if ((modulo10 == 2 || modulo10 == 3 || modulo10 == 4) && !(modulo100 == 12 || modulo100 == 13 || modulo100 == 14)){ 17538 return few; 17539 } else if (modulo10 == 0 || (modulo10 == 5 || modulo10 == 6 || modulo10 == 7 || modulo10 == 8 || modulo10 == 9) || (modulo100 == 11 || modulo100 == 12 || modulo100 == 13 || modulo100 == 14)){ 17540 return many; 17541 } else { 17542 return other; 17543 } 17544}; 17545 17546Locale.define('ru-RU', 'Date', { 17547 17548 months: ['ЯнваÑÑ', 'ФевÑалÑ', 'ÐаÑÑ', 'ÐпÑелÑ', 'Ðай', 'ÐÑнÑ', 'ÐÑлÑ', 'ÐвгÑÑÑ', 'СенÑÑбÑÑ', 'ÐкÑÑбÑÑ', 'ÐоÑбÑÑ', 'ÐекабÑÑ'], 17549 months_abbr: ['Ñнв', 'ÑевÑ', 'маÑÑ', 'апÑ', 'май','иÑнÑ','иÑлÑ','авг','ÑенÑ','окÑ','ноÑб','дек'], 17550 days: ['ÐоÑкÑеÑенÑе', 'ÐонеделÑник', 'ÐÑоÑник', 'СÑеда', 'ЧеÑвеÑг', 'ÐÑÑниÑа', 'СÑббоÑа'], 17551 days_abbr: ['ÐÑ', 'Ðн', 'ÐÑ', 'СÑ', 'ЧÑ', 'ÐÑ', 'Сб'], 17552 17553 // Culture's date order: DD.MM.YYYY 17554 dateOrder: ['date', 'month', 'year'], 17555 shortDate: '%d.%m.%Y', 17556 shortTime: '%H:%M', 17557 AM: 'AM', 17558 PM: 'PM', 17559 firstDayOfWeek: 1, 17560 17561 // Date.Extras 17562 ordinal: '', 17563 17564 lessThanMinuteAgo: 'менÑÑе минÑÑÑ Ð½Ð°Ð·Ð°Ð´', 17565 minuteAgo: 'минÑÑÑ Ð½Ð°Ð·Ð°Ð´', 17566 minutesAgo: function(delta){ return '{delta} ' + pluralize(delta, 'минÑÑÑ', 'минÑÑÑ', 'минÑÑ') + ' назад'; }, 17567 hourAgo: 'ÑÐ°Ñ Ð½Ð°Ð·Ð°Ð´', 17568 hoursAgo: function(delta){ return '{delta} ' + pluralize(delta, 'ÑаÑ', 'ÑаÑа', 'ÑаÑов') + ' назад'; }, 17569 dayAgo: 'вÑеÑа', 17570 daysAgo: function(delta){ return '{delta} ' + pluralize(delta, 'денÑ', 'днÑ', 'дней') + ' назад'; }, 17571 weekAgo: 'Ð½ÐµÐ´ÐµÐ»Ñ Ð½Ð°Ð·Ð°Ð´', 17572 weeksAgo: function(delta){ return '{delta} ' + pluralize(delta, 'неделÑ', 'недели', 'неделÑ') + ' назад'; }, 17573 monthAgo: 'меÑÑÑ Ð½Ð°Ð·Ð°Ð´', 17574 monthsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'меÑÑÑ', 'меÑÑÑа', 'меÑеÑев') + ' назад'; }, 17575 yearAgo: 'год назад', 17576 yearsAgo: function(delta){ return '{delta} ' + pluralize(delta, 'год', 'года', 'леÑ') + ' назад'; }, 17577 17578 lessThanMinuteUntil: 'менÑÑе Ñем ÑеÑез минÑÑÑ', 17579 minuteUntil: 'ÑеÑез минÑÑÑ', 17580 minutesUntil: function(delta){ return 'ÑеÑез {delta} ' + pluralize(delta, 'ÑаÑ', 'ÑаÑа', 'ÑаÑов') + ''; }, 17581 hourUntil: 'ÑеÑез ÑаÑ', 17582 hoursUntil: function(delta){ return 'ÑеÑез {delta} ' + pluralize(delta, 'ÑаÑ', 'ÑаÑа', 'ÑаÑов') + ''; }, 17583 dayUntil: 'завÑÑа', 17584 daysUntil: function(delta){ return 'ÑеÑез {delta} ' + pluralize(delta, 'денÑ', 'днÑ', 'дней') + ''; }, 17585 weekUntil: 'ÑеÑез неделÑ', 17586 weeksUntil: function(delta){ return 'ÑеÑез {delta} ' + pluralize(delta, 'неделÑ', 'недели', 'неделÑ') + ''; }, 17587 monthUntil: 'ÑеÑез меÑÑÑ', 17588 monthsUntil: function(delta){ return 'ÑеÑез {delta} ' + pluralize(delta, 'меÑÑÑ', 'меÑÑÑа', 'меÑеÑев') + ''; }, 17589 yearUntil: 'ÑеÑез', 17590 yearsUntil: function(delta){ return 'ÑеÑез {delta} ' + pluralize(delta, 'год', 'года', 'леÑ') + ''; } 17591 17592}); 17593 17594//<1.2compat> 17595 17596Locale.define('ru-RU-unicode').inherit('ru-RU', 'Date'); 17597 17598//</1.2compat> 17599 17600})(); 17601 17602 17603/* 17604--- 17605 17606name: Locale.ru-RU-unicode.Form.Validator 17607 17608description: Form Validator messages for Russian (utf-8). 17609 17610license: MIT-style license 17611 17612authors: 17613 - Chernodarov Egor 17614 17615requires: 17616 - /Locale 17617 17618provides: [Locale.ru-RU.Form.Validator] 17619 17620... 17621*/ 17622 17623Locale.define('ru-RU', 'FormValidator', { 17624 17625 required: 'ÐÑо поле обÑзаÑелÑно к заполнениÑ.', 17626 minLength: 'ÐожалÑйÑÑа, введиÑе Ñ Ð¾ÑÑ Ð±Ñ {minLength} Ñимволов (ÐÑ Ð²Ð²ÐµÐ»Ð¸ {length}).', 17627 maxLength: 'ÐожалÑйÑÑа, введиÑе не болÑÑе {maxLength} Ñимволов (ÐÑ Ð²Ð²ÐµÐ»Ð¸ {length}).', 17628 integer: 'ÐожалÑйÑÑа, введиÑе в ÑÑо поле ÑиÑло. ÐÑобнÑе ÑиÑла (напÑÐ¸Ð¼ÐµÑ 1.25) ÑÑÑ Ð½Ðµ ÑазÑеÑенÑ.', 17629 numeric: 'ÐожалÑйÑÑа, введиÑе в ÑÑо поле ÑиÑло (напÑÐ¸Ð¼ÐµÑ "1" или "1.1", или "-1", или "-1.1").', 17630 digits: 'Ð ÑÑом поле ÐÑ Ð¼Ð¾Ð¶ÐµÑе иÑполÑзоваÑÑ ÑолÑко ÑиÑÑÑ Ð¸ знаки пÑнкÑÑаÑии (напÑимеÑ, ÑелеÑоннÑй Ð½Ð¾Ð¼ÐµÑ Ñо знаками деÑиÑа или Ñ ÑоÑками).', 17631 alpha: 'Ð ÑÑом поле можно иÑполÑзоваÑÑ ÑолÑко лаÑинÑкие бÑÐºÐ²Ñ (a-z). ÐÑÐ¾Ð±ÐµÐ»Ñ Ð¸ дÑÑгие ÑÐ¸Ð¼Ð²Ð¾Ð»Ñ Ð·Ð°Ð¿ÑеÑенÑ.', 17632 alphanum: 'Ð ÑÑом поле можно иÑполÑзоваÑÑ ÑолÑко лаÑинÑкие бÑÐºÐ²Ñ (a-z) и ÑиÑÑÑ (0-9). ÐÑÐ¾Ð±ÐµÐ»Ñ Ð¸ дÑÑгие ÑÐ¸Ð¼Ð²Ð¾Ð»Ñ Ð·Ð°Ð¿ÑеÑенÑ.', 17633 dateSuchAs: 'ÐожалÑйÑÑа, введиÑе коÑÑекÑнÑÑ Ð´Ð°ÑÑ {date}', 17634 dateInFormatMDY: 'ÐожалÑйÑÑа, введиÑе даÑÑ Ð² ÑоÑмаÑе ÐÐ/ÐÐ/ÐÐÐÐ (напÑÐ¸Ð¼ÐµÑ "12/31/1999")', 17635 email: 'ÐожалÑйÑÑа, введиÑе коÑÑекÑнÑй емейл-адÑеÑ. ÐÐ»Ñ Ð¿ÑимеÑа "[email protected]".', 17636 url: 'ÐожалÑйÑÑа, введиÑе пÑавилÑнÑÑ ÑÑÑÐ»ÐºÑ Ð²Ð¸Ð´Ð° http://www.example.com.', 17637 currencyDollar: 'ÐожалÑйÑÑа, введиÑе ÑÑÐ¼Ð¼Ñ Ð² доллаÑÐ°Ñ . ÐапÑимеÑ: $100.00 .', 17638 oneRequired: 'ÐожалÑйÑÑа, вÑбеÑиÑе Ñ Ð¾ÑÑ ÑÑо-нибÑÐ´Ñ Ð² одном из ÑÑÐ¸Ñ Ð¿Ð¾Ð»ÐµÐ¹.', 17639 errorPrefix: 'ÐÑибка: ', 17640 warningPrefix: 'Ðнимание: ' 17641 17642}); 17643 17644//<1.2compat> 17645 17646Locale.define('ru-RU-unicode').inherit('ru-RU', 'FormValidator'); 17647 17648//</1.2compat> 17649 17650 17651 17652var Collapsible=new Class({Extends:Fx.Reveal,initialize:function(t,i,e){this.clicker=document.id(t),this.section=document.id(i),this.parent(this.section,e),this.boundtoggle=this.toggle.bind(this),this.attach()},attach:function(){this.clicker.addEvent("click",this.boundtoggle)},detach:function(){this.clicker.removeEvent("click",this.boundtoggle)}}),Collapsable=Collapsible,Clientcide={version:"3.0.10",assetLocation:"/salsa_javascripts/clientcide_assets",setAssetLocation:function(t){Clientcide.assetLocation=t,Clientcide.preloaded&&Clientcide.preLoadCss()},preLoadCss:function(){return window.StickyWin&&StickyWin.ui&&StickyWin.ui(),window.StickyWin&&StickyWin.pointy&&StickyWin.pointy(),Clientcide.preloaded=!0},preloaded:!1};!function(){var t;window.addEvent&&(t=function(){window.dbug&&dbug.log("preloading clientcide css"),Clientcide.preloaded||Clientcide.preLoadCss()},window.addEvent("domready",t),window.addEvent("load",t))}(),setCNETAssetBaseHref=Clientcide.setAssetLocation;var value,debugCookie,MooScroller=new Class({Implements:[Options,Events],options:{maxThumbSize:10,mode:"vertical",width:0,scrollSteps:10,wheel:!0,scrollLinks:{forward:"scrollForward",back:"scrollBack"},hideWhenNoOverflow:!0},initialize:function(t,i,e){this.setOptions(e),this.horz="horizontal"==this.options.mode,this.content=document.id(t).setStyle("overflow","hidden"),this.knob=document.id(i),this.track=this.knob.getParent(),this.setPositions(),this.horz&&this.options.width&&(this.wrapper=new Element("div"),this.content.getChildren().each(function(t){this.wrapper.adopt(t)},this),this.wrapper.inject(this.content).setStyle("width",this.options.width)),this.bound={start:this.start.bind(this),end:this.end.bind(this),drag:this.drag.bind(this),wheel:this.wheel.bind(this),page:this.page.bind(this)},this.position={},this.mouse={},this.update(),this.attach(),this.clearScroll=function(){clearInterval(this.scrolling)}.bind(this),["forward","back"].each(function(t){var i=document.id(this.options.scrollLinks[t]);i&&i.addEvents({mousedown:function(){this.scrolling=this[t].peri
17652odical(50,this)}.bind(this),mouseup:this.clearScroll.bind(this),click:this.clearScroll.bind(this)})},this),this.knob.addEvent("click",this.clearScroll.bind(this)),window.addEvent("domready",function(){try{document.id(document.body).addEvent("mouseup",this.clearScroll)}catch(t){}}.bind(this))},setPositions:function(){[this.track,this.knob].each(function(t){"static"==t.getStyle("position")&&t.setStyle("position","relative")})},toElement:function(){return this.content},update:function(){var t=this.horz?"Width":"Height";this.contentSize=this.content["offset"+t],this.contentScrollSize=this.content["scroll"+t],this.trackSize=this.track["offset"+t],this.contentRatio=this.contentSize/this.contentScrollSize,this.knobSize=(this.trackSize*this.contentRatio).limit(this.options.maxThumbSize,this.trackSize),this.options.hideWhenNoOverflow&&(this.hidden=this.knobSize==this.trackSize,this.track.setStyle("opacity",this.hidden?0:1)),this.scrollRatio=this.contentScrollSize/this.trackSize,this.knob.setStyle(t.toLowerCase(),this.knobSize),this.updateThumbFromContentScroll(),this.updateContentFromThumbPosition()},updateContentFromThumbPosition:function(){this.content[this.horz?"scrollLeft":"scrollTop"]=this.position.now*this.scrollRatio},updateThumbFromContentScroll:function(){this.position.now=(this.content[this.horz?"scrollLeft":"scrollTop"]/this.scrollRatio).limit(0,this.trackSize-this.knobSize),this.knob.setStyle(this.horz?"left":"top",this.position.now)},attach:function(){this.knob.addEvent("mousedown",this.bound.start),this.options.wheel&&(this.content.addEvent("mousewheel",this.bound.wheel),this.track.addEvent("mousewheel",this.bound.wheel)),this.track.addEvent("mouseup",this.bound.page)},detach:function(){this.knob.removeEvent("mousedown",this.bound.start),this.options.wheel&&(this.content.removeEvent("mousewheel",this.bound.wheel),this.track.removeEvent("mousewheel",this.bound.wheel)),this.track.removeEvent("mouseup",this.bound.page),document.id(document.body).removeEvent("mouseup",this.clearScroll)},wheel:function(t){this.hidden||(this.scroll(-(t.wheel*this.options.scrollSteps)),this.updateThumbFromContentScroll(),t.stop())},scroll:function(t){t=t||this.options.scrollSteps,this.content[this.horz?"scrollLeft":"scrollTop"]+=t,this.updateThumbFromContentScroll(),this.fireEvent("onScroll",t)},forward:function(t){this.scroll(t)},back:function(t){t=t||this.options.scrollSteps,this.scroll(-t)},page:function(t){var i=this.horz?"x":"y",i=t.page[i]>this.knob.getPosition()[i];this.scroll((i?1:-1)*this.content["offset"+(this.horz?"Width":"Height")]),this.updateThumbFromContentScroll(),this.fireEvent("onPage",i),t.stop()},start:function(t){var i=this.horz?"x":"y";this.mouse.start=t.page[i],this.position.start=this.knob.getStyle(this.horz?"left":"top").toInt(),document.addEvent("mousemove",this.bound.drag),document.addEvent("mouseup",this.bound.end),this.knob.addEvent("mouseup",this.bound.end),t.stop()},end:function(t){document.removeEvent("mousemove",this.bound.drag),document.removeEvent("mouseup",this.bound.end),this.knob.removeEvent("mouseup",this.bound.end),t.stop()},drag:function(t){var i=this.horz?"x":"y";this.mouse.now=t.page[i],this.position.now=(this.position.start+(this.mouse.now-this.mouse.start)).limit(0,this.trackSize-this.knobSize),this.updateContentFromThumbPosition(),this.updateThumbFromContentScroll(),t.stop()}}),MultipleOpenAccordion=new Class({Implements:[Options,Events,Chain],options:{togglers:[],elements:[],openAll:!1,firstElementsOpen:[0],fixedHeight:null,fixedWidth:null,height:!0,opacity:!0,width:!1},togglers:[],elements:[],initialize:function(t){var i=Array.link(arguments,{options:Type.isObject,elements:Type.isElements});this.setOptions(i.options),elements=$$(this.options.elements),$$(this.options.togglers).each(function(t,i){this.addSection(t,elements[i],i)},this),this.togglers.length&&(this.options.openAll?this.showAll():this.toggleSections(this.options.firstElementsOpen,!1,!0)),this.openSections=this.showSections.bind(this),this.closeSections=this.hideSections.bind(this)},addSection:function(t,i){t=document.id(t),i=document.id(i);this.togglers.contains(t),this.togglers.length;this.togglers.include(t),this.elements.include(i);var e=this.togglers.indexOf(t),e=this.toggleSection.bind(this,e);return t.addEvent("click",e).store("multipleOpenAccordion:display",e),e=this.options.height&&this.options.width?"both":this.options.height?"vertical":"horizontal",i.store("moa:reveal",new Fx.Reveal(i,{transitionOpacity:this.options.opacity,mode:e,heightOverride:this.options.fixedHeight,widthOverride:this.options.fixedWidth})),this},removeSection:function(t){var i=this.togglers.indexOf(t),i=this.elements[i];
17652return i.dissolve(),this.togglers.erase(t),this.elements.erase(i),this.detach(t),this},detach:function(t){var i=function(t){t.removeEvent(this.options.trigger,t.retrieve("multipleOpenAccordion:display"))}.bind(this);return t?i(t):this.togglers.each(i),this},onComplete:function(t,i){return this.fireEvent(this.elements[t].isDisplayed()?"onActive":"onBackground",[this.togglers[t],this.elements[t]]),this.callChain(),this},showSection:function(t,i){this.toggleSection(t,i,!0)},hideSection:function(t,i){this.toggleSection(t,i,!1)},toggleSection:function(t,i,e,s){var n=e?"reveal":null!=e?"dissolve":"toggle";s=[s,!0].pick();e=this.elements[t];return null==i||i?e.retrieve("moa:reveal")[n]().chain(this.onComplete.bind(this,t,s)):("toggle"==n?e.toggle():e["reveal"==n?"show":"hide"](),this.onComplete(t,s)),this},toggleAll:function(e,s){var n=this.elements.getLast();return this.elements.each(function(t,i){this.toggleSection(i,e,s,t==n)},this),this},toggleSections:function(e,s,n){return last=e.getLast(),this.elements.each(function(t,i){this.toggleSection(i,s,e.contains(i)?n:!n,i==last)},this),this},showSections:function(t,i){t.each(function(t){this.showSection(t,i)},this)},hideSections:function(t,i){t.each(function(t){this.hideSection(t,i)},this)},showAll:function(t){return this.toggleAll(t,!0)},hideAll:function(t){return this.toggleAll(t,!1)}}),dbug={logged:[],timers:{},firebug:!1,enabled:!1,log:function(){dbug.logged.push(arguments)},nolog:function(t){dbug.logged.push(arguments)},time:function(t){dbug.timers[t]=(new Date).getTime()},timeEnd:function(t){var i;dbug.timers[t]?(i=(new Date).getTime()-dbug.timers[t],dbug.timers[t]=!1,dbug.log("%s: %s",t,i)):dbug.log("no such timer: %s",t)},enable:function(t){var i=window.firebug?firebug.d.console.cmd:window.console;if(window.console&&window.console.warn||window.firebug)try{dbug.enabled=!0,dbug.log=function(){try{(i.debug||i.log).apply(i,arguments)}catch(t){console.log(Array.slice(arguments))}},dbug.time=function(){i.time.apply(i,arguments)},dbug.timeEnd=function(){i.timeEnd.apply(i,arguments)},t||dbug.log("enabling dbug");for(var e=0;e<dbug.logged.length;e++)dbug.log.apply(i,dbug.logged[e]);dbug.logged=[]}catch(t){dbug.enable.delay(400)}},disable:function(){dbug.firebug&&(dbug.enabled=!1),dbug.log=dbug.nolog,dbug.time=function(){},dbug.timeEnd=function(){}},cookie:function(t){var i=document.cookie.match("(?:^|;)\\s*jsdebug=([^;]*)"),i=!!i&&unescape(i[1]);null==t&&"true"!=i||null!=t&&t?(dbug.enable(),dbug.log("setting debugging cookie"),(t=new Date).setTime(t.getTime()+864e5),document.cookie="jsdebug=true;expires="+t.toGMTString()+";path=/;"):dbug.disableCookie()},disableCookie:function(){dbug.log("disabling debugging cookie"),document.cookie="jsdebug=false;path=/;"},conditional:function(t,i){if(dbug.enabled)return t();try{return t()}catch(t){i&&i(t)}}};!function(){var n=!!window.console||!!window.firebug,o=window.firebug?window.firebug.d.console.cmd:window.console;function t(t,i){for(var e=0;e<t.length;e++){var s=t[e];n&&o[s]?dbug[s]=function(t){return function(){o[t].apply(o,arguments)}}(s):dbug[s]=i}}t(["debug","info","warn","error","assert","dir","dirxml"],dbug.log),t(["trace","group","groupEnd","profile","profileEnd","count"],function(){})}(),(window.console&&window.console.warn||window.firebug)&&(dbug.firebug=!0,debugCookie=!!(value=document.cookie.match("(?:^|;)\\s*jsdebug=([^;]*)"))&&unescape(value[1]),(0<window.location.href.indexOf("jsdebug=true")||"true"==debugCookie)&&dbug.enable(),"true"==debugCookie&&dbug.log("debugging cookie enabled"),0<window.location.href.indexOf("jsdebugCookie=true")&&(dbug.cookie(),dbug.enabled||dbug.enable()),0<window.location.href.indexOf("jsdebugCookie=false")&&dbug.disableCookie());var StyleWriter=new Class({createStyle:function(i,e){window.addEvent("domready",function(){try{if(document.id(e)&&e)return;var t=new Element("style",{id:e||""}).inject($$("head")[0]);Browser.ie?t.styleSheet.cssText=i:t.set("text",i)}catch(t){dbug.log("error: %s",t)}}.bind(this))}}),StickyWin=new Class({Binds:["destroy","hide","togglepin","esc"],Implements:[Options,Events,StyleWriter],options:{closeClassName:"closeSticky",pinClassName:"pinSticky",content:"",zIndex:1e4,className:"",width:!1,height:!1,timeout:-1,allowMultipleByClass:!0,allowMultiple:!0,showNow:!0,useIframeShim:!0,iframeShimSelector:"",destroyOnClose:!1,closeOnClickOut:!1,closeOnEsc:!1,getWindowManager:function(){return StickyWin.WM}},css:'.SWclearfix:after {content: "."; display: block; height: 0; clear: both; visibility: hidden;}.SWclearfix {display: inline-table;} * html .SWclearfix {height: 1%;} .SWclearfix {display: block;}',initialize:function(t){this.options.inject=this.options.inject||{target:document.body,where:"bottom"},this.setOptions(t),this.windowManager=this.options.getWindowManager(),this.id=this.options.id||"StickyWin_"+(new Date).getTime(),this.makeWindow(),this.windowManager&&this.windowManager.add(this),this.options.content&&this.setContent(this.options.content),0<this.options.timeout&&this.addEvent("onDisplay",function(){this.hide.delay(this.options.timeout,this)}.bind(this)),this.createStyle(this.css,"StickyWinClearFix"),(this.options.closeOnClickOut||this.options.closeOnEsc)&&this.attach(),this.options.destroyOnClose&&this.addEvent("close",this.destroy),this.options.showNow&&this.show()},toElement:function(){return this.element},attach:function(t){var i=t?"removeEvents":"addEvents",t={};this.options.closeOnClickOut&&(t.click=this.esc),this.options.closeOnEsc&&(t.keyup=this.esc),document[i](t)},esc:function(t){"esc"==t.key&&this.hide(),"click"!=t.type||this.element==t.target||this.element.contains(t.target)||this.hide()},makeWindow:function(){return this.destroyOthers(),document.id(this.id)?this.win=document.id(this.id):this.win=new Element("div",{id:this.id}).addClass(this.options.className).addClass("StickyWinInstance").addClass("SWclearfix").setStyles({display:"none",position:"absolute",zIndex:this.options.zIndex}).inject(this.options.inject.target,this.options.inject.where).store("StickyWin",this),this.element=this.win,this.options.width&&"number"==typeOf(this.options.width.toInt())&&this.win.setStyle("width",this.options.width.toInt()),this.options.height&&"number"==typeOf(this.options.height.toInt())&&this.win.setStyle("height",this.options.height.toInt()),this},show:function(t){return this.showWin(),t||this.fireEvent("display"),this.options.useIframeShim&&this.showIframeShim(),this.visible=!0,this},showWin:function(){this.windowManager&&this.windowManager.focus(this),this.positioned||this.position(),this.win.show()},hide:function(t){return"event"!=typeOf(t)&&t||this.fireEvent("close"),this.hideWin(),this.options.useIframeShim&&this.hideIframeShim(),this.visible=!1,this},hideWin:function(){this.win.setStyle("display","none")},destroyOthers:function(){this.options.allowMultipleByClass&&this.options.allowMultiple||$$("div.StickyWinInstance").each(function(t){this.options.allowMultiple&&(this.options.allowMultipleByClass||!t.hasClass(this.options.className))||t.retrieve("StickyWin").destroy()},this)},setContent:function(t){return 0<this.win.getChildren().length&&this.win.empty(),"string"==typeOf(t)?this.win.set("html",t):document.id(t)&&this.win.adopt(t),this.win.getElements("."+this.options.closeClassName).each(function(t){t.addEvent("click",this.hide)},this),this.win.getElements("."+this.options.pinClassName).each(function(t){t.addEvent("click",this.togglepin)},this),this},position:function(t){return this.positioned=!0,this.setOptions(t),this.win.position(Object.cleanValues({allowNegative:[this.options.allowNegative,this.options.relativeTo!=document.body].pick(),relativeTo:this.options.relativeTo,position:this.options.position,offset:this.options.offset,edge:this.options.edge})),this.shim&&this.shim.position(),this},pin:function(t){return this.win.pin?(this.pinned=null!=t&&t,this.win.pin(t)):dbug.log("you must include element.pin.js!"),this},unpin:function(){return this.pin(!1)},togglepin:function(){return this.pin(!this.pinned)},makeIframeShim:function(){var t;this.shim||(t=this.options.iframeShimSelector?this.win.getElement(this.options.iframeShimSelector):this.win,this.shim=new IframeShim(t,{display:!1,name:"StickyWinShim"}))},showIframeShim:function(){this.options.useIframeShim&&(this.makeIframeShim(),this.shim.show())},hideIframeShim:function(){this.shim&&this.shim.hide()},destroy:function(){this.destroyed=!0,this.attach(!0),this.windowManager&&this.windowManager.remove(this),this.win&&this.win.destroy(),this.options.useIframeShim&&this.shim&&this.shim.destroy(),document.id("modalOverlay")&&document.id("modalOverlay").destroy(),this.fireEvent("destroy")}});StickyWin.Stacker=new Class({Implements:[Options,Events],Binds:["click"],instances:[],options:{zIndexBase:9e3},initialize:function(t){this.setOptions(t)},add:function(t){this.instances.include(t),$(t).addEvent("mousedown",this.click)},click:function(e){this.instances.each(function(t){var i=$(t);i!=e.target&&!i.contains($(e.target))||this.focus(t)},this)},focus:function(t){this.focused!=t&&((this.focused=t)&&this.instances.erase(t).push(t),this.instances.each(function(t,i){$(t).setStyle("z-index",this.options.zIndexBase+i)},this),this.focused=t)},remove:function(t){this.instances.erase(t),$(t).removeEvent("click",this.click)}}),StickyWin.WM=new StickyWin.Stacker,StickyWin.UI=new Class({Implements:[Options,StyleWriter],options:{width:300,css:"div.DefaultStickyWin {font-family:verdana; font-size:11px; line-height: 13px;position: relative;}div.DefaultStickyWin div.top{-moz-user-select: none;-khtml-user-select: none;}div.DefaultStickyWin div.top_ul{background:url({%baseHref%}full.png) top left no-repeat; height:30px; width:15px; float:left}div.DefaultStickyWin div.top_ur{position:relative; left:0px !important; left:-4px; background:url({%baseHref%}full.png) top right !important; height:30px; margin:0px 0px 0px 15px !important; margin-right:-4px; padding:0px}div.DefaultStickyWin h1.caption{clear: none !important; margin:0px !important; overflow: hidden; padding:0 !important; font-weight:bold; color:#555; font-size:14px !important; position:relative; top:8px !important; left:5px !important; float: left; height: 22px !important;}div.DefaultStickyWin div.middle, div.DefaultStickyWin div.closeBody {background:url({%baseHref%}body.png) top left repeat-y; margin:0px 20px 0px 0px !important;\tmargin-bottom: -3px; position: relative;
17652\ttop: 0px !important; top: -3px;}div.DefaultStickyWin div.body{background:url({%baseHref%}body.png) top right repeat-y; padding:8px 23px 8px 0px !important; margin-left:5px !important; position:relative; right:-20px !important; z-index: 1;}div.DefaultStickyWin div.bottom{clear:both;}div.DefaultStickyWin div.bottom_ll{background:url({%baseHref%}full.png) bottom left no-repeat; width:15px; height:15px; float:left}div.DefaultStickyWin div.bottom_lr{background:url({%baseHref%}full.png) bottom right; position:relative; left:0px !important; left:-4px; margin:0px 0px 0px 15px !important; margin-right:-4px; height:15px}div.DefaultStickyWin div.closeButtons{text-align: center; background:url({%baseHref%}body.png) top right repeat-y; padding: 4px 30px 8px 0px; margin-left:5px; position:relative; right:-20px}div.DefaultStickyWin a.button:hover{background:url({%baseHref%}big_button_over.gif) repeat-x}div.DefaultStickyWin a.button {background:url({%baseHref%}big_button.gif) repeat-x; margin: 2px 8px 2px 8px; padding: 2px 12px; cursor:pointer; border: 1px solid #999 !important; text-decoration:none; color: #000 !important;}div.DefaultStickyWin div.closeButton{width:13px; height:13px; background:url({%baseHref%}closebtn.gif) no-repeat; position: absolute; right: 0px; margin:10px 15px 0px 0px !important; cursor:pointer;top:0px}div.DefaultStickyWin div.dragHandle {\twidth: 11px;\theight: 25px;\tposition: relative;\ttop: 5px;\tleft: -3px;\tcursor: move;\tbackground: url({%baseHref%}drag_corner.gif); float: left;}",cornerHandle:!1,cssClass:"",buttons:[],cssId:"defaultStickyWinStyle",cssClassName:"DefaultStickyWin",closeButton:!0},initialize:function(){var t=this.getArgs(arguments);this.setOptions(t.options),this.legacy();var i=this.options.css.substitute({baseHref:this.options.baseHref||Clientcide.assetLocation+"/stickyWinHTML/"},/\\?\{%([^}]+)%\}/g);Browser.ie&&(i=i.replace(/png/g,"gif")),this.createStyle(i,this.options.cssId),this.build(),(t.caption||t.body)&&this.setContent(t.caption,t.body)},toElement:function(){return this.element},getArgs:function(){return StickyWin.UI.getArgs.apply(this,arguments)},legacy:function(){var t=this.options;t.confirmTxt&&t.buttons.push({text:t.confirmTxt,onClick:t.onConfirm||function(){}}),t.closeTxt&&t.buttons.push({text:t.closeTxt,onClick:t.onClose||function(){}})},build:function(){var t=this.options,i=new Element("div",{class:t.cssClassName});t.width&&i.setStyle("width",t.width),this.element=i,this.element.store("StickyWinUI",this),t.cssClass&&i.addClass(t.cssClass);var e=new Element("div").addClass("body");this.body=e;var s,n=new Element("div").addClass("top_ur");return this.top_ur=n,this.top=new Element("div").addClass("top").adopt(new Element("div").addClass("top_ul")).adopt(n),i.adopt(this.top),t.cornerHandle&&new Element("div").addClass("dragHandle").inject(n,"top"),i.adopt(new Element("div").addClass("middle").adopt(e)),0<t.buttons.length&&(s=new Element("div").addClass("closeButtons"),t.buttons.each(function(t){t.properties&&t.properties.className&&(t.properties.class=t.properties.className,delete t.properties.className);var i=Object.merge({class:"closeSticky"},t.properties);new Element("a").addEvent("click",t.onClick||function(){}).appendText(t.text).inject(s).set(i).addClass("button")}),i.adopt(new Element("div").addClass("closeBody").adopt(s))),i.adopt(new Element("div").addClass("bottom").adopt(new Element("div").addClass("bottom_ll")).adopt(new Element("div").addClass("bottom_lr"))),this.options.closeButton&&i.adopt(new Element("div").addClass("closeButton").addClass("closeSticky")),this},setCaption:function(t){return this.caption=t,this.h1?document.id(t)?this.h1.adopt(t):this.h1.set("html",t):this.makeCaption(t),this},makeCaption:function(t){if(!t)return this.destroyCaption();var i=this.options;return this.h1=new Element("h1").addClass("caption"),i.width&&this.h1.setStyle("width",i.width.toInt()-(i.cornerHandle?55:40)-(i.closeButton?10:0)),this.setCaption(t),this.top_ur.adopt(this.h1),this.options.cornerHandle||this.h1.addClass("dragHandle"),this},destroyCaption:function(){return this.h1&&(this.h1.destroy(),this.h1=null),this},setContent:function(){var t=this.getArgs.apply(this,arguments),i=t.caption,t=t.body;return this.setCaption(i),document.id(t)?this.body.empty().adopt(t):this.body.set("html",t),this}}),StickyWin.UI.getArgs=function(){var t="arguments"==typeOf(arguments[0])?arguments[0]:arguments;Browser.opera&&1===t.length&&(t=t[0]);var i=t[0],e=t[1],s=Array.link(t,{options:Type.isObject});return 3==t.length||!s.options&&2==t.length?(s.caption=i,s.body=e):"object"!=typeOf(e)&&e||!i||"object"==typeOf(i)||(s.body=i),s},StickyWin.ui=function(t,i,e){return document.id(new StickyWin.UI(t,i,e))},(StickyWin=Class.refactor(StickyWin,{options:{draggable:!1,dragOptions:{onComplete:function(){}},dragHandleSelector:".dragHandle",resizable:!1,resizeOptions:{onComplete:function(){}},resizeHandleSelector:""},setContent:function(){return this.previous.apply(this,arguments),this.options.draggable&&this.makeDraggable(),this.options.resizable&&this.makeResizable(),this},makeDraggable:function(){var t,i,e=this.toggleVisible(!0);this.options.useIframeShim&&(this.makeIframeShim(),t=this.options.dragOptions.onComplete,this.options.dragOptions.onComplete=function(){t(),this.shim.position()}.bind(this)),!this.options.dragHandleSelector||(i=this.win.getElement(this.options.dragHandleSelector))&&(i.setStyle("cursor","move"),this.options.dragOptions.handle=i),this.win.makeDraggable(this.options.dragOptions),e&&this.toggleVisible(!1)},makeResizable:function(){var t,i=this.toggleVisible(!0);this.options.useIframeShim&&(this.makeIframeShim(),t=this.options.resizeOptions.onComplete,this.options.resizeOptions.onComplete=function(){t(),this.shim.position()}.bind(this)),this.options.resizeHandleSelector&&this.win.getElement(this.options.resizeHandleSelector)&&(this.options.resizeOptions.handle=this.win.getElement(this.options.resizeHandleSelector)),this.win.makeResizable(this.options.resizeOptions),i&&this.toggleVisible(!1)},toggleVisible:function(t){return!this.visible&&null==t||t?(this.win.setStyles({display:"block",opacity:0}
17652),!0):(null==t||t||this.win.setStyles({display:"none",opacity:1}),!1)}})).Fx=StickyWin,Fx.Marquee=new Class({Extends:Fx.Morph,options:{mode:"horizontal",message:"",revert:!0,delay:5e3,cssClass:"msg",showEffect:{opacity:1},hideEffect:{opacity:0},revertEffect:{opacity:[0,1]},currentMessage:null},initialize:function(t,i){t=document.id(t);var e=this.options.currentMessage||1==t.getChildren().length?t.getFirst():"",t=new Element("div",{styles:{position:"relative"},class:"fxMarqueeWrapper"}).inject(t);this.parent(t,i),this.current=this.wrapMessage(e)},wrapMessage:function(t){var i;return document.id(t)&&document.id(t).hasClass("fxMarquee")?i=document.id(t):(i=new Element("span",{class:"fxMarquee",styles:{position:"relative"}}),document.id(t)?i.grab(document.id(t)):"string"==typeOf(t)&&i.set("html",t)),i.inject(this.element)},announce:function(t){return this.setOptions(t).showMessage(),this},showMessage:function(i){return function(){var t=this.$chain?Array.clone(this.$chain):[];this.clearChain(),this.element=document.id(this.element),this.current=document.id(this.current),this.message=document.id(this.message),this.start(this.options.hideEffect).chain(function(){i?(this.message.hide(),this.current&&this.current.show()):(this.message&&this.message.dispose(),this.message=this.wrapMessage(this.options.message),this.current&&this.current.hide()),this.start(i?this.options.revertEffect:this.options.showEffect).chain(function(){this.$chain?this.$chain.combine(t):this.$chain=t,this.fireEvent(i?"onRevert":"onMessage"),!i&&this.options.revert?this.showMessage(!0):this.callChain.delay(this.options.delay,this)}.bind(this))}.bind(this))}.delay(i?this.options.delay:10,this),this}}),StickyWin.UI.Pointy=new Class({Extends:StickyWin.UI,options:{theme:"dark",themes:{dark:{bgColor:"#333",fgColor:"#ddd",imgset:"dark"},light:{bgColor:"#ccc",fgColor:"#333",imgset:"light"}},css:"div.DefaultPointyTip {vertical-align: auto; position: relative;}div.DefaultPointyTip * {text-align:left !important}div.DefaultPointyTip .pointyWrapper div.body{background: {%bgColor%}; color: {%fgColor%}; left: 0px; right: 0px !important;padding: 0px 10px !important;margin-left: 0px !important;font-family: verdana;font-size: 11px;line-height: 13px;position: relative;}div.DefaultPointyTip .pointyWrapper div.top {position: relative;height: 25px; overflow: visible;}div.DefaultPointyTip .pointyWrapper div.top_ul{background: url({%baseHref%}{%imgset%}_back.png) top left no-repeat;width: 8px;height: 25px; position: absolute; left: 0px;}div.DefaultPointyTip .pointyWrapper div.top_ur{background: url({%baseHref%}{%imgset%}_back.png) top right !important;margin: 0 0 0 8px !important;height: 25px;position: relative;left: 0px !important;padding: 0;}div.DefaultPointyTip .pointyWrapper h1.caption{color: {%fgColor%};left: 0px !important;top: 4px !important;clear: none !important;overflow: hidden;font-weight: 700;font-size: 12px !important;position: relative;float: left;height: 22px !important;margin: 0 !important;padding: 0 !important;}div.DefaultPointyTip .pointyWrapper div.middle, div.DefaultPointyTip .pointyWrapper div.closeBody{background: {%bgColor%};margin: 0 0px 0 0 !important;position: relative;top: 0 !important;}div.DefaultPointyTip .pointyWrapper div.middle {min-height: 16px; background: {%bgColor%};margin: 0 0px 0 0 !important;position: relative;top: 0 !important;}div.DefaultPointyTip .pointyWrapper div.bottom {clear: both; width: 100% !important; background: none; height: 6px} div.DefaultPointyTip .pointyWrapper div.bottom_ll{font-size:1; background: url({%baseHref%}{%imgset%}_back.png) bottom left no-repeat;width: 6px;height: 6px;position: absolute; left: 0px;}div.DefaultPointyTip .pointyWrapper div.bottom_lr{font-size:1; background: url({%baseHref%}{%imgset%}_back.png) bottom right;height: 6px;margin: 0 0 0 6px !important;position: relative;left: 0 !important;}div.DefaultPointyTip .pointyWrapper div.noCaption{ height: 6px; overflow: hidden}div.DefaultPointyTip .pointyWrapper div.closeButton{width:13px; height:13px; background:url({%baseHref%}{%imgset%}_x.png) no-repeat; position: absolute; right: 0px; margin:0px !important; cursor:pointer; z-index: 1; top: 4px;}div.DefaultPointyTip .pointyWrapper div.pointyDivot {background: url({%divot%}) no-repeat;}",divot:"{%baseHref%}{%imgset%}_divot.png",divotSize:22,direction:12,cssId:"defaultPointyTipStyle",cssClassName:"DefaultPointyTip"},initialize:function(){var t=this.getArgs(arguments);if(this.setOptions(t.options),Object.append(this.options,this.options.themes[this.options.theme]),this.options.baseHref=this.options.baseHref||Clientcide.assetLocation+"/PointyTip/",this.options.divot=this.options.divot.substitute(this.options,/\\?\{%([^}]+)%\}/g),Browser.ie&&(this.options.divot=this.options.divot.replace(/png/g,"gif")),this.options.css=this.options.css.substitute(this.options,/\\?\{%([^}]+)%\}/g),t.options&&t.options.theme){for(;!this.id;){var i=Number.random(0,999999999);StickyWin.UI.Pointy[i]||((StickyWin.UI.Pointy[i]=this).id=i)}this.options.css=this.options.css.replace(/div\.DefaultPointyTip/g,"div#pointy_"+this.id
17652),this.options.cssId="pointyTipStyle_"+this.id}"string"==typeOf(this.options.direction)&&(this.options.direction={left:9,right:3,up:12,down:6}[this.options.direction]),this.parent(t.caption,t.body,this.options),this.id&&document.id(this).set("id","pointy_"+this.id)},build:function(){this.parent();var t=this.options;this.pointyWrapper=new Element("div",{class:"pointyWrapper"}).inject(document.id(this)),document.id(this).getChildren().each(function(t){t!=this.pointyWrapper&&this.pointyWrapper.grab(t)},this);var i=t.divotSize,e=i;t.width.toInt(),t.divotSize;this.pointer=new Element("div",{styles:Object.append({width:i,height:e,overflow:"hidden"},function(){switch(t.direction){case 12:case 1:case 11:return{height:e/2};case 5:case 6:case 7:return{height:e/2,backgroundPosition:"0 -"+e/2+"px"};case 8:case 9:case 10:return{width:i/2};case 2:case 3:case 4:return{width:i/2,backgroundPosition:"100%"}}}()),class:"pointyDivot pointy_"+t.direction}).inject(this.pointyWrapper)},expose:function(){return"none"!=document.id(this).getStyle("display")&&document.body!=document.id(this)&&document.id(document.body).contains(document.id(this))?function(){}:(document.id(this).setStyles({visibility:"hidden",position:"absolute"}),document.body==document.id(this)||document.body.contains(document.id(this))||(document.id(this).inject(document.body),t=!0),function(){t&&document.id(this).dispose(),document.id(this).setStyles({visibility:"visible",position:"relative"})}.bind(this));var t},positionPointer:function(t){if(this.pointer){var i,e=t||this.options,s=e.direction;switch(s){case 12:case 1:case 11:i={edge:{x:"center",y:"bottom"},position:{x:12==s?"center":1==s?"right":"left",y:"top"},offset:{x:(12==s?0:1==s?-1:1)*e.divotSize,y:1}};break;case 2:case 3:case 4:i={edge:{x:"left",y:"center"},position:{x:"right",y:3==s?"center":2==s?"top":"bottom"},offset:{x:-1,y:(3==s?0:4==s?-1:1)*e.divotSize}};break;case 5:case 6:case 7:i={edge:{x:"center",y:"top"},position:{x:6==s?"center":5==s?"right":"left",y:"bottom"},offset:{x:(6==s?0:5==s?-1:1)*e.divotSize,y:-1}};break;case 8:case 9:case 10:i={edge:{x:"right",y:"center"},position:{x:"left",y:9==s?"center":10==s?"top":"bottom"},offset:{x:1,y:(9==s?0:8==s?-1:1)*e.divotSize}}}e=this.expose();this.pointer.position(Object.append({relativeTo:this.pointyWrapper,allowNegative:!0},i,t)),e()}},setContent:function(t,i){return this.parent(t,i),this.top[this.h1?"removeClass":"addClass"]("noCaption"),Browser.ie&&document.id(this).getElements(".bottom_ll, .bottom_lr").setStyle("font-size",1),this.options.closeButton&&this.body.setStyle("margin-right",6),this.positionPointer(),this},makeCaption:function(t){this.parent(t),this.options.width&&this.h1&&this.h1.setStyle("width",this.options.width.toInt()-(this.options.closeButton?25:15))}}),StickyWin.UI.pointy=function(t,i,e){return document.id(new StickyWin.UI.Pointy(t,i,e))},StickyWin.ui.pointy=StickyWin.UI.pointy,StickyWin.PointyTip=new Class({Extends:StickyWin,options:{point:"left",pointyOptions:{}},initialize:function(){var t=this.getArgs(arguments);this.setOptions(t.options);var i=this.options.pointyOptions,e=i.direction;e||(e=(e={left:9,right:3,up:12,down:6}[this.options.point])||this.options.point,i.direction=e),i.width||(i.width=this.options.width),this.pointy=new StickyWin.UI.Pointy(t.caption,t.body,i),this.options.content=null,this.setOptions(t.options,this.getPositionSettings()),this.parent(this.options),this.win.empty().adopt(document.id(this.pointy)),this.attachHandlers(this.win),this.options.showNow&&this.position()},getArgs:function(){return StickyWin.UI.getArgs.apply(this,arguments)},getPositionSettings:function(){var t=this.pointy.options.divotSize,i=this.options.point,e=this.options.offset||{};switch(i){case"left":case 8:case 9:case 10:return{edge:{x:"left",y:10==i?"top":8==i?"bottom":"center"},position:{x:"right",y:"center"},offset:{x:t+(e.x||0),y:e.y||0}};case"right":case 2:case 3:case 4:return{edge:{x:"right",y:(2==i?"top":4==i?"bottom":"center")+(e.y||0)},position:{x:"left",y:"center"},offset:{x:-t+(e.x||0),y:e.y||0}};case"up":case 11:case 12:case 1:return{edge:{x:11==i?"left":1==i?"right":"center",y:"top"},position:{x:"center",y:"bottom"},offset:{y:t+(e.y||0),x:(11==i?-t:1==i?t:0)+(e.x||0)}};
17652case"down":case 5:case 6:case 7:return{edge:{x:(7==i?"left":5==i?"right":"center")+(e.x||0),y:"bottom"},position:{x:"center",y:"top"},offset:{y:-t+(e.y||0),x:(7==i?-t:5==i?t:0)+(e.x||0)}}}},setContent:function(){var t=this.getArgs(arguments);return this.pointy.setContent(t.caption,t.body),[this.pointy.h1,this.pointy.body].each(this.attachHandlers,this),this.visible&&this.position(),this},showWin:function(){this.parent(),this.pointy.positionPointer()},position:function(t){this.parent(t),this.pointy.positionPointer()},attachHandlers:function(t){t&&(t.getElements("."+this.options.closeClassName).addEvent("click",function(){this.hide()}.bind(this)),t.getElements("."+this.options.pinClassName).addEvent("click",function(){this.togglepin()}.bind(this)))}}),Tips.Pointy=new Class({Extends:Tips,options:{onShow:function(t,i){i.show()},onHide:function(t,i){i.hide()},pointyTipOptions:{point:11,width:150,pointyOptions:{closeButton:!1}}},initialize:function(){var t=Array.link(arguments,{options:Type.isObject,elements:function(t){return null!=t}});this.setOptions(t.options),this.tip=new StickyWin.PointyTip(Object.append(this.options.pointyTipOptions,{showNow:!1})),this.options.className&&document.id(this.tip).addClass(this.options.className),t.elements&&this.attach(t.elements)},elementEnter:function(t,i){var e=i.retrieve("tip:title"),s=i.retrieve("tip:text");this.tip.setContent(e,s),this.timer=clearTimeout(this.timer),this.timer=this.show.delay(this.options.showDelay,this),this.position(i)},elementLeave:function(t){clearTimeout(this.timer),this.timer=this.hide.delay(this.options.hideDelay,this)},elementMove:function(t){},position:function(t){this.tip.setOptions({relativeTo:t}),this.tip.position()},show:function(){this.fireEvent("show",[document.id(this.tip),this.tip])},hide:function(){this.fireEvent("hide",[document.id(this.tip),this.tip])},destroy:function(){this.detach(),this.tip.destroy()}}),StickyWin.Modal=new Class({Extends:StickyWin,options:{modalize:!0,maskOptions:{style:{"background-color":"#333",opacity:.8}},hideOnClick:!0,getWindowManager:function(){return StickyWin.ModalWM}},initialize:function(t){this.options.maskTarget=this.options.maskTarget||document.body,this.setOptions(t),this.mask=new Mask(this.options.maskTarget,this.options.maskOptions).addEvent("click",function(){this.options.hideOnClick&&this.hide()}.bind(this)),this.parent(t)},show:function(t){[t,this.options.modalize].pick()&&this.mask.show(),this.parent()},hide:function(t){[t,!0].pick()&&this.mask.hide(),this.parent()},destroy:function(){this.mask.destroy(),this.parent.apply(this,arguments)}}),StickyWin.ModalWM=new StickyWin.Stacker({zIndexBase:11e3}),StickyWin.Fx&&(StickyWin.Fx.Modal=StickyWin.Modal),StickyWin.Alert=new Class({Implements:Options,Extends:StickyWin.Modal,options:{destroyOnClose:!0,modalOptions:{modalStyle:{zIndex:11e3}},zIndex:110001,uiOptions:{width:250,buttons:[{text:"Ok"}]},getWindowManager:function(){}},initialize:function(t,i,e){this.message=i,this.caption=t,this.setOptions(e),this.setOptions({content:this.build()}),this.parent(e)},makeMessage:function(){return new Element("p",{class:"errorMsg SWclearfix",styles:{margin:0,minHeight:10},html:this.message})},build:function(){return StickyWin.ui(this.caption,this.makeMessage(),this.options.uiOptions)}}),StickyWin.Error=new Class({Extends:StickyWin.Alert,makeMessage:function(){var t=this.parent();return new Element("img",{src:(this.options.baseHref||Clientcide.assetLocation+"/simple.error.popup")+"/icon_problems_sm.gif",class:"bang clearfix",styles:{float:"left",width:30,height:30,margin:"3px 5px 5px 0px"}}).inject(t,"top"),t}}),StickyWin.alert=function(t,i,e){return"string"==typeOf(e)&&(e={baseHref:e}),new StickyWin.Alert(t,i,e)},StickyWin.error=function(t,i,e){return new StickyWin.Error(t,i,e)},StickyWin.Confirm=new Class({Extends:StickyWin.Alert,options:{uiOptions:{width:250}},build:function(t){return this.setOptions({uiOptions:{buttons:[{text:"Cancel"},{text:"Ok",onClick:t||function(){this.fireEvent("confirm")}.bind(this)}]}}),this.parent()}}),StickyWin.confirm=function(t,i,e,s){return new StickyWin.Confirm(t,i,s).addEvent("confirm",e)},Form.Validator.Tips=new Class({Extends:Form.Validator.Inline,options:{pointyTipOptions:{point:"left",width:250},tipCaption:""},showAdvice:function(t,i){i=this.getAdvice(i);i&&!i.visible&&(i.show(),i.position(),i.pointy.positionPointer())},hideAdvice:function(t,i){i=this.getAdvice(i);i&&i.visible&&i.hide()},getAdvice:function(t,i){return Array.link(arguments,{field:Type.isElement}).field.retrieve("PointyTip")}
17652,advices:[],makeAdvice:function(t,i,e,s){if(e||s){var n,o,h,a=i.retrieve("PointyTip");return a||(n=s?"warning-advice":"validation-advice",o=new Element("ul",{styles:{margin:0,padding:0,listStyle:"none"}}),(h=this.makeAdviceItem(t,i))&&o.adopt(h),i.store("validationMsgs",o),a=new StickyWin.PointyTip(this.options.tipCaption,o,Object.merge(this.options.pointyTipOptions,{showNow:!1,relativeTo:i,inject:{target:this.element}})),this.advices.push(a),a.msgs={},i.store("PointyTip",a),document.id(a).addClass(n).set("id","advice-"+t+"-"+this.getFieldId(i))),i.store("advice-"+t,a),this.appendAdvice(t,i,e,s),a.pointy.positionPointer(),a}},validateField:function(t,i){var e=this.getAdvice(t);if(this.advices.some(function(t){return t.visible})&&this.options.serial)return e&&e.visible&&(s=this.parent(t,i),t.hasClass("validation-failed")||e.hide()),s;var s=t.retrieve("validationMsgs");return s&&s.getChildren().hide(),(t.hasClass("validation-failed")||t.hasClass("warning"))&&e&&e.show(),!this.options.serial||(e=this.element.getElements(".validation-failed, .warning")).length&&e.each(function(t,i){t=this.getAdvice(t);t&&t.hide()},this),this.parent(t,i)},makeAdviceItem:function(t,i,e,s){if(e||s){var n=this.getAdvice(i),s=this.makeAdviceMsg(i,e,s);return n&&n.msgs[t]?n.msgs[t].set("html",s):new Element("li",{html:s,style:{display:"none"}})}},makeAdviceMsg:function(t,i,e){e=e?this.warningPrefix:this.errorPrefix;return e+=this.options.useTitles&&t.title||i},appendAdvice:function(t,i,e,s){var n=this.getAdvice(i);if(n.msgs[t])return n.msgs[t].set("html",this.makeAdviceMsg(i,e,s)).show();s=this.makeAdviceItem(t,i,e,s);s&&(s.inject(i.retrieve("validationMsgs")).show(),n.msgs[t]=s)},insertAdvice:function(t,i){var e=i.get("validatorProps");e.msgPos&&document.id(e.msgPos)?document.id(e.msgPos).grab(t):"radio"===i.type.toLowerCase()?i.getParent().adopt(t):document.id(t).inject(document.id(i),"after"),t.position()}}),window.FormValidator&&(FormValidator.Tips=Form.Validator.Tips);var HoverGroup=new Class({Implements:[Options,Events],Binds:["enter","leave","remain"],options:{elements:[],delay:300,start:["mouseenter"],remain:[],end:["mouseleave"]},initialize:function(t){this.setOptions(t),this.attachTo(this.options.elements),this.addEvents({leave:function(){this.active=!1},enter:function(){this.active=!0}})},elements:[],attachTo:function(t,i){var e={},s={},n={};return t=Array.from(document.id(t)||$$(t)),this.options.start.each(function(t){e[t]=this.enter},this),this.options.end.each(function(t){n[t]=this.leave},this),this.options.remain.each(function(t){s[t]=this.remain},this),i?t.each(function(t){t.removeEvents(e).removeEvents(n).removeEvents(s),this.elements.erase(t)},this):(t.each(function(t){t.addEvents(e).addEvents(n).addEvents(s)}),this.elements.combine(t)),this},detachFrom:function(t){this.attachTo(t,!0)},enter:function(t){this.isMoused=!0,this.assert(t)},leave:function(t){this.isMoused=!1,this.assert(t)},remain:function(t){this.active&&this.enter(t)},assert:function(t){clearTimeout(this.assertion),this.assertion=function(){!this.isMoused&&this.active?this.fireEvent("leave",t):this.isMoused&&!this.active&&this.fireEvent("enter",t)}.delay(this.options.delay,this)}});Browser.ie||(StickyWin=Class.refactor(StickyWin,{options:{fade:!0,fadeDuration:150},hideWin:function(){this.options.fade?this.fade(0):this.previous()},showWin:function(){this.options.fade?this.fade(1):this.previous()},hide:function(){this.previous(this.options.fade)},show:function(){this.previous(this.options.fade)},fade:function(t){var i;return this.fadeFx||(this.win.setStyles({opacity:0,display:"block"}),i={property:"opacity",duration:this.options.fadeDuration},this.options.fadeTransition&&(i.transition=this.options.fadeTransition),this.fadeFx=new Fx.Tween(this.win,i)),0<t&&(this.win.setStyle("display","block"),this.position()),this.fadeFx.clearChain(),this.fadeFx.start(t).chain(function(){0==t?(this.win.setStyle("display","none"),this.fireEvent("onClose")):this.fireEvent("onDisplay")}.bind(this)),this}})),StickyWin.Fx=StickyWin;var Observer=new Class({Implements:[Options,Events],options:{periodical:!1,delay:1e3},initialize:function(t,i,e){this.setOptions(e),this.addEvent("onFired",i),this.element=document.id(t)||$$(t),this.boundChange=this.changed.bind(this),this.resume()},changed:function(){var t=this.element.get("value");$equals(this.value,t)||(this.clear(),this.value=t,this.timeout=this.onFired.delay(this.options.delay,this))},setValue:function(t){return this.value=t,this.element.set("value",t),this.clear()},onFired:function(){this.fireEvent("onFired",[this.value,this.element])},clear:function(){return clearTimeout(this.timeout||null),this},pause:function(){return clearTimeout(this.timeout),clearTimeout(this.timer),this.element.removeEvent("keyup",this.boundChange),this},resume:function(){return this.value=this.element.get("value"),this.options.periodical?this.timer=this.changed.peri
17652odical(this.options.periodical,this):this.element.addEvent("keyup",this.boundChange),this}}),$equals=function(t,i){return t==i||JSON.encode(t)==JSON.encode(i)},Autocompleter={},OverlayFix=IframeShim;Autocompleter.Base=new Class({Implements:[Options,Events],options:{minLength:1,markQuery:!0,width:"inherit",maxChoices:10,className:"autocompleter-choices",zIndex:42,delay:400,observerOptions:{},fxOptions:{},autoSubmit:!1,overflow:!1,overflowMargin:25,selectFirst:!1,filter:null,filterCase:!1,filterSubset:!1,forceSelect:!1,selectMode:!0,choicesMatch:null,multiple:!1,separator:", ",autoTrim:!0,allowDupes:!1,cache:!0,relative:!1},initialize:function(t,i){this.element=document.id(t),this.setOptions(i),this.options.separatorSplit=new RegExp("s*["+this.options.separator==" "?" ":this.options.separator.trim()+"]s*/"),this.build(),this.observer=new Observer(this.element,this.prefetch.bind(this),Object.merge({delay:this.options.delay},this.options.observerOptions)),this.queryValue=null,this.options.filter&&(this.filter=this.options.filter.bind(this));i=this.options.selectMode;this.typeAhead="type-ahead"==i,this.selectMode=!0===i?"selection":i,this.cached=[]},build:function(){document.id(this.options.customChoices)?this.choices=this.options.customChoices:(this.choices=new Element("ul",{class:this.options.className,styles:{zIndex:this.options.zIndex}}).inject(document.body),this.relative=!1,!this.options.relative&&this.element.getOffsetParent()==document.body||(this.choices.inject(this.element,"after"),this.relative=this.element.getOffsetParent()),this.fix=new OverlayFix(this.choices)),this.options.separator.test(this.options.separatorSplit)||(this.options.separatorSplit=this.options.separator),this.fx=this.options.fxOptions?new Fx.Tween(this.choices,Object.merge({property:"opacity",link:"cancel",duration:200},this.options.fxOptions)).addEvent("onStart",Chain.prototype.clearChain).set(0):null,this.element.setProperty("autocomplete","off").addEvent(Browser.ie||Browser.chrome||Browser.safari?"keydown":"keypress",this.onCommand.bind(this)).addEvent("click",this.onCommand.bind(this,!1)).addEvent("focus",function(){this.toggleFocus.delay(100,this,[!0])}.bind(this)),document.addEvent("click",function(t){t.target!=this.choices&&this.toggleFocus(!1)}.bind(this))},destroy:function(){this.fix&&this.fix.dispose(),this.choices=this.selected=this.choices.destroy()},toggleFocus:function(t){(this.focussed=t)||this.hideChoices(!0),this.fireEvent(t?"onFocus":"onBlur",[this.element])},onCommand:function(t){if(!t&&this.focussed)return this.prefetch();if(t&&t.key&&!t.shift)switch(t.key){case"enter":case"tab":if(this.element.value!=this.opted)return!0;if(this.selected&&this.visible)return this.choiceSelect(this.selected),this.fireEvent("choiceConfirm",this.selected),!!this.options.autoSubmit;break;case"up":case"down":return this.prefetch()||null===this.queryValue||(t="up"==t.key,this.choiceOver((this.selected||this.choices)[this.selected?t?"getPrevious":"getNext":t?"getLast":"getFirst"](this.options.choicesMatch),!0)),!1;case"esc":this.hideChoices(!0)}return!0},setSelection:function(t){var i,e,s=this.selected.inputValue,n=s,o=this.queryValue.length,h=s.length;s.substr(0,o).toLowerCase()!=this.queryValue.toLowerCase()&&(o=0),this.options.multiple&&(e=this.options.separatorSplit,n=this.element.value,o+=this.queryIndex,h+=this.queryIndex,i=n.substr(this.queryIndex).split(e,1)[0],n=n.substr(0,this.queryIndex)+s+n.substr(this.queryIndex+i.length),t&&(e=/[^\s,]+/,i=n.split(this.options.separatorSplit).filter(e.test,e),this.options.allowDupes||(i=[].combine(i)),e=this.options.separator,h=(n=i.join(e)+e).length)),this.observer.setValue(n),this.opted=n,!t&&"pick"!=this.selectMode||(o=h),this.element.selectRange(o,h),this.fireEvent("onSelection",[this.element,this.selected,n,s])},showChoices:function(){var t,i,e=this.options.choicesMatch,s=this.choices.getFirst(e);this.selected=this.selectedValue=null,this.fix&&(t=this.element.getCoordinates(this.relative),i=this.options.width||"auto",this.choices.setStyles({left:t.left,top:t.bottom,width:!0===i||"inherit"==i?t.width:i})),s&&(this.visible||(this.visible=!0,this.choices.setStyle("display",""),this.fx&&this.fx.start(1),this.fireEvent("onShow",[this.element,this.choices])),(this.options.selectFirst||this.typeAhead||s.inputValue==this.queryValue)&&this.choiceOver(s,this.typeAhead),i=this.choices.getChildren(e),s=this.options.maxChoices,e={overflowY:"hidden",height:""},this.overflown=!1,i.length>s&&(s=i[s-1],e.overflowY="scroll",e.height=s.getCoordinates(this.choices).bottom,this.overflown=!0),this.choices.setStyles(e),this.fix&&this.fix.show())},hideChoices:function(t){var i;t&&(i=this.element.value,this.options.forceSelect&&(i=this.opted),this.options.autoTrim&&(i=i.split(this.options.separatorSplit).filter(function(){return arguments[0]}).join(this.options.separator)),this.observer.setValue(i)),this.visible&&(this.visible=!1,this.observer.clear(),i=function(){this.choices.setStyle("display","none"),this.fix&&this.fix.hide()}.bind(this),this.fx?this.fx.start(0).chain(i):i(),this.fireEvent("onHide",[this.element,this.choices]))},prefetch:function(){var t,i,e,s=this.element.value,n=s;if(this.options.multiple&&(e=this.options.separatorSplit,t=s.split(e),i=this.element.getCaretPosition(),i-=(e=s.substr(0,i).split(e))[e=e.length-1].length,n=t[e]),n.length<this.options.minLength)this.hideChoices();else if(n===this.queryValue||this.visible&&n==this.selectedValue){if(this.visible)return!1;this.showChoices()}else this.queryValue=n,this.queryIndex=i,this.fetchCached()||this.query();return!0},fetchCached:function(){return!(!(this.options.cache&&this.cached&&this.cached.length)||this.cached.length>=this.options.maxChoices||this.queryValue)&&(this.update(this.filter(this.cached)),!0)},update:function(t){this.choices.empty(),(this.cached=t)&&t.length?(this.options.maxChoices<t.length&&!this.options.overflow&&(t.length=this.options.maxChoices),t.each(this.options.injectChoice||function(t){var i=new Element("li",{html:this.markQueryValue(t)});i.inputValue=t,this.addChoiceEvents(i).inject(this.choices)},this),this.showChoices()):this.hideChoices()},choiceOver:function(t,i){var e,s,n;t&&t!=this.selected&&(this.selected&&this.selected.removeClass("autocompleter-selected"),this.selected=t.addClass("autocompleter-selected"),this.fireEvent("onSelect",[this.element,this.selected,i]),i&&(this.selectedValue=this.selected.inputValue,this.overflown&&(e=this.selected.getCoordinates(this.choices),s=this.options.overflowMargin,i=(n=this.choices.scrollTop)+(t=this.choices.offsetHeight),e.to
17652p-s<n&&n?this.choices.scrollTop=Math.max(e.top-s,0):e.bottom+s>i&&(this.choices.scrollTop=Math.min(e.bottom-t+s,i))),this.selectMode&&this.setSelection()))},choiceSelect:function(t){t&&this.choiceOver(t),this.setSelection(!0),this.queryValue=!1,this.hideChoices()},filter:function(t){return(t||this.tokens).filter(function(t){return this.test(t)},new RegExp((this.options.filterSubset?"":"^")+this.queryValue.escapeRegExp(),this.options.filterCase?"":"i"))},markQueryValue:function(t){if(!this.options.markQuery||!this.queryValue)return t;var i=new RegExp("("+(this.options.filterSubset?"":"^")+this.queryValue.escapeRegExp()+")",this.options.filterCase?"":"i");return t.replace(i,'<span class="autocompleter-queried">$1</span>')},addChoiceEvents:function(i){return i.addEvents({mouseover:this.choiceOver.bind(this,i),click:function(){var t=this.choiceSelect(i);return this.fireEvent("choiceConfirm",this.selected),t}.bind(this)})}}),Autocompleter.Ajax={},Autocompleter.Ajax.Base=new Class({Extends:Autocompleter.Base,options:{postVar:"value",postData:{},ajaxOptions:{}},initialize:function(t,i){this.parent(t,i);i=document.id(this.options.indicator);i&&this.addEvents({onRequest:i.show.bind(i),onComplete:i.hide.bind(i)},!0)},query:function(){var t=Object.clone(this.options.postData);t[this.options.postVar]=this.queryValue,this.fireEvent("onRequest",[this.element,this.request,t,this.queryValue]),this.request.send({data:t})},queryResponse:function(){this.fireEvent("onComplete",[this.element,this.request,this.response])}}),Autocompleter.Ajax.Json=new Class({Extends:Autocompleter.Ajax.Base,initialize:function(t,i,e){this.parent(t,e),this.request=new Request.JSON(Object.merge({url:i,link:"cancel"},this.options.ajaxOptions)).addEvent("onComplete",this.queryResponse.bind(this))},queryResponse:function(t){this.parent(),this.update(t)}}),Autocompleter.Ajax.Xhtml=new Class({Extends:Autocompleter.Ajax.Base,initialize:function(t,i,e){this.parent(t,e),this.request=new Request.HTML(Object.merge({url:i,link:"cancel",update:this.choices},this.options.ajaxOptions)).addEvent("onComplete",this.queryResponse.bind(this))},queryResponse:function(t,i){this.parent(),i&&i.length?(this.choices.getChildren(this.options.choicesMatch).each(this.options.injectChoice||function(t){var i=t.innerHTML;t.inputValue=i,this.addChoiceEvents(t.set("html",this.markQueryValue(i)))},this),this.showChoices()):this.hideChoices()}}),Autocompleter.Local=new Class({Extends:Autocompleter.Base,options:{minLength:0,delay:200},initialize:function(t,i,e){this.parent(t,e),this.tokens=i},query:function(){this.update(this.filter())}}),Autocompleter.Base=Class.refactor(Autocompleter.Base,{initialize:function(t,i,e){this.previous(t,i,e),this.writeStyle()},writeStyle:function(){window.addEvent("domready",function(){document.id("AutocompleterCss")||new Element("link",{rel:"stylesheet",media:"screen",type:"text/css",href:(this.options.baseHref||Clientcide.assetLocation+"/autocompleter")+"/Autocompleter.css",id:"AutocompleterCss"}).inject(document.head)}.bind(this))}}),function(){function t(t){return{Extends:t,options:{url:"",showNow:!1,cacheRequest:!1,requestOptions:{method:"get",evalScripts:!0},wrapWithUi:!1,caption:"",uiOptions:{},handleResponse:function(t){this.options.cacheRequest&&this.element.store(this.Request.options.url,t);var i="";this.Request.response.text.stripScripts(function(t){i+=t}),this.options.wrapWithUi&&(t=StickyWin.ui(this.options.caption,t,this.options.uiOptions)),this.setContent(t),this.show(),this.evalScripts&&Browser.exec(i),this.fireEvent("update")}},initialize:function(t){var i;t&&t.showNow&&(i=!0,t.showNow=!1),this.parent(t),this.evalScripts=this.options.requestOptions.evalScripts,this.options.requestOptions.evalScripts=!1,this.createRequest(),i&&this.update()},createRequest:function(){this.Request=new Request(this.options.requestOptions).addEvent("onSuccess",this.options.handleResponse.bind(this))},update:function(t,i){var e;return this.Request.options.url=t||i.url,this.options.cacheRequest&&(e=this.element.retrieve(t)),e?this.Request.fireEvent("onSuccess",e):this.Request.setOptions(i).send({url:t||this.options.url}),this}}}try{StickyWin.Ajax=new Class(t(StickyWin))}catch(t){}try{StickyWin.Modal.Ajax=new Class(t(StickyWin.Modal))}catch(t){}try{StickyWin.PointyTip.Ajax=new Class(t(StickyWin.PointyTip))}catch(t){}}(),Autocompleter.JSONP=new Class({Extends:Autocompleter.Ajax.Json,options:{postVar:"query",jsonpOptions:{},minLength:1},initialize:function(t,i,e){this.url=i,this.setOptions(e),this.parent(t,e)},query:function(){var t=Object.clone(this.options.jsonpOptions.data||{});t[this.options.postVar]=this.queryValue,this.jsonp=new Request.JSONP(Object.merge({url:this.url,data:t},this.options.jsonpOptions)),this.jsonp.addEvent("onComplete",this.queryResponse.bind(this)),this.fireEvent("onRequest",[this.element,this.jsonp,t,this.queryValue]),this.jsonp.send()},queryResponse:function(t){this.parent();t=this.options.filter?this.options.filter.apply(this,[t]):t;this.update(t)}}),Autocompleter.JsonP=Autocompleter.JSONP,StickyWin.Prompt=new Class({Extends:StickyWin.Confirm,options:{defaultValue:""},initialize:function(t,i,e){this.addEvent("display",function(){this.input.select()}.bind(this)),this.parent.apply(this,arguments)},makeMessage:function(){return this.input=new Element("input",{value:this.options.defaultValue,type:"text",id:"foo",styles:{width:"100%"},events:{keyup:function(t){"enter"==t.key&&(this.fireEvent("confirm",this.input.get("value")),this.hide())}.bind(this)}}),new Element("div").adopt(this.parent()).adopt(this.input)},build:function(){return this.parent(function(){this.fireEvent("confirm",this.input.get("value"))}.bind(this))}}),StickyWin.prompt=function(t,i,e,s){return new StickyWin.Prompt(t,i,s).addEvent("confirm",e)};var TabSwapper=new Class({Implements:[Options,Events],options:{preventDefault:!0,selectedClass:"tabSelected",mouseoverClass:"tabOver",deselectedClass:"",rearrangeDOM:!0,effectOptions:{duration:500},cookieDays:999},tabs:[],sections:[],clickers:[],sectionFx:[],initialize:function(t){this.setOptions(t);t=this.setup();if(t)return t;null!=this.options.initPanel?this.show(this.options.initPanel):this.options.cookieName&&this.recall()?this.show(this.recall().toInt()):this.show(0)},setup:function(){var t=this.options,e=$$(t.sections),i=$$(t.tabs);if(i[0]&&i[0].retrieve("tabSwapper"))return i[0].retrieve("tabSwapper");var s=$$(t.clickers);i.each(function(t,i){this.addTab(t,e[i],s[i],i)},this)},addTab:function(i,t,e,s){return i=document.id(i),e=document.id(e),t=document.id(t),0<=this.tabs.indexOf(i)&&i.retrieve("tabbered")&&this.tabs.indexOf(i)!=s&&this.options.rearrangeDOM?this.moveTab(this.tabs.indexOf(i),s):(null==s&&(s=this.tabs.length),0<s&&this.tabs[s-1]&&this.options.rearrangeDOM&&(i.inject(this.tabs[s-1],"after"),t.inject(this.tabs[s-1].retrieve("section"),"after")),this.tabs.splice(s,0,i),e=e||i,i.addEvents({mouseout:function(){i.removeClass(this.options.mouseoverClass)}.bind(this),mouseover:function(){i.addClass(this.options.mouseoverClass)}.bind(this)}),e.addEvent("click",function(t){this.options.preventDefault&&t.preventDefault(),this.show(this.tabs.indexOf(i))}.bind(this)),i.store("tabbered",!0),i.store("section",t),i.store("clicker",e),this.hideSection(s)),this},removeTab:function(t){var i=this.tabs[this.now];return this.now==t&&(0<t?this.show(t-1):t<this.tabs.length&&this.show(t+1)),this.now=this.tabs.indexOf(i),this},moveTab:function(t,i){var e=this.tabs[t],s=e.retrieve("clicker"),n=e.retrieve("section"),o=this.tabs[i],h=o.retrieve("clicker"),t=o.retrieve("section");return this.tabs.erase(e).splice(i,0,e),e.inject(o,"before"),s.inject(h,"before"),n.inject(t,"before"),this},show:function(e){return null==this.now&&this.tabs.each(function(t,i){e!=i&&this.hideSection(i)},this),this.showSection(e).save(e),this},save:function(t){return this.options.cookieName&&Cookie.write(this.options.cookieName,t,{duration:this.options.cookieDays}),this},recall:function(){return!!this.options.cookieName&&Cookie.read(this.options.cookieName)},hideSection:function(t){var i=this.tabs[t];if(!i)return this;var e=i.retrieve("section");return e&&"none"!=e.getStyle("display")&&(this.lastHeight=e.getSize().y,e.setStyle("display","none"),i.swapClass(this.options.selectedClass,this.options.deselectedClass),this.fireEvent("onBackgroun
17652d",[t,e,i])),this},showSection:function(t){var i=this.tabs[t];if(!i)return this;var e=i.retrieve("section");if(!e)return this;var s,n,o,h=this.options.smooth&&!Browser.ie;return this.now!=t&&(i.retrieve("tabFx")||i.store("tabFx",new Fx.Morph(e,this.options.effectOptions)),s=e.getStyle("overflow"),o={display:"block",overflow:"hidden"},h&&(o.opacity=0),n=!1,h?n={opacity:1}:e.getStyle("opacity").toInt()<1&&(e.setStyle("opacity",1),this.options.smoothSize||this.fireEvent("onActiveAfterFx",[t,e,i])),this.options.smoothSize&&(h=e.getDimensions().height,null!=this.options.maxSize&&this.options.maxSize<h&&(h=this.options.maxSize),(n=n||{}).height=h),null!=this.now&&this.hideSection(this.now),this.options.smoothSize&&this.lastHeight&&(o.height=this.lastHeight),e.setStyles(o),o=function(){this.fireEvent("onActiveAfterFx",[t,e,i]),e.setStyles({height:this.options.maxSize==n.height?this.options.maxSize:"auto",overflow:s}),e.getElements("input, textarea").setStyle("opacity",1)}.bind(this),n?i.retrieve("tabFx").start(n).chain(o):o(),this.now=t,this.fireEvent("onActive",[t,e,i])),i.swapClass(this.options.deselectedClass,this.options.selectedClass),this}}); 17653 17654var SalsaDropdown=new Class({Implements:[Options,Events],options:{container:".dropdown-container",toggler:".dropdown-button",panel:".dropdown-panel",activeClass:"dropdown-active",closeClass:"dropdown-close",keepOpen:""},initialize:function(t){this.setOptions(t),this.opened_panel=null,this._init_document_event(),this._init_toggler_event()},_init_document_event:function(){document.addEvent("click",function(t){!t.target.hasClass(this.options.closeClass)&&(t.target.hasClass(this.options.panel)||t.target.getParent(this.options.container)||this.options.keepOpen&&t.target.getParents(this.options.keepOpen).getLast())||this._hide_panels()}.bind(this))},_init_toggler_event:function(){var t="click:relay("+this.options.container+" "+this.options.toggler+")";document.getElement("body").addEvent(t,function(t,e){t.preventDefault();var n=e.getParent(this.options.container),t=n.hasClass(this.options.activeClass),e=n.getElements(this.options.panel);this._hide_panels(),t||this._show_panel(n,e),e.getPosition()[0].x+e.getSize()[0].x>window.getSize().x?e.addClass("dropdown-panel-right"):e.removeClass("dropdown-panel-right")}.bind(this))},_hide_panels:function(){null!==this.opened_panel&&(document.getElements(this.options.container).removeClass(this.options.activeClass),document.getElements(this.options.panel).setStyle("display","none"),this.fireEvent("hidden",this.opened_panel),this.opened_panel=null)},_show_panel:function(t,e){this.opened_panel=e,t.addClass(this.options.activeClass),e.setStyle("display",""),this.fireEvent("visible",e)}}); 17655 17656var ScrollBars=ScrollBars||new Class({version:"0.5.2",Implements:[Options],element:null,timer:null,fadeTimer:null,nativeScrollBarSize:0,options:{scrollBarSize:15,scrollStep:20,addBar:!0,barOverContent:!1,fade:!1},initialize:function(e,t){this.element=document.id(e),Browser.ie||$("webkit_hide_scrollbars")||document.id(document.body).adopt(new Element("style",{id:"webkit_hide_scrollbars",text:".scrollbar-content::-webkit-scrollbar{visibility:hidden;} .scrollbar-content .scrollbar-content-wrapper:after{clear: both;}"}));e=new Element("div",{styles:{height:"150px",overflow:"scroll"}}).adopt(new Element("div",{styles:{height:"160px"}}));document.id(document.body).adopt(e),this.nativeScrollBarSize=e.getSize().x-e.getScrollSize().x,e.destroy(),this.setOptions(t),this.injectHTML(),this.options.fade&&this._addFade(this.options.fade),window.addEvent("load",this.updateScrollBars.bind(this)),window.addEvent("resize",this.updateScrollBars.bind(this))},injectHTML:function(){this.element.getElement("ul.scrollbar")&&this.element.getElements("ul.scrollbar").destroy(),this.element.setStyles({overflow:"hidden",position:"relative"});var e=new Element("div",{class:"scrollbar-content",styles:{"padding-right":this.nativeScrollBarSize,"padding-bottom":this.nativeScrollBarSize,overflow:"hidden",height:"100%",width:"100%"}}).adopt(new Element("div",{class:"scrollbar-content-wrapper",styles:{float:"left","margin-right":-this.nativeScrollBarSize,"margin-bottom":-this.nativeScrollBarSize}}).adopt(this.element.childNodes));this.element.adopt(e),this.element.grab(new Element("ul",{class:"scrollbar vertical",styles:{position:"absolute",right:0,width:this.options.scrollBarSize}}).adopt([new Element("li",{class:"scroll bar-wrapper",styles:{position:"absolute",top:0,bottom:0,"min-width":this.options.scrollBarSize}}),new Element("li",{class:"scroll up",text:"up",styles:{position:"absolute",top:0,"min-height":this.options.scrollBarSize,"min-width":this.options.scrollBarSize}}).addEvents({mousedown:function(){this.element.getElement(".scrollbar-content").scrollTo(this.element.getElement(".scrollbar-content").getScroll().x,this.element.getElement(".scrollbar-content").getScroll().y-this.options.scrollStep),this.timer=this.element.getElement("ul.scrollbar.vertical li.scroll.up").fireEvent.delay(100,this.element.getElement("ul.scrollbar.vertical li.scroll.up"),"mousedown")}.bind(this),mouseup:function(){clearTimeout(this.timer)}.bind(this),mouseleave:function(){clearTimeout(this.timer)}.bind(this)}),new Element("li",{class:"scroll down",text:"down",styles:{position:"absolute",bottom:0,"min-height":this.options.scrollBarSize,"min-width":this.options.scrollBarSize}}).addEvents({mousedown:function(){this.element.getElement(".scrollbar-content").scrollTo(this.element.getElement(".scrollbar-content").getScroll().x,this.element.getElement(".scrollbar-content").getScroll().y+this.options.scrollStep),this.timer=this.element.getElement("ul.scrollbar.vertical li.scroll.down").fireEvent.delay(100,this.element.getElement("ul.scrollbar.vertical li.scroll.down"),"mousedown")}.bind(this),mouseup:function(){clearTimeout(this.timer)}.bind(this),mouseleave:function(){clearTimeout(this.timer)}.bind(this)})]),"top"),this.element.grab(new Element("ul",{class:"scrollbar horizontal",styles:{position:"absolute",bottom:0,height:this.options.scrollBarSize}}).adopt([new Element("li",{class:"scroll bar-wrapper",styles:{position:"absolute",left:0,right:0,"min-height":this.options.scrollBarSize}}),new Element("li",{class:"scroll left",text:"left",styles:{position:"absolute",left:0,"min-height":this.options.scrollBarSize,"min-width":this.options.scrollBarSize}}).addEvents({mousedown:function(){this.element.getElement(".scrollbar-content").scrollTo(this.element.getElement(".scrollbar-content").getScroll().x-this.options.scrollStep,this.element.getElement(".scrollbar-content").getScroll().y),this.timer=this.element.getElement("ul.scrollbar.horizontal li.scroll.left").fireEvent.delay(100,this.element.getElement("ul.scrollbar.horizontal li.scroll.left"),"mousedown")}.bind(this),mouseup:function(){clearTimeout(this.timer)}.bind(this),mouseleave:function(){clearTimeout(this.timer)}.bind(this)}),new Element("li",{class:"scroll right",text:"right",styles:{position:"absolute",right:0,"min-height":this.options.scrollBarSize,"min-width":this.options.scrollBarSize}}).addEvents({mousedown:function(){this.element.getElement(".scrollbar-content").scrollTo(this.element.getElement(".scrollbar-content").getScroll().x+this.options.scrollStep,this.element.getElement(".scrollbar-content").getScroll().y),this.timer=this.element.getElement("ul.scrollbar.horizontal li.scroll.right").fireEvent.delay(100,this.element.getElement("ul.scrollbar.horizontal li.scroll.right"),"mousedown")}.bind(this),mouseup:function(){clearTimeout(this.timer)}.bind(this),mouseleave:function(){clearTimeout(this.timer)}.bind(this)})]),"top"),this.options.addBar&&this.injectBarHtml()},injectBarHtml:function(){var t=this.element.getElement("ul.scrollbar.vertical li.scroll.bar-wrapper"),l=this.element.getElement("ul.scrollbar.horizontal li.scroll.bar-wrapper");t.adopt(new Element("div",{class:"scroll bar",styles:{position:"absolute",width:"100%"}})),l.adopt(new Element("div",{class:"scroll bar",styles:{position:"absolute",height:"100%"}}));var i=null,o=null;t.addEvents({mousedown:function(e){return this.element.getElement(".scrollbar-content").scrollTo(this.element.getElement(".scrollbar-content").getScroll().x,this.element.getElement(".scrollbar-content").getScrollSize().y*((e.page.y-t.getElement(".scroll.bar").getSize().y/2-t.getPosition().y)/t.getSize().y)),document.id(document.body).addEvent("mousemove",i=function(e){e.stop(),this.element.getElement(".scrollbar-content").scrollTo(this.element.getElement(".scrollbar-content").getScroll().x,this.element.getElement(".scrollbar-content").getScrollSize().y*((e.page.y-t.getElement(".scroll.bar").getSize().y/2-t.getPosition().y)/t.getSize().y)),document.id(document.body).focus()}.bind(this)),!1}.bind(this)}),l.addEvents({mousedown:function(e){return this.element.getElement(".scrollbar-content").scrollTo(this.element.getElement(".scrollbar-content").getScrollSize().x*((e.page.x-l.getElement(".scroll.bar").getSize().x/2-l.getPosition().x)/l.getSize().x),this.element.getElement(".scrollbar-content").getScroll().y),document.id(document.body).addEvent("mousemove",o=function(e){e.stop(),this.element.getElement(".scrollbar-content").scrollTo(this.element.getElement(".scrollbar-content").getScrollSize().x*((e.page.x-l.getElement(".scroll.bar").getSize().x/2-l.getPosition().x)/l.getSize().x),this.element.getElement(".scrollbar-content").getScroll().y),document.id(document.body).focus()}.bind(this)),!1}.bind(this)}),document.id(document.body).addEvent("mouseup",function(){document.id(document.body).removeEvent("mousemove",i),document.id(document.body).removeEvent("mousemove",o)}),this.element.getElement(".scrollbar-content").addEvent("scroll",function(){var e=Math.floor(this.element.getElement(".scrollbar-content").getScroll().y/this.element.getElement(".scrollbar-content").getScrollSize().y*100),t=Math.floor(this.element.getElement(".scrollbar-content").getScroll().x/this.element.getElement(".scrollbar-content").getScrollSize().x*100),l=this.element.getElement("ul.scrollbar.vertical li.scroll.bar-wrapper .scroll.bar"),i=this.element.getElement("ul.scrollbar.horizontal li.scroll.bar-wrapper .scroll.bar");!Browser.ie&&100<=l.getStyle("height").toInt()+e?(l.setStyle("bottom","0"),l.setStyle("top","auto")):(l.setStyle("top",e+"%"),l.setStyle("bottom","auto")),!Browser.ie&&100<=i.getStyle("width").toInt()+t?(i.setStyle("right","0"),i.setStyle("left","auto")):(i.setStyle("left",t+"%"),i.setStyle("right","auto"))}.bind(this)).fireEvent("scroll")},updateScrollBars:function(){var e,t,l=this.element.getElement(".scrollbar-content");this.element.getElement("ul.scrollbar.vertical").setStyle("height",this.element.getSize().y-this.element.getElement("ul.scrollbar.horizontal").get
17656Size().y),this.element.getElement("ul.scrollbar.horizontal").setStyle("width",this.element.getSize().x-this.element.getElement("ul.scrollbar.vertical").getSize().x),this.options.addBar&&(e=this.element.getElement("ul.scrollbar.vertical li.scroll.bar-wrapper").setStyles({top:0,bottom:0}),t=this.element.getElement("ul.scrollbar.horizontal li.scroll.bar-wrapper").setStyles({left:0,right:0}),this.element.getElement("li.scroll.up").getPosition(this.element).y<l.getSize().y/2&&e.setStyle("top",e.getStyle("top").toInt()+this.element.getElement("li.scroll.up").getSize().y),this.element.getElement("li.scroll.down").getPosition(this.element).y<l.getSize().y/2&&e.setStyle("top",e.getStyle("top").toInt()+this.element.getElement("li.scroll.down").getSize().y),this.element.getElement("li.scroll.up").getPosition(this.element).y>l.getSize().y/2&&e.setStyle("bottom",e.getStyle("bottom").toInt()+this.element.getElement("li.scroll.up").getSize().y),this.element.getElement("li.scroll.down").getPosition(this.element).y>l.getSize().y/2&&e.setStyle("bottom",e.getStyle("bottom").toInt()+this.element.getElement("li.scroll.down").getSize().y),this.element.getElement("li.scroll.left").getPosition(this.element).x<l.getSize().x/2&&t.setStyle("left",t.getStyle("left").toInt()+this.element.getElement("li.scroll.left").getSize().x),this.element.getElement("li.scroll.right").getPosition(this.element).x<l.getSize().x/2&&t.setStyle("left",t.getStyle("left").toInt()+this.element.getElement("li.scroll.right").getSize().x),this.element.getElement("li.scroll.left").getPosition(this.element).x>l.getSize().x/2&&t.setStyle("right",t.getStyle("right").toInt()+this.element.getElement("li.scroll.left").getSize().x),this.element.getElement("li.scroll.right").getPosition(this.element).x>l.getSize().x/2&&t.setStyle("right",t.getStyle("right").toInt()+this.element.getElement("li.scroll.right").getSize().x),e.getElement(".scroll.bar").setStyle("height",Math.min(100,Math.ceil((l.getSize().y-(Browser.ie?this.nativeScrollBarSize:0))/l.getScrollSize().y*100))+"%"),t.getElement(".scroll.bar").setStyle("width",Math.min(100,Math.ceil((l.getSize().x-(Browser.ie?this.nativeScrollBarSize:0))/l.getScrollSize().x*100))+"%"),l.fireEvent("scroll")),!this.element.getElement("ul.scrollbar.vertical").hasClass("inactive")&&l.getScrollSize().y<=l.getSize().y?this.element.getElement("ul.scrollbar.vertical").addClass("inactive"):l.getScrollSize().y>l.getSize().y&&this.element.getElement("ul.scrollbar.vertical").removeClass("inactive"),!this.element.getElement("ul.scrollbar.horizontal").hasClass("inactive")&&l.getScrollSize().x<=l.getSize().x?this.element.getElement("ul.scrollbar.horizontal").addClass("inactive"):l.getScrollSize().x>l.getSize().x&&this.element.getElement("ul.scrollbar.horizontal").removeClass("inactive"),this.options.barOverContent||"none"==this.element.getElement("ul.scrollbar.vertical").getStyle("display")&&"none"==this.element.getElement("ul.scrollbar.horizontal").getStyle("display")?l.getElement(".scrollbar-content-wrapper").setStyles({"padding-right":0,"padding-bottom":0}):"none"==this.element.getElement("ul.scrollbar.vertical").getStyle("display")?l.getElement(".scrollbar-content-wrapper").setStyles({"padding-right":0,"padding-bottom":this.options.scrollBarSize}):"none"==this.element.getElement("ul.scrollbar.horizontal").getStyle("display")?l.getElement(".scrollbar-content-wrapper").setStyles({"padding-right":this.options.scrollBarSize,"padding-bottom":0}):l.getElement(".scrollbar-content-wrapper").setStyles({"padding-right":this.options.scrollBarSize,"padding-bottom":this.options.scrollBarSize}),l.setStyle("overflow","scroll"),this.element.setStyle("height",this.element.style.height?this.element.getStyle("height"):this.element.getSize().y-this.nativeScrollBarSize)},fadeBars:function(t){this.element.getChildren("ul.scrollbar").each(function(e){e.getElements("li").each(function(e){e.get("tween").stop(),e.fade(t)})})},_addFade:function(e){e=!parseInt(e)||parseInt(e)<500?500:parseInt(e),this.element.addEvent("mousemove",function(){clearTimeout(this.fadeTimer),this.fadeBars("show"),this.fadeTimer=this.fadeBars.delay(e,this,"out")}.bind(this)),this.element.getElement(".scrollbar-content").addEvent("scroll",function(){clearTimeout(this.fadeTimer),this.fadeBars("show"),this.fadeTimer=this.fadeBars.delay(e,this,"out")}.bind(this)),this.fadeTimer=this.fadeBars.delay(e,this,"out")}});Element.implement({scrollbars:function(e){return Browser.Platform.mac?null:this.store("scrollbars",new ScrollBars(this,e))}}); 17657 17658function salsa_slide(n,t,e,i){var o=new Fx.Slide(document.id(n),{resetHeight:!0}),d=document.id(t);null==i||"closed"==i?o.hide():d.toggleClass(e),d.addEvent("click",function(n){n=new Event(n),o.toggle(),n.stop(),null!=e&&d.toggleClass(e)})}function salsa_go_to_top(t){document.id(t).set("opacity","0").setStyle("display","block"),window.addEvent("scroll",function(n){document.id(t).fade(400<window.getScroll().y?"in":"out")})}function salsa_curvy_corners(n,t,e,i,o,d){var s={tl:{radius:t},tr:{radius:e},bl:{radius:i},br:{radius:o},antiAlias:d};document.getElements(n).each(function(n){curvyCorners(s,n)})}function salsa_is_mobile(){return(0<window.innerWidth?window.innerWidth:screen.width)<=480} 17659 17660var SalsaDataLayer={event:function(e,t,a,n,o){SalsaDataLayer._event(e,t,a,n,void 0,void 0,o)},eventCard:function(e,t,a,n,o,r,c){SalsaDataLayer._event(e,t,a,n,o,r,c)},stats:function(e,t,a,n){SalsaDataLayer._event("stats","Stats",t,n,void 0,void 0,{statsType:e,statsId:a})},statsCard:function(e,t,a,n,o,r){void 0===o&&(o=a),void 0===r&&(r=n),SalsaDataLayer._event("statsCard","Stats Card",t,n,o,r,{statsType:e,statsId:a})},_event:function(e,t,a,n,o,r,c){void 0===window.dataLayer&&(window.dataLayer=[]);var s,l={event:e,eventCategory:t,eventAction:a,eventLabel:n};for(s in void 0!==o&&(l.cardId=o),void 0!==r&&(l.cardName=r),c)l[s]=c[s];window.dataLayer.push(l)},trackReferer:function(){""!==document.referrer&&SalsaDataLayer._get_hostname(document.referrer)===document.location.hostname||SalsaDataLayer.onGoogleAnalyticsTrackerReady(function(e){var a=new XMLHttpRequest;a.onreadystatechange=function(){if(4===this.readyState&&200===this.status){if(console.log("response: "+a.responseText),""===a.responseText)return;var e=a.responseText.match(/<script>(.*)<\/script>/);if(void 0===e[1])return;var t=document.createElement("script");t.text=e[1],document.head.appendChild(t)}};var t=window.location.protocol+"//"+document.location.hostname+"/salsa_call.php?_call=TrackReferer";t+="&url="+encodeURIComponent(document.location.href),t+="&referer_url="+encodeURIComponent(document.referrer),t+="&analytics_client_id="+encodeURIComponent(e.get("clientId")),a.open("GET",t,!0),a.send()})},_get_hostname:function(e){var t=document.createElement("a");return t.href=e,t.hostname},cardSite:function(a,n,o){SalsaDataLayer.onGoogleAnalyticsTrackerReady(function(e){var t=new window.gaplugins.Linker(e).decorate(a.replace("http:","https:")+"?from_portal=1"),e=document.createElement("iframe");e.src=t,e.style="display:none",e.onload=function(){SalsaDataLayer.event("portalReferrer","Portal Referrer","detail",n,{analyticsCode:o}),console.log("iframe src="+t+" loaded - portalReferrer="+n+" - analyticsCode="+o)},document.body.appendChild(e)})},onGoogleAnalyticsTrackerReady:function(t){var a=null,n=0,o=setInterval(function(){var e;n++,null!==a||10<n?clearInterval(o):(console.log("attempt "+n),(e=window[window.GoogleAnalyticsObject])&&e.getAll&&(a=e.getAll()[0],t(a)))},1e3)}}; 17661 17662var SalsaLangDetection=new Class({Implements:[Options,Events],options:{container:"",browser_lang:"",page_lang:"",page_lang_name:"",advice_view_url:"",page_lang_url:"",enable_effects:!0},initialize:function(e){this.cookie_name="salsa_browser_language_advice",this.setOptions(e),"https:"!=document.location.protocol&&this.options.browser_lang!=this.options.page_lang&&null===Cookie.read(this.cookie_name)&&(Cookie.write(this.cookie_name,"1",{duration:90}),this.container=document.id(this.options.container),this._load_advice(),this._init_events())},_load_advice:function(){new Request.HTML({url:this.options.advice_view_url,data:new Hash({browser_lang:this.options.browser_lang,page_lang:this.options.page_lang,page_lang_name:this.options.page_lang_name,page_lang_url:this.options.page_lang_url}).toQueryString(),onSuccess:function(e,t,n){var i;this.options.enable_effects&&(i=new Fx.Slide(this.container,{duration:1e3})).hide(),this.container.set("html",n),this.options.enable_effects&&i.slideIn("vertical"),this.fireEvent("show")}.bind(this)}).send()},_init_events:function(){this.container.addEvent("click:relay(a)",function(e){e.preventDefault();e=e.target;"a"!=e.get("tag")&&(e=e.getParent("a")),this.options.enable_effects?new Fx.Slide(this.container).slideOut("vertical"):this.container.empty(),this.fireEvent("hide");e=e.get("href");e&&(location.href=e)}.bind(this))}}); 17663 17664var Mediabox;!function(){var l,i,o,a,c,r,e,s,t,n,m,d,p,w,h,u,f,g,b,y,v,x,S,k,j,E,I,C,B,T,F,N,P,W=new Image,_=new Image,D=!1,H="none",L="mediaBox";function A(){h.setStyles({top:window.getScrollTop(),left:window.getScrollLeft()})}function M(){n=window.getWidth(),m=window.getHeight(),h.setStyles({width:n,height:m})}function $(t){Browser.Engine.gecko&&["object",window.ie?"select":"embed"].forEach(function(e){Array.forEach(document.getElementsByTagName(e),function(e){t&&(e._mediabox=e.style.visibility),e.style.visibility=t?"hidden":e._mediabox})}),h.style.display=t?"":"none";var e=t?"addEvent":"removeEvent";D&&window[e]("scroll",A),window[e]("resize",M),l.keyboard&&document[e]("keydown",z)}function z(e){if(l.alpha)switch(e.code){case 27:case 88:case 67:G();break;case 37:case 80:O();break;case 39:case 78:R()}else switch(e.code){case 27:G();break;case 37:O();break;case 39:R()}if(l.stopKey)return!1}function O(){return q(a)}function R(){return q(c)}function q(e){var t;return 0<=e&&(f.set("html",""),a=((o=e)||!l.loop?o:i.length)-1,(c=o+1)==i.length&&(c=l.loop?0:-1),function(){p&&(p.onload=$empty);d.resize.cancel(),d.image.cancel().set(0),d.bottom.cancel().set(0),$$(x,k).setStyle("display","none")}(),(t=u.getProperty("class"))&&t.split(" ").each(function(e){"mbType-"===e.substring(0,7)&&u.removeClass(e)}),u.addClass("mbLoading"),i[e][2]||(i[e][2]=""),E=i[e][2].split(" "),I=E.length,T=1<I?(B=E[I-2].match("%")?window.getWidth()*(.01*E[I-2].replace("%",""))+"px":"auto"==E[I-2]?"auto":E[I-2]+"px",
17664E[I-1].match("%")?window.getHeight()*(.01*E[I-1].replace("%",""))+"px":"auto"==E[I-1]?"auto":E[I-1]+"px"):B="",j=i[e][0],b=i[o][1].split("::"),j.match(/quietube\.com/i)?j=(F=j.split("v.php/"))[1]:j.match(/\/\/yfrog/i)&&((H=j.substring(j.length-1)).match(/b|g|j|p|t/i)&&(H="image"),"s"==H&&(H="flash"),H.match(/f|z/i)&&(H="video"),j+=":iphone"),j.match(/\.gif|\.jpg|\.jpeg|\.png|twitpic\.com/i)||"image"==H?(H="img",j=j.replace(/twitpic\.com/i,"twitpic.com/show/full"),(p=new Image).onload=V,p.src=j):(j.match(/\.flv|\.mp4/i)||"video"==H?(H="obj",B=B||l.defaultWidth,T=T||l.defaultHeight,p=l.useNB?new Swiff(l.playerpath+"?mediaURL="+j+"&allowSmoothing=true&autoPlay="+l.autoplay+"&buffer=6&showTimecode="+l.showTimecode+"&loop="+l.medialoop+"&controlColor="+l.controlColor+"&controlBackColor="+l.controlBackColor+"&defaultVolume="+l.volume+"&scaleIfFullScreen=true&showScalingButton=true&crop=false",{id:"MediaboxSWF",width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}}):new Swiff(l.JWplayerpath+"?file="+j+"&backcolor="+l.backcolor+"&frontcolor="+l.frontcolor+"&lightcolor="+l.lightcolor+"&screencolor="+l.screencolor+"&autostart="+l.autoplay+"&controlbar="+l.controlbar,{id:"MediaboxSWF",width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/\.mp3|\.aac|tweetmic\.com|tmic\.fm/i)||"audio"==H?(H="obj",B=B||l.defaultWidth,T=T||"20px",j.match(/tweetmic\.com|tmic\.fm/i)&&((j=j.split("/"))[4]=j[4]||j[3],j="http://media4.fjarnet.net/tweet/tweetmicapp-"+j[4]+".mp3"),p=l.useNB?new Swiff(l.playerpath+"?mediaURL="+j+"&allowSmoothing=true&autoPlay="+l.autoplay+"&buffer=6&showTimecode="+l.showTimecode+"&loop="+l.medialoop+"&controlColor="+l.controlColor+"&controlBackColor="+l.controlBackColor+"&defaultVolume="+l.volume+"&scaleIfFullScreen=true&showScalingButton=true&crop=false",{id:"MediaboxSWF",width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}}):new Swiff(l.JWplayerpath+"?file="+j+"&backcolor="+l.backcolor+"&frontcolor="+l.frontcolor+"&lightcolor="+l.lightcolor+"&screencolor="+l.screencolor+"&autostart="+l.autoplay,{id:"MediaboxSWF",width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/\.swf/i)||"flash"==H?(H="obj",B=B||l.defaultWidth,T=T||l.defaultHeight,p=new Swiff(j,{id:"MediaboxSWF",width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/\.mov|\.m4v|\.m4a|\.aiff|\.avi|\.caf|\.dv|\.mid|\.m3u|\.mp3|\.mp2|\.mp4|\.qtz/i)||"qt"==H?(H="qt",B=B||l.defaultWidth,T=parseInt(T)+16+"px"||l.defaultHeight,p=new Quickie(j,{id:"MediaboxQT",width:B,height:T,container:"mbImage",attributes:{controller:l.controller,autoplay:l.autoplay,volume:l.volume,loop:l.medialoop,bgcolor:l.bgcolor}})):j.match(/blip\.tv/i)?(H="obj",B=B||"640px",T=T||"390px",p=new Swiff(j,{src:j,width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/break\.com/i)?(H="obj",B=B||"464px",T=T||"376px",L=j.match(/\d{6}/g),p=new Swiff("http://embed.break.com/"+L,{width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/dailymotion\.com/i)?(H="obj",B=B||"480px",T=T||"381px",p=new Swiff(j,{id:L,width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/facebook\.com/i)?(H="obj",B=B||"320px",T=T||"240px",F=(F=j.split("v="))[1].split("&"),L=F[0],p=new Swiff("http://www.facebook.com/v/"+L,{movie:"http://www.facebook.com/v/"+L,classid:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/flickr\.com/i)?(H="obj",B=B||"500px",T=T||"375px",F=j.split("/"),L=F[5],p=new Swiff("http://www.flickr.com/apps/video/stewart.swf",{id:L,classid:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",width:B,height:T,params:{flashvars:"photo_id="+L+"&show_info_box="+l.flInfo,wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/gametrailers\.com/i)?(H="obj",B=B||"480px",T=T||"392px",L=j.match(/\d{5}/g),p=new Swiff("http://www.gametrailers.com/remote_wrap.php?mid="+L,{id:L,width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/google\.com\/videoplay/i)?(H="obj",B=B||"400px",T=T||"326px",F=j.split("="),L=F[1],p=new Swiff("http://video.google.com/googleplayer.swf?docId="+L+"&autoplay="
17664+l.autoplayNum,{id:L,width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/megavideo\.com/i)?(H="obj",B=B||"640px",T=T||"360px",F=j.split("="),L=F[1],p=new Swiff("http://wwwstatic.megavideo.com/mv_player.swf?v="+L,{id:L,width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/metacafe\.com\/watch/i)?(H="obj",B=B||"400px",T=T||"345px",F=j.split("/"),L=F[4],p=new Swiff("http://www.metacafe.com/fplayer/"+L+"/.swf?playerVars=autoPlay="+l.autoplayYes,{id:L,width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/vids\.myspace\.com/i)?(H="obj",B=B||"425px",T=T||"360px",p=new Swiff(j,{id:L,width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/revver\.com/i)?(H="obj",B=B||"480px",T=T||"392px",F=j.split("/"),L=F[4],p=new Swiff("http://flash.revver.com/player/1.0/player.swf?mediaId="+L+"&affiliateId="+l.revverID+"&allowFullScreen="+l.revverFullscreen+"&autoStart="+l.autoplay+"&backColor=#"+l.revverBack+"&frontColor=#"+l.revverFront+"&gradColor=#"+l.revverGrad+"&shareUrl=revver",{id:L,width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/rutube\.ru/i)?(H="obj",B=B||"470px",T=T||"353px",F=j.split("="),L=F[1],p=new Swiff("http://video.rutube.ru/"+L,{movie:"http://video.rutube.ru/"+L,width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/seesmic\.com/i)?(H="obj",B=B||"435px",T=T||"355px",F=j.split("/"),L=F[5],p=new Swiff("http://seesmic.com/Standalone.swf?video="+L,{id:L,width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/tudou\.com/i)?(H="obj",B=B||"400px",T=T||"340px",F=j.split("/"),L=F[5],p=new Swiff("http://www.tudou.com/v/"+L,{width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/twitcam\.com/i)?(H="obj",B=B||"320px",T=T||"265px",F=j.split("/"),L=F[3],p=new Swiff("http://static.livestream.com/chromelessPlayer/wrappers/TwitcamPlayer.swf?hash="+L,{width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/twiturm\.com/i)?(H="obj",B=B||"402px",T=T||"48px",F=j.split("/"),L=F[3],p=new Swiff("http://twiturm.com/flash/twiturm_mp3.swf?playerID=0&sf="+L,{width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/twitvid\.com/i)?(H="obj",B=B||"600px",T=T||"338px",F=j.split("/"),L=F[3],p=new Swiff("http://www.twitvid.com/player/"+L,{width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/ustream\.tv/i)?(H="obj",B=B||"400px",T=T||"326px",p=new Swiff(j+"&viewcount="+l.usViewers+"&autoplay="+l.autoplay,{width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/youku\.com/i)?(H="obj",B=B||"480px",T=T||"400px",F=j.split("id_"),L=F[1],p=new Swiff("http://player.youku.com/player.php/sid/"+L+"=/v.swf",{width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/youtube\.com\/watch/i)?(F=j.split("v="),p=l.html5?(H="url",B=B||"640px",T=T||"385px",L="mediaId_"+(new Date).getTime(),new Element("iframe",{src:"http://www.youtube.com/embed/"+F[1],id:L,width:B,height:T,frameborder:0})):(H="obj",L=F[1],T=L.match(/fmt=22/i)?(N="&ap=%2526fmt%3D22",B=B||"640px",T||"385px"):L.match(/fmt=18/i)?(N="&ap=%2526fmt%3D18",B=B||"560px",T||"345px"):(N=l.ytQuality,B=B||"480px",T||"295px"),new Swiff("http://www.youtube.com/v/"+L+"&autoplay="+l.autoplayNum+"&fs="+l.fullscreenNum+N+"&border="+l.ytBorder+"&color1=0x"+l.ytColor1+"&color2=0x"+l.ytColor2+"&rel="+l.ytRel+"&showinfo="+l.ytInfo+"&showsearch="+l.ytSearch,{id:L,width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}}))):j.match(/youtube\.com\/view/i)?(H="obj",F=j.split("p="),L=F[1],B=B||"480px",T=T||"385px",p=new Swiff("http://www.youtube.com/p/"+L+"&autoplay="
17664+l.autoplayNum+"&fs="+l.fullscreenNum+N+"&border="+l.ytBorder+"&color1=0x"+l.ytColor1+"&color2=0x"+l.ytColor2+"&rel="+l.ytRel+"&showinfo="+l.ytInfo+"&showsearch="+l.ytSearch,{id:L,width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/veoh\.com/i)?(H="obj",B=B||"410px",T=T||"341px",j=j.replace("%3D","/"),F=j.split("watch/"),L=F[1],p=new Swiff("http://www.veoh.com/static/swf/webplayer/WebPlayer.swf?version=AFrontend.5.5.2.1001&permalinkId="+L+"&player=videodetailsembedded&videoAutoPlay="+l.AutoplayNum+"&id=anonymous",{id:L,width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/viddler\.com/i)?(H="obj",B=B||"437px",T=T||"370px",F=j.split("/"),L=F[4],p=new Swiff(j,{id:"viddler_"+L,movie:j,classid:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen,id:"viddler_"+L,movie:j}})):j.match(/viddyou\.com/i)?(H="obj",B=B||"416px",T=T||"312px",F=j.split("="),L=F[1],p=new Swiff("http://www.viddyou.com/get/v2_"+l.vuPlayer+"/"+L+".swf",{id:L,movie:"http://www.viddyou.com/get/v2_"+l.vuPlayer+"/"+L+".swf",width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/vimeo\.com/i)?(B=B||"640px",T=T||"360px",F=j.split("/"),L=F[3],p=l.html5?(H="url",L="mediaId_"+(new Date).getTime(),new Element("iframe",{src:"http://player.vimeo.com/video/"+F[3]+"?portrait="+l.vmPortrait,id:L,width:B,height:T,frameborder:0})):(H="obj",new Swiff("http://www.vimeo.com/moogaloop.swf?clip_id="+L+"&server=www.vimeo.com&fullscreen="+l.fullscreenNum+"&autoplay="+l.autoplayNum+"&show_title="+l.vmTitle+"&show_byline="+l.vmByline+"&show_portrait="+l.vmPortrait+"&color="+l.vmColor,{id:L,width:B,height:T,params:{wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}}))):j.match(/12seconds\.tv/i)?(H="obj",B=B||"430px",T=T||"360px",F=j.split("/"),L=F[5],p=new Swiff("http://embed.12seconds.tv/players/remotePlayer.swf",{id:L,width:B,height:T,params:{flashvars:"vid="+L,wmode:l.wmode,bgcolor:l.bgcolor,allowscriptaccess:l.scriptaccess,allowfullscreen:l.fullscreen}})):j.match(/\#mb_/i)?(H="inline",B=B||l.defaultWidth,T=T||l.defaultHeight,URLsplit=j.split("#"),p=document.id(URLsplit[1]).get("html")):l.mediaTypeAjax?(H="ajax",l.resizeOpening=!1,l.keyboard=!1,l.alpha=!1,B=B||l.defaultWidth,T=T||l.defaultHeight,new Request.HTML({url:j,async:!1,evalScripts:!1,onSuccess:function(e,t,o,l){p=o,w=l}}).send()):(H="url",B=B||l.defaultWidth,T=T||l.defaultHeight,L="mediaId_"+(new Date).getTime(),p=new Element("iframe",{src:j,id:L,width:B,height:T,frameborder:0})),V())),-1===document.body.className.search(" salsa-lightbox-opened")&&(document.body.className+=" salsa-lightbox-opened"),"img"!==H&&-1===document.body.className.search(" salsa-lightbox-not-image")&&(document.body.className+=" salsa-lightbox-not-image"),u.addClass("mbType-"+H),!1}function V(){"img"==H?(B=p.width,T=p.height,l.imgBackground?f.setStyles({backgroundImage:"url("+j+")",display:""}):(T>=m-l.imgPadding&&B/n<=T/m?(T=m-l.imgPadding,B=p.width=parseInt(T/p.height*B),p.height=T):B>=n-l.imgPadding&&T/m<B/n&&(B=n-l.imgPadding,T=p.height=parseInt(B/p.width*T),p.width=B),Browser.Engine.trident&&(p=document.id(p)),p.addEvent("mousedown",function(e){e.stop()}).addEvent("contextmenu",function(e){e.stop()}),f.setStyles({backgroundImage:"none",display:""}),p.inject(f))):"obj"==H?Browser.Plugins.Flash.version<8?(f.setStyles({backgroundImage:"none",display:""}),f.set("html",'<div id="mbError"><b>Error</b><br/>Adobe Flash is either not installed or not up to date, please visit <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" title="Get Flash" target="_new">Adobe.com</a> to download the free player.</div>'),B=l.DefaultWidth,T=l.DefaultHeight):(f.setStyles({backgroundImage:"none",display:""}),p.inject(f)):"qt"==H?f.setStyles({backgroundImage:"none",display:""}):"inline"==H?(f.setStyles({backgroundImage:"none",display:""}),f.set("html",p)):"ajax"==H?(f.setStyles({backgroundImage:"none",display:""}),f.set("html",p),$exec(w)):"url"==H?(f.setStyles({backgroundImage:"none",display:""}),p.inject(f)):(f.setStyles({backgroundImage:"none",display:""}),f.set("html",'<div id="mbError"><b>Error</b><br/>A file type error has occoured, please visit <a href="iaian7.com/webcode/mediaboxAdvanced" title="mediaboxAdvanced" target="_new">iaian7.com</a> or contact the website author for more information.</div>'),B=l.defaultWidth,T=l.defaultHeight),f.setStyles({width:B,height:T}),v.setStyles({width:B}),y.set("html",l.showCaption?b[0]:""),v.set("html",l.showCaption&&1<b.length?b[1]:""),S.set("html",l.showCounter&&1<i.length?l.counterText.replace(/{x}/,o+1).replace(/{y}/,i.length):""),0<=a&&i[a][0].match(/\.gif|\.jpg|\.jpeg|\.png|twitpic\.com/i)&&(W.src=i[a][0].replace(/twitpic\.com/i,"twitpic.com/show/full")),0<=c&&i[c][0].match(/\.gif|\.jpg|\.jpeg|\.png|twitpic\.com/i)&&(_.src=i[c][0].replace(/twitpic\.com/i,"twitpic.com/show/full")),B=f.offsetWidth,T=f.offsetHeight+g.offsetHeight,e=r+r<=T?-r:-T/2,t=s+s<=B?-s:-B/2,l.resizeOpening?d.resize.start({width:B,height:T,marginTop:e-P,marginLeft:t-P}):(u.setStyles({width:B,height:T,marginTop:e-P,marginLeft:t-P}),U()),"ajax"==H&&u.setStyle("height","auto")}function U(){d.image.start(1)}function Q(){u.removeClass("mbLoading"),0<=a&&(x.style.display=""),0<=c&&(k.style.display=""),d.bottom.start(1)}function G(){if(0<=o){for(var e in p.onload=$empty,f.set("html",""),d)d[e].cancel();u.setStyle("display","none"),d.overlay.chain($).start(0)}return document.body.className=document.body.className.replace(" salsa-lightbox-opened",""),document.body.className=document.body.className.replace(" salsa-lightbox-not-image",""),!1}window.addEvent("domready",function(){document.id(document.body).adopt($$([h=new Element("div",{id:"mbOverlay"}).addEvent("click",G),u=new Element("div",{id:"mbCenter"})]).setStyle("display","none")),f=new Element("div",{id:"mbImage"}).injectInside(u),g=new Element("div",{id:"mbBottom"}).injectInside(u).adopt(closeLink=new Element("a",{id:"mbCloseLink",href:"#"}).addEvent("click",G),k=new Element("a",{id:"mbNextLink",href:"#"}).addEvent("click",R),x=new Element("a",{id:"mbPrevLink",href:"#"}).addEvent("click",O),y=new Element("div",{id:"mbTitle"}),v=new Element("div",{id:"mbCaption"}),S=new Element("div",{id:"mbNumber"})),d={overlay:new Fx.Tween(h,{property:"opacity",duration:360}).set(0),image:new Fx.Tween(f,{property:"opacity",duration:360,onComplete:Q}),bottom:new Fx.Tween(g,{property:"opacity",duration:240}).set(0)}}),Mediabox={close:function(){G()},open:function(e,t,o){return l=$extend({text:["<big>«</big>","<big>»</big>","<big>
17664×</big>"],loop:!1,keyboard:!0,alpha:!0,stopKey:!1,overlayOpacity:.7,resizeOpening:!0,resizeDuration:240,resizeTransition:!1,initialWidth:320,initialHeight:180,defaultWidth:640,defaultHeight:360,showCaption:!0,showCounter:!0,counterText:"({x} of {y})",imgBackground:!1,imgPadding:100,html5:"true",scriptaccess:"true",fullscreen:"true",fullscreenNum:"1",autoplay:"true",autoplayNum:"1",autoplayYes:"yes",volume:"100",medialoop:"true",bgcolor:"#000000",wmode:"opaque",useNB:!0,playerpath:"/js/NonverBlaster.swf",controlColor:"0xFFFFFF",controlBackColor:"0x000000",showTimecode:"false",JWplayerpath:"/js/player.swf",backcolor:"000000",frontcolor:"999999",lightcolor:"000000",screencolor:"000000",controlbar:"over",controller:"true",flInfo:"true",revverID:"187866",revverFullscreen:"true",revverBack:"000000",revverFront:"ffffff",revverGrad:"000000",usViewers:"true",ytBorder:"0",ytColor1:"000000",ytColor2:"333333",ytQuality:"&ap=%2526fmt%3D18",ytRel:"0",ytInfo:"1",ytSearch:"0",vuPlayer:"basic",vmTitle:"1",vmByline:"1",vmPortrait:"1",vmColor:"ffffff",mediaTypeAjax:!1},o||{}),x.set("html",l.text[0]),k.set("html",l.text[1]),closeLink.set("html",l.text[2]),P=u.getStyle("padding-left").toInt()+f.getStyle("margin-left").toInt()+f.getStyle("padding-left").toInt(),Browser.Engine.gecko&&Browser.Engine.version<19&&(l.overlayOpacity=1,h.className="mbOverlayFF"),Browser.Engine.trident&&Browser.Engine.version<5&&(D=!0,h.className="mbOverlayIE",h.setStyle("position","absolute"),A()),"string"==typeof e&&(e=[[e,t,o]],t=0),i=e,l.loop=l.loop&&1<i.length,M(),$(!0),r=window.getScrollTop()+window.getHeight()/2,s=window.getScrollLeft()+window.getWidth()/2,d.resize=new Fx.Morph(u,$extend({duration:l.resizeDuration,onComplete:U},l.resizeTransition?{transition:l.resizeTransition}:{})),u.setStyles({top:r,left:s,width:l.initialWidth,height:l.initialHeight,marginTop:-l.initialHeight/2-P,marginLeft:-l.initialWidth/2-P,display:""}),d.overlay.start(l.overlayOpacity),q(t)}},Element.implement({mediabox:function(e,t){return $$(this).mediabox(e,t),this}}),Elements.implement({mediabox:function(e,t,a){t=t||function(e){return C=e.rel.split(/[\[\]]/)[1],[e.href,e.title,C]},a=a||function(){return!0};var c=this;return c.addEvent("contextmenu",function(e){this.toString().match(/\.gif|\.jpg|\.jpeg|\.png/i)&&e.stop()}),c.removeEvents("click").addEvent("click",function(){var o=c.filter(a,this),l=[],i=[];return o.each(function(e,t){i.indexOf(e.toString())<0&&(l.include(o[t]),i.include(o[t].toString()))}),Mediabox.open(l.map(t),i.indexOf(this.toString()),e)}),c}})}(),Mediabox.scanPage=function(){var e=$$("a").filter(function(e){return e.rel&&e.rel.test(/^lightbox/i)});$$(e).mediabox({},null,function(e){var t=this.rel.replace(/[[]|]/gi," ").split(" ");return this==e||8<this.rel.length&&e.rel.match(t[1])})},Mediabox.scanPageRelay=function(){document.addEvent("click:relay(a[rel*=lightbox])",function(e){e.stop();e=document.getElements("a[rel*=lightbox]");e.addEvent("contextmenu",function(e){this.toString().match(/\.gif|\.jpg|\.jpeg|\.png/i)&&e.stop()});var o=e.filter(function(e){var t=this.rel.replace(/[[]|]/gi," ").split(" ");return this==e||8<this.rel.length&&e.rel.match(t[1])},this),l=[],i=[];o.each(function(e,t){i.indexOf(e.toString())<0&&(l.include(o[t]),i.include(o[t].toString()))});e={mediaTypeAjax:l.map(function(e){return"1"==e.get("data-ajax")}).reduce(function(e,t){return e||t})};return Mediabox.open(l.map(function(e){var t=(t=e.rel.split(/[\[\]]/))[1];return[e.href,e.title,t]}),i.indexOf(this.toString()),e)})},window.addEvent("domready",Mediabox.scanPageRelay); 17665 17666var noobSlide=new Class({initialize:function(t){if(this.items=t.items,this.mode=t.mode||"horizontal",this.modes={horizontal:["left","width"],vertical:["top","height"]},this.size=t.size||240,this.box=t.box.setStyle(this.modes[this.mode][1],this.size*this.items.length+"px"),this.button_event=t.button_event||"click",this.handle_event=t.handle_event||"click",this.onWalk=t.onWalk||null,this.currentIndex=null,this.previousIndex=null,this.nextIndex=null,this.interval=t.interval||5e3,this.autoPlay=t.autoPlay||!1,this._play=null,this.handles=t.handles||null,this.handles&&this.addHandleButtons(this.handles),this.buttons={previous:[],next:[],play:[],playback:[],stop:[]},t.addButtons)for(var s in t.addButtons)this.addActionButtons(s,"array"==$type(t.addButtons[s])?t.addButtons[s]:[t.addButtons[s]]);this.fx=new Fx.Tween(this.box,$extend(t.fxOptions||{duration:500,wait:!1},{property:this.modes[this.mode][0]})),this.walk(t.startItem||0,!0,!0)},setSize:function(t){this.size=t,this.box=this.box.setStyle(this.modes[this.mode][1],this.size*this.items.length+"px")},addHandleButtons:function(t){for(var s=0;s<t.length;s++)t[s].addEvent(this.handle_event,this.walk.pass([s,!0],this))},addActionButtons:function(t,s){for(var e=0;e<s.length;e++){switch(t){case"previous":s[e].addEvent(this.button_event,this.previous.pass([!0],this));break;case"next":s[e].addEvent(this.button_event,this.next.pass([!0],this));break;case"play":s[e].addEvent(this.button_event,this.play.pass([this.interval,"next",!1],this));break;case"playback":s[e].addEvent(this.button_event,this.play.pass([this.interval,"previous",!1],this));break;case"stop":s[e].addEvent(this.button_event,this.stop.create({bind:this}))}this.buttons[t].push(s[e])}},previous:function(t){this.walk(0<this.currentIndex?this.currentIndex-1:this.items.length-1,t)},next:function(t){this.walk(this.currentIndex<this.items.length-1?this.currentIndex+1:0,t)},play:function(t,s,e){this.stop(),e||this[s](!1),this._play=this[s].periodical(t,this,[!1])},stop:function(){$clear(this._play)},walk:function(t,s,e){t!=this.currentIndex&&(this.currentIndex=t,this.previousIndex=this.currentIndex+(0<this.currentIndex?-1:this.items.length-1),this.nextIndex=this.currentIndex+(this.currentIndex<this.items.length-1?1:1-this.items.length),s&&this.stop(),e?this.fx.cancel().set(this.size*-this.currentIndex+"px"):this.fx.start(this.size*-this.currentIndex),s&&this.autoPlay&&this.play(this.interval,"next",!0),this.onWalk&&this.onWalk(this.items[this.currentIndex]||null,this.handles&&this.handles[this.currentIndex]?this.handles[this.currentIndex]:null))}}); 17667 17668var SalsaAgree=new Class({Implements:Options,options:{active_class:"active",agree_button:".agree",disagree_button:".disagree",value_input:".value"},initialize:function(t,e){this.setOptions(e),document.getElements(t).each(function(t){var e=t.getElement(this.options.agree_button),s=t.getElement(this.options.disagree_button),i=t.getElement(this.options.value_input);e.addEvent("click",function(t){t.preventDefault(),this._toggle_value(e,s,i,"1")}.bind(this)),s.addEvent("click",function(t){t.preventDefault(),this._toggle_value(s,e,i,"-1")}.bind(this))}.bind(this))},_toggle_value:function(t,e,s,i){t.hasClass(this.options.active_class)?(t.removeClass(this.options.active_class),s.set("value","")):(t.addClass(this.options.active_class),s.set("value",i),e.hasClass(this.options.active_class)&&e.removeClass(this.options.active_class))}}); 17669 17670var SalsaFormValidator=new Class({Extends:FormValidator.Inline,initialize:function(e,a,o){SalsaFormValidator.initLang(a),SalsaFormValidator.initV
17670alidators(this),this.parent(document.id(e),o)}});SalsaFormValidator.initValidators=function(e){e.add("validate-recaptcha",{errorMsg:function(){return Form.Validator.getMsg("validateRecaptcha")},test:function(e){e=e.getParent().getChildren(".g-recaptcha");return!!e&&0<e.getElement(".g-recaptcha-response")[0].get("value").length}})},SalsaFormValidator.initLang=function(e){"it"==e?MooTools.lang.setLanguage("it-IT"):"es"==e?MooTools.lang.setLanguage("es-ES"):"pt"==e?MooTools.lang.setLanguage("pt-PT"):"fr"==e?MooTools.lang.setLanguage("fr-FR"):"es"==e?MooTools.lang.setLanguage("de-DE"):MooTools.lang.setLanguage("en-US")},MooTools.lang.set("it-IT","FormValidator",{required:"Il campo è obbligatorio.",minLength:"Inserire almeno {minLength} caratteri (ne sono stati inseriti {length}).",maxLength:"Inserire al massimo {maxLength} caratteri (ne sono stati inseriti {length}).",integer:"Inserire un numero intero. Non sono consentiti decimali (es.: 1.25).",numeric:'Inserire solo valori numerici (es.: "1" oppure "1.1" oppure "-1" oppure "-1.1").',digits:"Inserire solo numeri e caratteri di punteggiatura. Per esempio è consentito un numero telefonico con trattini o punti.",alpha:"Inserire solo lettere (a-z). Non sono consentiti spazi o altri caratteri.",alphanum:"Inserire solo lettere (a-z) o numeri (0-9). Non sono consentiti spazi o altri caratteri.",dateSuchAs:"Inserire una data valida del tipo {date}",dateInFormatMDY:'Inserire una data valida nel formato MM/GG/AAAA (es.: "12/31/1999")',email:'Inserire un indirizzo email valido. Per esempio "[email protected]".',url:'Inserire un indirizzo valido. Per esempio "http://www.dominio.com".',currencyDollar:'Inserire un importo valido. Per esempio "$100.00".',oneRequired:"Completare almeno uno dei campi richiesti.",errorPrefix:"Errore: ",warningPrefix:"Attenzione: ",requiredChk:"Il campo è obbligatorio.",match:"Questo campo deve coincidere con il campo {matchName}",validateRecaptcha:"Controllo antispam non riuscito."}),MooTools.lang.set("en-GB","FormValidator",{validateRecaptcha:"Antispam check failed."}),MooTools.lang.set("en-US","FormValidator",{validateRecaptcha:"Antispam check failed."}),MooTools.lang.set("es-ES","FormValidator",{required:"Este campo es obligatorio.",minLength:"Por favor introduce al menos {minLength} caracteres (has introducido {length} caracteres).",maxLength:"Por favor introduce no mas de {maxLength} caracteres (has introducido {length} caracteres).",integer:"Por favor introduce un numero entero en este campo. Numeros con decimales (p.e. 1,25) no se permiten.",numeric:'Por favor introduce solo valores numericos en este campo (p.e. "1" o "1,1" o "-1" o "-1,1").',digits:"Por favor usa solo numeros y puntuacion en este campo (por ejemplo, un numero de telefono con guines y puntos no esta permitido).",alpha:"Por favor usa letras solo (a-z) en este campo. No se admiten espacios ni otros caracteres.",alphanum:"Por favor, usa solo letras (a-z) o numeros (0-9) en este campo. No se admiten espacios ni otros caracteres.",dateSuchAs:"Por favor introduce una fecha valida como {date}",dateInFormatMDY:'Por favor introduce una fecha valida como DD/MM/YYYY (p.e. "31/12/1999")',email:'Por favor, introduce una direccione de email valida. Por ejemplo, "[email protected]".',url:"Por favor introduce una URL valida como http://www.google.com.",currencyDollar:"Por favor introduce una cantidad valida de €. Por ejemplo €100,00 .",oneRequired:"Por favor introduce algo para por lo menos una de estas entradas.",errorPrefix:"Error: ",warningPrefix:"Aviso: ",requiredChk:"Este campo es obligatorio.",validateRecaptcha:"Cheque AntiSpam falló."}),MooTools.lang.set("pt-PT","FormValidator",{required:"Este campo é necessário.",minLength:"Digite pelo menos{minLength} caracteres (comprimento {length} caracteres).",maxLength:"Não insira mais de {maxLength} caracteres (comprimento {length} caracteres).",integer:"Digite um número inteiro neste domínio. Com números decimais (por exemplo, 1,25), não são permitidas.",numeric:'Digite apenas valores numéricos neste domínio (p.ex., "1" ou "1.1" ou "-1" ou "-1,1").',digits:"Por favor, use números e pontuação apenas neste campo (p.ex., um número de telefone com traços ou pontos é permitida).",alpha:"Por favor use somente letras (a-z), com nesta área. Não utilize espaços nem outros caracteres são permitidos.",alphanum:"Use somente letras (a-z) ou números (0-9) neste campo. Não utilize espaços nem outros caracteres são permitidos.",dateSuchAs:"Digite uma data válida, como {date}",dateInFormatMDY:'Digite uma data válida, como DD/MM/YYYY (p.ex. "31/12/1999")',email:'Digite um endereço de email válido. Por exemplo "[email protected]".',url:"Digite uma URL válida, como http://www.google.com.",currencyDollar:"Digite um valor válido $. Por exemplo $ 100,00. ",oneRequired:"Digite algo para pelo menos um desses insumos.",errorPrefix:"Erro: ",warningPrefix:"Aviso: ",requiredChk:"Este campo é necessário.",validateRecaptcha:"Verificação Antispam falhou."}),MooTools.lang.set("fr-FR","FormValidator",{required:"Ce champ est obligatoire.",minLength:"S'il vous vous plat crivez au moins {minLength} caractres (vous avez crit {length} caractres).",maxLength:"S'il vous vous plat n'crivez pas plus de {maxLength} caractres (vous avez crit {length} caractres).",integer:"S'il vous vous plat crivez un nombre entier dans ce champ. Les nombres avec des dcimals (p.ex. 1'25) ne sont pas permis.",numeric:'S\'il vous vous plat crivez seulement des chiffres dans ce champ (p.ex. "1" ou "1\'1" ou "-1" or "-1\'1").',digits:"S'il vous vous plat crivez des nombres et des signes de ponctuation seulement dans ce champ (par exemple, un numro de tlphone avec des traits d'union est permis).",alpha:"S'il vous vous plat crivez seulement des lettres (a-z) dans ce champ. Les espaces ou d'autres caractres ne sont pas permis.",alphanum:"S'il vous vous plat crivez seulement des lettres (a-z) ou des chiffres (0-9) dans ce champ. Les espaces ou d'autres caractres ne sont pas permis.",dateSuchAs:"S'il vous vous plat crivez une date correcte, comme {date}",dateInFormatMDY:'S\'il vous vous plat crivez une date correcte, comme JJ/MM/AAAA (p.ex. "31/11/1999")',email:'S\'il vous vous plat crivez une adresse de courrier lectronique. Par example "[email protected]".',url:"S'il vous vous plat crivez une URL, comme http://www.google.com.",currencyDollar:"S'il vous vous plat crivez une quantit correcte. Par example $100.00 .",oneRequired:"S'il vous vous plat slectionnez au moins une de ces options.",errorPrefix:"Erreur: ",warningPrefix:"Attention: ",requiredChk:"Ce champ est obligatoire.",validateRecaptcha:"Vérification anti-spam a échoué."}),MooTools.lang.set("de-DE","FormValidator",{required:"Dit veld is verplicht.",minLength:"Vul minimaal {minLength} karakters in (je hebt {length} karakters ingevoerd).",maxLength:"Vul niet meer dan {maxLength} karakters in (je hebt {length} karakters ingevoerd).",integer:"Vul een getal in. Getallen met decimalen (bijvoorbeeld 1,25) zijn niet toegestaan.",numeric:'Vul alleen numerieke waarden in (bijvoorbeeld. "1" of "1.1" of "-1" of "-1.1").',digits:"Vul alleen nummers en leestekens in (bijvoorbeeld een telefoonnummer met een streepje).",alpha:"Vul alleen letters in (a-z). Spaties en andere karakters zijn niet toegestaan.",alphanum:"Vul alleen letters in (a-z) of nummers (0-9). Spaties en andere karakters zijn niet toegestaan.",dateSuchAs:"Vul een geldige datum in, zoals {date}",dateInFormatMDY:'Vul een geldige datum, in het formaat MM/DD/YYYY (bijvoorbeeld "12/31/1999")',email:'Vul een geldig e-mailadres in. Bijvoorbeeld "[email protected]".',url:"Vul een geldige URL in, zoals http://www.google.nl.",currencyDollar:"Vul een geldig $ bedrag in. Bijvoorbeeld $100.00 .",oneRequired:"Vul iets in bij minimaal een van de invoervelden.",warningPrefix:"Waarschuwing: ",errorPrefix:"Fout: ",requiredChk:"Dit veld is verplicht.",validateRecaptcha:"Anti-Spam-Prüfung fehlgeschlagen."}); 17671 17672var SalsaAccount=new Class({Implements:[Options,Events],options:{return_url:"",action_url:"",form_id:"",button_id:"",on_complete:function(){}},initialize:function(t){this.setOptions(t),this.form=document.id(this.options.form_id),this.button=document.id(this.options.button_id),this.errors_container=this.form?this.form.getElement(".errors"):null,this._init_events()},_init_events:function(){this.button.addEvent("click",function(t){t.preventDefault(),this._call()}.bind(this))},_call:function(){if(this.form&&!this.form.validate())return!1;new Request.JSON({url:this.options.action_url,data:this.form?this.form.toQueryString():"",onRequest:function(){this.button.addClass("loading"),this.button.set("disabled","disabled")}.bind(this),onComplete:function(t){t.success?""!=this.options.return_url?parent.location.href=this.options.return_url:(this.button.removeClass("loading"),this.button.set("disabled",""),this.options.on_complete(t)):(this.button.removeClass("loading"),this.button.set("disabled",""),this.errors_container&&this.errors_container.set("html",t.error_text))}.bind(this)}).send()}});SalsaAccount.openPopup=function(t,i,n){var o=(window.parent.getSize().x-i)/2,s=(window.parent.getSize().y-n)/2;
17672window.open(t,"","width="+i+", height="+n+", top="+s+", left="+o)}; 17673 17674var SalsaPolicies=new Class({Implements:[Options,Events],options:{container:"",advice_view_url:""},initialize:function(i){this.setOptions(i),this.cookie_name="salsa_policies_advice",this.container=document.id(this.options.container),this._load_advice()},_load_advice:function(){null===Cookie.read(this.cookie_name)&&new Request.HTML({url:this.options.advice_view_url,onSuccess:function(i,n,t){this.container.set("html",t),this._init_events()}.bind(this)}).send()},_init_events:function(){document.getElements(".salsa-policies-advice-button").each(function(i){i.addEvent("click",function(i){this.container.empty(),Cookie.write(this.cookie_name,"1",{duration:3650})}.bind(this))}.bind(this))}}); 17675
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.