This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var script = document.createElement("script"); | |
| script.src = "all_20100426.js"; | |
| document.documentElement.firstChild.appendChild(script); | |
| var mod = { | |
| buffer: []; | |
| } | |
| var inline_script = 'some_inline scripts'; | |
| //more inline scripts... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var preload; | |
| if ( /*@cc_on!@*/ false) { // IE sniffing with conditional comments | |
| preload = function (file) { | |
| new Image().src = file; | |
| }; | |
| } else { | |
| preload = function (file) { | |
| var obj = document.createElement('object'), | |
| body = document.body; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var store = { | |
| nextId: 1, | |
| cache: {}, | |
| add: function (fn) { | |
| if (!fn.id) { | |
| fn.id = this.nextId; | |
| this.nextId += 1; | |
| return !!(this.cache[fn.id] = fn); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var store = (function () { | |
| var nextId = 1, | |
| cache = {}; | |
| return { | |
| addFn: function (fn) { | |
| if (!fn.id) { | |
| fn.id = nextId; | |
| nextId += 1; | |
| return !!(cache[fn.id] = fn); | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isPrime(value) { | |
| if (!isPrime.anwers) isPrime.answers = {}; | |
| if (isPrime.answers[value] != null) { | |
| return isPrime.answers[value]; | |
| } | |
| var prime = value != 1; // 1 can never be prime | |
| for (var i = 2; i < value; i++) { | |
| if (value % i == 0) { | |
| prime = false; | |
| break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function animateIt(elementId) { | |
| var elem = document.getElementById(elementId); | |
| var tick = 0; | |
| var timer = setInterval(function () { | |
| if (tick < 100) { | |
| elem.style.left = elem.style.top = tick + "px"; | |
| tick++; | |
| } else { | |
| clearInterval(timer); | |
| assert(tick == 100, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function add(x, y) { | |
| if (typeof y === "undefined") { // partial | |
| return function (y) { | |
| return x + y; | |
| }; | |
| } | |
| // full application | |
| return x + y; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function schonfinkelize(fn) { | |
| var slice = Array.prototype.slice, | |
| stored_args = slice.call(arguments, 1); | |
| return function () { | |
| var new_args = slice.call(arguments), | |
| args = stored_args.concat(new_args); | |
| return fn.apply(null, args); | |
| }; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function.prototype.memoized = function (key) { | |
| this._values = this._values || {}; | |
| return this._values[key] !== undefined ? this._values[key] : this._values[key] = this.apply(this, arguments); | |
| }; | |
| Function.prototype.memoize = function () { | |
| var fn = this; | |
| return function () { | |
| return fn.memoized.apply(fn, arguments); | |
| }; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function wrap(object, method, wrapper) { | |
| var fn = object[method]; | |
| return object[method] = function () { | |
| return wrapper.apply(this, [fn.bind(this)].concat( | |
| Array.prototype.slice.call(arguments))); | |
| }; | |
| } | |
| if (Prototype.Browser.Opera) { | |
| wrap(Element.Methods, "readAttribute", |