Sfoglia il codice sorgente

fix: separate required scripts with `;` in a new line

fix violentmonkey/violentmonkey#78
Gerald 9 anni fa
parent
commit
9f02fceb2a
1 ha cambiato i file con 5 aggiunte e 1 eliminazioni
  1. 5 1
      src/injected.js

+ 5 - 1
src/injected.js

@@ -603,7 +603,11 @@ var comm = {
       ];
       ];
       comm.forEach(require, function (key) {
       comm.forEach(require, function (key) {
         var script = data.require[key];
         var script = data.require[key];
-        script && code.push(script + ';');
+        if (script) {
+          code.push(script);
+          // Add `;` to a new line in case script ends with comment lines
+          code.push(';');
+        }
       });
       });
       // wrap code to make 'use strict' work
       // wrap code to make 'use strict' work
       code.push('!function(){' + script.code + '\n}.call(this)');
       code.push('!function(){' + script.code + '\n}.call(this)');