eslint comma-dangle error + autofix files
This commit is contained in:
parent
5a9451f267
commit
414609297d
|
@ -19,7 +19,7 @@ rules:
|
||||||
brace-style: [2, 1tbs, {allowSingleLine: false}]
|
brace-style: [2, 1tbs, {allowSingleLine: false}]
|
||||||
camelcase: [2, {properties: never}]
|
camelcase: [2, {properties: never}]
|
||||||
class-methods-use-this: [2]
|
class-methods-use-this: [2]
|
||||||
comma-dangle: [1, {arrays: always-multiline, objects: always-multiline}]
|
comma-dangle: [2, {arrays: always-multiline, objects: always-multiline}]
|
||||||
comma-spacing: [2, {before: false, after: true}]
|
comma-spacing: [2, {before: false, after: true}]
|
||||||
comma-style: [2, last]
|
comma-style: [2, last]
|
||||||
complexity: [0]
|
complexity: [0]
|
||||||
|
|
|
@ -25,7 +25,7 @@ workerUtil.createAPI({
|
||||||
'/js/meta-parser.js'
|
'/js/meta-parser.js'
|
||||||
);
|
);
|
||||||
return metaParser.nullifyInvalidVars(vars);
|
return metaParser.nullifyInvalidVars(vars);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function compileUsercss(preprocessor, code, vars) {
|
function compileUsercss(preprocessor, code, vars) {
|
||||||
|
@ -55,7 +55,7 @@ function compileUsercss(preprocessor, code, vars) {
|
||||||
const va = vars[key];
|
const va = vars[key];
|
||||||
output[key] = Object.assign({}, va, {
|
output[key] = Object.assign({}, va, {
|
||||||
value: va.value === null || va.value === undefined ?
|
value: va.value === null || va.value === undefined ?
|
||||||
getVarValue(va, 'default') : getVarValue(va, 'value')
|
getVarValue(va, 'default') : getVarValue(va, 'value'),
|
||||||
});
|
});
|
||||||
return output;
|
return output;
|
||||||
}, {});
|
}, {});
|
||||||
|
@ -86,7 +86,7 @@ function getUsercssCompiler(preprocessor) {
|
||||||
section.code = varDef + section.code;
|
section.code = varDef + section.code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
stylus: {
|
stylus: {
|
||||||
preprocess(source, vars) {
|
preprocess(source, vars) {
|
||||||
|
@ -96,7 +96,7 @@ function getUsercssCompiler(preprocessor) {
|
||||||
new self.StylusRenderer(varDef + source)
|
new self.StylusRenderer(varDef + source)
|
||||||
.render((err, output) => err ? reject(err) : resolve(output));
|
.render((err, output) => err ? reject(err) : resolve(output));
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
less: {
|
less: {
|
||||||
preprocess(source, vars) {
|
preprocess(source, vars) {
|
||||||
|
@ -110,7 +110,7 @@ function getUsercssCompiler(preprocessor) {
|
||||||
const varDefs = Object.keys(vars).map(key => `@${key}:${vars[key].value};\n`).join('');
|
const varDefs = Object.keys(vars).map(key => `@${key}:${vars[key].value};\n`).join('');
|
||||||
return self.less.render(varDefs + source)
|
return self.less.render(varDefs + source)
|
||||||
.then(({css}) => css);
|
.then(({css}) => css);
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
uso: {
|
uso: {
|
||||||
preprocess(source, vars) {
|
preprocess(source, vars) {
|
||||||
|
@ -162,8 +162,8 @@ function getUsercssCompiler(preprocessor) {
|
||||||
return pool.get(name);
|
return pool.get(name);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (preprocessor) {
|
if (preprocessor) {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
// eslint-disable-next-line no-var
|
// eslint-disable-next-line no-var
|
||||||
var backgroundWorker = workerUtil.createWorker({
|
var backgroundWorker = workerUtil.createWorker({
|
||||||
url: '/background/background-worker.js'
|
url: '/background/background-worker.js',
|
||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line no-var
|
// eslint-disable-next-line no-var
|
||||||
|
@ -99,7 +99,7 @@ window.API_METHODS = Object.assign(window.API_METHODS || {}, {
|
||||||
getSyncStatus: sync.getStatus,
|
getSyncStatus: sync.getStatus,
|
||||||
syncLogin: sync.login,
|
syncLogin: sync.login,
|
||||||
|
|
||||||
openManage
|
openManage,
|
||||||
});
|
});
|
||||||
|
|
||||||
// *************************************************************************
|
// *************************************************************************
|
||||||
|
@ -119,7 +119,7 @@ if (FIREFOX) {
|
||||||
navigatorUtil.onDOMContentLoaded(webNavIframeHelperFF, {
|
navigatorUtil.onDOMContentLoaded(webNavIframeHelperFF, {
|
||||||
url: [
|
url: [
|
||||||
{urlEquals: 'about:blank'},
|
{urlEquals: 'about:blank'},
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ contextMenus = {
|
||||||
msg.sendTab(tab.id, {method: 'editDeleteText'}, undefined, 'extension')
|
msg.sendTab(tab.id, {method: 'editDeleteText'}, undefined, 'extension')
|
||||||
.catch(msg.ignoreError);
|
.catch(msg.ignoreError);
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
async function createContextMenus(ids) {
|
async function createContextMenus(ids) {
|
||||||
|
@ -321,14 +321,14 @@ function openManage({options = false, search} = {}) {
|
||||||
url,
|
url,
|
||||||
currentWindow: null,
|
currentWindow: null,
|
||||||
ignoreHash: true,
|
ignoreHash: true,
|
||||||
ignoreSearch: true
|
ignoreSearch: true,
|
||||||
})
|
})
|
||||||
.then(tab => {
|
.then(tab => {
|
||||||
if (tab) {
|
if (tab) {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
activateTab(tab),
|
activateTab(tab),
|
||||||
(tab.pendingUrl || tab.url) !== url && msg.sendTab(tab.id, {method: 'pushState', url})
|
(tab.pendingUrl || tab.url) !== url && msg.sendTab(tab.id, {method: 'pushState', url})
|
||||||
.catch(console.error)
|
.catch(console.error),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
return getActiveTab().then(tab => {
|
return getActiveTab().then(tab => {
|
||||||
|
|
|
@ -29,7 +29,7 @@ const contentScripts = (() => {
|
||||||
url: [
|
url: [
|
||||||
{hostEquals: 'greasyfork.org', urlMatches},
|
{hostEquals: 'greasyfork.org', urlMatches},
|
||||||
{hostEquals: 'sleazyfork.org', urlMatches},
|
{hostEquals: 'sleazyfork.org', urlMatches},
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
return {injectToTab, injectToAllTabs};
|
return {injectToTab, injectToAllTabs};
|
||||||
|
@ -57,7 +57,7 @@ const contentScripts = (() => {
|
||||||
const options = {
|
const options = {
|
||||||
runAt: script.run_at,
|
runAt: script.run_at,
|
||||||
allFrames: script.all_frames,
|
allFrames: script.all_frames,
|
||||||
matchAboutBlank: script.match_about_blank
|
matchAboutBlank: script.match_about_blank,
|
||||||
};
|
};
|
||||||
if (frameId !== null) {
|
if (frameId !== null) {
|
||||||
options.allFrames = false;
|
options.allFrames = false;
|
||||||
|
@ -80,7 +80,7 @@ const contentScripts = (() => {
|
||||||
} else {
|
} else {
|
||||||
injectToTab({
|
injectToTab({
|
||||||
url: tab.pendingUrl || tab.url,
|
url: tab.pendingUrl || tab.url,
|
||||||
tabId: tab.id
|
tabId: tab.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ function createChromeStorageDB() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return output;
|
return output;
|
||||||
})
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
return {exec};
|
return {exec};
|
||||||
|
|
|
@ -13,7 +13,7 @@ const iconManager = (() => {
|
||||||
], () => debounce(refreshIconBadgeColor));
|
], () => debounce(refreshIconBadgeColor));
|
||||||
|
|
||||||
prefs.subscribe([
|
prefs.subscribe([
|
||||||
'show-badge'
|
'show-badge',
|
||||||
], () => debounce(refreshAllIconsBadgeText));
|
], () => debounce(refreshAllIconsBadgeText));
|
||||||
|
|
||||||
prefs.subscribe([
|
prefs.subscribe([
|
||||||
|
@ -79,7 +79,7 @@ const iconManager = (() => {
|
||||||
tabManager.set(tabId, 'icon', newIcon);
|
tabManager.set(tabId, 'icon', newIcon);
|
||||||
iconUtil.setIcon({
|
iconUtil.setIcon({
|
||||||
path: getIconPath(newIcon),
|
path: getIconPath(newIcon),
|
||||||
tabId
|
tabId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,14 +103,14 @@ const iconManager = (() => {
|
||||||
|
|
||||||
function refreshGlobalIcon() {
|
function refreshGlobalIcon() {
|
||||||
iconUtil.setIcon({
|
iconUtil.setIcon({
|
||||||
path: getIconPath(getIconName())
|
path: getIconPath(getIconName()),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshIconBadgeColor() {
|
function refreshIconBadgeColor() {
|
||||||
const color = prefs.get(prefs.get('disableAll') ? 'badgeDisabled' : 'badgeNormal');
|
const color = prefs.get(prefs.get('disableAll') ? 'badgeDisabled' : 'badgeNormal');
|
||||||
iconUtil.setBadgeBackgroundColor({
|
iconUtil.setBadgeBackgroundColor({
|
||||||
color
|
color,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ const iconUtil = (() => {
|
||||||
Cache imageData for paths
|
Cache imageData for paths
|
||||||
*/
|
*/
|
||||||
setIcon,
|
setIcon,
|
||||||
setBadgeText
|
setBadgeText,
|
||||||
});
|
});
|
||||||
|
|
||||||
function loadImage(url) {
|
function loadImage(url) {
|
||||||
|
@ -85,7 +85,7 @@ const iconUtil = (() => {
|
||||||
return target[prop];
|
return target[prop];
|
||||||
}
|
}
|
||||||
return chrome.browserAction[prop].bind(chrome.browserAction);
|
return chrome.browserAction[prop].bind(chrome.browserAction);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
const navigatorUtil = (() => {
|
const navigatorUtil = (() => {
|
||||||
const handler = {
|
const handler = {
|
||||||
urlChange: null
|
urlChange: null,
|
||||||
};
|
};
|
||||||
return extendNative({onUrlChange});
|
return extendNative({onUrlChange});
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ const navigatorUtil = (() => {
|
||||||
return target[prop];
|
return target[prop];
|
||||||
}
|
}
|
||||||
return chrome.webNavigation[prop].addListener.bind(chrome.webNavigation[prop]);
|
return chrome.webNavigation[prop].addListener.bind(chrome.webNavigation[prop]);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -31,11 +31,11 @@
|
||||||
return fetch(api, {
|
return fetch(api, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: new Headers({
|
headers: new Headers({
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json',
|
||||||
}),
|
}),
|
||||||
body: query({
|
body: query({
|
||||||
id
|
id,
|
||||||
})
|
}),
|
||||||
})
|
})
|
||||||
.then(res => res.json());
|
.then(res => res.json());
|
||||||
};
|
};
|
||||||
|
|
|
@ -40,7 +40,7 @@ const styleManager = (() => {
|
||||||
style.appliesTo.delete(url);
|
style.appliesTo.delete(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const BAD_MATCHER = {test: () => false};
|
const BAD_MATCHER = {test: () => false};
|
||||||
|
@ -60,7 +60,7 @@ const styleManager = (() => {
|
||||||
protocol: '',
|
protocol: '',
|
||||||
search: '',
|
search: '',
|
||||||
searchParams: new URLSearchParams(),
|
searchParams: new URLSearchParams(),
|
||||||
username: ''
|
username: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const DELETE_IF_NULL = ['id', 'customName'];
|
const DELETE_IF_NULL = ['id', 'customName'];
|
||||||
|
@ -68,7 +68,7 @@ const styleManager = (() => {
|
||||||
handleLivePreviewConnections();
|
handleLivePreviewConnections();
|
||||||
|
|
||||||
return Object.assign(/** @namespace styleManager */{
|
return Object.assign(/** @namespace styleManager */{
|
||||||
compareRevision
|
compareRevision,
|
||||||
}, ensurePrepared(/** @namespace styleManager */{
|
}, ensurePrepared(/** @namespace styleManager */{
|
||||||
get,
|
get,
|
||||||
getByUUID,
|
getByUUID,
|
||||||
|
@ -88,7 +88,7 @@ const styleManager = (() => {
|
||||||
addExclusion,
|
addExclusion,
|
||||||
removeExclusion,
|
removeExclusion,
|
||||||
addInclusion,
|
addInclusion,
|
||||||
removeInclusion
|
removeInclusion,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function handleLivePreviewConnections() {
|
function handleLivePreviewConnections() {
|
||||||
|
@ -317,7 +317,7 @@ const styleManager = (() => {
|
||||||
uuidIndex.delete(style.data._id);
|
uuidIndex.delete(style.data._id);
|
||||||
return msg.broadcast({
|
return msg.broadcast({
|
||||||
method: 'styleDeleted',
|
method: 'styleDeleted',
|
||||||
style: {id}
|
style: {id},
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => id);
|
.then(() => id);
|
||||||
|
@ -348,7 +348,7 @@ const styleManager = (() => {
|
||||||
md5Url: null,
|
md5Url: null,
|
||||||
url: null,
|
url: null,
|
||||||
originalMd5: null,
|
originalMd5: null,
|
||||||
installDate: Date.now()
|
installDate: Date.now(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ const styleManager = (() => {
|
||||||
updated.add(url);
|
updated.add(url);
|
||||||
cache.sections[data.id] = {
|
cache.sections[data.id] = {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
code
|
code,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -379,10 +379,10 @@ const styleManager = (() => {
|
||||||
style: {
|
style: {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
md5Url: data.md5Url,
|
md5Url: data.md5Url,
|
||||||
enabled: data.enabled
|
enabled: data.enabled,
|
||||||
},
|
},
|
||||||
reason,
|
reason,
|
||||||
codeIsUpdated
|
codeIsUpdated,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,7 +425,7 @@ const styleManager = (() => {
|
||||||
if (!style) {
|
if (!style) {
|
||||||
styles.set(data.id, {
|
styles.set(data.id, {
|
||||||
appliesTo: new Set(),
|
appliesTo: new Set(),
|
||||||
data
|
data,
|
||||||
});
|
});
|
||||||
method = 'styleAdded';
|
method = 'styleAdded';
|
||||||
} else {
|
} else {
|
||||||
|
@ -473,7 +473,7 @@ const styleManager = (() => {
|
||||||
result.push({
|
result.push({
|
||||||
data: getStyleWithNoCode(data),
|
data: getStyleWithNoCode(data),
|
||||||
excluded,
|
excluded,
|
||||||
sloppy
|
sloppy,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -485,7 +485,7 @@ const styleManager = (() => {
|
||||||
if (!cache) {
|
if (!cache) {
|
||||||
cache = {
|
cache = {
|
||||||
sections: {},
|
sections: {},
|
||||||
maybeMatch: new Set()
|
maybeMatch: new Set(),
|
||||||
};
|
};
|
||||||
buildCache(styles.values());
|
buildCache(styles.values());
|
||||||
cachedStyleForUrl.set(url, cache);
|
cachedStyleForUrl.set(url, cache);
|
||||||
|
@ -511,7 +511,7 @@ const styleManager = (() => {
|
||||||
if (code) {
|
if (code) {
|
||||||
cache.sections[data.id] = {
|
cache.sections[data.id] = {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
code
|
code,
|
||||||
};
|
};
|
||||||
appliesTo.add(url);
|
appliesTo.add(url);
|
||||||
}
|
}
|
||||||
|
@ -536,7 +536,7 @@ const styleManager = (() => {
|
||||||
const ADD_MISSING_PROPS = {
|
const ADD_MISSING_PROPS = {
|
||||||
name: style => `ID: ${style.id}`,
|
name: style => `ID: ${style.id}`,
|
||||||
_id: () => uuidv4(),
|
_id: () => uuidv4(),
|
||||||
_rev: () => Date.now()
|
_rev: () => Date.now(),
|
||||||
};
|
};
|
||||||
|
|
||||||
return db.exec('getAll')
|
return db.exec('getAll')
|
||||||
|
@ -560,7 +560,7 @@ const styleManager = (() => {
|
||||||
fixUsoMd5Issue(style);
|
fixUsoMd5Issue(style);
|
||||||
styles.set(style.id, {
|
styles.set(style.id, {
|
||||||
appliesTo: new Set(),
|
appliesTo: new Set(),
|
||||||
data: style
|
data: style,
|
||||||
});
|
});
|
||||||
uuidIndex.set(style._id, style.id);
|
uuidIndex.set(style._id, style.id);
|
||||||
}
|
}
|
||||||
|
@ -706,7 +706,7 @@ const styleManager = (() => {
|
||||||
domain = u.hostname;
|
domain = u.hostname;
|
||||||
}
|
}
|
||||||
return domain;
|
return domain;
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ const sync = (() => {
|
||||||
progress: null,
|
progress: null,
|
||||||
currentDriveName: null,
|
currentDriveName: null,
|
||||||
errorMessage: null,
|
errorMessage: null,
|
||||||
login: false
|
login: false,
|
||||||
};
|
};
|
||||||
let currentDrive;
|
let currentDrive;
|
||||||
const ctrl = dbToCloud.dbToCloud({
|
const ctrl = dbToCloud.dbToCloud({
|
||||||
|
@ -43,7 +43,7 @@ const sync = (() => {
|
||||||
setState(drive, state) {
|
setState(drive, state) {
|
||||||
const key = `sync/state/${drive.name}`;
|
const key = `sync/state/${drive.name}`;
|
||||||
return chromeLocal.setValue(key, state);
|
return chromeLocal.setValue(key, state);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const initializing = prefs.initializing.then(() => {
|
const initializing = prefs.initializing.then(() => {
|
||||||
|
@ -58,7 +58,7 @@ const sync = (() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
return Object.assign({
|
return Object.assign({
|
||||||
getStatus: () => status
|
getStatus: () => status,
|
||||||
}, ensurePrepared({
|
}, ensurePrepared({
|
||||||
start,
|
start,
|
||||||
stop,
|
stop,
|
||||||
|
@ -73,7 +73,7 @@ const sync = (() => {
|
||||||
return ctrl.delete(...args);
|
return ctrl.delete(...args);
|
||||||
},
|
},
|
||||||
syncNow,
|
syncNow,
|
||||||
login
|
login,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function ensurePrepared(obj) {
|
function ensurePrepared(obj) {
|
||||||
|
@ -99,7 +99,7 @@ const sync = (() => {
|
||||||
function schedule(delay = SYNC_DELAY) {
|
function schedule(delay = SYNC_DELAY) {
|
||||||
chrome.alarms.create('syncNow', {
|
chrome.alarms.create('syncNow', {
|
||||||
delayInMinutes: delay,
|
delayInMinutes: delay,
|
||||||
periodInMinutes: SYNC_INTERVAL
|
periodInMinutes: SYNC_INTERVAL,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ const sync = (() => {
|
||||||
function getDrive(name) {
|
function getDrive(name) {
|
||||||
if (name === 'dropbox' || name === 'google' || name === 'onedrive') {
|
if (name === 'dropbox' || name === 'google' || name === 'onedrive') {
|
||||||
return dbToCloud.drive[name]({
|
return dbToCloud.drive[name]({
|
||||||
getAccessToken: () => tokenManager.getToken(name)
|
getAccessToken: () => tokenManager.getToken(name),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
throw new Error(`unknown cloud name: ${name}`);
|
throw new Error(`unknown cloud name: ${name}`);
|
||||||
|
|
|
@ -13,9 +13,9 @@ const tokenManager = (() => {
|
||||||
fetch('https://api.dropboxapi.com/2/auth/token/revoke', {
|
fetch('https://api.dropboxapi.com/2/auth/token/revoke', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': `Bearer ${token}`
|
'Authorization': `Bearer ${token}`,
|
||||||
}
|
},
|
||||||
})
|
}),
|
||||||
},
|
},
|
||||||
google: {
|
google: {
|
||||||
flow: 'code',
|
flow: 'code',
|
||||||
|
@ -27,14 +27,14 @@ const tokenManager = (() => {
|
||||||
// tokens for multiple machines.
|
// tokens for multiple machines.
|
||||||
// https://stackoverflow.com/q/18519185
|
// https://stackoverflow.com/q/18519185
|
||||||
access_type: 'offline',
|
access_type: 'offline',
|
||||||
prompt: 'consent'
|
prompt: 'consent',
|
||||||
},
|
},
|
||||||
tokenURL: 'https://oauth2.googleapis.com/token',
|
tokenURL: 'https://oauth2.googleapis.com/token',
|
||||||
scopes: ['https://www.googleapis.com/auth/drive.appdata'],
|
scopes: ['https://www.googleapis.com/auth/drive.appdata'],
|
||||||
revoke: token => {
|
revoke: token => {
|
||||||
const params = {token};
|
const params = {token};
|
||||||
return postQuery(`https://accounts.google.com/o/oauth2/revoke?${new URLSearchParams(params)}`);
|
return postQuery(`https://accounts.google.com/o/oauth2/revoke?${new URLSearchParams(params)}`);
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
onedrive: {
|
onedrive: {
|
||||||
flow: 'code',
|
flow: 'code',
|
||||||
|
@ -45,8 +45,8 @@ const tokenManager = (() => {
|
||||||
redirect_uri: FIREFOX ?
|
redirect_uri: FIREFOX ?
|
||||||
'https://clngdbkpkpeebahjckkjfobafhncgmne.chromiumapp.org/' :
|
'https://clngdbkpkpeebahjckkjfobafhncgmne.chromiumapp.org/' :
|
||||||
'https://' + location.hostname + '.chromiumapp.org/',
|
'https://' + location.hostname + '.chromiumapp.org/',
|
||||||
scopes: ['Files.ReadWrite.AppFolder', 'offline_access']
|
scopes: ['Files.ReadWrite.AppFolder', 'offline_access'],
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
const NETWORK_LATENCY = 30; // seconds
|
const NETWORK_LATENCY = 30; // seconds
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ const tokenManager = (() => {
|
||||||
client_id: provider.clientId,
|
client_id: provider.clientId,
|
||||||
refresh_token: obj[k.REFRESH],
|
refresh_token: obj[k.REFRESH],
|
||||||
grant_type: 'refresh_token',
|
grant_type: 'refresh_token',
|
||||||
scope: provider.scopes.join(' ')
|
scope: provider.scopes.join(' '),
|
||||||
};
|
};
|
||||||
if (provider.clientSecret) {
|
if (provider.clientSecret) {
|
||||||
body.client_secret = provider.clientSecret;
|
body.client_secret = provider.clientSecret;
|
||||||
|
@ -136,7 +136,7 @@ const tokenManager = (() => {
|
||||||
response_type: provider.flow,
|
response_type: provider.flow,
|
||||||
client_id: provider.clientId,
|
client_id: provider.clientId,
|
||||||
redirect_uri: provider.redirect_uri || chrome.identity.getRedirectURL(),
|
redirect_uri: provider.redirect_uri || chrome.identity.getRedirectURL(),
|
||||||
state
|
state,
|
||||||
};
|
};
|
||||||
if (provider.scopes) {
|
if (provider.scopes) {
|
||||||
query.scope = provider.scopes.join(' ');
|
query.scope = provider.scopes.join(' ');
|
||||||
|
@ -148,7 +148,7 @@ const tokenManager = (() => {
|
||||||
return webextLaunchWebAuthFlow({
|
return webextLaunchWebAuthFlow({
|
||||||
url,
|
url,
|
||||||
interactive,
|
interactive,
|
||||||
redirect_uri: query.redirect_uri
|
redirect_uri: query.redirect_uri,
|
||||||
})
|
})
|
||||||
.then(url => {
|
.then(url => {
|
||||||
const params = new URLSearchParams(
|
const params = new URLSearchParams(
|
||||||
|
@ -171,7 +171,7 @@ const tokenManager = (() => {
|
||||||
code,
|
code,
|
||||||
grant_type: 'authorization_code',
|
grant_type: 'authorization_code',
|
||||||
client_id: provider.clientId,
|
client_id: provider.clientId,
|
||||||
redirect_uri: query.redirect_uri
|
redirect_uri: query.redirect_uri,
|
||||||
};
|
};
|
||||||
if (provider.clientSecret) {
|
if (provider.clientSecret) {
|
||||||
body.client_secret = provider.clientSecret;
|
body.client_secret = provider.clientSecret;
|
||||||
|
@ -185,7 +185,7 @@ const tokenManager = (() => {
|
||||||
return chromeLocal.set({
|
return chromeLocal.set({
|
||||||
[k.TOKEN]: result.access_token,
|
[k.TOKEN]: result.access_token,
|
||||||
[k.EXPIRE]: result.expires_in ? Date.now() + (Number(result.expires_in) - NETWORK_LATENCY) * 1000 : undefined,
|
[k.EXPIRE]: result.expires_in ? Date.now() + (Number(result.expires_in) - NETWORK_LATENCY) * 1000 : undefined,
|
||||||
[k.REFRESH]: result.refresh_token
|
[k.REFRESH]: result.refresh_token,
|
||||||
})
|
})
|
||||||
.then(() => result.access_token);
|
.then(() => result.access_token);
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@ const tokenManager = (() => {
|
||||||
const options = {
|
const options = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
},
|
},
|
||||||
body: body ? new URLSearchParams(body) : null,
|
body: body ? new URLSearchParams(body) : null,
|
||||||
};
|
};
|
||||||
|
|
|
@ -61,7 +61,7 @@ const usercssHelper = (() => {
|
||||||
find(styleId ? {id: styleId} : style) : Promise.resolve();
|
find(styleId ? {id: styleId} : style) : Promise.resolve();
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
metaOnly ? style : doBuild(style, findDup),
|
metaOnly ? style : doBuild(style, findDup),
|
||||||
findDup
|
findDup,
|
||||||
]);
|
]);
|
||||||
})
|
})
|
||||||
.then(([style, dup]) => ({style, dup}));
|
.then(([style, dup]) => ({style, dup}));
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
const manifest = chrome.runtime.getManifest();
|
const manifest = chrome.runtime.getManifest();
|
||||||
const allowedOrigins = [
|
const allowedOrigins = [
|
||||||
'https://openusercss.org',
|
'https://openusercss.org',
|
||||||
'https://openusercss.com'
|
'https://openusercss.com',
|
||||||
];
|
];
|
||||||
|
|
||||||
const sendPostMessage = message => {
|
const sendPostMessage = message => {
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
const askHandshake = () => {
|
const askHandshake = () => {
|
||||||
// Tell the page that we exist and that it should send the handshake
|
// Tell the page that we exist and that it should send the handshake
|
||||||
sendPostMessage({
|
sendPostMessage({
|
||||||
type: 'ouc-begin-handshake'
|
type: 'ouc-begin-handshake',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
const sendInstalledCallback = styleData => {
|
const sendInstalledCallback = styleData => {
|
||||||
sendPostMessage({
|
sendPostMessage({
|
||||||
type: 'ouc-is-installed-response',
|
type: 'ouc-is-installed-response',
|
||||||
style: styleData
|
style: styleData,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,14 +36,14 @@
|
||||||
) {
|
) {
|
||||||
API.findUsercss({
|
API.findUsercss({
|
||||||
name: event.data.name,
|
name: event.data.name,
|
||||||
namespace: event.data.namespace
|
namespace: event.data.namespace,
|
||||||
}).then(style => {
|
}).then(style => {
|
||||||
const data = {event};
|
const data = {event};
|
||||||
const callbackObject = {
|
const callbackObject = {
|
||||||
installed: Boolean(style),
|
installed: Boolean(style),
|
||||||
enabled: style.enabled,
|
enabled: style.enabled,
|
||||||
name: data.name,
|
name: data.name,
|
||||||
namespace: data.namespace
|
namespace: data.namespace,
|
||||||
};
|
};
|
||||||
|
|
||||||
sendInstalledCallback(callbackObject);
|
sendInstalledCallback(callbackObject);
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
'update-auto',
|
'update-auto',
|
||||||
'export-json-backups',
|
'export-json-backups',
|
||||||
'import-json-backups',
|
'import-json-backups',
|
||||||
'manage-local'
|
'manage-local',
|
||||||
];
|
];
|
||||||
const reportedFeatures = [];
|
const reportedFeatures = [];
|
||||||
|
|
||||||
|
@ -96,8 +96,8 @@
|
||||||
key: event.data.key,
|
key: event.data.key,
|
||||||
extension: {
|
extension: {
|
||||||
name: manifest.name,
|
name: manifest.name,
|
||||||
capabilities: reportedFeatures
|
capabilities: reportedFeatures,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@
|
||||||
// we were able to install the theme and it may display a success message
|
// we were able to install the theme and it may display a success message
|
||||||
sendPostMessage({
|
sendPostMessage({
|
||||||
type: 'ouc-install-callback',
|
type: 'ouc-install-callback',
|
||||||
key: data.key
|
key: data.key,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@
|
||||||
}).then(style => {
|
}).then(style => {
|
||||||
sendInstallCallback({
|
sendInstallCallback({
|
||||||
enabled: style.enabled,
|
enabled: style.enabled,
|
||||||
key: event.data.key
|
key: event.data.key,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
const observer = new MutationObserver(check);
|
const observer = new MutationObserver(check);
|
||||||
observer.observe(document.documentElement, {
|
observer.observe(document.documentElement, {
|
||||||
childList: true,
|
childList: true,
|
||||||
subtree: true
|
subtree: true,
|
||||||
});
|
});
|
||||||
check();
|
check();
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
? 'styleCanBeUpdatedChrome'
|
? 'styleCanBeUpdatedChrome'
|
||||||
: 'styleAlreadyInstalledChrome',
|
: 'styleAlreadyInstalledChrome',
|
||||||
detail: {
|
detail: {
|
||||||
updateUrl: installedStyle.updateUrl
|
updateUrl: installedStyle.updateUrl,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -155,7 +155,7 @@
|
||||||
function doInstall() {
|
function doInstall() {
|
||||||
let oldStyle;
|
let oldStyle;
|
||||||
return API.findStyle({
|
return API.findStyle({
|
||||||
md5Url: getMeta('stylish-md5-url') || location.href
|
md5Url: getMeta('stylish-md5-url') || location.href,
|
||||||
}, true)
|
}, true)
|
||||||
.then(_oldStyle => {
|
.then(_oldStyle => {
|
||||||
oldStyle = _oldStyle;
|
oldStyle = _oldStyle;
|
||||||
|
|
|
@ -162,7 +162,7 @@ function beautify(scope, ui = true) {
|
||||||
$create('SVG:path', {
|
$create('SVG:path', {
|
||||||
'fill-rule': 'evenodd',
|
'fill-rule': 'evenodd',
|
||||||
'd': 'M1408 704q0 26-19 45l-448 448q-19 19-45 ' +
|
'd': 'M1408 704q0 26-19 45l-448 448q-19 19-45 ' +
|
||||||
'19t-45-19l-448-448q-19-19-19-45t19-45 45-19h896q26 0 45 19t19 45z'
|
'19t-45-19l-448-448q-19-19-19-45t19-45 45-19h896q26 0 45 19t19 45z',
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
|
@ -176,7 +176,7 @@ function beautify(scope, ui = true) {
|
||||||
$create('input', {
|
$create('input', {
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
dataset: {option: optionName},
|
dataset: {option: optionName},
|
||||||
checked: options[optionName] !== false
|
checked: options[optionName] !== false,
|
||||||
}),
|
}),
|
||||||
$create('SVG:svg.svg-icon.checked',
|
$create('SVG:svg.svg-icon.checked',
|
||||||
$create('SVG:use', {'xlink:href': '#svg-icon-checked'})),
|
$create('SVG:use', {'xlink:href': '#svg-icon-checked'})),
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
[
|
[
|
||||||
{from: 'Ctrl-', to: ['Alt-', 'Ctrl-Alt-']},
|
{from: 'Ctrl-', to: ['Alt-', 'Ctrl-Alt-']},
|
||||||
// Note: modifier order in CodeMirror is S-C-A
|
// Note: modifier order in CodeMirror is S-C-A
|
||||||
{from: 'Shift-Ctrl-', to: ['Ctrl-Alt-', 'Shift-Ctrl-Alt-']}
|
{from: 'Shift-Ctrl-', to: ['Ctrl-Alt-', 'Shift-Ctrl-Alt-']},
|
||||||
].forEach(remap => {
|
].forEach(remap => {
|
||||||
const oldKey = remap.from + char;
|
const oldKey = remap.from + char;
|
||||||
Object.keys(CodeMirror.keyMap).forEach(keyMapName => {
|
Object.keys(CodeMirror.keyMap).forEach(keyMapName => {
|
||||||
|
@ -134,7 +134,7 @@
|
||||||
let filled;
|
let filled;
|
||||||
this.eachLine(({text}) => (filled = text && /\S/.test(text)));
|
this.eachLine(({text}) => (filled = text && /\S/.test(text)));
|
||||||
return !filled;
|
return !filled;
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// editor commands
|
// editor commands
|
||||||
|
|
|
@ -33,13 +33,13 @@ const cmFactory = (() => {
|
||||||
cm.setOption('highlightSelectionMatches', {
|
cm.setOption('highlightSelectionMatches', {
|
||||||
showToken: /[#.\-\w]/,
|
showToken: /[#.\-\w]/,
|
||||||
annotateScrollbar: true,
|
annotateScrollbar: true,
|
||||||
onUpdate: updateMatchHighlightCount
|
onUpdate: updateMatchHighlightCount,
|
||||||
});
|
});
|
||||||
} else if (value === 'selection') {
|
} else if (value === 'selection') {
|
||||||
cm.setOption('highlightSelectionMatches', {
|
cm.setOption('highlightSelectionMatches', {
|
||||||
showToken: false,
|
showToken: false,
|
||||||
annotateScrollbar: true,
|
annotateScrollbar: true,
|
||||||
onUpdate: updateMatchHighlightCount
|
onUpdate: updateMatchHighlightCount,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
cm.setOption('highlightSelectionMatches', null);
|
cm.setOption('highlightSelectionMatches', null);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* exported CODEMIRROR_THEMES */
|
/* Do not edit. This file is auto-generated by build-vendor.js */
|
||||||
// this file is generated by update-codemirror-themes.js
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
/* exported CODEMIRROR_THEMES */
|
||||||
const CODEMIRROR_THEMES = [
|
const CODEMIRROR_THEMES = [
|
||||||
'3024-day',
|
'3024-day',
|
||||||
'3024-night',
|
'3024-night',
|
||||||
|
@ -65,5 +65,5 @@ const CODEMIRROR_THEMES = [
|
||||||
'xq-light',
|
'xq-light',
|
||||||
'yeti',
|
'yeti',
|
||||||
'yonce',
|
'yonce',
|
||||||
'zenburn'
|
'zenburn',
|
||||||
];
|
];
|
||||||
|
|
|
@ -72,7 +72,7 @@ lazyInit();
|
||||||
cm.scrollIntoView(cm.getCursor(), si.parentHeight / 2);
|
cm.scrollIntoView(cm.getCursor(), si.parentHeight / 2);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
prefs.subscribe('editor.linter', updateLinter);
|
prefs.subscribe('editor.linter', updateLinter);
|
||||||
prefs.subscribe('editor.keyMap', showHotkeyInTooltip);
|
prefs.subscribe('editor.keyMap', showHotkeyInTooltip);
|
||||||
|
@ -512,7 +512,7 @@ function showCodeMirrorPopup(title, html, options) {
|
||||||
matchBrackets: true,
|
matchBrackets: true,
|
||||||
styleActiveLine: true,
|
styleActiveLine: true,
|
||||||
theme: prefs.get('editor.theme'),
|
theme: prefs.get('editor.theme'),
|
||||||
keyMap: prefs.get('editor.keyMap')
|
keyMap: prefs.get('editor.keyMap'),
|
||||||
}, options));
|
}, options));
|
||||||
cm.focus();
|
cm.focus();
|
||||||
rerouteHotkeys(false);
|
rerouteHotkeys(false);
|
||||||
|
|
|
@ -29,13 +29,13 @@ workerUtil.createAPI({
|
||||||
code: err.code,
|
code: err.code,
|
||||||
args: err.args,
|
args: err.args,
|
||||||
message: err.message,
|
message: err.message,
|
||||||
index: err.index
|
index: err.index,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
getStylelintRules,
|
getStylelintRules,
|
||||||
getCsslintRules
|
getCsslintRules,
|
||||||
});
|
});
|
||||||
|
|
||||||
function getCsslintRules() {
|
function getCsslintRules() {
|
||||||
|
|
|
@ -100,7 +100,7 @@ onDOMready().then(() => {
|
||||||
state.lastFind = '';
|
state.lastFind = '';
|
||||||
toggleDataset(this, 'enabled', !state.icase);
|
toggleDataset(this, 'enabled', !state.icase);
|
||||||
doSearch({canAdvance: false});
|
doSearch({canAdvance: false});
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ onDOMready().then(() => {
|
||||||
trimUndoHistory();
|
trimUndoHistory();
|
||||||
enableUndoButton(state.undoHistory.length);
|
enableUndoButton(state.undoHistory.length);
|
||||||
if (state.find) doSearch({canAdvance: false});
|
if (state.find) doSearch({canAdvance: false});
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const DIALOG_PROPS = {
|
const DIALOG_PROPS = {
|
||||||
|
@ -152,7 +152,7 @@ onDOMready().then(() => {
|
||||||
state.replace = this.value;
|
state.replace = this.value;
|
||||||
adjustTextareaSize(this);
|
adjustTextareaSize(this);
|
||||||
debounce(writeStorage, STORAGE_UPDATE_DELAY);
|
debounce(writeStorage, STORAGE_UPDATE_DELAY);
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ onDOMready().then(() => {
|
||||||
replace(cm) {
|
replace(cm) {
|
||||||
state.reverse = false;
|
state.reverse = false;
|
||||||
focusDialog('replace', cm);
|
focusDialog('replace', cm);
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
COMMANDS.replaceAll = COMMANDS.replace;
|
COMMANDS.replaceAll = COMMANDS.replace;
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
loadScript([
|
loadScript([
|
||||||
'/vendor/codemirror/mode/javascript/javascript.js',
|
'/vendor/codemirror/mode/javascript/javascript.js',
|
||||||
'/vendor/codemirror/addon/lint/json-lint.js',
|
'/vendor/codemirror/addon/lint/json-lint.js',
|
||||||
'/vendor/jsonlint/jsonlint.js'
|
'/vendor/jsonlint/jsonlint.js',
|
||||||
]).then(() => {
|
]).then(() => {
|
||||||
cm.setOption('mode', 'application/json');
|
cm.setOption('mode', 'application/json');
|
||||||
cm.setOption('lint', true);
|
cm.setOption('lint', true);
|
||||||
|
|
|
@ -12,13 +12,13 @@ const LINTER_DEFAULTS = (() => {
|
||||||
rules: {
|
rules: {
|
||||||
'at-rule-no-unknown': [true, {
|
'at-rule-no-unknown': [true, {
|
||||||
'ignoreAtRules': ['extend', 'extends', 'css', 'block'],
|
'ignoreAtRules': ['extend', 'extends', 'css', 'block'],
|
||||||
'severity': 'warning'
|
'severity': 'warning',
|
||||||
}],
|
}],
|
||||||
'block-no-empty': [true, SEVERITY],
|
'block-no-empty': [true, SEVERITY],
|
||||||
'color-no-invalid-hex': [true, SEVERITY],
|
'color-no-invalid-hex': [true, SEVERITY],
|
||||||
'declaration-block-no-duplicate-properties': [true, {
|
'declaration-block-no-duplicate-properties': [true, {
|
||||||
'ignore': ['consecutive-duplicates-with-different-values'],
|
'ignore': ['consecutive-duplicates-with-different-values'],
|
||||||
'severity': 'warning'
|
'severity': 'warning',
|
||||||
}],
|
}],
|
||||||
'declaration-block-no-shorthand-property-overrides': [true, SEVERITY],
|
'declaration-block-no-shorthand-property-overrides': [true, SEVERITY],
|
||||||
'font-family-no-duplicate-names': [true, SEVERITY],
|
'font-family-no-duplicate-names': [true, SEVERITY],
|
||||||
|
@ -172,7 +172,7 @@ const LINTER_DEFAULTS = (() => {
|
||||||
'value-list-comma-space-before': 'never',
|
'value-list-comma-space-before': 'never',
|
||||||
'value-list-max-empty-lines': 0
|
'value-list-max-empty-lines': 0
|
||||||
*/
|
*/
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
const CSSLINT = {
|
const CSSLINT = {
|
||||||
// Default warnings
|
// Default warnings
|
||||||
|
@ -216,7 +216,7 @@ const LINTER_DEFAULTS = (() => {
|
||||||
'universal-selector': 0,
|
'universal-selector': 0,
|
||||||
'unqualified-attributes': 0,
|
'unqualified-attributes': 0,
|
||||||
'vendor-prefix': 0,
|
'vendor-prefix': 0,
|
||||||
'zero-units': 0
|
'zero-units': 0,
|
||||||
};
|
};
|
||||||
return {STYLELINT, CSSLINT, SEVERITY};
|
return {STYLELINT, CSSLINT, SEVERITY};
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
storageName: chromeSync.LZ_KEY.csslint,
|
storageName: chromeSync.LZ_KEY.csslint,
|
||||||
lint: csslint,
|
lint: csslint,
|
||||||
validMode: mode => mode === 'css',
|
validMode: mode => mode === 'css',
|
||||||
getConfig: config => Object.assign({}, LINTER_DEFAULTS.CSSLINT, config)
|
getConfig: config => Object.assign({}, LINTER_DEFAULTS.CSSLINT, config),
|
||||||
},
|
},
|
||||||
stylelint: {
|
stylelint: {
|
||||||
storageName: chromeSync.LZ_KEY.stylelint,
|
storageName: chromeSync.LZ_KEY.stylelint,
|
||||||
|
@ -15,9 +15,9 @@
|
||||||
validMode: () => true,
|
validMode: () => true,
|
||||||
getConfig: config => ({
|
getConfig: config => ({
|
||||||
syntax: 'sugarss',
|
syntax: 'sugarss',
|
||||||
rules: Object.assign({}, LINTER_DEFAULTS.STYLELINT.rules, config && config.rules)
|
rules: Object.assign({}, LINTER_DEFAULTS.STYLELINT.rules, config && config.rules),
|
||||||
})
|
}),
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
async function stylelint(text, config, mode) {
|
async function stylelint(text, config, mode) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ function createMetaCompiler(cm, onUpdated) {
|
||||||
to: cm.posFromIndex((err.index || 0) + match.index),
|
to: cm.posFromIndex((err.index || 0) + match.index),
|
||||||
message: err.code && chrome.i18n.getMessage(`meta_${err.code}`, err.args) || err.message,
|
message: err.code && chrome.i18n.getMessage(`meta_${err.code}`, err.args) || err.message,
|
||||||
severity: err.code === 'unknownMeta' ? 'warning' : 'error',
|
severity: err.code === 'unknownMeta' ? 'warning' : 'error',
|
||||||
rule: err.code
|
rule: err.code,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
meta = match[0];
|
meta = match[0];
|
||||||
|
|
|
@ -77,7 +77,7 @@ Object.assign(linter, (() => {
|
||||||
element: table,
|
element: table,
|
||||||
trs,
|
trs,
|
||||||
updateAnnotations,
|
updateAnnotations,
|
||||||
updateCaption
|
updateCaption,
|
||||||
};
|
};
|
||||||
|
|
||||||
function updateCaption() {
|
function updateCaption() {
|
||||||
|
@ -124,18 +124,18 @@ Object.assign(linter, (() => {
|
||||||
const message = $create('td', {attributes: {role: 'message'}});
|
const message = $create('td', {attributes: {role: 'message'}});
|
||||||
|
|
||||||
const trElement = $create('tr', {
|
const trElement = $create('tr', {
|
||||||
onclick: () => gotoLintIssue(cm, anno)
|
onclick: () => gotoLintIssue(cm, anno),
|
||||||
}, [
|
}, [
|
||||||
severity,
|
severity,
|
||||||
line,
|
line,
|
||||||
$create('td', {attributes: {role: 'sep'}}, ':'),
|
$create('td', {attributes: {role: 'sep'}}, ':'),
|
||||||
col,
|
col,
|
||||||
message
|
message,
|
||||||
]);
|
]);
|
||||||
return {
|
return {
|
||||||
element: trElement,
|
element: trElement,
|
||||||
update,
|
update,
|
||||||
getAnnotation: () => anno
|
getAnnotation: () => anno,
|
||||||
};
|
};
|
||||||
|
|
||||||
function update(_anno) {
|
function update(_anno) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
/* exported editorWorker */
|
/* exported editorWorker */
|
||||||
const editorWorker = workerUtil.createWorker({
|
const editorWorker = workerUtil.createWorker({
|
||||||
url: '/edit/editor-worker.js'
|
url: '/edit/editor-worker.js',
|
||||||
});
|
});
|
||||||
|
|
||||||
/* exported linter */
|
/* exported linter */
|
||||||
|
@ -19,7 +19,7 @@ const linter = (() => {
|
||||||
enableForEditor,
|
enableForEditor,
|
||||||
disableForEditor,
|
disableForEditor,
|
||||||
onLintingUpdated,
|
onLintingUpdated,
|
||||||
onUnhook
|
onUnhook,
|
||||||
};
|
};
|
||||||
|
|
||||||
function onUnhook(cb) {
|
function onUnhook(cb) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ function createLivePreview(preprocess, shouldShow) {
|
||||||
|
|
||||||
function createPreviewer() {
|
function createPreviewer() {
|
||||||
const port = chrome.runtime.connect({
|
const port = chrome.runtime.connect({
|
||||||
name: 'livePreview'
|
name: 'livePreview',
|
||||||
});
|
});
|
||||||
port.onDisconnect.addListener(err => {
|
port.onDisconnect.addListener(err => {
|
||||||
throw err;
|
throw err;
|
||||||
|
|
|
@ -75,7 +75,7 @@ function MozSectionFinder(cm) {
|
||||||
/** @param {MozSection} [section] */
|
/** @param {MozSection} [section] */
|
||||||
updatePositions(section) {
|
updatePositions(section) {
|
||||||
(section ? [section] : getState().sections).forEach(setPositionFromMark);
|
(section ? [section] : getState().sections).forEach(setPositionFromMark);
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
return MozSectionFinder;
|
return MozSectionFinder;
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ function MozSectionWidget(
|
||||||
if (funcs.length < 2) {
|
if (funcs.length < 2) {
|
||||||
messageBox({
|
messageBox({
|
||||||
contents: t('appliesRemoveError'),
|
contents: t('appliesRemoveError'),
|
||||||
buttons: [t('confirmClose')]
|
buttons: [t('confirmClose')],
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ function MozSectionWidget(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
actualStyle = $create('style');
|
actualStyle = $create('style');
|
||||||
|
|
|
@ -436,7 +436,7 @@ function SectionsEditor() {
|
||||||
/** @returns {Style} */
|
/** @returns {Style} */
|
||||||
function getModel() {
|
function getModel() {
|
||||||
return Object.assign({}, style, {
|
return Object.assign({}, style, {
|
||||||
sections: sections.filter(s => !s.removed).map(s => s.getModel())
|
sections: sections.filter(s => !s.removed).map(s => s.getModel()),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ function SourceEditor() {
|
||||||
return API.buildUsercss({
|
return API.buildUsercss({
|
||||||
styleId: style.id,
|
styleId: style.id,
|
||||||
sourceCode: style.sourceCode,
|
sourceCode: style.sourceCode,
|
||||||
assignVars: true
|
assignVars: true,
|
||||||
})
|
})
|
||||||
.then(({style: newStyle}) => {
|
.then(({style: newStyle}) => {
|
||||||
delete newStyle.enabled;
|
delete newStyle.enabled;
|
||||||
|
|
|
@ -214,6 +214,6 @@ function createHotkeyInput(prefId, onDone = () => {}) {
|
||||||
},
|
},
|
||||||
onpaste(event) {
|
onpaste(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
if (theme !== 'default') {
|
if (theme !== 'default') {
|
||||||
document.head.appendChild($create('link', {
|
document.head.appendChild($create('link', {
|
||||||
rel: 'stylesheet',
|
rel: 'stylesheet',
|
||||||
href: `vendor/codemirror/theme/${theme}.css`
|
href: `vendor/codemirror/theme/${theme}.css`,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
window.addEventListener('resize', adjustCodeHeight);
|
window.addEventListener('resize', adjustCodeHeight);
|
||||||
|
@ -111,7 +111,7 @@
|
||||||
frag.appendChild($createLink(url,
|
frag.appendChild($createLink(url,
|
||||||
$create('SVG:svg.svg-icon', {viewBox: '0 0 20 20'},
|
$create('SVG:svg.svg-icon', {viewBox: '0 0 20 20'},
|
||||||
$create('SVG:path', {
|
$create('SVG:path', {
|
||||||
d: 'M4,4h5v2H6v8h8v-3h2v5H4V4z M11,3h6v6l-2-2l-4,4L9,9l4-4L11,3z'
|
d: 'M4,4h5v2H6v8h8v-3h2v5H4V4z M11,3h6v6l-2-2l-4,4L9,9l4-4L11,3z',
|
||||||
}))
|
}))
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@
|
||||||
$create('li',
|
$create('li',
|
||||||
$createLink(...args)
|
$createLink(...args)
|
||||||
)
|
)
|
||||||
))
|
)),
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ function createCache({size = 1000, onDeleted} = {}) {
|
||||||
},
|
},
|
||||||
get size() {
|
get size() {
|
||||||
return map.size;
|
return map.size;
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function get(id) {
|
function get(id) {
|
||||||
|
|
|
@ -296,7 +296,7 @@ function $createLink(href = '', content) {
|
||||||
const opt = {
|
const opt = {
|
||||||
tag: 'a',
|
tag: 'a',
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
rel: 'noopener'
|
rel: 'noopener',
|
||||||
};
|
};
|
||||||
if (typeof href === 'object') {
|
if (typeof href === 'object') {
|
||||||
Object.assign(opt, href);
|
Object.assign(opt, href);
|
||||||
|
|
|
@ -126,7 +126,7 @@ function urlToMatchPattern(url, ignoreSearch) {
|
||||||
if (ignoreSearch) {
|
if (ignoreSearch) {
|
||||||
return [
|
return [
|
||||||
`${url.protocol}//${url.hostname}/${url.pathname}`,
|
`${url.protocol}//${url.hostname}/${url.pathname}`,
|
||||||
`${url.protocol}//${url.hostname}/${url.pathname}?*`
|
`${url.protocol}//${url.hostname}/${url.pathname}?*`,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
// FIXME: is %2f allowed in pathname and search?
|
// FIXME: is %2f allowed in pathname and search?
|
||||||
|
@ -220,7 +220,7 @@ function activateTab(tab, {url, index, openerTabId} = {}) {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
browser.tabs.update(tab.id, options),
|
browser.tabs.update(tab.id, options),
|
||||||
browser.windows && browser.windows.update(tab.windowId, {focused: true}),
|
browser.windows && browser.windows.update(tab.windowId, {focused: true}),
|
||||||
index != null && browser.tabs.move(tab.id, {index})
|
index != null && browser.tabs.move(tab.id, {index}),
|
||||||
])
|
])
|
||||||
.then(() => tab);
|
.then(() => tab);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,17 +12,17 @@ const metaParser = (() => {
|
||||||
throw new ParseError({
|
throw new ParseError({
|
||||||
code: 'unknownPreprocessor',
|
code: 'unknownPreprocessor',
|
||||||
args: [state.value],
|
args: [state.value],
|
||||||
index: state.valueIndex
|
index: state.valueIndex,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
validateVar: {
|
validateVar: {
|
||||||
select: state => {
|
select: state => {
|
||||||
if (state.varResult.options.every(o => o.name !== state.value)) {
|
if (state.varResult.options.every(o => o.name !== state.value)) {
|
||||||
throw new ParseError({
|
throw new ParseError({
|
||||||
code: 'invalidSelectValueMismatch',
|
code: 'invalidSelectValueMismatch',
|
||||||
index: state.valueIndex
|
index: state.valueIndex,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -32,19 +32,19 @@ const metaParser = (() => {
|
||||||
throw new ParseError({
|
throw new ParseError({
|
||||||
code: 'invalidColor',
|
code: 'invalidColor',
|
||||||
args: [state.value],
|
args: [state.value],
|
||||||
index: state.valueIndex
|
index: state.valueIndex,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
state.value = colorConverter.format(color, 'rgb');
|
state.value = colorConverter.format(color, 'rgb');
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
const parser = createParser(options);
|
const parser = createParser(options);
|
||||||
const looseParser = createParser(Object.assign({}, options, {allowErrors: true, unknownKey: 'throw'}));
|
const looseParser = createParser(Object.assign({}, options, {allowErrors: true, unknownKey: 'throw'}));
|
||||||
return {
|
return {
|
||||||
parse,
|
parse,
|
||||||
lint,
|
lint,
|
||||||
nullifyInvalidVars
|
nullifyInvalidVars,
|
||||||
};
|
};
|
||||||
|
|
||||||
function parse(text, indexOffset) {
|
function parse(text, indexOffset) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ const usercss = (() => {
|
||||||
const style = {
|
const style = {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
sourceCode,
|
sourceCode,
|
||||||
sections: []
|
sections: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
const match = sourceCode.match(RX_META);
|
const match = sourceCode.match(RX_META);
|
||||||
|
|
|
@ -67,7 +67,7 @@ const workerUtil = {
|
||||||
message: err.message,
|
message: err.message,
|
||||||
lineNumber: err.lineNumber,
|
lineNumber: err.lineNumber,
|
||||||
columnNumber: err.columnNumber,
|
columnNumber: err.columnNumber,
|
||||||
fileName: err.fileName
|
fileName: err.fileName,
|
||||||
}, err);
|
}, err);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ function configDialog(style) {
|
||||||
contents: [
|
contents: [
|
||||||
$create('.config-heading', data.supportURL &&
|
$create('.config-heading', data.supportURL &&
|
||||||
$createLink({className: '.external-support', href: data.supportURL}, t('externalFeedback'))),
|
$createLink({className: '.external-support', href: data.supportURL}, t('externalFeedback'))),
|
||||||
$create('.config-body', elements)
|
$create('.config-body', elements),
|
||||||
],
|
],
|
||||||
buttons: [{
|
buttons: [{
|
||||||
textContent: t('confirmSave'),
|
textContent: t('confirmSave'),
|
||||||
|
@ -210,8 +210,8 @@ function configDialog(style) {
|
||||||
$create('SVG:polygon', {
|
$create('SVG:polygon', {
|
||||||
points: '16.2,5.5 14.5,3.8 10,8.3 5.5,3.8 3.8,5.5 8.3,10 3.8,14.5 ' +
|
points: '16.2,5.5 14.5,3.8 10,8.3 5.5,3.8 3.8,5.5 8.3,10 3.8,14.5 ' +
|
||||||
'5.5,16.2 10,11.7 14.5,16.2 16.2,14.5 11.7,10',
|
'5.5,16.2 10,11.7 14.5,16.2 16.2,14.5 11.7,10',
|
||||||
})
|
}),
|
||||||
])
|
]),
|
||||||
]);
|
]);
|
||||||
for (const va of vars) {
|
for (const va of vars) {
|
||||||
let children;
|
let children;
|
||||||
|
@ -222,7 +222,7 @@ function configDialog(style) {
|
||||||
va.input = $create('a.color-swatch', {
|
va.input = $create('a.color-swatch', {
|
||||||
va,
|
va,
|
||||||
href: '#',
|
href: '#',
|
||||||
onclick: showColorpicker
|
onclick: showColorpicker,
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
|
@ -268,7 +268,7 @@ function configDialog(style) {
|
||||||
onblur: va.type === 'number' ? updateVarOnBlur : null,
|
onblur: va.type === 'number' ? updateVarOnBlur : null,
|
||||||
onchange: updateVarOnChange,
|
onchange: updateVarOnChange,
|
||||||
oninput: updateVarOnInput,
|
oninput: updateVarOnInput,
|
||||||
required: true
|
required: true,
|
||||||
};
|
};
|
||||||
if (typeof va.min === 'number') {
|
if (typeof va.min === 'number') {
|
||||||
options.min = va.min;
|
options.min = va.min;
|
||||||
|
@ -281,7 +281,7 @@ function configDialog(style) {
|
||||||
}
|
}
|
||||||
children = [
|
children = [
|
||||||
va.type === 'range' && $create('span.current-value'),
|
va.type === 'range' && $create('span.current-value'),
|
||||||
va.input = $create('input.config-value', options)
|
va.input = $create('input.config-value', options),
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ function filterOnChange({target: el, forceRefilter}) {
|
||||||
el.dataset[hide ? 'filterHide' : 'filter']
|
el.dataset[hide ? 'filterHide' : 'filter']
|
||||||
.split(/,\s*/)
|
.split(/,\s*/)
|
||||||
.map(s => (hide ? '.entry:not(.hidden)' : '') + s)
|
.map(s => (hide ? '.entry:not(.hidden)' : '') + s)
|
||||||
.join(','))
|
.join(',')),
|
||||||
].join(hide ? ',' : '');
|
].join(hide ? ',' : '');
|
||||||
Object.assign(filtersSelector, {
|
Object.assign(filtersSelector, {
|
||||||
hide: buildFilter(true),
|
hide: buildFilter(true),
|
||||||
|
|
|
@ -71,7 +71,7 @@ Promise.all([
|
||||||
// FIXME: integrate this into filter.js
|
// FIXME: integrate this into filter.js
|
||||||
router.getSearch('search') && API.searchDB({query: router.getSearch('search')}),
|
router.getSearch('search') && API.searchDB({query: router.getSearch('search')}),
|
||||||
waitForSelector('#installed'), // needed to avoid flicker due to an extra frame and layout shift
|
waitForSelector('#installed'), // needed to avoid flicker due to an extra frame and layout shift
|
||||||
prefs.initializing
|
prefs.initializing,
|
||||||
]).then(([styles, ids, el]) => {
|
]).then(([styles, ids, el]) => {
|
||||||
installed = el;
|
installed = el;
|
||||||
installed.onclick = handleEvent.entryClicked;
|
installed.onclick = handleEvent.entryClicked;
|
||||||
|
@ -370,7 +370,7 @@ Object.assign(handleEvent, {
|
||||||
'.update': 'update',
|
'.update': 'update',
|
||||||
'.delete': 'delete',
|
'.delete': 'delete',
|
||||||
'.applies-to .expander': 'expandTargets',
|
'.applies-to .expander': 'expandTargets',
|
||||||
'.configure-usercss': 'config'
|
'.configure-usercss': 'config',
|
||||||
},
|
},
|
||||||
|
|
||||||
entryClicked(event) {
|
entryClicked(event) {
|
||||||
|
@ -526,7 +526,7 @@ Object.assign(handleEvent, {
|
||||||
{prop: 'updateDate', name: 'dateUpdated'},
|
{prop: 'updateDate', name: 'dateUpdated'},
|
||||||
].map(({prop, name}) =>
|
].map(({prop, name}) =>
|
||||||
t(name) + ': ' + (formatDate(entry.styleMeta[prop]) || '—')).join('\n');
|
t(name) + ': ' + (formatDate(entry.styleMeta[prop]) || '—')).join('\n');
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,28 +13,28 @@ const sorter = (() => {
|
||||||
title: {
|
title: {
|
||||||
text: t('genericTitle'),
|
text: t('genericTitle'),
|
||||||
parse: ({name}) => name,
|
parse: ({name}) => name,
|
||||||
sorter: sorterType.alpha
|
sorter: sorterType.alpha,
|
||||||
},
|
},
|
||||||
usercss: {
|
usercss: {
|
||||||
text: 'Usercss',
|
text: 'Usercss',
|
||||||
parse: ({style}) => style.usercssData ? 0 : 1,
|
parse: ({style}) => style.usercssData ? 0 : 1,
|
||||||
sorter: sorterType.number
|
sorter: sorterType.number,
|
||||||
},
|
},
|
||||||
disabled: {
|
disabled: {
|
||||||
text: '', // added as either "enabled" or "disabled" by the addOptions function
|
text: '', // added as either "enabled" or "disabled" by the addOptions function
|
||||||
parse: ({style}) => style.enabled ? 1 : 0,
|
parse: ({style}) => style.enabled ? 1 : 0,
|
||||||
sorter: sorterType.number
|
sorter: sorterType.number,
|
||||||
},
|
},
|
||||||
dateInstalled: {
|
dateInstalled: {
|
||||||
text: t('dateInstalled'),
|
text: t('dateInstalled'),
|
||||||
parse: ({style}) => style.installDate,
|
parse: ({style}) => style.installDate,
|
||||||
sorter: sorterType.number
|
sorter: sorterType.number,
|
||||||
},
|
},
|
||||||
dateUpdated: {
|
dateUpdated: {
|
||||||
text: t('dateUpdated'),
|
text: t('dateUpdated'),
|
||||||
parse: ({style}) => style.updateDate || style.installDate,
|
parse: ({style}) => style.updateDate || style.installDate,
|
||||||
sorter: sorterType.number
|
sorter: sorterType.number,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Adding (assumed) most commonly used ('title,asc' should always be first)
|
// Adding (assumed) most commonly used ('title,asc' should always be first)
|
||||||
|
@ -56,7 +56,7 @@ const sorter = (() => {
|
||||||
'usercss,asc, title,desc',
|
'usercss,asc, title,desc',
|
||||||
'usercss,desc, title,desc',
|
'usercss,desc, title,desc',
|
||||||
'disabled,desc, title,desc',
|
'disabled,desc, title,desc',
|
||||||
'disabled,desc, usercss,asc, title,desc'
|
'disabled,desc, usercss,asc, title,desc',
|
||||||
];
|
];
|
||||||
|
|
||||||
const splitRegex = /\s*,\s*/;
|
const splitRegex = /\s*,\s*/;
|
||||||
|
@ -76,7 +76,7 @@ const sorter = (() => {
|
||||||
dateNew: ` (${t('sortDateNewestFirst')})`,
|
dateNew: ` (${t('sortDateNewestFirst')})`,
|
||||||
dateOld: ` (${t('sortDateOldestFirst')})`,
|
dateOld: ` (${t('sortDateOldestFirst')})`,
|
||||||
groupAsc: t('sortLabelTitleAsc'),
|
groupAsc: t('sortLabelTitleAsc'),
|
||||||
groupDesc: t('sortLabelTitleDesc')
|
groupDesc: t('sortLabelTitleDesc'),
|
||||||
};
|
};
|
||||||
const optgroupRegex = /\{\w+\}/;
|
const optgroupRegex = /\{\w+\}/;
|
||||||
selectOptions.forEach(sort => {
|
selectOptions.forEach(sort => {
|
||||||
|
@ -132,7 +132,7 @@ const sorter = (() => {
|
||||||
entry,
|
entry,
|
||||||
name: entry.styleNameLowerCase,
|
name: entry.styleNameLowerCase,
|
||||||
style: entry.styleMeta,
|
style: entry.styleMeta,
|
||||||
}))
|
})),
|
||||||
});
|
});
|
||||||
if (current.some((entry, index) => entry !== sorted[index].entry)) {
|
if (current.some((entry, index) => entry !== sorted[index].entry)) {
|
||||||
const renderBin = document.createDocumentFragment();
|
const renderBin = document.createDocumentFragment();
|
||||||
|
|
|
@ -87,7 +87,7 @@ function messageBox({
|
||||||
},
|
},
|
||||||
scroll() {
|
scroll() {
|
||||||
scrollTo(blockScroll.x, blockScroll.y);
|
scrollTo(blockScroll.x, blockScroll.y);
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ messageBox.alert = (contents, className, title) =>
|
||||||
title,
|
title,
|
||||||
contents,
|
contents,
|
||||||
className: `center ${className || ''}`,
|
className: `center ${className || ''}`,
|
||||||
buttons: [t('confirmClose')]
|
buttons: [t('confirmClose')],
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -174,5 +174,5 @@ messageBox.confirm = (contents, className, title) =>
|
||||||
title,
|
title,
|
||||||
contents,
|
contents,
|
||||||
className: `center ${className || ''}`,
|
className: `center ${className || ''}`,
|
||||||
buttons: [t('confirmYes'), t('confirmNo')]
|
buttons: [t('confirmYes'), t('confirmNo')],
|
||||||
}).then(result => result.button === 0 || result.enter);
|
}).then(result => result.button === 0 || result.enter);
|
||||||
|
|
|
@ -344,7 +344,7 @@ function createStyleElement(style) {
|
||||||
styleId: style.id,
|
styleId: style.id,
|
||||||
styleIsUsercss: Boolean(style.usercssData),
|
styleIsUsercss: Boolean(style.usercssData),
|
||||||
onmousedown: handleEvent.maybeEdit,
|
onmousedown: handleEvent.maybeEdit,
|
||||||
styleMeta: style
|
styleMeta: style,
|
||||||
});
|
});
|
||||||
const checkbox = $('.checker', entry);
|
const checkbox = $('.checker', entry);
|
||||||
Object.assign(checkbox, {
|
Object.assign(checkbox, {
|
||||||
|
@ -645,7 +645,7 @@ Object.assign(handleEvent, {
|
||||||
this.eventHandled = true;
|
this.eventHandled = true;
|
||||||
API.openManage({
|
API.openManage({
|
||||||
search: tabURL && (event.shiftKey || event.button === 2) ?
|
search: tabURL && (event.shiftKey || event.button === 2) ?
|
||||||
`url:${tabURL}` : null
|
`url:${tabURL}` : null,
|
||||||
});
|
});
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,7 +273,7 @@ window.addEventListener('showStyles:done', () => {
|
||||||
// title
|
// title
|
||||||
Object.assign($('.search-result-title', entry), {
|
Object.assign($('.search-result-title', entry), {
|
||||||
onclick: handleEvent.openURLandHide,
|
onclick: handleEvent.openURLandHide,
|
||||||
href: URLS.usoArchive + `?category=${category}&style=${id}`
|
href: URLS.usoArchive + `?category=${category}&style=${id}`,
|
||||||
});
|
});
|
||||||
$('.search-result-title span', entry).textContent =
|
$('.search-result-title span', entry).textContent =
|
||||||
tWordBreak(name.length < 300 ? name : name.slice(0, 300) + '...');
|
tWordBreak(name.length < 300 ? name : name.slice(0, 300) + '...');
|
||||||
|
@ -303,7 +303,7 @@ window.addEventListener('showStyles:done', () => {
|
||||||
// time
|
// time
|
||||||
Object.assign($('[data-type="updated"] time', entry), {
|
Object.assign($('[data-type="updated"] time', entry), {
|
||||||
dateTime: updateTime * 1000,
|
dateTime: updateTime * 1000,
|
||||||
textContent: formatDate(updateTime * 1000)
|
textContent: formatDate(updateTime * 1000),
|
||||||
});
|
});
|
||||||
// totals
|
// totals
|
||||||
$('[data-type="weekly"] dd', entry).textContent = formatNumber(weeklyInstalls);
|
$('[data-type="weekly"] dd', entry).textContent = formatNumber(weeklyInstalls);
|
||||||
|
|
|
@ -32,37 +32,37 @@ const files = {
|
||||||
'mode/css',
|
'mode/css',
|
||||||
'mode/javascript',
|
'mode/javascript',
|
||||||
'mode/stylus',
|
'mode/stylus',
|
||||||
'theme/*'
|
'theme/*',
|
||||||
],
|
],
|
||||||
'jsonlint': [
|
'jsonlint': [
|
||||||
'lib/jsonlint.js → jsonlint.js',
|
'lib/jsonlint.js → jsonlint.js',
|
||||||
'README.md → LICENSE'
|
'README.md → LICENSE',
|
||||||
],
|
],
|
||||||
'less-bundle': [
|
'less-bundle': [
|
||||||
'dist/less.min.js → less.min.js'
|
'dist/less.min.js → less.min.js',
|
||||||
],
|
],
|
||||||
'lz-string-unsafe': [
|
'lz-string-unsafe': [
|
||||||
'lz-string-unsafe.min.js'
|
'lz-string-unsafe.min.js',
|
||||||
],
|
],
|
||||||
'semver-bundle': [
|
'semver-bundle': [
|
||||||
'dist/semver.js → semver.js'
|
'dist/semver.js → semver.js',
|
||||||
],
|
],
|
||||||
'stylelint-bundle': [
|
'stylelint-bundle': [
|
||||||
'stylelint-bundle.min.js',
|
'stylelint-bundle.min.js',
|
||||||
'https://github.com/stylelint/stylelint/raw/{VERSION}/LICENSE → LICENSE'
|
'https://github.com/stylelint/stylelint/raw/{VERSION}/LICENSE → LICENSE',
|
||||||
],
|
],
|
||||||
'stylus-lang-bundle': [
|
'stylus-lang-bundle': [
|
||||||
'dist/stylus-renderer.min.js → stylus-renderer.min.js'
|
'dist/stylus-renderer.min.js → stylus-renderer.min.js',
|
||||||
],
|
],
|
||||||
'usercss-meta': [
|
'usercss-meta': [
|
||||||
'dist/usercss-meta.min.js → usercss-meta.min.js'
|
'dist/usercss-meta.min.js → usercss-meta.min.js',
|
||||||
],
|
],
|
||||||
'db-to-cloud': [
|
'db-to-cloud': [
|
||||||
'dist/db-to-cloud.min.js → db-to-cloud.min.js'
|
'dist/db-to-cloud.min.js → db-to-cloud.min.js',
|
||||||
],
|
],
|
||||||
'webext-launch-web-auth-flow': [
|
'webext-launch-web-auth-flow': [
|
||||||
'dist/webext-launch-web-auth-flow.min.js → webext-launch-web-auth-flow.min.js'
|
'dist/webext-launch-web-auth-flow.min.js → webext-launch-web-auth-flow.min.js',
|
||||||
]
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
main().catch(console.error);
|
main().catch(console.error);
|
||||||
|
@ -87,12 +87,15 @@ async function generateThemeList() {
|
||||||
.map(name => name.replace('.css', ''))
|
.map(name => name.replace('.css', ''))
|
||||||
.sort();
|
.sort();
|
||||||
return endent`
|
return endent`
|
||||||
/* exported CODEMIRROR_THEMES */
|
/* Do not edit. This file is auto-generated by build-vendor.js */
|
||||||
// this file is generated by update-codemirror-themes.js
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const CODEMIRROR_THEMES = ${JSON.stringify(themes, null, 2)};
|
/* exported CODEMIRROR_THEMES */
|
||||||
`.replace(/"/g, "'") + '\n';
|
const CODEMIRROR_THEMES = [
|
||||||
|
${
|
||||||
|
themes.map(t => ` '${t.replace(/'/g, '\\$&')}',\n`).join('')
|
||||||
|
}];
|
||||||
|
` + '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
async function copyLicense(pkg) {
|
async function copyLicense(pkg) {
|
||||||
|
|
|
@ -16,7 +16,7 @@ function createZip({isFirefox} = {}) {
|
||||||
'package-lock.json',
|
'package-lock.json',
|
||||||
'yarn.lock',
|
'yarn.lock',
|
||||||
'*.zip',
|
'*.zip',
|
||||||
'*.map'
|
'*.map',
|
||||||
];
|
];
|
||||||
|
|
||||||
const file = fs.createWriteStream(fileName);
|
const file = fs.createWriteStream(fileName);
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
{hex: '#00ffff', start: .50},
|
{hex: '#00ffff', start: .50},
|
||||||
{hex: '#0000ff', start: .67},
|
{hex: '#0000ff', start: .67},
|
||||||
{hex: '#ff00ff', start: .83},
|
{hex: '#ff00ff', start: .83},
|
||||||
{hex: '#ff0000', start: 1}
|
{hex: '#ff0000', start: 1},
|
||||||
];
|
];
|
||||||
const MIN_HEIGHT = 220;
|
const MIN_HEIGHT = 220;
|
||||||
const MARGIN = 8;
|
const MARGIN = 8;
|
||||||
|
@ -119,7 +119,7 @@
|
||||||
$inputGroups.hex = $(['input-group', 'hex'], [
|
$inputGroups.hex = $(['input-group', 'hex'], [
|
||||||
$(['input-field', 'hex'], [
|
$(['input-field', 'hex'], [
|
||||||
$hexCode = $('input', {tag: 'input', type: 'text', spellcheck: false,
|
$hexCode = $('input', {tag: 'input', type: 'text', spellcheck: false,
|
||||||
pattern: /^\s*#([a-fA-F\d]{3}([a-fA-F\d]([a-fA-F\d]{2}([a-fA-F\d]{2})?)?)?)\s*$/.source
|
pattern: /^\s*#([a-fA-F\d]{3}([a-fA-F\d]([a-fA-F\d]{2}([a-fA-F\d]{2})?)?)?)\s*$/.source,
|
||||||
}),
|
}),
|
||||||
$('title', [
|
$('title', [
|
||||||
$hexLettercase.true = $('title-action', {onclick: onHexLettercaseClicked}, 'HEX'),
|
$hexLettercase.true = $('title-action', {onclick: onHexLettercaseClicked}, 'HEX'),
|
||||||
|
@ -186,7 +186,7 @@
|
||||||
Object.defineProperty($inputs.hsl, 'color', {get: inputsToHSL});
|
Object.defineProperty($inputs.hsl, 'color', {get: inputsToHSL});
|
||||||
Object.defineProperty($inputs, 'color', {get: () => $inputs[currentFormat].color});
|
Object.defineProperty($inputs, 'color', {get: () => $inputs[currentFormat].color});
|
||||||
Object.defineProperty($inputs, 'colorString', {
|
Object.defineProperty($inputs, 'colorString', {
|
||||||
get: () => currentFormat && colorConverter.format($inputs[currentFormat].color)
|
get: () => currentFormat && colorConverter.format($inputs[currentFormat].color),
|
||||||
});
|
});
|
||||||
|
|
||||||
HUE_COLORS.forEach(color => Object.assign(color, colorConverter.parse(color.hex)));
|
HUE_COLORS.forEach(color => Object.assign(color, colorConverter.parse(color.hex)));
|
||||||
|
|
|
@ -2057,7 +2057,7 @@ self.parserlib = (() => {
|
||||||
return m.toString(p);
|
return m.toString(p);
|
||||||
}).join(required === false ? ' || ' : ' && ');
|
}).join(required === false ? ' || ' : ' && ');
|
||||||
return prec > p ? `[ ${s} ]` : s;
|
return prec > p ? `[ ${s} ]` : s;
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Matcher.parseGrammar = (() => {
|
Matcher.parseGrammar = (() => {
|
||||||
|
@ -5300,7 +5300,7 @@ self.parserlib = (() => {
|
||||||
_readDeclarations({
|
_readDeclarations({
|
||||||
checkStart = true,
|
checkStart = true,
|
||||||
readMargins = false,
|
readMargins = false,
|
||||||
stopAfterBrace = false
|
stopAfterBrace = false,
|
||||||
} = {}) {
|
} = {}) {
|
||||||
const stream = this._tokenStream;
|
const stream = this._tokenStream;
|
||||||
if (checkStart) stream.mustMatch(Tokens.LBRACE);
|
if (checkStart) stream.mustMatch(Tokens.LBRACE);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user