1/*! jQuery JSON plugin 2.4.0 | code.google.com/p/jquery-json */ 2(function($){'use strict';var escape=/["\\\x00-\x1f\x7f-\x9f]/g,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},hasOwn=Object.prototype.hasOwnProperty;$.toJSON=typeof JSON==='object'&&JSON.stringify?JSON.stringify:function(o){if(o===null){return'null';} 3var pairs,k,name,val,type=$.type(o);if(type==='undefined'){return undefined;} 4if(type==='number'||type==='boolean'){return String(o);} 5if(type==='string'){return $.quoteString(o);} 6if(typeof o.toJSON==='function'){return $.toJSON(o.toJSON());} 7if(type==='date'){var month=o.getUTCMonth()+1,day=o.getUTCDate(),year=o.getUTCFullYear(),hours=o.getUTCHours(),minutes=o.getUTCMinutes(),seconds=o.getUTCSeconds(),milli=o.getUTCMilliseconds();if(month<10){month='0'+month;} 8if(day<10){day='0'+day;} 9if(hours<10){hours='0'+hours;} 10if(minutes<10){minutes='0'+minutes;} 11if(seconds<10){seconds='0'+seconds;} 12if(milli<100){milli='0'+milli;} 13if(milli<10){milli='0'+milli;} 14return'"'+year+'-'+month+'-'+day+'T'+ 15hours+':'+minutes+':'+seconds+'.'+milli+'Z"';} 16pairs=[];if($.isArray(o)){for(k=0;k<o.length;k++){pairs.push($.toJSON(o[k])||'null');} 17return'['+pairs.join(',')+']';} 18if(typeof o==='object'){for(k in o){if(hasOwn.call(o,k)){type=typeof k;if(type==='number'){name='"'+k+'"';}else if(type==='string'){name=$.quoteString(k);}else{continue;} 19type=typeof o[k];if(type!=='function'&&type!=='undefined'){val=$.toJSON(o[k]);pairs.push(name+':'+val);}}} 20return'{'+pairs.join(',')+'}';}};$.evalJSON=typeof JSON==='object'&&JSON.parse?JSON.parse:function(str){return eval('('+str+')');};$.secureEvalJSON=typeof JSON==='object'&&JSON.parse?JSON.parse:function(str){var filtered=str.replace(/\\["\\\/bfnrtu]/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered)){return eval('('+str+')');} 21throw new SyntaxError('Error parsing JSON, source is not valid.');};$.quoteString=function(str){if(str.match(escape)){return'"'+str.replace(escape,function(a){var c=meta[a];if(typeof c==='string'){return c;} 22c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';} 23return'"'+str+'"';};}(jQuery));if(typeof String.prototype.trim !== 'function') { 24 String.prototype.trim = function() { 25 return this.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); 26 }; 27} 28var running = false; 29var api = function() { 30 return { 31 uri:'https://api.toc-goldratt.com', 32 sessionScript:undefined, 33 callback:undefined, 34 failure:undefined, 35 requireAdmin: false, 36 init:function() { 37 if( running === false ) { 38 // Fix for no transport error in ie 39 $.support.cors = true; 40 if( typeof autoLogin === 'undefined' || autoLogin === true ) { 41 // Check for sessions 42 if( typeof sessionData === 'undefined' ) { 43 setTimeout( api.session, 500 ); 44 } 45 setInterval( api.session, 20000 ); 46 } 47 running = true; 48 } 49 }, 50 logout:function( success, error ) { 51 var url = api.uri + '/user/logout'; 52 curl.request( url, 'POST', null, function() { 53 if( typeof success !== 'undefined' ) { 54 success( null ); 55 } else if( typeof api.callback !== 'undefined' ) { 56 api.callback( null ); 57 } else { 58 console.log( "Callback not set" ); 59 } 60 }, typeof error === 'undefined' ? api.failure : error ); 61 }, 62 session:function() { 63 // If disabled and is msie don't use api 64 var url = api.uri + '/user/session'; 65 var params = api.requireAdmin ? { require_admin: true } : null; 66 var method = params === null ? 'GET' : 'POST'; 67 return; 68 curl.request( url, method, params, function( data ) { 69 if( api.callback !== undefined && loggedIn === false ) { 70 api.callback( data ); 71 } 72 }, 73 function( data ) { 74 if( data.readyState !== 0 && data.status !== 0 ) { 75 if( typeof api.callback === 'function' && loggedIn === true ) { 76 api.callback( null ); 77 } 78 } 79 }); 80 } 81 }; 82}(); 83var curl = function() { 84 return { 85 connections: {}, 86 request:function( url, method, params, success, error, kill ) { 87 if( method === null ) { 88 method = 'GET'; 89 } 90 if( error === null ) { 91 error = curl.error; 92 } 93 if( kill === null ) { 94 kill = true; 95 } 96 var hash = url.split('?')[0]; 97 var loader = curl.connections[hash]; 98 if( kill !== false && typeof loader !== 'undefined' ) { 99 if( loader.readystate != 4 ) { 100 loader.abort(); 101 } 102 } 103 settings = { 104 type: method, 105 url: url, 106 cache: false, 107 crossDomain: true, 108 dataType: 'json', 109 xhrFields: { 110 withCredentials: true 111 }, 112 success: success, 113 error: error 114 }; 115 if( params !== null ) { 116 settings.processData = false; 117 settings.beforeSend = function(xhr) { 118 xhr.setRequestHeader("Content-type", "application/json; charset=utf-8"); 119 }; 120 settings.data = $.toJSON( params ); 121 } 122 curl.connections[hash] = $.ajax( settings ); 123 }, 124 error:function( data ) { 125 console.log( 'Failed ;-(' ); 126 //console.log( data ); 127 } 128 }; 129}(); 130var event = function( type, data ) { 131 return { 132 type: type, 133 data: data 134 }; 135}; 136if (typeof console == "undefined") { 137 window.console = { 138 log: function () {} 139 }; 140} 141if (typeof Console == "undefined") { 142 window.Console = { 143 log: function () {console.log( "Don't use this Console.log" ) } 144 }; 145}
146// Launch api code 147$(document).on( "ready", api.init );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.