mirror of
https://github.com/restoreddev/phpapprentice.git
synced 2025-10-24 19:36:04 +02:00
1103 lines
30 KiB
JavaScript
1103 lines
30 KiB
JavaScript
/******/ (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, {
|
||
/******/ configurable: false,
|
||
/******/ enumerable: true,
|
||
/******/ get: getter
|
||
/******/ });
|
||
/******/ }
|
||
/******/ };
|
||
/******/
|
||
/******/ // 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 = "/";
|
||
/******/
|
||
/******/ // Load entry module and return exports
|
||
/******/ return __webpack_require__(__webpack_require__.s = "./assets/js/site.js");
|
||
/******/ })
|
||
/************************************************************************/
|
||
/******/ ({
|
||
|
||
/***/ "./assets/js/site.js":
|
||
/*!***************************!*\
|
||
!*** ./assets/js/site.js ***!
|
||
\***************************/
|
||
/*! no exports provided */
|
||
/*! all exports used */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_prismjs_components_prism_core__ = __webpack_require__(/*! prismjs/components/prism-core */ "./node_modules/prismjs/components/prism-core.js");
|
||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_prismjs_components_prism_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_prismjs_components_prism_core__);
|
||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_prismjs_components_prism_clike__ = __webpack_require__(/*! prismjs/components/prism-clike */ "./node_modules/prismjs/components/prism-clike.js");
|
||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_prismjs_components_prism_clike___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_prismjs_components_prism_clike__);
|
||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_prismjs_components_prism_markup__ = __webpack_require__(/*! prismjs/components/prism-markup */ "./node_modules/prismjs/components/prism-markup.js");
|
||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_prismjs_components_prism_markup___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_prismjs_components_prism_markup__);
|
||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_prismjs_components_prism_markup_templating__ = __webpack_require__(/*! prismjs/components/prism-markup-templating */ "./node_modules/prismjs/components/prism-markup-templating.js");
|
||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_prismjs_components_prism_markup_templating___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_prismjs_components_prism_markup_templating__);
|
||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_prismjs_components_prism_php__ = __webpack_require__(/*! prismjs/components/prism-php */ "./node_modules/prismjs/components/prism-php.js");
|
||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_prismjs_components_prism_php___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_prismjs_components_prism_php__);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
var onLoad = function onLoad() {
|
||
__WEBPACK_IMPORTED_MODULE_0_prismjs_components_prism_core___default.a.highlightAll();
|
||
|
||
var menuButton = document.querySelector('.menu-button');
|
||
|
||
// stop execution if menu button does not exist on page
|
||
if (!menuButton) {
|
||
return;
|
||
}
|
||
|
||
var modalButton = document.querySelector('.modal-button');
|
||
var modal = document.querySelector('.modal');
|
||
var modalContent = document.querySelector('.modal-content');
|
||
var clickEvent = function clickEvent(e) {
|
||
var modal = document.querySelector('.modal');
|
||
|
||
if (modal.classList.contains('closed')) {
|
||
modal.classList.remove('closed');
|
||
} else {
|
||
modal.classList.add('closed');
|
||
}
|
||
};
|
||
|
||
menuButton.addEventListener('click', clickEvent);
|
||
modalButton.addEventListener('click', clickEvent);
|
||
modal.addEventListener('click', function (e) {
|
||
var target = e.target;
|
||
do {
|
||
if (target == modalContent) {
|
||
return;
|
||
}
|
||
target = target.parentNode;
|
||
} while (target);
|
||
|
||
modal.classList.add('closed');
|
||
});
|
||
};
|
||
|
||
document.onkeydown = function (e) {
|
||
e = e || window.event;
|
||
|
||
var isEscape = false;
|
||
if ("key" in e) {
|
||
isEscape = e.key == "Escape" || e.key == "Esc";
|
||
} else {
|
||
isEscape = e.keyCode == 27;
|
||
}
|
||
|
||
if (isEscape) {
|
||
var modal = document.querySelector('.modal');
|
||
if (modal && !modal.classList.contains('closed')) {
|
||
modal.classList.add('closed');
|
||
}
|
||
}
|
||
};
|
||
|
||
if (document.readyState !== 'loading') {
|
||
onLoad();
|
||
} else {
|
||
document.addEventListener('DOMContentLoaded', onLoad);
|
||
}
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/prismjs/components/prism-clike.js":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/prismjs/components/prism-clike.js ***!
|
||
\********************************************************/
|
||
/*! dynamic exports provided */
|
||
/***/ (function(module, exports) {
|
||
|
||
Prism.languages.clike = {
|
||
'comment': [
|
||
{
|
||
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
|
||
lookbehind: true
|
||
},
|
||
{
|
||
pattern: /(^|[^\\:])\/\/.*/,
|
||
lookbehind: true,
|
||
greedy: true
|
||
}
|
||
],
|
||
'string': {
|
||
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
|
||
greedy: true
|
||
},
|
||
'class-name': {
|
||
pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,
|
||
lookbehind: true,
|
||
inside: {
|
||
punctuation: /[.\\]/
|
||
}
|
||
},
|
||
'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
|
||
'boolean': /\b(?:true|false)\b/,
|
||
'function': /[a-z0-9_]+(?=\()/i,
|
||
'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,
|
||
'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,
|
||
'punctuation': /[{}[\];(),.:]/
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/prismjs/components/prism-core.js":
|
||
/*!*******************************************************!*\
|
||
!*** ./node_modules/prismjs/components/prism-core.js ***!
|
||
\*******************************************************/
|
||
/*! dynamic exports provided */
|
||
/*! exports used: default */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/* WEBPACK VAR INJECTION */(function(global) {var _self = (typeof window !== 'undefined')
|
||
? window // if in browser
|
||
: (
|
||
(typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
|
||
? self // if in worker
|
||
: {} // if in node js
|
||
);
|
||
|
||
/**
|
||
* Prism: Lightweight, robust, elegant syntax highlighting
|
||
* MIT license http://www.opensource.org/licenses/mit-license.php/
|
||
* @author Lea Verou http://lea.verou.me
|
||
*/
|
||
|
||
var Prism = (function(){
|
||
|
||
// Private helper vars
|
||
var lang = /\blang(?:uage)?-([\w-]+)\b/i;
|
||
var uniqueId = 0;
|
||
|
||
var _ = _self.Prism = {
|
||
manual: _self.Prism && _self.Prism.manual,
|
||
disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
|
||
util: {
|
||
encode: function (tokens) {
|
||
if (tokens instanceof Token) {
|
||
return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);
|
||
} else if (_.util.type(tokens) === 'Array') {
|
||
return tokens.map(_.util.encode);
|
||
} else {
|
||
return tokens.replace(/&/g, '&').replace(/</g, '<').replace(/\u00a0/g, ' ');
|
||
}
|
||
},
|
||
|
||
type: function (o) {
|
||
return Object.prototype.toString.call(o).match(/\[object (\w+)\]/)[1];
|
||
},
|
||
|
||
objId: function (obj) {
|
||
if (!obj['__id']) {
|
||
Object.defineProperty(obj, '__id', { value: ++uniqueId });
|
||
}
|
||
return obj['__id'];
|
||
},
|
||
|
||
// Deep clone a language definition (e.g. to extend it)
|
||
clone: function (o, visited) {
|
||
var type = _.util.type(o);
|
||
visited = visited || {};
|
||
|
||
switch (type) {
|
||
case 'Object':
|
||
if (visited[_.util.objId(o)]) {
|
||
return visited[_.util.objId(o)];
|
||
}
|
||
var clone = {};
|
||
visited[_.util.objId(o)] = clone;
|
||
|
||
for (var key in o) {
|
||
if (o.hasOwnProperty(key)) {
|
||
clone[key] = _.util.clone(o[key], visited);
|
||
}
|
||
}
|
||
|
||
return clone;
|
||
|
||
case 'Array':
|
||
if (visited[_.util.objId(o)]) {
|
||
return visited[_.util.objId(o)];
|
||
}
|
||
var clone = [];
|
||
visited[_.util.objId(o)] = clone;
|
||
|
||
o.forEach(function (v, i) {
|
||
clone[i] = _.util.clone(v, visited);
|
||
});
|
||
|
||
return clone;
|
||
}
|
||
|
||
return o;
|
||
}
|
||
},
|
||
|
||
languages: {
|
||
extend: function (id, redef) {
|
||
var lang = _.util.clone(_.languages[id]);
|
||
|
||
for (var key in redef) {
|
||
lang[key] = redef[key];
|
||
}
|
||
|
||
return lang;
|
||
},
|
||
|
||
/**
|
||
* Insert a token before another token in a language literal
|
||
* As this needs to recreate the object (we cannot actually insert before keys in object literals),
|
||
* we cannot just provide an object, we need anobject and a key.
|
||
* @param inside The key (or language id) of the parent
|
||
* @param before The key to insert before. If not provided, the function appends instead.
|
||
* @param insert Object with the key/value pairs to insert
|
||
* @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted.
|
||
*/
|
||
insertBefore: function (inside, before, insert, root) {
|
||
root = root || _.languages;
|
||
var grammar = root[inside];
|
||
|
||
if (arguments.length == 2) {
|
||
insert = arguments[1];
|
||
|
||
for (var newToken in insert) {
|
||
if (insert.hasOwnProperty(newToken)) {
|
||
grammar[newToken] = insert[newToken];
|
||
}
|
||
}
|
||
|
||
return grammar;
|
||
}
|
||
|
||
var ret = {};
|
||
|
||
for (var token in grammar) {
|
||
|
||
if (grammar.hasOwnProperty(token)) {
|
||
|
||
if (token == before) {
|
||
|
||
for (var newToken in insert) {
|
||
|
||
if (insert.hasOwnProperty(newToken)) {
|
||
ret[newToken] = insert[newToken];
|
||
}
|
||
}
|
||
}
|
||
|
||
ret[token] = grammar[token];
|
||
}
|
||
}
|
||
|
||
// Update references in other language definitions
|
||
_.languages.DFS(_.languages, function(key, value) {
|
||
if (value === root[inside] && key != inside) {
|
||
this[key] = ret;
|
||
}
|
||
});
|
||
|
||
return root[inside] = ret;
|
||
},
|
||
|
||
// Traverse a language definition with Depth First Search
|
||
DFS: function(o, callback, type, visited) {
|
||
visited = visited || {};
|
||
for (var i in o) {
|
||
if (o.hasOwnProperty(i)) {
|
||
callback.call(o, i, o[i], type || i);
|
||
|
||
if (_.util.type(o[i]) === 'Object' && !visited[_.util.objId(o[i])]) {
|
||
visited[_.util.objId(o[i])] = true;
|
||
_.languages.DFS(o[i], callback, null, visited);
|
||
}
|
||
else if (_.util.type(o[i]) === 'Array' && !visited[_.util.objId(o[i])]) {
|
||
visited[_.util.objId(o[i])] = true;
|
||
_.languages.DFS(o[i], callback, i, visited);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
plugins: {},
|
||
|
||
highlightAll: function(async, callback) {
|
||
_.highlightAllUnder(document, async, callback);
|
||
},
|
||
|
||
highlightAllUnder: function(container, async, callback) {
|
||
var env = {
|
||
callback: callback,
|
||
selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
|
||
};
|
||
|
||
_.hooks.run("before-highlightall", env);
|
||
|
||
var elements = env.elements || container.querySelectorAll(env.selector);
|
||
|
||
for (var i=0, element; element = elements[i++];) {
|
||
_.highlightElement(element, async === true, env.callback);
|
||
}
|
||
},
|
||
|
||
highlightElement: function(element, async, callback) {
|
||
// Find language
|
||
var language, grammar, parent = element;
|
||
|
||
while (parent && !lang.test(parent.className)) {
|
||
parent = parent.parentNode;
|
||
}
|
||
|
||
if (parent) {
|
||
language = (parent.className.match(lang) || [,''])[1].toLowerCase();
|
||
grammar = _.languages[language];
|
||
}
|
||
|
||
// Set language on the element, if not present
|
||
element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
|
||
|
||
if (element.parentNode) {
|
||
// Set language on the parent, for styling
|
||
parent = element.parentNode;
|
||
|
||
if (/pre/i.test(parent.nodeName)) {
|
||
parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
|
||
}
|
||
}
|
||
|
||
var code = element.textContent;
|
||
|
||
var env = {
|
||
element: element,
|
||
language: language,
|
||
grammar: grammar,
|
||
code: code
|
||
};
|
||
|
||
_.hooks.run('before-sanity-check', env);
|
||
|
||
if (!env.code || !env.grammar) {
|
||
if (env.code) {
|
||
_.hooks.run('before-highlight', env);
|
||
env.element.textContent = env.code;
|
||
_.hooks.run('after-highlight', env);
|
||
}
|
||
_.hooks.run('complete', env);
|
||
return;
|
||
}
|
||
|
||
_.hooks.run('before-highlight', env);
|
||
|
||
if (async && _self.Worker) {
|
||
var worker = new Worker(_.filename);
|
||
|
||
worker.onmessage = function(evt) {
|
||
env.highlightedCode = evt.data;
|
||
|
||
_.hooks.run('before-insert', env);
|
||
|
||
env.element.innerHTML = env.highlightedCode;
|
||
|
||
callback && callback.call(env.element);
|
||
_.hooks.run('after-highlight', env);
|
||
_.hooks.run('complete', env);
|
||
};
|
||
|
||
worker.postMessage(JSON.stringify({
|
||
language: env.language,
|
||
code: env.code,
|
||
immediateClose: true
|
||
}));
|
||
}
|
||
else {
|
||
env.highlightedCode = _.highlight(env.code, env.grammar, env.language);
|
||
|
||
_.hooks.run('before-insert', env);
|
||
|
||
env.element.innerHTML = env.highlightedCode;
|
||
|
||
callback && callback.call(element);
|
||
|
||
_.hooks.run('after-highlight', env);
|
||
_.hooks.run('complete', env);
|
||
}
|
||
},
|
||
|
||
highlight: function (text, grammar, language) {
|
||
var env = {
|
||
code: text,
|
||
grammar: grammar,
|
||
language: language
|
||
};
|
||
_.hooks.run('before-tokenize', env);
|
||
env.tokens = _.tokenize(env.code, env.grammar);
|
||
_.hooks.run('after-tokenize', env);
|
||
return Token.stringify(_.util.encode(env.tokens), env.language);
|
||
},
|
||
|
||
matchGrammar: function (text, strarr, grammar, index, startPos, oneshot, target) {
|
||
var Token = _.Token;
|
||
|
||
for (var token in grammar) {
|
||
if(!grammar.hasOwnProperty(token) || !grammar[token]) {
|
||
continue;
|
||
}
|
||
|
||
if (token == target) {
|
||
return;
|
||
}
|
||
|
||
var patterns = grammar[token];
|
||
patterns = (_.util.type(patterns) === "Array") ? patterns : [patterns];
|
||
|
||
for (var j = 0; j < patterns.length; ++j) {
|
||
var pattern = patterns[j],
|
||
inside = pattern.inside,
|
||
lookbehind = !!pattern.lookbehind,
|
||
greedy = !!pattern.greedy,
|
||
lookbehindLength = 0,
|
||
alias = pattern.alias;
|
||
|
||
if (greedy && !pattern.pattern.global) {
|
||
// Without the global flag, lastIndex won't work
|
||
var flags = pattern.pattern.toString().match(/[imuy]*$/)[0];
|
||
pattern.pattern = RegExp(pattern.pattern.source, flags + "g");
|
||
}
|
||
|
||
pattern = pattern.pattern || pattern;
|
||
|
||
// Don’t cache length as it changes during the loop
|
||
for (var i = index, pos = startPos; i < strarr.length; pos += strarr[i].length, ++i) {
|
||
|
||
var str = strarr[i];
|
||
|
||
if (strarr.length > text.length) {
|
||
// Something went terribly wrong, ABORT, ABORT!
|
||
return;
|
||
}
|
||
|
||
if (str instanceof Token) {
|
||
continue;
|
||
}
|
||
|
||
if (greedy && i != strarr.length - 1) {
|
||
pattern.lastIndex = pos;
|
||
var match = pattern.exec(text);
|
||
if (!match) {
|
||
break;
|
||
}
|
||
|
||
var from = match.index + (lookbehind ? match[1].length : 0),
|
||
to = match.index + match[0].length,
|
||
k = i,
|
||
p = pos;
|
||
|
||
for (var len = strarr.length; k < len && (p < to || (!strarr[k].type && !strarr[k - 1].greedy)); ++k) {
|
||
p += strarr[k].length;
|
||
// Move the index i to the element in strarr that is closest to from
|
||
if (from >= p) {
|
||
++i;
|
||
pos = p;
|
||
}
|
||
}
|
||
|
||
// If strarr[i] is a Token, then the match starts inside another Token, which is invalid
|
||
if (strarr[i] instanceof Token) {
|
||
continue;
|
||
}
|
||
|
||
// Number of tokens to delete and replace with the new match
|
||
delNum = k - i;
|
||
str = text.slice(pos, p);
|
||
match.index -= pos;
|
||
} else {
|
||
pattern.lastIndex = 0;
|
||
|
||
var match = pattern.exec(str),
|
||
delNum = 1;
|
||
}
|
||
|
||
if (!match) {
|
||
if (oneshot) {
|
||
break;
|
||
}
|
||
|
||
continue;
|
||
}
|
||
|
||
if(lookbehind) {
|
||
lookbehindLength = match[1] ? match[1].length : 0;
|
||
}
|
||
|
||
var from = match.index + lookbehindLength,
|
||
match = match[0].slice(lookbehindLength),
|
||
to = from + match.length,
|
||
before = str.slice(0, from),
|
||
after = str.slice(to);
|
||
|
||
var args = [i, delNum];
|
||
|
||
if (before) {
|
||
++i;
|
||
pos += before.length;
|
||
args.push(before);
|
||
}
|
||
|
||
var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias, match, greedy);
|
||
|
||
args.push(wrapped);
|
||
|
||
if (after) {
|
||
args.push(after);
|
||
}
|
||
|
||
Array.prototype.splice.apply(strarr, args);
|
||
|
||
if (delNum != 1)
|
||
_.matchGrammar(text, strarr, grammar, i, pos, true, token);
|
||
|
||
if (oneshot)
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
},
|
||
|
||
tokenize: function(text, grammar, language) {
|
||
var strarr = [text];
|
||
|
||
var rest = grammar.rest;
|
||
|
||
if (rest) {
|
||
for (var token in rest) {
|
||
grammar[token] = rest[token];
|
||
}
|
||
|
||
delete grammar.rest;
|
||
}
|
||
|
||
_.matchGrammar(text, strarr, grammar, 0, 0, false);
|
||
|
||
return strarr;
|
||
},
|
||
|
||
hooks: {
|
||
all: {},
|
||
|
||
add: function (name, callback) {
|
||
var hooks = _.hooks.all;
|
||
|
||
hooks[name] = hooks[name] || [];
|
||
|
||
hooks[name].push(callback);
|
||
},
|
||
|
||
run: function (name, env) {
|
||
var callbacks = _.hooks.all[name];
|
||
|
||
if (!callbacks || !callbacks.length) {
|
||
return;
|
||
}
|
||
|
||
for (var i=0, callback; callback = callbacks[i++];) {
|
||
callback(env);
|
||
}
|
||
}
|
||
}
|
||
};
|
||
|
||
var Token = _.Token = function(type, content, alias, matchedStr, greedy) {
|
||
this.type = type;
|
||
this.content = content;
|
||
this.alias = alias;
|
||
// Copy of the full string this token was created from
|
||
this.length = (matchedStr || "").length|0;
|
||
this.greedy = !!greedy;
|
||
};
|
||
|
||
Token.stringify = function(o, language, parent) {
|
||
if (typeof o == 'string') {
|
||
return o;
|
||
}
|
||
|
||
if (_.util.type(o) === 'Array') {
|
||
return o.map(function(element) {
|
||
return Token.stringify(element, language, o);
|
||
}).join('');
|
||
}
|
||
|
||
var env = {
|
||
type: o.type,
|
||
content: Token.stringify(o.content, language, parent),
|
||
tag: 'span',
|
||
classes: ['token', o.type],
|
||
attributes: {},
|
||
language: language,
|
||
parent: parent
|
||
};
|
||
|
||
if (o.alias) {
|
||
var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias];
|
||
Array.prototype.push.apply(env.classes, aliases);
|
||
}
|
||
|
||
_.hooks.run('wrap', env);
|
||
|
||
var attributes = Object.keys(env.attributes).map(function(name) {
|
||
return name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"';
|
||
}).join(' ');
|
||
|
||
return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + '</' + env.tag + '>';
|
||
|
||
};
|
||
|
||
if (!_self.document) {
|
||
if (!_self.addEventListener) {
|
||
// in Node.js
|
||
return _self.Prism;
|
||
}
|
||
|
||
if (!_.disableWorkerMessageHandler) {
|
||
// In worker
|
||
_self.addEventListener('message', function (evt) {
|
||
var message = JSON.parse(evt.data),
|
||
lang = message.language,
|
||
code = message.code,
|
||
immediateClose = message.immediateClose;
|
||
|
||
_self.postMessage(_.highlight(code, _.languages[lang], lang));
|
||
if (immediateClose) {
|
||
_self.close();
|
||
}
|
||
}, false);
|
||
}
|
||
|
||
return _self.Prism;
|
||
}
|
||
|
||
//Get current script and highlight
|
||
var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop();
|
||
|
||
if (script) {
|
||
_.filename = script.src;
|
||
|
||
if (!_.manual && !script.hasAttribute('data-manual')) {
|
||
if(document.readyState !== "loading") {
|
||
if (window.requestAnimationFrame) {
|
||
window.requestAnimationFrame(_.highlightAll);
|
||
} else {
|
||
window.setTimeout(_.highlightAll, 16);
|
||
}
|
||
}
|
||
else {
|
||
document.addEventListener('DOMContentLoaded', _.highlightAll);
|
||
}
|
||
}
|
||
}
|
||
|
||
return _self.Prism;
|
||
|
||
})();
|
||
|
||
if (typeof module !== 'undefined' && module.exports) {
|
||
module.exports = Prism;
|
||
}
|
||
|
||
// hack for components to work correctly in node.js
|
||
if (typeof global !== 'undefined') {
|
||
global.Prism = Prism;
|
||
}
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/prismjs/components/prism-markup-templating.js":
|
||
/*!********************************************************************!*\
|
||
!*** ./node_modules/prismjs/components/prism-markup-templating.js ***!
|
||
\********************************************************************/
|
||
/*! dynamic exports provided */
|
||
/***/ (function(module, exports) {
|
||
|
||
Prism.languages['markup-templating'] = {};
|
||
|
||
Object.defineProperties(Prism.languages['markup-templating'], {
|
||
buildPlaceholders: {
|
||
// Tokenize all inline templating expressions matching placeholderPattern
|
||
// If the replaceFilter function is provided, it will be called with every match.
|
||
// If it returns false, the match will not be replaced.
|
||
value: function (env, language, placeholderPattern, replaceFilter) {
|
||
if (env.language !== language) {
|
||
return;
|
||
}
|
||
|
||
env.tokenStack = [];
|
||
|
||
env.code = env.code.replace(placeholderPattern, function(match) {
|
||
if (typeof replaceFilter === 'function' && !replaceFilter(match)) {
|
||
return match;
|
||
}
|
||
var i = env.tokenStack.length;
|
||
// Check for existing strings
|
||
while (env.code.indexOf('___' + language.toUpperCase() + i + '___') !== -1)
|
||
++i;
|
||
|
||
// Create a sparse array
|
||
env.tokenStack[i] = match;
|
||
|
||
return '___' + language.toUpperCase() + i + '___';
|
||
});
|
||
|
||
// Switch the grammar to markup
|
||
env.grammar = Prism.languages.markup;
|
||
}
|
||
},
|
||
tokenizePlaceholders: {
|
||
// Replace placeholders with proper tokens after tokenizing
|
||
value: function (env, language) {
|
||
if (env.language !== language || !env.tokenStack) {
|
||
return;
|
||
}
|
||
|
||
// Switch the grammar back
|
||
env.grammar = Prism.languages[language];
|
||
|
||
var j = 0;
|
||
var keys = Object.keys(env.tokenStack);
|
||
var walkTokens = function (tokens) {
|
||
if (j >= keys.length) {
|
||
return;
|
||
}
|
||
for (var i = 0; i < tokens.length; i++) {
|
||
var token = tokens[i];
|
||
if (typeof token === 'string' || (token.content && typeof token.content === 'string')) {
|
||
var k = keys[j];
|
||
var t = env.tokenStack[k];
|
||
var s = typeof token === 'string' ? token : token.content;
|
||
|
||
var index = s.indexOf('___' + language.toUpperCase() + k + '___');
|
||
if (index > -1) {
|
||
++j;
|
||
var before = s.substring(0, index);
|
||
var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar, language), 'language-' + language, t);
|
||
var after = s.substring(index + ('___' + language.toUpperCase() + k + '___').length);
|
||
var replacement;
|
||
if (before || after) {
|
||
replacement = [before, middle, after].filter(function (v) { return !!v; });
|
||
walkTokens(replacement);
|
||
} else {
|
||
replacement = middle;
|
||
}
|
||
if (typeof token === 'string') {
|
||
Array.prototype.splice.apply(tokens, [i, 1].concat(replacement));
|
||
} else {
|
||
token.content = replacement;
|
||
}
|
||
|
||
if (j >= keys.length) {
|
||
break;
|
||
}
|
||
}
|
||
} else if (token.content && typeof token.content !== 'string') {
|
||
walkTokens(token.content);
|
||
}
|
||
}
|
||
};
|
||
|
||
walkTokens(env.tokens);
|
||
}
|
||
}
|
||
});
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/prismjs/components/prism-markup.js":
|
||
/*!*********************************************************!*\
|
||
!*** ./node_modules/prismjs/components/prism-markup.js ***!
|
||
\*********************************************************/
|
||
/*! dynamic exports provided */
|
||
/***/ (function(module, exports) {
|
||
|
||
Prism.languages.markup = {
|
||
'comment': /<!--[\s\S]*?-->/,
|
||
'prolog': /<\?[\s\S]+?\?>/,
|
||
'doctype': /<!DOCTYPE[\s\S]+?>/i,
|
||
'cdata': /<!\[CDATA\[[\s\S]*?]]>/i,
|
||
'tag': {
|
||
pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,
|
||
greedy: true,
|
||
inside: {
|
||
'tag': {
|
||
pattern: /^<\/?[^\s>\/]+/i,
|
||
inside: {
|
||
'punctuation': /^<\/?/,
|
||
'namespace': /^[^\s>\/:]+:/
|
||
}
|
||
},
|
||
'attr-value': {
|
||
pattern: /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,
|
||
inside: {
|
||
'punctuation': [
|
||
/^=/,
|
||
{
|
||
pattern: /(^|[^\\])["']/,
|
||
lookbehind: true
|
||
}
|
||
]
|
||
}
|
||
},
|
||
'punctuation': /\/?>/,
|
||
'attr-name': {
|
||
pattern: /[^\s>\/]+/,
|
||
inside: {
|
||
'namespace': /^[^\s>\/:]+:/
|
||
}
|
||
}
|
||
|
||
}
|
||
},
|
||
'entity': /&#?[\da-z]{1,8};/i
|
||
};
|
||
|
||
Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
|
||
Prism.languages.markup['entity'];
|
||
|
||
// Plugin to make entity title show the real entity, idea by Roman Komarov
|
||
Prism.hooks.add('wrap', function(env) {
|
||
|
||
if (env.type === 'entity') {
|
||
env.attributes['title'] = env.content.replace(/&/, '&');
|
||
}
|
||
});
|
||
|
||
Prism.languages.xml = Prism.languages.markup;
|
||
Prism.languages.html = Prism.languages.markup;
|
||
Prism.languages.mathml = Prism.languages.markup;
|
||
Prism.languages.svg = Prism.languages.markup;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/prismjs/components/prism-php.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/prismjs/components/prism-php.js ***!
|
||
\******************************************************/
|
||
/*! dynamic exports provided */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Original by Aaron Harun: http://aahacreative.com/2012/07/31/php-syntax-highlighting-prism/
|
||
* Modified by Miles Johnson: http://milesj.me
|
||
*
|
||
* Supports the following:
|
||
* - Extends clike syntax
|
||
* - Support for PHP 5.3+ (namespaces, traits, generators, etc)
|
||
* - Smarter constant and function matching
|
||
*
|
||
* Adds the following new token classes:
|
||
* constant, delimiter, variable, function, package
|
||
*/
|
||
(function (Prism) {
|
||
Prism.languages.php = Prism.languages.extend('clike', {
|
||
'keyword': /\b(?:and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,
|
||
'constant': /\b[A-Z0-9_]{2,}\b/,
|
||
'comment': {
|
||
pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
|
||
lookbehind: true
|
||
}
|
||
});
|
||
|
||
Prism.languages.insertBefore('php', 'string', {
|
||
'shell-comment': {
|
||
pattern: /(^|[^\\])#.*/,
|
||
lookbehind: true,
|
||
alias: 'comment'
|
||
}
|
||
});
|
||
|
||
Prism.languages.insertBefore('php', 'keyword', {
|
||
'delimiter': {
|
||
pattern: /\?>|<\?(?:php|=)?/i,
|
||
alias: 'important'
|
||
},
|
||
'variable': /\$+(?:\w+\b|(?={))/i,
|
||
'package': {
|
||
pattern: /(\\|namespace\s+|use\s+)[\w\\]+/,
|
||
lookbehind: true,
|
||
inside: {
|
||
punctuation: /\\/
|
||
}
|
||
}
|
||
});
|
||
|
||
// Must be defined after the function pattern
|
||
Prism.languages.insertBefore('php', 'operator', {
|
||
'property': {
|
||
pattern: /(->)[\w]+/,
|
||
lookbehind: true
|
||
}
|
||
});
|
||
|
||
Prism.languages.insertBefore('php', 'string', {
|
||
'nowdoc-string': {
|
||
pattern: /<<<'([^']+)'(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;/,
|
||
greedy: true,
|
||
alias: 'string',
|
||
inside: {
|
||
'delimiter': {
|
||
pattern: /^<<<'[^']+'|[a-z_]\w*;$/i,
|
||
alias: 'symbol',
|
||
inside: {
|
||
'punctuation': /^<<<'?|[';]$/
|
||
}
|
||
}
|
||
}
|
||
},
|
||
'heredoc-string': {
|
||
pattern: /<<<(?:"([^"]+)"(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;|([a-z_]\w*)(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\2;)/i,
|
||
greedy: true,
|
||
alias: 'string',
|
||
inside: {
|
||
'delimiter': {
|
||
pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,
|
||
alias: 'symbol',
|
||
inside: {
|
||
'punctuation': /^<<<"?|[";]$/
|
||
}
|
||
},
|
||
'interpolation': null // See below
|
||
}
|
||
},
|
||
'single-quoted-string': {
|
||
pattern: /'(?:\\[\s\S]|[^\\'])*'/,
|
||
greedy: true,
|
||
alias: 'string'
|
||
},
|
||
'double-quoted-string': {
|
||
pattern: /"(?:\\[\s\S]|[^\\"])*"/,
|
||
greedy: true,
|
||
alias: 'string',
|
||
inside: {
|
||
'interpolation': null // See below
|
||
}
|
||
}
|
||
});
|
||
// The different types of PHP strings "replace" the C-like standard string
|
||
delete Prism.languages.php['string'];
|
||
|
||
var string_interpolation = {
|
||
pattern: /{\$(?:{(?:{[^{}]+}|[^{}]+)}|[^{}])+}|(^|[^\\{])\$+(?:\w+(?:\[.+?]|->\w+)*)/,
|
||
lookbehind: true,
|
||
inside: {
|
||
rest: Prism.languages.php
|
||
}
|
||
};
|
||
Prism.languages.php['heredoc-string'].inside['interpolation'] = string_interpolation;
|
||
Prism.languages.php['double-quoted-string'].inside['interpolation'] = string_interpolation;
|
||
|
||
Prism.hooks.add('before-tokenize', function(env) {
|
||
if (!/(?:<\?php|<\?)/ig.test(env.code)) {
|
||
return;
|
||
}
|
||
|
||
var phpPattern = /(?:<\?php|<\?)[\s\S]*?(?:\?>|$)/ig;
|
||
Prism.languages['markup-templating'].buildPlaceholders(env, 'php', phpPattern);
|
||
});
|
||
|
||
Prism.hooks.add('after-tokenize', function(env) {
|
||
Prism.languages['markup-templating'].tokenizePlaceholders(env, 'php');
|
||
});
|
||
|
||
}(Prism));
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/webpack/buildin/global.js":
|
||
/*!***********************************!*\
|
||
!*** (webpack)/buildin/global.js ***!
|
||
\***********************************/
|
||
/*! dynamic exports provided */
|
||
/*! all exports used */
|
||
/***/ (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 || Function("return this")() || (1,eval)("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;
|
||
|
||
|
||
/***/ })
|
||
|
||
/******/ }); |