Browse Source

Update to avoid using cloud and a couple minor tweaks, refs #590

Jordi Boggiano 8 years ago
parent
commit
12f2b5006d

+ 1 - 0
src/Packagist/WebBundle/Resources/public/css/main.css

@@ -39,6 +39,7 @@ pre, code {
 pre {
   border-left: 2px solid #2d2d32;
 }
+code.hljs { display: inline; }
 
 label {
   display: block;

+ 15 - 12
src/Packagist/WebBundle/Resources/views/Package/viewPackage.html.twig

@@ -11,8 +11,8 @@
 {% endblock %}
 
 {% block head_additions %}
-    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/styles/monokai_sublime.min.css">
-    <script type="text/javascript">
+    <link rel="stylesheet" href="{{ asset('libs/highlightjs-9.6.0/styles/monokai_sublime.min.css') }}">
+    <script>
       WebFontConfig = {
         google: { families: [ 'Source+Code+Pro::latin' ] }
       };
@@ -24,8 +24,14 @@
         var s = document.getElementsByTagName('script')[0];
         s.parentNode.insertBefore(wf, s);
       })();
-      function highlight_code()
-      {
+    </script>
+{% endblock %}
+
+{% block scripts %}
+    <script src="{{ asset('bundles/packagistweb/js/view.js')}}"></script>
+
+    <script>
+      function highlight_code() {
         if (typeof (Worker) === undefined) return false;
 
         var workerFunction = new Blob(['(' + highlight_code_worker_function.toString() + ')()'], {type: "text/javascript"});
@@ -38,22 +44,19 @@
           worker.postMessage(code.text()); // start worker
         });
       }
-      function highlight_code_worker_function()
-      {
+
+      function highlight_code_worker_function() {
         onmessage = function(event) {
-          importScripts('https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/highlight.min.js');
+          importScripts({{ app.request.getSchemeAndHttpHost()|json_encode|raw }} + '/libs/highlightjs-9.6.0/highlight.min.js');
           self.hljs.configure({tabReplace:4});
           var result = self.hljs.highlightAuto(event.data);
           postMessage(result.value);
           close(); // close worker
         }
       }
-      $(window).on('load', highlight_code);
-    </script>
-{% endblock %}
 
-{% block scripts %}
-    <script src="{{ asset('bundles/packagistweb/js/view.js')}}"></script>
+      highlight_code();
+    </script>
 {% endblock %}
 
 {% block description -%}

File diff suppressed because it is too large
+ 1 - 0
web/libs/highlightjs-9.6.0/highlight.min.js


File diff suppressed because it is too large
+ 0 - 0
web/libs/highlightjs-9.6.0/styles/monokai_sublime.min.css


Some files were not shown because too many files changed in this diff