From bfbcc54c2f93a7d7a52c1897f7a711c02e6454b0 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 13 Nov 2017 11:51:22 -0500 Subject: data/resources/prism: Rename * source files to *in --- diff --git a/data/resources/prism/components/prism-clike.js b/data/resources/prism/components/prism-clike.jsin index c0b8ff5..c0b8ff5 100644 --- a/data/resources/prism/components/prism-clike.js +++ b/data/resources/prism/components/prism-clike.jsin diff --git a/data/resources/prism/components/prism-core.js b/data/resources/prism/components/prism-core.jsin index f34bcae..408af8d 100644 --- a/data/resources/prism/components/prism-core.js +++ b/data/resources/prism/components/prism-core.jsin @@ -20,6 +20,7 @@ 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) { @@ -184,11 +185,13 @@ var _ = _self.Prism = { // Set language on the element, if not present element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language; - // Set language on the parent, for styling - parent = element.parentNode; + 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; + if (/pre/i.test(parent.nodeName)) { + parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language; + } } var code = element.textContent; @@ -479,18 +482,21 @@ if (!_self.document) { // in Node.js return _self.Prism; } - // 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); + + 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; } diff --git a/data/resources/prism/components/prism-css.js b/data/resources/prism/components/prism-css.jsin index 6a2f7d3..6a2f7d3 100644 --- a/data/resources/prism/components/prism-css.js +++ b/data/resources/prism/components/prism-css.jsin diff --git a/data/resources/prism/components/prism-javascript.js b/data/resources/prism/components/prism-javascript.jsin index a1488ae..a1488ae 100644 --- a/data/resources/prism/components/prism-javascript.js +++ b/data/resources/prism/components/prism-javascript.jsin diff --git a/data/resources/prism/components/prism-markup.js b/data/resources/prism/components/prism-markup.jsin index 1dafd24..1dafd24 100644 --- a/data/resources/prism/components/prism-markup.js +++ b/data/resources/prism/components/prism-markup.jsin diff --git a/data/resources/prism/plugins/data-uri-highlight/prism-data-uri-highlight.js b/data/resources/prism/plugins/data-uri-highlight/prism-data-uri-highlight.jsin index 7ff8d1f..7ff8d1f 100644 --- a/data/resources/prism/plugins/data-uri-highlight/prism-data-uri-highlight.js +++ b/data/resources/prism/plugins/data-uri-highlight/prism-data-uri-highlight.jsin diff --git a/data/resources/prism/plugins/line-numbers/prism-line-numbers.css b/data/resources/prism/plugins/line-numbers/prism-line-numbers.cssin index d5cbfd3..d5cbfd3 100644 --- a/data/resources/prism/plugins/line-numbers/prism-line-numbers.css +++ b/data/resources/prism/plugins/line-numbers/prism-line-numbers.cssin diff --git a/data/resources/prism/plugins/line-numbers/prism-line-numbers.js b/data/resources/prism/plugins/line-numbers/prism-line-numbers.jsin index dea8e3a..dea8e3a 100644 --- a/data/resources/prism/plugins/line-numbers/prism-line-numbers.js +++ b/data/resources/prism/plugins/line-numbers/prism-line-numbers.jsin diff --git a/data/resources/prism/themes/prism.css b/data/resources/prism/themes/prism.cssin index 83ef295..83ef295 100644 --- a/data/resources/prism/themes/prism.css +++ b/data/resources/prism/themes/prism.cssin -- cgit v0.9.1