Deduplicate list of GM functions used.

This commit is contained in:
ccd0 2015-11-01 01:23:48 -08:00
parent 9c2ceacfde
commit 4756015a88
3 changed files with 26 additions and 22 deletions

View File

@ -297,21 +297,18 @@ module.exports = (grunt) ->
'-W084': true '-W084': true
'-W083': true '-W083': true
'-W093': true '-W093': true
globals: globals: do ->
Notification: true globals =
MediaError: true Notification: true
Set: true MediaError: true
GM_getValue: true Set: true
GM_setValue: true GM_info: true
GM_deleteValue: true cloneInto: true
GM_listValues: true unsafeWindow: true
GM_addValueChangeListener: true chrome: true
GM_openInTab: true pkg = grunt.file.readJSON 'package.json'
GM_xmlhttpRequest: true globals[v] = true for v in pkg.meta.grants
GM_info: true globals
cloneInto: true
unsafeWindow: true
chrome: true
script: 'tmp-<%= pkg.type %>/*.js' script: 'tmp-<%= pkg.type %>/*.js'
require('load-grunt-tasks') grunt require('load-grunt-tasks') grunt

View File

@ -30,6 +30,15 @@
"https://www.google.com/recaptcha/api2/frame?*&k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc*", "https://www.google.com/recaptcha/api2/frame?*&k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc*",
"*://www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc*" "*://www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc*"
], ],
"grants": [
"GM_getValue",
"GM_setValue",
"GM_deleteValue",
"GM_listValues",
"GM_addValueChangeListener",
"GM_openInTab",
"GM_xmlhttpRequest"
],
"suffix": { "suffix": {
"stable": "", "stable": "",
"beta": "-beta", "beta": "-beta",

View File

@ -18,13 +18,11 @@
} }
}).join('\n') }).join('\n')
%> %>
// @grant GM_getValue <%=
// @grant GM_setValue meta.grants.map(function(grant) {
// @grant GM_deleteValue return '// @grant ' + grant;
// @grant GM_listValues }).join('\n')
// @grant GM_addValueChangeListener %>
// @grant GM_openInTab
// @grant GM_xmlhttpRequest
// @run-at document-start // @run-at document-start
<% if (channel !== 'dev') { %>// @updateURL <%= (channel !== 'noupdate') ? (meta.downloads + name + meta.suffix[channel] + '.meta.js') : 'https://noupdate.invalid/' %> <% if (channel !== 'dev') { %>// @updateURL <%= (channel !== 'noupdate') ? (meta.downloads + name + meta.suffix[channel] + '.meta.js') : 'https://noupdate.invalid/' %>
// @downloadURL <%= (channel !== 'noupdate') ? (meta.downloads + name + meta.suffix[channel] + '.user.js') : 'https://noupdate.invalid/' %> // @downloadURL <%= (channel !== 'noupdate') ? (meta.downloads + name + meta.suffix[channel] + '.user.js') : 'https://noupdate.invalid/' %>