changeset 44:822ff5800f20

More updates
author nanaya <me@nanaya.pro>
date Thu, 24 Aug 2017 19:49:24 +0900
parents f52f5727818f
children 5536da666361
files cuffs-hulotte-popup.user.js
diffstat 1 files changed, 9 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/cuffs-hulotte-popup.user.js	Thu Aug 24 04:11:29 2017 +0900
+++ b/cuffs-hulotte-popup.user.js	Thu Aug 24 19:49:24 2017 +0900
@@ -1,7 +1,7 @@
 // ==UserScript==
 // @name         Cuffs/Hulotte tuning
 // @namespace    https://myconan.net
-// @version      1.0.8
+// @version      1.0.9
 // @description  Strip out Cuffs/Hulotte age confirmation popup, disables lightbox
 // @author       nanaya
 // @match        http://www.cuffs.co.jp/*
@@ -15,25 +15,22 @@
     "use strict";
 
     var $ = jQuery;
-    var rules = '';
+    var rules = [];
+    var i;
+    var styleEl;
 
     if (document.querySelector('#load_bg') != null) {
-        rules += ' #load_bg { display: none !important; } ';
+        rules.push('#load_bg { display: none !important; }');
     }
 
     if (document.querySelector('body > #mainContent') != null) {
-        rules += ' body > :not(#mainContent) { display: none !important; } ';
+        rules.push('body > :not(#mainContent) { display: none !important; }');
     }
 
-    if (rules !== '') {
-        var styleEl = document.createElement('style');
+    for (i = 0; i < rules.length; i++) {
+        styleEl = document.createElement('style');
         document.head.appendChild(styleEl);
-        var styleSheet = styleEl.sheet;
-
-        styleSheet.insertRule(
-            rules,
-            styleSheet.cssRules.length
-        );
+        styleEl.sheet.insertRule(rules[i], 0);
     }
 
     $(function () {