elemes/frontend/static/circuitjs1/circuitjs1/circuitjs1.nocache.js

458 lines
14 KiB
JavaScript

function circuitjs1(){
var $wnd_0 = window;
var $doc_0 = document;
sendStats('bootstrap', 'begin');
function isHostedMode(){
var query = $wnd_0.location.search;
return query.indexOf('gwt.codesvr.circuitjs1=') != -1 || query.indexOf('gwt.codesvr=') != -1;
}
function sendStats(evtGroupString, typeString){
if ($wnd_0.__gwtStatsEvent) {
$wnd_0.__gwtStatsEvent({moduleName:'circuitjs1', sessionId:$wnd_0.__gwtStatsSessionId, subSystem:'startup', evtGroup:evtGroupString, millis:(new Date).getTime(), type:typeString});
}
}
circuitjs1.__sendStats = sendStats;
circuitjs1.__moduleName = 'circuitjs1';
circuitjs1.__errFn = null;
circuitjs1.__moduleBase = 'DUMMY';
circuitjs1.__softPermutationId = 0;
circuitjs1.__computePropValue = null;
circuitjs1.__getPropMap = null;
circuitjs1.__installRunAsyncCode = function(){
}
;
circuitjs1.__gwtStartLoadingFragment = function(){
return null;
}
;
circuitjs1.__gwt_isKnownPropertyValue = function(){
return false;
}
;
circuitjs1.__gwt_getMetaProperty = function(){
return null;
}
;
var __propertyErrorFunction = null;
var activeModules = $wnd_0.__gwt_activeModules = $wnd_0.__gwt_activeModules || {};
activeModules['circuitjs1'] = {moduleName:'circuitjs1'};
circuitjs1.__moduleStartupDone = function(permProps){
var oldBindings = activeModules['circuitjs1'].bindings;
activeModules['circuitjs1'].bindings = function(){
var props = oldBindings?oldBindings():{};
var embeddedProps = permProps[circuitjs1.__softPermutationId];
for (var i = 0; i < embeddedProps.length; i++) {
var pair = embeddedProps[i];
props[pair[0]] = pair[1];
}
return props;
}
;
}
;
var frameDoc;
function getInstallLocationDoc(){
setupInstallLocation();
return frameDoc;
}
function setupInstallLocation(){
if (frameDoc) {
return;
}
var scriptFrame = $doc_0.createElement('iframe');
scriptFrame.id = 'circuitjs1';
scriptFrame.style.cssText = 'position:absolute; width:0; height:0; border:none; left: -1000px;' + ' top: -1000px;';
scriptFrame.tabIndex = -1;
$doc_0.body.appendChild(scriptFrame);
frameDoc = scriptFrame.contentWindow.document;
frameDoc.open();
var doctype = document.compatMode == 'CSS1Compat'?'<!doctype html>':'';
frameDoc.write(doctype + '<html><head><\/head><body><\/body><\/html>');
frameDoc.close();
}
function installScript(filename){
function setupWaitForBodyLoad(callback){
function isBodyLoaded(){
if (typeof $doc_0.readyState == 'undefined') {
return typeof $doc_0.body != 'undefined' && $doc_0.body != null;
}
return /loaded|complete/.test($doc_0.readyState);
}
var bodyDone = isBodyLoaded();
if (bodyDone) {
callback();
return;
}
function checkBodyDone(){
if (!bodyDone) {
if (!isBodyLoaded()) {
return;
}
bodyDone = true;
callback();
if ($doc_0.removeEventListener) {
$doc_0.removeEventListener('readystatechange', checkBodyDone, false);
}
if (onBodyDoneTimerId) {
clearInterval(onBodyDoneTimerId);
}
}
}
if ($doc_0.addEventListener) {
$doc_0.addEventListener('readystatechange', checkBodyDone, false);
}
var onBodyDoneTimerId = setInterval(function(){
checkBodyDone();
}
, 10);
}
function installCode(code_0){
var doc = getInstallLocationDoc();
var docbody = doc.body;
var script = doc.createElement('script');
script.language = 'javascript';
script.src = code_0;
if (circuitjs1.__errFn) {
script.onerror = function(){
circuitjs1.__errFn('circuitjs1', new Error('Failed to load ' + code_0));
}
;
}
docbody.appendChild(script);
sendStats('moduleStartup', 'scriptTagAdded');
}
sendStats('moduleStartup', 'moduleRequested');
setupWaitForBodyLoad(function(){
installCode(filename);
}
);
}
circuitjs1.__startLoadingFragment = function(fragmentFile){
return computeUrlForResource(fragmentFile);
}
;
circuitjs1.__installRunAsyncCode = function(code_0){
var doc = getInstallLocationDoc();
var docbody = doc.body;
var script = doc.createElement('script');
script.language = 'javascript';
script.text = code_0;
docbody.appendChild(script);
}
;
function processMetas(){
var metaProps = {};
var propertyErrorFunc;
var onLoadErrorFunc;
var metas = $doc_0.getElementsByTagName('meta');
for (var i = 0, n = metas.length; i < n; ++i) {
var meta = metas[i], name_1 = meta.getAttribute('name'), content_0;
if (name_1) {
name_1 = name_1.replace('circuitjs1::', '');
if (name_1.indexOf('::') >= 0) {
continue;
}
if (name_1 == 'gwt:property') {
content_0 = meta.getAttribute('content');
if (content_0) {
var value_1, eq = content_0.indexOf('=');
if (eq >= 0) {
name_1 = content_0.substring(0, eq);
value_1 = content_0.substring(eq + 1);
}
else {
name_1 = content_0;
value_1 = '';
}
metaProps[name_1] = value_1;
}
}
else if (name_1 == 'gwt:onPropertyErrorFn') {
content_0 = meta.getAttribute('content');
if (content_0) {
try {
propertyErrorFunc = eval(content_0);
}
catch (e) {
alert('Bad handler "' + content_0 + '" for "gwt:onPropertyErrorFn"');
}
}
}
else if (name_1 == 'gwt:onLoadErrorFn') {
content_0 = meta.getAttribute('content');
if (content_0) {
try {
onLoadErrorFunc = eval(content_0);
}
catch (e) {
alert('Bad handler "' + content_0 + '" for "gwt:onLoadErrorFn"');
}
}
}
}
}
__gwt_getMetaProperty = function(name_0){
var value_0 = metaProps[name_0];
return value_0 == null?null:value_0;
}
;
__propertyErrorFunction = propertyErrorFunc;
circuitjs1.__errFn = onLoadErrorFunc;
}
function computeScriptBase(){
function getDirectoryOfFile(path){
var hashIndex = path.lastIndexOf('#');
if (hashIndex == -1) {
hashIndex = path.length;
}
var queryIndex = path.indexOf('?');
if (queryIndex == -1) {
queryIndex = path.length;
}
var slashIndex = path.lastIndexOf('/', Math.min(queryIndex, hashIndex));
return slashIndex >= 0?path.substring(0, slashIndex + 1):'';
}
function ensureAbsoluteUrl(url_0){
if (url_0.match(/^\w+:\/\//)) {
}
else {
var img = $doc_0.createElement('img');
img.src = url_0 + 'clear.cache.gif';
url_0 = getDirectoryOfFile(img.src);
}
return url_0;
}
function tryMetaTag(){
var metaVal = __gwt_getMetaProperty('baseUrl');
if (metaVal != null) {
return metaVal;
}
return '';
}
function tryNocacheJsTag(){
var scriptTags = $doc_0.getElementsByTagName('script');
for (var i = 0; i < scriptTags.length; ++i) {
if (scriptTags[i].src.indexOf('circuitjs1.nocache.js') != -1) {
return getDirectoryOfFile(scriptTags[i].src);
}
}
return '';
}
function tryBaseTag(){
var baseElements = $doc_0.getElementsByTagName('base');
if (baseElements.length > 0) {
return baseElements[baseElements.length - 1].href;
}
return '';
}
function isLocationOk(){
var loc = $doc_0.location;
return loc.href == loc.protocol + '//' + loc.host + loc.pathname + loc.search + loc.hash;
}
var tempBase = tryMetaTag();
if (tempBase == '') {
tempBase = tryNocacheJsTag();
}
if (tempBase == '') {
tempBase = tryBaseTag();
}
if (tempBase == '' && isLocationOk()) {
tempBase = getDirectoryOfFile($doc_0.location.href);
}
tempBase = ensureAbsoluteUrl(tempBase);
return tempBase;
}
function computeUrlForResource(resource){
if (resource.match(/^\//)) {
return resource;
}
if (resource.match(/^[a-zA-Z]+:\/\//)) {
return resource;
}
return circuitjs1.__moduleBase + resource;
}
function getCompiledCodeFilename(){
var answers = [];
var softPermutationId = 0;
function unflattenKeylistIntoAnswers(propValArray, value_0){
var answer = answers;
for (var i = 0, n = propValArray.length - 1; i < n; ++i) {
answer = answer[propValArray[i]] || (answer[propValArray[i]] = []);
}
answer[propValArray[n]] = value_0;
}
var values = [];
var providers = [];
function computePropValue(propName){
var value_0 = providers[propName](), allowedValuesMap = values[propName];
if (value_0 in allowedValuesMap) {
return value_0;
}
var allowedValuesList = [];
for (var k in allowedValuesMap) {
allowedValuesList[allowedValuesMap[k]] = k;
}
if (__propertyErrorFunction) {
__propertyErrorFunction(propName, allowedValuesList, value_0);
}
throw null;
}
providers['user.agent'] = function(){
var ua = navigator.userAgent.toLowerCase();
var docMode = $doc_0.documentMode;
if (function(){
return ua.indexOf('webkit') != -1;
}
())
return 'safari';
if (function(){
return ua.indexOf('msie') != -1 && (docMode >= 10 && docMode < 11);
}
())
return 'ie10';
if (function(){
return ua.indexOf('msie') != -1 && (docMode >= 9 && docMode < 11);
}
())
return 'ie9';
if (function(){
return ua.indexOf('msie') != -1 && (docMode >= 8 && docMode < 11);
}
())
return 'ie8';
if (function(){
return ua.indexOf('gecko') != -1 || docMode >= 11;
}
())
return 'gecko1_8';
return '';
}
;
values['user.agent'] = {'gecko1_8':0, 'ie10':1, 'ie8':2, 'ie9':3, 'safari':4};
__gwt_isKnownPropertyValue = function(propName, propValue){
return propValue in values[propName];
}
;
circuitjs1.__getPropMap = function(){
var result = {};
for (var key in values) {
if (values.hasOwnProperty(key)) {
result[key] = computePropValue(key);
}
}
return result;
}
;
circuitjs1.__computePropValue = computePropValue;
$wnd_0.__gwt_activeModules['circuitjs1'].bindings = circuitjs1.__getPropMap;
sendStats('bootstrap', 'selectingPermutation');
if (isHostedMode()) {
return computeUrlForResource('circuitjs1.devmode.js');
}
var strongName;
try {
unflattenKeylistIntoAnswers(['safari'], '36F1448B76FC86511C0BBCAC982CC49F');
unflattenKeylistIntoAnswers(['ie10'], '4A324BCBA35B59267855CFD03175A059');
unflattenKeylistIntoAnswers(['ie8'], 'A84B98CDB743F647DB2BC152EE2313B0');
unflattenKeylistIntoAnswers(['gecko1_8'], 'BF7FE971A936A4BA42E907B8A9853BD0');
unflattenKeylistIntoAnswers(['ie9'], 'E4FFF366B417914DB5B911B69626EC9D');
strongName = answers[computePropValue('user.agent')];
var idx = strongName.indexOf(':');
if (idx != -1) {
softPermutationId = parseInt(strongName.substring(idx + 1), 10);
strongName = strongName.substring(0, idx);
}
}
catch (e) {
}
circuitjs1.__softPermutationId = softPermutationId;
return computeUrlForResource(strongName + '.cache.js');
}
function loadExternalStylesheets(){
if (!$wnd_0.__gwt_stylesLoaded) {
$wnd_0.__gwt_stylesLoaded = {};
}
function installOneStylesheet(stylesheetUrl){
if (!__gwt_stylesLoaded[stylesheetUrl]) {
var l = $doc_0.createElement('link');
l.setAttribute('rel', 'stylesheet');
l.setAttribute('href', computeUrlForResource(stylesheetUrl));
$doc_0.getElementsByTagName('head')[0].appendChild(l);
__gwt_stylesLoaded[stylesheetUrl] = true;
}
}
sendStats('loadExternalRefs', 'begin');
installOneStylesheet('gwt/clean/clean.css');
installOneStylesheet('style.css');
sendStats('loadExternalRefs', 'end');
}
processMetas();
circuitjs1.__moduleBase = computeScriptBase();
activeModules['circuitjs1'].moduleBase = circuitjs1.__moduleBase;
var filename_0 = getCompiledCodeFilename();
if ($wnd_0) {
var devModePermitted = !!($wnd_0.location.protocol == 'http:' || $wnd_0.location.protocol == 'file:');
$wnd_0.__gwt_activeModules['circuitjs1'].canRedirect = devModePermitted;
function supportsSessionStorage(){
var key = '_gwt_dummy_';
try {
$wnd_0.sessionStorage.setItem(key, key);
$wnd_0.sessionStorage.removeItem(key);
return true;
}
catch (e) {
return false;
}
}
if (devModePermitted && supportsSessionStorage()) {
var devModeKey = '__gwtDevModeHook:circuitjs1';
var devModeUrl = $wnd_0.sessionStorage[devModeKey];
if (!/^http:\/\/(localhost|127\.0\.0\.1)(:\d+)?\/.*$/.test(devModeUrl)) {
if (devModeUrl && (window.console && console.log)) {
console.log('Ignoring non-whitelisted Dev Mode URL: ' + devModeUrl);
}
devModeUrl = '';
}
if (devModeUrl && !$wnd_0[devModeKey]) {
$wnd_0[devModeKey] = true;
$wnd_0[devModeKey + ':moduleBase'] = computeScriptBase();
var devModeScript = $doc_0.createElement('script');
devModeScript.src = devModeUrl;
var head = $doc_0.getElementsByTagName('head')[0];
head.insertBefore(devModeScript, head.firstElementChild || head.children[0]);
return false;
}
}
}
loadExternalStylesheets();
sendStats('bootstrap', 'end');
installScript(filename_0);
return true;
}
circuitjs1.succeeded = circuitjs1();