Browse Source

Syntax highlight plugin fix

Achilleas Koutsou 5 years ago
parent
commit
45600eef36
3 changed files with 1 additions and 20 deletions
  1. BIN
      public/img/gogs-hero.png
  2. 1 15
      public/js/gogs.js
  3. 0 5
      public/plugins/highlighter.js

BIN
public/img/gogs-hero.png


+ 1 - 15
public/js/gogs.js

@@ -1281,21 +1281,7 @@ $(document).ready(function () {
 
     // Highlight JS
     if (typeof hljs != 'undefined') {
-        if (typeof(Worker) !== "undefined") {
-            addEventListener('load', function () {
-                var code = document.querySelector('code');
-                var worker = new Worker('/plugins/highlighter.js');
-                worker.onmessage = function (event) {
-                    code.innerHTML = event.data;
-                }
-                if (code !== null) {
-                    worker.postMessage(code.textContent);
-                }
-            })
-        } else {
-            hljs.initHighlightingOnLoad()
-        }
-
+        hljs.initHighlightingOnLoad();
     }
 
     // Dropzone

+ 0 - 5
public/plugins/highlighter.js

@@ -1,5 +0,0 @@
-onmessage = function (event) {
-	importScripts('/plugins/highlight-9.6.0/highlight.pack.js');
-	var result = self.hljs.highlightAuto(event.data);
-	postMessage(result.value);
-}