react / wstein / node_modules / jest-cli / node_modules / coffee-script / lib / coffee-script / browser.js
80677 views// Generated by CoffeeScript 1.9.31(function() {2var CoffeeScript, compile, runScripts,3indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };45CoffeeScript = require('./coffee-script');67CoffeeScript.require = require;89compile = CoffeeScript.compile;1011CoffeeScript["eval"] = function(code, options) {12if (options == null) {13options = {};14}15if (options.bare == null) {16options.bare = true;17}18return eval(compile(code, options));19};2021CoffeeScript.run = function(code, options) {22if (options == null) {23options = {};24}25options.bare = true;26options.shiftLine = true;27return Function(compile(code, options))();28};2930if (typeof window === "undefined" || window === null) {31return;32}3334if ((typeof btoa !== "undefined" && btoa !== null) && (typeof JSON !== "undefined" && JSON !== null) && (typeof unescape !== "undefined" && unescape !== null) && (typeof encodeURIComponent !== "undefined" && encodeURIComponent !== null)) {35compile = function(code, options) {36var js, ref, v3SourceMap;37if (options == null) {38options = {};39}40options.sourceMap = true;41options.inline = true;42ref = CoffeeScript.compile(code, options), js = ref.js, v3SourceMap = ref.v3SourceMap;43return js + "\n//# sourceMappingURL=data:application/json;base64," + (btoa(unescape(encodeURIComponent(v3SourceMap)))) + "\n//# sourceURL=coffeescript";44};45}4647CoffeeScript.load = function(url, callback, options, hold) {48var xhr;49if (options == null) {50options = {};51}52if (hold == null) {53hold = false;54}55options.sourceFiles = [url];56xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP') : new window.XMLHttpRequest();57xhr.open('GET', url, true);58if ('overrideMimeType' in xhr) {59xhr.overrideMimeType('text/plain');60}61xhr.onreadystatechange = function() {62var param, ref;63if (xhr.readyState === 4) {64if ((ref = xhr.status) === 0 || ref === 200) {65param = [xhr.responseText, options];66if (!hold) {67CoffeeScript.run.apply(CoffeeScript, param);68}69} else {70throw new Error("Could not load " + url);71}72if (callback) {73return callback(param);74}75}76};77return xhr.send(null);78};7980runScripts = function() {81var coffees, coffeetypes, execute, fn, i, index, j, len, s, script, scripts;82scripts = window.document.getElementsByTagName('script');83coffeetypes = ['text/coffeescript', 'text/literate-coffeescript'];84coffees = (function() {85var j, len, ref, results;86results = [];87for (j = 0, len = scripts.length; j < len; j++) {88s = scripts[j];89if (ref = s.type, indexOf.call(coffeetypes, ref) >= 0) {90results.push(s);91}92}93return results;94})();95index = 0;96execute = function() {97var param;98param = coffees[index];99if (param instanceof Array) {100CoffeeScript.run.apply(CoffeeScript, param);101index++;102return execute();103}104};105fn = function(script, i) {106var options, source;107options = {108literate: script.type === coffeetypes[1]109};110source = script.src || script.getAttribute('data-src');111if (source) {112return CoffeeScript.load(source, function(param) {113coffees[i] = param;114return execute();115}, options, true);116} else {117options.sourceFiles = ['embedded'];118return coffees[i] = [script.innerHTML, options];119}120};121for (i = j = 0, len = coffees.length; j < len; i = ++j) {122script = coffees[i];123fn(script, i);124}125return execute();126};127128if (window.addEventListener) {129window.addEventListener('DOMContentLoaded', runScripts, false);130} else {131window.attachEvent('onload', runScripts);132}133134}).call(this);135136137