From 8934ee6e1bdcb3271b85c335ca5dd02857278419 Mon Sep 17 00:00:00 2001 From: eight Date: Mon, 19 Nov 2018 16:13:40 +0800 Subject: [PATCH] Add: polyfill to support chrome 49 --- background/background-worker.js | 2 ++ edit.html | 1 + edit/editor-worker.js | 1 + install-usercss.html | 1 + js/polyfill.js | 6 ++++++ manage.html | 1 + manifest.json | 3 ++- options.html | 1 + popup.html | 1 + 9 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 js/polyfill.js diff --git a/background/background-worker.js b/background/background-worker.js index 366b7b3c..81387aac 100644 --- a/background/background-worker.js +++ b/background/background-worker.js @@ -12,6 +12,7 @@ createAPI({ compileUsercss, parseUsercssMeta(text, indexOffset = 0) { loadScript( + '/js/polyfill.js', '/vendor/usercss-meta/usercss-meta.min.js', '/vendor-overwrites/colorpicker/colorconverter.js', '/js/meta-parser.js' @@ -20,6 +21,7 @@ createAPI({ }, nullifyInvalidVars(vars) { loadScript( + '/js/polyfill.js', '/vendor/usercss-meta/usercss-meta.min.js', '/vendor-overwrites/colorpicker/colorconverter.js', '/js/meta-parser.js' diff --git a/edit.html b/edit.html index c064d89f..81423113 100644 --- a/edit.html +++ b/edit.html @@ -62,6 +62,7 @@ + diff --git a/edit/editor-worker.js b/edit/editor-worker.js index 62ef380c..6ef51eef 100644 --- a/edit/editor-worker.js +++ b/edit/editor-worker.js @@ -16,6 +16,7 @@ createAPI({ }, metalint: code => { loadScript( + '/js/polyfill.js', '/vendor/usercss-meta/usercss-meta.min.js', '/vendor-overwrites/colorpicker/colorconverter.js', '/js/meta-parser.js' diff --git a/install-usercss.html b/install-usercss.html index 00e71cb8..84eb5b26 100644 --- a/install-usercss.html +++ b/install-usercss.html @@ -9,6 +9,7 @@ + diff --git a/js/polyfill.js b/js/polyfill.js new file mode 100644 index 00000000..d2b63a37 --- /dev/null +++ b/js/polyfill.js @@ -0,0 +1,6 @@ +if (!Object.entries) { + Object.entries = obj => Object.keys(obj).map(k => [k, obj[k]]); +} +if (!Object.values) { + Object.values = obj => Object.keys(obj).map(k => obj[k]); +} diff --git a/manage.html b/manage.html index dcf3edaa..7754f573 100644 --- a/manage.html +++ b/manage.html @@ -146,6 +146,7 @@ + diff --git a/manifest.json b/manifest.json index 11489478..2fe717f0 100644 --- a/manifest.json +++ b/manifest.json @@ -24,6 +24,7 @@ ], "background": { "scripts": [ + "js/polyfill.js", "js/promisify.js", "js/messaging.js", "js/msg.js", @@ -62,7 +63,7 @@ "run_at": "document_start", "all_frames": true, "match_about_blank": true, - "js": ["js/promisify.js", "js/msg.js", "js/prefs.js", "content/apply.js"] + "js": ["js/polyfill.js", "js/promisify.js", "js/msg.js", "js/prefs.js", "content/apply.js"] }, { "matches": ["http://userstyles.org/*", "https://userstyles.org/*"], diff --git a/options.html b/options.html index 996ca894..d20834b5 100644 --- a/options.html +++ b/options.html @@ -19,6 +19,7 @@ } + diff --git a/popup.html b/popup.html index 93eadd4e..35c51cba 100644 --- a/popup.html +++ b/popup.html @@ -151,6 +151,7 @@ +