/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/assets/themes/j1/core/js"; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 2); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports) { var g; // This works in non-strict mode g = (function() { return this; })(); try { // This works if eval is allowed (see CSP) g = g || new Function("return this")(); } catch (e) { // This works if the window reference is available if (typeof window === "object") g = window; } // g can still be undefined, but nothing to do about it... // We return undefined, instead of nothing here, so it's // easier to handle this case. if(!global) { ...} module.exports = g; /***/ }), /* 1 */ /***/ (function(module, exports) { module.exports = { EN: 'English', DE: 'German', FR: 'French', ES: 'Spanish', IT: 'Italian', NL: 'Dutch', PL: 'Polish' }; /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { /* # ----------------------------------------------------------------------------- # ~/src/template.js # J1 Template Javascript Core library # # Product/Info: # https://jekyll.one # # Copyright (C) 2021 Juergen Adams # # J1 Template is licensed under the MIT License. # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE # # ----------------------------------------------------------------------------- */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint-disable no-unused-vars */ /* global window */ // ----------------------------------------------------------------------------- // Import SASS sources for HMR // ----------------------------------------------------------------------------- // import '../100_template_css/scss/theme_uno/components/_footer.scss'; // import '../100_template_css/theme_uno.css'; // <-- yes, also require (s)css. This is a Webpack thing // Core Libraries - imported|required from NODE|NPM modules // ----------------------------------------------------------------------------- // // Following objects (framework modules) are *conditionaly* forced to be // exposed for run-time to the global namespace (window) by WP config // file (expose-loader): // jQuery // Popper ('popper.js/dist/umd/popper', https://github.com/twbs/bootstrap/issues/23381) // ----------------------------------------------------------------------------- // Core Utilities (moved to modules) // ----------------------------------------------------------------------------- // Following objects (native node modules) are *explicitely* forced to be // exposed for run-time to the global namespace (window). // ----------------------------------------------------------------------------- window.Cookies = __webpack_require__(3); window.log4javascript = __webpack_require__(4); window.liteURL = __webpack_require__(5); window.platform = __webpack_require__(6); // Core Libraries - build|required from SOURCE // ----------------------------------------------------------------------------- // Following source objects|modules are *explicitely* forced to be // exposed for run-time to the global namespace (window). // ----------------------------------------------------------------------------- window.j1.adapter = __webpack_require__(8); window.j1.anime = __webpack_require__(9); // added for fam window.j1.core = __webpack_require__(10); window.j1.core.navigator = __webpack_require__(11); window.j1.core.asciidoctor = __webpack_require__(12); window.j1.core.scrollSmooth = __webpack_require__(13); window.deeplTranslator = __webpack_require__(14); // window.j1.fam = require('./js/fam/fam.js'); // cannot used until NOT rewritten to jQuery // Following source objects|modules are *implicetly* forced to be // exposed for run-time to the global namespace (window). // ----------------------------------------------------------------------------- //const Bootstrap = require('./js/bootstrap/bootstrap.js'); //const J1JekyllSearch = require('./js/jekyll_search/jekyll_search.js'); var J1Tocbot = __webpack_require__(24); var J1AttrChangeListener = __webpack_require__(30); //const J1ThemeSwitcher = require('./js/bs_theme_switcher/switcher.js'); // const J1MmenuLight = require('./js/mmenu-light/mmenu.js'); // Passing log data over Internet|SeeMe (currently NOT used) // ----------------------------------------------------------------------------- // window.j1.core.log4javascript = require('./js/logger/client/webhook.js'); // BMD Libraries (moved to modules) // ----------------------------------------------------------------------------- // window.bootstrapMaterialDesign = require('./js/bmd/js/bmd.js'); // Github Webhooks (currently NOT used) // ----------------------------------------------------------------------------- // window.j1.core.webhooks = require('./js/webhooks/octokit/client.js'); // Test|Custom modules (currently NOT used) // ----------------------------------------------------------------------------- // window.j1promiseTest = require('./js/custom/test_promises.js'); // window.j1Example = require('./js/custom/example_module.js'); // BS Libraries (moved to modules) // ----------------------------------------------------------------------------- // Following source objects|modules are *implicetly* forced to be // exposed for run-time to the global namespace (window). // ----------------------------------------------------------------------------- // const Bootstrap = require('./js/bootstrap/bootstrap.js'); // const J1JekyllSearch = require('./js/jekyll_search/jekyll_search.js'); // Buffer Kack // const J1Tocbot = require('./js/tocbot/tocbot.js'); // Backstretch (moved to modules) // ----------------------------------------------------------------------------- // Following source objects|modules are *implicetly* forced to be // exposed for run-time to the namespace of jQuery ($). // ----------------------------------------------------------------------------- // const J1Attics = require('./js/backstretch/backstretch.js'); // Additional Vanilla JS helpers // ----------------------------------------------------------------------------- var J1AdocResultViewer = __webpack_require__(31); // const MSIEPolyfills = require('./js/polyfills/ms-ie.js'); // HMR messages (currently NOT used) // ----------------------------------------------------------------------------- // if (module.hot) { // var logtext; // var stat; // var stat=module.hot.status(); // // logtext='[INFO ] [HMR ] [Hot Module Replacement enabled]'; // console.log(logtext); // logtext='[INFO ] [HMR ] [Status: ' + stat + ']'; // console.log(logtext); // // module.hot.accept('./template.js', function() { // console.log('[HMR] Accepting the updated template.js module!'); // }); // // module.hot.accept('../100_template_css/theme_uno.scss', function () { // console.log('[HMR] Accepting the updated style.css module!'); // require('../100_template_css/theme_uno.scss') // }) // // React to the current status... // module.hot.addStatusHandler(status => { // stat=module.hot.status(); // logtext='[INFO ] [HMR ] [Status: ' + stat + ']'; // console.log(logtext); // }); //} // ----------------------------------------------------------------------------- // END /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! * JavaScript Cookie v2.2.1 * https://github.com/js-cookie/js-cookie * * Copyright 2006, 2015 Klaus Hartl & Fagner Brack * Released under the MIT license */ ;(function (factory) { var registeredInModuleLoader; if (true) { !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); registeredInModuleLoader = true; } if (true) { module.exports = factory(); registeredInModuleLoader = true; } if (!registeredInModuleLoader) { var OldCookies = window.Cookies; var api = window.Cookies = factory(); api.noConflict = function () { window.Cookies = OldCookies; return api; }; } }(function () { function extend () { var i = 0; var result = {}; for (; i < arguments.length; i++) { var attributes = arguments[ i ]; for (var key in attributes) { result[key] = attributes[key]; } } return result; } function decode (s) { return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent); } function init (converter) { function api() {} function set (key, value, attributes) { if (typeof document === 'undefined') { return; } attributes = extend({ path: '/' }, api.defaults, attributes); if (typeof attributes.expires === 'number') { attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5); } // We're using "expires" because "max-age" is not supported by IE attributes.expires = attributes.expires ? attributes.expires.toUTCString() : ''; try { var result = JSON.stringify(value); if (/^[\{\[]/.test(result)) { value = result; } } catch (e) {} value = converter.write ? converter.write(value, key) : encodeURIComponent(String(value)) .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); key = encodeURIComponent(String(key)) .replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent) .replace(/[\(\)]/g, escape); var stringifiedAttributes = ''; for (var attributeName in attributes) { if (!attributes[attributeName]) { continue; } stringifiedAttributes += '; ' + attributeName; if (attributes[attributeName] === true) { continue; } // Considers RFC 6265 section 5.2: // ... // 3. If the remaining unparsed-attributes contains a %x3B (";") // character: // Consume the characters of the unparsed-attributes up to, // not including, the first %x3B (";") character. // ... stringifiedAttributes += '=' + attributes[attributeName].split(';')[0]; } return (document.cookie = key + '=' + value + stringifiedAttributes); } function get (key, json) { if (typeof document === 'undefined') { return; } var jar = {}; // To prevent the for loop in the first place assign an empty array // in case there are no cookies at all. var cookies = document.cookie ? document.cookie.split('; ') : []; var i = 0; for (; i < cookies.length; i++) { var parts = cookies[i].split('='); var cookie = parts.slice(1).join('='); if (!json && cookie.charAt(0) === '"') { cookie = cookie.slice(1, -1); } try { var name = decode(parts[0]); cookie = (converter.read || converter)(cookie, name) || decode(cookie); if (json) { try { cookie = JSON.parse(cookie); } catch (e) {} } jar[name] = cookie; if (key === name) { break; } } catch (e) {} } return key ? jar[key] : jar; } api.set = set; api.get = function (key) { return get(key, false /* read as raw */); }; api.getJSON = function (key) { return get(key, true /* read as json */); }; api.remove = function (key, attributes) { set(key, '', extend(attributes, { expires: -1 })); }; api.defaults = {}; api.withConverter = init; return api; } return init(function () {}); })); /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/** * Copyright 2015 Tim Down. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ (function(factory,root){if(true){!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));}else {}})(function(){if(!Array.prototype.push){Array.prototype.push=function(){for(var i=0,len=arguments.length;i0){var firstItem=this[0];for(var i=0,len=this.length-1;i2)?itemsAfterDeleted=argumentsArray.slice(2).concat(itemsAfterDeleted):itemsAfterDeleted;for(i=0,len=itemsToAppend.length;i=0){arr.splice(index,1);return true;}else{return false;}} function array_contains(arr,val){for(var i=0,len=arr.length;i=level.level;}};Level.ALL=new Level(Number.MIN_VALUE,"ALL");Level.TRACE=new Level(10000,"TRACE");Level.DEBUG=new Level(20000,"DEBUG");Level.INFO=new Level(30000,"INFO");Level.WARN=new Level(40000,"WARN");Level.ERROR=new Level(50000,"ERROR");Level.FATAL=new Level(60000,"FATAL");Level.OFF=new Level(Number.MAX_VALUE,"OFF");log4javascript.Level=Level;function Timer(name,level){this.name=name;this.level=isUndefined(level)?Level.INFO:level;this.start=new Date();} Timer.prototype.getElapsedTime=function(){return new Date().getTime()-this.start.getTime();};var anonymousLoggerName="[anonymous]";var defaultLoggerName="[default]";var nullLoggerName="[null]";var rootLoggerName="root";function Logger(name){this.name=name;this.parent=null;this.children=[];var appenders=[];var loggerLevel=null;var isRoot=(this.name===rootLoggerName);var isNull=(this.name===nullLoggerName);var appenderCache=null;var appenderCacheInvalidated=false;this.addChild=function(childLogger){this.children.push(childLogger);childLogger.parent=this;childLogger.invalidateAppenderCache();};var additive=true;this.getAdditivity=function(){return additive;};this.setAdditivity=function(additivity){var valueChanged=(additive!=additivity);additive=additivity;if(valueChanged){this.invalidateAppenderCache();}};this.addAppender=function(appender){if(isNull){handleError("Logger.addAppender: you may not add an appender to the null logger");}else{if(appender instanceof log4javascript.Appender){if(!array_contains(appenders,appender)){appenders.push(appender);appender.setAddedToLogger(this);this.invalidateAppenderCache();}}else{handleError("Logger.addAppender: appender supplied ('"+ toStr(appender)+"') is not a subclass of Appender");}}};this.removeAppender=function(appender){array_remove(appenders,appender);appender.setRemovedFromLogger(this);this.invalidateAppenderCache();};this.removeAllAppenders=function(){var appenderCount=appenders.length;if(appenderCount>0){for(var i=0;i1&&isError(lastParam)){exception=lastParam;finalParamIndex--;} var messages=[];for(var i=0;i<=finalParamIndex;i++){messages[i]=params[i];} var loggingEvent=new LoggingEvent(this,new Date(),level,messages,exception);this.callAppenders(loggingEvent);}};this.callAppenders=function(loggingEvent){var effectiveAppenders=this.getEffectiveAppenders();for(var i=0,len=effectiveAppenders.length;i0)?args:["Assertion Failure"];args.push(newLine);args.push(expr);this.log(Level.ERROR,args);}};this.toString=function(){return"Logger["+this.name+"]";};} Logger.prototype={trace:function(){this.log(Level.TRACE,arguments);},debug:function(){this.log(Level.DEBUG,arguments);},info:function(){this.log(Level.INFO,arguments);},warn:function(){this.log(Level.WARN,arguments);},error:function(){this.log(Level.ERROR,arguments);},fatal:function(){this.log(Level.FATAL,arguments);},isEnabledFor:function(level){return level.isGreaterOrEqual(this.getEffectiveLevel());},isTraceEnabled:function(){return this.isEnabledFor(Level.TRACE);},isDebugEnabled:function(){return this.isEnabledFor(Level.DEBUG);},isInfoEnabled:function(){return this.isEnabledFor(Level.INFO);},isWarnEnabled:function(){return this.isEnabledFor(Level.WARN);},isErrorEnabled:function(){return this.isEnabledFor(Level.ERROR);},isFatalEnabled:function(){return this.isEnabledFor(Level.FATAL);}};Logger.prototype.trace.isEntryPoint=true;Logger.prototype.debug.isEntryPoint=true;Logger.prototype.info.isEntryPoint=true;Logger.prototype.warn.isEntryPoint=true;Logger.prototype.error.isEntryPoint=true;Logger.prototype.fatal.isEntryPoint=true;var loggers={};var loggerNames=[];var ROOT_LOGGER_DEFAULT_LEVEL=Level.DEBUG;var rootLogger=new Logger(rootLoggerName);rootLogger.setLevel(ROOT_LOGGER_DEFAULT_LEVEL);log4javascript.getRootLogger=function(){return rootLogger;};log4javascript.getLogger=function(loggerName){if(typeof loggerName!="string"){loggerName=anonymousLoggerName;logLog.warn("log4javascript.getLogger: non-string logger name "+ toStr(loggerName)+" supplied, returning anonymous logger");} if(loggerName==rootLoggerName){handleError("log4javascript.getLogger: root logger may not be obtained by name");} if(!loggers[loggerName]){var logger=new Logger(loggerName);loggers[loggerName]=logger;loggerNames.push(loggerName);var lastDotIndex=loggerName.lastIndexOf(".");var parentLogger;if(lastDotIndex>-1){var parentLoggerName=loggerName.substring(0,lastDotIndex);parentLogger=log4javascript.getLogger(parentLoggerName);}else{parentLogger=rootLogger;} parentLogger.addChild(logger);} return loggers[loggerName];};var defaultLogger=null;log4javascript.getDefaultLogger=function(){if(!defaultLogger){defaultLogger=createDefaultLogger();} return defaultLogger;};var nullLogger=null;log4javascript.getNullLogger=function(){if(!nullLogger){nullLogger=new Logger(nullLoggerName);nullLogger.setLevel(Level.OFF);} return nullLogger;};log4javascript.resetConfiguration=function(){rootLogger.setLevel(ROOT_LOGGER_DEFAULT_LEVEL);loggers={};};var LoggingEvent=function(logger,timeStamp,level,messages,exception){this.logger=logger;this.timeStamp=timeStamp;this.timeStampInMilliseconds=timeStamp.getTime();this.timeStampInSeconds=Math.floor(this.timeStampInMilliseconds/1000);this.milliseconds=this.timeStamp.getMilliseconds();this.level=level;this.messages=messages;this.exception=exception;};LoggingEvent.prototype={getThrowableStrRep:function(){return this.exception?getExceptionStringRep(this.exception):"";},getCombinedMessages:function(){return(this.messages.length==1)?this.messages[0]:this.messages.join(newLine);},toString:function(){return"LoggingEvent["+this.level+"]";}};log4javascript.LoggingEvent=LoggingEvent;var Layout=function(){};Layout.prototype={defaults:{loggerKey:"logger",timeStampKey:"timestamp",millisecondsKey:"milliseconds",levelKey:"level",messageKey:"message",exceptionKey:"exception",urlKey:"url"},loggerKey:"logger",timeStampKey:"timestamp",millisecondsKey:"milliseconds",levelKey:"level",messageKey:"message",exceptionKey:"exception",urlKey:"url",batchHeader:"",batchFooter:"",batchSeparator:"",returnsPostData:false,overrideTimeStampsSetting:false,useTimeStampsInMilliseconds:null,format:function(){handleError("Layout.format: layout supplied has no format() method");},ignoresThrowable:function(){handleError("Layout.ignoresThrowable: layout supplied has no ignoresThrowable() method");},getContentType:function(){return"text/plain";},allowBatching:function(){return true;},setTimeStampsInMilliseconds:function(timeStampsInMilliseconds){this.overrideTimeStampsSetting=true;this.useTimeStampsInMilliseconds=bool(timeStampsInMilliseconds);},isTimeStampsInMilliseconds:function(){return this.overrideTimeStampsSetting?this.useTimeStampsInMilliseconds:useTimeStampsInMilliseconds;},getTimeStampValue:function(loggingEvent){return this.isTimeStampsInMilliseconds()?loggingEvent.timeStampInMilliseconds:loggingEvent.timeStampInSeconds;},getDataValues:function(loggingEvent,combineMessages){var dataValues=[[this.loggerKey,loggingEvent.logger.name],[this.timeStampKey,this.getTimeStampValue(loggingEvent)],[this.levelKey,loggingEvent.level.name],[this.urlKey,window.location.href],[this.messageKey,combineMessages?loggingEvent.getCombinedMessages():loggingEvent.messages]];if(!this.isTimeStampsInMilliseconds()){dataValues.push([this.millisecondsKey,loggingEvent.milliseconds]);} if(loggingEvent.exception){dataValues.push([this.exceptionKey,getExceptionStringRep(loggingEvent.exception)]);} if(this.hasCustomFields()){for(var i=0,len=this.customFields.length;i0);},formatWithException:function(loggingEvent){var formatted=this.format(loggingEvent);if(loggingEvent.exception&&this.ignoresThrowable()){formatted+=loggingEvent.getThrowableStrRep();} return formatted;},toString:function(){handleError("Layout.toString: all layouts must override this method");}};log4javascript.Layout=Layout;var Appender=function(){};Appender.prototype=new EventSupport();Appender.prototype.layout=new PatternLayout();Appender.prototype.threshold=Level.ALL;Appender.prototype.loggers=[];Appender.prototype.doAppend=function(loggingEvent){if(enabled&&loggingEvent.level.level>=this.threshold.level){this.append(loggingEvent);}};Appender.prototype.append=function(loggingEvent){};Appender.prototype.setLayout=function(layout){if(layout instanceof Layout){this.layout=layout;}else{handleError("Appender.setLayout: layout supplied to "+ this.toString()+" is not a subclass of Layout");}};Appender.prototype.getLayout=function(){return this.layout;};Appender.prototype.setThreshold=function(threshold){if(threshold instanceof Level){this.threshold=threshold;}else{handleError("Appender.setThreshold: threshold supplied to "+ this.toString()+" is not a subclass of Level");}};Appender.prototype.getThreshold=function(){return this.threshold;};Appender.prototype.setAddedToLogger=function(logger){this.loggers.push(logger);};Appender.prototype.setRemovedFromLogger=function(logger){array_remove(this.loggers,logger);};Appender.prototype.group=emptyFunction;Appender.prototype.groupEnd=emptyFunction;Appender.prototype.toString=function(){handleError("Appender.toString: all appenders must override this method");};log4javascript.Appender=Appender;function SimpleLayout(){this.customFields=[];} SimpleLayout.prototype=new Layout();SimpleLayout.prototype.format=function(loggingEvent){return loggingEvent.level.name+" - "+loggingEvent.getCombinedMessages();};SimpleLayout.prototype.ignoresThrowable=function(){return true;};SimpleLayout.prototype.toString=function(){return"SimpleLayout";};log4javascript.SimpleLayout=SimpleLayout;function NullLayout(){this.customFields=[];} NullLayout.prototype=new Layout();NullLayout.prototype.format=function(loggingEvent){return loggingEvent.messages;};NullLayout.prototype.ignoresThrowable=function(){return true;};NullLayout.prototype.formatWithException=function(loggingEvent){var messages=loggingEvent.messages,ex=loggingEvent.exception;return ex?messages.concat([ex]):messages;};NullLayout.prototype.toString=function(){return"NullLayout";};log4javascript.NullLayout=NullLayout;function XmlLayout(combineMessages){this.combineMessages=extractBooleanFromParam(combineMessages,true);this.customFields=[];} XmlLayout.prototype=new Layout();XmlLayout.prototype.isCombinedMessages=function(){return this.combineMessages;};XmlLayout.prototype.getContentType=function(){return"text/xml";};XmlLayout.prototype.escapeCdata=function(str){return str.replace(/\]\]>/,"]]>]]>";} var str=""+newLine;if(this.combineMessages){str+=formatMessage(loggingEvent.getCombinedMessages());}else{str+=""+newLine;for(i=0,len=loggingEvent.messages.length;i"+newLine;}} if(loggingEvent.exception){str+=""+newLine;} str+=""+newLine+newLine;return str;};XmlLayout.prototype.ignoresThrowable=function(){return false;};XmlLayout.prototype.toString=function(){return"XmlLayout";};log4javascript.XmlLayout=XmlLayout;function escapeNewLines(str){return str.replace(/\r\n|\r|\n/g,"\\r\\n");} function JsonLayout(readable,combineMessages){this.readable=extractBooleanFromParam(readable,false);this.combineMessages=extractBooleanFromParam(combineMessages,true);this.batchHeader=this.readable?"["+newLine:"[";this.batchFooter=this.readable?"]"+newLine:"]";this.batchSeparator=this.readable?","+newLine:",";this.setKeys();this.colon=this.readable?": ":":";this.tab=this.readable?"\t":"";this.lineBreak=this.readable?newLine:"";this.customFields=[];} JsonLayout.prototype=new Layout();JsonLayout.prototype.isReadable=function(){return this.readable;};JsonLayout.prototype.isCombinedMessages=function(){return this.combineMessages;};JsonLayout.prototype.format=function(loggingEvent){var layout=this;var dataValues=this.getDataValues(loggingEvent,this.combineMessages);var str="{"+this.lineBreak;var i,len;function formatValue(val,prefix,expand){var formattedValue;var valType=typeof val;if(val instanceof Date){formattedValue=String(val.getTime());}else if(expand&&(val instanceof Array)){formattedValue="["+layout.lineBreak;for(var i=0,len=val.length;i0){objectsExpanded.push(obj);expansion="["+newLine;childDepth=depth-1;childIndentation=indentation+" ";childLines=[];for(i=0,len=obj.length;i0){objectsExpanded.push(obj);expansion="{"+newLine;childDepth=depth-1;childIndentation=indentation+" ";childLines=[];for(i in obj){try{childExpansion=doFormat(obj[i],childDepth,childIndentation);childLines.push(childIndentation+i+": "+childExpansion);}catch(ex){childLines.push(childIndentation+i+": Error formatting property. Details: "+ getExceptionStringRep(ex));}} expansion+=childLines.join(","+newLine)+newLine+indentation+"}";return expansion;}else{return formatString(toStr(obj));}} return doFormat(obj,depth,indentation);} var SimpleDateFormat;(function(){var regex=/('[^']*')|(G+|y+|M+|w+|W+|D+|d+|F+|E+|a+|H+|k+|K+|h+|m+|s+|S+|Z+)|([a-zA-Z]+)|([^a-zA-Z']+)/;var monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];var dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var TEXT2=0,TEXT3=1,NUMBER=2,YEAR=3,MONTH=4,TIMEZONE=5;var types={G:TEXT2,y:YEAR,M:MONTH,w:NUMBER,W:NUMBER,D:NUMBER,d:NUMBER,F:NUMBER,E:TEXT3,a:TEXT2,H:NUMBER,k:NUMBER,K:NUMBER,h:NUMBER,m:NUMBER,s:NUMBER,S:NUMBER,Z:TIMEZONE};var ONE_DAY=24*60*60*1000;var ONE_WEEK=7*ONE_DAY;var DEFAULT_MINIMAL_DAYS_IN_FIRST_WEEK=1;var newDateAtMidnight=function(year,month,day){var d=new Date(year,month,day,0,0,0);d.setMilliseconds(0);return d;};Date.prototype.getDifference=function(date){return this.getTime()-date.getTime();};Date.prototype.isBefore=function(d){return this.getTime()=minimalDaysInFirstWeek){weekInMonth++;} return weekInMonth;};Date.prototype.getDayInYear=function(){var startOfYear=newDateAtMidnight(this.getFullYear(),0,1);return 1+Math.floor(this.getTimeSince(startOfYear)/ONE_DAY);};SimpleDateFormat=function(formatString){this.formatString=formatString;};SimpleDateFormat.prototype.setMinimalDaysInFirstWeek=function(days){this.minimalDaysInFirstWeek=days;};SimpleDateFormat.prototype.getMinimalDaysInFirstWeek=function(){return isUndefined(this.minimalDaysInFirstWeek)?DEFAULT_MINIMAL_DAYS_IN_FIRST_WEEK:this.minimalDaysInFirstWeek;};var padWithZeroes=function(str,len){while(str.length=4)?data:data.substr(0,Math.max(minLength,numberOfLetters));};var formatNumber=function(data,numberOfLetters){var dataString=""+data;return padWithZeroes(dataString,numberOfLetters);};SimpleDateFormat.prototype.format=function(date){var formattedString="";var result;var searchString=this.formatString;while((result=regex.exec(searchString))){var quotedString=result[1];var patternLetters=result[2];var otherLetters=result[3];var otherCharacters=result[4];if(quotedString){if(quotedString=="''"){formattedString+="'";}else{formattedString+=quotedString.substring(1,quotedString.length-1);}}else if(otherLetters){}else if(otherCharacters){formattedString+=otherCharacters;}else if(patternLetters){var patternLetter=patternLetters.charAt(0);var numberOfLetters=patternLetters.length;var rawData="";switch(patternLetter){case"G":rawData="AD";break;case"y":rawData=date.getFullYear();break;case"M":rawData=date.getMonth();break;case"w":rawData=date.getWeekInYear(this.getMinimalDaysInFirstWeek());break;case"W":rawData=date.getWeekInMonth(this.getMinimalDaysInFirstWeek());break;case"D":rawData=date.getDayInYear();break;case"d":rawData=date.getDate();break;case"F":rawData=1+Math.floor((date.getDate()-1)/7);break;case"E":rawData=dayNames[date.getDay()];break;case"a":rawData=(date.getHours()>=12)?"PM":"AM";break;case"H":rawData=date.getHours();break;case"k":rawData=date.getHours()||24;break;case"K":rawData=date.getHours()%12;break;case"h":rawData=(date.getHours()%12)||12;break;case"m":rawData=date.getMinutes();break;case"s":rawData=date.getSeconds();break;case"S":rawData=date.getMilliseconds();break;case"Z":rawData=date.getTimezoneOffset();break;} switch(types[patternLetter]){case TEXT2:formattedString+=formatText(rawData,numberOfLetters,2);break;case TEXT3:formattedString+=formatText(rawData,numberOfLetters,3);break;case NUMBER:formattedString+=formatNumber(rawData,numberOfLetters);break;case YEAR:if(numberOfLetters<=3){var dataString=""+rawData;formattedString+=dataString.substr(2,2);}else{formattedString+=formatNumber(rawData,numberOfLetters);} break;case MONTH:if(numberOfLetters>=3){formattedString+=formatText(monthNames[rawData],numberOfLetters,numberOfLetters);}else{formattedString+=formatNumber(rawData+1,numberOfLetters);} break;case TIMEZONE:var isPositive=(rawData>0);var prefix=isPositive?"-":"+";var absData=Math.abs(rawData);var hours=""+Math.floor(absData/60);hours=padWithZeroes(hours,2);var minutes=""+(absData%60);minutes=padWithZeroes(minutes,2);formattedString+=prefix+hours+minutes;break;}} searchString=searchString.substr(result.index+result[0].length);} return formattedString;};})();log4javascript.SimpleDateFormat=SimpleDateFormat;function PatternLayout(pattern){if(pattern){this.pattern=pattern;}else{this.pattern=PatternLayout.DEFAULT_CONVERSION_PATTERN;} this.customFields=[];} PatternLayout.TTCC_CONVERSION_PATTERN="%r %p %c - %m%n";PatternLayout.DEFAULT_CONVERSION_PATTERN="%m%n";PatternLayout.ISO8601_DATEFORMAT="yyyy-MM-dd HH:mm:ss,SSS";PatternLayout.DATETIME_DATEFORMAT="dd MMM yyyy HH:mm:ss,SSS";PatternLayout.ABSOLUTETIME_DATEFORMAT="HH:mm:ss,SSS";PatternLayout.prototype=new Layout();PatternLayout.prototype.format=function(loggingEvent){var regex=/%(-?[0-9]+)?(\.?[0-9]+)?([acdfmMnpr%])(\{([^\}]+)\})?|([^%]+)/;var formattedString="";var result;var searchString=this.pattern;while((result=regex.exec(searchString))){var matchedString=result[0];var padding=result[1];var truncation=result[2];var conversionCharacter=result[3];var specifier=result[5];var text=result[6];if(text){formattedString+=""+text;}else{var replacement="";switch(conversionCharacter){case"a":case"m":var depth=0;if(specifier){depth=parseInt(specifier,10);if(isNaN(depth)){handleError("PatternLayout.format: invalid specifier '"+ specifier+"' for conversion character '"+conversionCharacter+"' - should be a number");depth=0;}} var messages=(conversionCharacter==="a")?loggingEvent.messages[0]:loggingEvent.messages;for(var i=0,len=messages.length;i0&&(replacement.charAt(replacement.length-1)!==" ")){replacement+=" ";} if(depth===0){replacement+=messages[i];}else{replacement+=formatObjectExpansion(messages[i],depth);}} break;case"c":var loggerName=loggingEvent.logger.name;if(specifier){var precision=parseInt(specifier,10);var loggerNameBits=loggingEvent.logger.name.split(".");if(precision>=loggerNameBits.length){replacement=loggerName;}else{replacement=loggerNameBits.slice(loggerNameBits.length-precision).join(".");}}else{replacement=loggerName;} break;case"d":var dateFormat=PatternLayout.ISO8601_DATEFORMAT;if(specifier){dateFormat=specifier;if(dateFormat=="ISO8601"){dateFormat=PatternLayout.ISO8601_DATEFORMAT;}else if(dateFormat=="ABSOLUTE"){dateFormat=PatternLayout.ABSOLUTETIME_DATEFORMAT;}else if(dateFormat=="DATE"){dateFormat=PatternLayout.DATETIME_DATEFORMAT;}} replacement=(new SimpleDateFormat(dateFormat)).format(loggingEvent.timeStamp);break;case"f":if(this.hasCustomFields()){var fieldIndex=0;if(specifier){fieldIndex=parseInt(specifier,10);if(isNaN(fieldIndex)){handleError("PatternLayout.format: invalid specifier '"+ specifier+"' for conversion character 'f' - should be a number");}else if(fieldIndex===0){handleError("PatternLayout.format: invalid specifier '"+ specifier+"' for conversion character 'f' - must be greater than zero");}else if(fieldIndex>this.customFields.length){handleError("PatternLayout.format: invalid specifier '"+ specifier+"' for conversion character 'f' - there aren't that many custom fields");}else{fieldIndex=fieldIndex-1;}} var val=this.customFields[fieldIndex].value;if(typeof val=="function"){val=val(this,loggingEvent);} replacement=val;} break;case"n":replacement=newLine;break;case"p":replacement=loggingEvent.level.name;break;case"r":replacement=""+loggingEvent.timeStamp.getDifference(applicationStartDate);break;case"%":replacement="%";break;default:replacement=matchedString;break;} var l;if(truncation){l=parseInt(truncation.substr(1),10);var strLen=replacement.length;if(l=200&&xmlHttp.status<300)||xmlHttp.status==1223;} function AjaxAppender(url,withCredentials){var appender=this;var isSupported=true;if(!url){handleError("AjaxAppender: URL must be specified in constructor");isSupported=false;} var timed=this.defaults.timed;var waitForResponse=this.defaults.waitForResponse;var batchSize=this.defaults.batchSize;var timerInterval=this.defaults.timerInterval;var requestSuccessCallback=this.defaults.requestSuccessCallback;var failCallback=this.defaults.failCallback;var postVarName=this.defaults.postVarName;var sendAllOnUnload=this.defaults.sendAllOnUnload;var contentType=this.defaults.contentType;var sessionId=null;var queuedLoggingEvents=[];var queuedRequests=[];var headers=[];var sending=false;var initialized=false;function checkCanConfigure(configOptionName){if(initialized){handleError("AjaxAppender: configuration option '"+ configOptionName+"' may not be set after the appender has been initialized");return false;} return true;} this.getSessionId=function(){return sessionId;};this.setSessionId=function(sessionIdParam){sessionId=extractStringFromParam(sessionIdParam,null);this.layout.setCustomField("sessionid",sessionId);};this.setLayout=function(layoutParam){if(checkCanConfigure("layout")){this.layout=layoutParam;if(sessionId!==null){this.setSessionId(sessionId);}}};this.isTimed=function(){return timed;};this.setTimed=function(timedParam){if(checkCanConfigure("timed")){timed=bool(timedParam);}};this.getTimerInterval=function(){return timerInterval;};this.setTimerInterval=function(timerIntervalParam){if(checkCanConfigure("timerInterval")){timerInterval=extractIntFromParam(timerIntervalParam,timerInterval);}};this.isWaitForResponse=function(){return waitForResponse;};this.setWaitForResponse=function(waitForResponseParam){if(checkCanConfigure("waitForResponse")){waitForResponse=bool(waitForResponseParam);}};this.getBatchSize=function(){return batchSize;};this.setBatchSize=function(batchSizeParam){if(checkCanConfigure("batchSize")){batchSize=extractIntFromParam(batchSizeParam,batchSize);}};this.isSendAllOnUnload=function(){return sendAllOnUnload;};this.setSendAllOnUnload=function(sendAllOnUnloadParam){if(checkCanConfigure("sendAllOnUnload")){sendAllOnUnload=extractBooleanFromParam(sendAllOnUnloadParam,sendAllOnUnload);}};this.setRequestSuccessCallback=function(requestSuccessCallbackParam){requestSuccessCallback=extractFunctionFromParam(requestSuccessCallbackParam,requestSuccessCallback);};this.setFailCallback=function(failCallbackParam){failCallback=extractFunctionFromParam(failCallbackParam,failCallback);};this.getPostVarName=function(){return postVarName;};this.setPostVarName=function(postVarNameParam){if(checkCanConfigure("postVarName")){postVarName=extractStringFromParam(postVarNameParam,postVarName);}};this.getHeaders=function(){return headers;};this.addHeader=function(name,value){if(name.toLowerCase()=="content-type"){contentType=value;}else{headers.push({name:name,value:value});}};function sendAll(){if(isSupported&&enabled){sending=true;var currentRequestBatch;if(waitForResponse){if(queuedRequests.length>0){currentRequestBatch=queuedRequests.shift();sendRequest(preparePostData(currentRequestBatch),sendAll);}else{sending=false;if(timed){scheduleSending();}}}else{while((currentRequestBatch=queuedRequests.shift())){sendRequest(preparePostData(currentRequestBatch));} sending=false;if(timed){scheduleSending();}}}} this.sendAll=sendAll;function sendAllRemaining(){var sendingAnything=false;if(isSupported&&enabled){var actualBatchSize=appender.getLayout().allowBatching()?batchSize:1;var currentLoggingEvent;var batchedLoggingEvents=[];while((currentLoggingEvent=queuedLoggingEvents.shift())){batchedLoggingEvents.push(currentLoggingEvent);if(queuedLoggingEvents.length>=actualBatchSize){queuedRequests.push(batchedLoggingEvents);batchedLoggingEvents=[];}} if(batchedLoggingEvents.length>0){queuedRequests.push(batchedLoggingEvents);} sendingAnything=(queuedRequests.length>0);waitForResponse=false;timed=false;sendAll();} return sendingAnything;} this.sendAllRemaining=sendAllRemaining;function preparePostData(batchedLoggingEvents){var formattedMessages=[];var currentLoggingEvent;var postData="";while((currentLoggingEvent=batchedLoggingEvents.shift())){formattedMessages.push(appender.getLayout().formatWithException(currentLoggingEvent));} if(batchedLoggingEvents.length==1){postData=formattedMessages.join("");}else{postData=appender.getLayout().batchHeader+ formattedMessages.join(appender.getLayout().batchSeparator)+ appender.getLayout().batchFooter;} if(contentType==appender.defaults.contentType){postData=appender.getLayout().returnsPostData?postData:urlEncode(postVarName)+"="+urlEncode(postData);if(postData.length>0){postData+="&";} postData+="layout="+urlEncode(appender.getLayout().toString());} return postData;} function scheduleSending(){window.setTimeout(sendAll,timerInterval);} function xmlHttpErrorHandler(){var msg="AjaxAppender: could not create XMLHttpRequest object. AjaxAppender disabled";handleError(msg);isSupported=false;if(failCallback){failCallback(msg);}} function sendRequest(postData,successCallback){try{var xmlHttp=getXmlHttp(xmlHttpErrorHandler);if(isSupported){xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(isHttpRequestSuccessful(xmlHttp)){if(requestSuccessCallback){requestSuccessCallback(xmlHttp);} if(successCallback){successCallback(xmlHttp);}}else{var msg="AjaxAppender.append: XMLHttpRequest request to URL "+ url+" returned status code "+xmlHttp.status;handleError(msg);if(failCallback){failCallback(msg);}} xmlHttp.onreadystatechange=emptyFunction;xmlHttp=null;}};xmlHttp.open("POST",url,true);if(withCredentials&&withCredentialsSupported){xmlHttp.withCredentials=true;} try{for(var i=0,header;header=headers[i++];){xmlHttp.setRequestHeader(header.name,header.value);} xmlHttp.setRequestHeader("Content-Type",contentType);}catch(headerEx){var msg="AjaxAppender.append: your browser's XMLHttpRequest implementation"+" does not support setRequestHeader, therefore cannot post data. AjaxAppender disabled";handleError(msg);isSupported=false;if(failCallback){failCallback(msg);} return;} xmlHttp.send(postData);}}catch(ex){var errMsg="AjaxAppender.append: error sending log message to "+url;handleError(errMsg,ex);isSupported=false;if(failCallback){failCallback(errMsg+". Details: "+getExceptionStringRep(ex));}}} this.append=function(loggingEvent){if(isSupported){if(!initialized){init();} queuedLoggingEvents.push(loggingEvent);var actualBatchSize=this.getLayout().allowBatching()?batchSize:1;if(queuedLoggingEvents.length>=actualBatchSize){var currentLoggingEvent;var batchedLoggingEvents=[];while((currentLoggingEvent=queuedLoggingEvents.shift())){batchedLoggingEvents.push(currentLoggingEvent);} queuedRequests.push(batchedLoggingEvents);if(!timed&&(!waitForResponse||(waitForResponse&&!sending))){sendAll();}}}};function init(){initialized=true;if(sendAllOnUnload){var oldBeforeUnload=window.onbeforeunload;window.onbeforeunload=function(){if(oldBeforeUnload){oldBeforeUnload();} sendAllRemaining();};} if(timed){scheduleSending();}}} AjaxAppender.prototype=new Appender();AjaxAppender.prototype.defaults={waitForResponse:false,timed:false,timerInterval:1000,batchSize:1,sendAllOnUnload:false,requestSuccessCallback:null,failCallback:null,postVarName:"data",contentType:"application/x-www-form-urlencoded"};AjaxAppender.prototype.layout=new HttpPostDataLayout();AjaxAppender.prototype.toString=function(){return"AjaxAppender";};log4javascript.AjaxAppender=AjaxAppender;function setCookie(name,value,days,path){var expires;path=path?"; path="+path:"";if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toGMTString();}else{expires="";} document.cookie=escape(name)+"="+escape(value)+expires+path;} function getCookie(name){var nameEquals=escape(name)+"=";var ca=document.cookie.split(";");for(var i=0,len=ca.length;i','','','log4javascript','','','','','','','','','','','
','
','
','Filters:','','','','','','','','
','','
','Options:','','','','','','','','
','
','
','
','
','
','','','
','
','','',''];};var defaultCommandLineFunctions=[];ConsoleAppender=function(){};var consoleAppenderIdCounter=1;ConsoleAppender.prototype=new Appender();ConsoleAppender.prototype.create=function(inPage,container,lazyInit,initiallyMinimized,useDocumentWrite,width,height,focusConsoleWindow){var appender=this;var initialized=false;var consoleWindowCreated=false;var consoleWindowLoaded=false;var consoleClosed=false;var queuedLoggingEvents=[];var isSupported=true;var consoleAppenderId=consoleAppenderIdCounter++;initiallyMinimized=extractBooleanFromParam(initiallyMinimized,this.defaults.initiallyMinimized);lazyInit=extractBooleanFromParam(lazyInit,this.defaults.lazyInit);useDocumentWrite=extractBooleanFromParam(useDocumentWrite,this.defaults.useDocumentWrite);var newestMessageAtTop=this.defaults.newestMessageAtTop;var scrollToLatestMessage=this.defaults.scrollToLatestMessage;width=width?width:this.defaults.width;height=height?height:this.defaults.height;var maxMessages=this.defaults.maxMessages;var showCommandLine=this.defaults.showCommandLine;var commandLineObjectExpansionDepth=this.defaults.commandLineObjectExpansionDepth;var showHideButton=this.defaults.showHideButton;var showCloseButton=this.defaults.showCloseButton;this.setLayout(this.defaults.layout);var init,createWindow,safeToAppend,getConsoleWindow,open;var appenderName=inPage?"InPageAppender":"PopUpAppender";var checkCanConfigure=function(configOptionName){if(consoleWindowCreated){handleError(appenderName+": configuration option '"+configOptionName+"' may not be set after the appender has been initialized");return false;} return true;};var consoleWindowExists=function(){return(consoleWindowLoaded&&isSupported&&!consoleClosed);};this.isNewestMessageAtTop=function(){return newestMessageAtTop;};this.setNewestMessageAtTop=function(newestMessageAtTopParam){newestMessageAtTop=bool(newestMessageAtTopParam);if(consoleWindowExists()){getConsoleWindow().setNewestAtTop(newestMessageAtTop);}};this.isScrollToLatestMessage=function(){return scrollToLatestMessage;};this.setScrollToLatestMessage=function(scrollToLatestMessageParam){scrollToLatestMessage=bool(scrollToLatestMessageParam);if(consoleWindowExists()){getConsoleWindow().setScrollToLatest(scrollToLatestMessage);}};this.getWidth=function(){return width;};this.setWidth=function(widthParam){if(checkCanConfigure("width")){width=extractStringFromParam(widthParam,width);}};this.getHeight=function(){return height;};this.setHeight=function(heightParam){if(checkCanConfigure("height")){height=extractStringFromParam(heightParam,height);}};this.getMaxMessages=function(){return maxMessages;};this.setMaxMessages=function(maxMessagesParam){maxMessages=extractIntFromParam(maxMessagesParam,maxMessages);if(consoleWindowExists()){getConsoleWindow().setMaxMessages(maxMessages);}};this.isShowCommandLine=function(){return showCommandLine;};this.setShowCommandLine=function(showCommandLineParam){showCommandLine=bool(showCommandLineParam);if(consoleWindowExists()){getConsoleWindow().setShowCommandLine(showCommandLine);}};this.isShowHideButton=function(){return showHideButton;};this.setShowHideButton=function(showHideButtonParam){showHideButton=bool(showHideButtonParam);if(consoleWindowExists()){getConsoleWindow().setShowHideButton(showHideButton);}};this.isShowCloseButton=function(){return showCloseButton;};this.setShowCloseButton=function(showCloseButtonParam){showCloseButton=bool(showCloseButtonParam);if(consoleWindowExists()){getConsoleWindow().setShowCloseButton(showCloseButton);}};this.getCommandLineObjectExpansionDepth=function(){return commandLineObjectExpansionDepth;};this.setCommandLineObjectExpansionDepth=function(commandLineObjectExpansionDepthParam){commandLineObjectExpansionDepth=extractIntFromParam(commandLineObjectExpansionDepthParam,commandLineObjectExpansionDepth);};var minimized=initiallyMinimized;this.isInitiallyMinimized=function(){return initiallyMinimized;};this.setInitiallyMinimized=function(initiallyMinimizedParam){if(checkCanConfigure("initiallyMinimized")){initiallyMinimized=bool(initiallyMinimizedParam);minimized=initiallyMinimized;}};this.isUseDocumentWrite=function(){return useDocumentWrite;};this.setUseDocumentWrite=function(useDocumentWriteParam){if(checkCanConfigure("useDocumentWrite")){useDocumentWrite=bool(useDocumentWriteParam);}};function QueuedLoggingEvent(loggingEvent,formattedMessage){this.loggingEvent=loggingEvent;this.levelName=loggingEvent.level.name;this.formattedMessage=formattedMessage;} QueuedLoggingEvent.prototype.append=function(){getConsoleWindow().log(this.levelName,this.formattedMessage);};function QueuedGroup(name,initiallyExpanded){this.name=name;this.initiallyExpanded=initiallyExpanded;} QueuedGroup.prototype.append=function(){getConsoleWindow().group(this.name,this.initiallyExpanded);};function QueuedGroupEnd(){} QueuedGroupEnd.prototype.append=function(){getConsoleWindow().groupEnd();};var checkAndAppend=function(){safeToAppend();if(!initialized){init();}else if(consoleClosed&&reopenWhenClosed){createWindow();} if(safeToAppend()){appendQueuedLoggingEvents();}};this.append=function(loggingEvent){if(isSupported){var formattedMessage=appender.getLayout().formatWithException(loggingEvent);queuedLoggingEvents.push(new QueuedLoggingEvent(loggingEvent,formattedMessage));checkAndAppend();}};this.group=function(name,initiallyExpanded){if(isSupported){queuedLoggingEvents.push(new QueuedGroup(name,initiallyExpanded));checkAndAppend();}};this.groupEnd=function(){if(isSupported){queuedLoggingEvents.push(new QueuedGroupEnd());checkAndAppend();}};var appendQueuedLoggingEvents=function(){while(queuedLoggingEvents.length>0){queuedLoggingEvents.shift().append();} if(focusConsoleWindow){getConsoleWindow().focus();}};this.setAddedToLogger=function(logger){this.loggers.push(logger);if(enabled&&!lazyInit){init();}};this.clear=function(){if(consoleWindowExists()){getConsoleWindow().clearLog();} queuedLoggingEvents.length=0;};this.focus=function(){if(consoleWindowExists()){getConsoleWindow().focus();}};this.focusCommandLine=function(){if(consoleWindowExists()){getConsoleWindow().focusCommandLine();}};this.focusSearch=function(){if(consoleWindowExists()){getConsoleWindow().focusSearch();}};var commandWindow=window;this.getCommandWindow=function(){return commandWindow;};this.setCommandWindow=function(commandWindowParam){commandWindow=commandWindowParam;};this.executeLastCommand=function(){if(consoleWindowExists()){getConsoleWindow().evalLastCommand();}};var commandLayout=new PatternLayout("%m");this.getCommandLayout=function(){return commandLayout;};this.setCommandLayout=function(commandLayoutParam){commandLayout=commandLayoutParam;};this.evalCommandAndAppend=function(expr){var commandReturnValue={appendResult:true,isError:false};var commandOutput="";try{var result,i;if(!commandWindow.eval&&commandWindow.execScript){commandWindow.execScript("null");} var commandLineFunctionsHash={};for(i=0,len=commandLineFunctions.length;i";consoleClosed=false;var iframeDocumentExistsTest=function(win){try{return bool(win)&&bool(win.document);}catch(ex){return false;}};if(iframeDocumentExistsTest(getConsoleWindow())){writeToDocument();}else{pollConsoleWindow(iframeDocumentExistsTest,100,writeToDocument,initErrorMessage);} consoleWindowCreated=true;};createWindow=function(show){if(show||!initiallyMinimized){var pageLoadHandler=function(){if(!container){containerElement=document.createElement("div");containerElement.style.position="fixed";containerElement.style.left="0";containerElement.style.right="0";containerElement.style.bottom="0";document.body.appendChild(containerElement);appender.addCssProperty("borderWidth","1px 0 0 0");appender.addCssProperty("zIndex",1000000);open();}else{try{var el=document.getElementById(container);if(el.nodeType==1){containerElement=el;} open();}catch(ex){handleError("InPageAppender.init: invalid container element '"+container+"' supplied",ex);}}};if(pageLoaded&&container&&container.appendChild){containerElement=container;open();}else if(pageLoaded){pageLoadHandler();}else{log4javascript.addEventListener("load",pageLoadHandler);} windowCreationStarted=true;}};init=function(){createWindow();initialized=true;};getConsoleWindow=function(){var iframe=window.frames[iframeId];if(iframe){return iframe;}};safeToAppend=function(){if(isSupported&&!consoleClosed){if(consoleWindowCreated&&!consoleWindowLoaded&&getConsoleWindow()&&isLoaded(getConsoleWindow())){consoleWindowLoaded=true;} return consoleWindowLoaded;} return false;};}else{var useOldPopUp=appender.defaults.useOldPopUp;var complainAboutPopUpBlocking=appender.defaults.complainAboutPopUpBlocking;var reopenWhenClosed=this.defaults.reopenWhenClosed;this.isUseOldPopUp=function(){return useOldPopUp;};this.setUseOldPopUp=function(useOldPopUpParam){if(checkCanConfigure("useOldPopUp")){useOldPopUp=bool(useOldPopUpParam);}};this.isComplainAboutPopUpBlocking=function(){return complainAboutPopUpBlocking;};this.setComplainAboutPopUpBlocking=function(complainAboutPopUpBlockingParam){if(checkCanConfigure("complainAboutPopUpBlocking")){complainAboutPopUpBlocking=bool(complainAboutPopUpBlockingParam);}};this.isFocusPopUp=function(){return focusConsoleWindow;};this.setFocusPopUp=function(focusPopUpParam){focusConsoleWindow=bool(focusPopUpParam);};this.isReopenWhenClosed=function(){return reopenWhenClosed;};this.setReopenWhenClosed=function(reopenWhenClosedParam){reopenWhenClosed=bool(reopenWhenClosedParam);};this.close=function(){logLog.debug("close "+this);try{popUp.close();this.unload();}catch(ex){}};this.hide=function(){logLog.debug("hide "+this);if(consoleWindowExists()){this.close();}};this.show=function(){logLog.debug("show "+this);if(!consoleWindowCreated){open();}};this.isVisible=function(){return safeToAppend();};var popUp;open=function(){var windowProperties="width="+width+",height="+height+",status,resizable";var frameInfo="";try{var frameEl=window.frameElement;if(frameEl){frameInfo="_"+frameEl.tagName+"_"+(frameEl.name||frameEl.id||"");}}catch(e){frameInfo="_inaccessibleParentFrame";} var windowName="PopUp_"+location.host.replace(/[^a-z0-9]/gi,"_")+"_"+consoleAppenderId+frameInfo;if(!useOldPopUp||!useDocumentWrite){windowName=windowName+"_"+uniqueId;} var checkPopUpClosed=function(win){if(consoleClosed){return true;}else{try{return bool(win)&&win.closed;}catch(ex){}} return false;};var popUpClosedCallback=function(){if(!consoleClosed){appender.unload();}};function finalInit(){getConsoleWindow().setCloseIfOpenerCloses(!useOldPopUp||!useDocumentWrite);consoleWindowLoadHandler();consoleWindowLoaded=true;appendQueuedLoggingEvents();pollConsoleWindow(checkPopUpClosed,500,popUpClosedCallback,"PopUpAppender.checkPopUpClosed: error checking pop-up window");} try{popUp=window.open(getConsoleUrl(),windowName,windowProperties);consoleClosed=false;consoleWindowCreated=true;if(popUp&&popUp.document){if(useDocumentWrite&&useOldPopUp&&isLoaded(popUp)){popUp.mainPageReloaded();finalInit();}else{if(useDocumentWrite){writeHtml(popUp.document);} var popUpLoadedTest=function(win){return bool(win)&&isLoaded(win);};if(isLoaded(popUp)){finalInit();}else{pollConsoleWindow(popUpLoadedTest,100,finalInit,"PopUpAppender.init: unable to create console window");}}}else{isSupported=false;logLog.warn("PopUpAppender.init: pop-ups blocked, please unblock to use PopUpAppender");if(complainAboutPopUpBlocking){handleError("log4javascript: pop-up windows appear to be blocked. Please unblock them to use pop-up logging.");}}}catch(ex){handleError("PopUpAppender.init: error creating pop-up",ex);}};createWindow=function(){if(!initiallyMinimized){open();}};init=function(){createWindow();initialized=true;};getConsoleWindow=function(){return popUp;};safeToAppend=function(){if(isSupported&&!isUndefined(popUp)&&!consoleClosed){if(popUp.closed||(consoleWindowLoaded&&isUndefined(popUp.closed))){appender.unload();logLog.debug("PopUpAppender: pop-up closed");return false;} if(!consoleWindowLoaded&&isLoaded(popUp)){consoleWindowLoaded=true;}} return isSupported&&consoleWindowLoaded&&!consoleClosed;};} this.getConsoleWindow=getConsoleWindow;};ConsoleAppender.addGlobalCommandLineFunction=function(functionName,commandLineFunction){defaultCommandLineFunctions.push([functionName,commandLineFunction]);};function PopUpAppender(lazyInit,initiallyMinimized,useDocumentWrite,width,height){this.create(false,null,lazyInit,initiallyMinimized,useDocumentWrite,width,height,this.defaults.focusPopUp);} PopUpAppender.prototype=new ConsoleAppender();PopUpAppender.prototype.defaults={layout:new PatternLayout("%d{HH:mm:ss} %-5p - %m{1}%n"),initiallyMinimized:false,focusPopUp:false,lazyInit:true,useOldPopUp:true,complainAboutPopUpBlocking:true,newestMessageAtTop:false,scrollToLatestMessage:true,width:"600",height:"400",reopenWhenClosed:false,maxMessages:null,showCommandLine:true,commandLineObjectExpansionDepth:1,showHideButton:false,showCloseButton:true,useDocumentWrite:true};PopUpAppender.prototype.toString=function(){return"PopUpAppender";};log4javascript.PopUpAppender=PopUpAppender;function InPageAppender(container,lazyInit,initiallyMinimized,useDocumentWrite,width,height){this.create(true,container,lazyInit,initiallyMinimized,useDocumentWrite,width,height,false);} InPageAppender.prototype=new ConsoleAppender();InPageAppender.prototype.defaults={layout:new PatternLayout("%d{HH:mm:ss} %-5p - %m{1}%n"),initiallyMinimized:false,lazyInit:true,newestMessageAtTop:false,scrollToLatestMessage:true,width:"100%",height:"220px",maxMessages:null,showCommandLine:true,commandLineObjectExpansionDepth:1,showHideButton:false,showCloseButton:false,showLogEntryDeleteButtons:true,useDocumentWrite:true};InPageAppender.prototype.toString=function(){return"InPageAppender";};log4javascript.InPageAppender=InPageAppender;log4javascript.InlineAppender=InPageAppender;})();function padWithSpaces(str,len){if(str.length]*>","i");if(regex.test(el.outerHTML)){return RegExp.$1.toLowerCase();}} return"";} var lt="<";var gt=">";var i,len;if(includeRootNode&&rootNode.nodeType!=nodeTypes.DOCUMENT_FRAGMENT_NODE){switch(rootNode.nodeType){case nodeTypes.ELEMENT_NODE:var tagName=rootNode.tagName.toLowerCase();xhtml=startNewLine?newLine+indentation:"";xhtml+=lt;var prefix=getNamespace(rootNode);var hasPrefix=!!prefix;if(hasPrefix){xhtml+=prefix+":";} xhtml+=tagName;for(i=0,len=rootNode.attributes.length;i"+newLine;case nodeTypes.DOCUMENT_NODE:xhtml="";for(i=0,len=rootNode.childNodes.length;i -1 && length <= maxSafeInteger) { while (++index < length) { callback(object[index], index, object); } } else { forOwn(object, callback); } } /** * Trim and conditionally capitalize string values. * * @private * @param {string} string The string to format. * @returns {string} The formatted string. */ function format(string) { string = trim(string); return /^(?:webOS|i(?:OS|P))/.test(string) ? string : capitalize(string); } /** * Iterates over an object's own properties, executing the `callback` for each. * * @private * @param {Object} object The object to iterate over. * @param {Function} callback The function executed per own property. */ function forOwn(object, callback) { for (var key in object) { if (hasOwnProperty.call(object, key)) { callback(object[key], key, object); } } } /** * Gets the internal `[[Class]]` of a value. * * @private * @param {*} value The value. * @returns {string} The `[[Class]]`. */ function getClassOf(value) { return value == null ? capitalize(value) : toString.call(value).slice(8, -1); } /** * Host objects can return type values that are different from their actual * data type. The objects we are concerned with usually return non-primitive * types of "object", "function", or "unknown". * * @private * @param {*} object The owner of the property. * @param {string} property The property to check. * @returns {boolean} Returns `true` if the property value is a non-primitive, else `false`. */ function isHostType(object, property) { var type = object != null ? typeof object[property] : 'number'; return !/^(?:boolean|number|string|undefined)$/.test(type) && (type == 'object' ? !!object[property] : true); } /** * Prepares a string for use in a `RegExp` by making hyphens and spaces optional. * * @private * @param {string} string The string to qualify. * @returns {string} The qualified string. */ function qualify(string) { return String(string).replace(/([ -])(?!$)/g, '$1?'); } /** * A bare-bones `Array#reduce` like utility function. * * @private * @param {Array} array The array to iterate over. * @param {Function} callback The function called per iteration. * @returns {*} The accumulated result. */ function reduce(array, callback) { var accumulator = null; each(array, function(value, index) { accumulator = callback(accumulator, value, index, array); }); return accumulator; } /** * Removes leading and trailing whitespace from a string. * * @private * @param {string} string The string to trim. * @returns {string} The trimmed string. */ function trim(string) { return String(string).replace(/^ +| +$/g, ''); } /*--------------------------------------------------------------------------*/ /** * Creates a new platform object. * * @memberOf platform * @param {Object|string} [ua=navigator.userAgent] The user agent string or * context object. * @returns {Object} A platform object. */ function parse(ua) { /** The environment context object. */ var context = root; /** Used to flag when a custom context is provided. */ var isCustomContext = ua && typeof ua == 'object' && getClassOf(ua) != 'String'; // Juggle arguments. if (isCustomContext) { context = ua; ua = null; } /** Browser navigator object. */ var nav = context.navigator || {}; /** Browser user agent string. */ var userAgent = nav.userAgent || ''; ua || (ua = userAgent); /** Used to flag when `thisBinding` is the [ModuleScope]. */ var isModuleScope = isCustomContext || thisBinding == oldRoot; /** Used to detect if browser is like Chrome. */ var likeChrome = isCustomContext ? !!nav.likeChrome : /\bChrome\b/.test(ua) && !/internal|\n/i.test(toString.toString()); /** Internal `[[Class]]` value shortcuts. */ var objectClass = 'Object', airRuntimeClass = isCustomContext ? objectClass : 'ScriptBridgingProxyObject', enviroClass = isCustomContext ? objectClass : 'Environment', javaClass = (isCustomContext && context.java) ? 'JavaPackage' : getClassOf(context.java), phantomClass = isCustomContext ? objectClass : 'RuntimeObject'; /** Detect Java environments. */ var java = /\bJava/.test(javaClass) && context.java; /** Detect Rhino. */ var rhino = java && getClassOf(context.environment) == enviroClass; /** A character to represent alpha. */ var alpha = java ? 'a' : '\u03b1'; /** A character to represent beta. */ var beta = java ? 'b' : '\u03b2'; /** Browser document object. */ var doc = context.document || {}; /** * Detect Opera browser (Presto-based). * http://www.howtocreate.co.uk/operaStuff/operaObject.html * http://dev.opera.com/articles/view/opera-mini-web-content-authoring-guidelines/#operamini */ var opera = context.operamini || context.opera; /** Opera `[[Class]]`. */ var operaClass = reOpera.test(operaClass = (isCustomContext && opera) ? opera['[[Class]]'] : getClassOf(opera)) ? operaClass : (opera = null); /*------------------------------------------------------------------------*/ /** Temporary variable used over the script's lifetime. */ var data; /** The CPU architecture. */ var arch = ua; /** Platform description array. */ var description = []; /** Platform alpha/beta indicator. */ var prerelease = null; /** A flag to indicate that environment features should be used to resolve the platform. */ var useFeatures = ua == userAgent; /** The browser/environment version. */ var version = useFeatures && opera && typeof opera.version == 'function' && opera.version(); /** A flag to indicate if the OS ends with "/ Version" */ var isSpecialCasedOS; /* Detectable layout engines (order is important). */ var layout = getLayout([ { 'label': 'EdgeHTML', 'pattern': 'Edge' }, 'Trident', { 'label': 'WebKit', 'pattern': 'AppleWebKit' }, 'iCab', 'Presto', 'NetFront', 'Tasman', 'KHTML', 'Gecko' ]); /* Detectable browser names (order is important). */ var name = getName([ 'Adobe AIR', 'Arora', 'Avant Browser', 'Breach', 'Camino', 'Electron', 'Epiphany', 'Fennec', 'Flock', 'Galeon', 'GreenBrowser', 'iCab', 'Iceweasel', 'K-Meleon', 'Konqueror', 'Lunascape', 'Maxthon', { 'label': 'Microsoft Edge', 'pattern': '(?:Edge|Edg|EdgA|EdgiOS)' }, 'Midori', 'Nook Browser', 'PaleMoon', 'PhantomJS', 'Raven', 'Rekonq', 'RockMelt', { 'label': 'Samsung Internet', 'pattern': 'SamsungBrowser' }, 'SeaMonkey', { 'label': 'Silk', 'pattern': '(?:Cloud9|Silk-Accelerated)' }, 'Sleipnir', 'SlimBrowser', { 'label': 'SRWare Iron', 'pattern': 'Iron' }, 'Sunrise', 'Swiftfox', 'Vivaldi', 'Waterfox', 'WebPositive', { 'label': 'Yandex Browser', 'pattern': 'YaBrowser' }, { 'label': 'UC Browser', 'pattern': 'UCBrowser' }, 'Opera Mini', { 'label': 'Opera Mini', 'pattern': 'OPiOS' }, 'Opera', { 'label': 'Opera', 'pattern': 'OPR' }, 'Chromium', 'Chrome', { 'label': 'Chrome', 'pattern': '(?:HeadlessChrome)' }, { 'label': 'Chrome Mobile', 'pattern': '(?:CriOS|CrMo)' }, { 'label': 'Firefox', 'pattern': '(?:Firefox|Minefield)' }, { 'label': 'Firefox for iOS', 'pattern': 'FxiOS' }, { 'label': 'IE', 'pattern': 'IEMobile' }, { 'label': 'IE', 'pattern': 'MSIE' }, 'Safari' ]); /* Detectable products (order is important). */ var product = getProduct([ { 'label': 'BlackBerry', 'pattern': 'BB10' }, 'BlackBerry', { 'label': 'Galaxy S', 'pattern': 'GT-I9000' }, { 'label': 'Galaxy S2', 'pattern': 'GT-I9100' }, { 'label': 'Galaxy S3', 'pattern': 'GT-I9300' }, { 'label': 'Galaxy S4', 'pattern': 'GT-I9500' }, { 'label': 'Galaxy S5', 'pattern': 'SM-G900' }, { 'label': 'Galaxy S6', 'pattern': 'SM-G920' }, { 'label': 'Galaxy S6 Edge', 'pattern': 'SM-G925' }, { 'label': 'Galaxy S7', 'pattern': 'SM-G930' }, { 'label': 'Galaxy S7 Edge', 'pattern': 'SM-G935' }, 'Google TV', 'Lumia', 'iPad', 'iPod', 'iPhone', 'Kindle', { 'label': 'Kindle Fire', 'pattern': '(?:Cloud9|Silk-Accelerated)' }, 'Nexus', 'Nook', 'PlayBook', 'PlayStation Vita', 'PlayStation', 'TouchPad', 'Transformer', { 'label': 'Wii U', 'pattern': 'WiiU' }, 'Wii', 'Xbox One', { 'label': 'Xbox 360', 'pattern': 'Xbox' }, 'Xoom' ]); /* Detectable manufacturers. */ var manufacturer = getManufacturer({ 'Apple': { 'iPad': 1, 'iPhone': 1, 'iPod': 1 }, 'Alcatel': {}, 'Archos': {}, 'Amazon': { 'Kindle': 1, 'Kindle Fire': 1 }, 'Asus': { 'Transformer': 1 }, 'Barnes & Noble': { 'Nook': 1 }, 'BlackBerry': { 'PlayBook': 1 }, 'Google': { 'Google TV': 1, 'Nexus': 1 }, 'HP': { 'TouchPad': 1 }, 'HTC': {}, 'Huawei': {}, 'Lenovo': {}, 'LG': {}, 'Microsoft': { 'Xbox': 1, 'Xbox One': 1 }, 'Motorola': { 'Xoom': 1 }, 'Nintendo': { 'Wii U': 1, 'Wii': 1 }, 'Nokia': { 'Lumia': 1 }, 'Oppo': {}, 'Samsung': { 'Galaxy S': 1, 'Galaxy S2': 1, 'Galaxy S3': 1, 'Galaxy S4': 1 }, 'Sony': { 'PlayStation': 1, 'PlayStation Vita': 1 }, 'Xiaomi': { 'Mi': 1, 'Redmi': 1 } }); /* Detectable operating systems (order is important). */ var os = getOS([ 'Windows Phone', 'KaiOS', 'Android', 'CentOS', { 'label': 'Chrome OS', 'pattern': 'CrOS' }, 'Debian', { 'label': 'DragonFly BSD', 'pattern': 'DragonFly' }, 'Fedora', 'FreeBSD', 'Gentoo', 'Haiku', 'Kubuntu', 'Linux Mint', 'OpenBSD', 'Red Hat', 'SuSE', 'Ubuntu', 'Xubuntu', 'Cygwin', 'Symbian OS', 'hpwOS', 'webOS ', 'webOS', 'Tablet OS', 'Tizen', 'Linux', 'Mac OS X', 'Macintosh', 'Mac', 'Windows 98;', 'Windows ' ]); /*------------------------------------------------------------------------*/ /** * Picks the layout engine from an array of guesses. * * @private * @param {Array} guesses An array of guesses. * @returns {null|string} The detected layout engine. */ function getLayout(guesses) { return reduce(guesses, function(result, guess) { return result || RegExp('\\b' + ( guess.pattern || qualify(guess) ) + '\\b', 'i').exec(ua) && (guess.label || guess); }); } /** * Picks the manufacturer from an array of guesses. * * @private * @param {Array} guesses An object of guesses. * @returns {null|string} The detected manufacturer. */ function getManufacturer(guesses) { return reduce(guesses, function(result, value, key) { // Lookup the manufacturer by product or scan the UA for the manufacturer. return result || ( value[product] || value[/^[a-z]+(?: +[a-z]+\b)*/i.exec(product)] || RegExp('\\b' + qualify(key) + '(?:\\b|\\w*\\d)', 'i').exec(ua) ) && key; }); } /** * Picks the browser name from an array of guesses. * * @private * @param {Array} guesses An array of guesses. * @returns {null|string} The detected browser name. */ function getName(guesses) { return reduce(guesses, function(result, guess) { return result || RegExp('\\b' + ( guess.pattern || qualify(guess) ) + '\\b', 'i').exec(ua) && (guess.label || guess); }); } /** * Picks the OS name from an array of guesses. * * @private * @param {Array} guesses An array of guesses. * @returns {null|string} The detected OS name. */ function getOS(guesses) { return reduce(guesses, function(result, guess) { var pattern = guess.pattern || qualify(guess); if (!result && (result = RegExp('\\b' + pattern + '(?:/[\\d.]+|[ \\w.]*)', 'i').exec(ua) )) { result = cleanupOS(result, pattern, guess.label || guess); } return result; }); } /** * Picks the product name from an array of guesses. * * @private * @param {Array} guesses An array of guesses. * @returns {null|string} The detected product name. */ function getProduct(guesses) { return reduce(guesses, function(result, guess) { var pattern = guess.pattern || qualify(guess); if (!result && (result = RegExp('\\b' + pattern + ' *\\d+[.\\w_]*', 'i').exec(ua) || RegExp('\\b' + pattern + ' *\\w+-[\\w]*', 'i').exec(ua) || RegExp('\\b' + pattern + '(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)', 'i').exec(ua) )) { // Split by forward slash and append product version if needed. if ((result = String((guess.label && !RegExp(pattern, 'i').test(guess.label)) ? guess.label : result).split('/'))[1] && !/[\d.]+/.test(result[0])) { result[0] += ' ' + result[1]; } // Correct character case and cleanup string. guess = guess.label || guess; result = format(result[0] .replace(RegExp(pattern, 'i'), guess) .replace(RegExp('; *(?:' + guess + '[_-])?', 'i'), ' ') .replace(RegExp('(' + guess + ')[-_.]?(\\w)', 'i'), '$1 $2')); } return result; }); } /** * Resolves the version using an array of UA patterns. * * @private * @param {Array} patterns An array of UA patterns. * @returns {null|string} The detected version. */ function getVersion(patterns) { return reduce(patterns, function(result, pattern) { return result || (RegExp(pattern + '(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)', 'i').exec(ua) || 0)[1] || null; }); } /** * Returns `platform.description` when the platform object is coerced to a string. * * @name toString * @memberOf platform * @returns {string} Returns `platform.description` if available, else an empty string. */ function toStringPlatform() { return this.description || ''; } /*------------------------------------------------------------------------*/ // Convert layout to an array so we can add extra details. layout && (layout = [layout]); // Detect Android products. // Browsers on Android devices typically provide their product IDS after "Android;" // up to "Build" or ") AppleWebKit". // Example: // "Mozilla/5.0 (Linux; Android 8.1.0; Moto G (5) Plus) AppleWebKit/537.36 // (KHTML, like Gecko) Chrome/70.0.3538.80 Mobile Safari/537.36" if (/\bAndroid\b/.test(os) && !product && (data = /\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(ua))) { product = trim(data[1]) // Replace any language codes (eg. "en-US"). .replace(/^[a-z]{2}-[a-z]{2};\s*/i, '') || null; } // Detect product names that contain their manufacturer's name. if (manufacturer && !product) { product = getProduct([manufacturer]); } else if (manufacturer && product) { product = product .replace(RegExp('^(' + qualify(manufacturer) + ')[-_.\\s]', 'i'), manufacturer + ' ') .replace(RegExp('^(' + qualify(manufacturer) + ')[-_.]?(\\w)', 'i'), manufacturer + ' $2'); } // Clean up Google TV. if ((data = /\bGoogle TV\b/.exec(product))) { product = data[0]; } // Detect simulators. if (/\bSimulator\b/i.test(ua)) { product = (product ? product + ' ' : '') + 'Simulator'; } // Detect Opera Mini 8+ running in Turbo/Uncompressed mode on iOS. if (name == 'Opera Mini' && /\bOPiOS\b/.test(ua)) { description.push('running in Turbo/Uncompressed mode'); } // Detect IE Mobile 11. if (name == 'IE' && /\blike iPhone OS\b/.test(ua)) { data = parse(ua.replace(/like iPhone OS/, '')); manufacturer = data.manufacturer; product = data.product; } // Detect iOS. else if (/^iP/.test(product)) { name || (name = 'Safari'); os = 'iOS' + ((data = / OS ([\d_]+)/i.exec(ua)) ? ' ' + data[1].replace(/_/g, '.') : ''); } // Detect Kubuntu. else if (name == 'Konqueror' && /^Linux\b/i.test(os)) { os = 'Kubuntu'; } // Detect Android browsers. else if ((manufacturer && manufacturer != 'Google' && ((/Chrome/.test(name) && !/\bMobile Safari\b/i.test(ua)) || /\bVita\b/.test(product))) || (/\bAndroid\b/.test(os) && /^Chrome/.test(name) && /\bVersion\//i.test(ua))) { name = 'Android Browser'; os = /\bAndroid\b/.test(os) ? os : 'Android'; } // Detect Silk desktop/accelerated modes. else if (name == 'Silk') { if (!/\bMobi/i.test(ua)) { os = 'Android'; description.unshift('desktop mode'); } if (/Accelerated *= *true/i.test(ua)) { description.unshift('accelerated'); } } // Detect UC Browser speed mode. else if (name == 'UC Browser' && /\bUCWEB\b/.test(ua)) { description.push('speed mode'); } // Detect PaleMoon identifying as Firefox. else if (name == 'PaleMoon' && (data = /\bFirefox\/([\d.]+)\b/.exec(ua))) { description.push('identifying as Firefox ' + data[1]); } // Detect Firefox OS and products running Firefox. else if (name == 'Firefox' && (data = /\b(Mobile|Tablet|TV)\b/i.exec(ua))) { os || (os = 'Firefox OS'); product || (product = data[1]); } // Detect false positives for Firefox/Safari. else if (!name || (data = !/\bMinefield\b/i.test(ua) && /\b(?:Firefox|Safari)\b/.exec(name))) { // Escape the `/` for Firefox 1. if (name && !product && /[\/,]|^[^(]+?\)/.test(ua.slice(ua.indexOf(data + '/') + 8))) { // Clear name of false positives. name = null; } // Reassign a generic name. if ((data = product || manufacturer || os) && (product || manufacturer || /\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(os))) { name = /[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(os) ? os : data) + ' Browser'; } } // Add Chrome version to description for Electron. else if (name == 'Electron' && (data = (/\bChrome\/([\d.]+)\b/.exec(ua) || 0)[1])) { description.push('Chromium ' + data); } // Detect non-Opera (Presto-based) versions (order is important). if (!version) { version = getVersion([ '(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)', 'Version', qualify(name), '(?:Firefox|Minefield|NetFront)' ]); } // Detect stubborn layout engines. if ((data = layout == 'iCab' && parseFloat(version) > 3 && 'WebKit' || /\bOpera\b/.test(name) && (/\bOPR\b/.test(ua) ? 'Blink' : 'Presto') || /\b(?:Midori|Nook|Safari)\b/i.test(ua) && !/^(?:Trident|EdgeHTML)$/.test(layout) && 'WebKit' || !layout && /\bMSIE\b/i.test(ua) && (os == 'Mac OS' ? 'Tasman' : 'Trident') || layout == 'WebKit' && /\bPlayStation\b(?! Vita\b)/i.test(name) && 'NetFront' )) { layout = [data]; } // Detect Windows Phone 7 desktop mode. if (name == 'IE' && (data = (/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(ua) || 0)[1])) { name += ' Mobile'; os = 'Windows Phone ' + (/\+$/.test(data) ? data : data + '.x'); description.unshift('desktop mode'); } // Detect Windows Phone 8.x desktop mode. else if (/\bWPDesktop\b/i.test(ua)) { name = 'IE Mobile'; os = 'Windows Phone 8.x'; description.unshift('desktop mode'); version || (version = (/\brv:([\d.]+)/.exec(ua) || 0)[1]); } // Detect IE 11 identifying as other browsers. else if (name != 'IE' && layout == 'Trident' && (data = /\brv:([\d.]+)/.exec(ua))) { if (name) { description.push('identifying as ' + name + (version ? ' ' + version : '')); } name = 'IE'; version = data[1]; } // Leverage environment features. if (useFeatures) { // Detect server-side environments. // Rhino has a global function while others have a global object. if (isHostType(context, 'global')) { if (java) { data = java.lang.System; arch = data.getProperty('os.arch'); os = os || data.getProperty('os.name') + ' ' + data.getProperty('os.version'); } if (rhino) { try { version = context.require('ringo/engine').version.join('.'); name = 'RingoJS'; } catch(e) { if ((data = context.system) && data.global.system == context.system) { name = 'Narwhal'; os || (os = data[0].os || null); } } if (!name) { name = 'Rhino'; } } else if ( typeof context.process == 'object' && !context.process.browser && (data = context.process) ) { if (typeof data.versions == 'object') { if (typeof data.versions.electron == 'string') { description.push('Node ' + data.versions.node); name = 'Electron'; version = data.versions.electron; } else if (typeof data.versions.nw == 'string') { description.push('Chromium ' + version, 'Node ' + data.versions.node); name = 'NW.js'; version = data.versions.nw; } } if (!name) { name = 'Node.js'; arch = data.arch; os = data.platform; version = /[\d.]+/.exec(data.version); version = version ? version[0] : null; } } } // Detect Adobe AIR. else if (getClassOf((data = context.runtime)) == airRuntimeClass) { name = 'Adobe AIR'; os = data.flash.system.Capabilities.os; } // Detect PhantomJS. else if (getClassOf((data = context.phantom)) == phantomClass) { name = 'PhantomJS'; version = (data = data.version || null) && (data.major + '.' + data.minor + '.' + data.patch); } // Detect IE compatibility modes. else if (typeof doc.documentMode == 'number' && (data = /\bTrident\/(\d+)/i.exec(ua))) { // We're in compatibility mode when the Trident version + 4 doesn't // equal the document mode. version = [version, doc.documentMode]; if ((data = +data[1] + 4) != version[1]) { description.push('IE ' + version[1] + ' mode'); layout && (layout[1] = ''); version[1] = data; } version = name == 'IE' ? String(version[1].toFixed(1)) : version[0]; } // Detect IE 11 masking as other browsers. else if (typeof doc.documentMode == 'number' && /^(?:Chrome|Firefox)\b/.test(name)) { description.push('masking as ' + name + ' ' + version); name = 'IE'; version = '11.0'; layout = ['Trident']; os = 'Windows'; } os = os && format(os); } // Detect prerelease phases. if (version && (data = /(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(version) || /(?:alpha|beta)(?: ?\d)?/i.exec(ua + ';' + (useFeatures && nav.appMinorVersion)) || /\bMinefield\b/i.test(ua) && 'a' )) { prerelease = /b/i.test(data) ? 'beta' : 'alpha'; version = version.replace(RegExp(data + '\\+?$'), '') + (prerelease == 'beta' ? beta : alpha) + (/\d+\+?/.exec(data) || ''); } // Detect Firefox Mobile. if (name == 'Fennec' || name == 'Firefox' && /\b(?:Android|Firefox OS|KaiOS)\b/.test(os)) { name = 'Firefox Mobile'; } // Obscure Maxthon's unreliable version. else if (name == 'Maxthon' && version) { version = version.replace(/\.[\d.]+/, '.x'); } // Detect Xbox 360 and Xbox One. else if (/\bXbox\b/i.test(product)) { if (product == 'Xbox 360') { os = null; } if (product == 'Xbox 360' && /\bIEMobile\b/.test(ua)) { description.unshift('mobile mode'); } } // Add mobile postfix. else if ((/^(?:Chrome|IE|Opera)$/.test(name) || name && !product && !/Browser|Mobi/.test(name)) && (os == 'Windows CE' || /Mobi/i.test(ua))) { name += ' Mobile'; } // Detect IE platform preview. else if (name == 'IE' && useFeatures) { try { if (context.external === null) { description.unshift('platform preview'); } } catch(e) { description.unshift('embedded'); } } // Detect BlackBerry OS version. // http://docs.blackberry.com/en/developers/deliverables/18169/HTTP_headers_sent_by_BB_Browser_1234911_11.jsp else if ((/\bBlackBerry\b/.test(product) || /\bBB10\b/.test(ua)) && (data = (RegExp(product.replace(/ +/g, ' *') + '/([.\\d]+)', 'i').exec(ua) || 0)[1] || version )) { data = [data, /BB10/.test(ua)]; os = (data[1] ? (product = null, manufacturer = 'BlackBerry') : 'Device Software') + ' ' + data[0]; version = null; } // Detect Opera identifying/masking itself as another browser. // http://www.opera.com/support/kb/view/843/ else if (this != forOwn && product != 'Wii' && ( (useFeatures && opera) || (/Opera/.test(name) && /\b(?:MSIE|Firefox)\b/i.test(ua)) || (name == 'Firefox' && /\bOS X (?:\d+\.){2,}/.test(os)) || (name == 'IE' && ( (os && !/^Win/.test(os) && version > 5.5) || /\bWindows XP\b/.test(os) && version > 8 || version == 8 && !/\bTrident\b/.test(ua) )) ) && !reOpera.test((data = parse.call(forOwn, ua.replace(reOpera, '') + ';'))) && data.name) { // When "identifying", the UA contains both Opera and the other browser's name. data = 'ing as ' + data.name + ((data = data.version) ? ' ' + data : ''); if (reOpera.test(name)) { if (/\bIE\b/.test(data) && os == 'Mac OS') { os = null; } data = 'identify' + data; } // When "masking", the UA contains only the other browser's name. else { data = 'mask' + data; if (operaClass) { name = format(operaClass.replace(/([a-z])([A-Z])/g, '$1 $2')); } else { name = 'Opera'; } if (/\bIE\b/.test(data)) { os = null; } if (!useFeatures) { version = null; } } layout = ['Presto']; description.push(data); } // Detect WebKit Nightly and approximate Chrome/Safari versions. if ((data = (/\bAppleWebKit\/([\d.]+\+?)/i.exec(ua) || 0)[1])) { // Correct build number for numeric comparison. // (e.g. "532.5" becomes "532.05") data = [parseFloat(data.replace(/\.(\d)$/, '.0$1')), data]; // Nightly builds are postfixed with a "+". if (name == 'Safari' && data[1].slice(-1) == '+') { name = 'WebKit Nightly'; prerelease = 'alpha'; version = data[1].slice(0, -1); } // Clear incorrect browser versions. else if (version == data[1] || version == (data[2] = (/\bSafari\/([\d.]+\+?)/i.exec(ua) || 0)[1])) { version = null; } // Use the full Chrome version when available. data[1] = (/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(ua) || 0)[1]; // Detect Blink layout engine. if (data[0] == 537.36 && data[2] == 537.36 && parseFloat(data[1]) >= 28 && layout == 'WebKit') { layout = ['Blink']; } // Detect JavaScriptCore. // http://stackoverflow.com/questions/6768474/how-can-i-detect-which-javascript-engine-v8-or-jsc-is-used-at-runtime-in-androi if (!useFeatures || (!likeChrome && !data[1])) { layout && (layout[1] = 'like Safari'); data = (data = data[0], data < 400 ? 1 : data < 500 ? 2 : data < 526 ? 3 : data < 533 ? 4 : data < 534 ? '4+' : data < 535 ? 5 : data < 537 ? 6 : data < 538 ? 7 : data < 601 ? 8 : data < 602 ? 9 : data < 604 ? 10 : data < 606 ? 11 : data < 608 ? 12 : '12'); } else { layout && (layout[1] = 'like Chrome'); data = data[1] || (data = data[0], data < 530 ? 1 : data < 532 ? 2 : data < 532.05 ? 3 : data < 533 ? 4 : data < 534.03 ? 5 : data < 534.07 ? 6 : data < 534.10 ? 7 : data < 534.13 ? 8 : data < 534.16 ? 9 : data < 534.24 ? 10 : data < 534.30 ? 11 : data < 535.01 ? 12 : data < 535.02 ? '13+' : data < 535.07 ? 15 : data < 535.11 ? 16 : data < 535.19 ? 17 : data < 536.05 ? 18 : data < 536.10 ? 19 : data < 537.01 ? 20 : data < 537.11 ? '21+' : data < 537.13 ? 23 : data < 537.18 ? 24 : data < 537.24 ? 25 : data < 537.36 ? 26 : layout != 'Blink' ? '27' : '28'); } // Add the postfix of ".x" or "+" for approximate versions. layout && (layout[1] += ' ' + (data += typeof data == 'number' ? '.x' : /[.+]/.test(data) ? '' : '+')); // Obscure version for some Safari 1-2 releases. if (name == 'Safari' && (!version || parseInt(version) > 45)) { version = data; } else if (name == 'Chrome' && /\bHeadlessChrome/i.test(ua)) { description.unshift('headless'); } } // Detect Opera desktop modes. if (name == 'Opera' && (data = /\bzbov|zvav$/.exec(os))) { name += ' '; description.unshift('desktop mode'); if (data == 'zvav') { name += 'Mini'; version = null; } else { name += 'Mobile'; } os = os.replace(RegExp(' *' + data + '$'), ''); } // Detect Chrome desktop mode. else if (name == 'Safari' && /\bChrome\b/.exec(layout && layout[1])) { description.unshift('desktop mode'); name = 'Chrome Mobile'; version = null; if (/\bOS X\b/.test(os)) { manufacturer = 'Apple'; os = 'iOS 4.3+'; } else { os = null; } } // Newer versions of SRWare Iron uses the Chrome tag to indicate its version number. else if (/\bSRWare Iron\b/.test(name) && !version) { version = getVersion('Chrome'); } // Strip incorrect OS versions. if (version && version.indexOf((data = /[\d.]+$/.exec(os))) == 0 && ua.indexOf('/' + data + '-') > -1) { os = trim(os.replace(data, '')); } // Ensure OS does not include the browser name. if (os && os.indexOf(name) != -1 && !RegExp(name + ' OS').test(os)) { os = os.replace(RegExp(' *' + qualify(name) + ' *'), ''); } // Add layout engine. if (layout && !/\b(?:Avant|Nook)\b/.test(name) && ( /Browser|Lunascape|Maxthon/.test(name) || name != 'Safari' && /^iOS/.test(os) && /\bSafari\b/.test(layout[1]) || /^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(name) && layout[1])) { // Don't add layout details to description if they are falsey. (data = layout[layout.length - 1]) && description.push(data); } // Combine contextual information. if (description.length) { description = ['(' + description.join('; ') + ')']; } // Append manufacturer to description. if (manufacturer && product && product.indexOf(manufacturer) < 0) { description.push('on ' + manufacturer); } // Append product to description. if (product) { description.push((/^on /.test(description[description.length - 1]) ? '' : 'on ') + product); } // Parse the OS into an object. if (os) { data = / ([\d.+]+)$/.exec(os); isSpecialCasedOS = data && os.charAt(os.length - data[0].length - 1) == '/'; os = { 'architecture': 32, 'family': (data && !isSpecialCasedOS) ? os.replace(data[0], '') : os, 'version': data ? data[1] : null, 'toString': function() { var version = this.version; return this.family + ((version && !isSpecialCasedOS) ? ' ' + version : '') + (this.architecture == 64 ? ' 64-bit' : ''); } }; } // Add browser/OS architecture. if ((data = /\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(arch)) && !/\bi686\b/i.test(arch)) { if (os) { os.architecture = 64; os.family = os.family.replace(RegExp(' *' + data), ''); } if ( name && (/\bWOW64\b/i.test(ua) || (useFeatures && /\w(?:86|32)$/.test(nav.cpuClass || nav.platform) && !/\bWin64; x64\b/i.test(ua))) ) { description.unshift('32-bit'); } } // Chrome 39 and above on OS X is always 64-bit. else if ( os && /^OS X/.test(os.family) && name == 'Chrome' && parseFloat(version) >= 39 ) { os.architecture = 64; } ua || (ua = null); /*------------------------------------------------------------------------*/ /** * The platform object. * * @name platform * @type Object */ var platform = {}; /** * The platform description. * * @memberOf platform * @type string|null */ platform.description = ua; /** * The name of the browser's layout engine. * * The list of common layout engines include: * "Blink", "EdgeHTML", "Gecko", "Trident" and "WebKit" * * @memberOf platform * @type string|null */ platform.layout = layout && layout[0]; /** * The name of the product's manufacturer. * * The list of manufacturers include: * "Apple", "Archos", "Amazon", "Asus", "Barnes & Noble", "BlackBerry", * "Google", "HP", "HTC", "LG", "Microsoft", "Motorola", "Nintendo", * "Nokia", "Samsung" and "Sony" * * @memberOf platform * @type string|null */ platform.manufacturer = manufacturer; /** * The name of the browser/environment. * * The list of common browser names include: * "Chrome", "Electron", "Firefox", "Firefox for iOS", "IE", * "Microsoft Edge", "PhantomJS", "Safari", "SeaMonkey", "Silk", * "Opera Mini" and "Opera" * * Mobile versions of some browsers have "Mobile" appended to their name: * eg. "Chrome Mobile", "Firefox Mobile", "IE Mobile" and "Opera Mobile" * * @memberOf platform * @type string|null */ platform.name = name; /** * The alpha/beta release indicator. * * @memberOf platform * @type string|null */ platform.prerelease = prerelease; /** * The name of the product hosting the browser. * * The list of common products include: * * "BlackBerry", "Galaxy S4", "Lumia", "iPad", "iPod", "iPhone", "Kindle", * "Kindle Fire", "Nexus", "Nook", "PlayBook", "TouchPad" and "Transformer" * * @memberOf platform * @type string|null */ platform.product = product; /** * The browser's user agent string. * * @memberOf platform * @type string|null */ platform.ua = ua; /** * The browser/environment version. * * @memberOf platform * @type string|null */ platform.version = name && version; /** * The name of the operating system. * * @memberOf platform * @type Object */ platform.os = os || { /** * The CPU architecture the OS is built for. * * @memberOf platform.os * @type number|null */ 'architecture': null, /** * The family of the OS. * * Common values include: * "Windows", "Windows Server 2008 R2 / 7", "Windows Server 2008 / Vista", * "Windows XP", "OS X", "Linux", "Ubuntu", "Debian", "Fedora", "Red Hat", * "SuSE", "Android", "iOS" and "Windows Phone" * * @memberOf platform.os * @type string|null */ 'family': null, /** * The version of the OS. * * @memberOf platform.os * @type string|null */ 'version': null, /** * Returns the OS string. * * @memberOf platform.os * @returns {string} The OS string. */ 'toString': function() { return 'null'; } }; platform.parse = parse; platform.toString = toStringPlatform; if (platform.version) { description.unshift(version); } if (platform.name) { description.unshift(name); } if (os && name && !(os == String(os).split(' ')[0] && (os == name.split(' ')[0] || product))) { description.push(product ? '(' + os + ')' : 'on ' + os); } if (description.length) { platform.description = description.join(' '); } return platform; } /*--------------------------------------------------------------------------*/ // Export platform. var platform = parse(); // Some AMD build optimizers, like r.js, check for condition patterns like the following: if (true) { // Expose platform on the global object to prevent errors when platform is // loaded by a script tag in the presence of an AMD loader. // See http://requirejs.org/docs/errors.html#mismatch for more details. root.platform = platform; // Define as an anonymous module so platform can be aliased through path mapping. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return platform; }).call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } // Check for `exports` after `define` in case a build optimizer adds an `exports` object. else {} }.call(this)); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(7)(module), __webpack_require__(0))) /***/ }), /* 7 */ /***/ (function(module, exports) { module.exports = function(module) { if (!module.webpackPolyfill) { module.deprecate = function() {}; module.paths = []; // module.parent = undefined by default if (!module.children) module.children = []; Object.defineProperty(module, "loaded", { enumerable: true, get: function() { return module.l; } }); Object.defineProperty(module, "id", { enumerable: true, get: function() { return module.i; } }); module.webpackPolyfill = 1; } return module; }; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* # ----------------------------------------------------------------------------- # ~/js/adapter/adapter.js # Provides an empty object for later loaded adapter objects # # Product/Info: # https://jekyll.one # # Copyright (C) 2021 Juergen Adams # # J1 Template is licensed under MIT License. # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE # ----------------------------------------------------------------------------- */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* eslint no-unused-vars: "off" */ /* eslint no-undef: "off" */ // ----------------------------------------------------------------------------- /*! * J1 Adapter * Copyright (C) 2021 Juergen Adams * Licensed under MIT License. */ module.exports = function (j1, window) { return { // ------------------------------------------------------------------------- // _init_ // Global initializer for the adapter object // ------------------------------------------------------------------------- _init_: function _init_() { return; } // END _init_ }; // END return }(j1, window); /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* * anime.js v3.2.0 * (c) 2020 Julian Garnier * Released under the MIT license * animejs.com */ // Defaults var defaultInstanceSettings = { update: null, begin: null, loopBegin: null, changeBegin: null, change: null, changeComplete: null, loopComplete: null, complete: null, loop: 1, direction: 'normal', autoplay: true, timelineOffset: 0 }; var defaultTweenSettings = { duration: 1000, delay: 0, endDelay: 0, easing: 'easeOutElastic(1, .5)', round: 0 }; var validTransforms = ['translateX', 'translateY', 'translateZ', 'rotate', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'perspective', 'matrix', 'matrix3d']; // Caching var cache = { CSS: {}, springs: {} }; // Utils function minMax(val, min, max) { return Math.min(Math.max(val, min), max); } function stringContains(str, text) { return str.indexOf(text) > -1; } function applyArguments(func, args) { return func.apply(null, args); } var is = { arr: function arr(a) { return Array.isArray(a); }, obj: function obj(a) { return stringContains(Object.prototype.toString.call(a), 'Object'); }, pth: function pth(a) { return is.obj(a) && a.hasOwnProperty('totalLength'); }, svg: function svg(a) { return a instanceof SVGElement; }, inp: function inp(a) { return a instanceof HTMLInputElement; }, dom: function dom(a) { return a.nodeType || is.svg(a); }, str: function str(a) { return typeof a === 'string'; }, fnc: function fnc(a) { return typeof a === 'function'; }, und: function und(a) { return typeof a === 'undefined'; }, hex: function hex(a) { return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a); }, rgb: function rgb(a) { return /^rgb/.test(a); }, hsl: function hsl(a) { return /^hsl/.test(a); }, col: function col(a) { return is.hex(a) || is.rgb(a) || is.hsl(a); }, key: function key(a) { return !defaultInstanceSettings.hasOwnProperty(a) && !defaultTweenSettings.hasOwnProperty(a) && a !== 'targets' && a !== 'keyframes'; } }; // Easings function parseEasingParameters(string) { var match = /\(([^)]+)\)/.exec(string); return match ? match[1].split(',').map(function (p) { return parseFloat(p); }) : []; } // Spring solver inspired by Webkit Copyright © 2016 Apple Inc. All rights reserved. https://webkit.org/demos/spring/spring.js function spring(string, duration) { var params = parseEasingParameters(string); var mass = minMax(is.und(params[0]) ? 1 : params[0], .1, 100); var stiffness = minMax(is.und(params[1]) ? 100 : params[1], .1, 100); var damping = minMax(is.und(params[2]) ? 10 : params[2], .1, 100); var velocity = minMax(is.und(params[3]) ? 0 : params[3], .1, 100); var w0 = Math.sqrt(stiffness / mass); var zeta = damping / (2 * Math.sqrt(stiffness * mass)); var wd = zeta < 1 ? w0 * Math.sqrt(1 - zeta * zeta) : 0; var a = 1; var b = zeta < 1 ? (zeta * w0 + -velocity) / wd : -velocity + w0; function solver(t) { var progress = duration ? duration * t / 1000 : t; if (zeta < 1) { progress = Math.exp(-progress * zeta * w0) * (a * Math.cos(wd * progress) + b * Math.sin(wd * progress)); } else { progress = (a + b * progress) * Math.exp(-progress * w0); } if (t === 0 || t === 1) { return t; } return 1 - progress; } function getDuration() { var cached = cache.springs[string]; if (cached) { return cached; } var frame = 1 / 6; var elapsed = 0; var rest = 0; while (true) { elapsed += frame; if (solver(elapsed) === 1) { rest++; if (rest >= 16) { break; } } else { rest = 0; } } var duration = elapsed * frame * 1000; cache.springs[string] = duration; return duration; } return duration ? solver : getDuration; } // Basic steps easing implementation https://developer.mozilla.org/fr/docs/Web/CSS/transition-timing-function function steps(steps) { if (steps === void 0) steps = 10; return function (t) { return Math.ceil(minMax(t, 0.000001, 1) * steps) * (1 / steps); }; } // BezierEasing https://github.com/gre/bezier-easing var bezier = function () { var kSplineTableSize = 11; var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0); function A(aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1; } function B(aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1; } function C(aA1) { return 3.0 * aA1; } function calcBezier(aT, aA1, aA2) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT; } function getSlope(aT, aA1, aA2) { return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1); } function binarySubdivide(aX, aA, aB, mX1, mX2) { var currentX, currentT, i = 0; do { currentT = aA + (aB - aA) / 2.0; currentX = calcBezier(currentT, mX1, mX2) - aX; if (currentX > 0.0) { aB = currentT; } else { aA = currentT; } } while (Math.abs(currentX) > 0.0000001 && ++i < 10); return currentT; } function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) { for (var i = 0; i < 4; ++i) { var currentSlope = getSlope(aGuessT, mX1, mX2); if (currentSlope === 0.0) { return aGuessT; } var currentX = calcBezier(aGuessT, mX1, mX2) - aX; aGuessT -= currentX / currentSlope; } return aGuessT; } function bezier(mX1, mY1, mX2, mY2) { if (!(0 <= mX1 && mX1 <= 1 && 0 <= mX2 && mX2 <= 1)) { return; } var sampleValues = new Float32Array(kSplineTableSize); if (mX1 !== mY1 || mX2 !== mY2) { for (var i = 0; i < kSplineTableSize; ++i) { sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2); } } function getTForX(aX) { var intervalStart = 0; var currentSample = 1; var lastSample = kSplineTableSize - 1; for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) { intervalStart += kSampleStepSize; } --currentSample; var dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]); var guessForT = intervalStart + dist * kSampleStepSize; var initialSlope = getSlope(guessForT, mX1, mX2); if (initialSlope >= 0.001) { return newtonRaphsonIterate(aX, guessForT, mX1, mX2); } else if (initialSlope === 0.0) { return guessForT; } else { return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2); } } return function (x) { if (mX1 === mY1 && mX2 === mY2) { return x; } if (x === 0 || x === 1) { return x; } return calcBezier(getTForX(x), mY1, mY2); }; } return bezier; }(); var penner = function () { // Based on jQuery UI's implemenation of easing equations from Robert Penner (http://www.robertpenner.com/easing) var eases = { linear: function linear() { return function (t) { return t; }; } }; var functionEasings = { Sine: function Sine() { return function (t) { return 1 - Math.cos(t * Math.PI / 2); }; }, Circ: function Circ() { return function (t) { return 1 - Math.sqrt(1 - t * t); }; }, Back: function Back() { return function (t) { return t * t * (3 * t - 2); }; }, Bounce: function Bounce() { return function (t) { var pow2, b = 4; while (t < ((pow2 = Math.pow(2, --b)) - 1) / 11) {} return 1 / Math.pow(4, 3 - b) - 7.5625 * Math.pow((pow2 * 3 - 2) / 22 - t, 2); }; }, Elastic: function Elastic(amplitude, period) { if (amplitude === void 0) amplitude = 1; if (period === void 0) period = .5; var a = minMax(amplitude, 1, 10); var p = minMax(period, .1, 2); return function (t) { return t === 0 || t === 1 ? t : -a * Math.pow(2, 10 * (t - 1)) * Math.sin((t - 1 - p / (Math.PI * 2) * Math.asin(1 / a)) * (Math.PI * 2) / p); }; } }; var baseEasings = ['Quad', 'Cubic', 'Quart', 'Quint', 'Expo']; baseEasings.forEach(function (name, i) { functionEasings[name] = function () { return function (t) { return Math.pow(t, i + 2); }; }; }); Object.keys(functionEasings).forEach(function (name) { var easeIn = functionEasings[name]; eases['easeIn' + name] = easeIn; eases['easeOut' + name] = function (a, b) { return function (t) { return 1 - easeIn(a, b)(1 - t); }; }; eases['easeInOut' + name] = function (a, b) { return function (t) { return t < 0.5 ? easeIn(a, b)(t * 2) / 2 : 1 - easeIn(a, b)(t * -2 + 2) / 2; }; }; }); return eases; }(); function parseEasings(easing, duration) { if (is.fnc(easing)) { return easing; } var name = easing.split('(')[0]; var ease = penner[name]; var args = parseEasingParameters(easing); switch (name) { case 'spring': return spring(easing, duration); case 'cubicBezier': return applyArguments(bezier, args); case 'steps': return applyArguments(steps, args); default: return applyArguments(ease, args); } } // Strings function selectString(str) { try { var nodes = document.querySelectorAll(str); return nodes; } catch (e) { return; } } // Arrays function filterArray(arr, callback) { var len = arr.length; var thisArg = arguments.length >= 2 ? arguments[1] : void 0; var result = []; for (var i = 0; i < len; i++) { if (i in arr) { var val = arr[i]; if (callback.call(thisArg, val, i, arr)) { result.push(val); } } } return result; } function flattenArray(arr) { return arr.reduce(function (a, b) { return a.concat(is.arr(b) ? flattenArray(b) : b); }, []); } function toArray(o) { if (is.arr(o)) { return o; } if (is.str(o)) { o = selectString(o) || o; } if (o instanceof NodeList || o instanceof HTMLCollection) { return [].slice.call(o); } return [o]; } function arrayContains(arr, val) { return arr.some(function (a) { return a === val; }); } // Objects function cloneObject(o) { var clone = {}; for (var p in o) { clone[p] = o[p]; } return clone; } function replaceObjectProps(o1, o2) { var o = cloneObject(o1); for (var p in o1) { o[p] = o2.hasOwnProperty(p) ? o2[p] : o1[p]; } return o; } function mergeObjects(o1, o2) { var o = cloneObject(o1); for (var p in o2) { o[p] = is.und(o1[p]) ? o2[p] : o1[p]; } return o; } // Colors function rgbToRgba(rgbValue) { var rgb = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(rgbValue); return rgb ? "rgba(" + rgb[1] + ",1)" : rgbValue; } function hexToRgba(hexValue) { var rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; var hex = hexValue.replace(rgx, function (m, r, g, b) { return r + r + g + g + b + b; }); var rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); var r = parseInt(rgb[1], 16); var g = parseInt(rgb[2], 16); var b = parseInt(rgb[3], 16); return "rgba(" + r + "," + g + "," + b + ",1)"; } function hslToRgba(hslValue) { var hsl = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(hslValue) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(hslValue); var h = parseInt(hsl[1], 10) / 360; var s = parseInt(hsl[2], 10) / 100; var l = parseInt(hsl[3], 10) / 100; var a = hsl[4] || 1; function hue2rgb(p, q, t) { if (t < 0) { t += 1; } if (t > 1) { t -= 1; } if (t < 1 / 6) { return p + (q - p) * 6 * t; } if (t < 1 / 2) { return q; } if (t < 2 / 3) { return p + (q - p) * (2 / 3 - t) * 6; } return p; } var r, g, b; if (s == 0) { r = g = b = l; } else { var q = l < 0.5 ? l * (1 + s) : l + s - l * s; var p = 2 * l - q; r = hue2rgb(p, q, h + 1 / 3); g = hue2rgb(p, q, h); b = hue2rgb(p, q, h - 1 / 3); } return "rgba(" + r * 255 + "," + g * 255 + "," + b * 255 + "," + a + ")"; } function colorToRgb(val) { if (is.rgb(val)) { return rgbToRgba(val); } if (is.hex(val)) { return hexToRgba(val); } if (is.hsl(val)) { return hslToRgba(val); } } // Units function getUnit(val) { var split = /[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(val); if (split) { return split[1]; } } function getTransformUnit(propName) { if (stringContains(propName, 'translate') || propName === 'perspective') { return 'px'; } if (stringContains(propName, 'rotate') || stringContains(propName, 'skew')) { return 'deg'; } } // Values function getFunctionValue(val, animatable) { if (!is.fnc(val)) { return val; } return val(animatable.target, animatable.id, animatable.total); } function getAttribute(el, prop) { return el.getAttribute(prop); } function convertPxToUnit(el, value, unit) { var valueUnit = getUnit(value); if (arrayContains([unit, 'deg', 'rad', 'turn'], valueUnit)) { return value; } var cached = cache.CSS[value + unit]; if (!is.und(cached)) { return cached; } var baseline = 100; var tempEl = document.createElement(el.tagName); var parentEl = el.parentNode && el.parentNode !== document ? el.parentNode : document.body; parentEl.appendChild(tempEl); tempEl.style.position = 'absolute'; tempEl.style.width = baseline + unit; var factor = baseline / tempEl.offsetWidth; parentEl.removeChild(tempEl); var convertedUnit = factor * parseFloat(value); cache.CSS[value + unit] = convertedUnit; return convertedUnit; } function getCSSValue(el, prop, unit) { if (prop in el.style) { var uppercasePropName = prop.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); var value = el.style[prop] || getComputedStyle(el).getPropertyValue(uppercasePropName) || '0'; return unit ? convertPxToUnit(el, value, unit) : value; } } function getAnimationType(el, prop) { if (is.dom(el) && !is.inp(el) && (getAttribute(el, prop) || is.svg(el) && el[prop])) { return 'attribute'; } if (is.dom(el) && arrayContains(validTransforms, prop)) { return 'transform'; } if (is.dom(el) && prop !== 'transform' && getCSSValue(el, prop)) { return 'css'; } if (el[prop] != null) { return 'object'; } } function getElementTransforms(el) { if (!is.dom(el)) { return; } var str = el.style.transform || ''; var reg = /(\w+)\(([^)]*)\)/g; var transforms = new Map(); var m; while (m = reg.exec(str)) { transforms.set(m[1], m[2]); } return transforms; } function getTransformValue(el, propName, animatable, unit) { var defaultVal = stringContains(propName, 'scale') ? 1 : 0 + getTransformUnit(propName); var value = getElementTransforms(el).get(propName) || defaultVal; if (animatable) { animatable.transforms.list.set(propName, value); animatable.transforms['last'] = propName; } return unit ? convertPxToUnit(el, value, unit) : value; } function getOriginalTargetValue(target, propName, unit, animatable) { switch (getAnimationType(target, propName)) { case 'transform': return getTransformValue(target, propName, animatable, unit); case 'css': return getCSSValue(target, propName, unit); case 'attribute': return getAttribute(target, propName); default: return target[propName] || 0; } } function getRelativeValue(to, from) { var operator = /^(\*=|\+=|-=)/.exec(to); if (!operator) { return to; } var u = getUnit(to) || 0; var x = parseFloat(from); var y = parseFloat(to.replace(operator[0], '')); switch (operator[0][0]) { case '+': return x + y + u; case '-': return x - y + u; case '*': return x * y + u; } } function validateValue(val, unit) { if (is.col(val)) { return colorToRgb(val); } if (/\s/g.test(val)) { return val; } var originalUnit = getUnit(val); var unitLess = originalUnit ? val.substr(0, val.length - originalUnit.length) : val; if (unit) { return unitLess + unit; } return unitLess; } // getTotalLength() equivalent for circle, rect, polyline, polygon and line shapes // adapted from https://gist.github.com/SebLambla/3e0550c496c236709744 function getDistance(p1, p2) { return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)); } function getCircleLength(el) { return Math.PI * 2 * getAttribute(el, 'r'); } function getRectLength(el) { return getAttribute(el, 'width') * 2 + getAttribute(el, 'height') * 2; } function getLineLength(el) { return getDistance({ x: getAttribute(el, 'x1'), y: getAttribute(el, 'y1') }, { x: getAttribute(el, 'x2'), y: getAttribute(el, 'y2') }); } function getPolylineLength(el) { var points = el.points; var totalLength = 0; var previousPos; for (var i = 0; i < points.numberOfItems; i++) { var currentPos = points.getItem(i); if (i > 0) { totalLength += getDistance(previousPos, currentPos); } previousPos = currentPos; } return totalLength; } function getPolygonLength(el) { var points = el.points; return getPolylineLength(el) + getDistance(points.getItem(points.numberOfItems - 1), points.getItem(0)); } // Path animation function getTotalLength(el) { if (el.getTotalLength) { return el.getTotalLength(); } switch (el.tagName.toLowerCase()) { case 'circle': return getCircleLength(el); case 'rect': return getRectLength(el); case 'line': return getLineLength(el); case 'polyline': return getPolylineLength(el); case 'polygon': return getPolygonLength(el); } } function setDashoffset(el) { var pathLength = getTotalLength(el); el.setAttribute('stroke-dasharray', pathLength); return pathLength; } // Motion path function getParentSvgEl(el) { var parentEl = el.parentNode; while (is.svg(parentEl)) { if (!is.svg(parentEl.parentNode)) { break; } parentEl = parentEl.parentNode; } return parentEl; } function getParentSvg(pathEl, svgData) { var svg = svgData || {}; var parentSvgEl = svg.el || getParentSvgEl(pathEl); var rect = parentSvgEl.getBoundingClientRect(); var viewBoxAttr = getAttribute(parentSvgEl, 'viewBox'); var width = rect.width; var height = rect.height; var viewBox = svg.viewBox || (viewBoxAttr ? viewBoxAttr.split(' ') : [0, 0, width, height]); return { el: parentSvgEl, viewBox: viewBox, x: viewBox[0] / 1, y: viewBox[1] / 1, w: width / viewBox[2], h: height / viewBox[3] }; } function getPath(path, percent) { var pathEl = is.str(path) ? selectString(path)[0] : path; var p = percent || 100; return function (property) { return { property: property, el: pathEl, svg: getParentSvg(pathEl), totalLength: getTotalLength(pathEl) * (p / 100) }; }; } function getPathProgress(path, progress) { function point(offset) { if (offset === void 0) offset = 0; var l = progress + offset >= 1 ? progress + offset : 0; return path.el.getPointAtLength(l); } var svg = getParentSvg(path.el, path.svg); var p = point(); var p0 = point(-1); var p1 = point(+1); switch (path.property) { case 'x': return (p.x - svg.x) * svg.w; case 'y': return (p.y - svg.y) * svg.h; case 'angle': return Math.atan2(p1.y - p0.y, p1.x - p0.x) * 180 / Math.PI; } } // Decompose value function decomposeValue(val, unit) { // const rgx = /-?\d*\.?\d+/g; // handles basic numbers // const rgx = /[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g; // handles exponents notation var rgx = /[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g; // handles exponents notation var value = validateValue(is.pth(val) ? val.totalLength : val, unit) + ''; return { original: value, numbers: value.match(rgx) ? value.match(rgx).map(Number) : [0], strings: is.str(val) || unit ? value.split(rgx) : [] }; } // Animatables function parseTargets(targets) { var targetsArray = targets ? flattenArray(is.arr(targets) ? targets.map(toArray) : toArray(targets)) : []; return filterArray(targetsArray, function (item, pos, self) { return self.indexOf(item) === pos; }); } function getAnimatables(targets) { var parsed = parseTargets(targets); return parsed.map(function (t, i) { return { target: t, id: i, total: parsed.length, transforms: { list: getElementTransforms(t) } }; }); } // Properties function normalizePropertyTweens(prop, tweenSettings) { var settings = cloneObject(tweenSettings); // Override duration if easing is a spring if (/^spring/.test(settings.easing)) { settings.duration = spring(settings.easing); } if (is.arr(prop)) { var l = prop.length; var isFromTo = l === 2 && !is.obj(prop[0]); if (!isFromTo) { // Duration divided by the number of tweens if (!is.fnc(tweenSettings.duration)) { settings.duration = tweenSettings.duration / l; } } else { // Transform [from, to] values shorthand to a valid tween value prop = { value: prop }; } } var propArray = is.arr(prop) ? prop : [prop]; return propArray.map(function (v, i) { var obj = is.obj(v) && !is.pth(v) ? v : { value: v }; // Default delay value should only be applied to the first tween if (is.und(obj.delay)) { obj.delay = !i ? tweenSettings.delay : 0; } // Default endDelay value should only be applied to the last tween if (is.und(obj.endDelay)) { obj.endDelay = i === propArray.length - 1 ? tweenSettings.endDelay : 0; } return obj; }).map(function (k) { return mergeObjects(k, settings); }); } function flattenKeyframes(keyframes) { var propertyNames = filterArray(flattenArray(keyframes.map(function (key) { return Object.keys(key); })), function (p) { return is.key(p); }).reduce(function (a, b) { if (a.indexOf(b) < 0) { a.push(b); } return a; }, []); var properties = {}; var loop = function loop(i) { var propName = propertyNames[i]; properties[propName] = keyframes.map(function (key) { var newKey = {}; for (var p in key) { if (is.key(p)) { if (p == propName) { newKey.value = key[p]; } } else { newKey[p] = key[p]; } } return newKey; }); }; for (var i = 0; i < propertyNames.length; i++) { loop(i); } return properties; } function getProperties(tweenSettings, params) { var properties = []; var keyframes = params.keyframes; if (keyframes) { params = mergeObjects(flattenKeyframes(keyframes), params); } for (var p in params) { if (is.key(p)) { properties.push({ name: p, tweens: normalizePropertyTweens(params[p], tweenSettings) }); } } return properties; } // Tweens function normalizeTweenValues(tween, animatable) { var t = {}; for (var p in tween) { var value = getFunctionValue(tween[p], animatable); if (is.arr(value)) { value = value.map(function (v) { return getFunctionValue(v, animatable); }); if (value.length === 1) { value = value[0]; } } t[p] = value; } t.duration = parseFloat(t.duration); t.delay = parseFloat(t.delay); return t; } function normalizeTweens(prop, animatable) { var previousTween; return prop.tweens.map(function (t) { var tween = normalizeTweenValues(t, animatable); var tweenValue = tween.value; var to = is.arr(tweenValue) ? tweenValue[1] : tweenValue; var toUnit = getUnit(to); var originalValue = getOriginalTargetValue(animatable.target, prop.name, toUnit, animatable); var previousValue = previousTween ? previousTween.to.original : originalValue; var from = is.arr(tweenValue) ? tweenValue[0] : previousValue; var fromUnit = getUnit(from) || getUnit(originalValue); var unit = toUnit || fromUnit; if (is.und(to)) { to = previousValue; } tween.from = decomposeValue(from, unit); tween.to = decomposeValue(getRelativeValue(to, from), unit); tween.start = previousTween ? previousTween.end : 0; tween.end = tween.start + tween.delay + tween.duration + tween.endDelay; tween.easing = parseEasings(tween.easing, tween.duration); tween.isPath = is.pth(tweenValue); tween.isColor = is.col(tween.from.original); if (tween.isColor) { tween.round = 1; } previousTween = tween; return tween; }); } // Tween progress var setProgressValue = { css: function css(t, p, v) { return t.style[p] = v; }, attribute: function attribute(t, p, v) { return t.setAttribute(p, v); }, object: function object(t, p, v) { return t[p] = v; }, transform: function transform(t, p, v, transforms, manual) { transforms.list.set(p, v); if (p === transforms.last || manual) { var str = ''; transforms.list.forEach(function (value, prop) { str += prop + "(" + value + ") "; }); t.style.transform = str; } } }; // Set Value helper function setTargetsValue(targets, properties) { var animatables = getAnimatables(targets); animatables.forEach(function (animatable) { for (var property in properties) { var value = getFunctionValue(properties[property], animatable); var target = animatable.target; var valueUnit = getUnit(value); var originalValue = getOriginalTargetValue(target, property, valueUnit, animatable); var unit = valueUnit || getUnit(originalValue); var to = getRelativeValue(validateValue(value, unit), originalValue); var animType = getAnimationType(target, property); setProgressValue[animType](target, property, to, animatable.transforms, true); } }); } // Animations function createAnimation(animatable, prop) { var animType = getAnimationType(animatable.target, prop.name); if (animType) { var tweens = normalizeTweens(prop, animatable); var lastTween = tweens[tweens.length - 1]; return { type: animType, property: prop.name, animatable: animatable, tweens: tweens, duration: lastTween.end, delay: tweens[0].delay, endDelay: lastTween.endDelay }; } } function getAnimations(animatables, properties) { return filterArray(flattenArray(animatables.map(function (animatable) { return properties.map(function (prop) { return createAnimation(animatable, prop); }); })), function (a) { return !is.und(a); }); } // Create Instance function getInstanceTimings(animations, tweenSettings) { var animLength = animations.length; var getTlOffset = function getTlOffset(anim) { return anim.timelineOffset ? anim.timelineOffset : 0; }; var timings = {}; timings.duration = animLength ? Math.max.apply(Math, animations.map(function (anim) { return getTlOffset(anim) + anim.duration; })) : tweenSettings.duration; timings.delay = animLength ? Math.min.apply(Math, animations.map(function (anim) { return getTlOffset(anim) + anim.delay; })) : tweenSettings.delay; timings.endDelay = animLength ? timings.duration - Math.max.apply(Math, animations.map(function (anim) { return getTlOffset(anim) + anim.duration - anim.endDelay; })) : tweenSettings.endDelay; return timings; } var instanceID = 0; function createNewInstance(params) { var instanceSettings = replaceObjectProps(defaultInstanceSettings, params); var tweenSettings = replaceObjectProps(defaultTweenSettings, params); var properties = getProperties(tweenSettings, params); var animatables = getAnimatables(params.targets); var animations = getAnimations(animatables, properties); var timings = getInstanceTimings(animations, tweenSettings); var id = instanceID; instanceID++; return mergeObjects(instanceSettings, { id: id, children: [], animatables: animatables, animations: animations, duration: timings.duration, delay: timings.delay, endDelay: timings.endDelay }); } // Core var activeInstances = []; var pausedInstances = []; var raf; var engine = function () { function play() { raf = requestAnimationFrame(step); } function step(t) { var activeInstancesLength = activeInstances.length; if (activeInstancesLength) { var i = 0; while (i < activeInstancesLength) { var activeInstance = activeInstances[i]; if (!activeInstance.paused) { activeInstance.tick(t); } else { var instanceIndex = activeInstances.indexOf(activeInstance); if (instanceIndex > -1) { activeInstances.splice(instanceIndex, 1); activeInstancesLength = activeInstances.length; } } i++; } play(); } else { raf = cancelAnimationFrame(raf); } } return play; }(); function handleVisibilityChange() { if (document.hidden) { activeInstances.forEach(function (ins) { return ins.pause(); }); pausedInstances = activeInstances.slice(0); anime.running = activeInstances = []; } else { pausedInstances.forEach(function (ins) { return ins.play(); }); } } if (typeof document !== 'undefined') { document.addEventListener('visibilitychange', handleVisibilityChange); } // Public Instance function anime(params) { if (params === void 0) params = {}; var startTime = 0, lastTime = 0, now = 0; var children, childrenLength = 0; var resolve = null; function makePromise(instance) { var promise = window.Promise && new Promise(function (_resolve) { return resolve = _resolve; }); instance.finished = promise; return promise; } var instance = createNewInstance(params); var promise = makePromise(instance); function toggleInstanceDirection() { var direction = instance.direction; if (direction !== 'alternate') { instance.direction = direction !== 'normal' ? 'normal' : 'reverse'; } instance.reversed = !instance.reversed; children.forEach(function (child) { return child.reversed = instance.reversed; }); } function adjustTime(time) { return instance.reversed ? instance.duration - time : time; } function resetTime() { startTime = 0; lastTime = adjustTime(instance.currentTime) * (1 / anime.speed); } function seekChild(time, child) { if (child) { child.seek(time - child.timelineOffset); } } function syncInstanceChildren(time) { if (!instance.reversePlayback) { for (var i = 0; i < childrenLength; i++) { seekChild(time, children[i]); } } else { for (var i$1 = childrenLength; i$1--;) { seekChild(time, children[i$1]); } } } function setAnimationsProgress(insTime) { var i = 0; var animations = instance.animations; var animationsLength = animations.length; while (i < animationsLength) { var anim = animations[i]; var animatable = anim.animatable; var tweens = anim.tweens; var tweenLength = tweens.length - 1; var tween = tweens[tweenLength]; // Only check for keyframes if there is more than one tween if (tweenLength) { tween = filterArray(tweens, function (t) { return insTime < t.end; })[0] || tween; } var elapsed = minMax(insTime - tween.start - tween.delay, 0, tween.duration) / tween.duration; var eased = isNaN(elapsed) ? 1 : tween.easing(elapsed); var strings = tween.to.strings; var round = tween.round; var numbers = []; var toNumbersLength = tween.to.numbers.length; var progress = void 0; for (var n = 0; n < toNumbersLength; n++) { var value = void 0; var toNumber = tween.to.numbers[n]; var fromNumber = tween.from.numbers[n] || 0; if (!tween.isPath) { value = fromNumber + eased * (toNumber - fromNumber); } else { value = getPathProgress(tween.value, eased * toNumber); } if (round) { if (!(tween.isColor && n > 2)) { value = Math.round(value * round) / round; } } numbers.push(value); } // Manual Array.reduce for better performances var stringsLength = strings.length; if (!stringsLength) { progress = numbers[0]; } else { progress = strings[0]; for (var s = 0; s < stringsLength; s++) { var a = strings[s]; var b = strings[s + 1]; var n$1 = numbers[s]; if (!isNaN(n$1)) { if (!b) { progress += n$1 + ' '; } else { progress += n$1 + b; } } } } setProgressValue[anim.type](animatable.target, anim.property, progress, animatable.transforms); anim.currentValue = progress; i++; } } function setCallback(cb) { if (instance[cb] && !instance.passThrough) { instance[cb](instance); } } function countIteration() { if (instance.remaining && instance.remaining !== true) { instance.remaining--; } } function setInstanceProgress(engineTime) { var insDuration = instance.duration; var insDelay = instance.delay; var insEndDelay = insDuration - instance.endDelay; var insTime = adjustTime(engineTime); instance.progress = minMax(insTime / insDuration * 100, 0, 100); instance.reversePlayback = insTime < instance.currentTime; if (children) { syncInstanceChildren(insTime); } if (!instance.began && instance.currentTime > 0) { instance.began = true; setCallback('begin'); } if (!instance.loopBegan && instance.currentTime > 0) { instance.loopBegan = true; setCallback('loopBegin'); } if (insTime <= insDelay && instance.currentTime !== 0) { setAnimationsProgress(0); } if (insTime >= insEndDelay && instance.currentTime !== insDuration || !insDuration) { setAnimationsProgress(insDuration); } if (insTime > insDelay && insTime < insEndDelay) { if (!instance.changeBegan) { instance.changeBegan = true; instance.changeCompleted = false; setCallback('changeBegin'); } setCallback('change'); setAnimationsProgress(insTime); } else { if (instance.changeBegan) { instance.changeCompleted = true; instance.changeBegan = false; setCallback('changeComplete'); } } instance.currentTime = minMax(insTime, 0, insDuration); if (instance.began) { setCallback('update'); } if (engineTime >= insDuration) { lastTime = 0; countIteration(); if (!instance.remaining) { instance.paused = true; if (!instance.completed) { instance.completed = true; setCallback('loopComplete'); setCallback('complete'); if (!instance.passThrough && 'Promise' in window) { resolve(); promise = makePromise(instance); } } } else { startTime = now; setCallback('loopComplete'); instance.loopBegan = false; if (instance.direction === 'alternate') { toggleInstanceDirection(); } } } } instance.reset = function () { var direction = instance.direction; instance.passThrough = false; instance.currentTime = 0; instance.progress = 0; instance.paused = true; instance.began = false; instance.loopBegan = false; instance.changeBegan = false; instance.completed = false; instance.changeCompleted = false; instance.reversePlayback = false; instance.reversed = direction === 'reverse'; instance.remaining = instance.loop; children = instance.children; childrenLength = children.length; for (var i = childrenLength; i--;) { instance.children[i].reset(); } if (instance.reversed && instance.loop !== true || direction === 'alternate' && instance.loop === 1) { instance.remaining++; } setAnimationsProgress(instance.reversed ? instance.duration : 0); }; // Set Value helper instance.set = function (targets, properties) { setTargetsValue(targets, properties); return instance; }; instance.tick = function (t) { now = t; if (!startTime) { startTime = now; } setInstanceProgress((now + (lastTime - startTime)) * anime.speed); }; instance.seek = function (time) { setInstanceProgress(adjustTime(time)); }; instance.pause = function () { instance.paused = true; resetTime(); }; instance.play = function () { if (!instance.paused) { return; } if (instance.completed) { instance.reset(); } instance.paused = false; activeInstances.push(instance); resetTime(); if (!raf) { engine(); } }; instance.reverse = function () { toggleInstanceDirection(); instance.completed = instance.reversed ? false : true; resetTime(); }; instance.restart = function () { instance.reset(); instance.play(); }; instance.reset(); if (instance.autoplay) { instance.play(); } return instance; } // Remove targets from animation function removeTargetsFromAnimations(targetsArray, animations) { for (var a = animations.length; a--;) { if (arrayContains(targetsArray, animations[a].animatable.target)) { animations.splice(a, 1); } } } function removeTargets(targets) { var targetsArray = parseTargets(targets); for (var i = activeInstances.length; i--;) { var instance = activeInstances[i]; var animations = instance.animations; var children = instance.children; removeTargetsFromAnimations(targetsArray, animations); for (var c = children.length; c--;) { var child = children[c]; var childAnimations = child.animations; removeTargetsFromAnimations(targetsArray, childAnimations); if (!childAnimations.length && !child.children.length) { children.splice(c, 1); } } if (!animations.length && !children.length) { instance.pause(); } } } // Stagger helpers function stagger(val, params) { if (params === void 0) params = {}; var direction = params.direction || 'normal'; var easing = params.easing ? parseEasings(params.easing) : null; var grid = params.grid; var axis = params.axis; var fromIndex = params.from || 0; var fromFirst = fromIndex === 'first'; var fromCenter = fromIndex === 'center'; var fromLast = fromIndex === 'last'; var isRange = is.arr(val); var val1 = isRange ? parseFloat(val[0]) : parseFloat(val); var val2 = isRange ? parseFloat(val[1]) : 0; var unit = getUnit(isRange ? val[1] : val) || 0; var start = params.start || 0 + (isRange ? val1 : 0); var values = []; var maxValue = 0; return function (el, i, t) { if (fromFirst) { fromIndex = 0; } if (fromCenter) { fromIndex = (t - 1) / 2; } if (fromLast) { fromIndex = t - 1; } if (!values.length) { for (var index = 0; index < t; index++) { if (!grid) { values.push(Math.abs(fromIndex - index)); } else { var fromX = !fromCenter ? fromIndex % grid[0] : (grid[0] - 1) / 2; var fromY = !fromCenter ? Math.floor(fromIndex / grid[0]) : (grid[1] - 1) / 2; var toX = index % grid[0]; var toY = Math.floor(index / grid[0]); var distanceX = fromX - toX; var distanceY = fromY - toY; var value = Math.sqrt(distanceX * distanceX + distanceY * distanceY); if (axis === 'x') { value = -distanceX; } if (axis === 'y') { value = -distanceY; } values.push(value); } maxValue = Math.max.apply(Math, values); } if (easing) { values = values.map(function (val) { return easing(val / maxValue) * maxValue; }); } if (direction === 'reverse') { values = values.map(function (val) { return axis ? val < 0 ? val * -1 : -val : Math.abs(maxValue - val); }); } } var spacing = isRange ? (val2 - val1) / maxValue : val1; return start + spacing * (Math.round(values[i] * 100) / 100) + unit; }; } // Timeline function timeline(params) { if (params === void 0) params = {}; var tl = anime(params); tl.duration = 0; tl.add = function (instanceParams, timelineOffset) { var tlIndex = activeInstances.indexOf(tl); var children = tl.children; if (tlIndex > -1) { activeInstances.splice(tlIndex, 1); } function passThrough(ins) { ins.passThrough = true; } for (var i = 0; i < children.length; i++) { passThrough(children[i]); } var insParams = mergeObjects(instanceParams, replaceObjectProps(defaultTweenSettings, params)); insParams.targets = insParams.targets || params.targets; var tlDuration = tl.duration; insParams.autoplay = false; insParams.direction = tl.direction; insParams.timelineOffset = is.und(timelineOffset) ? tlDuration : getRelativeValue(timelineOffset, tlDuration); passThrough(tl); tl.seek(insParams.timelineOffset); var ins = anime(insParams); passThrough(ins); children.push(ins); var timings = getInstanceTimings(children, params); tl.delay = timings.delay; tl.endDelay = timings.endDelay; tl.duration = timings.duration; tl.seek(0); tl.reset(); if (tl.autoplay) { tl.play(); } return tl; }; return tl; } anime.version = '3.2.0'; anime.speed = 1; anime.running = activeInstances; anime.remove = removeTargets; anime.get = getOriginalTargetValue; anime.set = setTargetsValue; anime.convertPx = convertPxToUnit; anime.path = getPath; anime.setDashoffset = setDashoffset; anime.stagger = stagger; anime.timeline = timeline; anime.easing = parseEasings; anime.penner = penner; anime.random = function (min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; }; module.exports = anime; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* # ----------------------------------------------------------------------------- # ~/js/j1_template/core.js # Provides an empty object for later loaded core objects # # Product/Info: # https://jekyll.one # http://getbootstrap.com/ # # Copyright (C) 2021 Juergen Adams # # J1 Template is licensed under MIT License. # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE # ----------------------------------------------------------------------------- */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* eslint no-unused-vars: "off" */ /* eslint no-undef: "off" */ // ----------------------------------------------------------------------------- // module.exports = function core ( options ) { /*! * J1 Core * Copyright (C) 2021 Juergen Adams * Licensed under MIT License. */ module.exports = function (options) { // --------------------------------------------------------------------------- // Global variables // --------------------------------------------------------------------------- // var messageCatalog = {}; // var state; // var logger; // var logText; // --------------------------------------------------------------------------- // Default settings // --------------------------------------------------------------------------- var settings = $.extend({ foo: 'foo_option', bar: 'bar_option' }, options); var state = 'loaded'; return { // ------------------------------------------------------------------------- // _init_ // Global initializer for the core object // ------------------------------------------------------------------------- _init_: function _init_(options) { // // Place handling of options here // return; }, // END _init_ // ------------------------------------------------------------------------- // Returns the current (processing) state of the module // ------------------------------------------------------------------------- getState: function getState() { return state; }, // END state // ------------------------------------------------------------------------- // isMobile // Return true if the current platform is a mobile device // ------------------------------------------------------------------------- isMobile: function isMobile(ua_name) { var mobile = false; (function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm|cell|chtm|cldc|cmd|co(mp|nd)|craw|da(it|ll|ng)|dbte|dcs|devi|dica|dmob|do(c|p)o|ds(12|d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(|_)|g1 u|g560|gene|gf5|gmo|go(\.w|od)|gr(ad|un)|haie|hcit|hd(m|p|t)|hei|hi(pt|ta)|hp( i|ip)|hsc|ht(c(| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i(20|go|ma)|i230|iac( ||\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|[a-w])|libw|lynx|m1w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|mcr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|([1-8]|c))|phil|pire|pl(ay|uc)|pn2|po(ck|rt|se)|prox|psio|ptg|qaa|qc(07|12|21|32|60|[2-7]|i)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h|oo|p)|sdk\/|se(c(|0|1)|47|mc|nd|ri)|sgh|shar|sie(|m)|sk0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h|v|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl|tdg|tel(i|m)|tim|tmo|to(pl|sh)|ts(70|m|m3|m5)|tx9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas|your|zeto|zte/i.test(a.substr(0, 4))) mobile = true; })(navigator.userAgent || navigator.vendor || window.opera); return mobile; }, // END isMobile // ------------------------------------------------------------------------- // Clear button for input fields (forms) // ------------------------------------------------------------------------- bsFormClearButton: function bsFormClearButton() { // $('.position-relative :input').on('keydown focus', function() { $(':input').on('keydown focus change mouseover', function () { if ($(this).val().length > 0) { $(this).nextAll('.form-clear').removeClass('d-none'); } }).on('keydown keyup blur', function () { if ($(this).val().length === 0) { $(this).nextAll('.form-clear').addClass('d-none'); } }); // $('.form-clear').on('click', function() { // $(this).addClass('d-none').prevAll(':input').val(''); // // hide|clear results from top search // $('#search-results').hide(); // $('#search-results').html(''); // }); }, // END bsFormClearButton // ------------------------------------------------------------------------- // Initialize Backdrops on all

elements of class "dropcap" // ------------------------------------------------------------------------- createDropCap: function createDropCap() { // add class dropcap $('.paragraph.dropcap').children('p').addClass('dropcap'); // if ($('p.dropcap').length) { $('p.dropcap').each(function () { var $p = $(this); var text = $.trim($p.text()); var firstLetter = text[0]; var marginalDropCap = '' + firstLetter + ''; $p.html(text.replace(firstLetter, marginalDropCap)); }); } } // END createDropCap }; // end return (object) //})( jQuery, window ); }(); // END IFFE /***/ }), /* 11 */ /***/ (function(module, exports) { /* # ----------------------------------------------------------------------------- # ~/js/navigator/navigator.js # Provides all JavaScript core functions for J1 Navigator # # Product/Info: # https://jekyll.one # https://github.com/adamnurdin01/navigator # # Copyright (C) 2021 Juergen Adams # Copyright (C) 2016 adamnurdin01 # # J1 Template is licensed under MIT License. # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE # Bootsnav is licensed under MIT License. # See: https://github.com/adamnurdin01/navigator # # ----------------------------------------------------------------------------- # NOTE: # jadams, 2020-06-21: # J1 Navigator needs a general revision on BS4 code and functionalities # Current, only base function are tested with BS4 (was coded for BS3) # ----------------------------------------------------------------------------- */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* eslint no-unused-vars: "off" */ /* eslint no-undef: "off" */ // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- // TODO: Height of dropdowns are to be limited in general // ----------------------------------------------------------------------------- // Navigator core registered as 'j1.core.navigator' // ----------------------------------------------------------------------------- module.exports = function navigator(options) { // --------------------------------------------------------------------------- // global vars // --------------------------------------------------------------------------- var message = {}; var state; var logger; var logText; // ----------------------------------------------------------------------- // default settings // ----------------------------------------------------------------------- var settings = $.extend({ foo: 'bar', bar: 'foo' }, options); // --------------------------------------------------------------------------- // main object // --------------------------------------------------------------------------- return { // ------------------------------------------------------------------------- // module initializer // ------------------------------------------------------------------------- init: function init(defaultOptions, menuOptions) { logger = log4javascript.getLogger('j1.core.navigator'); logText = 'core is being initialized'; logger.info(logText); this.manageDropdownMenu(defaultOptions, menuOptions); this.navbarSticky(); this.eventHandler(defaultOptions); // jadams, 2021-07-03: initialize events early message.type = 'command'; message.action = 'core_initialized'; message.text = 'navigator core initialized'; j1.sendMessage('j1.core.navigator', 'j1.adapter.navigator', message); return true; }, // ------------------------------------------------------------------------- // event handler // ------------------------------------------------------------------------- eventHandler: function eventHandler(options) { var defaultOptions = options; var logger = log4javascript.getLogger('j1.core.navigator.eventHandler'); var $getNav = $('nav.navbar.navigator'); var json_data; // const seeMe = 'https://smee.io/wlNIFNiJN0GClm2'; // const middleware = 'localhost:5000/state'; // const web_server_dev = 'http://localhost:41000/status'; // const utility_server = 'http://localhost:41001/git?request=pull'; // var sender = seeMe; // var payload; // if (j1.checkUserAgent('IE') || j1.checkUserAgent('Edge')) { // logger.warn('HTML5 server side events (SSE) not supported for: ' + userAgent); // logger.warn('Middleware messages disabled'); // } else { // const middleware_status = new EventSource(sender); // // // ----------------------------------------------------------------------- // // middleware event handler ( SSE currently NOT used) // // ----------------------------------------------------------------------- // middleware_status.onmessage = (event) => { // const payload = JSON.parse(event.data); // // logger.debug('middleware: event received'); // // json_data = JSON.stringify(payload, undefined, 2); // logText = 'payload: ' + json_data; // logger.debug(logText); // // message.type = 'command'; // message.action = 'status'; // message.text = payload; // j1.sendMessage( 'j1.core.navigator', 'j1.adapter.navigator', message ); // // return true; // }; // END event onMessage // } // bind click event to all links with "#" to suppress default action // See: https://stackoverflow.com/questions/134845/which-href-value-should-i-use-for-javascript-links-or-javascriptvoid0 // $('a[href="#"]').click(function (e) { e.preventDefault ? e.preventDefault() : e.returnValue = false; logger.info('bound click event to "#", suppress default action'); }); // ----------------------------------------------------------------------- // Navbar Sticky // ----------------------------------------------------------------------- var navSticky = $getNav.hasClass('navbar-sticky'); if (navSticky) { // Wraped navigation $getNav.wrap('

'); } // ----------------------------------------------------------------------- // Navbar Center // ----------------------------------------------------------------------- if ($getNav.hasClass('brand-center')) { var postsArr = new Array(); var index = $('nav.brand-center'); var $postsList = index.find('ul.navbar-nav'); //Create array of all posts in lists index.find('ul.navbar-nav > li').each(function () { postsArr.push($(this).html()); }); // Split the array at this point. The original array is altered. var firstList = postsArr.splice(0, Math.round(postsArr.length / 2)); var secondList = postsArr; var ListHTML = ''; var createHTML = function createHTML(list) { ListHTML = ''; for (var i = 0; i < list.length; i++) { ListHTML += '
  • ' + list[i] + '
  • '; } }; // Generate HTML for first list createHTML(firstList); $postsList.html(ListHTML); index.find('ul.nav').first().addClass('navbar-left'); // Generate HTML for second list createHTML(secondList); //Create new list after original one $postsList.after('').next().html(ListHTML); index.find('ul.nav').last().addClass('navbar-right'); // Wrap navigation menu index.find('ul.nav.navbar-left').wrap('
    '); index.find('ul.nav.navbar-right').wrap('
    '); // Selection Class index.find('ul.navbar-nav > li').each(function () { var dropDown = $('ul.dropdown-menu', this), megaMenu = $('ul.megamenu-content', this); dropDown.closest('li').addClass('dropdown'); megaMenu.closest('li').addClass('megamenu-fw'); }); } // ----------------------------------------------------------------------- // Menu Center // ----------------------------------------------------------------------- if ($getNav.find('ul.nav').hasClass('navbar-center')) { $getNav.addClass('menu-center'); } // ----------------------------------------------------------------------- // Navbar Full // ----------------------------------------------------------------------- if ($getNav.hasClass('navbar-full')) { // Add Class to body $('nav.navbar.navigator').find('ul.nav').wrap('
    '); $('.wrap-full-menu').wrap('
    '); $('ul.nav.navbar-nav').prepend('
  • '); } else if ($getNav.hasClass('navbar-mobile')) { $getNav.removeClass('no-full'); } else { $getNav.addClass('no-full'); } // ----------------------------------------------------------------------- // Navbar Fixed // ----------------------------------------------------------------------- if ($getNav.hasClass('no-background')) { $(window).on('scroll', function () { var navbarHeighth = $('nav.navbar').outerHeight(); var scrollPos = $(window).scrollTop(); if (scrollPos > navbarHeighth) { $('.navbar-fixed').removeClass('no-background'); } else { $('.navbar-fixed').addClass('no-background'); } }); } if ($getNav.hasClass('navbar-transparent')) { $(window).on('scroll', function () { var navbarHeighth = $('nav.navbar').outerHeight(); var scrollPos = $(window).scrollTop(); if (scrollPos > navbarHeighth) { $('.navbar-fixed').removeClass('navbar-transparent'); $('.navbar-fixed').addClass('navbar-scrolled'); } else { $('.navbar-fixed').removeClass('navbar-scrolled'); $('.navbar-fixed').addClass('navbar-transparent'); } }); } // ----------------------------------------------------------------------- // Toggle Search // https://stackoverflow.com/questions/178325/how-do-i-check-if-an-element-is-hidden-in-jquery // https://stackoverflow.com/questions/4770025/how-to-disable-scrolling-temporarily // https://stackoverflow.com/questions/5963669/whats-the-difference-between-event-stoppropagation-and-event-preventdefault // ----------------------------------------------------------------------- // $('nav.navbar.navigator .attr-nav').each(function() { $('.attr-nav').each(function () { logger.debug('register OPEN event|s for QuickSearch'); $('li.search > a', this).on('click', function (e) { // e.preventDefault(); // don't do the default browser action logger.debug('manage search action OPEN'); $('html,body').animate({ scrollTop: 0 }, 0); $('.top-search').slideToggle('slow', 'swing', function () { if ($('.top-search').is(':visible')) { // disable scrolling (desktop) $('body').addClass('stop-scrolling'); // disable scrolling (mobile) $('body').bind('touchmove', function (e) { e.preventDefault(); }); // disable navbar $('#' + defaultOptions.nav_bar.container_id).hide(); } else { // enable scrolling (desktop) $('body').removeClass('stop-scrolling'); // enable scrolling (mobile) $('body').unbind('touchmove'); // enable navbar $('#' + defaultOptions.nav_bar.container_id).show(); } }); // e.stopPropagation(); // don't bubble up the event }); }); logger.debug('register CLOSE event|s for QuickSearch'); $('.input-group-addon.close-search').on('click', function (e) { e.preventDefault(); // don't do the default browser action logger.debug('manage search action CLOSE'); $('.top-search').slideUp('slow', 'swing'); $('html,body').animate({ scrollTop: 0 }, 0); // enable scrolling (desktop) $('body').removeClass('stop-scrolling'); // enable scrolling (mobile) $('body').unbind('touchmove'); // enable navbar $('#' + defaultOptions.nav_bar.container_id).show(); e.stopPropagation(); // don't bubble up the event }); // ----------------------------------------------------------------------- // Toggle Translator SHOW|HIDE // ----------------------------------------------------------------------- $('nav.navbar.navigator .attr-nav').each(function () { logger.debug('register SHOW|HIDE event|s for J1 Translator'); $('li.translator > a', this).on('click', function (e) { // e.preventDefault(); // don't do the default browser action // window.location.reload(true); logger.debug('toggle translator icon SHOW|HIDE'); // See: https://api.jquery.com/toggle/ // With no parameters, the .toggle() method simply toggles the visibility of elements $('#google_translate_element').toggle(); if ($('#google_translate_element').css('display') !== 'none') { $('html,body').animate({ scrollTop: 0 }, 'slow'); } // e.stopPropagation(); // don't bubble up the event }); }); // ----------------------------------------------------------------------- // Wrapper // ----------------------------------------------------------------------- $('body').wrapInner('
    '); }, // end event // ------------------------------------------------------------------------- // Manage the Menu Dropdowns for Desktop|Mobile // ------------------------------------------------------------------------- manageDropdownMenu: function manageDropdownMenu(defaultOptions, menuOptions) { var navDefaultOptions = defaultOptions; var navMenuOptions = menuOptions; var $getNav = $('nav.navbar.navigator'); var $windowOrientation = window.matchMedia('(orientation: landscape)').matches ? 'landscape' : 'portrait'; var $getWindow = $(window).width(); var $getNavWidth = $('nav').width(); var $getIn = $getNav.find('ul.nav').data('in'); var $getOut = $getNav.find('ul.nav').data('out'); var menuSelector = '#' + navMenuOptions.xhr_container_id + '.collapse'; var delayMenuOpen = navMenuOptions.delay_menu_open; var $menu; var breakPoint; var $dropDown; var timeoutHandle; // BS4 @media MAX breakpoints // NOTE: a media query is always a range // ----------------------------------------------------------------------- var gridBreakpoint_lg = 992; // bs-breakpoint-lg var gridBreakpoint_md = 768; // bs-breakpoint-md var gridBreakpoint_sm = 576; // bs-breakpoint-sm // BS4 @media MIN breakpoints // ----------------------------------------------------------------------- // NOTE: a media query is always a range // var gridBreakpoint_lg = 991; // var gridBreakpoint_md = 767; // var gridBreakpoint_sm = 575; // @media ranges // ----------------------------------------------------------------------- var small_range = { min: '0em', max: '40em' }; /* 0, 640px */ var medium_range = { min: '40.063em', max: '64em' }; /* 641px, 1024px */ var large_range = { min: '64.063em', max: '90em' }; /* 1025px, 1440px */ var xlarge_range = { min: '90.063em', max: '120em' }; /* 1441px, 1920px */ var xxlarge_range = { min: '120.063em' }; /* 1921px */ // jadams, 2019-05-01: Set Media Breakpoint for Desktop|Mobile Navigation if (navDefaultOptions.nav_bar.media_breakpoint === 'lg') { breakPoint = gridBreakpoint_lg; } else if (navDefaultOptions.nav_bar.media_breakpoint === 'md') { breakPoint = gridBreakpoint_md; } else if (navDefaultOptions.nav_bar.media_breakpoint === 'sm') { breakPoint = gridBreakpoint_sm; } else { breakPoint = gridBreakpoint_lg; } // ----------------------------------------------------------------------- // Tablet or Mobile // NOTE: // Managing the mobile menu is moved to MMenu Plugin // Only base functions like QuickLinks are managed by // J1 Navigator // ----------------------------------------------------------------------- // MIN media breakpoint if ($getWindow <= breakPoint) { // Collapse Navbar $(menuSelector).addClass('navbar-collapse'); $(menuSelector).removeClass('show'); // $('#navigator_nav_quicklinks').addClass('show'); // Enable click Quicklink Navigation $('nav.navbar.navigator .attr-nav').each(function () { $('.dropdown-menu', this).removeClass('animated'); $('li.dropdown', this).off('mouseenter'); $('li.dropdown', this).off('mouseleave'); $('a.dropdown-toggle', this).off('click'); $('a.dropdown-toggle', this).on('click', function (e) { // e.stopPropagation(); // don't bubble up the event $(this).closest('li.dropdown').find('.dropdown-menu').first().stop().fadeToggle(); $('.navbar-toggle').each(function () { $('.mdi', this).removeClass('mdi-close'); $('.mdi', this).addClass('mdi-menu'); $('.navbar-collapse').removeClass('in'); $('.navbar-collapse').removeClass('open'); }); }); $(this).on('mouseleave', function () { $('.dropdown-menu', this).stop().fadeOut(); $('li.dropdown', this).removeClass('open'); // return false; }); }); $('#desktop_menu').hide(); // ----------------------------------------------------------------------- // Desktop Navigation does NOT work on physical devices like iPad|Pro // Config DISABLED // // } else if ( $getWindow > breakPoint || $getWindow <= 1024 && $windowOrientation == 'portrait' ) { } else if ($getWindow > breakPoint) { // ----------------------------------------------------------------------- // Desktop // ----------------------------------------------------------------------- $('#navigator_nav_quicklinks').removeClass('show'); $('#desktop_menu').show(); // jadams, 2021-03-05: manage dropdown menus // --------------------------------------------------------------------- $('.dropdown-menu > li').on('mouseenter', function () { if ($('body').hasClass('stop-scrolling')) { return false; } else { $('body').addClass('stop-scrolling'); } }); $('.dropdown-menu > li').on('mouseleave', function () { // stop scrolling if top search or any (mmenu) drawer is opened if ($('body').hasClass('stop-scrolling')) { $('body').removeClass('stop-scrolling'); } }); // limit the dropdown menu lenght if needed $('.dropdown-menu > li').hover(function () { var $container = $(this); var $list = $container.find('ul'); // limit LAST menu ONLY // if ($list.length == 1) { $list.addClass('scrollable-menu'); } }); // jadams, 2021-03-06: Enable|Show Desktop Menu|s // $(menuSelector).removeClass('navbar-collapse'); $(menuSelector).addClass('show'); // Navbar Sidebar // jadams, 2021-03-05: Sidebar NOT used anymore // Open Desktop Menu|s on hover // $('nav.navbar.navigator ul.nav').each(function () { $('a.dropdown-toggle', this).off('click'); $('a.dropdown-toggle', this).on('click', function (e) {// e.stopPropagation(); // don't bubble up the event }); $('.megamenu-fw', this).each(function () { $('.title', this).off('click'); $('a.dropdown-toggle', this).off('click'); $('.content').removeClass('animated'); }); $('.dropdown-menu', this).addClass('animated'); $('li.dropdown', this).on('mouseenter', function () { $menu = $('.dropdown-menu', this).eq(0); $dropDown = $(this); $menu.removeClass($getOut); $menu.removeClass('open'); $dropDown.addClass('open'); // Get|Set the timeout object to delay the dropdown open timeoutHandle = window.setTimeout(function () { if ($dropDown.hasClass('open')) { $menu.stop().fadeIn().addClass($getIn); $menu.addClass('open'); $dropDown.addClass('open'); } }, delayMenuOpen); }); $('li.dropdown', this).on('mouseleave', function () { window.clearTimeout(timeoutHandle); // Clear the timeout object $(this).removeClass('open').removeClass('open'); $('.dropdown-menu', this).removeClass('open'); $('.dropdown-menu', this).eq(0).removeClass($getIn); $('.dropdown-menu', this).eq(0).stop().fadeOut().addClass($getOut); }); $(this).on('mouseleave', function () { window.clearTimeout(timeoutHandle); $('li.dropdown', this).removeClass('open'); $('.dropdown-menu', this).removeClass('open'); $('.dropdown-menu', this).removeClass($getIn); $('.dropdown-menu', this).eq(0).stop().fadeOut().addClass($getOut); }); }); // END Desktop Menu } // end Desktop // ----------------------------------------------------------------------- // Hover Open on Quicklink Navigation // ----------------------------------------------------------------------- $('nav.navbar.navigator .attr-nav').each(function () { $('a.dropdown-toggle', this).off('click'); $('a.dropdown-toggle', this).on('click', function (e) {// e.stopPropagation(); // don't bubble up the event }); $('.dropdown-menu', this).addClass('animated'); $('li.dropdown', this).on('mouseenter', function () { $('.dropdown-menu', this).eq(0).removeClass($getOut); $('.dropdown-menu', this).eq(0).stop().fadeIn().addClass($getIn); $(this).addClass('open'); //return false; }); $('li.dropdown', this).on('mouseleave', function () { $('.dropdown-menu', this).eq(0).removeClass($getIn); $('.dropdown-menu', this).eq(0).stop().fadeOut().addClass($getOut); $(this).removeClass('open'); }); $(this).on('mouseleave', function () { $('.dropdown-menu', this).removeClass($getIn); $('.dropdown-menu', this).eq(0).stop().fadeOut().addClass($getOut); $('li.dropdown', this).removeClass('open'); //return false; }); }); // ----------------------------------------------------------------------- // Fullscreen Menu // ----------------------------------------------------------------------- if ($getNav.hasClass('navbar-full')) { var windowHeight = $(window).height(), windowWidth = $(window).width(); $('.nav-full').css('height', windowHeight + 'px'); $('.wrap-full-menu').css('height', windowHeight + 'px'); $('.wrap-full-menu').css('width', windowWidth + 'px'); $('.navbar-collapse').addClass('animated'); $('.navbar-toggle').each(function () { var getId = $(this).data('target'); $(this).off('click'); $(this).on('click', function (e) { e.preventDefault(); $(getId).removeClass($getOut); $(getId).addClass('in'); $(getId).addClass($getIn); // e.stopPropagation(); // don't bubble up the event // return false; }); $('li.close-full-menu').on('click', function (e) { e.preventDefault(); $(getId).addClass($getOut); setTimeout(function () { $(getId).removeClass('in'); $(getId).removeClass($getIn); }, 500); //e.stopPropagation(); // don't bubble up the event // return false; }); }); } }, // end manageDropdownMenu // ------------------------------------------------------------------------- // Sticky Navbar // ------------------------------------------------------------------------- navbarSticky: function navbarSticky() { var $getNav = $('nav.navbar.navigator'), navSticky = $getNav.hasClass('navbar-sticky'); if (navSticky) { // Set Height Navigation var $getHeight = $getNav.height(); $('.wrap-sticky').height($getHeight); // Windown on scroll var getOffset = $('.wrap-sticky').offset().top; $(window).on('scroll', function () { var scrollTop = $(window).scrollTop(); if (scrollTop > getOffset) { $getNav.addClass('sticked'); } else { $getNav.removeClass('sticked'); } }); } }, // end navbarSticky // ------------------------------------------------------------------------- // updateSidebar // Note: // ------------------------------------------------------------------------- updateSidebar: function updateSidebar(user_data) { var logger = log4javascript.getLogger('j1.core.navigator.updateSidebar'); var json_message; // json_message = JSON.stringify(user_data, undefined, 2); // multiline json_message = JSON.stringify(user_data); logText = 'user state data: ' + json_message; logger.debug(logText); // Replace Macro placeholders to values j1.resolveMacros(user_data); // Replace Macro values only j1.updateMacros(user_data); return true; } // END updateSidebar }; // end return (object) }(jQuery); /***/ }), /* 12 */ /***/ (function(module, exports) { /* # ----------------------------------------------------------------------------- # ~200_template_js/js/asciidoctor/asciidoctor.js # Provides JS functions to (dynamically) modify Asciidoctor HTML elements # # Product/Info: # http://jekyll.one # # Copyright (C) 2021 Juergen Adams # # J1 Template is licensed under MIT License. # See: https://github.com/jekyll-one/J1 Template/blob/master/LICENSE # ----------------------------------------------------------------------------- # NOTE: # ----------------------------------------------------------------------------- */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint no-unused-vars: "off" */ /* eslint no-undef: "off" */ /* eslint no-redeclare: "off" */ /* global window */ // TODO: // ----------------------------------------------------------------------------- // J1 Asciidoctor registered as "asciidoctor" // ----------------------------------------------------------------------------- /*! * J1 Asciidoctor * Copyright (C) 2021 Juergen Adams * Licensed under MIT License. */ module.exports = function asciidoctor(options) { return { // ------------------------------------------------------------------------- // module initializer // ------------------------------------------------------------------------- init: function init(options) { var moduleOptions = options; var logger = log4javascript.getLogger('j1.core.asciidoctor'); var moduleDefaults = { dummyOption: false // placeholder }; var options = $.extend(moduleDefaults, moduleOptions); logText = 'J1 Asciidoctor is being initialized'; logger.info(logText); this.callouts(); }, // end initializer // ------------------------------------------------------------------------- // manage callouts (HTML) // ------------------------------------------------------------------------- // see: https://stackoverflow.com/questions/19393493/add-colgroup-for-each-table-column callouts: function callouts(options) { var colgroupList = ''; // If the colist does not have a structure // if ($('.colist > table > colgroup').length == 0) { colgroupList += '' + '\n'; colgroupList += ' '; $(".colist > table").prepend(colgroupList); } }, // end callouts // ------------------------------------------------------------------------- // manage callouts (HTML) // ------------------------------------------------------------------------- conums: function conums(options) { var dependencies_met_page_finished = setInterval(function () { if (j1.getState() == 'finished') { // If the colist does not have a structure if ($('.colist > table > colgroup').length == 0) { var colgroupList = ''; colgroupList += ' '; $(".colist > table").prepend(colgroupList); clearInterval(dependencies_met_page_finished); } } }); } // end conums }; // END return }(jQuery); /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* # ----------------------------------------------------------------------------- # ~/js/scroll-smooth/scroll-smooth.js # Provides Javascript functions for smooth scrolling # # Product/Info: # http://jekyll.one # # Copyright (C) 2020 Juergen Adams # # J1 Template is licensed under the MIT License. # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE # ----------------------------------------------------------------------------- */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* eslint no-unused-vars: "off" */ /* eslint no-undef: "off" */ /* eslint no-redeclare: "off" */ /* eslint indent: "off" */ // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- // scrollSmooth core registered as "scrollSmooth" // ----------------------------------------------------------------------------- module.exports = function scrollSmooth(options) { // Default settings var settings = $.extend({ foo: 'foo_option', bar: 'bar_option' }, options); // ----------------------------------------------------------------------- // Helper functions // ----------------------------------------------------------------------- function stripHash(url) { return url.slice(0, url.lastIndexOf('#')); } function isCssSmoothScrollSupported() { return 'scrollBehavior' in document.documentElement.style; } return { // ------------------------------------------------------------------------- // Initialize scrollSmooth // ------------------------------------------------------------------------- scroll: function scroll(target, options) { var logger; var logText; logger = log4javascript.getLogger('j1.core.scrollSmooth'); // indicator|check currently NOT used // if (isCssSmoothScrollSupported()) { } logText = 'run module scrollSmooth'; logger.info(logText); var duration = options.duration; var offset = options.offset; // var pageUrl = options.location.hash // ? stripHash(options.location.href) // : options.location.href; this.scrollTo(target, { duration: duration, offset: offset, callback: null }); logText = 'scrollSmooth finished'; logger.info(logText); }, // ------------------------------------------------------------------------- // scrollTo // ------------------------------------------------------------------------- scrollTo: function scrollTo(target, options) { var start = window.pageYOffset; var opt = { duration: options.duration, offset: options.offset || 0, callback: options.callback, easing: options.easing || easeInOutQuad }; // This makes ids that start with a number work: ('[id="' + decodeURI(target).split('#').join('') + '"]') // DecodeURI for nonASCII hashes, they was encoded, but id was not encoded, it lead to not finding the tgt element by id. // And this is for IE: document.body.scrollTop var tgt = document.querySelector('[id="' + decodeURI(target).split('#').join('') + '"]'); var distance = typeof target === 'string' ? opt.offset + (target ? tgt && tgt.getBoundingClientRect().top || 0 // handle non-existent links better. : -(document.documentElement.scrollTop || document.body.scrollTop)) : target; var duration = typeof opt.duration === 'function' ? opt.duration(distance) : opt.duration; var timeStart; var timeElapsed; requestAnimationFrame(function (time) { timeStart = time; loop(time); }); function loop(time) { timeElapsed = time - timeStart; window.scrollTo(0, opt.easing(timeElapsed, start, distance, duration)); if (timeElapsed < duration) { requestAnimationFrame(loop); } else { end(); } } function end() { window.scrollTo(0, start + distance); // jadams, 2020-07-04: on (some?) mobile devices, the navbar // background is NOT switched (always?) correctly on a // page RELOAD. // // Solution: scroll the page one pixel back and forth (trigger) // to get the right position for the Toccer and adjust the // Navigator to display the (tranparent) navbar correctly based // on their onscroll events registered. // $(window).scrollTop($(window).scrollTop() + 1); $(window).scrollTop($(window).scrollTop() - 1); if (typeof opt.callback === 'function') { opt.callback(); } } // Robert Penner's easeInOutQuad - http://robertpenner.com/easing/ function easeInOutQuad(t, b, c, d) { t /= d / 2; if (t < 1) return c / 2 * t * t + b; t--; return -c / 2 * (t * (t - 2) - 1) + b; } } // END scrollTo }; // END return }(jQuery); /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(15); /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { const languages = __webpack_require__(1); const { validateText, validateSourceLanguage, validateTargetLanguage, validateSourceTargetLanguage, validateBeginning } = __webpack_require__(16); const { splitSentences, getTranslation, getAlternatives } = __webpack_require__(17); const { EOL } = __webpack_require__(23); function detectLanguage(text) { return translate(text, 'EN').then(({ resolvedSourceLanguage }) => { return { languageCode: resolvedSourceLanguage, languageName: resolvedSourceLanguage.split(',').map(code => languages[code]).join(',') }; }); } function validateInputs(validationArray) { return Promise.all(validationArray).then(validationResults => { const errors = validationResults.filter(validationResult => validationResult).join('\n'); return errors.length ? Promise.reject(new Error(`Input parameter validation failed with error(s): ${errors}`)) : Promise.resolve(''); }); } function translate(text, targetLanguage, sourceLanguage = 'auto') { return validateInputs([validateText(text), validateSourceLanguage(sourceLanguage), validateTargetLanguage(targetLanguage), validateSourceTargetLanguage(sourceLanguage, targetLanguage)]).then(valid => splitSentences(text.split(EOL), sourceLanguage)).then(transformSplitSentencesResponse).then(([paragraphs, resolvedSourceLanguage]) => { return Promise.all(paragraphs.map(paragraph => paragraph.length === 0 ? [] : getTranslation(paragraph, targetLanguage, resolvedSourceLanguage || 'auto').then(transformTranslationResponse))).then(translatedParagraphs => ({ targetLanguage, resolvedSourceLanguage: translatedParagraphs.map(paragraph => paragraph[1]).reduce((unique, current) => [...unique, unique.indexOf(current) < 0 && current], []).filter(lang => lang).join(','), translation: translatedParagraphs.map(([paragraph]) => paragraph || '').join(EOL) })); }); } function translateWithAlternatives(text, targetLanguage, sourceLanguage = 'auto', beginning) { return validateInputs([validateText(text), validateSourceLanguage(sourceLanguage), validateTargetLanguage(targetLanguage), validateSourceTargetLanguage(sourceLanguage, targetLanguage)]).then(valid => getTranslation([text], targetLanguage, sourceLanguage, beginning)).then(({ result: { source_lang, translations: [{ beams }] } }) => ({ targetLanguage, resolvedSourceLanguage: source_lang, translation: beams[0].postprocessed_sentence, translationAlternatives: beams.map(({ postprocessed_sentence }) => postprocessed_sentence) })); } function wordAlternatives(text, targetLanguage, sourceLanguage, beginning) { return validateInputs([validateText(text), validateSourceLanguage(sourceLanguage), validateTargetLanguage(targetLanguage), validateSourceTargetLanguage(sourceLanguage, targetLanguage), validateBeginning(beginning)]).then(valid => getAlternatives(text, targetLanguage, sourceLanguage, beginning)).then(res => { return { targetLanguage: res.result.target_lang, resolvedSourceLanguage: res.result.source_lang, alternatives: res.result.translations[0].beams.map(alt => { return alt.postprocessed_sentence; }) }; }); } function transformTranslationResponse(response) { try { const { result: { target_lang: targetLanguage, source_lang: resolvedSourceLanguage, translations } } = response; const translatedSentences = translations.map(({ beams: [{ postprocessed_sentence: translation }] }) => translation); return [translatedSentences.join(' '), resolvedSourceLanguage]; } catch (error) { throw new Error(`Unexpected error when parsing deepl translation response: ${JSON.stringify(response)}`); } } function transformSplitSentencesResponse(response) { try { const { result: { splitted_texts: texts, lang_is_confident, lang } } = response; return [texts, lang_is_confident && lang]; } catch (error) { throw new Error(`Unexpected error when parsing deepl split sentence response: ${JSON.stringify(response)}`); } } module.exports = { translate, translateWithAlternatives, detectLanguage, wordAlternatives }; /***/ }), /* 16 */ /***/ (function(module, exports, __webpack_require__) { const languages = __webpack_require__(1); module.exports = { validateText: text => Promise.resolve((typeof text !== 'string' || text.trim().length === 0) && 'Must provide valid text for translation'), validateTargetLanguage: targetLanguage => Promise.resolve(!languages[targetLanguage] && `Invalid target language code ${targetLanguage}`), validateSourceLanguage: sourceLanguage => Promise.resolve(sourceLanguage !== 'auto' && !languages[sourceLanguage] && `Invalid source language code ${sourceLanguage}`), validateSourceTargetLanguage: (sourceLanguage, targetLanguage) => Promise.resolve(targetLanguage === sourceLanguage && `Target and source language codes identical`), validateBeginning: beginning => Promise.resolve(!beginning && `Must provide valid text for beginning translation override`) }; /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer) {const request = __webpack_require__(22); const DEEPL_HOSTNAME = 'www2.deepl.com'; const DEEPL_ENDPOINT = '/jsonrpc'; function getHandleJobsBody(texts, targetLanguage, sourceLanguage, beginning) { return { jsonrpc: '2.0', method: 'LMT_handle_jobs', params: { jobs: texts.map(text => { return { kind: 'default', raw_en_sentence: text, de_sentence_beginning: beginning }; }), lang: { user_preferred_langs: ['EN'], source_lang_user_selected: sourceLanguage, target_lang: targetLanguage }, priority: -1 }, id: 1 }; } function getAlternativesBody(text, targetLanguage, sourceLanguage, beginning) { return { jsonrpc: '2.0', method: 'LMT_handle_jobs', params: { jobs: [{ de_sentence_beginning: beginning, kind: 'alternatives_at_position', raw_en_sentence: text }], lang: { source_lang_computed: sourceLanguage, target_lang: targetLanguage }, priority: 1 }, id: 1 }; } function getSplitSentencesBody(texts, sourceLanguage) { return { jsonrpc: '2.0', method: 'LMT_split_into_sentences', params: { texts, lang: { lang_user_selected: sourceLanguage, user_preferred_langs: ['EN'] } }, id: 1 }; } function getRequestOptions(postBody) { return { hostname: DEEPL_HOSTNAME, port: 443, protocol: 'https:', path: DEEPL_ENDPOINT, method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(JSON.stringify(postBody)), 'Cache-Control': 'no-cache' } }; } module.exports = { getTranslation: (texts, targetLanguage, sourceLanguage, beginning) => { const postBody = getHandleJobsBody(texts, targetLanguage, sourceLanguage, beginning); const options = getRequestOptions(postBody); return request(options, postBody); }, splitSentences: (texts, sourceLanguage) => { const postBody = getSplitSentencesBody(texts, sourceLanguage); const options = getRequestOptions(postBody); return request(options, postBody); }, getAlternatives: (text, targetLanguage, sourceLanguage, beginning) => { const postBody = getAlternativesBody(text, targetLanguage, sourceLanguage, beginning); const options = getRequestOptions(postBody); return request(options, postBody); } }; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(18).Buffer)) /***/ }), /* 18 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ /* eslint-disable no-proto */ var base64 = __webpack_require__(19) var ieee754 = __webpack_require__(20) var isArray = __webpack_require__(21) exports.Buffer = Buffer exports.SlowBuffer = SlowBuffer exports.INSPECT_MAX_BYTES = 50 /** * If `Buffer.TYPED_ARRAY_SUPPORT`: * === true Use Uint8Array implementation (fastest) * === false Use Object implementation (most compatible, even IE6) * * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, * Opera 11.6+, iOS 4.2+. * * Due to various browser bugs, sometimes the Object implementation will be used even * when the browser supports typed arrays. * * Note: * * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. * * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. * * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of * incorrect length in some situations. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they * get the Object implementation, which is slower but behaves correctly. */ Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined ? global.TYPED_ARRAY_SUPPORT : typedArraySupport() /* * Export kMaxLength after typed array support is determined. */ exports.kMaxLength = kMaxLength() function typedArraySupport () { try { var arr = new Uint8Array(1) arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} return arr.foo() === 42 && // typed array instances can be augmented typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` } catch (e) { return false } } function kMaxLength () { return Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff } function createBuffer (that, length) { if (kMaxLength() < length) { throw new RangeError('Invalid typed array length') } if (Buffer.TYPED_ARRAY_SUPPORT) { // Return an augmented `Uint8Array` instance, for best performance that = new Uint8Array(length) that.__proto__ = Buffer.prototype } else { // Fallback: Return an object instance of the Buffer class if (that === null) { that = new Buffer(length) } that.length = length } return that } /** * The Buffer constructor returns instances of `Uint8Array` that have their * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of * `Uint8Array`, so the returned instances will have all the node `Buffer` methods * and the `Uint8Array` methods. Square bracket notation works as expected -- it * returns a single octet. * * The `Uint8Array` prototype remains unmodified. */ function Buffer (arg, encodingOrOffset, length) { if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { return new Buffer(arg, encodingOrOffset, length) } // Common case. if (typeof arg === 'number') { if (typeof encodingOrOffset === 'string') { throw new Error( 'If encoding is specified then the first argument must be a string' ) } return allocUnsafe(this, arg) } return from(this, arg, encodingOrOffset, length) } Buffer.poolSize = 8192 // not used by this implementation // TODO: Legacy, not needed anymore. Remove in next major version. Buffer._augment = function (arr) { arr.__proto__ = Buffer.prototype return arr } function from (that, value, encodingOrOffset, length) { if (typeof value === 'number') { throw new TypeError('"value" argument must not be a number') } if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { return fromArrayBuffer(that, value, encodingOrOffset, length) } if (typeof value === 'string') { return fromString(that, value, encodingOrOffset) } return fromObject(that, value) } /** * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError * if value is a number. * Buffer.from(str[, encoding]) * Buffer.from(array) * Buffer.from(buffer) * Buffer.from(arrayBuffer[, byteOffset[, length]]) **/ Buffer.from = function (value, encodingOrOffset, length) { return from(null, value, encodingOrOffset, length) } if (Buffer.TYPED_ARRAY_SUPPORT) { Buffer.prototype.__proto__ = Uint8Array.prototype Buffer.__proto__ = Uint8Array if (typeof Symbol !== 'undefined' && Symbol.species && Buffer[Symbol.species] === Buffer) { // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 Object.defineProperty(Buffer, Symbol.species, { value: null, configurable: true }) } } function assertSize (size) { if (typeof size !== 'number') { throw new TypeError('"size" argument must be a number') } else if (size < 0) { throw new RangeError('"size" argument must not be negative') } } function alloc (that, size, fill, encoding) { assertSize(size) if (size <= 0) { return createBuffer(that, size) } if (fill !== undefined) { // Only pay attention to encoding if it's a string. This // prevents accidentally sending in a number that would // be interpretted as a start offset. return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill) } return createBuffer(that, size) } /** * Creates a new filled Buffer instance. * alloc(size[, fill[, encoding]]) **/ Buffer.alloc = function (size, fill, encoding) { return alloc(null, size, fill, encoding) } function allocUnsafe (that, size) { assertSize(size) that = createBuffer(that, size < 0 ? 0 : checked(size) | 0) if (!Buffer.TYPED_ARRAY_SUPPORT) { for (var i = 0; i < size; ++i) { that[i] = 0 } } return that } /** * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. * */ Buffer.allocUnsafe = function (size) { return allocUnsafe(null, size) } /** * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. */ Buffer.allocUnsafeSlow = function (size) { return allocUnsafe(null, size) } function fromString (that, string, encoding) { if (typeof encoding !== 'string' || encoding === '') { encoding = 'utf8' } if (!Buffer.isEncoding(encoding)) { throw new TypeError('"encoding" must be a valid string encoding') } var length = byteLength(string, encoding) | 0 that = createBuffer(that, length) var actual = that.write(string, encoding) if (actual !== length) { // Writing a hex string, for example, that contains invalid characters will // cause everything after the first invalid character to be ignored. (e.g. // 'abxxcd' will be treated as 'ab') that = that.slice(0, actual) } return that } function fromArrayLike (that, array) { var length = array.length < 0 ? 0 : checked(array.length) | 0 that = createBuffer(that, length) for (var i = 0; i < length; i += 1) { that[i] = array[i] & 255 } return that } function fromArrayBuffer (that, array, byteOffset, length) { array.byteLength // this throws if `array` is not a valid ArrayBuffer if (byteOffset < 0 || array.byteLength < byteOffset) { throw new RangeError('\'offset\' is out of bounds') } if (array.byteLength < byteOffset + (length || 0)) { throw new RangeError('\'length\' is out of bounds') } if (byteOffset === undefined && length === undefined) { array = new Uint8Array(array) } else if (length === undefined) { array = new Uint8Array(array, byteOffset) } else { array = new Uint8Array(array, byteOffset, length) } if (Buffer.TYPED_ARRAY_SUPPORT) { // Return an augmented `Uint8Array` instance, for best performance that = array that.__proto__ = Buffer.prototype } else { // Fallback: Return an object instance of the Buffer class that = fromArrayLike(that, array) } return that } function fromObject (that, obj) { if (Buffer.isBuffer(obj)) { var len = checked(obj.length) | 0 that = createBuffer(that, len) if (that.length === 0) { return that } obj.copy(that, 0, 0, len) return that } if (obj) { if ((typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer) || 'length' in obj) { if (typeof obj.length !== 'number' || isnan(obj.length)) { return createBuffer(that, 0) } return fromArrayLike(that, obj) } if (obj.type === 'Buffer' && isArray(obj.data)) { return fromArrayLike(that, obj.data) } } throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') } function checked (length) { // Note: cannot use `length < kMaxLength()` here because that fails when // length is NaN (which is otherwise coerced to zero.) if (length >= kMaxLength()) { throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes') } return length | 0 } function SlowBuffer (length) { if (+length != length) { // eslint-disable-line eqeqeq length = 0 } return Buffer.alloc(+length) } Buffer.isBuffer = function isBuffer (b) { return !!(b != null && b._isBuffer) } Buffer.compare = function compare (a, b) { if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { throw new TypeError('Arguments must be Buffers') } if (a === b) return 0 var x = a.length var y = b.length for (var i = 0, len = Math.min(x, y); i < len; ++i) { if (a[i] !== b[i]) { x = a[i] y = b[i] break } } if (x < y) return -1 if (y < x) return 1 return 0 } Buffer.isEncoding = function isEncoding (encoding) { switch (String(encoding).toLowerCase()) { case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'latin1': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return true default: return false } } Buffer.concat = function concat (list, length) { if (!isArray(list)) { throw new TypeError('"list" argument must be an Array of Buffers') } if (list.length === 0) { return Buffer.alloc(0) } var i if (length === undefined) { length = 0 for (i = 0; i < list.length; ++i) { length += list[i].length } } var buffer = Buffer.allocUnsafe(length) var pos = 0 for (i = 0; i < list.length; ++i) { var buf = list[i] if (!Buffer.isBuffer(buf)) { throw new TypeError('"list" argument must be an Array of Buffers') } buf.copy(buffer, pos) pos += buf.length } return buffer } function byteLength (string, encoding) { if (Buffer.isBuffer(string)) { return string.length } if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { return string.byteLength } if (typeof string !== 'string') { string = '' + string } var len = string.length if (len === 0) return 0 // Use a for loop to avoid recursion var loweredCase = false for (;;) { switch (encoding) { case 'ascii': case 'latin1': case 'binary': return len case 'utf8': case 'utf-8': case undefined: return utf8ToBytes(string).length case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return len * 2 case 'hex': return len >>> 1 case 'base64': return base64ToBytes(string).length default: if (loweredCase) return utf8ToBytes(string).length // assume utf8 encoding = ('' + encoding).toLowerCase() loweredCase = true } } } Buffer.byteLength = byteLength function slowToString (encoding, start, end) { var loweredCase = false // No need to verify that "this.length <= MAX_UINT32" since it's a read-only // property of a typed array. // This behaves neither like String nor Uint8Array in that we set start/end // to their upper/lower bounds if the value passed is out of range. // undefined is handled specially as per ECMA-262 6th Edition, // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. if (start === undefined || start < 0) { start = 0 } // Return early if start > this.length. Done here to prevent potential uint32 // coercion fail below. if (start > this.length) { return '' } if (end === undefined || end > this.length) { end = this.length } if (end <= 0) { return '' } // Force coersion to uint32. This will also coerce falsey/NaN values to 0. end >>>= 0 start >>>= 0 if (end <= start) { return '' } if (!encoding) encoding = 'utf8' while (true) { switch (encoding) { case 'hex': return hexSlice(this, start, end) case 'utf8': case 'utf-8': return utf8Slice(this, start, end) case 'ascii': return asciiSlice(this, start, end) case 'latin1': case 'binary': return latin1Slice(this, start, end) case 'base64': return base64Slice(this, start, end) case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return utf16leSlice(this, start, end) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) encoding = (encoding + '').toLowerCase() loweredCase = true } } } // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect // Buffer instances. Buffer.prototype._isBuffer = true function swap (b, n, m) { var i = b[n] b[n] = b[m] b[m] = i } Buffer.prototype.swap16 = function swap16 () { var len = this.length if (len % 2 !== 0) { throw new RangeError('Buffer size must be a multiple of 16-bits') } for (var i = 0; i < len; i += 2) { swap(this, i, i + 1) } return this } Buffer.prototype.swap32 = function swap32 () { var len = this.length if (len % 4 !== 0) { throw new RangeError('Buffer size must be a multiple of 32-bits') } for (var i = 0; i < len; i += 4) { swap(this, i, i + 3) swap(this, i + 1, i + 2) } return this } Buffer.prototype.swap64 = function swap64 () { var len = this.length if (len % 8 !== 0) { throw new RangeError('Buffer size must be a multiple of 64-bits') } for (var i = 0; i < len; i += 8) { swap(this, i, i + 7) swap(this, i + 1, i + 6) swap(this, i + 2, i + 5) swap(this, i + 3, i + 4) } return this } Buffer.prototype.toString = function toString () { var length = this.length | 0 if (length === 0) return '' if (arguments.length === 0) return utf8Slice(this, 0, length) return slowToString.apply(this, arguments) } Buffer.prototype.equals = function equals (b) { if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') if (this === b) return true return Buffer.compare(this, b) === 0 } Buffer.prototype.inspect = function inspect () { var str = '' var max = exports.INSPECT_MAX_BYTES if (this.length > 0) { str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') if (this.length > max) str += ' ... ' } return '' } Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { if (!Buffer.isBuffer(target)) { throw new TypeError('Argument must be a Buffer') } if (start === undefined) { start = 0 } if (end === undefined) { end = target ? target.length : 0 } if (thisStart === undefined) { thisStart = 0 } if (thisEnd === undefined) { thisEnd = this.length } if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { throw new RangeError('out of range index') } if (thisStart >= thisEnd && start >= end) { return 0 } if (thisStart >= thisEnd) { return -1 } if (start >= end) { return 1 } start >>>= 0 end >>>= 0 thisStart >>>= 0 thisEnd >>>= 0 if (this === target) return 0 var x = thisEnd - thisStart var y = end - start var len = Math.min(x, y) var thisCopy = this.slice(thisStart, thisEnd) var targetCopy = target.slice(start, end) for (var i = 0; i < len; ++i) { if (thisCopy[i] !== targetCopy[i]) { x = thisCopy[i] y = targetCopy[i] break } } if (x < y) return -1 if (y < x) return 1 return 0 } // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, // OR the last index of `val` in `buffer` at offset <= `byteOffset`. // // Arguments: // - buffer - a Buffer to search // - val - a string, Buffer, or number // - byteOffset - an index into `buffer`; will be clamped to an int32 // - encoding - an optional encoding, relevant is val is a string // - dir - true for indexOf, false for lastIndexOf function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { // Empty buffer means no match if (buffer.length === 0) return -1 // Normalize byteOffset if (typeof byteOffset === 'string') { encoding = byteOffset byteOffset = 0 } else if (byteOffset > 0x7fffffff) { byteOffset = 0x7fffffff } else if (byteOffset < -0x80000000) { byteOffset = -0x80000000 } byteOffset = +byteOffset // Coerce to Number. if (isNaN(byteOffset)) { // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer byteOffset = dir ? 0 : (buffer.length - 1) } // Normalize byteOffset: negative offsets start from the end of the buffer if (byteOffset < 0) byteOffset = buffer.length + byteOffset if (byteOffset >= buffer.length) { if (dir) return -1 else byteOffset = buffer.length - 1 } else if (byteOffset < 0) { if (dir) byteOffset = 0 else return -1 } // Normalize val if (typeof val === 'string') { val = Buffer.from(val, encoding) } // Finally, search either indexOf (if dir is true) or lastIndexOf if (Buffer.isBuffer(val)) { // Special case: looking for empty string/buffer always fails if (val.length === 0) { return -1 } return arrayIndexOf(buffer, val, byteOffset, encoding, dir) } else if (typeof val === 'number') { val = val & 0xFF // Search for a byte value [0-255] if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') { if (dir) { return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) } else { return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) } } return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) } throw new TypeError('val must be string, number or Buffer') } function arrayIndexOf (arr, val, byteOffset, encoding, dir) { var indexSize = 1 var arrLength = arr.length var valLength = val.length if (encoding !== undefined) { encoding = String(encoding).toLowerCase() if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') { if (arr.length < 2 || val.length < 2) { return -1 } indexSize = 2 arrLength /= 2 valLength /= 2 byteOffset /= 2 } } function read (buf, i) { if (indexSize === 1) { return buf[i] } else { return buf.readUInt16BE(i * indexSize) } } var i if (dir) { var foundIndex = -1 for (i = byteOffset; i < arrLength; i++) { if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { if (foundIndex === -1) foundIndex = i if (i - foundIndex + 1 === valLength) return foundIndex * indexSize } else { if (foundIndex !== -1) i -= i - foundIndex foundIndex = -1 } } } else { if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength for (i = byteOffset; i >= 0; i--) { var found = true for (var j = 0; j < valLength; j++) { if (read(arr, i + j) !== read(val, j)) { found = false break } } if (found) return i } } return -1 } Buffer.prototype.includes = function includes (val, byteOffset, encoding) { return this.indexOf(val, byteOffset, encoding) !== -1 } Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, true) } Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, false) } function hexWrite (buf, string, offset, length) { offset = Number(offset) || 0 var remaining = buf.length - offset if (!length) { length = remaining } else { length = Number(length) if (length > remaining) { length = remaining } } // must be an even number of digits var strLen = string.length if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') if (length > strLen / 2) { length = strLen / 2 } for (var i = 0; i < length; ++i) { var parsed = parseInt(string.substr(i * 2, 2), 16) if (isNaN(parsed)) return i buf[offset + i] = parsed } return i } function utf8Write (buf, string, offset, length) { return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) } function asciiWrite (buf, string, offset, length) { return blitBuffer(asciiToBytes(string), buf, offset, length) } function latin1Write (buf, string, offset, length) { return asciiWrite(buf, string, offset, length) } function base64Write (buf, string, offset, length) { return blitBuffer(base64ToBytes(string), buf, offset, length) } function ucs2Write (buf, string, offset, length) { return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) } Buffer.prototype.write = function write (string, offset, length, encoding) { // Buffer#write(string) if (offset === undefined) { encoding = 'utf8' length = this.length offset = 0 // Buffer#write(string, encoding) } else if (length === undefined && typeof offset === 'string') { encoding = offset length = this.length offset = 0 // Buffer#write(string, offset[, length][, encoding]) } else if (isFinite(offset)) { offset = offset | 0 if (isFinite(length)) { length = length | 0 if (encoding === undefined) encoding = 'utf8' } else { encoding = length length = undefined } // legacy write(string, encoding, offset, length) - remove in v0.13 } else { throw new Error( 'Buffer.write(string, encoding, offset[, length]) is no longer supported' ) } var remaining = this.length - offset if (length === undefined || length > remaining) length = remaining if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { throw new RangeError('Attempt to write outside buffer bounds') } if (!encoding) encoding = 'utf8' var loweredCase = false for (;;) { switch (encoding) { case 'hex': return hexWrite(this, string, offset, length) case 'utf8': case 'utf-8': return utf8Write(this, string, offset, length) case 'ascii': return asciiWrite(this, string, offset, length) case 'latin1': case 'binary': return latin1Write(this, string, offset, length) case 'base64': // Warning: maxLength not taken into account in base64Write return base64Write(this, string, offset, length) case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return ucs2Write(this, string, offset, length) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) encoding = ('' + encoding).toLowerCase() loweredCase = true } } } Buffer.prototype.toJSON = function toJSON () { return { type: 'Buffer', data: Array.prototype.slice.call(this._arr || this, 0) } } function base64Slice (buf, start, end) { if (start === 0 && end === buf.length) { return base64.fromByteArray(buf) } else { return base64.fromByteArray(buf.slice(start, end)) } } function utf8Slice (buf, start, end) { end = Math.min(buf.length, end) var res = [] var i = start while (i < end) { var firstByte = buf[i] var codePoint = null var bytesPerSequence = (firstByte > 0xEF) ? 4 : (firstByte > 0xDF) ? 3 : (firstByte > 0xBF) ? 2 : 1 if (i + bytesPerSequence <= end) { var secondByte, thirdByte, fourthByte, tempCodePoint switch (bytesPerSequence) { case 1: if (firstByte < 0x80) { codePoint = firstByte } break case 2: secondByte = buf[i + 1] if ((secondByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) if (tempCodePoint > 0x7F) { codePoint = tempCodePoint } } break case 3: secondByte = buf[i + 1] thirdByte = buf[i + 2] if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { codePoint = tempCodePoint } } break case 4: secondByte = buf[i + 1] thirdByte = buf[i + 2] fourthByte = buf[i + 3] if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { codePoint = tempCodePoint } } } } if (codePoint === null) { // we did not generate a valid codePoint so insert a // replacement char (U+FFFD) and advance only 1 byte codePoint = 0xFFFD bytesPerSequence = 1 } else if (codePoint > 0xFFFF) { // encode to utf16 (surrogate pair dance) codePoint -= 0x10000 res.push(codePoint >>> 10 & 0x3FF | 0xD800) codePoint = 0xDC00 | codePoint & 0x3FF } res.push(codePoint) i += bytesPerSequence } return decodeCodePointsArray(res) } // Based on http://stackoverflow.com/a/22747272/680742, the browser with // the lowest limit is Chrome, with 0x10000 args. // We go 1 magnitude less, for safety var MAX_ARGUMENTS_LENGTH = 0x1000 function decodeCodePointsArray (codePoints) { var len = codePoints.length if (len <= MAX_ARGUMENTS_LENGTH) { return String.fromCharCode.apply(String, codePoints) // avoid extra slice() } // Decode in chunks to avoid "call stack size exceeded". var res = '' var i = 0 while (i < len) { res += String.fromCharCode.apply( String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) ) } return res } function asciiSlice (buf, start, end) { var ret = '' end = Math.min(buf.length, end) for (var i = start; i < end; ++i) { ret += String.fromCharCode(buf[i] & 0x7F) } return ret } function latin1Slice (buf, start, end) { var ret = '' end = Math.min(buf.length, end) for (var i = start; i < end; ++i) { ret += String.fromCharCode(buf[i]) } return ret } function hexSlice (buf, start, end) { var len = buf.length if (!start || start < 0) start = 0 if (!end || end < 0 || end > len) end = len var out = '' for (var i = start; i < end; ++i) { out += toHex(buf[i]) } return out } function utf16leSlice (buf, start, end) { var bytes = buf.slice(start, end) var res = '' for (var i = 0; i < bytes.length; i += 2) { res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) } return res } Buffer.prototype.slice = function slice (start, end) { var len = this.length start = ~~start end = end === undefined ? len : ~~end if (start < 0) { start += len if (start < 0) start = 0 } else if (start > len) { start = len } if (end < 0) { end += len if (end < 0) end = 0 } else if (end > len) { end = len } if (end < start) end = start var newBuf if (Buffer.TYPED_ARRAY_SUPPORT) { newBuf = this.subarray(start, end) newBuf.__proto__ = Buffer.prototype } else { var sliceLen = end - start newBuf = new Buffer(sliceLen, undefined) for (var i = 0; i < sliceLen; ++i) { newBuf[i] = this[i + start] } } return newBuf } /* * Need to make sure that buffer isn't trying to write out of bounds. */ function checkOffset (offset, ext, length) { if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') } Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var val = this[offset] var mul = 1 var i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } return val } Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) { checkOffset(offset, byteLength, this.length) } var val = this[offset + --byteLength] var mul = 1 while (byteLength > 0 && (mul *= 0x100)) { val += this[offset + --byteLength] * mul } return val } Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { if (!noAssert) checkOffset(offset, 1, this.length) return this[offset] } Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) return this[offset] | (this[offset + 1] << 8) } Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) return (this[offset] << 8) | this[offset + 1] } Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return ((this[offset]) | (this[offset + 1] << 8) | (this[offset + 2] << 16)) + (this[offset + 3] * 0x1000000) } Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset] * 0x1000000) + ((this[offset + 1] << 16) | (this[offset + 2] << 8) | this[offset + 3]) } Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var val = this[offset] var mul = 1 var i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } mul *= 0x80 if (val >= mul) val -= Math.pow(2, 8 * byteLength) return val } Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var i = byteLength var mul = 1 var val = this[offset + --i] while (i > 0 && (mul *= 0x100)) { val += this[offset + --i] * mul } mul *= 0x80 if (val >= mul) val -= Math.pow(2, 8 * byteLength) return val } Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { if (!noAssert) checkOffset(offset, 1, this.length) if (!(this[offset] & 0x80)) return (this[offset]) return ((0xff - this[offset] + 1) * -1) } Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) var val = this[offset] | (this[offset + 1] << 8) return (val & 0x8000) ? val | 0xFFFF0000 : val } Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) var val = this[offset + 1] | (this[offset] << 8) return (val & 0x8000) ? val | 0xFFFF0000 : val } Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset]) | (this[offset + 1] << 8) | (this[offset + 2] << 16) | (this[offset + 3] << 24) } Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset] << 24) | (this[offset + 1] << 16) | (this[offset + 2] << 8) | (this[offset + 3]) } Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return ieee754.read(this, offset, true, 23, 4) } Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return ieee754.read(this, offset, false, 23, 4) } Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { if (!noAssert) checkOffset(offset, 8, this.length) return ieee754.read(this, offset, true, 52, 8) } Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { if (!noAssert) checkOffset(offset, 8, this.length) return ieee754.read(this, offset, false, 52, 8) } function checkInt (buf, value, offset, ext, max, min) { if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') if (offset + ext > buf.length) throw new RangeError('Index out of range') } Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) { var maxBytes = Math.pow(2, 8 * byteLength) - 1 checkInt(this, value, offset, byteLength, maxBytes, 0) } var mul = 1 var i = 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF } return offset + byteLength } Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) { var maxBytes = Math.pow(2, 8 * byteLength) - 1 checkInt(this, value, offset, byteLength, maxBytes, 0) } var i = byteLength - 1 var mul = 1 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF } return offset + byteLength } Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) this[offset] = (value & 0xff) return offset + 1 } function objectWriteUInt16 (buf, value, offset, littleEndian) { if (value < 0) value = 0xffff + value + 1 for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> (littleEndian ? i : 1 - i) * 8 } } Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) } else { objectWriteUInt16(this, value, offset, true) } return offset + 2 } Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 8) this[offset + 1] = (value & 0xff) } else { objectWriteUInt16(this, value, offset, false) } return offset + 2 } function objectWriteUInt32 (buf, value, offset, littleEndian) { if (value < 0) value = 0xffffffff + value + 1 for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff } } Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset + 3] = (value >>> 24) this[offset + 2] = (value >>> 16) this[offset + 1] = (value >>> 8) this[offset] = (value & 0xff) } else { objectWriteUInt32(this, value, offset, true) } return offset + 4 } Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 24) this[offset + 1] = (value >>> 16) this[offset + 2] = (value >>> 8) this[offset + 3] = (value & 0xff) } else { objectWriteUInt32(this, value, offset, false) } return offset + 4 } Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 if (!noAssert) { var limit = Math.pow(2, 8 * byteLength - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } var i = 0 var mul = 1 var sub = 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { sub = 1 } this[offset + i] = ((value / mul) >> 0) - sub & 0xFF } return offset + byteLength } Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 if (!noAssert) { var limit = Math.pow(2, 8 * byteLength - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } var i = byteLength - 1 var mul = 1 var sub = 0 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { sub = 1 } this[offset + i] = ((value / mul) >> 0) - sub & 0xFF } return offset + byteLength } Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) if (value < 0) value = 0xff + value + 1 this[offset] = (value & 0xff) return offset + 1 } Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) } else { objectWriteUInt16(this, value, offset, true) } return offset + 2 } Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 8) this[offset + 1] = (value & 0xff) } else { objectWriteUInt16(this, value, offset, false) } return offset + 2 } Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) this[offset + 2] = (value >>> 16) this[offset + 3] = (value >>> 24) } else { objectWriteUInt32(this, value, offset, true) } return offset + 4 } Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) if (value < 0) value = 0xffffffff + value + 1 if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 24) this[offset + 1] = (value >>> 16) this[offset + 2] = (value >>> 8) this[offset + 3] = (value & 0xff) } else { objectWriteUInt32(this, value, offset, false) } return offset + 4 } function checkIEEE754 (buf, value, offset, ext, max, min) { if (offset + ext > buf.length) throw new RangeError('Index out of range') if (offset < 0) throw new RangeError('Index out of range') } function writeFloat (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) } ieee754.write(buf, value, offset, littleEndian, 23, 4) return offset + 4 } Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { return writeFloat(this, value, offset, true, noAssert) } Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { return writeFloat(this, value, offset, false, noAssert) } function writeDouble (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) } ieee754.write(buf, value, offset, littleEndian, 52, 8) return offset + 8 } Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { return writeDouble(this, value, offset, true, noAssert) } Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { return writeDouble(this, value, offset, false, noAssert) } // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) Buffer.prototype.copy = function copy (target, targetStart, start, end) { if (!start) start = 0 if (!end && end !== 0) end = this.length if (targetStart >= target.length) targetStart = target.length if (!targetStart) targetStart = 0 if (end > 0 && end < start) end = start // Copy 0 bytes; we're done if (end === start) return 0 if (target.length === 0 || this.length === 0) return 0 // Fatal error conditions if (targetStart < 0) { throw new RangeError('targetStart out of bounds') } if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') if (end < 0) throw new RangeError('sourceEnd out of bounds') // Are we oob? if (end > this.length) end = this.length if (target.length - targetStart < end - start) { end = target.length - targetStart + start } var len = end - start var i if (this === target && start < targetStart && targetStart < end) { // descending copy from end for (i = len - 1; i >= 0; --i) { target[i + targetStart] = this[i + start] } } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { // ascending copy from start for (i = 0; i < len; ++i) { target[i + targetStart] = this[i + start] } } else { Uint8Array.prototype.set.call( target, this.subarray(start, start + len), targetStart ) } return len } // Usage: // buffer.fill(number[, offset[, end]]) // buffer.fill(buffer[, offset[, end]]) // buffer.fill(string[, offset[, end]][, encoding]) Buffer.prototype.fill = function fill (val, start, end, encoding) { // Handle string cases: if (typeof val === 'string') { if (typeof start === 'string') { encoding = start start = 0 end = this.length } else if (typeof end === 'string') { encoding = end end = this.length } if (val.length === 1) { var code = val.charCodeAt(0) if (code < 256) { val = code } } if (encoding !== undefined && typeof encoding !== 'string') { throw new TypeError('encoding must be a string') } if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { throw new TypeError('Unknown encoding: ' + encoding) } } else if (typeof val === 'number') { val = val & 255 } // Invalid ranges are not set to a default, so can range check early. if (start < 0 || this.length < start || this.length < end) { throw new RangeError('Out of range index') } if (end <= start) { return this } start = start >>> 0 end = end === undefined ? this.length : end >>> 0 if (!val) val = 0 var i if (typeof val === 'number') { for (i = start; i < end; ++i) { this[i] = val } } else { var bytes = Buffer.isBuffer(val) ? val : utf8ToBytes(new Buffer(val, encoding).toString()) var len = bytes.length for (i = 0; i < end - start; ++i) { this[i + start] = bytes[i % len] } } return this } // HELPER FUNCTIONS // ================ var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g function base64clean (str) { // Node strips out invalid characters like \n and \t from the string, base64-js does not str = stringtrim(str).replace(INVALID_BASE64_RE, '') // Node converts strings with length < 2 to '' if (str.length < 2) return '' // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not while (str.length % 4 !== 0) { str = str + '=' } return str } function stringtrim (str) { if (str.trim) return str.trim() return str.replace(/^\s+|\s+$/g, '') } function toHex (n) { if (n < 16) return '0' + n.toString(16) return n.toString(16) } function utf8ToBytes (string, units) { units = units || Infinity var codePoint var length = string.length var leadSurrogate = null var bytes = [] for (var i = 0; i < length; ++i) { codePoint = string.charCodeAt(i) // is surrogate component if (codePoint > 0xD7FF && codePoint < 0xE000) { // last char was a lead if (!leadSurrogate) { // no lead yet if (codePoint > 0xDBFF) { // unexpected trail if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) continue } else if (i + 1 === length) { // unpaired lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) continue } // valid lead leadSurrogate = codePoint continue } // 2 leads in a row if (codePoint < 0xDC00) { if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) leadSurrogate = codePoint continue } // valid surrogate pair codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 } else if (leadSurrogate) { // valid bmp char, but last char was a lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) } leadSurrogate = null // encode utf8 if (codePoint < 0x80) { if ((units -= 1) < 0) break bytes.push(codePoint) } else if (codePoint < 0x800) { if ((units -= 2) < 0) break bytes.push( codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80 ) } else if (codePoint < 0x10000) { if ((units -= 3) < 0) break bytes.push( codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80 ) } else if (codePoint < 0x110000) { if ((units -= 4) < 0) break bytes.push( codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80 ) } else { throw new Error('Invalid code point') } } return bytes } function asciiToBytes (str) { var byteArray = [] for (var i = 0; i < str.length; ++i) { // Node's code seems to be doing this and not & 0x7F.. byteArray.push(str.charCodeAt(i) & 0xFF) } return byteArray } function utf16leToBytes (str, units) { var c, hi, lo var byteArray = [] for (var i = 0; i < str.length; ++i) { if ((units -= 2) < 0) break c = str.charCodeAt(i) hi = c >> 8 lo = c % 256 byteArray.push(lo) byteArray.push(hi) } return byteArray } function base64ToBytes (str) { return base64.toByteArray(base64clean(str)) } function blitBuffer (src, dst, offset, length) { for (var i = 0; i < length; ++i) { if ((i + offset >= dst.length) || (i >= src.length)) break dst[i + offset] = src[i] } return i } function isnan (val) { return val !== val // eslint-disable-line no-self-compare } /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(0))) /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.byteLength = byteLength exports.toByteArray = toByteArray exports.fromByteArray = fromByteArray var lookup = [] var revLookup = [] var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' for (var i = 0, len = code.length; i < len; ++i) { lookup[i] = code[i] revLookup[code.charCodeAt(i)] = i } // Support decoding URL-safe base64 strings, as Node.js does. // See: https://en.wikipedia.org/wiki/Base64#URL_applications revLookup['-'.charCodeAt(0)] = 62 revLookup['_'.charCodeAt(0)] = 63 function getLens (b64) { var len = b64.length if (len % 4 > 0) { throw new Error('Invalid string. Length must be a multiple of 4') } // Trim off extra bytes after placeholder bytes are found // See: https://github.com/beatgammit/base64-js/issues/42 var validLen = b64.indexOf('=') if (validLen === -1) validLen = len var placeHoldersLen = validLen === len ? 0 : 4 - (validLen % 4) return [validLen, placeHoldersLen] } // base64 is 4/3 + up to two characters of the original data function byteLength (b64) { var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen } function _byteLength (b64, validLen, placeHoldersLen) { return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen } function toByteArray (b64) { var tmp var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) var curByte = 0 // if there are placeholders, only get up to the last complete 4 chars var len = placeHoldersLen > 0 ? validLen - 4 : validLen var i for (i = 0; i < len; i += 4) { tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)] arr[curByte++] = (tmp >> 16) & 0xFF arr[curByte++] = (tmp >> 8) & 0xFF arr[curByte++] = tmp & 0xFF } if (placeHoldersLen === 2) { tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4) arr[curByte++] = tmp & 0xFF } if (placeHoldersLen === 1) { tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2) arr[curByte++] = (tmp >> 8) & 0xFF arr[curByte++] = tmp & 0xFF } return arr } function tripletToBase64 (num) { return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] } function encodeChunk (uint8, start, end) { var tmp var output = [] for (var i = start; i < end; i += 3) { tmp = ((uint8[i] << 16) & 0xFF0000) + ((uint8[i + 1] << 8) & 0xFF00) + (uint8[i + 2] & 0xFF) output.push(tripletToBase64(tmp)) } return output.join('') } function fromByteArray (uint8) { var tmp var len = uint8.length var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes var parts = [] var maxChunkLength = 16383 // must be multiple of 3 // go through the array every three bytes, we'll deal with trailing stuff later for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) } // pad the end with zeros, but make sure to not forget the extra bytes if (extraBytes === 1) { tmp = uint8[len - 1] parts.push( lookup[tmp >> 2] + lookup[(tmp << 4) & 0x3F] + '==' ) } else if (extraBytes === 2) { tmp = (uint8[len - 2] << 8) + uint8[len - 1] parts.push( lookup[tmp >> 10] + lookup[(tmp >> 4) & 0x3F] + lookup[(tmp << 2) & 0x3F] + '=' ) } return parts.join('') } /***/ }), /* 20 */ /***/ (function(module, exports) { /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = (nBytes * 8) - mLen - 1 var eMax = (1 << eLen) - 1 var eBias = eMax >> 1 var nBits = -7 var i = isLE ? (nBytes - 1) : 0 var d = isLE ? -1 : 1 var s = buffer[offset + i] i += d e = s & ((1 << (-nBits)) - 1) s >>= (-nBits) nBits += eLen for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} m = e & ((1 << (-nBits)) - 1) e >>= (-nBits) nBits += mLen for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} if (e === 0) { e = 1 - eBias } else if (e === eMax) { return m ? NaN : ((s ? -1 : 1) * Infinity) } else { m = m + Math.pow(2, mLen) e = e - eBias } return (s ? -1 : 1) * m * Math.pow(2, e - mLen) } exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { var e, m, c var eLen = (nBytes * 8) - mLen - 1 var eMax = (1 << eLen) - 1 var eBias = eMax >> 1 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) var i = isLE ? 0 : (nBytes - 1) var d = isLE ? 1 : -1 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 value = Math.abs(value) if (isNaN(value) || value === Infinity) { m = isNaN(value) ? 1 : 0 e = eMax } else { e = Math.floor(Math.log(value) / Math.LN2) if (value * (c = Math.pow(2, -e)) < 1) { e-- c *= 2 } if (e + eBias >= 1) { value += rt / c } else { value += rt * Math.pow(2, 1 - eBias) } if (value * c >= 2) { e++ c /= 2 } if (e + eBias >= eMax) { m = 0 e = eMax } else if (e + eBias >= 1) { m = ((value * c) - 1) * Math.pow(2, mLen) e = e + eBias } else { m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) e = 0 } } for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} e = (e << mLen) | m eLen += mLen for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} buffer[offset + i - d] |= s * 128 } /***/ }), /* 21 */ /***/ (function(module, exports) { var toString = {}.toString; module.exports = Array.isArray || function (arr) { return toString.call(arr) == '[object Array]'; }; /***/ }), /* 22 */ /***/ (function(module, exports) { module.exports = ({ protocol, hostname, path }, postBody) => { return new Promise((resolve, reject) => { let xhr = new XMLHttpRequest(); xhr.open('POST', `${protocol}//${hostname}${path}`, true); xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8'); xhr.setRequestHeader('Access-Control-Allow-Origin', '*'); xhr.setRequestHeader("Accept", "*/*"); xhr.onreadystatechange = () => { if (xhr.readyState == 4) { xhr.status == 200 ? resolve(JSON.parse(xhr.responseText)) : reject(xhr.status); } }; xhr.send(JSON.stringify(postBody)); }); }; /***/ }), /* 23 */ /***/ (function(module, exports) { exports.endianness = function () { return 'LE' }; exports.hostname = function () { if (typeof location !== 'undefined') { return location.hostname } else return ''; }; exports.loadavg = function () { return [] }; exports.uptime = function () { return 0 }; exports.freemem = function () { return Number.MAX_VALUE; }; exports.totalmem = function () { return Number.MAX_VALUE; }; exports.cpus = function () { return [] }; exports.type = function () { return 'Browser' }; exports.release = function () { if (typeof navigator !== 'undefined') { return navigator.appVersion; } return ''; }; exports.networkInterfaces = exports.getNetworkInterfaces = function () { return {} }; exports.arch = function () { return 'javascript' }; exports.platform = function () { return 'browser' }; exports.tmpdir = exports.tmpDir = function () { return '/tmp'; }; exports.EOL = '\n'; exports.homedir = function () { return '/' }; /***/ }), /* 24 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } /* # ----------------------------------------------------------------------------- # ~/js/tocbot/tocbot.js # Tocbot v4.12.0 implementation for J1 template # # Product/Info: # https://jekyll.one # https://tscanlin.github.io/tocbot # https://github.com/tscanlin/tocbot # # Copyright (C) 2021 Juergen Adams # Copyright (C) 2016 Tim Scanlin # # J1 Template is licensed under MIT License. # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE # Tocbot is licensed under the MIT License. # For details, https://github.com/tscanlin/tocbot/blob/master/LICENSE # ----------------------------------------------------------------------------- # rules: # "eslint:tocbot": "eslint --ignore-path .eslintignore src/tocbot/js" # ----------------------------------------------------------------------------- */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* eslint no-undef: "off" */ /* eslint semi: "off" */ // ----------------------------------------------------------------------------- /** * Tocbot * Tocbot creates a toble of contents based on HTML headings on a page, * this allows users to easily jump to different sections of the document. * Tocbot was inspired by tocify (http://gregfranko.com/jquery.tocify.js/). * The main differences are that it works natively without any need for jquery or jquery UI). * * @author Tim Scanlin */ /* globals define */ (function (root, factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory(root)), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else {} })(typeof global !== 'undefined' ? global : this.window || this.global, function (root) { 'use strict'; // Default options. var defaultOptions = __webpack_require__(25); // Object to store current options. var options = {}; // Object for public APIs. var tocbot = {}; var BuildHtml = __webpack_require__(26); var ParseContent = __webpack_require__(27); var updateTocScroll = __webpack_require__(28); // Keep these variables at top scope once options are passed in. var buildHtml; var parseContent; // Just return if its not a browser. var supports = !!root && !!root.document && !!root.document.querySelector && !!root.addEventListener; // Feature test if (typeof window === 'undefined' && !supports) { return; } var headingsArray; // From: https://github.com/Raynos/xtend var hasOwnProperty = Object.prototype.hasOwnProperty; function extend() { var target = {}; for (var i = 0; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; } // From: https://remysharp.com/2010/07/21/throttling-function-calls function throttle(fn, threshold, scope) { threshold || (threshold = 250); var last; var deferTimer; return function () { var context = scope || this; var now = +new Date(); var args = arguments; if (last && now < last + threshold) { // hold on to it clearTimeout(deferTimer); deferTimer = setTimeout(function () { last = now; fn.apply(context, args); }, threshold); } else { last = now; fn.apply(context, args); } }; } /** * Destroy tocbot. */ tocbot.destroy = function () { if (!options.skipRendering) { // Clear HTML. try { document.querySelector(options.tocSelector).innerHTML = ''; } catch (e) { console.warn('Element not found: ' + options.tocSelector); // eslint-disable-line } } // Remove event listeners. if (options.scrollContainer && document.querySelector(options.scrollContainer)) { document.querySelector(options.scrollContainer).removeEventListener('scroll', this._scrollListener, false); document.querySelector(options.scrollContainer).removeEventListener('resize', this._scrollListener, false); if (buildHtml) { document.querySelector(options.scrollContainer).removeEventListener('click', this._clickListener, false); } } else { document.removeEventListener('scroll', this._scrollListener, false); document.removeEventListener('resize', this._scrollListener, false); if (buildHtml) { document.removeEventListener('click', this._clickListener, false); } } }; /** * Initialize tocbot. * @param {object} customOptions */ tocbot.init = function (customOptions) { // feature test if (!supports) { return; } // Merge defaults with user options. // Set to options variable at the top. options = extend(defaultOptions, customOptions || {}); this.options = options; this.state = {}; // Init smooth scroll if enabled (default). if (options.scrollSmooth) { options.duration = options.scrollSmoothDuration; options.offset = options.scrollSmoothOffset; tocbot.scrollSmooth = __webpack_require__(29).initSmoothScrolling(options); } // Pass options to these modules. buildHtml = BuildHtml(options); parseContent = ParseContent(options); // For testing purposes. this._buildHtml = buildHtml; this._parseContent = parseContent; // Destroy it if it exists first. tocbot.destroy(); // Get headings array. headingsArray = parseContent.selectHeadings(options.contentSelector, options.headingSelector); // Return if no headings are found. if (headingsArray === null) { return; } // Build nested headings array. var nestedHeadingsObj = parseContent.nestHeadingsArray(headingsArray); var nestedHeadings = nestedHeadingsObj.nest; // Render. if (!options.skipRendering) { buildHtml.render(options.tocSelector, nestedHeadings); } // Update Sidebar and bind listeners. this._scrollListener = throttle(function (e) { buildHtml.updateToc(headingsArray); !options.disableTocScrollSync && updateTocScroll(options); var isTop = e && e.target && e.target.scrollingElement && e.target.scrollingElement.scrollTop === 0; if (e && (e.eventPhase === 0 || e.currentTarget === null) || isTop) { buildHtml.updateToc(headingsArray); if (options.scrollEndCallback) { options.scrollEndCallback(e); } } }, options.throttleTimeout); this._scrollListener(); if (options.scrollContainer && document.querySelector(options.scrollContainer)) { document.querySelector(options.scrollContainer).addEventListener('scroll', this._scrollListener, false); document.querySelector(options.scrollContainer).addEventListener('resize', this._scrollListener, false); } else { document.addEventListener('scroll', this._scrollListener, false); document.addEventListener('resize', this._scrollListener, false); } // Bind click listeners to disable animation. var timeout = null; this._clickListener = throttle(function (event) { if (options.scrollSmooth) { buildHtml.disableTocAnimation(event); } buildHtml.updateToc(headingsArray); // Timeout to re-enable the animation. timeout && clearTimeout(timeout); timeout = setTimeout(function () { buildHtml.enableTocAnimation(); }, options.scrollSmoothDuration); }, options.throttleTimeout); if (options.scrollContainer && document.querySelector(options.scrollContainer)) { document.querySelector(options.scrollContainer).addEventListener('click', this._clickListener, false); } else { document.addEventListener('click', this._clickListener, false); } return this; }; /** * Refresh tocbot. */ tocbot.refresh = function (customOptions) { tocbot.destroy(); tocbot.init(customOptions || this.options); }; // Make tocbot available globally. root.tocbot = tocbot; return tocbot; }); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(0))) /***/ }), /* 25 */ /***/ (function(module, exports) { // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* eslint no-undef: "off" */ /* eslint no-unused-vars: "off" */ // ----------------------------------------------------------------------------- module.exports = { // Where to render the table of contents. tocSelector: '.js-toc', // Where to grab the headings to build the table of contents. contentSelector: '.js-toc-content', // Which headings to grab inside of the contentSelector element. headingSelector: 'h1, h2, h3', // Headings that match the ignoreSelector will be skipped. ignoreSelector: '.js-toc-ignore', // For headings inside relative or absolute positioned containers within content hasInnerContainers: false, // Main class to add to links. linkClass: 'toc-link', // Extra classes to add to links. extraLinkClasses: '', // Class to add to active links, // the link corresponding to the top most heading on the page. activeLinkClass: 'is-active-link', // Main class to add to lists. listClass: 'toc-list', // Extra classes to add to lists. extraListClasses: '', // Class that gets added when a list should be collapsed. isCollapsedClass: 'is-collapsed', // Class that gets added when a list should be able // to be collapsed but isn't necessarily collapsed. collapsibleClass: 'is-collapsible', // Class to add to list items. listItemClass: 'toc-list-item', // Class to add to active list items. activeListItemClass: 'is-active-li', // How many heading levels should not be collapsed. // For example, number 6 will show everything since // there are only 6 heading levels and number 0 will collapse them all. // The sections that are hidden will open // and close as you scroll to headings within them. collapseDepth: 0, // Smooth scrolling enabled. scrollSmooth: true, // Smooth scroll duration. scrollSmoothDuration: 420, // Smooth scroll offset. scrollSmoothOffset: 0, // Callback for scroll end. scrollEndCallback: function scrollEndCallback(e) {}, // Headings offset between the headings and the top of the document (this is meant for minor adjustments). headingsOffset: 1, // Timeout between events firing to make sure it's // not too rapid (for performance reasons). throttleTimeout: 50, // Element to add the positionFixedClass to. positionFixedSelector: null, // Fixed position class to add to make sidebar fixed after scrolling // down past the fixedSidebarOffset. positionFixedClass: 'is-position-fixed', // fixedSidebarOffset can be any number but by default is set // to auto which sets the fixedSidebarOffset to the sidebar // element's offsetTop from the top of the document on init. fixedSidebarOffset: 'auto', // includeHtml can be set to true to include the HTML markup from the // heading node instead of just including the textContent. includeHtml: false, // onclick function to apply to all links in toc. will be called with // the event as the first parameter, and this can be used to stop, // propagation, prevent default or perform action onClick: function onClick(e) {}, // orderedList can be set to false to generate unordered lists (ul) // instead of ordered lists (ol) orderedList: true, // If there is a fixed article scroll container, set to calculate titles' offset scrollContainer: null, // prevent ToC DOM rendering if it's already rendered by an external system skipRendering: false, // Optional callback to change heading labels. // For example it can be used to cut down and put ellipses on multiline headings you deem too long. // Called each time a heading is parsed. Expects a string in return, the modified label to display. // function (string) => string headingLabelCallback: false, // ignore headings that are hidden in DOM ignoreHiddenElements: false, // Optional callback to modify properties of parsed headings. // The heading element is passed in node parameter and information parsed by default parser is provided in obj parameter. // Function has to return the same or modified obj. // The heading will be excluded from TOC if nothing is returned. // function (object, HTMLElement) => object | void headingObjectCallback: null, // Set the base path, useful if you use a `base` tag in `head`. basePath: '', // Only takes affect when `tocSelector` is scrolling, // keep the toc scroll position in sync with the content. disableTocScrollSync: false }; /***/ }), /* 26 */ /***/ (function(module, exports) { /** * This file is responsible for building the DOM and updating DOM state. * * @author Tim Scanlin */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* eslint no-undef: "off" */ /* eslint semi: "off" */ // ----------------------------------------------------------------------------- module.exports = function (options) { var forEach = [].forEach; var some = [].some; var body = document.body; var currentlyHighlighting = true; var SPACE_CHAR = ' '; /** * Create link and list elements. * @param {Object} d * @param {HTMLElement} container * @return {HTMLElement} */ function createEl(d, container) { var link = container.appendChild(createLink(d)); if (d.children.length) { var list = createList(d.isCollapsed); d.children.forEach(function (child) { createEl(child, list); }); link.appendChild(list); } } /** * Render nested heading array data into a given selector. * @param {String} selector * @param {Array} data * @return {HTMLElement} */ function render(selector, data) { var collapsed = false; var container = createList(collapsed); data.forEach(function (d) { createEl(d, container); }); var parent = document.querySelector(selector); // Return if no parent is found. if (parent === null) { return; } // Remove existing child if it exists. if (parent.firstChild) { parent.removeChild(parent.firstChild); } // Just return the parent and don't append the list if no links are found. if (data.length === 0) { return parent; } // Append the Elements that have been created return parent.appendChild(container); } /** * Create link element. * @param {Object} data * @return {HTMLElement} */ function createLink(data) { var item = document.createElement('li'); var a = document.createElement('a'); if (options.listItemClass) { item.setAttribute('class', options.listItemClass); } if (options.onClick) { a.onclick = options.onClick; } if (options.includeHtml && data.childNodes.length) { forEach.call(data.childNodes, function (node) { a.appendChild(node.cloneNode(true)); }); } else { // Default behavior. a.textContent = data.textContent; } a.setAttribute('href', options.basePath + '#' + data.id); a.setAttribute('class', options.linkClass + SPACE_CHAR + 'node-name--' + data.nodeName + SPACE_CHAR + options.extraLinkClasses); item.appendChild(a); return item; } /** * Create list element. * @param {Boolean} isCollapsed * @return {HTMLElement} */ function createList(isCollapsed) { var listElement = options.orderedList ? 'ol' : 'ul'; var list = document.createElement(listElement); var classes = options.listClass + SPACE_CHAR + options.extraListClasses; if (isCollapsed) { classes += SPACE_CHAR + options.collapsibleClass; classes += SPACE_CHAR + options.isCollapsedClass; } list.setAttribute('class', classes); return list; } /** * Update fixed sidebar class. * @return {HTMLElement} */ function updateFixedSidebarClass() { if (options.scrollContainer && document.querySelector(options.scrollContainer)) { var top; top = document.querySelector(options.scrollContainer).scrollTop; } else { top = document.documentElement.scrollTop || body.scrollTop; } var posFixedEl = document.querySelector(options.positionFixedSelector); if (options.fixedSidebarOffset === 'auto') { options.fixedSidebarOffset = document.querySelector(options.tocSelector).offsetTop; } if (top > options.fixedSidebarOffset) { if (posFixedEl.className.indexOf(options.positionFixedClass) === -1) { posFixedEl.className += SPACE_CHAR + options.positionFixedClass; } } else { posFixedEl.className = posFixedEl.className.split(SPACE_CHAR + options.positionFixedClass).join(''); } } /** * Get top position of heading * @param {HTMLElement} * @return {integer} position */ function getHeadingTopPos(obj) { var position = 0; if (obj !== document.querySelector(options.contentSelector && obj != null)) { position = obj.offsetTop; if (options.hasInnerContainers) { position += getHeadingTopPos(obj.offsetParent); } } return position; } /** * Update TOC highlighting and collapsed groups */ function updateToc(headingsArray) { // If a fixed content container was set if (options.scrollContainer && document.querySelector(options.scrollContainer)) { var top; top = document.querySelector(options.scrollContainer).scrollTop; } else { top = document.documentElement.scrollTop || body.scrollTop; } // Add fixed class at offset if (options.positionFixedSelector) { updateFixedSidebarClass(); } // Get the most TOP heading currently visible on the page to // identify what element to be highlighted var headings = headingsArray; var topHeader; var headingTopPos; // Using some instead of each so that we can escape early if (currentlyHighlighting && document.querySelector(options.tocSelector) !== null && headings.length > 0) { some.call(headings, function (heading, i) { headingTopPos = getHeadingTopPos(heading); if (headingTopPos > top + options.headingsOffset + 10) { // Don't allow negative index value // var index = (i === 0) ? i : i - 1; // topHeader = headings[index]; // jadams, index correction seems NOT needed topHeader = headings[i]; return true; } else if (i === headings.length - 1) { // This allows scrolling for the last heading on the page topHeader = headings[headings.length - 1]; return true; } }); // Remove the active class from the other tocLinks. var tocLinks = document.querySelector(options.tocSelector).querySelectorAll('.' + options.linkClass); forEach.call(tocLinks, function (tocLink) { tocLink.className = tocLink.className.split(SPACE_CHAR + options.activeLinkClass).join(''); }); var tocLis = document.querySelector(options.tocSelector).querySelectorAll('.' + options.listItemClass); forEach.call(tocLis, function (tocLi) { tocLi.className = tocLi.className.split(SPACE_CHAR + options.activeListItemClass).join(''); }); // Add the active class to the active tocLink. var activeTocLink = document.querySelector(options.tocSelector).querySelector('.' + options.linkClass + '.node-name--' + topHeader.nodeName + '[href="' + options.basePath + '#' + topHeader.id.replace(/([ #;&,.+*~':"!^$[\]()=>|/@])/g, '\\$1') + '"]'); if (activeTocLink.className.indexOf(options.activeLinkClass) === -1) { activeTocLink.className += SPACE_CHAR + options.activeLinkClass; } var li = activeTocLink.parentNode; if (li && li.className.indexOf(options.activeListItemClass) === -1) { li.className += SPACE_CHAR + options.activeListItemClass; } var tocLists = document.querySelector(options.tocSelector).querySelectorAll('.' + options.listClass + '.' + options.collapsibleClass); // Collapse the other collapsible lists. forEach.call(tocLists, function (list) { if (list.className.indexOf(options.isCollapsedClass) === -1) { list.className += SPACE_CHAR + options.isCollapsedClass; } }); // Expand the active link's collapsible list and its sibling if applicable. if (activeTocLink.nextSibling && activeTocLink.nextSibling.className.indexOf(options.isCollapsedClass) !== -1) { activeTocLink.nextSibling.className = activeTocLink.nextSibling.className.split(SPACE_CHAR + options.isCollapsedClass).join(''); } removeCollapsedFromParents(activeTocLink.parentNode.parentNode); } } /** * Remove collpased class from parent elements. * @param {HTMLElement} element * @return {HTMLElement} */ function removeCollapsedFromParents(element) { if (element.className.indexOf(options.collapsibleClass) !== -1 && element.className.indexOf(options.isCollapsedClass) !== -1) { element.className = element.className.split(SPACE_CHAR + options.isCollapsedClass).join(''); return removeCollapsedFromParents(element.parentNode.parentNode); } return element; } /** * Disable TOC Animation when a link is clicked. * @param {Event} event */ function disableTocAnimation(event) { var target = event.target || event.srcElement; if (typeof target.className !== 'string' || target.className.indexOf(options.linkClass) === -1) { return; } // Bind to tocLink clicks to temporarily disable highlighting // while smoothScroll is animating. currentlyHighlighting = false; } /** * Enable TOC Animation. */ function enableTocAnimation() { currentlyHighlighting = true; } return { enableTocAnimation: enableTocAnimation, disableTocAnimation: disableTocAnimation, render: render, updateToc: updateToc }; }; /***/ }), /* 27 */ /***/ (function(module, exports) { /** * This file is responsible for parsing the content from the DOM and making * sure data is nested properly. * * @author Tim Scanlin */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* eslint no-undef: "off" */ /* eslint semi: "off" */ // ----------------------------------------------------------------------------- module.exports = function parseContent(options) { var reduce = [].reduce; /** * Get the last item in an array and return a reference to it. * @param {Array} array * @return {Object} */ function getLastItem(array) { return array[array.length - 1]; } /** * Get heading level for a heading dom node. * @param {HTMLElement} heading * @return {Number} */ function getHeadingLevel(heading) { return +heading.nodeName.split('H').join(''); } /** * Get important properties from a heading element and store in a plain object. * @param {HTMLElement} heading * @return {Object} */ function getHeadingObject(heading) { // each node is processed twice by this method because nestHeadingsArray() and addNode() calls it // first time heading is real DOM node element, second time it is obj // that is causing problem so I am processing only original DOM node if (!(heading instanceof window.HTMLElement)) return heading; if (options.ignoreHiddenElements && (!heading.offsetHeight || !heading.offsetParent)) { return null; } var obj = { id: heading.id, children: [], nodeName: heading.nodeName, headingLevel: getHeadingLevel(heading), textContent: options.headingLabelCallback ? String(options.headingLabelCallback(heading.textContent)) : heading.textContent.trim() }; if (options.includeHtml) { obj.childNodes = heading.childNodes; } if (options.headingObjectCallback) { return options.headingObjectCallback(obj, heading); } return obj; } /** * Add a node to the nested array. * @param {Object} node * @param {Array} nest * @return {Array} */ function addNode(node, nest) { var obj = getHeadingObject(node); var level = obj.headingLevel; var array = nest; var lastItem = getLastItem(array); var lastItemLevel = lastItem ? lastItem.headingLevel : 0; var counter = level - lastItemLevel; while (counter > 0) { lastItem = getLastItem(array); if (lastItem && lastItem.children !== undefined) { array = lastItem.children; } counter--; } if (level >= options.collapseDepth) { obj.isCollapsed = true; } array.push(obj); return array; } /** * Select headings in content area, exclude any selector in options.ignoreSelector * @param {String} contentSelector * @param {Array} headingSelector * @return {Array} */ function selectHeadings(contentSelector, headingSelector) { var selectors = headingSelector; if (options.ignoreSelector) { selectors = headingSelector.split(',').map(function mapSelectors(selector) { return selector.trim() + ':not(' + options.ignoreSelector + ')'; }); } try { return document.querySelector(contentSelector).querySelectorAll(selectors); } catch (e) { console.warn('Element not found: ' + contentSelector); // eslint-disable-line return null; } } /** * Nest headings array into nested arrays with 'children' property. * @param {Array} headingsArray * @return {Object} */ function nestHeadingsArray(headingsArray) { return reduce.call(headingsArray, function reducer(prev, curr) { var currentHeading = getHeadingObject(curr); if (currentHeading) { addNode(currentHeading, prev.nest); } return prev; }, { nest: [] }); } return { nestHeadingsArray: nestHeadingsArray, selectHeadings: selectHeadings }; }; /***/ }), /* 28 */ /***/ (function(module, exports) { // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* eslint no-undef: "off" */ /* eslint semi: "off" */ // ----------------------------------------------------------------------------- module.exports = function updateTocScroll(options) { var toc = document.querySelector(options.tocSelector); if (toc && toc.scrollHeight > toc.clientHeight) { var activeItem = toc.querySelector('.' + options.activeListItemClass); if (activeItem) { toc.scrollTop = activeItem.offsetTop; } } }; /***/ }), /* 29 */ /***/ (function(module, exports) { /* # ----------------------------------------------------------------------------- # ~/js/tocbot/scroll-smooth/index.js # Scroll-Smooth (Tocbot v4.12.0) implementation for J1 template # # Product/Info: # https://jekyll.one # https://tscanlin.github.io/tocbot # https://github.com/tscanlin/tocbot # # Copyright (C) 2021 Juergen Adams # Copyright (C) 2016 Tim Scanlin # # J1 Template is licensed under MIT License. # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE # Tocbot is licensed under the MIT License. # For details, https://github.com/tscanlin/tocbot/blob/master/LICENSE # ----------------------------------------------------------------------------- */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint no-redeclare: "off" */ /* eslint no-undef: "off" */ /* eslint no-empty: "off" */ /* eslint semi: "off" */ // ----------------------------------------------------------------------------- /* globals location, requestAnimationFrame */ exports.initSmoothScrolling = initSmoothScrolling; function initSmoothScrolling(options) { if (isCssSmoothSCrollSupported()) {} var duration = options.duration; var offset = options.offset; var pageUrl = location.hash ? stripHash(location.href) : location.href; delegatedLinkHijacking(); function delegatedLinkHijacking() { document.body.addEventListener('click', onClick, false); function onClick(e) { if (!isInPageLink(e.target) || e.target.className.indexOf('no-smooth-scroll') > -1 || e.target.href.charAt(e.target.href.length - 2) === '#' && e.target.href.charAt(e.target.href.length - 1) === '!' || e.target.className.indexOf(options.linkClass) === -1) { return; } // Don't prevent default or hash doesn't change. // e.preventDefault() jump(e.target.hash, { duration: duration, offset: offset, callback: function callback() { setFocus(e.target.hash); } }); } } function isInPageLink(n) { return n.tagName.toLowerCase() === 'a' && (n.hash.length > 0 || n.href.charAt(n.href.length - 1) === '#') && (stripHash(n.href) === pageUrl || stripHash(n.href) + '#' === pageUrl); } function stripHash(url) { return url.slice(0, url.lastIndexOf('#')); } function isCssSmoothSCrollSupported() { return 'scrollBehavior' in document.documentElement.style; } // Adapted from: // https://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/ function setFocus(hash) { var element = document.getElementById(hash.substring(1)); if (element) { if (!/^(?:a|select|input|button|textarea)$/i.test(element.tagName)) { element.tabIndex = -1; } element.focus(); } } } function jump(target, options) { var start = window.pageYOffset; var opt = { duration: options.duration, offset: options.offset || 0, callback: options.callback, easing: options.easing || easeInOutQuad }; // This makes ids that start with a number work: ('[id="' + decodeURI(target).split('#').join('') + '"]') // DecodeURI for nonASCII hashes, they was encoded, but id was not encoded, it lead to not finding the tgt element by id. // And this is for IE: document.body.scrollTop var tgt = document.querySelector('[id="' + decodeURI(target).split('#').join('') + '"]'); var distance = typeof target === 'string' ? opt.offset + (target ? tgt && tgt.getBoundingClientRect().top || 0 // handle non-existent links better. : -(document.documentElement.scrollTop || document.body.scrollTop)) : target; var duration = typeof opt.duration === 'function' ? opt.duration(distance) : opt.duration; var timeStart; var timeElapsed; requestAnimationFrame(function (time) { timeStart = time; loop(time); }); function loop(time) { timeElapsed = time - timeStart; window.scrollTo(0, opt.easing(timeElapsed, start, distance, duration)); if (timeElapsed < duration) { requestAnimationFrame(loop); } else { end(); } } function end() { window.scrollTo(0, start + distance); if (typeof opt.callback === 'function') { opt.callback(); } } // Robert Penner's easeInOutQuad - http://robertpenner.com/easing/ function easeInOutQuad(t, b, c, d) { t /= d / 2; if (t < 1) return c / 2 * t * t + b; t--; return -c / 2 * (t * (t - 2) - 1) + b; } } /***/ }), /* 30 */ /***/ (function(module, exports) { function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } /* A simple jQuery function that can add listeners on attribute change. http://meetselva.github.io/attrchange/ About License: Copyright (C) 2013-2014 Selvakumar Arumugam You may use attrchange plugin under the terms of the MIT Licese. https://github.com/meetselva/attrchange/blob/master/MIT-License.txt */ ; (function ($) { function isDOMAttrModifiedSupported() { var p = document.createElement('p'); var flag = false; if (p.addEventListener) { p.addEventListener('DOMAttrModified', function () { flag = true; }, false); } else if (p.attachEvent) { p.attachEvent('onDOMAttrModified', function () { flag = true; }); } else { return false; } p.setAttribute('id', 'target'); return flag; } function checkAttributes(chkAttr, e) { if (chkAttr) { var attributes = this.data('attr-old-value'); if (e.attributeName.indexOf('style') >= 0) { if (!attributes['style']) attributes['style'] = {}; //initialize var keys = e.attributeName.split('.'); e.attributeName = keys[0]; e.oldValue = attributes['style'][keys[1]]; //old value e.newValue = keys[1] + ':' + this.prop("style")[$.camelCase(keys[1])]; //new value attributes['style'][keys[1]] = e.newValue; } else { e.oldValue = attributes[e.attributeName]; e.newValue = this.attr(e.attributeName); attributes[e.attributeName] = e.newValue; } this.data('attr-old-value', attributes); //update the old value object } } //initialize Mutation Observer var MutationObserver = window.MutationObserver || window.WebKitMutationObserver; $.fn.attrchange = function (a, b) { if (_typeof(a) == 'object') { //core var cfg = { trackValues: false, callback: $.noop }; //backward compatibility if (typeof a === "function") { cfg.callback = a; } else { $.extend(cfg, a); } if (cfg.trackValues) { //get attributes old value this.each(function (i, el) { var attributes = {}; for (var attr, i = 0, attrs = el.attributes, l = attrs.length; i < l; i++) { attr = attrs.item(i); attributes[attr.nodeName] = attr.value; } $(this).data('attr-old-value', attributes); }); } if (MutationObserver) { //Modern Browsers supporting MutationObserver var mOptions = { subtree: false, attributes: true, attributeOldValue: cfg.trackValues }; var observer = new MutationObserver(function (mutations) { mutations.forEach(function (e) { var _this = e.target; //get new value if trackValues is true if (cfg.trackValues) { e.newValue = $(_this).attr(e.attributeName); } if ($(_this).data('attrchange-status') === 'connected') { //execute if connected cfg.callback.call(_this, e); } }); }); return this.data('attrchange-method', 'Mutation Observer').data('attrchange-status', 'connected').data('attrchange-obs', observer).each(function () { observer.observe(this, mOptions); }); } else if (isDOMAttrModifiedSupported()) { //Opera //Good old Mutation Events return this.data('attrchange-method', 'DOMAttrModified').data('attrchange-status', 'connected').on('DOMAttrModified', function (event) { if (event.originalEvent) { event = event.originalEvent; } //jQuery normalization is not required event.attributeName = event.attrName; //property names to be consistent with MutationObserver event.oldValue = event.prevValue; //property names to be consistent with MutationObserver if ($(this).data('attrchange-status') === 'connected') { //disconnected logically cfg.callback.call(this, event); } }); } else if ('onpropertychange' in document.body) { //works only in IE return this.data('attrchange-method', 'propertychange').data('attrchange-status', 'connected').on('propertychange', function (e) { e.attributeName = window.event.propertyName; //to set the attr old value checkAttributes.call($(this), cfg.trackValues, e); if ($(this).data('attrchange-status') === 'connected') { //disconnected logically cfg.callback.call(this, e); } }); } return this; } else if (typeof a == 'string' && $.fn.attrchange.hasOwnProperty('extensions') && $.fn.attrchange['extensions'].hasOwnProperty(a)) { //extensions/options return $.fn.attrchange['extensions'][a].call(this, b); } }; $.fn.attrchange.extensions = { /*attrchange option/extension*/ disconnect: function disconnect(o) { if (typeof o !== 'undefined' && o.isPhysicalDisconnect) { return this.each(function () { var attrchangeMethod = $(this).data('attrchange-method'); if (attrchangeMethod == 'propertychange' || attrchangeMethod == 'DOMAttrModified') { $(this).off(attrchangeMethod); } else if (attrchangeMethod == 'Mutation Observer') { $(this).data('attrchange-obs').disconnect(); } else if (attrchangeMethod == 'polling') { clearInterval($(this).data('attrchange-polling-timer')); } }).removeData(['attrchange-method', 'attrchange-status']); } else { //logical disconnect return this.data('attrchange-status', 'disconnected'); //set a flag that prevents triggering callback onattrchange } }, remove: function remove(o) { return $.fn.attrchange.extensions['disconnect'].call(this, { isPhysicalDisconnect: true }); }, getProperties: function getProperties(o) { var attrchangeMethod = $(this).data('attrchange-method'); var pollInterval = $(this).data('attrchange-pollInterval'); return { method: attrchangeMethod, isPolling: attrchangeMethod == 'polling', pollingInterval: typeof pollInterval === 'undefined' ? 0 : parseInt(pollInterval, 10), status: typeof attrchangeMethod === 'undefined' ? 'removed' : $(this).data('attrchange-status') }; }, reconnect: function reconnect(o) { //reconnect possible only when there is a logical disconnect return this.data('attrchange-status', 'connected'); }, polling: function polling(o) { if (o.hasOwnProperty('isComputedStyle') && o.isComputedStyle == 'true') { /* extensive and slow - polling to check on computed style properties */ return this.each(function (i, _this) { if (!o.hasOwnProperty('properties') || Object.prototype.toString.call(o.properties) !== '[object Array]' || o.properties.length == 0) { return false; } //return if no properties found var attributes = {}; //store computed properties for (var i = 0; i < o.properties.length; i++) { attributes[o.properties[i]] = $(this).css(o.properties[i]); } var _this = this; $(this).data('attrchange-polling-timer', setInterval(function () { var changes = {}, hasChanges = false; // attrName: { oldValue: xxx, newValue: yyy} for (var comuptedVal, i = 0; i < o.properties.length; i++) { comuptedVal = $(_this).css(o.properties[i]); if (attributes[o.properties[i]] !== comuptedVal) { hasChanges = true; changes[o.properties[i]] = { oldValue: attributes[o.properties[i]], newValue: comuptedVal }; attributes[o.properties[i]] = comuptedVal; //add the attribute to the orig } } if (hasChanges && $(_this).data('attrchange-status') === 'connected') { //disconnected logically o.callback.call(_this, changes); } }, o.pollInterval ? o.pollInterval : 1000)).data('attrchange-method', 'polling').data('attrchange-pollInterval', o.pollInterval).data('attrchange-status', 'connected'); }); } else { return this.each(function (i, _this) { /* this one is programmatic polling */ var attributes = {}; for (var attr, i = 0, attrs = _this.attributes, l = attrs.length; i < l; i++) { attr = attrs.item(i); attributes[attr.nodeName] = attr.nodeValue; } $(_this).data('attrchange-polling-timer', setInterval(function () { var changes = {}, hasChanges = false; // attrName: { oldValue: xxx, newValue: yyy} for (var attr, i = 0, attrs = _this.attributes, l = attrs.length; i < l; i++) { attr = attrs.item(i); if (attributes.hasOwnProperty(attr.nodeName) && attributes[attr.nodeName] != attr.nodeValue) { //check the values changes[attr.nodeName] = { oldValue: attributes[attr.nodeName], newValue: attr.nodeValue }; hasChanges = true; } else if (!attributes.hasOwnProperty(attr.nodeName)) { //new attribute changes[attr.nodeName] = { oldValue: '', newValue: attr.nodeValue }; hasChanges = true; } attributes[attr.nodeName] = attr.nodeValue; //add the attribute to the orig } if (hasChanges && $(_this).data('attrchange-status') === 'connected') { //disconnected logically o.callback.call(_this, changes); } }, o.pollInterval ? o.pollInterval : 1000)).data('attrchange-method', 'polling').data('attrchange-pollInterval', o.pollInterval).data('attrchange-status', 'connected'); }); } } }; })(jQuery); /***/ }), /* 31 */ /***/ (function(module, exports) { /* # ----------------------------------------------------------------------------- # ~/js/adoc_result_viewer/view_results.js # Provides JavaScript functions displaying results for Asciidoctor # example block # # Product/Info: # https://jekyll.one # # Copyright (C) 2021 Juergen Adams # # J1 Template is licensed under MIT License. # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE # ----------------------------------------------------------------------------- # TODO: Improve lanuage settings # TODO: Improve auto-hide functionality for the results block # ----------------------------------------------------------------------------- */ // ----------------------------------------------------------------------------- // ESLint shimming // ----------------------------------------------------------------------------- /* eslint indent: "off" */ /* global $ */ // ----------------------------------------------------------------------------- var timeoutHandle; // var language = 'de'; var language = document.documentElement.lang; function toggle_result_block(result_block) { window.clearTimeout(timeoutHandle); // Clear the timeout object result_block.prev().toggleClass('stacked'); result_block.toggle(); // jadams: Improve auto-hide functionality for the results block // // timeoutHandle = window.setTimeout(function () { // result_block.hide(); // }, 5000); } function insert_result_links() { $('.result').each(function (idx, node) { var view_result_link; var result_block = $(node); var title_div = result_block.prev().find('.title'); if (language == 'en') { view_result_link = $('
    View
    '); } else if (language == 'de') { view_result_link = $('
    Anzeige
    '); } else { view_result_link = $('
    View
    '); } title_div.append(view_result_link); view_result_link.on('click', function (event) { event.preventDefault(); toggle_result_block(result_block); }); }); } $(insert_result_links); /***/ }) /******/ ]);