├── 13.jpg ├── 13.png ├── 328-dip.jpg ├── 328-mlf28.jpg ├── 328.jpg ├── 328.png ├── LICENSE ├── README.md ├── core.js ├── gogo.js ├── index.html ├── more.js ├── templates.js ├── tiny4,9.jpg ├── tiny4,9.png ├── tiny5,10.jpg ├── tiny5,10.png ├── tiny828.jpg ├── x4-alt.jpg ├── x4-alt.png ├── x4.jpg ├── x4.png ├── x5.jpg └── x5.png /13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sleemanj/ArduinoOrientedChipPinoutCreator/fcbb550b228ac05cd2431d088f6923cf2730f129/13.jpg -------------------------------------------------------------------------------- /13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sleemanj/ArduinoOrientedChipPinoutCreator/fcbb550b228ac05cd2431d088f6923cf2730f129/13.png -------------------------------------------------------------------------------- /328-dip.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sleemanj/ArduinoOrientedChipPinoutCreator/fcbb550b228ac05cd2431d088f6923cf2730f129/328-dip.jpg -------------------------------------------------------------------------------- /328-mlf28.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sleemanj/ArduinoOrientedChipPinoutCreator/fcbb550b228ac05cd2431d088f6923cf2730f129/328-mlf28.jpg -------------------------------------------------------------------------------- /328.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sleemanj/ArduinoOrientedChipPinoutCreator/fcbb550b228ac05cd2431d088f6923cf2730f129/328.jpg -------------------------------------------------------------------------------- /328.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sleemanj/ArduinoOrientedChipPinoutCreator/fcbb550b228ac05cd2431d088f6923cf2730f129/328.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 James Sleeman 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # James' Dodgy Arduino-Oriented Pinout Maker For Microcontrollers 2 | 3 | A quick-and-dirty tool to create a simple Arduino-oriented pinout diagrams of a Microcontroller (2 sided or 4 sided) IC from a JSON based description of the IC. 4 | 5 | Download/Clone and open the index.html in your browser (no server required). 6 | 7 | Tested in Chrome only. 8 | 9 | A few templates have been built in you can select from, and hit the Draw It button. 10 | 11 | If you want to create a new template, open the templates.js file and you will find it well commented and easy to understand. 12 | 13 | Examples 14 | --- 15 | 16 | ### ATTiny13 17 | ![ATTiny13 Example](https://cdn.rawgit.com/sleemanj/ArduinoOrientedChipPinoutCreator/master/13.jpg) 18 | 19 | ### ATMega328 QFP/MLF32 20 | ![ATMega328 Example](https://rawgit.com/sleemanj/ArduinoOrientedChipPinoutCreator/master/328.png) 21 | -------------------------------------------------------------------------------- /core.js: -------------------------------------------------------------------------------- 1 | /* 2 | --- 3 | MooTools: the javascript framework 4 | 5 | web build: 6 | - http://mootools.net/core/7c56cfef9dddcf170a5d68e3fb61cfd7 7 | 8 | packager 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.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 | name: Core 15 | 16 | description: The heart of MooTools. 17 | 18 | license: MIT-style license. 19 | 20 | copyright: Copyright (c) 2006-2010 [Valerio Proietti](http://mad4milk.net/). 21 | 22 | authors: The MooTools production team (http://mootools.net/developers/) 23 | 24 | inspiration: 25 | - 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) 26 | - Some functionality inspired by [Prototype.js](http://prototypejs.org) Copyright (c) 2005-2007 Sam Stephenson, [MIT License](http://opensource.org/licenses/mit-license.php) 27 | 28 | provides: [Core, MooTools, Type, typeOf, instanceOf, Native] 29 | 30 | ... 31 | */ 32 | 33 | (function(){ 34 | 35 | this.MooTools = { 36 | version: '1.3.1', 37 | build: 'af48c8d589f43f32212f9bb8ff68a127e6a3ba6c' 38 | }; 39 | 40 | // typeOf, instanceOf 41 | 42 | var typeOf = this.typeOf = function(item){ 43 | if (item == null) return 'null'; 44 | if (item.$family) return item.$family(); 45 | 46 | if (item.nodeName){ 47 | if (item.nodeType == 1) return 'element'; 48 | if (item.nodeType == 3) return (/\S/).test(item.nodeValue) ? 'textnode' : 'whitespace'; 49 | } else if (typeof item.length == 'number'){ 50 | if (item.callee) return 'arguments'; 51 | if ('item' in item) return 'collection'; 52 | } 53 | 54 | return typeof item; 55 | }; 56 | 57 | var instanceOf = this.instanceOf = function(item, object){ 58 | if (item == null) return false; 59 | var constructor = item.$constructor || item.constructor; 60 | while (constructor){ 61 | if (constructor === object) return true; 62 | constructor = constructor.parent; 63 | } 64 | return item instanceof object; 65 | }; 66 | 67 | // Function overloading 68 | 69 | var Function = this.Function; 70 | 71 | var enumerables = true; 72 | for (var i in {toString: 1}) enumerables = null; 73 | if (enumerables) enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'constructor']; 74 | 75 | Function.prototype.overloadSetter = function(usePlural){ 76 | var self = this; 77 | return function(a, b){ 78 | if (a == null) return this; 79 | if (usePlural || typeof a != 'string'){ 80 | for (var k in a) self.call(this, k, a[k]); 81 | if (enumerables) for (var i = enumerables.length; i--;){ 82 | k = enumerables[i]; 83 | if (a.hasOwnProperty(k)) self.call(this, k, a[k]); 84 | } 85 | } else { 86 | self.call(this, a, b); 87 | } 88 | return this; 89 | }; 90 | }; 91 | 92 | Function.prototype.overloadGetter = function(usePlural){ 93 | var self = this; 94 | return function(a){ 95 | var args, result; 96 | if (usePlural || typeof a != 'string') args = a; 97 | else if (arguments.length > 1) args = arguments; 98 | if (args){ 99 | result = {}; 100 | for (var i = 0; i < args.length; i++) result[args[i]] = self.call(this, args[i]); 101 | } else { 102 | result = self.call(this, a); 103 | } 104 | return result; 105 | }; 106 | }; 107 | 108 | Function.prototype.extend = function(key, value){ 109 | this[key] = value; 110 | }.overloadSetter(); 111 | 112 | Function.prototype.implement = function(key, value){ 113 | this.prototype[key] = value; 114 | }.overloadSetter(); 115 | 116 | // From 117 | 118 | var slice = Array.prototype.slice; 119 | 120 | Function.from = function(item){ 121 | return (typeOf(item) == 'function') ? item : function(){ 122 | return item; 123 | }; 124 | }; 125 | 126 | Array.from = function(item){ 127 | if (item == null) return []; 128 | return (Type.isEnumerable(item) && typeof item != 'string') ? (typeOf(item) == 'array') ? item : slice.call(item) : [item]; 129 | }; 130 | 131 | Number.from = function(item){ 132 | var number = parseFloat(item); 133 | return isFinite(number) ? number : null; 134 | }; 135 | 136 | String.from = function(item){ 137 | return item + ''; 138 | }; 139 | 140 | // hide, protect 141 | 142 | Function.implement({ 143 | 144 | hide: function(){ 145 | this.$hidden = true; 146 | return this; 147 | }, 148 | 149 | protect: function(){ 150 | this.$protected = true; 151 | return this; 152 | } 153 | 154 | }); 155 | 156 | // Type 157 | 158 | var Type = this.Type = function(name, object){ 159 | if (name){ 160 | var lower = name.toLowerCase(); 161 | var typeCheck = function(item){ 162 | return (typeOf(item) == lower); 163 | }; 164 | 165 | Type['is' + name] = typeCheck; 166 | if (object != null){ 167 | object.prototype.$family = (function(){ 168 | return lower; 169 | }).hide(); 170 | //<1.2compat> 171 | object.type = typeCheck; 172 | // 173 | } 174 | } 175 | 176 | if (object == null) return null; 177 | 178 | object.extend(this); 179 | object.$constructor = Type; 180 | object.prototype.$constructor = object; 181 | 182 | return object; 183 | }; 184 | 185 | var toString = Object.prototype.toString; 186 | 187 | Type.isEnumerable = function(item){ 188 | return (item != null && typeof item.length == 'number' && toString.call(item) != '[object Function]' ); 189 | }; 190 | 191 | var hooks = {}; 192 | 193 | var hooksOf = function(object){ 194 | var type = typeOf(object.prototype); 195 | return hooks[type] || (hooks[type] = []); 196 | }; 197 | 198 | var implement = function(name, method){ 199 | if (method && method.$hidden) return; 200 | 201 | var hooks = hooksOf(this); 202 | 203 | for (var i = 0; i < hooks.length; i++){ 204 | var hook = hooks[i]; 205 | if (typeOf(hook) == 'type') implement.call(hook, name, method); 206 | else hook.call(this, name, method); 207 | } 208 | 209 | var previous = this.prototype[name]; 210 | if (previous == null || !previous.$protected) this.prototype[name] = method; 211 | 212 | if (this[name] == null && typeOf(method) == 'function') extend.call(this, name, function(item){ 213 | return method.apply(item, slice.call(arguments, 1)); 214 | }); 215 | }; 216 | 217 | var extend = function(name, method){ 218 | if (method && method.$hidden) return; 219 | var previous = this[name]; 220 | if (previous == null || !previous.$protected) this[name] = method; 221 | }; 222 | 223 | Type.implement({ 224 | 225 | implement: implement.overloadSetter(), 226 | 227 | extend: extend.overloadSetter(), 228 | 229 | alias: function(name, existing){ 230 | implement.call(this, name, this.prototype[existing]); 231 | }.overloadSetter(), 232 | 233 | mirror: function(hook){ 234 | hooksOf(this).push(hook); 235 | return this; 236 | } 237 | 238 | }); 239 | 240 | new Type('Type', Type); 241 | 242 | // Default Types 243 | 244 | var force = function(name, object, methods){ 245 | var isType = (object != Object), 246 | prototype = object.prototype; 247 | 248 | if (isType) object = new Type(name, object); 249 | 250 | for (var i = 0, l = methods.length; i < l; i++){ 251 | var key = methods[i], 252 | generic = object[key], 253 | proto = prototype[key]; 254 | 255 | if (generic) generic.protect(); 256 | 257 | if (isType && proto){ 258 | delete prototype[key]; 259 | prototype[key] = proto.protect(); 260 | } 261 | } 262 | 263 | if (isType) object.implement(prototype); 264 | 265 | return force; 266 | }; 267 | 268 | force('String', String, [ 269 | 'charAt', 'charCodeAt', 'concat', 'indexOf', 'lastIndexOf', 'match', 'quote', 'replace', 'search', 270 | 'slice', 'split', 'substr', 'substring', 'toLowerCase', 'toUpperCase' 271 | ])('Array', Array, [ 272 | 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice', 273 | 'indexOf', 'lastIndexOf', 'filter', 'forEach', 'every', 'map', 'some', 'reduce', 'reduceRight' 274 | ])('Number', Number, [ 275 | 'toExponential', 'toFixed', 'toLocaleString', 'toPrecision' 276 | ])('Function', Function, [ 277 | 'apply', 'call', 'bind' 278 | ])('RegExp', RegExp, [ 279 | 'exec', 'test' 280 | ])('Object', Object, [ 281 | 'create', 'defineProperty', 'defineProperties', 'keys', 282 | 'getPrototypeOf', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 283 | 'preventExtensions', 'isExtensible', 'seal', 'isSealed', 'freeze', 'isFrozen' 284 | ])('Date', Date, ['now']); 285 | 286 | Object.extend = extend.overloadSetter(); 287 | 288 | Date.extend('now', function(){ 289 | return +(new Date); 290 | }); 291 | 292 | new Type('Boolean', Boolean); 293 | 294 | // fixes NaN returning as Number 295 | 296 | Number.prototype.$family = function(){ 297 | return isFinite(this) ? 'number' : 'null'; 298 | }.hide(); 299 | 300 | // Number.random 301 | 302 | Number.extend('random', function(min, max){ 303 | return Math.floor(Math.random() * (max - min + 1) + min); 304 | }); 305 | 306 | // forEach, each 307 | 308 | var hasOwnProperty = Object.prototype.hasOwnProperty; 309 | Object.extend('forEach', function(object, fn, bind){ 310 | for (var key in object){ 311 | if (hasOwnProperty.call(object, key)) fn.call(bind, object[key], key, object); 312 | } 313 | }); 314 | 315 | Object.each = Object.forEach; 316 | 317 | Array.implement({ 318 | 319 | forEach: function(fn, bind){ 320 | for (var i = 0, l = this.length; i < l; i++){ 321 | if (i in this) fn.call(bind, this[i], i, this); 322 | } 323 | }, 324 | 325 | each: function(fn, bind){ 326 | Array.forEach(this, fn, bind); 327 | return this; 328 | } 329 | 330 | }); 331 | 332 | // Array & Object cloning, Object merging and appending 333 | 334 | var cloneOf = function(item){ 335 | switch (typeOf(item)){ 336 | case 'array': return item.clone(); 337 | case 'object': return Object.clone(item); 338 | default: return item; 339 | } 340 | }; 341 | 342 | Array.implement('clone', function(){ 343 | var i = this.length, clone = new Array(i); 344 | while (i--) clone[i] = cloneOf(this[i]); 345 | return clone; 346 | }); 347 | 348 | var mergeOne = function(source, key, current){ 349 | switch (typeOf(current)){ 350 | case 'object': 351 | if (typeOf(source[key]) == 'object') Object.merge(source[key], current); 352 | else source[key] = Object.clone(current); 353 | break; 354 | case 'array': source[key] = current.clone(); break; 355 | default: source[key] = current; 356 | } 357 | return source; 358 | }; 359 | 360 | Object.extend({ 361 | 362 | merge: function(source, k, v){ 363 | if (typeOf(k) == 'string') return mergeOne(source, k, v); 364 | for (var i = 1, l = arguments.length; i < l; i++){ 365 | var object = arguments[i]; 366 | for (var key in object) mergeOne(source, key, object[key]); 367 | } 368 | return source; 369 | }, 370 | 371 | clone: function(object){ 372 | var clone = {}; 373 | for (var key in object) clone[key] = cloneOf(object[key]); 374 | return clone; 375 | }, 376 | 377 | append: function(original){ 378 | for (var i = 1, l = arguments.length; i < l; i++){ 379 | var extended = arguments[i] || {}; 380 | for (var key in extended) original[key] = extended[key]; 381 | } 382 | return original; 383 | } 384 | 385 | }); 386 | 387 | // Object-less types 388 | 389 | ['Object', 'WhiteSpace', 'TextNode', 'Collection', 'Arguments'].each(function(name){ 390 | new Type(name); 391 | }); 392 | 393 | // Unique ID 394 | 395 | var UID = Date.now(); 396 | 397 | String.extend('uniqueID', function(){ 398 | return (UID++).toString(36); 399 | }); 400 | 401 | //<1.2compat> 402 | 403 | var Hash = this.Hash = new Type('Hash', function(object){ 404 | if (typeOf(object) == 'hash') object = Object.clone(object.getClean()); 405 | for (var key in object) this[key] = object[key]; 406 | return this; 407 | }); 408 | 409 | Hash.implement({ 410 | 411 | forEach: function(fn, bind){ 412 | Object.forEach(this, fn, bind); 413 | }, 414 | 415 | getClean: function(){ 416 | var clean = {}; 417 | for (var key in this){ 418 | if (this.hasOwnProperty(key)) clean[key] = this[key]; 419 | } 420 | return clean; 421 | }, 422 | 423 | getLength: function(){ 424 | var length = 0; 425 | for (var key in this){ 426 | if (this.hasOwnProperty(key)) length++; 427 | } 428 | return length; 429 | } 430 | 431 | }); 432 | 433 | Hash.alias('each', 'forEach'); 434 | 435 | Object.type = Type.isObject; 436 | 437 | var Native = this.Native = function(properties){ 438 | return new Type(properties.name, properties.initialize); 439 | }; 440 | 441 | Native.type = Type.type; 442 | 443 | Native.implement = function(objects, methods){ 444 | for (var i = 0; i < objects.length; i++) objects[i].implement(methods); 445 | return Native; 446 | }; 447 | 448 | var arrayType = Array.type; 449 | Array.type = function(item){ 450 | return instanceOf(item, Array) || arrayType(item); 451 | }; 452 | 453 | this.$A = function(item){ 454 | return Array.from(item).slice(); 455 | }; 456 | 457 | this.$arguments = function(i){ 458 | return function(){ 459 | return arguments[i]; 460 | }; 461 | }; 462 | 463 | this.$chk = function(obj){ 464 | return !!(obj || obj === 0); 465 | }; 466 | 467 | this.$clear = function(timer){ 468 | clearTimeout(timer); 469 | clearInterval(timer); 470 | return null; 471 | }; 472 | 473 | this.$defined = function(obj){ 474 | return (obj != null); 475 | }; 476 | 477 | this.$each = function(iterable, fn, bind){ 478 | var type = typeOf(iterable); 479 | ((type == 'arguments' || type == 'collection' || type == 'array' || type == 'elements') ? Array : Object).each(iterable, fn, bind); 480 | }; 481 | 482 | this.$empty = function(){}; 483 | 484 | this.$extend = function(original, extended){ 485 | return Object.append(original, extended); 486 | }; 487 | 488 | this.$H = function(object){ 489 | return new Hash(object); 490 | }; 491 | 492 | this.$merge = function(){ 493 | var args = Array.slice(arguments); 494 | args.unshift({}); 495 | return Object.merge.apply(null, args); 496 | }; 497 | 498 | this.$lambda = Function.from; 499 | this.$mixin = Object.merge; 500 | this.$random = Number.random; 501 | this.$splat = Array.from; 502 | this.$time = Date.now; 503 | 504 | this.$type = function(object){ 505 | var type = typeOf(object); 506 | if (type == 'elements') return 'array'; 507 | return (type == 'null') ? false : type; 508 | }; 509 | 510 | this.$unlink = function(object){ 511 | switch (typeOf(object)){ 512 | case 'object': return Object.clone(object); 513 | case 'array': return Array.clone(object); 514 | case 'hash': return new Hash(object); 515 | default: return object; 516 | } 517 | }; 518 | 519 | // 520 | 521 | }).call(this); 522 | 523 | 524 | /* 525 | --- 526 | 527 | name: Array 528 | 529 | description: Contains Array Prototypes like each, contains, and erase. 530 | 531 | license: MIT-style license. 532 | 533 | requires: Type 534 | 535 | provides: Array 536 | 537 | ... 538 | */ 539 | 540 | Array.implement({ 541 | 542 | invoke: function(methodName){ 543 | var args = Array.slice(arguments, 1); 544 | return this.map(function(item){ 545 | return item[methodName].apply(item, args); 546 | }); 547 | }, 548 | 549 | every: function(fn, bind){ 550 | for (var i = 0, l = this.length; i < l; i++){ 551 | if ((i in this) && !fn.call(bind, this[i], i, this)) return false; 552 | } 553 | return true; 554 | }, 555 | 556 | filter: function(fn, bind){ 557 | var results = []; 558 | for (var i = 0, l = this.length; i < l; i++){ 559 | if ((i in this) && fn.call(bind, this[i], i, this)) results.push(this[i]); 560 | } 561 | return results; 562 | }, 563 | 564 | clean: function(){ 565 | return this.filter(function(item){ 566 | return item != null; 567 | }); 568 | }, 569 | 570 | indexOf: function(item, from){ 571 | var len = this.length; 572 | for (var i = (from < 0) ? Math.max(0, len + from) : from || 0; i < len; i++){ 573 | if (this[i] === item) return i; 574 | } 575 | return -1; 576 | }, 577 | 578 | map: function(fn, bind){ 579 | var results = []; 580 | for (var i = 0, l = this.length; i < l; i++){ 581 | if (i in this) results[i] = fn.call(bind, this[i], i, this); 582 | } 583 | return results; 584 | }, 585 | 586 | some: function(fn, bind){ 587 | for (var i = 0, l = this.length; i < l; i++){ 588 | if ((i in this) && fn.call(bind, this[i], i, this)) return true; 589 | } 590 | return false; 591 | }, 592 | 593 | associate: function(keys){ 594 | var obj = {}, length = Math.min(this.length, keys.length); 595 | for (var i = 0; i < length; i++) obj[keys[i]] = this[i]; 596 | return obj; 597 | }, 598 | 599 | link: function(object){ 600 | var result = {}; 601 | for (var i = 0, l = this.length; i < l; i++){ 602 | for (var key in object){ 603 | if (object[key](this[i])){ 604 | result[key] = this[i]; 605 | delete object[key]; 606 | break; 607 | } 608 | } 609 | } 610 | return result; 611 | }, 612 | 613 | contains: function(item, from){ 614 | return this.indexOf(item, from) != -1; 615 | }, 616 | 617 | append: function(array){ 618 | this.push.apply(this, array); 619 | return this; 620 | }, 621 | 622 | getLast: function(){ 623 | return (this.length) ? this[this.length - 1] : null; 624 | }, 625 | 626 | getRandom: function(){ 627 | return (this.length) ? this[Number.random(0, this.length - 1)] : null; 628 | }, 629 | 630 | include: function(item){ 631 | if (!this.contains(item)) this.push(item); 632 | return this; 633 | }, 634 | 635 | combine: function(array){ 636 | for (var i = 0, l = array.length; i < l; i++) this.include(array[i]); 637 | return this; 638 | }, 639 | 640 | erase: function(item){ 641 | for (var i = this.length; i--;){ 642 | if (this[i] === item) this.splice(i, 1); 643 | } 644 | return this; 645 | }, 646 | 647 | empty: function(){ 648 | this.length = 0; 649 | return this; 650 | }, 651 | 652 | flatten: function(){ 653 | var array = []; 654 | for (var i = 0, l = this.length; i < l; i++){ 655 | var type = typeOf(this[i]); 656 | if (type == 'null') continue; 657 | array = array.concat((type == 'array' || type == 'collection' || type == 'arguments' || instanceOf(this[i], Array)) ? Array.flatten(this[i]) : this[i]); 658 | } 659 | return array; 660 | }, 661 | 662 | pick: function(){ 663 | for (var i = 0, l = this.length; i < l; i++){ 664 | if (this[i] != null) return this[i]; 665 | } 666 | return null; 667 | }, 668 | 669 | hexToRgb: function(array){ 670 | if (this.length != 3) return null; 671 | var rgb = this.map(function(value){ 672 | if (value.length == 1) value += value; 673 | return value.toInt(16); 674 | }); 675 | return (array) ? rgb : 'rgb(' + rgb + ')'; 676 | }, 677 | 678 | rgbToHex: function(array){ 679 | if (this.length < 3) return null; 680 | if (this.length == 4 && this[3] == 0 && !array) return 'transparent'; 681 | var hex = []; 682 | for (var i = 0; i < 3; i++){ 683 | var bit = (this[i] - 0).toString(16); 684 | hex.push((bit.length == 1) ? '0' + bit : bit); 685 | } 686 | return (array) ? hex : '#' + hex.join(''); 687 | } 688 | 689 | }); 690 | 691 | //<1.2compat> 692 | 693 | Array.alias('extend', 'append'); 694 | 695 | var $pick = function(){ 696 | return Array.from(arguments).pick(); 697 | }; 698 | 699 | // 700 | 701 | 702 | /* 703 | --- 704 | 705 | name: String 706 | 707 | description: Contains String Prototypes like camelCase, capitalize, test, and toInt. 708 | 709 | license: MIT-style license. 710 | 711 | requires: Type 712 | 713 | provides: String 714 | 715 | ... 716 | */ 717 | 718 | String.implement({ 719 | 720 | test: function(regex, params){ 721 | return ((typeOf(regex) == 'regexp') ? regex : new RegExp('' + regex, params)).test(this); 722 | }, 723 | 724 | contains: function(string, separator){ 725 | return (separator) ? (separator + this + separator).indexOf(separator + string + separator) > -1 : this.indexOf(string) > -1; 726 | }, 727 | 728 | trim: function(){ 729 | return this.replace(/^\s+|\s+$/g, ''); 730 | }, 731 | 732 | clean: function(){ 733 | return this.replace(/\s+/g, ' ').trim(); 734 | }, 735 | 736 | camelCase: function(){ 737 | return this.replace(/-\D/g, function(match){ 738 | return match.charAt(1).toUpperCase(); 739 | }); 740 | }, 741 | 742 | hyphenate: function(){ 743 | return this.replace(/[A-Z]/g, function(match){ 744 | return ('-' + match.charAt(0).toLowerCase()); 745 | }); 746 | }, 747 | 748 | capitalize: function(){ 749 | return this.replace(/\b[a-z]/g, function(match){ 750 | return match.toUpperCase(); 751 | }); 752 | }, 753 | 754 | escapeRegExp: function(){ 755 | return this.replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1'); 756 | }, 757 | 758 | toInt: function(base){ 759 | return parseInt(this, base || 10); 760 | }, 761 | 762 | toFloat: function(){ 763 | return parseFloat(this); 764 | }, 765 | 766 | hexToRgb: function(array){ 767 | var hex = this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/); 768 | return (hex) ? hex.slice(1).hexToRgb(array) : null; 769 | }, 770 | 771 | rgbToHex: function(array){ 772 | var rgb = this.match(/\d{1,3}/g); 773 | return (rgb) ? rgb.rgbToHex(array) : null; 774 | }, 775 | 776 | substitute: function(object, regexp){ 777 | return this.replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){ 778 | if (match.charAt(0) == '\\') return match.slice(1); 779 | return (object[name] != null) ? object[name] : ''; 780 | }); 781 | } 782 | 783 | }); 784 | 785 | 786 | /* 787 | --- 788 | 789 | name: Number 790 | 791 | description: Contains Number Prototypes like limit, round, times, and ceil. 792 | 793 | license: MIT-style license. 794 | 795 | requires: Type 796 | 797 | provides: Number 798 | 799 | ... 800 | */ 801 | 802 | Number.implement({ 803 | 804 | limit: function(min, max){ 805 | return Math.min(max, Math.max(min, this)); 806 | }, 807 | 808 | round: function(precision){ 809 | precision = Math.pow(10, precision || 0).toFixed(precision < 0 ? -precision : 0); 810 | return Math.round(this * precision) / precision; 811 | }, 812 | 813 | times: function(fn, bind){ 814 | for (var i = 0; i < this; i++) fn.call(bind, i, this); 815 | }, 816 | 817 | toFloat: function(){ 818 | return parseFloat(this); 819 | }, 820 | 821 | toInt: function(base){ 822 | return parseInt(this, base || 10); 823 | } 824 | 825 | }); 826 | 827 | Number.alias('each', 'times'); 828 | 829 | (function(math){ 830 | var methods = {}; 831 | math.each(function(name){ 832 | if (!Number[name]) methods[name] = function(){ 833 | return Math[name].apply(null, [this].concat(Array.from(arguments))); 834 | }; 835 | }); 836 | Number.implement(methods); 837 | })(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']); 838 | 839 | 840 | /* 841 | --- 842 | 843 | name: Function 844 | 845 | description: Contains Function Prototypes like create, bind, pass, and delay. 846 | 847 | license: MIT-style license. 848 | 849 | requires: Type 850 | 851 | provides: Function 852 | 853 | ... 854 | */ 855 | 856 | Function.extend({ 857 | 858 | attempt: function(){ 859 | for (var i = 0, l = arguments.length; i < l; i++){ 860 | try { 861 | return arguments[i](); 862 | } catch (e){} 863 | } 864 | return null; 865 | } 866 | 867 | }); 868 | 869 | Function.implement({ 870 | 871 | attempt: function(args, bind){ 872 | try { 873 | return this.apply(bind, Array.from(args)); 874 | } catch (e){} 875 | 876 | return null; 877 | }, 878 | 879 | bind: function(bind){ 880 | var self = this, 881 | args = (arguments.length > 1) ? Array.slice(arguments, 1) : null; 882 | 883 | return function(){ 884 | if (!args && !arguments.length) return self.call(bind); 885 | if (args && arguments.length) return self.apply(bind, args.concat(Array.from(arguments))); 886 | return self.apply(bind, args || arguments); 887 | }; 888 | }, 889 | 890 | pass: function(args, bind){ 891 | var self = this; 892 | if (args != null) args = Array.from(args); 893 | return function(){ 894 | return self.apply(bind, args || arguments); 895 | }; 896 | }, 897 | 898 | delay: function(delay, bind, args){ 899 | return setTimeout(this.pass((args == null ? [] : args), bind), delay); 900 | }, 901 | 902 | periodical: function(periodical, bind, args){ 903 | return setInterval(this.pass((args == null ? [] : args), bind), periodical); 904 | } 905 | 906 | }); 907 | 908 | //<1.2compat> 909 | 910 | delete Function.prototype.bind; 911 | 912 | Function.implement({ 913 | 914 | create: function(options){ 915 | var self = this; 916 | options = options || {}; 917 | return function(event){ 918 | var args = options.arguments; 919 | args = (args != null) ? Array.from(args) : Array.slice(arguments, (options.event) ? 1 : 0); 920 | if (options.event) args = [event || window.event].extend(args); 921 | var returns = function(){ 922 | return self.apply(options.bind || null, args); 923 | }; 924 | if (options.delay) return setTimeout(returns, options.delay); 925 | if (options.periodical) return setInterval(returns, options.periodical); 926 | if (options.attempt) return Function.attempt(returns); 927 | return returns(); 928 | }; 929 | }, 930 | 931 | bind: function(bind, args){ 932 | var self = this; 933 | if (args != null) args = Array.from(args); 934 | return function(){ 935 | return self.apply(bind, args || arguments); 936 | }; 937 | }, 938 | 939 | bindWithEvent: function(bind, args){ 940 | var self = this; 941 | if (args != null) args = Array.from(args); 942 | return function(event){ 943 | return self.apply(bind, (args == null) ? arguments : [event].concat(args)); 944 | }; 945 | }, 946 | 947 | run: function(args, bind){ 948 | return this.apply(bind, Array.from(args)); 949 | } 950 | 951 | }); 952 | 953 | var $try = Function.attempt; 954 | 955 | // 956 | 957 | 958 | /* 959 | --- 960 | 961 | name: Object 962 | 963 | description: Object generic methods 964 | 965 | license: MIT-style license. 966 | 967 | requires: Type 968 | 969 | provides: [Object, Hash] 970 | 971 | ... 972 | */ 973 | 974 | (function(){ 975 | 976 | var hasOwnProperty = Object.prototype.hasOwnProperty; 977 | 978 | Object.extend({ 979 | 980 | subset: function(object, keys){ 981 | var results = {}; 982 | for (var i = 0, l = keys.length; i < l; i++){ 983 | var k = keys[i]; 984 | results[k] = object[k]; 985 | } 986 | return results; 987 | }, 988 | 989 | map: function(object, fn, bind){ 990 | var results = {}; 991 | for (var key in object){ 992 | if (hasOwnProperty.call(object, key)) results[key] = fn.call(bind, object[key], key, object); 993 | } 994 | return results; 995 | }, 996 | 997 | filter: function(object, fn, bind){ 998 | var results = {}; 999 | Object.each(object, function(value, key){ 1000 | if (fn.call(bind, value, key, object)) results[key] = value; 1001 | }); 1002 | return results; 1003 | }, 1004 | 1005 | every: function(object, fn, bind){ 1006 | for (var key in object){ 1007 | if (hasOwnProperty.call(object, key) && !fn.call(bind, object[key], key)) return false; 1008 | } 1009 | return true; 1010 | }, 1011 | 1012 | some: function(object, fn, bind){ 1013 | for (var key in object){ 1014 | if (hasOwnProperty.call(object, key) && fn.call(bind, object[key], key)) return true; 1015 | } 1016 | return false; 1017 | }, 1018 | 1019 | keys: function(object){ 1020 | var keys = []; 1021 | for (var key in object){ 1022 | if (hasOwnProperty.call(object, key)) keys.push(key); 1023 | } 1024 | return keys; 1025 | }, 1026 | 1027 | values: function(object){ 1028 | var values = []; 1029 | for (var key in object){ 1030 | if (hasOwnProperty.call(object, key)) values.push(object[key]); 1031 | } 1032 | return values; 1033 | }, 1034 | 1035 | getLength: function(object){ 1036 | return Object.keys(object).length; 1037 | }, 1038 | 1039 | keyOf: function(object, value){ 1040 | for (var key in object){ 1041 | if (hasOwnProperty.call(object, key) && object[key] === value) return key; 1042 | } 1043 | return null; 1044 | }, 1045 | 1046 | contains: function(object, value){ 1047 | return Object.keyOf(object, value) != null; 1048 | }, 1049 | 1050 | toQueryString: function(object, base){ 1051 | var queryString = []; 1052 | 1053 | Object.each(object, function(value, key){ 1054 | if (base) key = base + '[' + key + ']'; 1055 | var result; 1056 | switch (typeOf(value)){ 1057 | case 'object': result = Object.toQueryString(value, key); break; 1058 | case 'array': 1059 | var qs = {}; 1060 | value.each(function(val, i){ 1061 | qs[i] = val; 1062 | }); 1063 | result = Object.toQueryString(qs, key); 1064 | break; 1065 | default: result = key + '=' + encodeURIComponent(value); 1066 | } 1067 | if (value != null) queryString.push(result); 1068 | }); 1069 | 1070 | return queryString.join('&'); 1071 | } 1072 | 1073 | }); 1074 | 1075 | })(); 1076 | 1077 | //<1.2compat> 1078 | 1079 | Hash.implement({ 1080 | 1081 | has: Object.prototype.hasOwnProperty, 1082 | 1083 | keyOf: function(value){ 1084 | return Object.keyOf(this, value); 1085 | }, 1086 | 1087 | hasValue: function(value){ 1088 | return Object.contains(this, value); 1089 | }, 1090 | 1091 | extend: function(properties){ 1092 | Hash.each(properties || {}, function(value, key){ 1093 | Hash.set(this, key, value); 1094 | }, this); 1095 | return this; 1096 | }, 1097 | 1098 | combine: function(properties){ 1099 | Hash.each(properties || {}, function(value, key){ 1100 | Hash.include(this, key, value); 1101 | }, this); 1102 | return this; 1103 | }, 1104 | 1105 | erase: function(key){ 1106 | if (this.hasOwnProperty(key)) delete this[key]; 1107 | return this; 1108 | }, 1109 | 1110 | get: function(key){ 1111 | return (this.hasOwnProperty(key)) ? this[key] : null; 1112 | }, 1113 | 1114 | set: function(key, value){ 1115 | if (!this[key] || this.hasOwnProperty(key)) this[key] = value; 1116 | return this; 1117 | }, 1118 | 1119 | empty: function(){ 1120 | Hash.each(this, function(value, key){ 1121 | delete this[key]; 1122 | }, this); 1123 | return this; 1124 | }, 1125 | 1126 | include: function(key, value){ 1127 | if (this[key] == null) this[key] = value; 1128 | return this; 1129 | }, 1130 | 1131 | map: function(fn, bind){ 1132 | return new Hash(Object.map(this, fn, bind)); 1133 | }, 1134 | 1135 | filter: function(fn, bind){ 1136 | return new Hash(Object.filter(this, fn, bind)); 1137 | }, 1138 | 1139 | every: function(fn, bind){ 1140 | return Object.every(this, fn, bind); 1141 | }, 1142 | 1143 | some: function(fn, bind){ 1144 | return Object.some(this, fn, bind); 1145 | }, 1146 | 1147 | getKeys: function(){ 1148 | return Object.keys(this); 1149 | }, 1150 | 1151 | getValues: function(){ 1152 | return Object.values(this); 1153 | }, 1154 | 1155 | toQueryString: function(base){ 1156 | return Object.toQueryString(this, base); 1157 | } 1158 | 1159 | }); 1160 | 1161 | Hash.extend = Object.append; 1162 | 1163 | Hash.alias({indexOf: 'keyOf', contains: 'hasValue'}); 1164 | 1165 | // 1166 | 1167 | 1168 | /* 1169 | --- 1170 | 1171 | name: Browser 1172 | 1173 | description: The Browser Object. Contains Browser initialization, Window and Document, and the Browser Hash. 1174 | 1175 | license: MIT-style license. 1176 | 1177 | requires: [Array, Function, Number, String] 1178 | 1179 | provides: [Browser, Window, Document] 1180 | 1181 | ... 1182 | */ 1183 | 1184 | (function(){ 1185 | 1186 | var document = this.document; 1187 | var window = document.window = this; 1188 | 1189 | var UID = 1; 1190 | 1191 | this.$uid = (window.ActiveXObject) ? function(item){ 1192 | return (item.uid || (item.uid = [UID++]))[0]; 1193 | } : function(item){ 1194 | return item.uid || (item.uid = UID++); 1195 | }; 1196 | 1197 | $uid(window); 1198 | $uid(document); 1199 | 1200 | var ua = navigator.userAgent.toLowerCase(), 1201 | platform = navigator.platform.toLowerCase(), 1202 | UA = ua.match(/(opera|ie|firefox|chrome|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/) || [null, 'unknown', 0], 1203 | mode = UA[1] == 'ie' && document.documentMode; 1204 | 1205 | var Browser = this.Browser = { 1206 | 1207 | extend: Function.prototype.extend, 1208 | 1209 | name: (UA[1] == 'version') ? UA[3] : UA[1], 1210 | 1211 | version: mode || parseFloat((UA[1] == 'opera' && UA[4]) ? UA[4] : UA[2]), 1212 | 1213 | Platform: { 1214 | name: ua.match(/ip(?:ad|od|hone)/) ? 'ios' : (ua.match(/(?:webos|android)/) || platform.match(/mac|win|linux/) || ['other'])[0] 1215 | }, 1216 | 1217 | Features: { 1218 | xpath: !!(document.evaluate), 1219 | air: !!(window.runtime), 1220 | query: !!(document.querySelector), 1221 | json: !!(window.JSON) 1222 | }, 1223 | 1224 | Plugins: {} 1225 | 1226 | }; 1227 | 1228 | Browser[Browser.name] = true; 1229 | Browser[Browser.name + parseInt(Browser.version, 10)] = true; 1230 | Browser.Platform[Browser.Platform.name] = true; 1231 | 1232 | // Request 1233 | 1234 | Browser.Request = (function(){ 1235 | 1236 | var XMLHTTP = function(){ 1237 | return new XMLHttpRequest(); 1238 | }; 1239 | 1240 | var MSXML2 = function(){ 1241 | return new ActiveXObject('MSXML2.XMLHTTP'); 1242 | }; 1243 | 1244 | var MSXML = function(){ 1245 | return new ActiveXObject('Microsoft.XMLHTTP'); 1246 | }; 1247 | 1248 | return Function.attempt(function(){ 1249 | XMLHTTP(); 1250 | return XMLHTTP; 1251 | }, function(){ 1252 | MSXML2(); 1253 | return MSXML2; 1254 | }, function(){ 1255 | MSXML(); 1256 | return MSXML; 1257 | }); 1258 | 1259 | })(); 1260 | 1261 | Browser.Features.xhr = !!(Browser.Request); 1262 | 1263 | // Flash detection 1264 | 1265 | var version = (Function.attempt(function(){ 1266 | return navigator.plugins['Shockwave Flash'].description; 1267 | }, function(){ 1268 | return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version'); 1269 | }) || '0 r0').match(/\d+/g); 1270 | 1271 | Browser.Plugins.Flash = { 1272 | version: Number(version[0] || '0.' + version[1]) || 0, 1273 | build: Number(version[2]) || 0 1274 | }; 1275 | 1276 | // String scripts 1277 | 1278 | Browser.exec = function(text){ 1279 | if (!text) return text; 1280 | if (window.execScript){ 1281 | window.execScript(text); 1282 | } else { 1283 | var script = document.createElement('script'); 1284 | script.setAttribute('type', 'text/javascript'); 1285 | script.text = text; 1286 | document.head.appendChild(script); 1287 | document.head.removeChild(script); 1288 | } 1289 | return text; 1290 | }; 1291 | 1292 | String.implement('stripScripts', function(exec){ 1293 | var scripts = ''; 1294 | var text = this.replace(/]*>([\s\S]*?)<\/script>/gi, function(all, code){ 1295 | scripts += code + '\n'; 1296 | return ''; 1297 | }); 1298 | if (exec === true) Browser.exec(scripts); 1299 | else if (typeOf(exec) == 'function') exec(scripts, text); 1300 | return text; 1301 | }); 1302 | 1303 | // Window, Document 1304 | 1305 | Browser.extend({ 1306 | Document: this.Document, 1307 | Window: this.Window, 1308 | Element: this.Element, 1309 | Event: this.Event 1310 | }); 1311 | 1312 | this.Window = this.$constructor = new Type('Window', function(){}); 1313 | 1314 | this.$family = Function.from('window').hide(); 1315 | 1316 | Window.mirror(function(name, method){ 1317 | window[name] = method; 1318 | }); 1319 | 1320 | this.Document = document.$constructor = new Type('Document', function(){}); 1321 | 1322 | document.$family = Function.from('document').hide(); 1323 | 1324 | Document.mirror(function(name, method){ 1325 | document[name] = method; 1326 | }); 1327 | 1328 | document.html = document.documentElement; 1329 | document.head = document.getElementsByTagName('head')[0]; 1330 | 1331 | if (document.execCommand) try { 1332 | document.execCommand("BackgroundImageCache", false, true); 1333 | } catch (e){} 1334 | 1335 | if (this.attachEvent && !this.addEventListener){ 1336 | var unloadEvent = function(){ 1337 | this.detachEvent('onunload', unloadEvent); 1338 | document.head = document.html = document.window = null; 1339 | }; 1340 | this.attachEvent('onunload', unloadEvent); 1341 | } 1342 | 1343 | // IE fails on collections and ) 1344 | var arrayFrom = Array.from; 1345 | try { 1346 | arrayFrom(document.html.childNodes); 1347 | } catch(e){ 1348 | Array.from = function(item){ 1349 | if (typeof item != 'string' && Type.isEnumerable(item) && typeOf(item) != 'array'){ 1350 | var i = item.length, array = new Array(i); 1351 | while (i--) array[i] = item[i]; 1352 | return array; 1353 | } 1354 | return arrayFrom(item); 1355 | }; 1356 | 1357 | var prototype = Array.prototype, 1358 | slice = prototype.slice; 1359 | ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice'].each(function(name){ 1360 | var method = prototype[name]; 1361 | Array[name] = function(item){ 1362 | return method.apply(Array.from(item), slice.call(arguments, 1)); 1363 | }; 1364 | }); 1365 | } 1366 | 1367 | //<1.2compat> 1368 | 1369 | if (Browser.Platform.ios) Browser.Platform.ipod = true; 1370 | 1371 | Browser.Engine = {}; 1372 | 1373 | var setEngine = function(name, version){ 1374 | Browser.Engine.name = name; 1375 | Browser.Engine[name + version] = true; 1376 | Browser.Engine.version = version; 1377 | }; 1378 | 1379 | if (Browser.ie){ 1380 | Browser.Engine.trident = true; 1381 | 1382 | switch (Browser.version){ 1383 | case 6: setEngine('trident', 4); break; 1384 | case 7: setEngine('trident', 5); break; 1385 | case 8: setEngine('trident', 6); 1386 | } 1387 | } 1388 | 1389 | if (Browser.firefox){ 1390 | Browser.Engine.gecko = true; 1391 | 1392 | if (Browser.version >= 3) setEngine('gecko', 19); 1393 | else setEngine('gecko', 18); 1394 | } 1395 | 1396 | if (Browser.safari || Browser.chrome){ 1397 | Browser.Engine.webkit = true; 1398 | 1399 | switch (Browser.version){ 1400 | case 2: setEngine('webkit', 419); break; 1401 | case 3: setEngine('webkit', 420); break; 1402 | case 4: setEngine('webkit', 525); 1403 | } 1404 | } 1405 | 1406 | if (Browser.opera){ 1407 | Browser.Engine.presto = true; 1408 | 1409 | if (Browser.version >= 9.6) setEngine('presto', 960); 1410 | else if (Browser.version >= 9.5) setEngine('presto', 950); 1411 | else setEngine('presto', 925); 1412 | } 1413 | 1414 | if (Browser.name == 'unknown'){ 1415 | switch ((ua.match(/(?:webkit|khtml|gecko)/) || [])[0]){ 1416 | case 'webkit': 1417 | case 'khtml': 1418 | Browser.Engine.webkit = true; 1419 | break; 1420 | case 'gecko': 1421 | Browser.Engine.gecko = true; 1422 | } 1423 | } 1424 | 1425 | this.$exec = Browser.exec; 1426 | 1427 | // 1428 | 1429 | }).call(this); 1430 | 1431 | 1432 | /* 1433 | --- 1434 | 1435 | name: Event 1436 | 1437 | description: Contains the Event Class, to make the event object cross-browser. 1438 | 1439 | license: MIT-style license. 1440 | 1441 | requires: [Window, Document, Array, Function, String, Object] 1442 | 1443 | provides: Event 1444 | 1445 | ... 1446 | */ 1447 | 1448 | var Event = new Type('Event', function(event, win){ 1449 | if (!win) win = window; 1450 | var doc = win.document; 1451 | event = event || win.event; 1452 | if (event.$extended) return event; 1453 | this.$extended = true; 1454 | var type = event.type, 1455 | target = event.target || event.srcElement, 1456 | page = {}, 1457 | client = {}, 1458 | related = null, 1459 | rightClick, wheel, code, key; 1460 | while (target && target.nodeType == 3) target = target.parentNode; 1461 | 1462 | if (type.indexOf('key') != -1){ 1463 | code = event.which || event.keyCode; 1464 | key = Object.keyOf(Event.Keys, code); 1465 | if (type == 'keydown'){ 1466 | var fKey = code - 111; 1467 | if (fKey > 0 && fKey < 13) key = 'f' + fKey; 1468 | } 1469 | if (!key) key = String.fromCharCode(code).toLowerCase(); 1470 | } else if ((/click|mouse|menu/i).test(type)){ 1471 | doc = (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body; 1472 | page = { 1473 | x: (event.pageX != null) ? event.pageX : event.clientX + doc.scrollLeft, 1474 | y: (event.pageY != null) ? event.pageY : event.clientY + doc.scrollTop 1475 | }; 1476 | client = { 1477 | x: (event.pageX != null) ? event.pageX - win.pageXOffset : event.clientX, 1478 | y: (event.pageY != null) ? event.pageY - win.pageYOffset : event.clientY 1479 | }; 1480 | if ((/DOMMouseScroll|mousewheel/).test(type)){ 1481 | wheel = (event.wheelDelta) ? event.wheelDelta / 120 : -(event.detail || 0) / 3; 1482 | } 1483 | rightClick = (event.which == 3) || (event.button == 2); 1484 | if ((/over|out/).test(type)){ 1485 | related = event.relatedTarget || event[(type == 'mouseover' ? 'from' : 'to') + 'Element']; 1486 | var testRelated = function(){ 1487 | while (related && related.nodeType == 3) related = related.parentNode; 1488 | return true; 1489 | }; 1490 | var hasRelated = (Browser.firefox2) ? testRelated.attempt() : testRelated(); 1491 | related = (hasRelated) ? related : null; 1492 | } 1493 | } else if ((/gesture|touch/i).test(type)){ 1494 | this.rotation = event.rotation; 1495 | this.scale = event.scale; 1496 | this.targetTouches = event.targetTouches; 1497 | this.changedTouches = event.changedTouches; 1498 | var touches = this.touches = event.touches; 1499 | if (touches && touches[0]){ 1500 | var touch = touches[0]; 1501 | page = {x: touch.pageX, y: touch.pageY}; 1502 | client = {x: touch.clientX, y: touch.clientY}; 1503 | } 1504 | } 1505 | 1506 | return Object.append(this, { 1507 | event: event, 1508 | type: type, 1509 | 1510 | page: page, 1511 | client: client, 1512 | rightClick: rightClick, 1513 | 1514 | wheel: wheel, 1515 | 1516 | relatedTarget: document.id(related), 1517 | target: document.id(target), 1518 | 1519 | code: code, 1520 | key: key, 1521 | 1522 | shift: event.shiftKey, 1523 | control: event.ctrlKey, 1524 | alt: event.altKey, 1525 | meta: event.metaKey 1526 | }); 1527 | }); 1528 | 1529 | Event.Keys = { 1530 | 'enter': 13, 1531 | 'up': 38, 1532 | 'down': 40, 1533 | 'left': 37, 1534 | 'right': 39, 1535 | 'esc': 27, 1536 | 'space': 32, 1537 | 'backspace': 8, 1538 | 'tab': 9, 1539 | 'delete': 46 1540 | }; 1541 | 1542 | //<1.2compat> 1543 | 1544 | Event.Keys = new Hash(Event.Keys); 1545 | 1546 | // 1547 | 1548 | Event.implement({ 1549 | 1550 | stop: function(){ 1551 | return this.stopPropagation().preventDefault(); 1552 | }, 1553 | 1554 | stopPropagation: function(){ 1555 | if (this.event.stopPropagation) this.event.stopPropagation(); 1556 | else this.event.cancelBubble = true; 1557 | return this; 1558 | }, 1559 | 1560 | preventDefault: function(){ 1561 | if (this.event.preventDefault) this.event.preventDefault(); 1562 | else this.event.returnValue = false; 1563 | return this; 1564 | } 1565 | 1566 | }); 1567 | 1568 | 1569 | /* 1570 | --- 1571 | 1572 | name: Class 1573 | 1574 | description: Contains the Class Function for easily creating, extending, and implementing reusable Classes. 1575 | 1576 | license: MIT-style license. 1577 | 1578 | requires: [Array, String, Function, Number] 1579 | 1580 | provides: Class 1581 | 1582 | ... 1583 | */ 1584 | 1585 | (function(){ 1586 | 1587 | var Class = this.Class = new Type('Class', function(params){ 1588 | if (instanceOf(params, Function)) params = {initialize: params}; 1589 | 1590 | var newClass = function(){ 1591 | reset(this); 1592 | if (newClass.$prototyping) return this; 1593 | this.$caller = null; 1594 | var value = (this.initialize) ? this.initialize.apply(this, arguments) : this; 1595 | this.$caller = this.caller = null; 1596 | return value; 1597 | }.extend(this).implement(params); 1598 | 1599 | newClass.$constructor = Class; 1600 | newClass.prototype.$constructor = newClass; 1601 | newClass.prototype.parent = parent; 1602 | 1603 | return newClass; 1604 | }); 1605 | 1606 | var parent = function(){ 1607 | if (!this.$caller) throw new Error('The method "parent" cannot be called.'); 1608 | var name = this.$caller.$name, 1609 | parent = this.$caller.$owner.parent, 1610 | previous = (parent) ? parent.prototype[name] : null; 1611 | if (!previous) throw new Error('The method "' + name + '" has no parent.'); 1612 | return previous.apply(this, arguments); 1613 | }; 1614 | 1615 | var reset = function(object){ 1616 | for (var key in object){ 1617 | var value = object[key]; 1618 | switch (typeOf(value)){ 1619 | case 'object': 1620 | var F = function(){}; 1621 | F.prototype = value; 1622 | object[key] = reset(new F); 1623 | break; 1624 | case 'array': object[key] = value.clone(); break; 1625 | } 1626 | } 1627 | return object; 1628 | }; 1629 | 1630 | var wrap = function(self, key, method){ 1631 | if (method.$origin) method = method.$origin; 1632 | var wrapper = function(){ 1633 | if (method.$protected && this.$caller == null) throw new Error('The method "' + key + '" cannot be called.'); 1634 | var caller = this.caller, current = this.$caller; 1635 | this.caller = current; this.$caller = wrapper; 1636 | var result = method.apply(this, arguments); 1637 | this.$caller = current; this.caller = caller; 1638 | return result; 1639 | }.extend({$owner: self, $origin: method, $name: key}); 1640 | return wrapper; 1641 | }; 1642 | 1643 | var implement = function(key, value, retain){ 1644 | if (Class.Mutators.hasOwnProperty(key)){ 1645 | value = Class.Mutators[key].call(this, value); 1646 | if (value == null) return this; 1647 | } 1648 | 1649 | if (typeOf(value) == 'function'){ 1650 | if (value.$hidden) return this; 1651 | this.prototype[key] = (retain) ? value : wrap(this, key, value); 1652 | } else { 1653 | Object.merge(this.prototype, key, value); 1654 | } 1655 | 1656 | return this; 1657 | }; 1658 | 1659 | var getInstance = function(klass){ 1660 | klass.$prototyping = true; 1661 | var proto = new klass; 1662 | delete klass.$prototyping; 1663 | return proto; 1664 | }; 1665 | 1666 | Class.implement('implement', implement.overloadSetter()); 1667 | 1668 | Class.Mutators = { 1669 | 1670 | Extends: function(parent){ 1671 | this.parent = parent; 1672 | this.prototype = getInstance(parent); 1673 | }, 1674 | 1675 | Implements: function(items){ 1676 | Array.from(items).each(function(item){ 1677 | var instance = new item; 1678 | for (var key in instance) implement.call(this, key, instance[key], true); 1679 | }, this); 1680 | } 1681 | }; 1682 | 1683 | }).call(this); 1684 | 1685 | 1686 | /* 1687 | --- 1688 | 1689 | name: Class.Extras 1690 | 1691 | description: Contains Utility Classes that can be implemented into your own Classes to ease the execution of many common tasks. 1692 | 1693 | license: MIT-style license. 1694 | 1695 | requires: Class 1696 | 1697 | provides: [Class.Extras, Chain, Events, Options] 1698 | 1699 | ... 1700 | */ 1701 | 1702 | (function(){ 1703 | 1704 | this.Chain = new Class({ 1705 | 1706 | $chain: [], 1707 | 1708 | chain: function(){ 1709 | this.$chain.append(Array.flatten(arguments)); 1710 | return this; 1711 | }, 1712 | 1713 | callChain: function(){ 1714 | return (this.$chain.length) ? this.$chain.shift().apply(this, arguments) : false; 1715 | }, 1716 | 1717 | clearChain: function(){ 1718 | this.$chain.empty(); 1719 | return this; 1720 | } 1721 | 1722 | }); 1723 | 1724 | var removeOn = function(string){ 1725 | return string.replace(/^on([A-Z])/, function(full, first){ 1726 | return first.toLowerCase(); 1727 | }); 1728 | }; 1729 | 1730 | this.Events = new Class({ 1731 | 1732 | $events: {}, 1733 | 1734 | addEvent: function(type, fn, internal){ 1735 | type = removeOn(type); 1736 | 1737 | /*<1.2compat>*/ 1738 | if (fn == $empty) return this; 1739 | /**/ 1740 | 1741 | this.$events[type] = (this.$events[type] || []).include(fn); 1742 | if (internal) fn.internal = true; 1743 | return this; 1744 | }, 1745 | 1746 | addEvents: function(events){ 1747 | for (var type in events) this.addEvent(type, events[type]); 1748 | return this; 1749 | }, 1750 | 1751 | fireEvent: function(type, args, delay){ 1752 | type = removeOn(type); 1753 | var events = this.$events[type]; 1754 | if (!events) return this; 1755 | args = Array.from(args); 1756 | events.each(function(fn){ 1757 | if (delay) fn.delay(delay, this, args); 1758 | else fn.apply(this, args); 1759 | }, this); 1760 | return this; 1761 | }, 1762 | 1763 | removeEvent: function(type, fn){ 1764 | type = removeOn(type); 1765 | var events = this.$events[type]; 1766 | if (events && !fn.internal){ 1767 | var index = events.indexOf(fn); 1768 | if (index != -1) delete events[index]; 1769 | } 1770 | return this; 1771 | }, 1772 | 1773 | removeEvents: function(events){ 1774 | var type; 1775 | if (typeOf(events) == 'object'){ 1776 | for (type in events) this.removeEvent(type, events[type]); 1777 | return this; 1778 | } 1779 | if (events) events = removeOn(events); 1780 | for (type in this.$events){ 1781 | if (events && events != type) continue; 1782 | var fns = this.$events[type]; 1783 | for (var i = fns.length; i--;) if (i in fns){ 1784 | this.removeEvent(type, fns[i]); 1785 | } 1786 | } 1787 | return this; 1788 | } 1789 | 1790 | }); 1791 | 1792 | this.Options = new Class({ 1793 | 1794 | setOptions: function(){ 1795 | var options = this.options = Object.merge.apply(null, [{}, this.options].append(arguments)); 1796 | if (this.addEvent) for (var option in options){ 1797 | if (typeOf(options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue; 1798 | this.addEvent(option, options[option]); 1799 | delete options[option]; 1800 | } 1801 | return this; 1802 | } 1803 | 1804 | }); 1805 | 1806 | }).call(this); 1807 | 1808 | 1809 | /* 1810 | --- 1811 | name: Slick.Parser 1812 | description: Standalone CSS3 Selector parser 1813 | provides: Slick.Parser 1814 | ... 1815 | */ 1816 | 1817 | ;(function(){ 1818 | 1819 | var parsed, 1820 | separatorIndex, 1821 | combinatorIndex, 1822 | reversed, 1823 | cache = {}, 1824 | reverseCache = {}, 1825 | reUnescape = /\\/g; 1826 | 1827 | var parse = function(expression, isReversed){ 1828 | if (expression == null) return null; 1829 | if (expression.Slick === true) return expression; 1830 | expression = ('' + expression).replace(/^\s+|\s+$/g, ''); 1831 | reversed = !!isReversed; 1832 | var currentCache = (reversed) ? reverseCache : cache; 1833 | if (currentCache[expression]) return currentCache[expression]; 1834 | parsed = { 1835 | Slick: true, 1836 | expressions: [], 1837 | raw: expression, 1838 | reverse: function(){ 1839 | return parse(this.raw, true); 1840 | } 1841 | }; 1842 | separatorIndex = -1; 1843 | while (expression != (expression = expression.replace(regexp, parser))); 1844 | parsed.length = parsed.expressions.length; 1845 | return currentCache[parsed.raw] = (reversed) ? reverse(parsed) : parsed; 1846 | }; 1847 | 1848 | var reverseCombinator = function(combinator){ 1849 | if (combinator === '!') return ' '; 1850 | else if (combinator === ' ') return '!'; 1851 | else if ((/^!/).test(combinator)) return combinator.replace(/^!/, ''); 1852 | else return '!' + combinator; 1853 | }; 1854 | 1855 | var reverse = function(expression){ 1856 | var expressions = expression.expressions; 1857 | for (var i = 0; i < expressions.length; i++){ 1858 | var exp = expressions[i]; 1859 | var last = {parts: [], tag: '*', combinator: reverseCombinator(exp[0].combinator)}; 1860 | 1861 | for (var j = 0; j < exp.length; j++){ 1862 | var cexp = exp[j]; 1863 | if (!cexp.reverseCombinator) cexp.reverseCombinator = ' '; 1864 | cexp.combinator = cexp.reverseCombinator; 1865 | delete cexp.reverseCombinator; 1866 | } 1867 | 1868 | exp.reverse().push(last); 1869 | } 1870 | return expression; 1871 | }; 1872 | 1873 | var escapeRegExp = function(string){// Credit: XRegExp 0.6.1 (c) 2007-2008 Steven Levithan MIT License 1874 | return string.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, function(match){ 1875 | return '\\' + match; 1876 | }); 1877 | }; 1878 | 1879 | var regexp = new RegExp( 1880 | /* 1881 | #!/usr/bin/env ruby 1882 | puts "\t\t" + DATA.read.gsub(/\(\?x\)|\s+#.*$|\s+|\\$|\\n/,'') 1883 | __END__ 1884 | "(?x)^(?:\ 1885 | \\s* ( , ) \\s* # Separator \n\ 1886 | | \\s* ( + ) \\s* # Combinator \n\ 1887 | | ( \\s+ ) # CombinatorChildren \n\ 1888 | | ( + | \\* ) # Tag \n\ 1889 | | \\# ( + ) # ID \n\ 1890 | | \\. ( + ) # ClassName \n\ 1891 | | # Attribute \n\ 1892 | \\[ \ 1893 | \\s* (+) (?: \ 1894 | \\s* ([*^$!~|]?=) (?: \ 1895 | \\s* (?:\ 1896 | ([\"']?)(.*?)\\9 \ 1897 | )\ 1898 | ) \ 1899 | )? \\s* \ 1900 | \\](?!\\]) \n\ 1901 | | :+ ( + )(?:\ 1902 | \\( (?:\ 1903 | (?:([\"'])([^\\12]*)\\12)|((?:\\([^)]+\\)|[^()]*)+)\ 1904 | ) \\)\ 1905 | )?\ 1906 | )" 1907 | */ 1908 | "^(?:\\s*(,)\\s*|\\s*(+)\\s*|(\\s+)|(+|\\*)|\\#(+)|\\.(+)|\\[\\s*(+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)" 1909 | .replace(//, '[' + escapeRegExp(">+~`!@$%^&={}\\;/g, '(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])') 1911 | .replace(//g, '(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])') 1912 | ); 1913 | 1914 | function parser( 1915 | rawMatch, 1916 | 1917 | separator, 1918 | combinator, 1919 | combinatorChildren, 1920 | 1921 | tagName, 1922 | id, 1923 | className, 1924 | 1925 | attributeKey, 1926 | attributeOperator, 1927 | attributeQuote, 1928 | attributeValue, 1929 | 1930 | pseudoMarker, 1931 | pseudoClass, 1932 | pseudoQuote, 1933 | pseudoClassQuotedValue, 1934 | pseudoClassValue 1935 | ){ 1936 | if (separator || separatorIndex === -1){ 1937 | parsed.expressions[++separatorIndex] = []; 1938 | combinatorIndex = -1; 1939 | if (separator) return ''; 1940 | } 1941 | 1942 | if (combinator || combinatorChildren || combinatorIndex === -1){ 1943 | combinator = combinator || ' '; 1944 | var currentSeparator = parsed.expressions[separatorIndex]; 1945 | if (reversed && currentSeparator[combinatorIndex]) 1946 | currentSeparator[combinatorIndex].reverseCombinator = reverseCombinator(combinator); 1947 | currentSeparator[++combinatorIndex] = {combinator: combinator, tag: '*'}; 1948 | } 1949 | 1950 | var currentParsed = parsed.expressions[separatorIndex][combinatorIndex]; 1951 | 1952 | if (tagName){ 1953 | currentParsed.tag = tagName.replace(reUnescape, ''); 1954 | 1955 | } else if (id){ 1956 | currentParsed.id = id.replace(reUnescape, ''); 1957 | 1958 | } else if (className){ 1959 | className = className.replace(reUnescape, ''); 1960 | 1961 | if (!currentParsed.classList) currentParsed.classList = []; 1962 | if (!currentParsed.classes) currentParsed.classes = []; 1963 | currentParsed.classList.push(className); 1964 | currentParsed.classes.push({ 1965 | value: className, 1966 | regexp: new RegExp('(^|\\s)' + escapeRegExp(className) + '(\\s|$)') 1967 | }); 1968 | 1969 | } else if (pseudoClass){ 1970 | pseudoClassValue = pseudoClassValue || pseudoClassQuotedValue; 1971 | pseudoClassValue = pseudoClassValue ? pseudoClassValue.replace(reUnescape, '') : null; 1972 | 1973 | if (!currentParsed.pseudos) currentParsed.pseudos = []; 1974 | currentParsed.pseudos.push({ 1975 | key: pseudoClass.replace(reUnescape, ''), 1976 | value: pseudoClassValue, 1977 | type: pseudoMarker.length == 1 ? 'class' : 'element' 1978 | }); 1979 | 1980 | } else if (attributeKey){ 1981 | attributeKey = attributeKey.replace(reUnescape, ''); 1982 | attributeValue = (attributeValue || '').replace(reUnescape, ''); 1983 | 1984 | var test, regexp; 1985 | 1986 | switch (attributeOperator){ 1987 | case '^=' : regexp = new RegExp( '^'+ escapeRegExp(attributeValue) ); break; 1988 | case '$=' : regexp = new RegExp( escapeRegExp(attributeValue) +'$' ); break; 1989 | case '~=' : regexp = new RegExp( '(^|\\s)'+ escapeRegExp(attributeValue) +'(\\s|$)' ); break; 1990 | case '|=' : regexp = new RegExp( '^'+ escapeRegExp(attributeValue) +'(-|$)' ); break; 1991 | case '=' : test = function(value){ 1992 | return attributeValue == value; 1993 | }; break; 1994 | case '*=' : test = function(value){ 1995 | return value && value.indexOf(attributeValue) > -1; 1996 | }; break; 1997 | case '!=' : test = function(value){ 1998 | return attributeValue != value; 1999 | }; break; 2000 | default : test = function(value){ 2001 | return !!value; 2002 | }; 2003 | } 2004 | 2005 | if (attributeValue == '' && (/^[*$^]=$/).test(attributeOperator)) test = function(){ 2006 | return false; 2007 | }; 2008 | 2009 | if (!test) test = function(value){ 2010 | return value && regexp.test(value); 2011 | }; 2012 | 2013 | if (!currentParsed.attributes) currentParsed.attributes = []; 2014 | currentParsed.attributes.push({ 2015 | key: attributeKey, 2016 | operator: attributeOperator, 2017 | value: attributeValue, 2018 | test: test 2019 | }); 2020 | 2021 | } 2022 | 2023 | return ''; 2024 | }; 2025 | 2026 | // Slick NS 2027 | 2028 | var Slick = (this.Slick || {}); 2029 | 2030 | Slick.parse = function(expression){ 2031 | return parse(expression); 2032 | }; 2033 | 2034 | Slick.escapeRegExp = escapeRegExp; 2035 | 2036 | if (!this.Slick) this.Slick = Slick; 2037 | 2038 | }).apply(/**/(typeof exports != 'undefined') ? exports : /**/this); 2039 | 2040 | 2041 | /* 2042 | --- 2043 | name: Slick.Finder 2044 | description: The new, superfast css selector engine. 2045 | provides: Slick.Finder 2046 | requires: Slick.Parser 2047 | ... 2048 | */ 2049 | 2050 | ;(function(){ 2051 | 2052 | var local = {}, 2053 | featuresCache = {}, 2054 | toString = Object.prototype.toString; 2055 | 2056 | // Feature / Bug detection 2057 | 2058 | local.isNativeCode = function(fn){ 2059 | return (/\{\s*\[native code\]\s*\}/).test('' + fn); 2060 | }; 2061 | 2062 | local.isXML = function(document){ 2063 | return (!!document.xmlVersion) || (!!document.xml) || (toString.call(document) == '[object XMLDocument]') || 2064 | (document.nodeType == 9 && document.documentElement.nodeName != 'HTML'); 2065 | }; 2066 | 2067 | local.setDocument = function(document){ 2068 | 2069 | // convert elements / window arguments to document. if document cannot be extrapolated, the function returns. 2070 | var nodeType = document.nodeType; 2071 | if (nodeType == 9); // document 2072 | else if (nodeType) document = document.ownerDocument; // node 2073 | else if (document.navigator) document = document.document; // window 2074 | else return; 2075 | 2076 | // check if it's the old document 2077 | 2078 | if (this.document === document) return; 2079 | this.document = document; 2080 | 2081 | // check if we have done feature detection on this document before 2082 | 2083 | var root = document.documentElement, 2084 | rootUid = this.getUIDXML(root), 2085 | features = featuresCache[rootUid], 2086 | feature; 2087 | 2088 | if (features){ 2089 | for (feature in features){ 2090 | this[feature] = features[feature]; 2091 | } 2092 | return; 2093 | } 2094 | 2095 | features = featuresCache[rootUid] = {}; 2096 | 2097 | features.root = root; 2098 | features.isXMLDocument = this.isXML(document); 2099 | 2100 | features.brokenStarGEBTN 2101 | = features.starSelectsClosedQSA 2102 | = features.idGetsName 2103 | = features.brokenMixedCaseQSA 2104 | = features.brokenGEBCN 2105 | = features.brokenCheckedQSA 2106 | = features.brokenEmptyAttributeQSA 2107 | = features.isHTMLDocument 2108 | = features.nativeMatchesSelector 2109 | = false; 2110 | 2111 | var starSelectsClosed, starSelectsComments, 2112 | brokenSecondClassNameGEBCN, cachedGetElementsByClassName, 2113 | brokenFormAttributeGetter; 2114 | 2115 | var selected, id = 'slick_uniqueid'; 2116 | var testNode = document.createElement('div'); 2117 | 2118 | var testRoot = document.body || document.getElementsByTagName('body')[0] || root; 2119 | testRoot.appendChild(testNode); 2120 | 2121 | // on non-HTML documents innerHTML and getElementsById doesnt work properly 2122 | try { 2123 | testNode.innerHTML = ''; 2124 | features.isHTMLDocument = !!document.getElementById(id); 2125 | } catch(e){}; 2126 | 2127 | if (features.isHTMLDocument){ 2128 | 2129 | testNode.style.display = 'none'; 2130 | 2131 | // IE returns comment nodes for getElementsByTagName('*') for some documents 2132 | testNode.appendChild(document.createComment('')); 2133 | starSelectsComments = (testNode.getElementsByTagName('*').length > 1); 2134 | 2135 | // IE returns closed nodes (EG:"") for getElementsByTagName('*') for some documents 2136 | try { 2137 | testNode.innerHTML = 'foo'; 2138 | selected = testNode.getElementsByTagName('*'); 2139 | starSelectsClosed = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/'); 2140 | } catch(e){}; 2141 | 2142 | features.brokenStarGEBTN = starSelectsComments || starSelectsClosed; 2143 | 2144 | // IE returns elements with the name instead of just id for getElementsById for some documents 2145 | try { 2146 | testNode.innerHTML = ''; 2147 | features.idGetsName = document.getElementById(id) === testNode.firstChild; 2148 | } catch(e){}; 2149 | 2150 | if (testNode.getElementsByClassName){ 2151 | 2152 | // Safari 3.2 getElementsByClassName caches results 2153 | try { 2154 | testNode.innerHTML = ''; 2155 | testNode.getElementsByClassName('b').length; 2156 | testNode.firstChild.className = 'b'; 2157 | cachedGetElementsByClassName = (testNode.getElementsByClassName('b').length != 2); 2158 | } catch(e){}; 2159 | 2160 | // Opera 9.6 getElementsByClassName doesnt detects the class if its not the first one 2161 | try { 2162 | testNode.innerHTML = ''; 2163 | brokenSecondClassNameGEBCN = (testNode.getElementsByClassName('a').length != 2); 2164 | } catch(e){}; 2165 | 2166 | features.brokenGEBCN = cachedGetElementsByClassName || brokenSecondClassNameGEBCN; 2167 | } 2168 | 2169 | if (testNode.querySelectorAll){ 2170 | // IE 8 returns closed nodes (EG:"") for querySelectorAll('*') for some documents 2171 | try { 2172 | testNode.innerHTML = 'foo'; 2173 | selected = testNode.querySelectorAll('*'); 2174 | features.starSelectsClosedQSA = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/'); 2175 | } catch(e){}; 2176 | 2177 | // Safari 3.2 querySelectorAll doesnt work with mixedcase on quirksmode 2178 | try { 2179 | testNode.innerHTML = ''; 2180 | features.brokenMixedCaseQSA = !testNode.querySelectorAll('.MiX').length; 2181 | } catch(e){}; 2182 | 2183 | // Webkit and Opera dont return selected options on querySelectorAll 2184 | try { 2185 | testNode.innerHTML = ''; 2186 | features.brokenCheckedQSA = (testNode.querySelectorAll(':checked').length == 0); 2187 | } catch(e){}; 2188 | 2189 | // IE returns incorrect results for attr[*^$]="" selectors on querySelectorAll 2190 | try { 2191 | testNode.innerHTML = ''; 2192 | features.brokenEmptyAttributeQSA = (testNode.querySelectorAll('[class*=""]').length != 0); 2193 | } catch(e){}; 2194 | 2195 | } 2196 | 2197 | // IE6-7, if a form has an input of id x, form.getAttribute(x) returns a reference to the input 2198 | try { 2199 | testNode.innerHTML = '
'; 2200 | brokenFormAttributeGetter = (testNode.firstChild.getAttribute('action') != 's'); 2201 | } catch(e){}; 2202 | 2203 | // native matchesSelector function 2204 | 2205 | features.nativeMatchesSelector = root.matchesSelector || /*root.msMatchesSelector ||*/ root.mozMatchesSelector || root.webkitMatchesSelector; 2206 | if (features.nativeMatchesSelector) try { 2207 | // if matchesSelector trows errors on incorrect sintaxes we can use it 2208 | features.nativeMatchesSelector.call(root, ':slick'); 2209 | features.nativeMatchesSelector = null; 2210 | } catch(e){}; 2211 | 2212 | } 2213 | 2214 | try { 2215 | root.slick_expando = 1; 2216 | delete root.slick_expando; 2217 | features.getUID = this.getUIDHTML; 2218 | } catch(e) { 2219 | features.getUID = this.getUIDXML; 2220 | } 2221 | 2222 | testRoot.removeChild(testNode); 2223 | testNode = selected = testRoot = null; 2224 | 2225 | // getAttribute 2226 | 2227 | features.getAttribute = (features.isHTMLDocument && brokenFormAttributeGetter) ? function(node, name){ 2228 | var method = this.attributeGetters[name]; 2229 | if (method) return method.call(node); 2230 | var attributeNode = node.getAttributeNode(name); 2231 | return (attributeNode) ? attributeNode.nodeValue : null; 2232 | } : function(node, name){ 2233 | var method = this.attributeGetters[name]; 2234 | return (method) ? method.call(node) : node.getAttribute(name); 2235 | }; 2236 | 2237 | // hasAttribute 2238 | 2239 | features.hasAttribute = (root && this.isNativeCode(root.hasAttribute)) ? function(node, attribute) { 2240 | return node.hasAttribute(attribute); 2241 | } : function(node, attribute) { 2242 | node = node.getAttributeNode(attribute); 2243 | return !!(node && (node.specified || node.nodeValue)); 2244 | }; 2245 | 2246 | // contains 2247 | // FIXME: Add specs: local.contains should be different for xml and html documents? 2248 | features.contains = (root && this.isNativeCode(root.contains)) ? function(context, node){ 2249 | return context.contains(node); 2250 | } : (root && root.compareDocumentPosition) ? function(context, node){ 2251 | return context === node || !!(context.compareDocumentPosition(node) & 16); 2252 | } : function(context, node){ 2253 | if (node) do { 2254 | if (node === context) return true; 2255 | } while ((node = node.parentNode)); 2256 | return false; 2257 | }; 2258 | 2259 | // document order sorting 2260 | // credits to Sizzle (http://sizzlejs.com/) 2261 | 2262 | features.documentSorter = (root.compareDocumentPosition) ? function(a, b){ 2263 | if (!a.compareDocumentPosition || !b.compareDocumentPosition) return 0; 2264 | return a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; 2265 | } : ('sourceIndex' in root) ? function(a, b){ 2266 | if (!a.sourceIndex || !b.sourceIndex) return 0; 2267 | return a.sourceIndex - b.sourceIndex; 2268 | } : (document.createRange) ? function(a, b){ 2269 | if (!a.ownerDocument || !b.ownerDocument) return 0; 2270 | var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); 2271 | aRange.setStart(a, 0); 2272 | aRange.setEnd(a, 0); 2273 | bRange.setStart(b, 0); 2274 | bRange.setEnd(b, 0); 2275 | return aRange.compareBoundaryPoints(Range.START_TO_END, bRange); 2276 | } : null ; 2277 | 2278 | root = null; 2279 | 2280 | for (feature in features){ 2281 | this[feature] = features[feature]; 2282 | } 2283 | }; 2284 | 2285 | // Main Method 2286 | 2287 | var reSimpleSelector = /^([#.]?)((?:[\w-]+|\*))$/, 2288 | reEmptyAttribute = /\[.+[*$^]=(?:""|'')?\]/, 2289 | qsaFailExpCache = {}; 2290 | 2291 | local.search = function(context, expression, append, first){ 2292 | 2293 | var found = this.found = (first) ? null : (append || []); 2294 | 2295 | if (!context) return found; 2296 | else if (context.navigator) context = context.document; // Convert the node from a window to a document 2297 | else if (!context.nodeType) return found; 2298 | 2299 | // setup 2300 | 2301 | var parsed, i, 2302 | uniques = this.uniques = {}, 2303 | hasOthers = !!(append && append.length), 2304 | contextIsDocument = (context.nodeType == 9); 2305 | 2306 | if (this.document !== (contextIsDocument ? context : context.ownerDocument)) this.setDocument(context); 2307 | 2308 | // avoid duplicating items already in the append array 2309 | if (hasOthers) for (i = found.length; i--;) uniques[this.getUID(found[i])] = true; 2310 | 2311 | // expression checks 2312 | 2313 | if (typeof expression == 'string'){ // expression is a string 2314 | 2315 | /**/ 2316 | var simpleSelector = expression.match(reSimpleSelector); 2317 | simpleSelectors: if (simpleSelector) { 2318 | 2319 | var symbol = simpleSelector[1], 2320 | name = simpleSelector[2], 2321 | node, nodes; 2322 | 2323 | if (!symbol){ 2324 | 2325 | if (name == '*' && this.brokenStarGEBTN) break simpleSelectors; 2326 | nodes = context.getElementsByTagName(name); 2327 | if (first) return nodes[0] || null; 2328 | for (i = 0; node = nodes[i++];){ 2329 | if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); 2330 | } 2331 | 2332 | } else if (symbol == '#'){ 2333 | 2334 | if (!this.isHTMLDocument || !contextIsDocument) break simpleSelectors; 2335 | node = context.getElementById(name); 2336 | if (!node) return found; 2337 | if (this.idGetsName && node.getAttributeNode('id').nodeValue != name) break simpleSelectors; 2338 | if (first) return node || null; 2339 | if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); 2340 | 2341 | } else if (symbol == '.'){ 2342 | 2343 | if (!this.isHTMLDocument || ((!context.getElementsByClassName || this.brokenGEBCN) && context.querySelectorAll)) break simpleSelectors; 2344 | if (context.getElementsByClassName && !this.brokenGEBCN){ 2345 | nodes = context.getElementsByClassName(name); 2346 | if (first) return nodes[0] || null; 2347 | for (i = 0; node = nodes[i++];){ 2348 | if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); 2349 | } 2350 | } else { 2351 | var matchClass = new RegExp('(^|\\s)'+ Slick.escapeRegExp(name) +'(\\s|$)'); 2352 | nodes = context.getElementsByTagName('*'); 2353 | for (i = 0; node = nodes[i++];){ 2354 | className = node.className; 2355 | if (!(className && matchClass.test(className))) continue; 2356 | if (first) return node; 2357 | if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); 2358 | } 2359 | } 2360 | 2361 | } 2362 | 2363 | if (hasOthers) this.sort(found); 2364 | return (first) ? null : found; 2365 | 2366 | } 2367 | /**/ 2368 | 2369 | /**/ 2370 | querySelector: if (context.querySelectorAll) { 2371 | 2372 | if (!this.isHTMLDocument || this.brokenMixedCaseQSA || qsaFailExpCache[expression] || 2373 | (this.brokenCheckedQSA && expression.indexOf(':checked') > -1) || 2374 | (this.brokenEmptyAttributeQSA && reEmptyAttribute.test(expression)) || Slick.disableQSA) break querySelector; 2375 | 2376 | var _expression = expression; 2377 | if (!contextIsDocument){ 2378 | // non-document rooted QSA 2379 | // credits to Andrew Dupont 2380 | var currentId = context.getAttribute('id'), slickid = 'slickid__'; 2381 | context.setAttribute('id', slickid); 2382 | _expression = '#' + slickid + ' ' + _expression; 2383 | } 2384 | 2385 | try { 2386 | if (first) return context.querySelector(_expression) || null; 2387 | else nodes = context.querySelectorAll(_expression); 2388 | } catch(e) { 2389 | qsaFailExpCache[expression] = 1; 2390 | break querySelector; 2391 | } finally { 2392 | if (!contextIsDocument){ 2393 | if (currentId) context.setAttribute('id', currentId); 2394 | else context.removeAttribute('id'); 2395 | } 2396 | } 2397 | 2398 | if (this.starSelectsClosedQSA) for (i = 0; node = nodes[i++];){ 2399 | if (node.nodeName > '@' && !(hasOthers && uniques[this.getUID(node)])) found.push(node); 2400 | } else for (i = 0; node = nodes[i++];){ 2401 | if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); 2402 | } 2403 | 2404 | if (hasOthers) this.sort(found); 2405 | return found; 2406 | 2407 | } 2408 | /**/ 2409 | 2410 | parsed = this.Slick.parse(expression); 2411 | if (!parsed.length) return found; 2412 | } else if (expression == null){ // there is no expression 2413 | return found; 2414 | } else if (expression.Slick){ // expression is a parsed Slick object 2415 | parsed = expression; 2416 | } else if (this.contains(context.documentElement || context, expression)){ // expression is a node 2417 | (found) ? found.push(expression) : found = expression; 2418 | return found; 2419 | } else { // other junk 2420 | return found; 2421 | } 2422 | 2423 | /**//**/ 2424 | 2425 | // cache elements for the nth selectors 2426 | 2427 | this.posNTH = {}; 2428 | this.posNTHLast = {}; 2429 | this.posNTHType = {}; 2430 | this.posNTHTypeLast = {}; 2431 | 2432 | /**//**/ 2433 | 2434 | // if append is null and there is only a single selector with one expression use pushArray, else use pushUID 2435 | this.push = (!hasOthers && (first || (parsed.length == 1 && parsed.expressions[0].length == 1))) ? this.pushArray : this.pushUID; 2436 | 2437 | if (found == null) found = []; 2438 | 2439 | // default engine 2440 | 2441 | var j, m, n; 2442 | var combinator, tag, id, classList, classes, attributes, pseudos; 2443 | var currentItems, currentExpression, currentBit, lastBit, expressions = parsed.expressions; 2444 | 2445 | search: for (i = 0; (currentExpression = expressions[i]); i++) for (j = 0; (currentBit = currentExpression[j]); j++){ 2446 | 2447 | combinator = 'combinator:' + currentBit.combinator; 2448 | if (!this[combinator]) continue search; 2449 | 2450 | tag = (this.isXMLDocument) ? currentBit.tag : currentBit.tag.toUpperCase(); 2451 | id = currentBit.id; 2452 | classList = currentBit.classList; 2453 | classes = currentBit.classes; 2454 | attributes = currentBit.attributes; 2455 | pseudos = currentBit.pseudos; 2456 | lastBit = (j === (currentExpression.length - 1)); 2457 | 2458 | this.bitUniques = {}; 2459 | 2460 | if (lastBit){ 2461 | this.uniques = uniques; 2462 | this.found = found; 2463 | } else { 2464 | this.uniques = {}; 2465 | this.found = []; 2466 | } 2467 | 2468 | if (j === 0){ 2469 | this[combinator](context, tag, id, classes, attributes, pseudos, classList); 2470 | if (first && lastBit && found.length) break search; 2471 | } else { 2472 | if (first && lastBit) for (m = 0, n = currentItems.length; m < n; m++){ 2473 | this[combinator](currentItems[m], tag, id, classes, attributes, pseudos, classList); 2474 | if (found.length) break search; 2475 | } else for (m = 0, n = currentItems.length; m < n; m++) this[combinator](currentItems[m], tag, id, classes, attributes, pseudos, classList); 2476 | } 2477 | 2478 | currentItems = this.found; 2479 | } 2480 | 2481 | // should sort if there are nodes in append and if you pass multiple expressions. 2482 | if (hasOthers || (parsed.expressions.length > 1)) this.sort(found); 2483 | 2484 | return (first) ? (found[0] || null) : found; 2485 | }; 2486 | 2487 | // Utils 2488 | 2489 | local.uidx = 1; 2490 | local.uidk = 'slick-uniqueid'; 2491 | 2492 | local.getUIDXML = function(node){ 2493 | var uid = node.getAttribute(this.uidk); 2494 | if (!uid){ 2495 | uid = this.uidx++; 2496 | node.setAttribute(this.uidk, uid); 2497 | } 2498 | return uid; 2499 | }; 2500 | 2501 | local.getUIDHTML = function(node){ 2502 | return node.uniqueNumber || (node.uniqueNumber = this.uidx++); 2503 | }; 2504 | 2505 | // sort based on the setDocument documentSorter method. 2506 | 2507 | local.sort = function(results){ 2508 | if (!this.documentSorter) return results; 2509 | results.sort(this.documentSorter); 2510 | return results; 2511 | }; 2512 | 2513 | /**//**/ 2514 | 2515 | local.cacheNTH = {}; 2516 | 2517 | local.matchNTH = /^([+-]?\d*)?([a-z]+)?([+-]\d+)?$/; 2518 | 2519 | local.parseNTHArgument = function(argument){ 2520 | var parsed = argument.match(this.matchNTH); 2521 | if (!parsed) return false; 2522 | var special = parsed[2] || false; 2523 | var a = parsed[1] || 1; 2524 | if (a == '-') a = -1; 2525 | var b = +parsed[3] || 0; 2526 | parsed = 2527 | (special == 'n') ? {a: a, b: b} : 2528 | (special == 'odd') ? {a: 2, b: 1} : 2529 | (special == 'even') ? {a: 2, b: 0} : {a: 0, b: a}; 2530 | 2531 | return (this.cacheNTH[argument] = parsed); 2532 | }; 2533 | 2534 | local.createNTHPseudo = function(child, sibling, positions, ofType){ 2535 | return function(node, argument){ 2536 | var uid = this.getUID(node); 2537 | if (!this[positions][uid]){ 2538 | var parent = node.parentNode; 2539 | if (!parent) return false; 2540 | var el = parent[child], count = 1; 2541 | if (ofType){ 2542 | var nodeName = node.nodeName; 2543 | do { 2544 | if (el.nodeName != nodeName) continue; 2545 | this[positions][this.getUID(el)] = count++; 2546 | } while ((el = el[sibling])); 2547 | } else { 2548 | do { 2549 | if (el.nodeType != 1) continue; 2550 | this[positions][this.getUID(el)] = count++; 2551 | } while ((el = el[sibling])); 2552 | } 2553 | } 2554 | argument = argument || 'n'; 2555 | var parsed = this.cacheNTH[argument] || this.parseNTHArgument(argument); 2556 | if (!parsed) return false; 2557 | var a = parsed.a, b = parsed.b, pos = this[positions][uid]; 2558 | if (a == 0) return b == pos; 2559 | if (a > 0){ 2560 | if (pos < b) return false; 2561 | } else { 2562 | if (b < pos) return false; 2563 | } 2564 | return ((pos - b) % a) == 0; 2565 | }; 2566 | }; 2567 | 2568 | /**//**/ 2569 | 2570 | local.pushArray = function(node, tag, id, classes, attributes, pseudos){ 2571 | if (this.matchSelector(node, tag, id, classes, attributes, pseudos)) this.found.push(node); 2572 | }; 2573 | 2574 | local.pushUID = function(node, tag, id, classes, attributes, pseudos){ 2575 | var uid = this.getUID(node); 2576 | if (!this.uniques[uid] && this.matchSelector(node, tag, id, classes, attributes, pseudos)){ 2577 | this.uniques[uid] = true; 2578 | this.found.push(node); 2579 | } 2580 | }; 2581 | 2582 | local.matchNode = function(node, selector){ 2583 | if (this.isHTMLDocument && this.nativeMatchesSelector){ 2584 | try { 2585 | return this.nativeMatchesSelector.call(node, selector.replace(/\[([^=]+)=\s*([^'"\]]+?)\s*\]/g, '[$1="$2"]')); 2586 | } catch(matchError) {} 2587 | } 2588 | 2589 | var parsed = this.Slick.parse(selector); 2590 | if (!parsed) return true; 2591 | 2592 | // simple (single) selectors 2593 | var expressions = parsed.expressions, reversedExpressions, simpleExpCounter = 0, i; 2594 | for (i = 0; (currentExpression = expressions[i]); i++){ 2595 | if (currentExpression.length == 1){ 2596 | var exp = currentExpression[0]; 2597 | if (this.matchSelector(node, (this.isXMLDocument) ? exp.tag : exp.tag.toUpperCase(), exp.id, exp.classes, exp.attributes, exp.pseudos)) return true; 2598 | simpleExpCounter++; 2599 | } 2600 | } 2601 | 2602 | if (simpleExpCounter == parsed.length) return false; 2603 | 2604 | var nodes = this.search(this.document, parsed), item; 2605 | for (i = 0; item = nodes[i++];){ 2606 | if (item === node) return true; 2607 | } 2608 | return false; 2609 | }; 2610 | 2611 | local.matchPseudo = function(node, name, argument){ 2612 | var pseudoName = 'pseudo:' + name; 2613 | if (this[pseudoName]) return this[pseudoName](node, argument); 2614 | var attribute = this.getAttribute(node, name); 2615 | return (argument) ? argument == attribute : !!attribute; 2616 | }; 2617 | 2618 | local.matchSelector = function(node, tag, id, classes, attributes, pseudos){ 2619 | if (tag){ 2620 | var nodeName = (this.isXMLDocument) ? node.nodeName : node.nodeName.toUpperCase(); 2621 | if (tag == '*'){ 2622 | if (nodeName < '@') return false; // Fix for comment nodes and closed nodes 2623 | } else { 2624 | if (nodeName != tag) return false; 2625 | } 2626 | } 2627 | 2628 | if (id && node.getAttribute('id') != id) return false; 2629 | 2630 | var i, part, cls; 2631 | if (classes) for (i = classes.length; i--;){ 2632 | cls = node.getAttribute('class') || node.className; 2633 | if (!(cls && classes[i].regexp.test(cls))) return false; 2634 | } 2635 | if (attributes) for (i = attributes.length; i--;){ 2636 | part = attributes[i]; 2637 | if (part.operator ? !part.test(this.getAttribute(node, part.key)) : !this.hasAttribute(node, part.key)) return false; 2638 | } 2639 | if (pseudos) for (i = pseudos.length; i--;){ 2640 | part = pseudos[i]; 2641 | if (!this.matchPseudo(node, part.key, part.value)) return false; 2642 | } 2643 | return true; 2644 | }; 2645 | 2646 | var combinators = { 2647 | 2648 | ' ': function(node, tag, id, classes, attributes, pseudos, classList){ // all child nodes, any level 2649 | 2650 | var i, item, children; 2651 | 2652 | if (this.isHTMLDocument){ 2653 | getById: if (id){ 2654 | item = this.document.getElementById(id); 2655 | if ((!item && node.all) || (this.idGetsName && item && item.getAttributeNode('id').nodeValue != id)){ 2656 | // all[id] returns all the elements with that name or id inside node 2657 | // if theres just one it will return the element, else it will be a collection 2658 | children = node.all[id]; 2659 | if (!children) return; 2660 | if (!children[0]) children = [children]; 2661 | for (i = 0; item = children[i++];){ 2662 | var idNode = item.getAttributeNode('id'); 2663 | if (idNode && idNode.nodeValue == id){ 2664 | this.push(item, tag, null, classes, attributes, pseudos); 2665 | break; 2666 | } 2667 | } 2668 | return; 2669 | } 2670 | if (!item){ 2671 | // if the context is in the dom we return, else we will try GEBTN, breaking the getById label 2672 | if (this.contains(this.root, node)) return; 2673 | else break getById; 2674 | } else if (this.document !== node && !this.contains(node, item)) return; 2675 | this.push(item, tag, null, classes, attributes, pseudos); 2676 | return; 2677 | } 2678 | getByClass: if (classes && node.getElementsByClassName && !this.brokenGEBCN){ 2679 | children = node.getElementsByClassName(classList.join(' ')); 2680 | if (!(children && children.length)) break getByClass; 2681 | for (i = 0; item = children[i++];) this.push(item, tag, id, null, attributes, pseudos); 2682 | return; 2683 | } 2684 | } 2685 | getByTag: { 2686 | children = node.getElementsByTagName(tag); 2687 | if (!(children && children.length)) break getByTag; 2688 | if (!this.brokenStarGEBTN) tag = null; 2689 | for (i = 0; item = children[i++];) this.push(item, tag, id, classes, attributes, pseudos); 2690 | } 2691 | }, 2692 | 2693 | '>': function(node, tag, id, classes, attributes, pseudos){ // direct children 2694 | if ((node = node.firstChild)) do { 2695 | if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos); 2696 | } while ((node = node.nextSibling)); 2697 | }, 2698 | 2699 | '+': function(node, tag, id, classes, attributes, pseudos){ // next sibling 2700 | while ((node = node.nextSibling)) if (node.nodeType == 1){ 2701 | this.push(node, tag, id, classes, attributes, pseudos); 2702 | break; 2703 | } 2704 | }, 2705 | 2706 | '^': function(node, tag, id, classes, attributes, pseudos){ // first child 2707 | node = node.firstChild; 2708 | if (node){ 2709 | if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos); 2710 | else this['combinator:+'](node, tag, id, classes, attributes, pseudos); 2711 | } 2712 | }, 2713 | 2714 | '~': function(node, tag, id, classes, attributes, pseudos){ // next siblings 2715 | while ((node = node.nextSibling)){ 2716 | if (node.nodeType != 1) continue; 2717 | var uid = this.getUID(node); 2718 | if (this.bitUniques[uid]) break; 2719 | this.bitUniques[uid] = true; 2720 | this.push(node, tag, id, classes, attributes, pseudos); 2721 | } 2722 | }, 2723 | 2724 | '++': function(node, tag, id, classes, attributes, pseudos){ // next sibling and previous sibling 2725 | this['combinator:+'](node, tag, id, classes, attributes, pseudos); 2726 | this['combinator:!+'](node, tag, id, classes, attributes, pseudos); 2727 | }, 2728 | 2729 | '~~': function(node, tag, id, classes, attributes, pseudos){ // next siblings and previous siblings 2730 | this['combinator:~'](node, tag, id, classes, attributes, pseudos); 2731 | this['combinator:!~'](node, tag, id, classes, attributes, pseudos); 2732 | }, 2733 | 2734 | '!': function(node, tag, id, classes, attributes, pseudos){ // all parent nodes up to document 2735 | while ((node = node.parentNode)) if (node !== this.document) this.push(node, tag, id, classes, attributes, pseudos); 2736 | }, 2737 | 2738 | '!>': function(node, tag, id, classes, attributes, pseudos){ // direct parent (one level) 2739 | node = node.parentNode; 2740 | if (node !== this.document) this.push(node, tag, id, classes, attributes, pseudos); 2741 | }, 2742 | 2743 | '!+': function(node, tag, id, classes, attributes, pseudos){ // previous sibling 2744 | while ((node = node.previousSibling)) if (node.nodeType == 1){ 2745 | this.push(node, tag, id, classes, attributes, pseudos); 2746 | break; 2747 | } 2748 | }, 2749 | 2750 | '!^': function(node, tag, id, classes, attributes, pseudos){ // last child 2751 | node = node.lastChild; 2752 | if (node){ 2753 | if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos); 2754 | else this['combinator:!+'](node, tag, id, classes, attributes, pseudos); 2755 | } 2756 | }, 2757 | 2758 | '!~': function(node, tag, id, classes, attributes, pseudos){ // previous siblings 2759 | while ((node = node.previousSibling)){ 2760 | if (node.nodeType != 1) continue; 2761 | var uid = this.getUID(node); 2762 | if (this.bitUniques[uid]) break; 2763 | this.bitUniques[uid] = true; 2764 | this.push(node, tag, id, classes, attributes, pseudos); 2765 | } 2766 | } 2767 | 2768 | }; 2769 | 2770 | for (var c in combinators) local['combinator:' + c] = combinators[c]; 2771 | 2772 | var pseudos = { 2773 | 2774 | /**/ 2775 | 2776 | 'empty': function(node){ 2777 | var child = node.firstChild; 2778 | return !(child && child.nodeType == 1) && !(node.innerText || node.textContent || '').length; 2779 | }, 2780 | 2781 | 'not': function(node, expression){ 2782 | return !this.matchNode(node, expression); 2783 | }, 2784 | 2785 | 'contains': function(node, text){ 2786 | return (node.innerText || node.textContent || '').indexOf(text) > -1; 2787 | }, 2788 | 2789 | 'first-child': function(node){ 2790 | while ((node = node.previousSibling)) if (node.nodeType == 1) return false; 2791 | return true; 2792 | }, 2793 | 2794 | 'last-child': function(node){ 2795 | while ((node = node.nextSibling)) if (node.nodeType == 1) return false; 2796 | return true; 2797 | }, 2798 | 2799 | 'only-child': function(node){ 2800 | var prev = node; 2801 | while ((prev = prev.previousSibling)) if (prev.nodeType == 1) return false; 2802 | var next = node; 2803 | while ((next = next.nextSibling)) if (next.nodeType == 1) return false; 2804 | return true; 2805 | }, 2806 | 2807 | /**/ 2808 | 2809 | 'nth-child': local.createNTHPseudo('firstChild', 'nextSibling', 'posNTH'), 2810 | 2811 | 'nth-last-child': local.createNTHPseudo('lastChild', 'previousSibling', 'posNTHLast'), 2812 | 2813 | 'nth-of-type': local.createNTHPseudo('firstChild', 'nextSibling', 'posNTHType', true), 2814 | 2815 | 'nth-last-of-type': local.createNTHPseudo('lastChild', 'previousSibling', 'posNTHTypeLast', true), 2816 | 2817 | 'index': function(node, index){ 2818 | return this['pseudo:nth-child'](node, '' + index + 1); 2819 | }, 2820 | 2821 | 'even': function(node){ 2822 | return this['pseudo:nth-child'](node, '2n'); 2823 | }, 2824 | 2825 | 'odd': function(node){ 2826 | return this['pseudo:nth-child'](node, '2n+1'); 2827 | }, 2828 | 2829 | /**/ 2830 | 2831 | /**/ 2832 | 2833 | 'first-of-type': function(node){ 2834 | var nodeName = node.nodeName; 2835 | while ((node = node.previousSibling)) if (node.nodeName == nodeName) return false; 2836 | return true; 2837 | }, 2838 | 2839 | 'last-of-type': function(node){ 2840 | var nodeName = node.nodeName; 2841 | while ((node = node.nextSibling)) if (node.nodeName == nodeName) return false; 2842 | return true; 2843 | }, 2844 | 2845 | 'only-of-type': function(node){ 2846 | var prev = node, nodeName = node.nodeName; 2847 | while ((prev = prev.previousSibling)) if (prev.nodeName == nodeName) return false; 2848 | var next = node; 2849 | while ((next = next.nextSibling)) if (next.nodeName == nodeName) return false; 2850 | return true; 2851 | }, 2852 | 2853 | /**/ 2854 | 2855 | // custom pseudos 2856 | 2857 | 'enabled': function(node){ 2858 | return !node.disabled; 2859 | }, 2860 | 2861 | 'disabled': function(node){ 2862 | return node.disabled; 2863 | }, 2864 | 2865 | 'checked': function(node){ 2866 | return node.checked || node.selected; 2867 | }, 2868 | 2869 | 'focus': function(node){ 2870 | return this.isHTMLDocument && this.document.activeElement === node && (node.href || node.type || this.hasAttribute(node, 'tabindex')); 2871 | }, 2872 | 2873 | 'root': function(node){ 2874 | return (node === this.root); 2875 | }, 2876 | 2877 | 'selected': function(node){ 2878 | return node.selected; 2879 | } 2880 | 2881 | /**/ 2882 | }; 2883 | 2884 | for (var p in pseudos) local['pseudo:' + p] = pseudos[p]; 2885 | 2886 | // attributes methods 2887 | 2888 | local.attributeGetters = { 2889 | 2890 | 'class': function(){ 2891 | return this.getAttribute('class') || this.className; 2892 | }, 2893 | 2894 | 'for': function(){ 2895 | return ('htmlFor' in this) ? this.htmlFor : this.getAttribute('for'); 2896 | }, 2897 | 2898 | 'href': function(){ 2899 | return ('href' in this) ? this.getAttribute('href', 2) : this.getAttribute('href'); 2900 | }, 2901 | 2902 | 'style': function(){ 2903 | return (this.style) ? this.style.cssText : this.getAttribute('style'); 2904 | }, 2905 | 2906 | 'tabindex': function(){ 2907 | var attributeNode = this.getAttributeNode('tabindex'); 2908 | return (attributeNode && attributeNode.specified) ? attributeNode.nodeValue : null; 2909 | }, 2910 | 2911 | 'type': function(){ 2912 | return this.getAttribute('type'); 2913 | } 2914 | 2915 | }; 2916 | 2917 | // Slick 2918 | 2919 | var Slick = local.Slick = (this.Slick || {}); 2920 | 2921 | Slick.version = '1.1.5'; 2922 | 2923 | // Slick finder 2924 | 2925 | Slick.search = function(context, expression, append){ 2926 | return local.search(context, expression, append); 2927 | }; 2928 | 2929 | Slick.find = function(context, expression){ 2930 | return local.search(context, expression, null, true); 2931 | }; 2932 | 2933 | // Slick containment checker 2934 | 2935 | Slick.contains = function(container, node){ 2936 | local.setDocument(container); 2937 | return local.contains(container, node); 2938 | }; 2939 | 2940 | // Slick attribute getter 2941 | 2942 | Slick.getAttribute = function(node, name){ 2943 | return local.getAttribute(node, name); 2944 | }; 2945 | 2946 | // Slick matcher 2947 | 2948 | Slick.match = function(node, selector){ 2949 | if (!(node && selector)) return false; 2950 | if (!selector || selector === node) return true; 2951 | local.setDocument(node); 2952 | return local.matchNode(node, selector); 2953 | }; 2954 | 2955 | // Slick attribute accessor 2956 | 2957 | Slick.defineAttributeGetter = function(name, fn){ 2958 | local.attributeGetters[name] = fn; 2959 | return this; 2960 | }; 2961 | 2962 | Slick.lookupAttributeGetter = function(name){ 2963 | return local.attributeGetters[name]; 2964 | }; 2965 | 2966 | // Slick pseudo accessor 2967 | 2968 | Slick.definePseudo = function(name, fn){ 2969 | local['pseudo:' + name] = function(node, argument){ 2970 | return fn.call(node, argument); 2971 | }; 2972 | return this; 2973 | }; 2974 | 2975 | Slick.lookupPseudo = function(name){ 2976 | var pseudo = local['pseudo:' + name]; 2977 | if (pseudo) return function(argument){ 2978 | return pseudo.call(this, argument); 2979 | }; 2980 | return null; 2981 | }; 2982 | 2983 | // Slick overrides accessor 2984 | 2985 | Slick.override = function(regexp, fn){ 2986 | local.override(regexp, fn); 2987 | return this; 2988 | }; 2989 | 2990 | Slick.isXML = local.isXML; 2991 | 2992 | Slick.uidOf = function(node){ 2993 | return local.getUIDHTML(node); 2994 | }; 2995 | 2996 | if (!this.Slick) this.Slick = Slick; 2997 | 2998 | }).apply(/**/(typeof exports != 'undefined') ? exports : /**/this); 2999 | 3000 | 3001 | /* 3002 | --- 3003 | 3004 | name: Element 3005 | 3006 | description: 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. 3007 | 3008 | license: MIT-style license. 3009 | 3010 | requires: [Window, Document, Array, String, Function, Number, Slick.Parser, Slick.Finder] 3011 | 3012 | provides: [Element, Elements, $, $$, Iframe, Selectors] 3013 | 3014 | ... 3015 | */ 3016 | 3017 | var Element = function(tag, props){ 3018 | var konstructor = Element.Constructors[tag]; 3019 | if (konstructor) return konstructor(props); 3020 | if (typeof tag != 'string') return document.id(tag).set(props); 3021 | 3022 | if (!props) props = {}; 3023 | 3024 | if (!(/^[\w-]+$/).test(tag)){ 3025 | var parsed = Slick.parse(tag).expressions[0][0]; 3026 | tag = (parsed.tag == '*') ? 'div' : parsed.tag; 3027 | if (parsed.id && props.id == null) props.id = parsed.id; 3028 | 3029 | var attributes = parsed.attributes; 3030 | if (attributes) for (var i = 0, l = attributes.length; i < l; i++){ 3031 | var attr = attributes[i]; 3032 | if (attr.value != null && attr.operator == '=' && props[attr.key] == null) 3033 | props[attr.key] = attr.value; 3034 | } 3035 | 3036 | if (parsed.classList && props['class'] == null) props['class'] = parsed.classList.join(' '); 3037 | } 3038 | 3039 | return document.newElement(tag, props); 3040 | }; 3041 | 3042 | if (Browser.Element) Element.prototype = Browser.Element.prototype; 3043 | 3044 | new Type('Element', Element).mirror(function(name){ 3045 | if (Array.prototype[name]) return; 3046 | 3047 | var obj = {}; 3048 | obj[name] = function(){ 3049 | var results = [], args = arguments, elements = true; 3050 | for (var i = 0, l = this.length; i < l; i++){ 3051 | var element = this[i], result = results[i] = element[name].apply(element, args); 3052 | elements = (elements && typeOf(result) == 'element'); 3053 | } 3054 | return (elements) ? new Elements(results) : results; 3055 | }; 3056 | 3057 | Elements.implement(obj); 3058 | }); 3059 | 3060 | if (!Browser.Element){ 3061 | Element.parent = Object; 3062 | 3063 | Element.Prototype = {'$family': Function.from('element').hide()}; 3064 | 3065 | Element.mirror(function(name, method){ 3066 | Element.Prototype[name] = method; 3067 | }); 3068 | } 3069 | 3070 | Element.Constructors = {}; 3071 | 3072 | //<1.2compat> 3073 | 3074 | Element.Constructors = new Hash; 3075 | 3076 | // 3077 | 3078 | var IFrame = new Type('IFrame', function(){ 3079 | var params = Array.link(arguments, { 3080 | properties: Type.isObject, 3081 | iframe: function(obj){ 3082 | return (obj != null); 3083 | } 3084 | }); 3085 | 3086 | var props = params.properties || {}, iframe; 3087 | if (params.iframe) iframe = document.id(params.iframe); 3088 | var onload = props.onload || function(){}; 3089 | delete props.onload; 3090 | props.id = props.name = [props.id, props.name, iframe ? (iframe.id || iframe.name) : 'IFrame_' + String.uniqueID()].pick(); 3091 | iframe = new Element(iframe || 'iframe', props); 3092 | 3093 | var onLoad = function(){ 3094 | onload.call(iframe.contentWindow); 3095 | }; 3096 | 3097 | if (window.frames[props.id]) onLoad(); 3098 | else iframe.addListener('load', onLoad); 3099 | return iframe; 3100 | }); 3101 | 3102 | var Elements = this.Elements = function(nodes){ 3103 | if (nodes && nodes.length){ 3104 | var uniques = {}, node; 3105 | for (var i = 0; node = nodes[i++];){ 3106 | var uid = Slick.uidOf(node); 3107 | if (!uniques[uid]){ 3108 | uniques[uid] = true; 3109 | this.push(node); 3110 | } 3111 | } 3112 | } 3113 | }; 3114 | 3115 | Elements.prototype = {length: 0}; 3116 | Elements.parent = Array; 3117 | 3118 | new Type('Elements', Elements).implement({ 3119 | 3120 | filter: function(filter, bind){ 3121 | if (!filter) return this; 3122 | return new Elements(Array.filter(this, (typeOf(filter) == 'string') ? function(item){ 3123 | return item.match(filter); 3124 | } : filter, bind)); 3125 | }.protect(), 3126 | 3127 | push: function(){ 3128 | var length = this.length; 3129 | for (var i = 0, l = arguments.length; i < l; i++){ 3130 | var item = document.id(arguments[i]); 3131 | if (item) this[length++] = item; 3132 | } 3133 | return (this.length = length); 3134 | }.protect(), 3135 | 3136 | unshift: function(){ 3137 | var items = []; 3138 | for (var i = 0, l = arguments.length; i < l; i++){ 3139 | var item = document.id(arguments[i]); 3140 | if (item) items.push(item); 3141 | } 3142 | return Array.prototype.unshift.apply(this, items); 3143 | }.protect(), 3144 | 3145 | concat: function(){ 3146 | var newElements = new Elements(this); 3147 | for (var i = 0, l = arguments.length; i < l; i++){ 3148 | var item = arguments[i]; 3149 | if (Type.isEnumerable(item)) newElements.append(item); 3150 | else newElements.push(item); 3151 | } 3152 | return newElements; 3153 | }.protect(), 3154 | 3155 | append: function(collection){ 3156 | for (var i = 0, l = collection.length; i < l; i++) this.push(collection[i]); 3157 | return this; 3158 | }.protect(), 3159 | 3160 | empty: function(){ 3161 | while (this.length) delete this[--this.length]; 3162 | return this; 3163 | }.protect() 3164 | 3165 | }); 3166 | 3167 | //<1.2compat> 3168 | 3169 | Elements.alias('extend', 'append'); 3170 | 3171 | // 3172 | 3173 | (function(){ 3174 | 3175 | // FF, IE 3176 | var splice = Array.prototype.splice, object = {'0': 0, '1': 1, length: 2}; 3177 | 3178 | splice.call(object, 1, 1); 3179 | if (object[1] == 1) Elements.implement('splice', function(){ 3180 | var length = this.length; 3181 | splice.apply(this, arguments); 3182 | while (length >= this.length) delete this[length--]; 3183 | return this; 3184 | }.protect()); 3185 | 3186 | Elements.implement(Array.prototype); 3187 | 3188 | Array.mirror(Elements); 3189 | 3190 | /**/ 3191 | var createElementAcceptsHTML; 3192 | try { 3193 | var x = document.createElement(''); 3194 | createElementAcceptsHTML = (x.name == 'x'); 3195 | } catch(e){} 3196 | 3197 | var escapeQuotes = function(html){ 3198 | return ('' + html).replace(/&/g, '&').replace(/"/g, '"'); 3199 | }; 3200 | /**/ 3201 | 3202 | Document.implement({ 3203 | 3204 | newElement: function(tag, props){ 3205 | if (props && props.checked != null) props.defaultChecked = props.checked; 3206 | /**/// Fix for readonly name and type properties in IE < 8 3207 | if (createElementAcceptsHTML && props){ 3208 | tag = '<' + tag; 3209 | if (props.name) tag += ' name="' + escapeQuotes(props.name) + '"'; 3210 | if (props.type) tag += ' type="' + escapeQuotes(props.type) + '"'; 3211 | tag += '>'; 3212 | delete props.name; 3213 | delete props.type; 3214 | } 3215 | /**/ 3216 | return this.id(this.createElement(tag)).set(props); 3217 | } 3218 | 3219 | }); 3220 | 3221 | })(); 3222 | 3223 | Document.implement({ 3224 | 3225 | newTextNode: function(text){ 3226 | return this.createTextNode(text); 3227 | }, 3228 | 3229 | getDocument: function(){ 3230 | return this; 3231 | }, 3232 | 3233 | getWindow: function(){ 3234 | return this.window; 3235 | }, 3236 | 3237 | id: (function(){ 3238 | 3239 | var types = { 3240 | 3241 | string: function(id, nocash, doc){ 3242 | id = Slick.find(doc, '#' + id.replace(/(\W)/g, '\\$1')); 3243 | return (id) ? types.element(id, nocash) : null; 3244 | }, 3245 | 3246 | element: function(el, nocash){ 3247 | $uid(el); 3248 | if (!nocash && !el.$family && !(/^(?:object|embed)$/i).test(el.tagName)){ 3249 | Object.append(el, Element.Prototype); 3250 | } 3251 | return el; 3252 | }, 3253 | 3254 | object: function(obj, nocash, doc){ 3255 | if (obj.toElement) return types.element(obj.toElement(doc), nocash); 3256 | return null; 3257 | } 3258 | 3259 | }; 3260 | 3261 | types.textnode = types.whitespace = types.window = types.document = function(zero){ 3262 | return zero; 3263 | }; 3264 | 3265 | return function(el, nocash, doc){ 3266 | if (el && el.$family && el.uid) return el; 3267 | var type = typeOf(el); 3268 | return (types[type]) ? types[type](el, nocash, doc || document) : null; 3269 | }; 3270 | 3271 | })() 3272 | 3273 | }); 3274 | 3275 | if (window.$ == null) Window.implement('$', function(el, nc){ 3276 | return document.id(el, nc, this.document); 3277 | }); 3278 | 3279 | Window.implement({ 3280 | 3281 | getDocument: function(){ 3282 | return this.document; 3283 | }, 3284 | 3285 | getWindow: function(){ 3286 | return this; 3287 | } 3288 | 3289 | }); 3290 | 3291 | [Document, Element].invoke('implement', { 3292 | 3293 | getElements: function(expression){ 3294 | return Slick.search(this, expression, new Elements); 3295 | }, 3296 | 3297 | getElement: function(expression){ 3298 | return document.id(Slick.find(this, expression)); 3299 | } 3300 | 3301 | }); 3302 | 3303 | //<1.2compat> 3304 | 3305 | (function(search, find, match){ 3306 | 3307 | this.Selectors = {}; 3308 | var pseudos = this.Selectors.Pseudo = new Hash(); 3309 | 3310 | var addSlickPseudos = function(){ 3311 | for (var name in pseudos) if (pseudos.hasOwnProperty(name)){ 3312 | Slick.definePseudo(name, pseudos[name]); 3313 | delete pseudos[name]; 3314 | } 3315 | }; 3316 | 3317 | Slick.search = function(context, expression, append){ 3318 | addSlickPseudos(); 3319 | return search.call(this, context, expression, append); 3320 | }; 3321 | 3322 | Slick.find = function(context, expression){ 3323 | addSlickPseudos(); 3324 | return find.call(this, context, expression); 3325 | }; 3326 | 3327 | Slick.match = function(node, selector){ 3328 | addSlickPseudos(); 3329 | return match.call(this, node, selector); 3330 | }; 3331 | 3332 | })(Slick.search, Slick.find, Slick.match); 3333 | 3334 | if (window.$$ == null) Window.implement('$$', function(selector){ 3335 | var elements = new Elements; 3336 | if (arguments.length == 1 && typeof selector == 'string') return Slick.search(this.document, selector, elements); 3337 | var args = Array.flatten(arguments); 3338 | for (var i = 0, l = args.length; i < l; i++){ 3339 | var item = args[i]; 3340 | switch (typeOf(item)){ 3341 | case 'element': elements.push(item); break; 3342 | case 'string': Slick.search(this.document, item, elements); 3343 | } 3344 | } 3345 | return elements; 3346 | }); 3347 | 3348 | // 3349 | 3350 | if (window.$$ == null) Window.implement('$$', function(selector){ 3351 | if (arguments.length == 1){ 3352 | if (typeof selector == 'string') return Slick.search(this.document, selector, new Elements); 3353 | else if (Type.isEnumerable(selector)) return new Elements(selector); 3354 | } 3355 | return new Elements(arguments); 3356 | }); 3357 | 3358 | (function(){ 3359 | 3360 | var collected = {}, storage = {}; 3361 | var formProps = {input: 'checked', option: 'selected', textarea: 'value'}; 3362 | 3363 | var get = function(uid){ 3364 | return (storage[uid] || (storage[uid] = {})); 3365 | }; 3366 | 3367 | var clean = function(item){ 3368 | var uid = item.uid; 3369 | if (item.removeEvents) item.removeEvents(); 3370 | if (item.clearAttributes) item.clearAttributes(); 3371 | if (uid != null){ 3372 | delete collected[uid]; 3373 | delete storage[uid]; 3374 | } 3375 | return item; 3376 | }; 3377 | 3378 | var camels = ['defaultValue', 'accessKey', 'cellPadding', 'cellSpacing', 'colSpan', 'frameBorder', 'maxLength', 'readOnly', 3379 | 'rowSpan', 'tabIndex', 'useMap' 3380 | ]; 3381 | var bools = ['compact', 'nowrap', 'ismap', 'declare', 'noshade', 'checked', 'disabled', 'readOnly', 'multiple', 'selected', 3382 | 'noresize', 'defer', 'defaultChecked' 3383 | ]; 3384 | var attributes = { 3385 | 'html': 'innerHTML', 3386 | 'class': 'className', 3387 | 'for': 'htmlFor', 3388 | 'text': (function(){ 3389 | var temp = document.createElement('div'); 3390 | return (temp.textContent == null) ? 'innerText' : 'textContent'; 3391 | })() 3392 | }; 3393 | var readOnly = ['type']; 3394 | var expandos = ['value', 'defaultValue']; 3395 | var uriAttrs = /^(?:href|src|usemap)$/i; 3396 | 3397 | bools = bools.associate(bools); 3398 | camels = camels.associate(camels.map(String.toLowerCase)); 3399 | readOnly = readOnly.associate(readOnly); 3400 | 3401 | Object.append(attributes, expandos.associate(expandos)); 3402 | 3403 | var inserters = { 3404 | 3405 | before: function(context, element){ 3406 | var parent = element.parentNode; 3407 | if (parent) parent.insertBefore(context, element); 3408 | }, 3409 | 3410 | after: function(context, element){ 3411 | var parent = element.parentNode; 3412 | if (parent) parent.insertBefore(context, element.nextSibling); 3413 | }, 3414 | 3415 | bottom: function(context, element){ 3416 | element.appendChild(context); 3417 | }, 3418 | 3419 | top: function(context, element){ 3420 | element.insertBefore(context, element.firstChild); 3421 | } 3422 | 3423 | }; 3424 | 3425 | inserters.inside = inserters.bottom; 3426 | 3427 | //<1.2compat> 3428 | 3429 | Object.each(inserters, function(inserter, where){ 3430 | 3431 | where = where.capitalize(); 3432 | 3433 | var methods = {}; 3434 | 3435 | methods['inject' + where] = function(el){ 3436 | inserter(this, document.id(el, true)); 3437 | return this; 3438 | }; 3439 | 3440 | methods['grab' + where] = function(el){ 3441 | inserter(document.id(el, true), this); 3442 | return this; 3443 | }; 3444 | 3445 | Element.implement(methods); 3446 | 3447 | }); 3448 | 3449 | // 3450 | 3451 | var injectCombinator = function(expression, combinator){ 3452 | if (!expression) return combinator; 3453 | 3454 | expression = Object.clone(Slick.parse(expression)); 3455 | 3456 | var expressions = expression.expressions; 3457 | for (var i = expressions.length; i--;) 3458 | expressions[i][0].combinator = combinator; 3459 | 3460 | return expression; 3461 | }; 3462 | 3463 | Element.implement({ 3464 | 3465 | set: function(prop, value){ 3466 | var property = Element.Properties[prop]; 3467 | (property && property.set) ? property.set.call(this, value) : this.setProperty(prop, value); 3468 | }.overloadSetter(), 3469 | 3470 | get: function(prop){ 3471 | var property = Element.Properties[prop]; 3472 | return (property && property.get) ? property.get.apply(this) : this.getProperty(prop); 3473 | }.overloadGetter(), 3474 | 3475 | erase: function(prop){ 3476 | var property = Element.Properties[prop]; 3477 | (property && property.erase) ? property.erase.apply(this) : this.removeProperty(prop); 3478 | return this; 3479 | }, 3480 | 3481 | setProperty: function(attribute, value){ 3482 | attribute = camels[attribute] || attribute; 3483 | if (value == null) return this.removeProperty(attribute); 3484 | var key = attributes[attribute]; 3485 | (key) ? this[key] = value : 3486 | (bools[attribute]) ? this[attribute] = !!value : this.setAttribute(attribute, '' + value); 3487 | return this; 3488 | }, 3489 | 3490 | setProperties: function(attributes){ 3491 | for (var attribute in attributes) this.setProperty(attribute, attributes[attribute]); 3492 | return this; 3493 | }, 3494 | 3495 | getProperty: function(attribute){ 3496 | attribute = camels[attribute] || attribute; 3497 | var key = attributes[attribute] || readOnly[attribute]; 3498 | return (key) ? this[key] : 3499 | (bools[attribute]) ? !!this[attribute] : 3500 | (uriAttrs.test(attribute) ? this.getAttribute(attribute, 2) : 3501 | (key = this.getAttributeNode(attribute)) ? key.nodeValue : null) || null; 3502 | }, 3503 | 3504 | getProperties: function(){ 3505 | var args = Array.from(arguments); 3506 | return args.map(this.getProperty, this).associate(args); 3507 | }, 3508 | 3509 | removeProperty: function(attribute){ 3510 | attribute = camels[attribute] || attribute; 3511 | var key = attributes[attribute]; 3512 | (key) ? this[key] = '' : 3513 | (bools[attribute]) ? this[attribute] = false : this.removeAttribute(attribute); 3514 | return this; 3515 | }, 3516 | 3517 | removeProperties: function(){ 3518 | Array.each(arguments, this.removeProperty, this); 3519 | return this; 3520 | }, 3521 | 3522 | hasClass: function(className){ 3523 | return this.className.clean().contains(className, ' '); 3524 | }, 3525 | 3526 | addClass: function(className){ 3527 | if (!this.hasClass(className)) this.className = (this.className + ' ' + className).clean(); 3528 | return this; 3529 | }, 3530 | 3531 | removeClass: function(className){ 3532 | this.className = this.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)'), '$1'); 3533 | return this; 3534 | }, 3535 | 3536 | toggleClass: function(className, force){ 3537 | if (force == null) force = !this.hasClass(className); 3538 | return (force) ? this.addClass(className) : this.removeClass(className); 3539 | }, 3540 | 3541 | adopt: function(){ 3542 | var parent = this, fragment, elements = Array.flatten(arguments), length = elements.length; 3543 | if (length > 1) parent = fragment = document.createDocumentFragment(); 3544 | 3545 | for (var i = 0; i < length; i++){ 3546 | var element = document.id(elements[i], true); 3547 | if (element) parent.appendChild(element); 3548 | } 3549 | 3550 | if (fragment) this.appendChild(fragment); 3551 | 3552 | return this; 3553 | }, 3554 | 3555 | appendText: function(text, where){ 3556 | return this.grab(this.getDocument().newTextNode(text), where); 3557 | }, 3558 | 3559 | grab: function(el, where){ 3560 | inserters[where || 'bottom'](document.id(el, true), this); 3561 | return this; 3562 | }, 3563 | 3564 | inject: function(el, where){ 3565 | inserters[where || 'bottom'](this, document.id(el, true)); 3566 | return this; 3567 | }, 3568 | 3569 | replaces: function(el){ 3570 | el = document.id(el, true); 3571 | el.parentNode.replaceChild(this, el); 3572 | return this; 3573 | }, 3574 | 3575 | wraps: function(el, where){ 3576 | el = document.id(el, true); 3577 | return this.replaces(el).grab(el, where); 3578 | }, 3579 | 3580 | getPrevious: function(expression){ 3581 | return document.id(Slick.find(this, injectCombinator(expression, '!~'))); 3582 | }, 3583 | 3584 | getAllPrevious: function(expression){ 3585 | return Slick.search(this, injectCombinator(expression, '!~'), new Elements); 3586 | }, 3587 | 3588 | getNext: function(expression){ 3589 | return document.id(Slick.find(this, injectCombinator(expression, '~'))); 3590 | }, 3591 | 3592 | getAllNext: function(expression){ 3593 | return Slick.search(this, injectCombinator(expression, '~'), new Elements); 3594 | }, 3595 | 3596 | getFirst: function(expression){ 3597 | return document.id(Slick.search(this, injectCombinator(expression, '>'))[0]); 3598 | }, 3599 | 3600 | getLast: function(expression){ 3601 | return document.id(Slick.search(this, injectCombinator(expression, '>')).getLast()); 3602 | }, 3603 | 3604 | getParent: function(expression){ 3605 | return document.id(Slick.find(this, injectCombinator(expression, '!'))); 3606 | }, 3607 | 3608 | getParents: function(expression){ 3609 | return Slick.search(this, injectCombinator(expression, '!'), new Elements); 3610 | }, 3611 | 3612 | getSiblings: function(expression){ 3613 | return Slick.search(this, injectCombinator(expression, '~~'), new Elements); 3614 | }, 3615 | 3616 | getChildren: function(expression){ 3617 | return Slick.search(this, injectCombinator(expression, '>'), new Elements); 3618 | }, 3619 | 3620 | getWindow: function(){ 3621 | return this.ownerDocument.window; 3622 | }, 3623 | 3624 | getDocument: function(){ 3625 | return this.ownerDocument; 3626 | }, 3627 | 3628 | getElementById: function(id){ 3629 | return document.id(Slick.find(this, '#' + ('' + id).replace(/(\W)/g, '\\$1'))); 3630 | }, 3631 | 3632 | getSelected: function(){ 3633 | this.selectedIndex; // Safari 3.2.1 3634 | return new Elements(Array.from(this.options).filter(function(option){ 3635 | return option.selected; 3636 | })); 3637 | }, 3638 | 3639 | toQueryString: function(){ 3640 | var queryString = []; 3641 | this.getElements('input, select, textarea').each(function(el){ 3642 | var type = el.type; 3643 | if (!el.name || el.disabled || type == 'submit' || type == 'reset' || type == 'file' || type == 'image') return; 3644 | 3645 | var value = (el.get('tag') == 'select') ? el.getSelected().map(function(opt){ 3646 | // IE 3647 | return document.id(opt).get('value'); 3648 | }) : ((type == 'radio' || type == 'checkbox') && !el.checked) ? null : el.get('value'); 3649 | 3650 | Array.from(value).each(function(val){ 3651 | if (typeof val != 'undefined') queryString.push(encodeURIComponent(el.name) + '=' + encodeURIComponent(val)); 3652 | }); 3653 | }); 3654 | return queryString.join('&'); 3655 | }, 3656 | 3657 | destroy: function(){ 3658 | var children = clean(this).getElementsByTagName('*'); 3659 | Array.each(children, clean); 3660 | Element.dispose(this); 3661 | return null; 3662 | }, 3663 | 3664 | empty: function(){ 3665 | Array.from(this.childNodes).each(Element.dispose); 3666 | return this; 3667 | }, 3668 | 3669 | dispose: function(){ 3670 | return (this.parentNode) ? this.parentNode.removeChild(this) : this; 3671 | }, 3672 | 3673 | match: function(expression){ 3674 | return !expression || Slick.match(this, expression); 3675 | } 3676 | 3677 | }); 3678 | 3679 | var cleanClone = function(node, element, keepid){ 3680 | if (!keepid) node.setAttributeNode(document.createAttribute('id')); 3681 | if (node.clearAttributes){ 3682 | node.clearAttributes(); 3683 | node.mergeAttributes(element); 3684 | node.removeAttribute('uid'); 3685 | if (node.options){ 3686 | var no = node.options, eo = element.options; 3687 | for (var i = no.length; i--;) no[i].selected = eo[i].selected; 3688 | } 3689 | } 3690 | 3691 | var prop = formProps[element.tagName.toLowerCase()]; 3692 | if (prop && element[prop]) node[prop] = element[prop]; 3693 | }; 3694 | 3695 | Element.implement('clone', function(contents, keepid){ 3696 | contents = contents !== false; 3697 | var clone = this.cloneNode(contents), i; 3698 | 3699 | if (contents){ 3700 | var ce = clone.getElementsByTagName('*'), te = this.getElementsByTagName('*'); 3701 | for (i = ce.length; i--;) cleanClone(ce[i], te[i], keepid); 3702 | } 3703 | 3704 | cleanClone(clone, this, keepid); 3705 | 3706 | if (Browser.ie){ 3707 | var co = clone.getElementsByTagName('object'), to = this.getElementsByTagName('object'); 3708 | for (i = co.length; i--;) co[i].outerHTML = to[i].outerHTML; 3709 | } 3710 | return document.id(clone); 3711 | }); 3712 | 3713 | var contains = {contains: function(element){ 3714 | return Slick.contains(this, element); 3715 | }}; 3716 | 3717 | if (!document.contains) Document.implement(contains); 3718 | if (!document.createElement('div').contains) Element.implement(contains); 3719 | 3720 | //<1.2compat> 3721 | 3722 | Element.implement('hasChild', function(element){ 3723 | return this !== element && this.contains(element); 3724 | }); 3725 | 3726 | // 3727 | 3728 | [Element, Window, Document].invoke('implement', { 3729 | 3730 | addListener: function(type, fn){ 3731 | if (type == 'unload'){ 3732 | var old = fn, self = this; 3733 | fn = function(){ 3734 | self.removeListener('unload', fn); 3735 | old(); 3736 | }; 3737 | } else { 3738 | collected[$uid(this)] = this; 3739 | } 3740 | if (this.addEventListener) this.addEventListener(type, fn, !!arguments[2]); 3741 | else this.attachEvent('on' + type, fn); 3742 | return this; 3743 | }, 3744 | 3745 | removeListener: function(type, fn){ 3746 | if (this.removeEventListener) this.removeEventListener(type, fn, !!arguments[2]); 3747 | else this.detachEvent('on' + type, fn); 3748 | return this; 3749 | }, 3750 | 3751 | retrieve: function(property, dflt){ 3752 | var storage = get($uid(this)), prop = storage[property]; 3753 | if (dflt != null && prop == null) prop = storage[property] = dflt; 3754 | return prop != null ? prop : null; 3755 | }, 3756 | 3757 | store: function(property, value){ 3758 | var storage = get($uid(this)); 3759 | storage[property] = value; 3760 | return this; 3761 | }, 3762 | 3763 | eliminate: function(property){ 3764 | var storage = get($uid(this)); 3765 | delete storage[property]; 3766 | return this; 3767 | } 3768 | 3769 | }); 3770 | 3771 | // IE purge 3772 | if (window.attachEvent && !window.addEventListener) window.addListener('unload', function(){ 3773 | Object.each(collected, clean); 3774 | if (window.CollectGarbage) CollectGarbage(); 3775 | }); 3776 | 3777 | })(); 3778 | 3779 | Element.Properties = {}; 3780 | 3781 | //<1.2compat> 3782 | 3783 | Element.Properties = new Hash; 3784 | 3785 | // 3786 | 3787 | Element.Properties.style = { 3788 | 3789 | set: function(style){ 3790 | this.style.cssText = style; 3791 | }, 3792 | 3793 | get: function(){ 3794 | return this.style.cssText; 3795 | }, 3796 | 3797 | erase: function(){ 3798 | this.style.cssText = ''; 3799 | } 3800 | 3801 | }; 3802 | 3803 | Element.Properties.tag = { 3804 | 3805 | get: function(){ 3806 | return this.tagName.toLowerCase(); 3807 | } 3808 | 3809 | }; 3810 | 3811 | (function(maxLength){ 3812 | if (maxLength != null) Element.Properties.maxlength = Element.Properties.maxLength = { 3813 | get: function(){ 3814 | var maxlength = this.getAttribute('maxLength'); 3815 | return maxlength == maxLength ? null : maxlength; 3816 | } 3817 | }; 3818 | })(document.createElement('input').getAttribute('maxLength')); 3819 | 3820 | Element.Properties.html = (function(){ 3821 | 3822 | var tableTest = Function.attempt(function(){ 3823 | var table = document.createElement('table'); 3824 | table.innerHTML = ''; 3825 | }); 3826 | 3827 | var wrapper = document.createElement('div'); 3828 | 3829 | var translations = { 3830 | table: [1, '', '
'], 3831 | select: [1, ''], 3832 | tbody: [2, '', '
'], 3833 | tr: [3, '', '
'] 3834 | }; 3835 | translations.thead = translations.tfoot = translations.tbody; 3836 | 3837 | var html = { 3838 | set: function(){ 3839 | var html = Array.flatten(arguments).join(''); 3840 | var wrap = (!tableTest && translations[this.get('tag')]); 3841 | if (wrap){ 3842 | var first = wrapper; 3843 | first.innerHTML = wrap[1] + html + wrap[2]; 3844 | for (var i = wrap[0]; i--;) first = first.firstChild; 3845 | this.empty().adopt(first.childNodes); 3846 | } else { 3847 | this.innerHTML = html; 3848 | } 3849 | } 3850 | }; 3851 | 3852 | html.erase = html.set; 3853 | 3854 | return html; 3855 | })(); 3856 | 3857 | 3858 | /* 3859 | --- 3860 | 3861 | name: Element.Style 3862 | 3863 | description: Contains methods for interacting with the styles of Elements in a fashionable way. 3864 | 3865 | license: MIT-style license. 3866 | 3867 | requires: Element 3868 | 3869 | provides: Element.Style 3870 | 3871 | ... 3872 | */ 3873 | 3874 | (function(){ 3875 | 3876 | var html = document.html; 3877 | 3878 | Element.Properties.styles = {set: function(styles){ 3879 | this.setStyles(styles); 3880 | }}; 3881 | 3882 | var hasOpacity = (html.style.opacity != null); 3883 | var reAlpha = /alpha\(opacity=([\d.]+)\)/i; 3884 | 3885 | var setOpacity = function(element, opacity){ 3886 | if (!element.currentStyle || !element.currentStyle.hasLayout) element.style.zoom = 1; 3887 | if (hasOpacity){ 3888 | element.style.opacity = opacity; 3889 | } else { 3890 | opacity = (opacity == 1) ? '' : 'alpha(opacity=' + opacity * 100 + ')'; 3891 | var filter = element.style.filter || element.getComputedStyle('filter') || ''; 3892 | element.style.filter = reAlpha.test(filter) ? filter.replace(reAlpha, opacity) : filter + opacity; 3893 | } 3894 | }; 3895 | 3896 | Element.Properties.opacity = { 3897 | 3898 | set: function(opacity){ 3899 | var visibility = this.style.visibility; 3900 | if (opacity == 0 && visibility != 'hidden') this.style.visibility = 'hidden'; 3901 | else if (opacity != 0 && visibility != 'visible') this.style.visibility = 'visible'; 3902 | 3903 | setOpacity(this, opacity); 3904 | }, 3905 | 3906 | get: (hasOpacity) ? function(){ 3907 | var opacity = this.style.opacity || this.getComputedStyle('opacity'); 3908 | return (opacity == '') ? 1 : opacity; 3909 | } : function(){ 3910 | var opacity, filter = (this.style.filter || this.getComputedStyle('filter')); 3911 | if (filter) opacity = filter.match(reAlpha); 3912 | return (opacity == null || filter == null) ? 1 : (opacity[1] / 100); 3913 | } 3914 | 3915 | }; 3916 | 3917 | var floatName = (html.style.cssFloat == null) ? 'styleFloat' : 'cssFloat'; 3918 | 3919 | Element.implement({ 3920 | 3921 | getComputedStyle: function(property){ 3922 | if (this.currentStyle) return this.currentStyle[property.camelCase()]; 3923 | var defaultView = Element.getDocument(this).defaultView, 3924 | computed = defaultView ? defaultView.getComputedStyle(this, null) : null; 3925 | return (computed) ? computed.getPropertyValue((property == floatName) ? 'float' : property.hyphenate()) : null; 3926 | }, 3927 | 3928 | setOpacity: function(value){ 3929 | setOpacity(this, value); 3930 | return this; 3931 | }, 3932 | 3933 | getOpacity: function(){ 3934 | return this.get('opacity'); 3935 | }, 3936 | 3937 | setStyle: function(property, value){ 3938 | switch (property){ 3939 | case 'opacity': return this.set('opacity', parseFloat(value)); 3940 | case 'float': property = floatName; 3941 | } 3942 | property = property.camelCase(); 3943 | if (typeOf(value) != 'string'){ 3944 | var map = (Element.Styles[property] || '@').split(' '); 3945 | value = Array.from(value).map(function(val, i){ 3946 | if (!map[i]) return ''; 3947 | return (typeOf(val) == 'number') ? map[i].replace('@', Math.round(val)) : val; 3948 | }).join(' '); 3949 | } else if (value == String(Number(value))){ 3950 | value = Math.round(value); 3951 | } 3952 | this.style[property] = value; 3953 | return this; 3954 | }, 3955 | 3956 | getStyle: function(property){ 3957 | switch (property){ 3958 | case 'opacity': return this.get('opacity'); 3959 | case 'float': property = floatName; 3960 | } 3961 | property = property.camelCase(); 3962 | var result = this.style[property]; 3963 | if (!result || property == 'zIndex'){ 3964 | result = []; 3965 | for (var style in Element.ShortStyles){ 3966 | if (property != style) continue; 3967 | for (var s in Element.ShortStyles[style]) result.push(this.getStyle(s)); 3968 | return result.join(' '); 3969 | } 3970 | result = this.getComputedStyle(property); 3971 | } 3972 | if (result){ 3973 | result = String(result); 3974 | var color = result.match(/rgba?\([\d\s,]+\)/); 3975 | if (color) result = result.replace(color[0], color[0].rgbToHex()); 3976 | } 3977 | if (Browser.opera || (Browser.ie && isNaN(parseFloat(result)))){ 3978 | if ((/^(height|width)$/).test(property)){ 3979 | var values = (property == 'width') ? ['left', 'right'] : ['top', 'bottom'], size = 0; 3980 | values.each(function(value){ 3981 | size += this.getStyle('border-' + value + '-width').toInt() + this.getStyle('padding-' + value).toInt(); 3982 | }, this); 3983 | return this['offset' + property.capitalize()] - size + 'px'; 3984 | } 3985 | if (Browser.opera && String(result).indexOf('px') != -1) return result; 3986 | if ((/^border(.+)Width|margin|padding/).test(property)) return '0px'; 3987 | } 3988 | return result; 3989 | }, 3990 | 3991 | setStyles: function(styles){ 3992 | for (var style in styles) this.setStyle(style, styles[style]); 3993 | return this; 3994 | }, 3995 | 3996 | getStyles: function(){ 3997 | var result = {}; 3998 | Array.flatten(arguments).each(function(key){ 3999 | result[key] = this.getStyle(key); 4000 | }, this); 4001 | return result; 4002 | } 4003 | 4004 | }); 4005 | 4006 | Element.Styles = { 4007 | left: '@px', top: '@px', bottom: '@px', right: '@px', 4008 | width: '@px', height: '@px', maxWidth: '@px', maxHeight: '@px', minWidth: '@px', minHeight: '@px', 4009 | backgroundColor: 'rgb(@, @, @)', backgroundPosition: '@px @px', color: 'rgb(@, @, @)', 4010 | fontSize: '@px', letterSpacing: '@px', lineHeight: '@px', clip: 'rect(@px @px @px @px)', 4011 | margin: '@px @px @px @px', padding: '@px @px @px @px', border: '@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)', 4012 | borderWidth: '@px @px @px @px', borderStyle: '@ @ @ @', borderColor: 'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)', 4013 | zIndex: '@', 'zoom': '@', fontWeight: '@', textIndent: '@px', opacity: '@' 4014 | }; 4015 | 4016 | //<1.2compat> 4017 | 4018 | Element.Styles = new Hash(Element.Styles); 4019 | 4020 | // 4021 | 4022 | Element.ShortStyles = {margin: {}, padding: {}, border: {}, borderWidth: {}, borderStyle: {}, borderColor: {}}; 4023 | 4024 | ['Top', 'Right', 'Bottom', 'Left'].each(function(direction){ 4025 | var Short = Element.ShortStyles; 4026 | var All = Element.Styles; 4027 | ['margin', 'padding'].each(function(style){ 4028 | var sd = style + direction; 4029 | Short[style][sd] = All[sd] = '@px'; 4030 | }); 4031 | var bd = 'border' + direction; 4032 | Short.border[bd] = All[bd] = '@px @ rgb(@, @, @)'; 4033 | var bdw = bd + 'Width', bds = bd + 'Style', bdc = bd + 'Color'; 4034 | Short[bd] = {}; 4035 | Short.borderWidth[bdw] = Short[bd][bdw] = All[bdw] = '@px'; 4036 | Short.borderStyle[bds] = Short[bd][bds] = All[bds] = '@'; 4037 | Short.borderColor[bdc] = Short[bd][bdc] = All[bdc] = 'rgb(@, @, @)'; 4038 | }); 4039 | 4040 | }).call(this); 4041 | 4042 | 4043 | /* 4044 | --- 4045 | 4046 | name: Element.Event 4047 | 4048 | description: Contains Element methods for dealing with events. This file also includes mouseenter and mouseleave custom Element Events. 4049 | 4050 | license: MIT-style license. 4051 | 4052 | requires: [Element, Event] 4053 | 4054 | provides: Element.Event 4055 | 4056 | ... 4057 | */ 4058 | 4059 | (function(){ 4060 | 4061 | Element.Properties.events = {set: function(events){ 4062 | this.addEvents(events); 4063 | }}; 4064 | 4065 | [Element, Window, Document].invoke('implement', { 4066 | 4067 | addEvent: function(type, fn){ 4068 | var events = this.retrieve('events', {}); 4069 | if (!events[type]) events[type] = {keys: [], values: []}; 4070 | if (events[type].keys.contains(fn)) return this; 4071 | events[type].keys.push(fn); 4072 | var realType = type, 4073 | custom = Element.Events[type], 4074 | condition = fn, 4075 | self = this; 4076 | if (custom){ 4077 | if (custom.onAdd) custom.onAdd.call(this, fn); 4078 | if (custom.condition){ 4079 | condition = function(event){ 4080 | if (custom.condition.call(this, event)) return fn.call(this, event); 4081 | return true; 4082 | }; 4083 | } 4084 | realType = custom.base || realType; 4085 | } 4086 | var defn = function(){ 4087 | return fn.call(self); 4088 | }; 4089 | var nativeEvent = Element.NativeEvents[realType]; 4090 | if (nativeEvent){ 4091 | if (nativeEvent == 2){ 4092 | defn = function(event){ 4093 | event = new Event(event, self.getWindow()); 4094 | if (condition.call(self, event) === false) event.stop(); 4095 | }; 4096 | } 4097 | this.addListener(realType, defn, arguments[2]); 4098 | } 4099 | events[type].values.push(defn); 4100 | return this; 4101 | }, 4102 | 4103 | removeEvent: function(type, fn){ 4104 | var events = this.retrieve('events'); 4105 | if (!events || !events[type]) return this; 4106 | var list = events[type]; 4107 | var index = list.keys.indexOf(fn); 4108 | if (index == -1) return this; 4109 | var value = list.values[index]; 4110 | delete list.keys[index]; 4111 | delete list.values[index]; 4112 | var custom = Element.Events[type]; 4113 | if (custom){ 4114 | if (custom.onRemove) custom.onRemove.call(this, fn); 4115 | type = custom.base || type; 4116 | } 4117 | return (Element.NativeEvents[type]) ? this.removeListener(type, value, arguments[2]) : this; 4118 | }, 4119 | 4120 | addEvents: function(events){ 4121 | for (var event in events) this.addEvent(event, events[event]); 4122 | return this; 4123 | }, 4124 | 4125 | removeEvents: function(events){ 4126 | var type; 4127 | if (typeOf(events) == 'object'){ 4128 | for (type in events) this.removeEvent(type, events[type]); 4129 | return this; 4130 | } 4131 | var attached = this.retrieve('events'); 4132 | if (!attached) return this; 4133 | if (!events){ 4134 | for (type in attached) this.removeEvents(type); 4135 | this.eliminate('events'); 4136 | } else if (attached[events]){ 4137 | attached[events].keys.each(function(fn){ 4138 | this.removeEvent(events, fn); 4139 | }, this); 4140 | delete attached[events]; 4141 | } 4142 | return this; 4143 | }, 4144 | 4145 | fireEvent: function(type, args, delay){ 4146 | var events = this.retrieve('events'); 4147 | if (!events || !events[type]) return this; 4148 | args = Array.from(args); 4149 | 4150 | events[type].keys.each(function(fn){ 4151 | if (delay) fn.delay(delay, this, args); 4152 | else fn.apply(this, args); 4153 | }, this); 4154 | return this; 4155 | }, 4156 | 4157 | cloneEvents: function(from, type){ 4158 | from = document.id(from); 4159 | var events = from.retrieve('events'); 4160 | if (!events) return this; 4161 | if (!type){ 4162 | for (var eventType in events) this.cloneEvents(from, eventType); 4163 | } else if (events[type]){ 4164 | events[type].keys.each(function(fn){ 4165 | this.addEvent(type, fn); 4166 | }, this); 4167 | } 4168 | return this; 4169 | } 4170 | 4171 | }); 4172 | 4173 | Element.NativeEvents = { 4174 | click: 2, dblclick: 2, mouseup: 2, mousedown: 2, contextmenu: 2, //mouse buttons 4175 | mousewheel: 2, DOMMouseScroll: 2, //mouse wheel 4176 | mouseover: 2, mouseout: 2, mousemove: 2, selectstart: 2, selectend: 2, //mouse movement 4177 | keydown: 2, keypress: 2, keyup: 2, //keyboard 4178 | orientationchange: 2, // mobile 4179 | touchstart: 2, touchmove: 2, touchend: 2, touchcancel: 2, // touch 4180 | gesturestart: 2, gesturechange: 2, gestureend: 2, // gesture 4181 | focus: 2, blur: 2, change: 2, reset: 2, select: 2, submit: 2, //form elements 4182 | load: 2, unload: 1, beforeunload: 2, resize: 1, move: 1, DOMContentLoaded: 1, readystatechange: 1, //window 4183 | error: 1, abort: 1, scroll: 1 //misc 4184 | }; 4185 | 4186 | var check = function(event){ 4187 | var related = event.relatedTarget; 4188 | if (related == null) return true; 4189 | if (!related) return false; 4190 | return (related != this && related.prefix != 'xul' && typeOf(this) != 'document' && !this.contains(related)); 4191 | }; 4192 | 4193 | Element.Events = { 4194 | 4195 | mouseenter: { 4196 | base: 'mouseover', 4197 | condition: check 4198 | }, 4199 | 4200 | mouseleave: { 4201 | base: 'mouseout', 4202 | condition: check 4203 | }, 4204 | 4205 | mousewheel: { 4206 | base: (Browser.firefox) ? 'DOMMouseScroll' : 'mousewheel' 4207 | } 4208 | 4209 | }; 4210 | 4211 | //<1.2compat> 4212 | 4213 | Element.Events = new Hash(Element.Events); 4214 | 4215 | // 4216 | 4217 | }).call(this); 4218 | 4219 | 4220 | /* 4221 | --- 4222 | 4223 | name: Element.Dimensions 4224 | 4225 | description: Contains methods to work with size, scroll, or positioning of Elements and the window object. 4226 | 4227 | license: MIT-style license. 4228 | 4229 | credits: 4230 | - Element positioning based on the [qooxdoo](http://qooxdoo.org/) code and smart browser fixes, [LGPL License](http://www.gnu.org/licenses/lgpl.html). 4231 | - Viewport dimensions based on [YUI](http://developer.yahoo.com/yui/) code, [BSD License](http://developer.yahoo.com/yui/license.html). 4232 | 4233 | requires: [Element, Element.Style] 4234 | 4235 | provides: [Element.Dimensions] 4236 | 4237 | ... 4238 | */ 4239 | 4240 | (function(){ 4241 | 4242 | var element = document.createElement('div'), 4243 | child = document.createElement('div'); 4244 | element.style.height = '0'; 4245 | element.appendChild(child); 4246 | var brokenOffsetParent = (child.offsetParent === element); 4247 | element = child = null; 4248 | 4249 | var isOffset = function(el){ 4250 | return styleString(el, 'position') != 'static' || isBody(el); 4251 | }; 4252 | 4253 | var isOffsetStatic = function(el){ 4254 | return isOffset(el) || (/^(?:table|td|th)$/i).test(el.tagName); 4255 | }; 4256 | 4257 | Element.implement({ 4258 | 4259 | scrollTo: function(x, y){ 4260 | if (isBody(this)){ 4261 | this.getWindow().scrollTo(x, y); 4262 | } else { 4263 | this.scrollLeft = x; 4264 | this.scrollTop = y; 4265 | } 4266 | return this; 4267 | }, 4268 | 4269 | getSize: function(){ 4270 | if (isBody(this)) return this.getWindow().getSize(); 4271 | return {x: this.offsetWidth, y: this.offsetHeight}; 4272 | }, 4273 | 4274 | getScrollSize: function(){ 4275 | if (isBody(this)) return this.getWindow().getScrollSize(); 4276 | return {x: this.scrollWidth, y: this.scrollHeight}; 4277 | }, 4278 | 4279 | getScroll: function(){ 4280 | if (isBody(this)) return this.getWindow().getScroll(); 4281 | return {x: this.scrollLeft, y: this.scrollTop}; 4282 | }, 4283 | 4284 | getScrolls: function(){ 4285 | var element = this.parentNode, position = {x: 0, y: 0}; 4286 | while (element && !isBody(element)){ 4287 | position.x += element.scrollLeft; 4288 | position.y += element.scrollTop; 4289 | element = element.parentNode; 4290 | } 4291 | return position; 4292 | }, 4293 | 4294 | getOffsetParent: brokenOffsetParent ? function(){ 4295 | var element = this; 4296 | if (isBody(element) || styleString(element, 'position') == 'fixed') return null; 4297 | 4298 | var isOffsetCheck = (styleString(element, 'position') == 'static') ? isOffsetStatic : isOffset; 4299 | while ((element = element.parentNode)){ 4300 | if (isOffsetCheck(element) && element.tagName) return element; 4301 | } 4302 | return null; 4303 | } : function(){ 4304 | var element = this; 4305 | if (isBody(element) || styleString(element, 'position') == 'fixed') return null; 4306 | 4307 | try { 4308 | return (element.offsetParent && element.offsetParent.tagName) ? element.offsetParent : null; 4309 | } catch(e) {} 4310 | return null; 4311 | }, 4312 | 4313 | getOffsets: function(){ 4314 | if (this.getBoundingClientRect && !Browser.Platform.ios){ 4315 | var bound = this.getBoundingClientRect(), 4316 | html = document.id(this.getDocument().documentElement), 4317 | htmlScroll = html.getScroll(), 4318 | elemScrolls = this.getScrolls(), 4319 | isFixed = (styleString(this, 'position') == 'fixed'); 4320 | 4321 | return { 4322 | x: bound.left.toInt() + elemScrolls.x + ((isFixed) ? 0 : htmlScroll.x) - html.clientLeft, 4323 | y: bound.top.toInt() + elemScrolls.y + ((isFixed) ? 0 : htmlScroll.y) - html.clientTop 4324 | }; 4325 | } 4326 | 4327 | var element = this, position = {x: 0, y: 0}; 4328 | if (isBody(this)) return position; 4329 | 4330 | while (element && !isBody(element)){ 4331 | position.x += element.offsetLeft; 4332 | position.y += element.offsetTop; 4333 | 4334 | if (Browser.firefox){ 4335 | if (!borderBox(element)){ 4336 | position.x += leftBorder(element); 4337 | position.y += topBorder(element); 4338 | } 4339 | var parent = element.parentNode; 4340 | if (parent && styleString(parent, 'overflow') != 'visible'){ 4341 | position.x += leftBorder(parent); 4342 | position.y += topBorder(parent); 4343 | } 4344 | } else if (element != this && Browser.safari){ 4345 | position.x += leftBorder(element); 4346 | position.y += topBorder(element); 4347 | } 4348 | 4349 | element = element.offsetParent; 4350 | } 4351 | if (Browser.firefox && !borderBox(this)){ 4352 | position.x -= leftBorder(this); 4353 | position.y -= topBorder(this); 4354 | } 4355 | return position; 4356 | }, 4357 | 4358 | getPosition: function(relative){ 4359 | if (isBody(this)) return {x: 0, y: 0}; 4360 | var offset = this.getOffsets(), 4361 | scroll = this.getScrolls(); 4362 | var position = { 4363 | x: offset.x - scroll.x, 4364 | y: offset.y - scroll.y 4365 | }; 4366 | 4367 | if (relative && (relative = document.id(relative))){ 4368 | var relativePosition = relative.getPosition(); 4369 | return {x: position.x - relativePosition.x - leftBorder(relative), y: position.y - relativePosition.y - topBorder(relative)}; 4370 | } 4371 | return position; 4372 | }, 4373 | 4374 | getCoordinates: function(element){ 4375 | if (isBody(this)) return this.getWindow().getCoordinates(); 4376 | var position = this.getPosition(element), 4377 | size = this.getSize(); 4378 | var obj = { 4379 | left: position.x, 4380 | top: position.y, 4381 | width: size.x, 4382 | height: size.y 4383 | }; 4384 | obj.right = obj.left + obj.width; 4385 | obj.bottom = obj.top + obj.height; 4386 | return obj; 4387 | }, 4388 | 4389 | computePosition: function(obj){ 4390 | return { 4391 | left: obj.x - styleNumber(this, 'margin-left'), 4392 | top: obj.y - styleNumber(this, 'margin-top') 4393 | }; 4394 | }, 4395 | 4396 | setPosition: function(obj){ 4397 | return this.setStyles(this.computePosition(obj)); 4398 | } 4399 | 4400 | }); 4401 | 4402 | 4403 | [Document, Window].invoke('implement', { 4404 | 4405 | getSize: function(){ 4406 | var doc = getCompatElement(this); 4407 | return {x: doc.clientWidth, y: doc.clientHeight}; 4408 | }, 4409 | 4410 | getScroll: function(){ 4411 | var win = this.getWindow(), doc = getCompatElement(this); 4412 | return {x: win.pageXOffset || doc.scrollLeft, y: win.pageYOffset || doc.scrollTop}; 4413 | }, 4414 | 4415 | getScrollSize: function(){ 4416 | var doc = getCompatElement(this), 4417 | min = this.getSize(), 4418 | body = this.getDocument().body; 4419 | 4420 | return {x: Math.max(doc.scrollWidth, body.scrollWidth, min.x), y: Math.max(doc.scrollHeight, body.scrollHeight, min.y)}; 4421 | }, 4422 | 4423 | getPosition: function(){ 4424 | return {x: 0, y: 0}; 4425 | }, 4426 | 4427 | getCoordinates: function(){ 4428 | var size = this.getSize(); 4429 | return {top: 0, left: 0, bottom: size.y, right: size.x, height: size.y, width: size.x}; 4430 | } 4431 | 4432 | }); 4433 | 4434 | // private methods 4435 | 4436 | var styleString = Element.getComputedStyle; 4437 | 4438 | function styleNumber(element, style){ 4439 | return styleString(element, style).toInt() || 0; 4440 | } 4441 | 4442 | function borderBox(element){ 4443 | return styleString(element, '-moz-box-sizing') == 'border-box'; 4444 | } 4445 | 4446 | function topBorder(element){ 4447 | return styleNumber(element, 'border-top-width'); 4448 | } 4449 | 4450 | function leftBorder(element){ 4451 | return styleNumber(element, 'border-left-width'); 4452 | } 4453 | 4454 | function isBody(element){ 4455 | return (/^(?:body|html)$/i).test(element.tagName); 4456 | } 4457 | 4458 | function getCompatElement(element){ 4459 | var doc = element.getDocument(); 4460 | return (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body; 4461 | } 4462 | 4463 | }).call(this); 4464 | 4465 | //aliases 4466 | Element.alias({position: 'setPosition'}); //compatability 4467 | 4468 | [Window, Document, Element].invoke('implement', { 4469 | 4470 | getHeight: function(){ 4471 | return this.getSize().y; 4472 | }, 4473 | 4474 | getWidth: function(){ 4475 | return this.getSize().x; 4476 | }, 4477 | 4478 | getScrollTop: function(){ 4479 | return this.getScroll().y; 4480 | }, 4481 | 4482 | getScrollLeft: function(){ 4483 | return this.getScroll().x; 4484 | }, 4485 | 4486 | getScrollHeight: function(){ 4487 | return this.getScrollSize().y; 4488 | }, 4489 | 4490 | getScrollWidth: function(){ 4491 | return this.getScrollSize().x; 4492 | }, 4493 | 4494 | getTop: function(){ 4495 | return this.getPosition().y; 4496 | }, 4497 | 4498 | getLeft: function(){ 4499 | return this.getPosition().x; 4500 | } 4501 | 4502 | }); 4503 | 4504 | 4505 | /* 4506 | --- 4507 | 4508 | name: Fx 4509 | 4510 | description: Contains the basic animation logic to be extended by all other Fx Classes. 4511 | 4512 | license: MIT-style license. 4513 | 4514 | requires: [Chain, Events, Options] 4515 | 4516 | provides: Fx 4517 | 4518 | ... 4519 | */ 4520 | 4521 | (function(){ 4522 | 4523 | var Fx = this.Fx = new Class({ 4524 | 4525 | Implements: [Chain, Events, Options], 4526 | 4527 | options: { 4528 | /* 4529 | onStart: nil, 4530 | onCancel: nil, 4531 | onComplete: nil, 4532 | */ 4533 | fps: 60, 4534 | unit: false, 4535 | duration: 500, 4536 | frames: null, 4537 | frameSkip: true, 4538 | link: 'ignore' 4539 | }, 4540 | 4541 | initialize: function(options){ 4542 | this.subject = this.subject || this; 4543 | this.setOptions(options); 4544 | }, 4545 | 4546 | getTransition: function(){ 4547 | return function(p){ 4548 | return -(Math.cos(Math.PI * p) - 1) / 2; 4549 | }; 4550 | }, 4551 | 4552 | step: function(now){ 4553 | if (this.options.frameSkip){ 4554 | var diff = (this.time != null) ? (now - this.time) : 0, frames = diff / this.frameInterval; 4555 | this.time = now; 4556 | this.frame += frames; 4557 | } else { 4558 | this.frame++; 4559 | } 4560 | 4561 | if (this.frame < this.frames){ 4562 | var delta = this.transition(this.frame / this.frames); 4563 | this.set(this.compute(this.from, this.to, delta)); 4564 | } else { 4565 | this.frame = this.frames; 4566 | this.set(this.compute(this.from, this.to, 1)); 4567 | this.stop(); 4568 | } 4569 | }, 4570 | 4571 | set: function(now){ 4572 | return now; 4573 | }, 4574 | 4575 | compute: function(from, to, delta){ 4576 | return Fx.compute(from, to, delta); 4577 | }, 4578 | 4579 | check: function(){ 4580 | if (!this.isRunning()) return true; 4581 | switch (this.options.link){ 4582 | case 'cancel': this.cancel(); return true; 4583 | case 'chain': this.chain(this.caller.pass(arguments, this)); return false; 4584 | } 4585 | return false; 4586 | }, 4587 | 4588 | start: function(from, to){ 4589 | if (!this.check(from, to)) return this; 4590 | this.from = from; 4591 | this.to = to; 4592 | this.frame = (this.options.frameSkip) ? 0 : -1; 4593 | this.time = null; 4594 | this.transition = this.getTransition(); 4595 | var frames = this.options.frames, fps = this.options.fps, duration = this.options.duration; 4596 | this.duration = Fx.Durations[duration] || duration.toInt(); 4597 | this.frameInterval = 1000 / fps; 4598 | this.frames = frames || Math.round(this.duration / this.frameInterval); 4599 | this.fireEvent('start', this.subject); 4600 | pushInstance.call(this, fps); 4601 | return this; 4602 | }, 4603 | 4604 | stop: function(){ 4605 | if (this.isRunning()){ 4606 | this.time = null; 4607 | pullInstance.call(this, this.options.fps); 4608 | if (this.frames == this.frame){ 4609 | this.fireEvent('complete', this.subject); 4610 | if (!this.callChain()) this.fireEvent('chainComplete', this.subject); 4611 | } else { 4612 | this.fireEvent('stop', this.subject); 4613 | } 4614 | } 4615 | return this; 4616 | }, 4617 | 4618 | cancel: function(){ 4619 | if (this.isRunning()){ 4620 | this.time = null; 4621 | pullInstance.call(this, this.options.fps); 4622 | this.frame = this.frames; 4623 | this.fireEvent('cancel', this.subject).clearChain(); 4624 | } 4625 | return this; 4626 | }, 4627 | 4628 | pause: function(){ 4629 | if (this.isRunning()){ 4630 | this.time = null; 4631 | pullInstance.call(this, this.options.fps); 4632 | } 4633 | return this; 4634 | }, 4635 | 4636 | resume: function(){ 4637 | if ((this.frame < this.frames) && !this.isRunning()) pushInstance.call(this, this.options.fps); 4638 | return this; 4639 | }, 4640 | 4641 | isRunning: function(){ 4642 | var list = instances[this.options.fps]; 4643 | return list && list.contains(this); 4644 | } 4645 | 4646 | }); 4647 | 4648 | Fx.compute = function(from, to, delta){ 4649 | return (to - from) * delta + from; 4650 | }; 4651 | 4652 | Fx.Durations = {'short': 250, 'normal': 500, 'long': 1000}; 4653 | 4654 | // global timers 4655 | 4656 | var instances = {}, timers = {}; 4657 | 4658 | var loop = function(){ 4659 | var now = Date.now(); 4660 | for (var i = this.length; i--;){ 4661 | var instance = this[i]; 4662 | if (instance) instance.step(now); 4663 | } 4664 | }; 4665 | 4666 | var pushInstance = function(fps){ 4667 | var list = instances[fps] || (instances[fps] = []); 4668 | list.push(this); 4669 | if (!timers[fps]) timers[fps] = loop.periodical(Math.round(1000 / fps), list); 4670 | }; 4671 | 4672 | var pullInstance = function(fps){ 4673 | var list = instances[fps]; 4674 | if (list){ 4675 | list.erase(this); 4676 | if (!list.length && timers[fps]){ 4677 | delete instances[fps]; 4678 | timers[fps] = clearInterval(timers[fps]); 4679 | } 4680 | } 4681 | }; 4682 | 4683 | }).call(this); 4684 | 4685 | 4686 | /* 4687 | --- 4688 | 4689 | name: Fx.CSS 4690 | 4691 | description: Contains the CSS animation logic. Used by Fx.Tween, Fx.Morph, Fx.Elements. 4692 | 4693 | license: MIT-style license. 4694 | 4695 | requires: [Fx, Element.Style] 4696 | 4697 | provides: Fx.CSS 4698 | 4699 | ... 4700 | */ 4701 | 4702 | Fx.CSS = new Class({ 4703 | 4704 | Extends: Fx, 4705 | 4706 | //prepares the base from/to object 4707 | 4708 | prepare: function(element, property, values){ 4709 | values = Array.from(values); 4710 | if (values[1] == null){ 4711 | values[1] = values[0]; 4712 | values[0] = element.getStyle(property); 4713 | } 4714 | var parsed = values.map(this.parse); 4715 | return {from: parsed[0], to: parsed[1]}; 4716 | }, 4717 | 4718 | //parses a value into an array 4719 | 4720 | parse: function(value){ 4721 | value = Function.from(value)(); 4722 | value = (typeof value == 'string') ? value.split(' ') : Array.from(value); 4723 | return value.map(function(val){ 4724 | val = String(val); 4725 | var found = false; 4726 | Object.each(Fx.CSS.Parsers, function(parser, key){ 4727 | if (found) return; 4728 | var parsed = parser.parse(val); 4729 | if (parsed || parsed === 0) found = {value: parsed, parser: parser}; 4730 | }); 4731 | found = found || {value: val, parser: Fx.CSS.Parsers.String}; 4732 | return found; 4733 | }); 4734 | }, 4735 | 4736 | //computes by a from and to prepared objects, using their parsers. 4737 | 4738 | compute: function(from, to, delta){ 4739 | var computed = []; 4740 | (Math.min(from.length, to.length)).times(function(i){ 4741 | computed.push({value: from[i].parser.compute(from[i].value, to[i].value, delta), parser: from[i].parser}); 4742 | }); 4743 | computed.$family = Function.from('fx:css:value'); 4744 | return computed; 4745 | }, 4746 | 4747 | //serves the value as settable 4748 | 4749 | serve: function(value, unit){ 4750 | if (typeOf(value) != 'fx:css:value') value = this.parse(value); 4751 | var returned = []; 4752 | value.each(function(bit){ 4753 | returned = returned.concat(bit.parser.serve(bit.value, unit)); 4754 | }); 4755 | return returned; 4756 | }, 4757 | 4758 | //renders the change to an element 4759 | 4760 | render: function(element, property, value, unit){ 4761 | document.id(element).setStyle(property, this.serve(value, unit)); 4762 | }, 4763 | 4764 | //searches inside the page css to find the values for a selector 4765 | 4766 | search: function(selector){ 4767 | if (Fx.CSS.Cache[selector]) return Fx.CSS.Cache[selector]; 4768 | var to = {}, selectorTest = new RegExp('^' + selector.escapeRegExp() + '$'); 4769 | Array.each(document.styleSheets, function(sheet, j){ 4770 | var href = sheet.href; 4771 | if (href && href.contains('://') && !href.contains(document.domain)) return; 4772 | var rules = sheet.rules || sheet.cssRules; 4773 | Array.each(rules, function(rule, i){ 4774 | if (!rule.style) return; 4775 | var selectorText = (rule.selectorText) ? rule.selectorText.replace(/^\w+/, function(m){ 4776 | return m.toLowerCase(); 4777 | }) : null; 4778 | if (!selectorText || !selectorTest.test(selectorText)) return; 4779 | Object.each(Element.Styles, function(value, style){ 4780 | if (!rule.style[style] || Element.ShortStyles[style]) return; 4781 | value = String(rule.style[style]); 4782 | to[style] = ((/^rgb/).test(value)) ? value.rgbToHex() : value; 4783 | }); 4784 | }); 4785 | }); 4786 | return Fx.CSS.Cache[selector] = to; 4787 | } 4788 | 4789 | }); 4790 | 4791 | Fx.CSS.Cache = {}; 4792 | 4793 | Fx.CSS.Parsers = { 4794 | 4795 | Color: { 4796 | parse: function(value){ 4797 | if (value.match(/^#[0-9a-f]{3,6}$/i)) return value.hexToRgb(true); 4798 | return ((value = value.match(/(\d+),\s*(\d+),\s*(\d+)/))) ? [value[1], value[2], value[3]] : false; 4799 | }, 4800 | compute: function(from, to, delta){ 4801 | return from.map(function(value, i){ 4802 | return Math.round(Fx.compute(from[i], to[i], delta)); 4803 | }); 4804 | }, 4805 | serve: function(value){ 4806 | return value.map(Number); 4807 | } 4808 | }, 4809 | 4810 | Number: { 4811 | parse: parseFloat, 4812 | compute: Fx.compute, 4813 | serve: function(value, unit){ 4814 | return (unit) ? value + unit : value; 4815 | } 4816 | }, 4817 | 4818 | String: { 4819 | parse: Function.from(false), 4820 | compute: function(zero, one){ 4821 | return one; 4822 | }, 4823 | serve: function(zero){ 4824 | return zero; 4825 | } 4826 | } 4827 | 4828 | }; 4829 | 4830 | //<1.2compat> 4831 | 4832 | Fx.CSS.Parsers = new Hash(Fx.CSS.Parsers); 4833 | 4834 | // 4835 | 4836 | 4837 | /* 4838 | --- 4839 | 4840 | name: Fx.Tween 4841 | 4842 | description: Formerly Fx.Style, effect to transition any CSS property for an element. 4843 | 4844 | license: MIT-style license. 4845 | 4846 | requires: Fx.CSS 4847 | 4848 | provides: [Fx.Tween, Element.fade, Element.highlight] 4849 | 4850 | ... 4851 | */ 4852 | 4853 | Fx.Tween = new Class({ 4854 | 4855 | Extends: Fx.CSS, 4856 | 4857 | initialize: function(element, options){ 4858 | this.element = this.subject = document.id(element); 4859 | this.parent(options); 4860 | }, 4861 | 4862 | set: function(property, now){ 4863 | if (arguments.length == 1){ 4864 | now = property; 4865 | property = this.property || this.options.property; 4866 | } 4867 | this.render(this.element, property, now, this.options.unit); 4868 | return this; 4869 | }, 4870 | 4871 | start: function(property, from, to){ 4872 | if (!this.check(property, from, to)) return this; 4873 | var args = Array.flatten(arguments); 4874 | this.property = this.options.property || args.shift(); 4875 | var parsed = this.prepare(this.element, this.property, args); 4876 | return this.parent(parsed.from, parsed.to); 4877 | } 4878 | 4879 | }); 4880 | 4881 | Element.Properties.tween = { 4882 | 4883 | set: function(options){ 4884 | this.get('tween').cancel().setOptions(options); 4885 | return this; 4886 | }, 4887 | 4888 | get: function(){ 4889 | var tween = this.retrieve('tween'); 4890 | if (!tween){ 4891 | tween = new Fx.Tween(this, {link: 'cancel'}); 4892 | this.store('tween', tween); 4893 | } 4894 | return tween; 4895 | } 4896 | 4897 | }; 4898 | 4899 | Element.implement({ 4900 | 4901 | tween: function(property, from, to){ 4902 | this.get('tween').start(arguments); 4903 | return this; 4904 | }, 4905 | 4906 | fade: function(how){ 4907 | var fade = this.get('tween'), o = 'opacity', toggle; 4908 | how = [how, 'toggle'].pick(); 4909 | switch (how){ 4910 | case 'in': fade.start(o, 1); break; 4911 | case 'out': fade.start(o, 0); break; 4912 | case 'show': fade.set(o, 1); break; 4913 | case 'hide': fade.set(o, 0); break; 4914 | case 'toggle': 4915 | var flag = this.retrieve('fade:flag', this.get('opacity') == 1); 4916 | fade.start(o, (flag) ? 0 : 1); 4917 | this.store('fade:flag', !flag); 4918 | toggle = true; 4919 | break; 4920 | default: fade.start(o, arguments); 4921 | } 4922 | if (!toggle) this.eliminate('fade:flag'); 4923 | return this; 4924 | }, 4925 | 4926 | highlight: function(start, end){ 4927 | if (!end){ 4928 | end = this.retrieve('highlight:original', this.getStyle('background-color')); 4929 | end = (end == 'transparent') ? '#fff' : end; 4930 | } 4931 | var tween = this.get('tween'); 4932 | tween.start('background-color', start || '#ffff88', end).chain(function(){ 4933 | this.setStyle('background-color', this.retrieve('highlight:original')); 4934 | tween.callChain(); 4935 | }.bind(this)); 4936 | return this; 4937 | } 4938 | 4939 | }); 4940 | 4941 | 4942 | /* 4943 | --- 4944 | 4945 | name: Fx.Morph 4946 | 4947 | description: Formerly Fx.Styles, effect to transition any number of CSS properties for an element using an object of rules, or CSS based selector rules. 4948 | 4949 | license: MIT-style license. 4950 | 4951 | requires: Fx.CSS 4952 | 4953 | provides: Fx.Morph 4954 | 4955 | ... 4956 | */ 4957 | 4958 | Fx.Morph = new Class({ 4959 | 4960 | Extends: Fx.CSS, 4961 | 4962 | initialize: function(element, options){ 4963 | this.element = this.subject = document.id(element); 4964 | this.parent(options); 4965 | }, 4966 | 4967 | set: function(now){ 4968 | if (typeof now == 'string') now = this.search(now); 4969 | for (var p in now) this.render(this.element, p, now[p], this.options.unit); 4970 | return this; 4971 | }, 4972 | 4973 | compute: function(from, to, delta){ 4974 | var now = {}; 4975 | for (var p in from) now[p] = this.parent(from[p], to[p], delta); 4976 | return now; 4977 | }, 4978 | 4979 | start: function(properties){ 4980 | if (!this.check(properties)) return this; 4981 | if (typeof properties == 'string') properties = this.search(properties); 4982 | var from = {}, to = {}; 4983 | for (var p in properties){ 4984 | var parsed = this.prepare(this.element, p, properties[p]); 4985 | from[p] = parsed.from; 4986 | to[p] = parsed.to; 4987 | } 4988 | return this.parent(from, to); 4989 | } 4990 | 4991 | }); 4992 | 4993 | Element.Properties.morph = { 4994 | 4995 | set: function(options){ 4996 | this.get('morph').cancel().setOptions(options); 4997 | return this; 4998 | }, 4999 | 5000 | get: function(){ 5001 | var morph = this.retrieve('morph'); 5002 | if (!morph){ 5003 | morph = new Fx.Morph(this, {link: 'cancel'}); 5004 | this.store('morph', morph); 5005 | } 5006 | return morph; 5007 | } 5008 | 5009 | }; 5010 | 5011 | Element.implement({ 5012 | 5013 | morph: function(props){ 5014 | this.get('morph').start(props); 5015 | return this; 5016 | } 5017 | 5018 | }); 5019 | 5020 | 5021 | /* 5022 | --- 5023 | 5024 | name: Fx.Transitions 5025 | 5026 | description: Contains a set of advanced transitions to be used with any of the Fx Classes. 5027 | 5028 | license: MIT-style license. 5029 | 5030 | credits: 5031 | - Easing Equations by Robert Penner, , modified and optimized to be used with MooTools. 5032 | 5033 | requires: Fx 5034 | 5035 | provides: Fx.Transitions 5036 | 5037 | ... 5038 | */ 5039 | 5040 | Fx.implement({ 5041 | 5042 | getTransition: function(){ 5043 | var trans = this.options.transition || Fx.Transitions.Sine.easeInOut; 5044 | if (typeof trans == 'string'){ 5045 | var data = trans.split(':'); 5046 | trans = Fx.Transitions; 5047 | trans = trans[data[0]] || trans[data[0].capitalize()]; 5048 | if (data[1]) trans = trans['ease' + data[1].capitalize() + (data[2] ? data[2].capitalize() : '')]; 5049 | } 5050 | return trans; 5051 | } 5052 | 5053 | }); 5054 | 5055 | Fx.Transition = function(transition, params){ 5056 | params = Array.from(params); 5057 | var easeIn = function(pos){ 5058 | return transition(pos, params); 5059 | }; 5060 | return Object.append(easeIn, { 5061 | easeIn: easeIn, 5062 | easeOut: function(pos){ 5063 | return 1 - transition(1 - pos, params); 5064 | }, 5065 | easeInOut: function(pos){ 5066 | return (pos <= 0.5 ? transition(2 * pos, params) : (2 - transition(2 * (1 - pos), params))) / 2; 5067 | } 5068 | }); 5069 | }; 5070 | 5071 | Fx.Transitions = { 5072 | 5073 | linear: function(zero){ 5074 | return zero; 5075 | } 5076 | 5077 | }; 5078 | 5079 | //<1.2compat> 5080 | 5081 | Fx.Transitions = new Hash(Fx.Transitions); 5082 | 5083 | // 5084 | 5085 | Fx.Transitions.extend = function(transitions){ 5086 | for (var transition in transitions) Fx.Transitions[transition] = new Fx.Transition(transitions[transition]); 5087 | }; 5088 | 5089 | Fx.Transitions.extend({ 5090 | 5091 | Pow: function(p, x){ 5092 | return Math.pow(p, x && x[0] || 6); 5093 | }, 5094 | 5095 | Expo: function(p){ 5096 | return Math.pow(2, 8 * (p - 1)); 5097 | }, 5098 | 5099 | Circ: function(p){ 5100 | return 1 - Math.sin(Math.acos(p)); 5101 | }, 5102 | 5103 | Sine: function(p){ 5104 | return 1 - Math.cos(p * Math.PI / 2); 5105 | }, 5106 | 5107 | Back: function(p, x){ 5108 | x = x && x[0] || 1.618; 5109 | return Math.pow(p, 2) * ((x + 1) * p - x); 5110 | }, 5111 | 5112 | Bounce: function(p){ 5113 | var value; 5114 | for (var a = 0, b = 1; 1; a += b, b /= 2){ 5115 | if (p >= (7 - 4 * a) / 11){ 5116 | value = b * b - Math.pow((11 - 6 * a - 11 * p) / 4, 2); 5117 | break; 5118 | } 5119 | } 5120 | return value; 5121 | }, 5122 | 5123 | Elastic: function(p, x){ 5124 | return Math.pow(2, 10 * --p) * Math.cos(20 * p * Math.PI * (x && x[0] || 1) / 3); 5125 | } 5126 | 5127 | }); 5128 | 5129 | ['Quad', 'Cubic', 'Quart', 'Quint'].each(function(transition, i){ 5130 | Fx.Transitions[transition] = new Fx.Transition(function(p){ 5131 | return Math.pow(p, i + 2); 5132 | }); 5133 | }); 5134 | 5135 | 5136 | /* 5137 | --- 5138 | 5139 | name: Request 5140 | 5141 | description: Powerful all purpose Request Class. Uses XMLHTTPRequest. 5142 | 5143 | license: MIT-style license. 5144 | 5145 | requires: [Object, Element, Chain, Events, Options, Browser] 5146 | 5147 | provides: Request 5148 | 5149 | ... 5150 | */ 5151 | 5152 | (function(){ 5153 | 5154 | var empty = function(){}, 5155 | progressSupport = ('onprogress' in new Browser.Request); 5156 | 5157 | var Request = this.Request = new Class({ 5158 | 5159 | Implements: [Chain, Events, Options], 5160 | 5161 | options: {/* 5162 | onRequest: function(){}, 5163 | onLoadstart: function(event, xhr){}, 5164 | onProgress: function(event, xhr){}, 5165 | onComplete: function(){}, 5166 | onCancel: function(){}, 5167 | onSuccess: function(responseText, responseXML){}, 5168 | onFailure: function(xhr){}, 5169 | onException: function(headerName, value){}, 5170 | onTimeout: function(){}, 5171 | user: '', 5172 | password: '',*/ 5173 | url: '', 5174 | data: '', 5175 | headers: { 5176 | 'X-Requested-With': 'XMLHttpRequest', 5177 | 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' 5178 | }, 5179 | async: true, 5180 | format: false, 5181 | method: 'post', 5182 | link: 'ignore', 5183 | isSuccess: null, 5184 | emulation: true, 5185 | urlEncoded: true, 5186 | encoding: 'utf-8', 5187 | evalScripts: false, 5188 | evalResponse: false, 5189 | timeout: 0, 5190 | noCache: false 5191 | }, 5192 | 5193 | initialize: function(options){ 5194 | this.xhr = new Browser.Request(); 5195 | this.setOptions(options); 5196 | this.headers = this.options.headers; 5197 | }, 5198 | 5199 | onStateChange: function(){ 5200 | var xhr = this.xhr; 5201 | if (xhr.readyState != 4 || !this.running) return; 5202 | this.running = false; 5203 | this.status = 0; 5204 | Function.attempt(function(){ 5205 | var status = xhr.status; 5206 | this.status = (status == 1223) ? 204 : status; 5207 | }.bind(this)); 5208 | xhr.onreadystatechange = empty; 5209 | if (progressSupport) xhr.onprogress = xhr.onloadstart = empty; 5210 | clearTimeout(this.timer); 5211 | 5212 | this.response = {text: this.xhr.responseText || '', xml: this.xhr.responseXML}; 5213 | if (this.options.isSuccess.call(this, this.status)) 5214 | this.success(this.response.text, this.response.xml); 5215 | else 5216 | this.failure(); 5217 | }, 5218 | 5219 | isSuccess: function(){ 5220 | var status = this.status; 5221 | return (status >= 200 && status < 300); 5222 | }, 5223 | 5224 | isRunning: function(){ 5225 | return !!this.running; 5226 | }, 5227 | 5228 | processScripts: function(text){ 5229 | if (this.options.evalResponse || (/(ecma|java)script/).test(this.getHeader('Content-type'))) return Browser.exec(text); 5230 | return text.stripScripts(this.options.evalScripts); 5231 | }, 5232 | 5233 | success: function(text, xml){ 5234 | this.onSuccess(this.processScripts(text), xml); 5235 | }, 5236 | 5237 | onSuccess: function(){ 5238 | this.fireEvent('complete', arguments).fireEvent('success', arguments).callChain(); 5239 | }, 5240 | 5241 | failure: function(){ 5242 | this.onFailure(); 5243 | }, 5244 | 5245 | onFailure: function(){ 5246 | this.fireEvent('complete').fireEvent('failure', this.xhr); 5247 | }, 5248 | 5249 | loadstart: function(event){ 5250 | this.fireEvent('loadstart', [event, this.xhr]); 5251 | }, 5252 | 5253 | progress: function(event){ 5254 | this.fireEvent('progress', [event, this.xhr]); 5255 | }, 5256 | 5257 | timeout: function(){ 5258 | this.fireEvent('timeout', this.xhr); 5259 | }, 5260 | 5261 | setHeader: function(name, value){ 5262 | this.headers[name] = value; 5263 | return this; 5264 | }, 5265 | 5266 | getHeader: function(name){ 5267 | return Function.attempt(function(){ 5268 | return this.xhr.getResponseHeader(name); 5269 | }.bind(this)); 5270 | }, 5271 | 5272 | check: function(){ 5273 | if (!this.running) return true; 5274 | switch (this.options.link){ 5275 | case 'cancel': this.cancel(); return true; 5276 | case 'chain': this.chain(this.caller.pass(arguments, this)); return false; 5277 | } 5278 | return false; 5279 | }, 5280 | 5281 | send: function(options){ 5282 | if (!this.check(options)) return this; 5283 | 5284 | this.options.isSuccess = this.options.isSuccess || this.isSuccess; 5285 | this.running = true; 5286 | 5287 | var type = typeOf(options); 5288 | if (type == 'string' || type == 'element') options = {data: options}; 5289 | 5290 | var old = this.options; 5291 | options = Object.append({data: old.data, url: old.url, method: old.method}, options); 5292 | var data = options.data, url = String(options.url), method = options.method.toLowerCase(); 5293 | 5294 | switch (typeOf(data)){ 5295 | case 'element': data = document.id(data).toQueryString(); break; 5296 | case 'object': case 'hash': data = Object.toQueryString(data); 5297 | } 5298 | 5299 | if (this.options.format){ 5300 | var format = 'format=' + this.options.format; 5301 | data = (data) ? format + '&' + data : format; 5302 | } 5303 | 5304 | if (this.options.emulation && !['get', 'post'].contains(method)){ 5305 | var _method = '_method=' + method; 5306 | data = (data) ? _method + '&' + data : _method; 5307 | method = 'post'; 5308 | } 5309 | 5310 | if (this.options.urlEncoded && ['post', 'put'].contains(method)){ 5311 | var encoding = (this.options.encoding) ? '; charset=' + this.options.encoding : ''; 5312 | this.headers['Content-type'] = 'application/x-www-form-urlencoded' + encoding; 5313 | } 5314 | 5315 | if (!url) url = document.location.pathname; 5316 | 5317 | var trimPosition = url.lastIndexOf('/'); 5318 | if (trimPosition > -1 && (trimPosition = url.indexOf('#')) > -1) url = url.substr(0, trimPosition); 5319 | 5320 | if (this.options.noCache) 5321 | url += (url.contains('?') ? '&' : '?') + String.uniqueID(); 5322 | 5323 | if (data && method == 'get'){ 5324 | url += (url.contains('?') ? '&' : '?') + data; 5325 | data = null; 5326 | } 5327 | 5328 | var xhr = this.xhr; 5329 | if (progressSupport){ 5330 | xhr.onloadstart = this.loadstart.bind(this); 5331 | xhr.onprogress = this.progress.bind(this); 5332 | } 5333 | 5334 | xhr.open(method.toUpperCase(), url, this.options.async, this.options.user, this.options.password); 5335 | if (this.options.user && 'withCredentials' in xhr) xhr.withCredentials = true; 5336 | 5337 | xhr.onreadystatechange = this.onStateChange.bind(this); 5338 | 5339 | Object.each(this.headers, function(value, key){ 5340 | try { 5341 | xhr.setRequestHeader(key, value); 5342 | } catch (e){ 5343 | this.fireEvent('exception', [key, value]); 5344 | } 5345 | }, this); 5346 | 5347 | this.fireEvent('request'); 5348 | xhr.send(data); 5349 | if (!this.options.async) this.onStateChange(); 5350 | if (this.options.timeout) this.timer = this.timeout.delay(this.options.timeout, this); 5351 | return this; 5352 | }, 5353 | 5354 | cancel: function(){ 5355 | if (!this.running) return this; 5356 | this.running = false; 5357 | var xhr = this.xhr; 5358 | xhr.abort(); 5359 | clearTimeout(this.timer); 5360 | xhr.onreadystatechange = empty; 5361 | if (progressSupport) xhr.onprogress = xhr.onloadstart = empty; 5362 | this.xhr = new Browser.Request(); 5363 | this.fireEvent('cancel'); 5364 | return this; 5365 | } 5366 | 5367 | }); 5368 | 5369 | var methods = {}; 5370 | ['get', 'post', 'put', 'delete', 'GET', 'POST', 'PUT', 'DELETE'].each(function(method){ 5371 | methods[method] = function(data){ 5372 | var object = { 5373 | method: method 5374 | }; 5375 | if (data != null) object.data = data; 5376 | return this.send(object); 5377 | }; 5378 | }); 5379 | 5380 | Request.implement(methods); 5381 | 5382 | Element.Properties.send = { 5383 | 5384 | set: function(options){ 5385 | var send = this.get('send').cancel(); 5386 | send.setOptions(options); 5387 | return this; 5388 | }, 5389 | 5390 | get: function(){ 5391 | var send = this.retrieve('send'); 5392 | if (!send){ 5393 | send = new Request({ 5394 | data: this, link: 'cancel', method: this.get('method') || 'post', url: this.get('action') 5395 | }); 5396 | this.store('send', send); 5397 | } 5398 | return send; 5399 | } 5400 | 5401 | }; 5402 | 5403 | Element.implement({ 5404 | 5405 | send: function(url){ 5406 | var sender = this.get('send'); 5407 | sender.send({data: this, url: url || sender.options.url}); 5408 | return this; 5409 | } 5410 | 5411 | }); 5412 | 5413 | })(); 5414 | 5415 | /* 5416 | --- 5417 | 5418 | name: Request.HTML 5419 | 5420 | description: Extends the basic Request Class with additional methods for interacting with HTML responses. 5421 | 5422 | license: MIT-style license. 5423 | 5424 | requires: [Element, Request] 5425 | 5426 | provides: Request.HTML 5427 | 5428 | ... 5429 | */ 5430 | 5431 | Request.HTML = new Class({ 5432 | 5433 | Extends: Request, 5434 | 5435 | options: { 5436 | update: false, 5437 | append: false, 5438 | evalScripts: true, 5439 | filter: false, 5440 | headers: { 5441 | Accept: 'text/html, application/xml, text/xml, */*' 5442 | } 5443 | }, 5444 | 5445 | success: function(text){ 5446 | var options = this.options, response = this.response; 5447 | 5448 | response.html = text.stripScripts(function(script){ 5449 | response.javascript = script; 5450 | }); 5451 | 5452 | var match = response.html.match(/]*>([\s\S]*?)<\/body>/i); 5453 | if (match) response.html = match[1]; 5454 | var temp = new Element('div').set('html', response.html); 5455 | 5456 | response.tree = temp.childNodes; 5457 | response.elements = temp.getElements('*'); 5458 | 5459 | if (options.filter) response.tree = response.elements.filter(options.filter); 5460 | if (options.update) document.id(options.update).empty().set('html', response.html); 5461 | else if (options.append) document.id(options.append).adopt(temp.getChildren()); 5462 | if (options.evalScripts) Browser.exec(response.javascript); 5463 | 5464 | this.onSuccess(response.tree, response.elements, response.html, response.javascript); 5465 | } 5466 | 5467 | }); 5468 | 5469 | Element.Properties.load = { 5470 | 5471 | set: function(options){ 5472 | var load = this.get('load').cancel(); 5473 | load.setOptions(options); 5474 | return this; 5475 | }, 5476 | 5477 | get: function(){ 5478 | var load = this.retrieve('load'); 5479 | if (!load){ 5480 | load = new Request.HTML({data: this, link: 'cancel', update: this, method: 'get'}); 5481 | this.store('load', load); 5482 | } 5483 | return load; 5484 | } 5485 | 5486 | }; 5487 | 5488 | Element.implement({ 5489 | 5490 | load: function(){ 5491 | this.get('load').send(Array.link(arguments, {data: Type.isObject, url: Type.isString})); 5492 | return this; 5493 | } 5494 | 5495 | }); 5496 | 5497 | 5498 | /* 5499 | --- 5500 | 5501 | name: JSON 5502 | 5503 | description: JSON encoder and decoder. 5504 | 5505 | license: MIT-style license. 5506 | 5507 | See Also: 5508 | 5509 | requires: [Array, String, Number, Function] 5510 | 5511 | provides: JSON 5512 | 5513 | ... 5514 | */ 5515 | 5516 | if (typeof JSON == 'undefined') this.JSON = {}; 5517 | 5518 | //<1.2compat> 5519 | 5520 | JSON = new Hash({ 5521 | stringify: JSON.stringify, 5522 | parse: JSON.parse 5523 | }); 5524 | 5525 | // 5526 | 5527 | (function(){ 5528 | 5529 | var special = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'}; 5530 | 5531 | var escape = function(chr){ 5532 | return special[chr] || '\\u' + ('0000' + chr.charCodeAt(0).toString(16)).slice(-4); 5533 | }; 5534 | 5535 | JSON.validate = function(string){ 5536 | string = string.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@'). 5537 | replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'). 5538 | replace(/(?:^|:|,)(?:\s*\[)+/g, ''); 5539 | 5540 | return (/^[\],:{}\s]*$/).test(string); 5541 | }; 5542 | 5543 | JSON.encode = JSON.stringify ? function(obj){ 5544 | return JSON.stringify(obj); 5545 | } : function(obj){ 5546 | if (obj && obj.toJSON) obj = obj.toJSON(); 5547 | 5548 | switch (typeOf(obj)){ 5549 | case 'string': 5550 | return '"' + obj.replace(/[\x00-\x1f\\"]/g, escape) + '"'; 5551 | case 'array': 5552 | return '[' + obj.map(JSON.encode).clean() + ']'; 5553 | case 'object': case 'hash': 5554 | var string = []; 5555 | Object.each(obj, function(value, key){ 5556 | var json = JSON.encode(value); 5557 | if (json) string.push(JSON.encode(key) + ':' + json); 5558 | }); 5559 | return '{' + string + '}'; 5560 | case 'number': case 'boolean': return '' + obj; 5561 | case 'null': return 'null'; 5562 | } 5563 | 5564 | return null; 5565 | }; 5566 | 5567 | JSON.decode = function(string, secure){ 5568 | if (!string || typeOf(string) != 'string') return null; 5569 | 5570 | if (secure || JSON.secure){ 5571 | if (JSON.parse) return JSON.parse(string); 5572 | if (!JSON.validate(string)) throw new Error('JSON could not decode the input; security is enabled and the value is not secure.'); 5573 | } 5574 | 5575 | return eval('(' + string + ')'); 5576 | }; 5577 | 5578 | }).call(this); 5579 | 5580 | 5581 | /* 5582 | --- 5583 | 5584 | name: Request.JSON 5585 | 5586 | description: Extends the basic Request Class with additional methods for sending and receiving JSON data. 5587 | 5588 | license: MIT-style license. 5589 | 5590 | requires: [Request, JSON] 5591 | 5592 | provides: Request.JSON 5593 | 5594 | ... 5595 | */ 5596 | 5597 | Request.JSON = new Class({ 5598 | 5599 | Extends: Request, 5600 | 5601 | options: { 5602 | /*onError: function(text, error){},*/ 5603 | secure: true 5604 | }, 5605 | 5606 | initialize: function(options){ 5607 | this.parent(options); 5608 | Object.append(this.headers, { 5609 | 'Accept': 'application/json', 5610 | 'X-Request': 'JSON' 5611 | }); 5612 | }, 5613 | 5614 | success: function(text){ 5615 | var json; 5616 | try { 5617 | json = this.response.json = JSON.decode(text, this.options.secure); 5618 | } catch (error){ 5619 | this.fireEvent('error', [text, error]); 5620 | return; 5621 | } 5622 | if (json == null) this.onFailure(); 5623 | else this.onSuccess(json, text); 5624 | } 5625 | 5626 | }); 5627 | 5628 | 5629 | /* 5630 | --- 5631 | 5632 | name: Cookie 5633 | 5634 | description: Class for creating, reading, and deleting browser Cookies. 5635 | 5636 | license: MIT-style license. 5637 | 5638 | credits: 5639 | - Based on the functions by Peter-Paul Koch (http://quirksmode.org). 5640 | 5641 | requires: [Options, Browser] 5642 | 5643 | provides: Cookie 5644 | 5645 | ... 5646 | */ 5647 | 5648 | var Cookie = new Class({ 5649 | 5650 | Implements: Options, 5651 | 5652 | options: { 5653 | path: '/', 5654 | domain: false, 5655 | duration: false, 5656 | secure: false, 5657 | document: document, 5658 | encode: true 5659 | }, 5660 | 5661 | initialize: function(key, options){ 5662 | this.key = key; 5663 | this.setOptions(options); 5664 | }, 5665 | 5666 | write: function(value){ 5667 | if (this.options.encode) value = encodeURIComponent(value); 5668 | if (this.options.domain) value += '; domain=' + this.options.domain; 5669 | if (this.options.path) value += '; path=' + this.options.path; 5670 | if (this.options.duration){ 5671 | var date = new Date(); 5672 | date.setTime(date.getTime() + this.options.duration * 24 * 60 * 60 * 1000); 5673 | value += '; expires=' + date.toGMTString(); 5674 | } 5675 | if (this.options.secure) value += '; secure'; 5676 | this.options.document.cookie = this.key + '=' + value; 5677 | return this; 5678 | }, 5679 | 5680 | read: function(){ 5681 | var value = this.options.document.cookie.match('(?:^|;)\\s*' + this.key.escapeRegExp() + '=([^;]*)'); 5682 | return (value) ? decodeURIComponent(value[1]) : null; 5683 | }, 5684 | 5685 | dispose: function(){ 5686 | new Cookie(this.key, Object.merge({}, this.options, {duration: -1})).write(''); 5687 | return this; 5688 | } 5689 | 5690 | }); 5691 | 5692 | Cookie.write = function(key, value, options){ 5693 | return new Cookie(key, options).write(value); 5694 | }; 5695 | 5696 | Cookie.read = function(key){ 5697 | return new Cookie(key).read(); 5698 | }; 5699 | 5700 | Cookie.dispose = function(key, options){ 5701 | return new Cookie(key, options).dispose(); 5702 | }; 5703 | 5704 | 5705 | /* 5706 | --- 5707 | 5708 | name: DOMReady 5709 | 5710 | description: Contains the custom event domready. 5711 | 5712 | license: MIT-style license. 5713 | 5714 | requires: [Browser, Element, Element.Event] 5715 | 5716 | provides: [DOMReady, DomReady] 5717 | 5718 | ... 5719 | */ 5720 | 5721 | (function(window, document){ 5722 | 5723 | var ready, 5724 | loaded, 5725 | checks = [], 5726 | shouldPoll, 5727 | timer, 5728 | isFramed = true; 5729 | 5730 | // Thanks to Rich Dougherty 5731 | try { 5732 | isFramed = window.frameElement != null; 5733 | } catch(e){} 5734 | 5735 | var domready = function(){ 5736 | clearTimeout(timer); 5737 | if (ready) return; 5738 | Browser.loaded = ready = true; 5739 | document.removeListener('DOMContentLoaded', domready).removeListener('readystatechange', check); 5740 | 5741 | document.fireEvent('domready'); 5742 | window.fireEvent('domready'); 5743 | }; 5744 | 5745 | var check = function(){ 5746 | for (var i = checks.length; i--;) if (checks[i]()){ 5747 | domready(); 5748 | return true; 5749 | } 5750 | 5751 | return false; 5752 | }; 5753 | 5754 | var poll = function(){ 5755 | clearTimeout(timer); 5756 | if (!check()) timer = setTimeout(poll, 10); 5757 | }; 5758 | 5759 | document.addListener('DOMContentLoaded', domready); 5760 | 5761 | // doScroll technique by Diego Perini http://javascript.nwbox.com/IEContentLoaded/ 5762 | var testElement = document.createElement('div'); 5763 | if (testElement.doScroll && !isFramed){ 5764 | checks.push(function(){ 5765 | try { 5766 | testElement.doScroll(); 5767 | return true; 5768 | } catch (e){} 5769 | 5770 | return false; 5771 | }); 5772 | shouldPoll = true; 5773 | } 5774 | 5775 | if (document.readyState) checks.push(function(){ 5776 | var state = document.readyState; 5777 | return (state == 'loaded' || state == 'complete'); 5778 | }); 5779 | 5780 | if ('onreadystatechange' in document) document.addListener('readystatechange', check); 5781 | else shouldPoll = true; 5782 | 5783 | if (shouldPoll) poll(); 5784 | 5785 | Element.Events.domready = { 5786 | onAdd: function(fn){ 5787 | if (ready) fn.call(this); 5788 | } 5789 | }; 5790 | 5791 | // Make sure that domready fires before load 5792 | Element.Events.load = { 5793 | base: 'load', 5794 | onAdd: function(fn){ 5795 | if (loaded && this == window) fn.call(this); 5796 | }, 5797 | condition: function(){ 5798 | if (this == window){ 5799 | domready(); 5800 | delete Element.Events.load; 5801 | } 5802 | 5803 | return true; 5804 | } 5805 | }; 5806 | 5807 | // This is based on the custom load event 5808 | window.addEvent('load', function(){ 5809 | loaded = true; 5810 | }); 5811 | 5812 | })(window, document); 5813 | 5814 | 5815 | /* 5816 | --- 5817 | 5818 | name: Swiff 5819 | 5820 | description: Wrapper for embedding SWF movies. Supports External Interface Communication. 5821 | 5822 | license: MIT-style license. 5823 | 5824 | credits: 5825 | - Flash detection & Internet Explorer + Flash Player 9 fix inspired by SWFObject. 5826 | 5827 | requires: [Options, Object, Element] 5828 | 5829 | provides: Swiff 5830 | 5831 | ... 5832 | */ 5833 | 5834 | (function(){ 5835 | 5836 | var Swiff = this.Swiff = new Class({ 5837 | 5838 | Implements: Options, 5839 | 5840 | options: { 5841 | id: null, 5842 | height: 1, 5843 | width: 1, 5844 | container: null, 5845 | properties: {}, 5846 | params: { 5847 | quality: 'high', 5848 | allowScriptAccess: 'always', 5849 | wMode: 'window', 5850 | swLiveConnect: true 5851 | }, 5852 | callBacks: {}, 5853 | vars: {} 5854 | }, 5855 | 5856 | toElement: function(){ 5857 | return this.object; 5858 | }, 5859 | 5860 | initialize: function(path, options){ 5861 | this.instance = 'Swiff_' + String.uniqueID(); 5862 | 5863 | this.setOptions(options); 5864 | options = this.options; 5865 | var id = this.id = options.id || this.instance; 5866 | var container = document.id(options.container); 5867 | 5868 | Swiff.CallBacks[this.instance] = {}; 5869 | 5870 | var params = options.params, vars = options.vars, callBacks = options.callBacks; 5871 | var properties = Object.append({height: options.height, width: options.width}, options.properties); 5872 | 5873 | var self = this; 5874 | 5875 | for (var callBack in callBacks){ 5876 | Swiff.CallBacks[this.instance][callBack] = (function(option){ 5877 | return function(){ 5878 | return option.apply(self.object, arguments); 5879 | }; 5880 | })(callBacks[callBack]); 5881 | vars[callBack] = 'Swiff.CallBacks.' + this.instance + '.' + callBack; 5882 | } 5883 | 5884 | params.flashVars = Object.toQueryString(vars); 5885 | if (Browser.ie){ 5886 | properties.classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'; 5887 | params.movie = path; 5888 | } else { 5889 | properties.type = 'application/x-shockwave-flash'; 5890 | } 5891 | properties.data = path; 5892 | 5893 | var build = ''; 5898 | } 5899 | build += ''; 5900 | this.object = ((container) ? container.empty() : new Element('div')).set('html', build).firstChild; 5901 | }, 5902 | 5903 | replaces: function(element){ 5904 | element = document.id(element, true); 5905 | element.parentNode.replaceChild(this.toElement(), element); 5906 | return this; 5907 | }, 5908 | 5909 | inject: function(element){ 5910 | document.id(element, true).appendChild(this.toElement()); 5911 | return this; 5912 | }, 5913 | 5914 | remote: function(){ 5915 | return Swiff.remote.apply(Swiff, [this.toElement()].append(arguments)); 5916 | } 5917 | 5918 | }); 5919 | 5920 | Swiff.CallBacks = {}; 5921 | 5922 | Swiff.remote = function(obj, fn){ 5923 | var rs = obj.CallFunction('' + __flash__argumentsToXML(arguments, 2) + ''); 5924 | return eval(rs); 5925 | }; 5926 | 5927 | }).call(this); 5928 | 5929 | -------------------------------------------------------------------------------- /gogo.js: -------------------------------------------------------------------------------- 1 | var $E = function(selector, filter){ 2 | return (document.id(filter) || document).getElement(selector); 3 | }; 4 | 5 | var $ES = function(selector, filter){ 6 | return (document.id(filter) || document).getElements(selector); 7 | }; 8 | 9 | Number.implement({ 10 | decimalFormat: function(decimals) 11 | { 12 | return this.round(decimals).toFixed(decimals); 13 | } 14 | }); 15 | 16 | 17 | // Element.alias({'dispose': 'remove', 'getLast': 'getLastChild'}); 18 | 19 | Element.implement({ 20 | 21 | getText: function(){ 22 | return this.get('text'); 23 | }, 24 | 25 | setText: function(text){ 26 | return this.set('text', text); 27 | }, 28 | 29 | setHTML: function(){ 30 | return this.set('html', arguments); 31 | }, 32 | 33 | getHTML: function(){ 34 | return this.get('html'); 35 | }, 36 | 37 | getTag: function(){ 38 | return this.get('tag'); 39 | }, 40 | 41 | setOpacity: function(op){ 42 | return this.set('opacity', op); 43 | } 44 | }); 45 | 46 | if(typeof Element.prototype.hasAttribute == 'undefined') 47 | { 48 | Element.implement({ 49 | hasAttribute: function(attribute) { var node = this.getAttributeNode(attribute); 50 | return !!(node && (node.specified || node.nodeValue)); } 51 | }); 52 | } 53 | 54 | Event.keys = Event.Keys; 55 | 56 | 57 | window.$MOO = $; 58 | 59 | if(typeof document.id != 'function') 60 | document.id = $; -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | PinMap 4 | 5 | 6 | 7 | 8 | 9 | 544 | 545 | 661 | 662 | 663 | 664 |
665 |

James' Dodgy Arduino-Oriented Pinout Maker For Microcontrollers

666 |

667 | Step 1. Select template from drop down. Edit as required. Click the button. 668 |

669 | 670 |

671 | Step 2. Adjust the position of the vertical pins and margins so they are correct. 672 |

673 |

674 | Step 3. Screenshot or print-to-pdf or whatever and adjust further in your favourite graphics package. 675 |

676 | 677 |

678 |
681 | 682 | 683 |

684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 |
Vertical Pins Offset:top: , left:
Vertical Pins Margins:top: , bottom:
696 | 697 |
698 | 699 |
700 |
701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 717 | 718 |
0..n, ~ digitalWrite(), digitalRead(), pinMode(), ~analogWrite()
A0..AnanalogRead()
711 |
Programmer
712 |
Serial
713 |
SPI
714 |
I2C
715 |
Interrupt
716 |
719 |
720 | 721 | 722 | -------------------------------------------------------------------------------- /templates.js: -------------------------------------------------------------------------------- 1 | var templates = [ 2 | 3 | // The numbers in a template are the physical pin numbers 4 | // of the IC, starting at 1 top left and progressing anticlockwise 5 | // as is the custom. 6 | { 7 | Name : 'ATtiny13', // A label for the IC 8 | Package: '2SIDED' , // 2SIDED or 4SIDED 9 | Pins : 8 , // Total number of pins in the package 10 | Programmer: 'ISP', 11 | 12 | // PRC (Power Reset Clock) are the labels closest to the IC 13 | // If a label should be applied to more that one pin, use an 14 | // array... 15 | // Vcc: [1,2,3] 16 | // Interrupt is a special case and will be labelled as 17 | // INTx where x is the index of the pin in the array 18 | // eg Interrupt: [6,9] 19 | // means pin 6 gets labelled INT0 and 9 as INT1 20 | // 21 | // Reset, XTAL1 and XTAL2 if present will cause 22 | // other labels on that pin to be semi-transparent to show 23 | // that those functions are typically not available 24 | // due to use of reset or crystals. 25 | PRC : { Vcc:8, Gnd:4, Reset: 1, CLKI: 2, Interrupt: [6]}, 26 | 27 | // Pins which can handle PWM functions (Timer Controlled Outputs) 28 | // these are labelled with a tilde ~ 29 | PWM : [5,6], 30 | 31 | // Digital Input/Output Pins 32 | // These get labeled as the index in the array, eg 33 | // Digital: [3,4,5] 34 | // marks pin 3 as "0", pin 4 as "1" and pin 5 as "2" 35 | Digital: [5,6,7,2,3,1], 36 | 37 | // Analog Input/Output Pins 38 | // These get labelled as An where n is the index in the array 39 | // Analog: [3,4,5] 40 | // marks pin 3 as "A0", pin 4 as "A1" and pin 5 as "A2" 41 | Analog : [1,7,3,2], 42 | 43 | // Other categries of pins, the labels you use here are 44 | // arbitrary, Serial, SPI and I2C will get coloured labels 45 | // others are just white. 46 | Peripherals: 47 | { 48 | Serial : {TX: 5, RX: 6}, 49 | Programmer : {MOSI: 5, MISO: 6, SCK: 7}, 50 | // I2C : {SDA: 6, SCL: 7} 51 | } 52 | 53 | }, 54 | 55 | { 56 | Name : 'ATtiny 5/10', // A label for the IC 57 | Package: '2SIDED' , // 2SIDED or 4SIDED 58 | Pins : 6 , // Total number of pins in the package 59 | Programmer: 'TPI', 60 | 61 | // PRC (Power Reset Clock) are the labels closest to the IC 62 | // If a label should be applied to more that one pin, use an 63 | // array... 64 | // Vcc: [1,2,3] 65 | // Interrupt is a special case and will be labelled as 66 | // INTx where x is the index of the pin in the array 67 | // eg Interrupt: [6,9] 68 | // means pin 6 gets labelled INT0 and 9 as INT1 69 | // 70 | // Reset, XTAL1 and XTAL2 if present will cause 71 | // other labels on that pin to be semi-transparent to show 72 | // that those functions are typically not available 73 | // due to use of reset or crystals. 74 | PRC : { Vcc:5, Gnd:2, Reset: 6, CLKI: 3, Interrupt: [4]}, 75 | 76 | // Pins which can handle PWM functions (Timer Controlled Outputs) 77 | // these are labelled with a tilde ~ 78 | PWM : [1,3], 79 | 80 | // Digital Input/Output Pins 81 | // These get labeled as the index in the array, eg 82 | // Digital: [3,4,5] 83 | // marks pin 3 as "0", pin 4 as "1" and pin 5 as "2" 84 | Digital: [1,3,4,6], 85 | 86 | // Analog Input/Output Pins 87 | // These get labelled as An where n is the index in the array 88 | // Analog: [3,4,5] 89 | // marks pin 3 as "A0", pin 4 as "A1" and pin 5 as "A2" 90 | Analog : [1,3,4,6], 91 | 92 | // Other categries of pins, the labels you use here are 93 | // arbitrary, Serial, SPI and I2C will get coloured labels 94 | // others are just white. 95 | Peripherals: 96 | { 97 | Serial : {TX: 1, RX: 3}, 98 | Programmer : {DATA: 1, CLK: 3}, 99 | } 100 | 101 | }, 102 | 103 | { 104 | Name : 'ATtiny 4/9', // A label for the IC 105 | Package: '2SIDED' , // 2SIDED or 4SIDED 106 | Pins : 6 , // Total number of pins in the package 107 | Programmer: 'TPI', 108 | 109 | // PRC (Power Reset Clock) are the labels closest to the IC 110 | // If a label should be applied to more that one pin, use an 111 | // array... 112 | // Vcc: [1,2,3] 113 | // Interrupt is a special case and will be labelled as 114 | // INTx where x is the index of the pin in the array 115 | // eg Interrupt: [6,9] 116 | // means pin 6 gets labelled INT0 and 9 as INT1 117 | // 118 | // Reset, XTAL1 and XTAL2 if present will cause 119 | // other labels on that pin to be semi-transparent to show 120 | // that those functions are typically not available 121 | // due to use of reset or crystals. 122 | PRC : { Vcc:5, Gnd:2, Reset: 6, CLKI: 3, Interrupt: [4]}, 123 | 124 | // Pins which can handle PWM functions (Timer Controlled Outputs) 125 | // these are labelled with a tilde ~ 126 | PWM : [1,3], 127 | 128 | // Digital Input/Output Pins 129 | // These get labeled as the index in the array, eg 130 | // Digital: [3,4,5] 131 | // marks pin 3 as "0", pin 4 as "1" and pin 5 as "2" 132 | Digital: [1,3,4,6], 133 | 134 | // Analog Input/Output Pins 135 | // These get labelled as An where n is the index in the array 136 | // Analog: [3,4,5] 137 | // marks pin 3 as "A0", pin 4 as "A1" and pin 5 as "A2" 138 | Analog : [], 139 | 140 | // Other categries of pins, the labels you use here are 141 | // arbitrary, Serial, SPI and I2C will get coloured labels 142 | // others are just white. 143 | Peripherals: 144 | { 145 | Serial : {TX: 1, RX: 3}, 146 | Programmer : {DATA: 1, CLK: 3}, 147 | } 148 | 149 | }, 150 | { 151 | Name : 'ATtiny 24/44/84', 152 | Package: '2SIDED' , 153 | Pins : 14 , 154 | Programmer: 'ISP', 155 | 156 | PRC : { Vcc:1, Gnd:14, Reset: 4, XTAL1: 2, XTAL2: 3, Interrupt: [5]}, 157 | PWM : [5,6,7,8], 158 | Digital: [13,12,11,10,9,8,7,6,5,3,2,4], 159 | Analog : [13,12,11,10,9,8,7,6], 160 | 161 | Peripherals: 162 | { 163 | Serial : {TX: 12, RX: 11}, 164 | Programmer : {MOSI: 7, MISO: 8, SCK: 9}, 165 | SPI : {MOSI: 8, MISO: 7, SCK: 9}, 166 | I2C : {SDA: 7, SCL: 9} 167 | } 168 | 169 | }, 170 | 171 | { 172 | Name : 'ATtiny 24/44/84 A0=D10 Variant', 173 | Package: '2SIDED' , 174 | Pins : 14 , 175 | Programmer: 'ISP', 176 | 177 | PRC : { Vcc:1, Gnd:14, Reset: 4, XTAL1: 2, XTAL2: 3, Interrupt: [5]}, 178 | PWM : [5,6,7,8], 179 | Digital: [2,3,5,6,7,8,9,10,11,12,13,4], 180 | Analog : [13,12,11,10,9,8,7,6], 181 | 182 | Peripherals: 183 | { 184 | Serial : {TX: 12, RX: 11}, 185 | Programmer : {MOSI: 7, MISO: 8, SCK: 9}, 186 | SPI : {MOSI: 8, MISO: 7, SCK: 9}, 187 | I2C : {SDA: 7, SCL: 9} 188 | } 189 | 190 | }, 191 | { 192 | Name : 'ATtiny 25/45/85', 193 | Package: '2SIDED' , 194 | Pins : 8 , 195 | Programmer: 'ISP', 196 | 197 | PRC : { Vcc:8, Gnd:4, Reset: 1, XTAL1: 2, XTAL2: 3, Interrupt: [7]}, // PRC = Power, Reset and Clock 198 | PWM : [5,6,3], 199 | Digital: [5,6,7,2,3,1], 200 | Analog : [1,7,3,2], 201 | 202 | Peripherals: 203 | { 204 | Serial : {TX: 5, RX: 6}, 205 | Programmer : {MOSI: 5, MISO: 6, SCK: 7}, 206 | SPI : {MOSI: 6, MISO: 5, SCK: 7}, 207 | I2C : {SDA: 5, SCL: 7} 208 | } 209 | 210 | }, 211 | 212 | 213 | { 214 | Name : 'ATMega 48/88/168/328 (DIP)', 215 | Package: '2SIDED' , 216 | Pins : 28 , 217 | 218 | PRC : { Vcc:[7,20], Gnd:[8,22], Reset: 1, XTAL1: 9, XTAL2: 10, AREF:21, Interrupt: [4,5]}, // PRC = Power, Reset and Clock 219 | PWM : [5,11,12,15,16,17], 220 | Digital: [2,3,4,5,6,11,12,13,14,15,16,17,18,19,23,24,25,26,27,28], 221 | Analog : [23,24,25,26,27,28], 222 | 223 | Peripherals: 224 | { 225 | Serial : {TX: 3, RX: 2}, 226 | SPI : {MOSI: 17, MISO: 18, SCK: 19}, 227 | I2C : {SDA: 27, SCL: 28} 228 | } 229 | 230 | }, 231 | 232 | 233 | { 234 | Name : 'ATMega 48/88/168/328 (QFP/MLF32)', 235 | Package: '4SIDED' , 236 | Pins : 32 , 237 | 238 | PRC : { Vcc:[4,6,], AVcc: 18, Gnd:[3,5,21], Reset: 29, XTAL1: 7, XTAL2: 8, AREF:20, Interrupt: [32,1]}, // PRC = Power, Reset and Clock 239 | PWM : [1,9,10,13,14,15], 240 | Digital: [30,31,32,1,2,9,10,11,12,13,14,15,16,17,23,24,25,26,27,28], 241 | Analog : [23,24,25,26,27,28,19,22], 242 | 243 | 244 | Peripherals: 245 | { 246 | Serial : {TX: 31, RX: 30}, 247 | SPI : {MOSI: 15, MISO: 16, SCK: 17}, 248 | I2C : {SDA: 27, SCL: 28} 249 | } 250 | 251 | }, 252 | 253 | 254 | { 255 | Name : 'ATMega 48/88/168/328 (MLF28)', 256 | Package: '4SIDED' , 257 | Pins : 28 , 258 | 259 | PRC : { Vcc:[3], AVcc: 16, Gnd:[4,18], Reset: 25, XTAL1: 5, XTAL2: 6, AREF:17, Interrupt: [28,1]}, // Closest labels to chip 260 | PWM : [1,7,8,11,12,13], 261 | Digital: [26,27,28,1,2,7,8,9,10,11,12,13,14,15,19,20,21,22,23,24], 262 | Analog : [19,20,21,22,23,24], 263 | 264 | Peripherals: 265 | { 266 | Serial : {TX: 27, RX: 26}, 267 | SPI : {MOSI: 13, MISO: 14, SCK: 15}, 268 | I2C : {SDA: 23, SCL: 24} 269 | } 270 | 271 | }, 272 | 273 | 274 | { 275 | Name : 'ATtiny828', 276 | Package: '4SIDED' , 277 | Pins : 32 , 278 | 279 | PRC : { Vcc:[4], AVcc: 18, Gnd:[5,21], Reset: 29, CLKI: 6, Interrupt: [32,1]}, // Closest labels to chip 280 | PWM : [3,6,7,31], 281 | Digital: [9,10,11,12,13,14,15,16,17,19,20,22,23,24,25,26,27,28,29,30,31,32,1,2,3,6,7,8], 282 | Analog : [9,10,11,12,13,14,15,16,17,19,20,22,23,24,25,26,31,32,1,2,3,6,7,8,27,28,29,30], 283 | 284 | Peripherals: 285 | { 286 | Serial : {TX: 2, RX: 1}, 287 | SPI : {MOSI: 27, MISO: 28, SCK: 30, SS: 31}, 288 | I2C : {SDA: 27, SCL: 30} 289 | }, 290 | 291 | "VerticalPinsOffset": { 292 | "top": "-52", 293 | "left": "-7" 294 | }, 295 | "VerticalPinsMargin": { 296 | "top": "290", 297 | "bottom": "256" 298 | } 299 | } 300 | 301 | 302 | 303 | ]; 304 | -------------------------------------------------------------------------------- /tiny4,9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sleemanj/ArduinoOrientedChipPinoutCreator/fcbb550b228ac05cd2431d088f6923cf2730f129/tiny4,9.jpg -------------------------------------------------------------------------------- /tiny4,9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sleemanj/ArduinoOrientedChipPinoutCreator/fcbb550b228ac05cd2431d088f6923cf2730f129/tiny4,9.png -------------------------------------------------------------------------------- /tiny5,10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sleemanj/ArduinoOrientedChipPinoutCreator/fcbb550b228ac05cd2431d088f6923cf2730f129/tiny5,10.jpg -------------------------------------------------------------------------------- /tiny5,10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sleemanj/ArduinoOrientedChipPinoutCreator/fcbb550b228ac05cd2431d088f6923cf2730f129/tiny5,10.png -------------------------------------------------------------------------------- /tiny828.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sleemanj/ArduinoOrientedChipPinoutCreator/fcbb550b228ac05cd2431d088f6923cf2730f129/tiny828.jpg -------------------------------------------------------------------------------- /x4-alt.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sleemanj/ArduinoOrientedChipPinoutCreator/fcbb550b228ac05cd2431d088f6923cf2730f129/x4-alt.jpg -------------------------------------------------------------------------------- /x4-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sleemanj/ArduinoOrientedChipPinoutCreator/fcbb550b228ac05cd2431d088f6923cf2730f129/x4-alt.png -------------------------------------------------------------------------------- /x4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sleemanj/ArduinoOrientedChipPinoutCreator/fcbb550b228ac05cd2431d088f6923cf2730f129/x4.jpg -------------------------------------------------------------------------------- /x4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sleemanj/ArduinoOrientedChipPinoutCreator/fcbb550b228ac05cd2431d088f6923cf2730f129/x4.png -------------------------------------------------------------------------------- /x5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sleemanj/ArduinoOrientedChipPinoutCreator/fcbb550b228ac05cd2431d088f6923cf2730f129/x5.jpg -------------------------------------------------------------------------------- /x5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sleemanj/ArduinoOrientedChipPinoutCreator/fcbb550b228ac05cd2431d088f6923cf2730f129/x5.png --------------------------------------------------------------------------------