-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install styles from *.user.css file #134
Changes from 188 commits
81f490c
6aaa7ef
9c2acd5
8607d77
dfb7ac9
acd9bef
0e5ab44
3c40b52
4dec097
b3b4769
78264a1
f74641e
6e52d48
3f06ce8
f7a43d7
1f44898
4e0f4b3
bf45575
3daff40
cb23f89
8c374db
1c33172
cfdb0b4
8bc6986
a15493b
f305719
381ee88
20481c9
3730a4e
41f0174
d4ddefe
de84248
e2ea93a
5fecd7e
6ce4af8
8207d60
33200db
a395df1
e13a6f6
e1d221e
f3176de
97b4d91
bbe37ad
43b912c
e4d3025
27f8bc2
7612cd3
02c61b9
e7eb38b
4b2f7a1
39df704
431dbdc
7c1b140
51e92e5
9069562
e3c3dcc
a3f26d8
8e5ffd0
6b1d656
23bd3e2
a1b8945
dc37588
2506b95
2342cc5
acaa1ed
436551a
6165487
93fe23f
279c7d0
31464bb
fa06b29
b102aa0
6195e55
0e92e6d
d7f0e3c
b61b058
3c450e7
411df8b
40a5dab
97fd2aa
b7b5888
37c83ce
2ba4c4f
70bbc08
a542d22
553cc94
5a9ac5c
21256e3
eaf33af
ccb5f48
693a048
a73493d
4d6f856
dc988a4
a0495f4
aed3698
90ca2f2
94e5336
1e9ee78
1d829fe
94a7e0c
aa71984
ead006a
d1964bb
ba4c06a
0852b56
2b6404c
a4e3fba
18fd153
24cd856
cb7aaa7
587feb3
7365a8b
04ebc83
c2eadda
2912a53
6636d33
bb508b6
b69b834
0f6de58
b866688
c0514a6
f194155
0d4d058
da5626a
56e669f
fc51d80
40a1781
7652315
f255631
9ee7e20
50a5bbe
8007f47
3cb1943
228057d
1a6f9df
2f3c477
cd00c20
a901ca2
77b6b6c
1d1c7da
c0378e3
4115705
3906060
5b701d0
2642206
7ca9938
ce2a214
eec52ad
40ad783
33607e7
54076d9
a1ca416
7c22489
c1d2857
9770523
96a046f
368bb34
9590238
be4a896
831a4ef
0a6de8e
ce348d4
7101362
adc0c80
62748b3
6fac838
6536028
6f51100
79b6266
098dc10
398056c
13ca45a
45da3ff
9dddbbb
534803c
8f642dc
6a53ea4
d981660
45e70b2
f35fbb5
71a1c5e
db1643e
0ad0c70
2b17c07
5a9f78e
391cfb5
90be1da
08c7004
8d19e0b
92b01e1
e0bd991
f70cf01
285f314
a7b73e8
caaeec0
191603a
9d1b088
3c51361
8094149
3d57fd4
0c64e60
3844b3d
2edd22e
92cadc0
c4c4b56
b4dfe5c
eef17cc
48e5650
0d06f32
fa1c55b
7266c38
2b614bd
5f5b06b
0c292c3
95e3ba1
3a78681
6358162
f86d0fc
a1b818f
09e7d67
7842ac7
c17433c
dd64551
78c1a1b
5dd322e
f070d7f
137198e
4a8894d
1dd0dbf
29f5daa
3011ba8
9a8c19b
988a920
d03c752
53770c0
6d411c0
d93bf05
c268757
ae50cbe
4d8268b
d02984e
79a7a21
a1c1eb3
7543b84
ecc306d
d59f24c
9b41a70
26e46a9
58c0239
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,10 @@ | |
"message": "Add Style", | ||
"description": "Title of the page for adding styles" | ||
}, | ||
"alphaChannel": { | ||
"message": "Opacity", | ||
"description": "Label of color's opacity" | ||
}, | ||
"appliesAdd": { | ||
"message": "Add", | ||
"description": "Label for the button to add an 'applies' entry" | ||
|
@@ -36,6 +40,14 @@ | |
"message": "Applies to", | ||
"description": "Label for 'applies to' fields on the edit/add screen" | ||
}, | ||
"appliesLineWidgetLabel": { | ||
"message": "Display 'Applies to' info", | ||
"description": "Label for the checkbox to display applies-to information in the single editor" | ||
}, | ||
"appliesLineWidgetWarning": { | ||
"message": "Does not work with minified CSS", | ||
"description": "A warning that applies-to information won't show properly with minified CSS" | ||
}, | ||
"appliesRegexpOption": { | ||
"message": "URLs matching the regexp", | ||
"description": "Option to make the style apply to the entered string as a regular expression" | ||
|
@@ -64,6 +76,10 @@ | |
"message": "Apply all updates", | ||
"description": "Label for the button to apply all detected updates" | ||
}, | ||
"author": { | ||
"message": "Author", | ||
"description": "Label for the style author" | ||
}, | ||
"backupButtons": { | ||
"message": "Backup", | ||
"description": "Heading for backup" | ||
|
@@ -83,6 +99,10 @@ | |
"updateCheckHistory": { | ||
"message": "History of update checks" | ||
}, | ||
"configureStyle": { | ||
"message": "Configure", | ||
"description": "Label for the button to configure userstyle" | ||
}, | ||
"checkForUpdate": { | ||
"message": "Check for update", | ||
"description": "Label for the button to check a single style for an update" | ||
|
@@ -167,6 +187,14 @@ | |
"message": "No", | ||
"description": "'No' button in a confirm dialog" | ||
}, | ||
"confirmDefault": { | ||
"message": "Use default", | ||
"description": "'Set to default' button in a confirm dialog" | ||
}, | ||
"confirmSave": { | ||
"message": "Save", | ||
"description": "'Save' button in a confirm dialog" | ||
}, | ||
"confirmStop": { | ||
"message": "Stop", | ||
"description": "'Stop' button in a confirm dialog" | ||
|
@@ -175,6 +203,10 @@ | |
"message": "Yes", | ||
"description": "'Yes' button in a confirm dialog" | ||
}, | ||
"confirmClose": { | ||
"message": "Close", | ||
"description": "'Close' button in a confirm dialog" | ||
}, | ||
"dbError": { | ||
"message": "An error has occurred using the Stylus database. Would you like to visit a web page with possible solutions?", | ||
"description": "Prompt when a DB error is encountered" | ||
|
@@ -257,6 +289,26 @@ | |
"message": "Export", | ||
"description": "Label for the button to export a style ('edit' page) or all styles ('manage' page)" | ||
}, | ||
"externalLink": { | ||
"message": "External link", | ||
"description": "Label for external links" | ||
}, | ||
"externalHomepage": { | ||
"message": "Homepage", | ||
"description": "Label for the external link to style's homepage" | ||
}, | ||
"externalSupport": { | ||
"message": "Support", | ||
"description": "Label for the external link to style's support site" | ||
}, | ||
"externalFeedback": { | ||
"message": "Feedback", | ||
"description": "Label for the external link to send feedback for the style" | ||
}, | ||
"externalUsercssDocument": { | ||
"message": "Documentation for Usercss", | ||
"description": "Label for the external link to usercss documentation" | ||
}, | ||
"filteredStyles": { | ||
"message": "$numShown$ shown of $numTotal$ total", | ||
"description": "TL note - make this message short", | ||
|
@@ -345,10 +397,48 @@ | |
"message": "Discard contents of current style and overwrite it with the imported style", | ||
"description": "Label for the button to import and overwrite current style" | ||
}, | ||
"installButton": { | ||
"message": "Install", | ||
"description": "Label for install button" | ||
}, | ||
"installButtonInstalled": { | ||
"message": "Installed", | ||
"description": "Text displayed when the style is successfully installed" | ||
}, | ||
"installButtonUpdate": { | ||
"message": "Update", | ||
"description": "Label for update button" | ||
}, | ||
"installButtonReinstall": { | ||
"message": "Reinstall", | ||
"description": "Label for reinstall button" | ||
}, | ||
"installUpdate": { | ||
"message": "Install update", | ||
"description": "Label for the button to install an update for a single style" | ||
}, | ||
"installUpdateFrom": { | ||
"message": "Currently the style is updated from $url$", | ||
"description": "Label to describe where the style gets update", | ||
"placeholders": { | ||
"url": { | ||
"content": "$1" | ||
} | ||
} | ||
}, | ||
"installUpdateFromLabel": { | ||
"message": "Install update from $url$", | ||
"description": "Label for the checkbox to save current URL for update check", | ||
"placeholders": { | ||
"url": { | ||
"content": "$1" | ||
} | ||
} | ||
}, | ||
"license": { | ||
"message": "License", | ||
"description": "Label for the license" | ||
}, | ||
"linterConfigPopupTitle": { | ||
"message": "Set $linter$ rules configuration", | ||
"description": "Stylelint or CSSLint popup header", | ||
|
@@ -366,6 +456,15 @@ | |
"message": "(Set rule as: 0 = disabled; 1 = warning; 2 = error)", | ||
"description": "CSSLint rule config values" | ||
}, | ||
"linterCSSLintIncompatible": { | ||
"message": "CSSLint doesn't support $preprocessorname$ preprocessor", | ||
"description": "The label to display when the preprocessor isn't compatible with CSSLint", | ||
"placeholders": { | ||
"preprocessorname": { | ||
"content": "$1" | ||
} | ||
} | ||
}, | ||
"linterInvalidConfigError": { | ||
"message": "Not saved due to these invalid configuration settings:", | ||
"description": "Invalid linter config will show a message followed by a list of invalid entries" | ||
|
@@ -395,6 +494,10 @@ | |
"message": "See a full list of rules", | ||
"description": "Stylelint or CSSLint rules label added immediately before a link" | ||
}, | ||
"liveReloadLabel": { | ||
"message": "Live reload", | ||
"description": "The label of live-reload feature" | ||
}, | ||
"manageFilters": { | ||
"message": "Filters", | ||
"description": "Label for filters container" | ||
|
@@ -483,6 +586,10 @@ | |
"message": "More Options", | ||
"description": "Subheading for options section on manage page." | ||
}, | ||
"parseUsercssError": { | ||
"message": "Stylus failed to parse usercss:", | ||
"description": "The error message to show when stylus failed to parse usercss" | ||
}, | ||
"popupManageTooltip": { | ||
"message": "Shift-click or right-click opens manager with styles applicable for current site", | ||
"description": "Tooltip for the 'Manage' button in the popup." | ||
|
@@ -629,6 +736,56 @@ | |
} | ||
} | ||
}, | ||
"styleInstallOverwrite" : { | ||
"message": "'$stylename$' is already installed. Overwrite?\nVersion: $oldVersion$ -> $newVersion$", | ||
"description": "Confirmation when re-installing a style", | ||
"placeholders": { | ||
"stylename": { | ||
"content": "$1" | ||
}, | ||
"oldVersion": { | ||
"content": "$2" | ||
}, | ||
"newVersion": { | ||
"content": "$3" | ||
} | ||
} | ||
}, | ||
"styleInstallFailed": { | ||
"message": "Failed to install userstyle!\n$error$", | ||
"description": "Warning when installation failed", | ||
"placeholders": { | ||
"error": { | ||
"content": "$1" | ||
} | ||
} | ||
}, | ||
"styleMetaErrorCheckbox": { | ||
"message": "Invalid @var checkbox: value must be 0 or 1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These messages are used by usercss parser. Is it necessary to translate error messages? If not, we can remove them. Also note that errors from JSON parser is not translated, and errors thrown by CSSLint (moz-parser) or Stylus-lang preprocessor are not translatable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let them be. |
||
"description": "Error displayed when the value of @var checkbox is invalid" | ||
}, | ||
"styleMetaErrorColor": { | ||
"message": "$color$ is not a valid color", | ||
"description": "Error displayed when the value of @var color is invalid", | ||
"placeholders": { | ||
"color": { | ||
"content": "$1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
} | ||
} | ||
}, | ||
"styleMetaErrorSelectValueMismatch": { | ||
"message": "Invalid @select: value doesn't exist in the list", | ||
"description": "Error displayed when the value of @select is invalid" | ||
}, | ||
"styleMissingMeta": { | ||
"message": "Missing metadata @$key$", | ||
"description": "Error displayed when a mandatory metadata is missing", | ||
"placeholders": { | ||
"key": { | ||
"content": "$1" | ||
} | ||
} | ||
}, | ||
"styleMissingName": { | ||
"message": "Enter a name.", | ||
"description": "Error displayed when user saves without providing a name" | ||
|
@@ -645,6 +802,10 @@ | |
"message": "Mozilla Format", | ||
"description": "Heading for the section with buttons to import/export Mozilla format of the style" | ||
}, | ||
"styleFromMozillaFormatError": { | ||
"message": "Failed to import from Mozilla format", | ||
"description": "Label for the import error" | ||
}, | ||
"styleFromMozillaFormatPrompt": { | ||
"message": "Paste the Mozilla-format code", | ||
"description": "Prompt in the dialog displayed after clicking 'Import from Mozilla format' button" | ||
|
@@ -666,6 +827,10 @@ | |
} | ||
} | ||
}, | ||
"styleUpdateDiscardChanges": { | ||
"message": "The style is changed outside of the editor. Would you like to reload the style?", | ||
"description": "Confirmation to update the style in the editor" | ||
}, | ||
"stylusUnavailableForURL": { | ||
"message": "Stylus doesn't work on pages like this.", | ||
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect" | ||
|
@@ -743,6 +908,10 @@ | |
"message": "Updates installed:", | ||
"description": "Text that displays when an update is installed on options page. Followed by the number of currently installed updates." | ||
}, | ||
"versionInvalidOlder": { | ||
"message": "The version is older then installed style.", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. then -> than the |
||
"description": "Displayed when the version of style is older then installed one" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. then -> than the |
||
}, | ||
"writeStyleFor": { | ||
"message": "Write style for: ", | ||
"description": "Label for toolbar pop-up that precedes the links to write a new style" | ||
|
@@ -805,6 +974,9 @@ | |
"optionsAdvancedContextDelete": { | ||
"message": "Add 'Delete' in editor context menu" | ||
}, | ||
"optionsAdvancedNewStyleInUsercss": { | ||
"message": "Write new style as usercss" | ||
}, | ||
"optionsActions": { | ||
"message": "Actions" | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* global dbExec, getStyles, saveStyle */ | ||
/* global handleCssTransitionBug */ | ||
/* global usercssHelper openEditor */ | ||
'use strict'; | ||
|
||
// eslint-disable-next-line no-var | ||
|
@@ -302,6 +303,14 @@ function onRuntimeMessage(request, sender, sendResponse) { | |
saveStyle(request).then(sendResponse); | ||
return KEEP_CHANNEL_OPEN; | ||
|
||
case 'saveUsercss': | ||
usercssHelper.save(request, true).then(sendResponse); | ||
return KEEP_CHANNEL_OPEN; | ||
|
||
case 'buildUsercss': | ||
usercssHelper.build(request, true).then(sendResponse); | ||
return KEEP_CHANNEL_OPEN; | ||
|
||
case 'healthCheck': | ||
dbExec() | ||
.then(() => sendResponse(true)) | ||
|
@@ -313,5 +322,36 @@ function onRuntimeMessage(request, sender, sendResponse) { | |
.then(sendResponse) | ||
.catch(() => sendResponse(null)); | ||
return KEEP_CHANNEL_OPEN; | ||
|
||
case 'openUsercssInstallPage': | ||
usercssHelper.openInstallPage(sender.tab.id, request).then(sendResponse); | ||
return KEEP_CHANNEL_OPEN; | ||
|
||
case 'closeTab': | ||
closeTab(sender.tab.id, request).then(sendResponse); | ||
return KEEP_CHANNEL_OPEN; | ||
|
||
case 'openEditor': | ||
openEditor(request.id); | ||
return; | ||
} | ||
} | ||
|
||
function closeTab(tabId, request) { | ||
return new Promise(resolve => { | ||
if (request.tabId) { | ||
tabId = request.tabId; | ||
} | ||
chrome.tabs.remove(tabId, () => { | ||
const {lastError} = chrome.runtime; | ||
if (lastError) { | ||
resolve({ | ||
status: 'error', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not a simple boolean flag like |
||
error: lastError.message || String(lastError) | ||
}); | ||
return; | ||
} | ||
resolve({status: 'success'}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see above |
||
}); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ERROR
should match "error"... Or, actually I'm not sure if placeholders are case-insensitive. @tophf?