Get off off rails-assets
Just moving the things we currently use (and should drop in the ASAP) to vendor/assets
This commit is contained in:
parent
9fd0807a9a
commit
b6560dbb34
659 changed files with 129299 additions and 67 deletions
155
vendor/assets/javascripts/holderjs/src/lib/vendor/ondomready.js
vendored
Normal file
155
vendor/assets/javascripts/holderjs/src/lib/vendor/ondomready.js
vendored
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
/*!
|
||||
* onDomReady.js 1.4.0 (c) 2013 Tubal Martin - MIT license
|
||||
*
|
||||
* Specially modified to work with Holder.js
|
||||
*/
|
||||
|
||||
function _onDomReady(win) {
|
||||
//Lazy loading fix for Firefox < 3.6
|
||||
//http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html
|
||||
if (document.readyState == null && document.addEventListener) {
|
||||
document.addEventListener("DOMContentLoaded", function DOMContentLoaded() {
|
||||
document.removeEventListener("DOMContentLoaded", DOMContentLoaded, false);
|
||||
document.readyState = "complete";
|
||||
}, false);
|
||||
document.readyState = "loading";
|
||||
}
|
||||
|
||||
var doc = win.document,
|
||||
docElem = doc.documentElement,
|
||||
|
||||
LOAD = "load",
|
||||
FALSE = false,
|
||||
ONLOAD = "on"+LOAD,
|
||||
COMPLETE = "complete",
|
||||
READYSTATE = "readyState",
|
||||
ATTACHEVENT = "attachEvent",
|
||||
DETACHEVENT = "detachEvent",
|
||||
ADDEVENTLISTENER = "addEventListener",
|
||||
DOMCONTENTLOADED = "DOMContentLoaded",
|
||||
ONREADYSTATECHANGE = "onreadystatechange",
|
||||
REMOVEEVENTLISTENER = "removeEventListener",
|
||||
|
||||
// W3C Event model
|
||||
w3c = ADDEVENTLISTENER in doc,
|
||||
_top = FALSE,
|
||||
|
||||
// isReady: Is the DOM ready to be used? Set to true once it occurs.
|
||||
isReady = FALSE,
|
||||
|
||||
// Callbacks pending execution until DOM is ready
|
||||
callbacks = [];
|
||||
|
||||
// Handle when the DOM is ready
|
||||
function ready( fn ) {
|
||||
if ( !isReady ) {
|
||||
|
||||
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
|
||||
if ( !doc.body ) {
|
||||
return defer( ready );
|
||||
}
|
||||
|
||||
// Remember that the DOM is ready
|
||||
isReady = true;
|
||||
|
||||
// Execute all callbacks
|
||||
while ( fn = callbacks.shift() ) {
|
||||
defer( fn );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The ready event handler
|
||||
function completed( event ) {
|
||||
// readyState === "complete" is good enough for us to call the dom ready in oldIE
|
||||
if ( w3c || event.type === LOAD || doc[READYSTATE] === COMPLETE ) {
|
||||
detach();
|
||||
ready();
|
||||
}
|
||||
}
|
||||
|
||||
// Clean-up method for dom ready events
|
||||
function detach() {
|
||||
if ( w3c ) {
|
||||
doc[REMOVEEVENTLISTENER]( DOMCONTENTLOADED, completed, FALSE );
|
||||
win[REMOVEEVENTLISTENER]( LOAD, completed, FALSE );
|
||||
} else {
|
||||
doc[DETACHEVENT]( ONREADYSTATECHANGE, completed );
|
||||
win[DETACHEVENT]( ONLOAD, completed );
|
||||
}
|
||||
}
|
||||
|
||||
// Defers a function, scheduling it to run after the current call stack has cleared.
|
||||
function defer( fn, wait ) {
|
||||
// Allow 0 to be passed
|
||||
setTimeout( fn, +wait >= 0 ? wait : 1 );
|
||||
}
|
||||
|
||||
// Attach the listeners:
|
||||
|
||||
// Catch cases where onDomReady is called after the browser event has already occurred.
|
||||
// we once tried to use readyState "interactive" here, but it caused issues like the one
|
||||
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
|
||||
if ( doc[READYSTATE] === COMPLETE ) {
|
||||
// Handle it asynchronously to allow scripts the opportunity to delay ready
|
||||
defer( ready );
|
||||
|
||||
// Standards-based browsers support DOMContentLoaded
|
||||
} else if ( w3c ) {
|
||||
// Use the handy event callback
|
||||
doc[ADDEVENTLISTENER]( DOMCONTENTLOADED, completed, FALSE );
|
||||
|
||||
// A fallback to window.onload, that will always work
|
||||
win[ADDEVENTLISTENER]( LOAD, completed, FALSE );
|
||||
|
||||
// If IE event model is used
|
||||
} else {
|
||||
// Ensure firing before onload, maybe late but safe also for iframes
|
||||
doc[ATTACHEVENT]( ONREADYSTATECHANGE, completed );
|
||||
|
||||
// A fallback to window.onload, that will always work
|
||||
win[ATTACHEVENT]( ONLOAD, completed );
|
||||
|
||||
// If IE and not a frame
|
||||
// continually check to see if the document is ready
|
||||
try {
|
||||
_top = win.frameElement == null && docElem;
|
||||
} catch(e) {}
|
||||
|
||||
if ( _top && _top.doScroll ) {
|
||||
(function doScrollCheck() {
|
||||
if ( !isReady ) {
|
||||
try {
|
||||
// Use the trick by Diego Perini
|
||||
// http://javascript.nwbox.com/IEContentLoaded/
|
||||
_top.doScroll("left");
|
||||
} catch(e) {
|
||||
return defer( doScrollCheck, 50 );
|
||||
}
|
||||
|
||||
// detach all dom ready events
|
||||
detach();
|
||||
|
||||
// and execute any waiting functions
|
||||
ready();
|
||||
}
|
||||
})();
|
||||
}
|
||||
}
|
||||
|
||||
function onDomReady( fn ) {
|
||||
// If DOM is ready, execute the function (async), otherwise wait
|
||||
isReady ? defer( fn ) : callbacks.push( fn );
|
||||
}
|
||||
|
||||
// Add version
|
||||
onDomReady.version = "1.4.0";
|
||||
// Add method to check if DOM is ready
|
||||
onDomReady.isReady = function(){
|
||||
return isReady;
|
||||
};
|
||||
|
||||
return onDomReady;
|
||||
}
|
||||
|
||||
module.exports = typeof window !== "undefined" && _onDomReady(window);
|
||||
234
vendor/assets/javascripts/holderjs/src/lib/vendor/polyfills.js
vendored
Normal file
234
vendor/assets/javascripts/holderjs/src/lib/vendor/polyfills.js
vendored
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
(function (window) {
|
||||
if (!window.document) return;
|
||||
var document = window.document;
|
||||
|
||||
//https://github.com/inexorabletash/polyfill/blob/master/web.js
|
||||
if (!document.querySelectorAll) {
|
||||
document.querySelectorAll = function (selectors) {
|
||||
var style = document.createElement('style'), elements = [], element;
|
||||
document.documentElement.firstChild.appendChild(style);
|
||||
document._qsa = [];
|
||||
|
||||
style.styleSheet.cssText = selectors + '{x-qsa:expression(document._qsa && document._qsa.push(this))}';
|
||||
window.scrollBy(0, 0);
|
||||
style.parentNode.removeChild(style);
|
||||
|
||||
while (document._qsa.length) {
|
||||
element = document._qsa.shift();
|
||||
element.style.removeAttribute('x-qsa');
|
||||
elements.push(element);
|
||||
}
|
||||
document._qsa = null;
|
||||
return elements;
|
||||
};
|
||||
}
|
||||
|
||||
if (!document.querySelector) {
|
||||
document.querySelector = function (selectors) {
|
||||
var elements = document.querySelectorAll(selectors);
|
||||
return (elements.length) ? elements[0] : null;
|
||||
};
|
||||
}
|
||||
|
||||
if (!document.getElementsByClassName) {
|
||||
document.getElementsByClassName = function (classNames) {
|
||||
classNames = String(classNames).replace(/^|\s+/g, '.');
|
||||
return document.querySelectorAll(classNames);
|
||||
};
|
||||
}
|
||||
|
||||
//https://github.com/inexorabletash/polyfill
|
||||
// ES5 15.2.3.14 Object.keys ( O )
|
||||
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/keys
|
||||
if (!Object.keys) {
|
||||
Object.keys = function (o) {
|
||||
if (o !== Object(o)) { throw TypeError('Object.keys called on non-object'); }
|
||||
var ret = [], p;
|
||||
for (p in o) {
|
||||
if (Object.prototype.hasOwnProperty.call(o, p)) {
|
||||
ret.push(p);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
// ES5 15.4.4.18 Array.prototype.forEach ( callbackfn [ , thisArg ] )
|
||||
// From https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/forEach
|
||||
if (!Array.prototype.forEach) {
|
||||
Array.prototype.forEach = function (fun /*, thisp */) {
|
||||
if (this === void 0 || this === null) { throw TypeError(); }
|
||||
|
||||
var t = Object(this);
|
||||
var len = t.length >>> 0;
|
||||
if (typeof fun !== "function") { throw TypeError(); }
|
||||
|
||||
var thisp = arguments[1], i;
|
||||
for (i = 0; i < len; i++) {
|
||||
if (i in t) {
|
||||
fun.call(thisp, t[i], i, t);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//https://github.com/inexorabletash/polyfill/blob/master/web.js
|
||||
(function (global) {
|
||||
var B64_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
||||
global.atob = global.atob || function (input) {
|
||||
input = String(input);
|
||||
var position = 0,
|
||||
output = [],
|
||||
buffer = 0, bits = 0, n;
|
||||
|
||||
input = input.replace(/\s/g, '');
|
||||
if ((input.length % 4) === 0) { input = input.replace(/=+$/, ''); }
|
||||
if ((input.length % 4) === 1) { throw Error('InvalidCharacterError'); }
|
||||
if (/[^+/0-9A-Za-z]/.test(input)) { throw Error('InvalidCharacterError'); }
|
||||
|
||||
while (position < input.length) {
|
||||
n = B64_ALPHABET.indexOf(input.charAt(position));
|
||||
buffer = (buffer << 6) | n;
|
||||
bits += 6;
|
||||
|
||||
if (bits === 24) {
|
||||
output.push(String.fromCharCode((buffer >> 16) & 0xFF));
|
||||
output.push(String.fromCharCode((buffer >> 8) & 0xFF));
|
||||
output.push(String.fromCharCode(buffer & 0xFF));
|
||||
bits = 0;
|
||||
buffer = 0;
|
||||
}
|
||||
position += 1;
|
||||
}
|
||||
|
||||
if (bits === 12) {
|
||||
buffer = buffer >> 4;
|
||||
output.push(String.fromCharCode(buffer & 0xFF));
|
||||
} else if (bits === 18) {
|
||||
buffer = buffer >> 2;
|
||||
output.push(String.fromCharCode((buffer >> 8) & 0xFF));
|
||||
output.push(String.fromCharCode(buffer & 0xFF));
|
||||
}
|
||||
|
||||
return output.join('');
|
||||
};
|
||||
|
||||
global.btoa = global.btoa || function (input) {
|
||||
input = String(input);
|
||||
var position = 0,
|
||||
out = [],
|
||||
o1, o2, o3,
|
||||
e1, e2, e3, e4;
|
||||
|
||||
if (/[^\x00-\xFF]/.test(input)) { throw Error('InvalidCharacterError'); }
|
||||
|
||||
while (position < input.length) {
|
||||
o1 = input.charCodeAt(position++);
|
||||
o2 = input.charCodeAt(position++);
|
||||
o3 = input.charCodeAt(position++);
|
||||
|
||||
// 111111 112222 222233 333333
|
||||
e1 = o1 >> 2;
|
||||
e2 = ((o1 & 0x3) << 4) | (o2 >> 4);
|
||||
e3 = ((o2 & 0xf) << 2) | (o3 >> 6);
|
||||
e4 = o3 & 0x3f;
|
||||
|
||||
if (position === input.length + 2) {
|
||||
e3 = 64; e4 = 64;
|
||||
}
|
||||
else if (position === input.length + 1) {
|
||||
e4 = 64;
|
||||
}
|
||||
|
||||
out.push(B64_ALPHABET.charAt(e1),
|
||||
B64_ALPHABET.charAt(e2),
|
||||
B64_ALPHABET.charAt(e3),
|
||||
B64_ALPHABET.charAt(e4));
|
||||
}
|
||||
|
||||
return out.join('');
|
||||
};
|
||||
}(window));
|
||||
|
||||
//https://gist.github.com/jimeh/332357
|
||||
if (!Object.prototype.hasOwnProperty){
|
||||
/*jshint -W001, -W103 */
|
||||
Object.prototype.hasOwnProperty = function(prop) {
|
||||
var proto = this.__proto__ || this.constructor.prototype;
|
||||
return (prop in this) && (!(prop in proto) || proto[prop] !== this[prop]);
|
||||
};
|
||||
/*jshint +W001, +W103 */
|
||||
}
|
||||
|
||||
// @license http://opensource.org/licenses/MIT
|
||||
// copyright Paul Irish 2015
|
||||
|
||||
|
||||
// Date.now() is supported everywhere except IE8. For IE8 we use the Date.now polyfill
|
||||
// github.com/Financial-Times/polyfill-service/blob/master/polyfills/Date.now/polyfill.js
|
||||
// as Safari 6 doesn't have support for NavigationTiming, we use a Date.now() timestamp for relative values
|
||||
|
||||
// if you want values similar to what you'd get with real perf.now, place this towards the head of the page
|
||||
// but in reality, you're just getting the delta between now() calls, so it's not terribly important where it's placed
|
||||
|
||||
|
||||
(function(){
|
||||
|
||||
if ('performance' in window === false) {
|
||||
window.performance = {};
|
||||
}
|
||||
|
||||
Date.now = (Date.now || function () { // thanks IE8
|
||||
return new Date().getTime();
|
||||
});
|
||||
|
||||
if ('now' in window.performance === false){
|
||||
|
||||
var nowOffset = Date.now();
|
||||
|
||||
if (performance.timing && performance.timing.navigationStart){
|
||||
nowOffset = performance.timing.navigationStart;
|
||||
}
|
||||
|
||||
window.performance.now = function now(){
|
||||
return Date.now() - nowOffset;
|
||||
};
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
//requestAnimationFrame polyfill for older Firefox/Chrome versions
|
||||
if (!window.requestAnimationFrame) {
|
||||
if (window.webkitRequestAnimationFrame && window.webkitCancelAnimationFrame) {
|
||||
//https://github.com/Financial-Times/polyfill-service/blob/master/polyfills/requestAnimationFrame/polyfill-webkit.js
|
||||
(function (global) {
|
||||
global.requestAnimationFrame = function (callback) {
|
||||
return webkitRequestAnimationFrame(function () {
|
||||
callback(global.performance.now());
|
||||
});
|
||||
};
|
||||
|
||||
global.cancelAnimationFrame = global.webkitCancelAnimationFrame;
|
||||
}(window));
|
||||
} else if (window.mozRequestAnimationFrame && window.mozCancelAnimationFrame) {
|
||||
//https://github.com/Financial-Times/polyfill-service/blob/master/polyfills/requestAnimationFrame/polyfill-moz.js
|
||||
(function (global) {
|
||||
global.requestAnimationFrame = function (callback) {
|
||||
return mozRequestAnimationFrame(function () {
|
||||
callback(global.performance.now());
|
||||
});
|
||||
};
|
||||
|
||||
global.cancelAnimationFrame = global.mozCancelAnimationFrame;
|
||||
}(window));
|
||||
} else {
|
||||
(function (global) {
|
||||
global.requestAnimationFrame = function (callback) {
|
||||
return global.setTimeout(callback, 1000 / 60);
|
||||
};
|
||||
|
||||
global.cancelAnimationFrame = global.clearTimeout;
|
||||
})(window);
|
||||
}
|
||||
}
|
||||
})(this);
|
||||
102
vendor/assets/javascripts/holderjs/src/lib/vendor/querystring.js
vendored
Normal file
102
vendor/assets/javascripts/holderjs/src/lib/vendor/querystring.js
vendored
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
//Modified version of component/querystring
|
||||
//Changes: updated dependencies, dot notation parsing, JSHint fixes
|
||||
//Fork at https://github.com/imsky/querystring
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var encode = encodeURIComponent;
|
||||
var decode = decodeURIComponent;
|
||||
var trim = require('trim');
|
||||
var type = require('component-type');
|
||||
|
||||
var arrayRegex = /(\w+)\[(\d+)\]/;
|
||||
var objectRegex = /\w+\.\w+/;
|
||||
|
||||
/**
|
||||
* Parse the given query `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {Object}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.parse = function(str){
|
||||
if ('string' !== typeof str) return {};
|
||||
|
||||
str = trim(str);
|
||||
if ('' === str) return {};
|
||||
if ('?' === str.charAt(0)) str = str.slice(1);
|
||||
|
||||
var obj = {};
|
||||
var pairs = str.split('&');
|
||||
for (var i = 0; i < pairs.length; i++) {
|
||||
var parts = pairs[i].split('=');
|
||||
var key = decode(parts[0]);
|
||||
var m, ctx, prop;
|
||||
|
||||
if (m = arrayRegex.exec(key)) {
|
||||
obj[m[1]] = obj[m[1]] || [];
|
||||
obj[m[1]][m[2]] = decode(parts[1]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m = objectRegex.test(key)) {
|
||||
m = key.split('.');
|
||||
ctx = obj;
|
||||
|
||||
while (m.length) {
|
||||
prop = m.shift();
|
||||
|
||||
if (!prop.length) continue;
|
||||
|
||||
if (!ctx[prop]) {
|
||||
ctx[prop] = {};
|
||||
} else if (ctx[prop] && typeof ctx[prop] !== 'object') {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!m.length) {
|
||||
ctx[prop] = decode(parts[1]);
|
||||
}
|
||||
|
||||
ctx = ctx[prop];
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
obj[parts[0]] = null == parts[1] ? '' : decode(parts[1]);
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
/**
|
||||
* Stringify the given `obj`.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @return {String}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.stringify = function(obj){
|
||||
if (!obj) return '';
|
||||
var pairs = [];
|
||||
|
||||
for (var key in obj) {
|
||||
var value = obj[key];
|
||||
|
||||
if ('array' == type(value)) {
|
||||
for (var i = 0; i < value.length; ++i) {
|
||||
pairs.push(encode(key + '[' + i + ']') + '=' + encode(value[i]));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
pairs.push(encode(key) + '=' + encode(obj[key]));
|
||||
}
|
||||
|
||||
return pairs.join('&');
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue