Compare commits

..

1 Commits

Author SHA1 Message Date
eight04
6e1bc133f0 WIP: refactor editor CSS 2021-12-10 04:44:44 +08:00
259 changed files with 21359 additions and 19540 deletions

View File

@ -24,9 +24,6 @@ If not, then provide details describing which page the feature will effect, e.g.
## Adding translations ## Adding translations
You can help us translate the extension on [Transifex](https://www.transifex.com/github-7/Stylus). You can help us translate the extension on [Transifex](https://www.transifex.com/github-7/Stylus).
Only the languages supported by the web store are allowed:
https://developer.chrome.com/docs/webstore/i18n/#localeTable
## Pull requests ## Pull requests

8
.gitignore vendored
View File

@ -1,8 +1,8 @@
*.zip
.DS_Store .DS_Store
.eslintcache pull_locales_login.rb
.transifexrc
.vscode .vscode
desktop.ini
node_modules/ node_modules/
yarn.lock yarn.lock
*.zip
.eslintcache
.transifexrc

View File

@ -50,7 +50,7 @@ Copyright © 2005-2014 [Jason Barnabe](jason.barnabe@gmail.com)
Current Stylus: Current Stylus:
Copyright © 2017-2022 [Stylus Team](https://github.com/openstyles/stylus/graphs/contributors) Copyright © 2017-2019 [Stylus Team](https://github.com/openstyles/stylus/graphs/contributors)
**[GNU GPLv3](./LICENSE)** **[GNU GPLv3](./LICENSE)**

View File

@ -58,12 +58,6 @@
"checkingForUpdate": { "checkingForUpdate": {
"message": "جارٍ البحث..." "message": "جارٍ البحث..."
}, },
"confirmDelete": {
"message": "حذف"
},
"confirmSave": {
"message": "حفظ"
},
"deleteStyleConfirm": { "deleteStyleConfirm": {
"message": "هل تريد بالتأكيد حذف هذا النمط؟" "message": "هل تريد بالتأكيد حذف هذا النمط؟"
}, },
@ -76,9 +70,6 @@
"disableStyleLabel": { "disableStyleLabel": {
"message": "تعطيل" "message": "تعطيل"
}, },
"editDeleteText": {
"message": "حذف"
},
"editStyleHeading": { "editStyleHeading": {
"message": "تعديل النمط" "message": "تعديل النمط"
}, },
@ -96,11 +87,8 @@
"enableStyleLabel": { "enableStyleLabel": {
"message": "تمكين" "message": "تمكين"
}, },
"genericAdd": { "findStylesForSite": {
"message": "إضافة" "message": "البحث عن المزيد من الأنماط لموقع الويب هذا"
},
"genericEnabledLabel": {
"message": "ممكّن"
}, },
"helpAlt": { "helpAlt": {
"message": "مساعدة" "message": "مساعدة"
@ -117,9 +105,6 @@
"openManage": { "openManage": {
"message": "إدارة الأنماط المثبتة" "message": "إدارة الأنماط المثبتة"
}, },
"optionsSyncUrl": {
"message": "عنوان URL"
},
"sectionAdd": { "sectionAdd": {
"message": "إضافة قسم آخر" "message": "إضافة قسم آخر"
}, },
@ -129,9 +114,6 @@
"sectionRemove": { "sectionRemove": {
"message": "إزالة القسم" "message": "إزالة القسم"
}, },
"sections": {
"message": "الأقسام"
},
"styleCancelEditLabel": { "styleCancelEditLabel": {
"message": "رجوع للإدارة" "message": "رجوع للإدارة"
}, },

View File

@ -52,6 +52,9 @@
"backupButtons": { "backupButtons": {
"message": "Резервни копия" "message": "Резервни копия"
}, },
"backupMessage": {
"message": "Изберете файл или го влачете до страницата."
},
"bckpInstStyles": { "bckpInstStyles": {
"message": "Изнасяне на стилове" "message": "Изнасяне на стилове"
}, },
@ -112,9 +115,6 @@
"confirmOK": { "confirmOK": {
"message": "Добре" "message": "Добре"
}, },
"confirmSave": {
"message": "Запазване"
},
"confirmStop": { "confirmStop": {
"message": "Спиране" "message": "Спиране"
}, },
@ -171,15 +171,12 @@
"exportLabel": { "exportLabel": {
"message": "Изнасяне" "message": "Изнасяне"
}, },
"genericAdd": { "findStylesForSite": {
"message": "Добавяне" "message": "Още стилове за този сайт"
}, },
"genericDisabledLabel": { "genericDisabledLabel": {
"message": "Изключено" "message": "Изключено"
}, },
"genericEnabledLabel": {
"message": "Включено"
},
"genericHistoryLabel": { "genericHistoryLabel": {
"message": "Хронология" "message": "Хронология"
}, },
@ -263,6 +260,9 @@
"manageFaviconsGray": { "manageFaviconsGray": {
"message": "Сиви" "message": "Сиви"
}, },
"manageFaviconsHelp": {
"message": "Разширението използва външна услуга https://www.google.com/s2/favicons"
},
"manageFilters": { "manageFilters": {
"message": "Филтри" "message": "Филтри"
}, },
@ -299,9 +299,6 @@
"openManage": { "openManage": {
"message": "Управление" "message": "Управление"
}, },
"openOptions": {
"message": "Настройки"
},
"openStylesManager": { "openStylesManager": {
"message": "Управление на стиловете" "message": "Управление на стиловете"
}, },
@ -368,9 +365,6 @@
"optionsSubheading": { "optionsSubheading": {
"message": "Още настройки" "message": "Още настройки"
}, },
"optionsSyncUrl": {
"message": "Адрес"
},
"optionsUpdateImportNote": { "optionsUpdateImportNote": {
"message": "При внасянето на резервни копия от стари версии или от Стайлиш направете ръчна проверка за обновления, за да сте сигурни, че стиловете са актуални." "message": "При внасянето на резервни копия от стари версии или от Стайлиш направете ръчна проверка за обновления, за да сте сигурни, че стиловете са актуални."
}, },
@ -407,9 +401,6 @@
"sectionRemove": { "sectionRemove": {
"message": "Премахване на отдела" "message": "Премахване на отдела"
}, },
"sections": {
"message": "Отдели"
},
"shortcuts": { "shortcuts": {
"message": "Клавишни комбинации" "message": "Клавишни комбинации"
}, },
@ -463,6 +454,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "Брой на неприложените отдели поради неправилно използване на регулярни изрази" "message": "Брой на неприложените отдели поради неправилно използване на регулярни изрази"
}, },
"styleRegexpTestButton": {
"message": "Тест на регулярния израз"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "Съвпадащи подпрозорци" "message": "Съвпадащи подпрозорци"
}, },

View File

@ -67,6 +67,9 @@
"backupButtons": { "backupButtons": {
"message": "Zálohovat" "message": "Zálohovat"
}, },
"backupMessage": {
"message": "Vyberte soubor nebo ho přetáhněte na tuto stránku."
},
"bckpInstStyles": { "bckpInstStyles": {
"message": "Exportovat styly" "message": "Exportovat styly"
}, },
@ -272,6 +275,15 @@
"findStyles": { "findStyles": {
"message": "Najít styly" "message": "Najít styly"
}, },
"findStylesForSite": {
"message": "Najít styly pro tento web"
},
"findStylesInline": {
"message": "Zobrazit zde"
},
"findStylesInlineTooltip": {
"message": "Zobrazit výsledky vyhledávání v tomto okně."
},
"genericAdd": { "genericAdd": {
"message": "Přidat" "message": "Přidat"
}, },
@ -461,7 +473,7 @@
"message": "Zešednutí" "message": "Zešednutí"
}, },
"manageFaviconsHelp": { "manageFaviconsHelp": {
"message": "Stylus používá externí službu https://icons.duckduckgo.com" "message": "Stylus používá externí službu https://www.google.com/s2/favicons"
}, },
"manageFilters": { "manageFilters": {
"message": "Filtry" "message": "Filtry"
@ -505,9 +517,6 @@
"menuShowBadge": { "menuShowBadge": {
"message": "Zobrazit počet aktivních stylů" "message": "Zobrazit počet aktivních stylů"
}, },
"meta_invalidCheckboxDefault": {
"message": "Neplatný @var checkbox: hodnota musí být 0 nebo 1"
},
"meta_invalidNumber": { "meta_invalidNumber": {
"message": "Očekáváno číslo" "message": "Očekáváno číslo"
}, },
@ -553,9 +562,6 @@
"openManage": { "openManage": {
"message": "Spravovat" "message": "Spravovat"
}, },
"openOptions": {
"message": "Možnosti"
},
"openStylesManager": { "openStylesManager": {
"message": "Otevřít správce stylů" "message": "Otevřít správce stylů"
}, },
@ -625,9 +631,6 @@
"optionsSubheading": { "optionsSubheading": {
"message": "Další možnosti" "message": "Další možnosti"
}, },
"optionsSyncUrl": {
"message": "URL adresa"
},
"optionsUpdateImportNote": { "optionsUpdateImportNote": {
"message": "Importujete-li zálohy stylů ze starší verze nebo z rozšíření Stylish, proveďte jednorázovou ruční kontrolu aktualizací ve správci stylů, aby byly všechny styly aktuální." "message": "Importujete-li zálohy stylů ze starší verze nebo z rozšíření Stylish, proveďte jednorázovou ruční kontrolu aktualizací ve správci stylů, aby byly všechny styly aktuální."
}, },
@ -742,9 +745,6 @@
"sectionRestore": { "sectionRestore": {
"message": "Obnovit odstraněnou sekci" "message": "Obnovit odstraněnou sekci"
}, },
"sections": {
"message": "Sekce"
},
"shortcuts": { "shortcuts": {
"message": "Zkratky" "message": "Zkratky"
}, },
@ -844,6 +844,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "Počet sekcí nepoužitých kvůli nesprávnému použití „regexp()“" "message": "Počet sekcí nepoužitých kvůli nesprávnému použití „regexp()“"
}, },
"styleRegexpTestButton": {
"message": "Otestovat RegExp"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "Odpovídající listy" "message": "Odpovídající listy"
}, },
@ -912,9 +915,6 @@
"unreachableFileHint": { "unreachableFileHint": {
"message": "Stylus může přistupovat k file:// URL pouze při povolení odpovídající možnosti pro rozšíření Stylus ve správci chrome://extensions." "message": "Stylus může přistupovat k file:// URL pouze při povolení odpovídající možnosti pro rozšíření Stylus ve správci chrome://extensions."
}, },
"unreachableMozSiteHintOldFF": {
"message": "Pouze Firefox 59 a novější může být nakonfigurován tak, aby rozšíření typu WebExtensions mohla přidávat styly na stránky chráněné CSP (Content Security Policy) jako je tato."
},
"unzipStyles": { "unzipStyles": {
"message": "Rozbalování stylů…" "message": "Rozbalování stylů…"
}, },
@ -974,6 +974,9 @@
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "Nahradit výchozí šablonu pro nové Usercss styly aktuálním kódem?" "message": "Nahradit výchozí šablonu pro nové Usercss styly aktuálním kódem?"
}, },
"usercssReplaceTemplateName": {
"message": "Prázdné @name nahrazuje výchozí šablonu"
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "Sem vložte kód…" "message": "Sem vložte kód…"
}, },

View File

@ -58,6 +58,9 @@
"author": { "author": {
"message": "Forfatter" "message": "Forfatter"
}, },
"backupMessage": {
"message": "Vælg en fil eller træk og slip til denne side."
},
"bckpInstStyles": { "bckpInstStyles": {
"message": "Eksportér stil" "message": "Eksportér stil"
}, },
@ -93,8 +96,5 @@
}, },
"cm_keyMap": { "cm_keyMap": {
"message": "Tastegenveje" "message": "Tastegenveje"
},
"genericAdd": {
"message": "Tilføj"
} }
} }

View File

@ -68,7 +68,7 @@
"message": "Datensicherung" "message": "Datensicherung"
}, },
"backupMessage": { "backupMessage": {
"message": "Um die Backupdatei zu importieren, ziehe sie in diese Seite oder klicke auf die Import-Schaltfläche.\n\nZum Exportieren einer mit Stylus 1.5.18 (und älter) kompatiblen Backupdatei, rechtsklicke oder Shift-klicke auf die Export-Schaltfläche." "message": "Wähle eine Datei aus oder ziehe die Datei auf diese Seite. (Drag and Drop)"
}, },
"bckpInstStyles": { "bckpInstStyles": {
"message": "Styles exportieren" "message": "Styles exportieren"
@ -223,23 +223,9 @@
"disableAllStyles": { "disableAllStyles": {
"message": "Alle Styles deaktivieren" "message": "Alle Styles deaktivieren"
}, },
"disableAllStylesOff": {
"message": "Styles sind ausgeschaltet"
},
"disableStyleLabel": { "disableStyleLabel": {
"message": "Deaktivieren" "message": "Deaktivieren"
}, },
"draftAction": {
"message": "Wähle \"Ja\", um diesen Entwurf zu laden oder \"Nein\", um ihn zu verwerfen."
},
"draftTitle": {
"message": "Wiederherstellung ungespeicherter Entwürfe, erstellt vor $date$",
"placeholders": {
"date": {
"content": "$1"
}
}
},
"dragDropMessage": { "dragDropMessage": {
"message": "Ziehe die Backup Datei zum importieren an irgendeinen Ort auf dieser Seite." "message": "Ziehe die Backup Datei zum importieren an irgendeinen Ort auf dieser Seite."
}, },
@ -266,9 +252,6 @@
} }
} }
}, },
"editorSettings": {
"message": "Editor Einstellungen"
},
"enableStyleLabel": { "enableStyleLabel": {
"message": "Aktivieren" "message": "Aktivieren"
}, },
@ -278,9 +261,6 @@
"excludeStyleByUrlLabel": { "excludeStyleByUrlLabel": {
"message": "Aktuelle URL ausschließen" "message": "Aktuelle URL ausschließen"
}, },
"exportCompatible": {
"message": "Exportieren (Kompatibilitätsmodus)"
},
"exportLabel": { "exportLabel": {
"message": "Exportieren" "message": "Exportieren"
}, },
@ -313,6 +293,15 @@
"findStyles": { "findStyles": {
"message": "Styles finden" "message": "Styles finden"
}, },
"findStylesForSite": {
"message": "Weitere Styles für diese Seite finden"
},
"findStylesInline": {
"message": "Ergebnisse hier anzeigen"
},
"findStylesInlineTooltip": {
"message": "Suchergebnisse in diesem Fenster anzeigen."
},
"genericAdd": { "genericAdd": {
"message": "Hinzufügen" "message": "Hinzufügen"
}, },
@ -346,9 +335,6 @@
"genericSavedMessage": { "genericSavedMessage": {
"message": "Gespeichert" "message": "Gespeichert"
}, },
"genericSize": {
"message": "Größe"
},
"genericTitle": { "genericTitle": {
"message": "Name" "message": "Name"
}, },
@ -358,9 +344,6 @@
"gettingStyles": { "gettingStyles": {
"message": "Empfange alle Styles..." "message": "Empfange alle Styles..."
}, },
"headerResizerHint": {
"message": "Halte Shift gedrückt, um nur diese Art der Benutzeroberfläche (z.B. Editor, Manager, Installer) zu verändern"
},
"helpAlt": { "helpAlt": {
"message": "Hilfe" "message": "Hilfe"
}, },
@ -535,7 +518,7 @@
"message": "Ausgegraut" "message": "Ausgegraut"
}, },
"manageFaviconsHelp": { "manageFaviconsHelp": {
"message": "Stylus nutzt hierzu den externen Dienst https://icons.duckduckgo.com" "message": "Stylus nutzt hierzu den externen Dienst https://www.google.com/s2/favicons"
}, },
"manageFilters": { "manageFilters": {
"message": "Filter" "message": "Filter"
@ -546,9 +529,6 @@
"manageMaxTargets": { "manageMaxTargets": {
"message": "Anzahl der \"Gilt für\" Elemente" "message": "Anzahl der \"Gilt für\" Elemente"
}, },
"manageMinColumnWidth": {
"message": "Minimale Spaltenbreite (in Pixeln. 9999 deaktiviert den Mehrspalten-Modus)"
},
"manageNewStyleAsUsercss": { "manageNewStyleAsUsercss": {
"message": "als UserCSS" "message": "als UserCSS"
}, },
@ -798,15 +778,6 @@
"optionsAdvanced": { "optionsAdvanced": {
"message": "Erweitert" "message": "Erweitert"
}, },
"optionsAdvancedAutoSwitchSchemeBySystem": {
"message": "Nach Systemeinstellung"
},
"optionsAdvancedAutoSwitchSchemeByTime": {
"message": "Bei Nacht:"
},
"optionsAdvancedAutoSwitchSchemeNever": {
"message": "Deaktiviert. Die hell / dunkel Einstellung in Styles wird ignoriert."
},
"optionsAdvancedContextDelete": { "optionsAdvancedContextDelete": {
"message": "\"Löschen\" im Editor-Kontextmenü hinzufügen" "message": "\"Löschen\" im Editor-Kontextmenü hinzufügen"
}, },
@ -816,17 +787,11 @@
"optionsAdvancedExposeIframesNote": { "optionsAdvancedExposeIframesNote": {
"message": "Style wirkt sich auch auf iframes der anvisierten (obersten) Domain aus.\nIframe-spezifisches CSS ist dann wie folgt möglich:\nhtml[stylus-iframe$$=\"twitter.com\"] h1 { display:none }" "message": "Style wirkt sich auch auf iframes der anvisierten (obersten) Domain aus.\nIframe-spezifisches CSS ist dann wie folgt möglich:\nhtml[stylus-iframe$$=\"twitter.com\"] h1 { display:none }"
}, },
"optionsAdvancedExposeStyleName": {
"message": "Stylename anzeigen"
},
"optionsAdvancedExposeStyleNameNote": {
"message": "Zeigt den Stylenamen auf der Seite an, um das Debuggen von Styles in den Devtools zu erleichtern. Bitte lade die Tabs neu, um die neue Einstellung zu übernehmen."
},
"optionsAdvancedNewStyleAsUsercss": { "optionsAdvancedNewStyleAsUsercss": {
"message": "Schreibe neuen Style als UserCSS" "message": "Schreibe neuen Style als UserCSS"
}, },
"optionsAdvancedPatchCsp": { "optionsAdvancedPatchCsp": {
"message": "<code>CSP</code> abändern, um externe Ressourcen zu erlauben" "message": "<code>CSP</code>abändern, um externe Ressourcen zu erlauben"
}, },
"optionsAdvancedPatchCspNote": { "optionsAdvancedPatchCspNote": {
"message": "Aktivieren, wenn Styles Bilder oder Schriftarten enthalten, die aufgrund strenger <code>CSP</code> (<code>Content-Security-Policy</code>) Regeln mancher Seiten nicht laden.\n\nDas Aktivieren wird <code>CSP</code>Beschränkungen lockern, um für den Style erforderliche Ressourcen zu laden. Diese Option ist für fortgeschrittene Benutzer gedacht, die sich den möglichen Sicherheitsrisiken bewusst sind und die die Verantwortung dafür tragen, die nachgeladenen Inhalte selbst zu überwachen. Informiere dich über \"CSS-basierte Angriffe\" um mehr zu erfahren.\n\nBeachte außerdem, dass diese Option nicht garantiert funktioniert, falls eine andere installierte Erweiterung die Netzwerkantwort (CSP-header) zuerst abändert." "message": "Aktivieren, wenn Styles Bilder oder Schriftarten enthalten, die aufgrund strenger <code>CSP</code> (<code>Content-Security-Policy</code>) Regeln mancher Seiten nicht laden.\n\nDas Aktivieren wird <code>CSP</code>Beschränkungen lockern, um für den Style erforderliche Ressourcen zu laden. Diese Option ist für fortgeschrittene Benutzer gedacht, die sich den möglichen Sicherheitsrisiken bewusst sind und die die Verantwortung dafür tragen, die nachgeladenen Inhalte selbst zu überwachen. Informiere dich über \"CSS-basierte Angriffe\" um mehr zu erfahren.\n\nBeachte außerdem, dass diese Option nicht garantiert funktioniert, falls eine andere installierte Erweiterung die Netzwerkantwort (CSP-header) zuerst abändert."
@ -861,9 +826,6 @@
"optionsHeading": { "optionsHeading": {
"message": "Optionen" "message": "Optionen"
}, },
"optionsIconAuto": {
"message": "An Hell- / Dunkelmodus angleichen"
},
"optionsIconDark": { "optionsIconDark": {
"message": "Dunkle Browser-Themes" "message": "Dunkle Browser-Themes"
}, },
@ -886,7 +848,7 @@
"message": "Optionen zurücksetzen" "message": "Optionen zurücksetzen"
}, },
"optionsStylusThemes": { "optionsStylusThemes": {
"message": "Klicke auf einer beliebigen Stylus Seite auf das Stylus-Symbol in der Werkzeugleiste des Browsers, dann klicke auf \"Styles finden\"" "message": "Stylus UI-Theme suchen"
}, },
"optionsSubheading": { "optionsSubheading": {
"message": "Mehr Optionen" "message": "Mehr Optionen"
@ -903,9 +865,6 @@
"optionsSyncNone": { "optionsSyncNone": {
"message": "Nichts" "message": "Nichts"
}, },
"optionsSyncPassword": {
"message": "Passwort"
},
"optionsSyncStatusConnected": { "optionsSyncStatusConnected": {
"message": "Verbunden" "message": "Verbunden"
}, },
@ -949,9 +908,6 @@
"optionsSyncSyncNow": { "optionsSyncSyncNow": {
"message": "Jetzt synchronisieren" "message": "Jetzt synchronisieren"
}, },
"optionsSyncUsername": {
"message": "Benutzername"
},
"optionsUpdateImportNote": { "optionsUpdateImportNote": {
"message": "Nach dem Importieren von Styles aus einer alten Version oder von Stylish ist eine einmalige manuelle Updatesuche in der Verwaltung nötig. Dies stellt sicher, dass alle Styles auf dem aktuellsten Stand sind." "message": "Nach dem Importieren von Styles aus einer alten Version oder von Stylish ist eine einmalige manuelle Updatesuche in der Verwaltung nötig. Dies stellt sicher, dass alle Styles auf dem aktuellsten Stand sind."
}, },
@ -994,9 +950,6 @@
"popupHotkeysTooltip": { "popupHotkeysTooltip": {
"message": "Klicke, um Tastenkürzel zu sehen" "message": "Klicke, um Tastenkürzel zu sehen"
}, },
"popupManageSiteStyles": {
"message": "Styles dieser Seite verwalten"
},
"popupManageTooltip": { "popupManageTooltip": {
"message": "Shift+Klick oder Rechtsklick öffnet den Stylemanager mit Filter für Styles der aktuellen Seite" "message": "Shift+Klick oder Rechtsklick öffnet den Stylemanager mit Filter für Styles der aktuellen Seite"
}, },
@ -1018,21 +971,6 @@
"prefShowBadge": { "prefShowBadge": {
"message": "Anzahl der aktiven Styles auf der aktuellen Seite" "message": "Anzahl der aktiven Styles auf der aktuellen Seite"
}, },
"preferScheme": {
"message": "Hell- / Dunkelmodus Vorrang"
},
"preferSchemeAlways": {
"message": "Derzeit ignoriert (Style wird immer angewendet), weil der allgemeine Hell- / Dunkelmodus nicht aktiv ist"
},
"preferSchemeDark": {
"message": "Dunkel"
},
"preferSchemeLight": {
"message": "Hell"
},
"preferSchemeNone": {
"message": "Keines (immer aktiv)"
},
"previewLabel": { "previewLabel": {
"message": "Echtzeitvorschau" "message": "Echtzeitvorschau"
}, },
@ -1061,7 +999,7 @@
"message": "Lese Styles..." "message": "Lese Styles..."
}, },
"reload": { "reload": {
"message": "Neu laden" "message": "Stylus Addon neu laden"
}, },
"replace": { "replace": {
"message": "Ersetzen" "message": "Ersetzen"
@ -1072,15 +1010,9 @@
"replaceWith": { "replaceWith": {
"message": "Ersetzen durch" "message": "Ersetzen durch"
}, },
"restoreTemplate": {
"message": "Standard-Template wiederherstellen.\n\n(Die gerade geöffneten Editorseiten werden nicht verändert.)"
},
"retrieveBckp": { "retrieveBckp": {
"message": "Styles importieren" "message": "Styles importieren"
}, },
"saveAsTemplate": {
"message": "Als Template speichern"
},
"search": { "search": {
"message": "Suche" "message": "Suche"
}, },
@ -1121,7 +1053,7 @@
"message": "Wöchentliche Installationen" "message": "Wöchentliche Installationen"
}, },
"searchStyleQueryHint": { "searchStyleQueryHint": {
"message": "Stylenamen durchsuchen (Groß-Kleinschreibung wird beachtet, sobald ein Großbuchstabe benutzt wird):\nHaus Baum Sonne - sucht nach allen Wörtern in beliebiger Reihenfolge\n\"Baum Haus\" - sucht exakt diesen Ausdruck (ohne Anführungszeichen)\n/foo.*bar/i - Regulärer Ausdruck ohne Leerzeichen (nutze stattdessen \\s)" "message": "Stylenamen ohne Beachtung der Groß-/Kleinschreibung suchen:\nMehrere Suchworte - alle Wörter in beliebiger Reihenfolge\n\"Bestimmte Phrase\" - genau diese Phrase ohne Anführungszeichen\n2020 - zeigt auch Styles, die 2020 aktualisiert wurden"
}, },
"searchStylesAll": { "searchStylesAll": {
"message": "Alles" "message": "Alles"
@ -1150,18 +1082,12 @@
"sections": { "sections": {
"message": "Bereiche" "message": "Bereiche"
}, },
"settings": {
"message": "Einstellungen"
},
"shortcuts": { "shortcuts": {
"message": "Tastenkürzel" "message": "Tastenkürzel"
}, },
"shortcutsNote": { "shortcutsNote": {
"message": "Eine Tastenkombination definieren" "message": "Eine Tastenkombination definieren"
}, },
"shortcutsNoteFF": {
"message": "In Firefox 66+ kannst du die eingebaute Tastenkürzelverwaltung selbst öffnen:\n1) Rechtsklicke das Stylus-Symbol in der Werkzeugleiste und wähle \"Erweiterung verwalten\". Alternativ kannst du about:addons über das Hauptmenü oder per Tastenkürzel Strg-Umschalt-A öffnen.\n2) Klicke auf der geöffneten Seite (about:addons) auf das Zahnrad oben rechts.\n3) Wähle \"Tastenkombinationen von Erweiterungen verwalten\".\n\nHier kannst du alle Tastenkürzel individuell anpassen."
},
"sortDateNewestFirst": { "sortDateNewestFirst": {
"message": "neueste zuerst" "message": "neueste zuerst"
}, },
@ -1207,30 +1133,12 @@
"styleEnabledLabel": { "styleEnabledLabel": {
"message": "Aktiviert" "message": "Aktiviert"
}, },
"styleExcludeLabel": {
"message": "Benutzerdefinierte ausgeschlossene URLs"
},
"styleFromMozillaFormatError": { "styleFromMozillaFormatError": {
"message": "Import vom Mozilla Format fehlgeschlagen" "message": "Import vom Mozilla Format fehlgeschlagen"
}, },
"styleFromMozillaFormatPrompt": { "styleFromMozillaFormatPrompt": {
"message": "Mozilla-Format Code einfügen" "message": "Mozilla-Format Code einfügen"
}, },
"styleIncludeLabel": {
"message": "Benutzerdefinierte Ziel-URLs"
},
"styleInjectionImportance": {
"message": "Style als wichtig markieren"
},
"styleInjectionOrder": {
"message": "Applikationsreihenfolge der Styles"
},
"styleInjectionOrderHint": {
"message": "Ziehe den Style mit der Maus an die gewünschte Stelle, um die Applikationsreihenfolge zu ändern. Styles weiter unten können die oberen überschreiben."
},
"styleInjectionOrderHint_prio": {
"message": "Die unten als wichtig gekennzeichneten Styles werden immer zuletzt angewendet, sodass sie auch neu installierte Styles überschreiben können. Klicke auf das Zeichen des Styles, um die Wichtigkeit umzuschalten."
},
"styleInstall": { "styleInstall": {
"message": "\"$stylename$\" mit Stylus installieren?", "message": "\"$stylename$\" mit Stylus installieren?",
"placeholders": { "placeholders": {
@ -1270,15 +1178,6 @@
"styleNotAppliedRegexpProblemTooltip": { "styleNotAppliedRegexpProblemTooltip": {
"message": "Der Style wurde aufgrund ungültiger RegExp nicht angewandt." "message": "Der Style wurde aufgrund ungültiger RegExp nicht angewandt."
}, },
"styleNotAppliedSchemeDark": {
"message": "Der Style wird nur im dunklen Modus angewendet"
},
"styleNotAppliedSchemeLight": {
"message": "Der Style wird nur im hellen Modus angewendet"
},
"stylePreferSchemeLabel": {
"message": "Dunkler/Heller Modus"
},
"styleRegexpInvalidExplanation": { "styleRegexpInvalidExplanation": {
"message": "Einige RegExp konnten nicht kompiliert werden." "message": "Einige RegExp konnten nicht kompiliert werden."
}, },
@ -1288,6 +1187,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "Anzahl der Bereiche, welche aufgrund nicht korrekt verwendeter RegExp nicht angewendet wurden" "message": "Anzahl der Bereiche, welche aufgrund nicht korrekt verwendeter RegExp nicht angewendet wurden"
}, },
"styleRegexpTestButton": {
"message": "RegExp testen"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "Zutreffende Tabs" "message": "Zutreffende Tabs"
}, },
@ -1309,9 +1211,6 @@
"styleSaveLabel": { "styleSaveLabel": {
"message": "Speichern" "message": "Speichern"
}, },
"styleSettings": {
"message": "Style Einstellungen"
},
"styleToMozillaFormatHelp": { "styleToMozillaFormatHelp": {
"message": "Das Mozilla-Format des Codes kann mit Stylish für Firefox verwendet werden und bei userstyles.org eingereicht werden." "message": "Das Mozilla-Format des Codes kann mit Stylish für Firefox verwendet werden und bei userstyles.org eingereicht werden."
}, },
@ -1333,7 +1232,7 @@
"message": "Stylus funktioniert nicht auf Seiten wie diesen." "message": "Stylus funktioniert nicht auf Seiten wie diesen."
}, },
"stylusUnavailableForURLdetails": { "stylusUnavailableForURLdetails": {
"message": "Als Sicherheitsvorkehrung verbietet der Browser es Erweiterungen, seine eigenen Seiten (wie z.B. chrome://version oder about:addons) und eigene Seiten anderer Erweiterungen zu verändern. Auch die jeweils browser-eigene Erweiterungsgalerie (wie Chrome Web Store oder addons.mozilla.org) kann nicht verändert werden." "message": "Als Sicherheitsvorkehrung verbietet der Browser es Erweiterungen, seine eingebauten Seiten (wie chrome://version, dem neuen Standard-Tab ab Chrome 61, about:addons, usw.), sowie Seiten anderer Erweiterungen zu beeinflussen. Jeder Browser beschränkt auch den Zugriff auf seine eigene Erweiterungsgalerie (wie Chrome Web Store oder addons.mozilla.org)."
}, },
"syncDropboxDeprecated": { "syncDropboxDeprecated": {
"message": "Dropbox Import / Export wurde durch einen fortschrittlicheren Mechanismus auf der Optionsseite ersetzt." "message": "Dropbox Import / Export wurde durch einen fortschrittlicheren Mechanismus auf der Optionsseite ersetzt."
@ -1341,16 +1240,8 @@
"syncError": { "syncError": {
"message": "Synchronisation fehlgeschlagen" "message": "Synchronisation fehlgeschlagen"
}, },
"syncErrorLock": {
"message": "Die Datenbank wird bereits verwendet. Die Sperre wird um $TIME$ aufgehoben.",
"placeholders": {
"time": {
"content": "$1"
}
}
},
"syncErrorRelogin": { "syncErrorRelogin": {
"message": "Synchronisation erfolglos. Du wurdest ausgeloggt.\nVersuche, dich in den Stylus Einstellungen wieder einzuloggen." "message": "Synchronisation fehlgeschlagen.\nVersuche, dich in den Optionen neu einzuloggen:\nKlicke erst \"Trennen\", dann \"Verbinden\"."
}, },
"syncStorageErrorSaving": { "syncStorageErrorSaving": {
"message": "Der Wert kann nicht gespeichert werden. Versuche, die Textmenge zu reduzieren." "message": "Der Wert kann nicht gespeichert werden. Versuche, die Textmenge zu reduzieren."
@ -1441,6 +1332,9 @@
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "Ersetze das vorgegebene Template für neue UserCSS styles mit dem vorliegenden Code?" "message": "Ersetze das vorgegebene Template für neue UserCSS styles mit dem vorliegenden Code?"
}, },
"usercssReplaceTemplateName": {
"message": "Ein leeres @name ersetzt das vorgegebene Template"
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "Quelltext hier eingeben..." "message": "Quelltext hier eingeben..."
}, },

View File

@ -64,6 +64,9 @@
"backupButtons": { "backupButtons": {
"message": "Δημιουργήστε αντίγραφο ασφαλείας" "message": "Δημιουργήστε αντίγραφο ασφαλείας"
}, },
"backupMessage": {
"message": "Επιλέξτε ένα αρχείο ή σύρετέ το σε αυτήν τη σελίδα"
},
"bckpInstStyles": { "bckpInstStyles": {
"message": "Εξαγωγή στυλ" "message": "Εξαγωγή στυλ"
}, },
@ -298,6 +301,9 @@
"findStyles": { "findStyles": {
"message": "Εύρεση στυλ" "message": "Εύρεση στυλ"
}, },
"findStylesForSite": {
"message": "Αναζήτηση περισσότερων στυλ για αυτή την ιστοσελίδα"
},
"genericAdd": { "genericAdd": {
"message": "Προσθήκη" "message": "Προσθήκη"
}, },
@ -409,6 +415,9 @@
"linterResetMessage": { "linterResetMessage": {
"message": "Για αναίρεση μιας κατά λάθος επαναφοράς, πατήστε Ctrl-Z (ή Cmd-Z) στο πλαίσιο κειμένου" "message": "Για αναίρεση μιας κατά λάθος επαναφοράς, πατήστε Ctrl-Z (ή Cmd-Z) στο πλαίσιο κειμένου"
}, },
"manageFaviconsHelp": {
"message": "Το Stylus χρησιμοποιεί μία εξωτερική υπηρεσία https://www.google.com/s2/favicons"
},
"manageFilters": { "manageFilters": {
"message": "Φίλτρα" "message": "Φίλτρα"
}, },
@ -529,9 +538,6 @@
"optionsSyncSyncNow": { "optionsSyncSyncNow": {
"message": "Συγχρονισμός τώρα" "message": "Συγχρονισμός τώρα"
}, },
"optionsSyncUrl": {
"message": "διεύθυνση URL"
},
"optionsUpdateInterval": { "optionsUpdateInterval": {
"message": "Διάστημα αυτόματης ενημέρωσης των στυλ σε ώρες (0 για απενεργοποίηση)" "message": "Διάστημα αυτόματης ενημέρωσης των στυλ σε ώρες (0 για απενεργοποίηση)"
}, },
@ -604,9 +610,6 @@
"sectionRemove": { "sectionRemove": {
"message": "Αφαίρεση ενότητας" "message": "Αφαίρεση ενότητας"
}, },
"sections": {
"message": "Ενότητες"
},
"shortcuts": { "shortcuts": {
"message": "Συντομεύσεις" "message": "Συντομεύσεις"
}, },
@ -677,6 +680,9 @@
"syncError": { "syncError": {
"message": "Ο συγχρονισμός απέτυχε" "message": "Ο συγχρονισμός απέτυχε"
}, },
"syncErrorRelogin": {
"message": "Ο συγχρονισμός απέτυχε.\nΠροσπαθήστε να συνδεθείτε ξανά στις επιλογές Stylus:\nκάντε κλικ στο 'αποσύνδεση' πρώτα και μετά στο 'σύνδεση'."
},
"toggleStyle": { "toggleStyle": {
"message": "Αλλαγή στυλ" "message": "Αλλαγή στυλ"
}, },

View File

@ -93,8 +93,8 @@
"description": "Heading for backup" "description": "Heading for backup"
}, },
"backupMessage": { "backupMessage": {
"message": "To import the backup file, drag'n'drop it into this page or click the Import button.\n\nTo export a compatible backup for Stylus older than 1.5.18, right-click or shift-click the Export button.", "message": "Select a file or drag and drop to this page.",
"description": "Text for Backup section's (i) in the manager" "description": "Message for backup"
}, },
"bckpInstStyles": { "bckpInstStyles": {
"message": "Export styles" "message": "Export styles"
@ -186,10 +186,6 @@
"message": "Theme", "message": "Theme",
"description": "Label for the style editor's CSS theme." "description": "Label for the style editor's CSS theme."
}, },
"cm_arrowKeysTraverse": {
"message": "Arrow keys ↑↓ traverse sections",
"description": "Label for the option in the editor."
},
"colorpickerPaletteHint": { "colorpickerPaletteHint": {
"message": "Right-click a swatch to cycle through its source lines" "message": "Right-click a swatch to cycle through its source lines"
}, },
@ -340,29 +336,12 @@
}, },
"disableAllStyles": { "disableAllStyles": {
"message": "Turn all styles off", "message": "Turn all styles off",
"description": "Label for the checkbox that turns all styles off." "description": "Label for the checkbox that turns all enabled styles off."
},
"disableAllStylesOff": {
"message": "Styles are turned off",
"description": "Label for the checkbox that turns all styles off when it's checked."
}, },
"disableStyleLabel": { "disableStyleLabel": {
"message": "Disable", "message": "Disable",
"description": "Label for the button to disable a style" "description": "Label for the button to disable a style"
}, },
"draftTitle": {
"message": "Draft recovery, created $date$",
"placeholders": {
"date": {
"content": "$1"
}
},
"description": "Title of the modal displayed in the editor when an unsaved draft is found, the $date$ looks like '1 hour ago' in user's current UI language"
},
"draftAction": {
"message": "Choose 'Yes' to load this draft or 'No' to discard it.",
"description": "Displayed in the editor after the browser/extension crashed"
},
"dragDropMessage": { "dragDropMessage": {
"message": "Drop your backup file anywhere on this page to import.", "message": "Drop your backup file anywhere on this page to import.",
"description": "Drag'n'drop message" "description": "Drag'n'drop message"
@ -396,8 +375,11 @@
}, },
"description": "Title of the page for editing styles" "description": "Title of the page for editing styles"
}, },
"editorSettings": { "editorCodeLabel": {
"message": "Editor settings" "message": "Code"
},
"editorSettingLabel": {
"message": "Settings"
}, },
"enableStyleLabel": { "enableStyleLabel": {
"message": "Enable", "message": "Enable",
@ -413,9 +395,6 @@
"message": "Export", "message": "Export",
"description": "Label for the button to export a style ('edit' page) or all styles ('manage' page)" "description": "Label for the button to export a style ('edit' page) or all styles ('manage' page)"
}, },
"exportCompatible": {
"message": "Export (compatible mode)"
},
"exportSavedSuccess": { "exportSavedSuccess": {
"message": "File saved with success" "message": "File saved with success"
}, },
@ -459,6 +438,18 @@
"message": "Find styles", "message": "Find styles",
"description": "Text for a link that gets a list of styles for the current site" "description": "Text for a link that gets a list of styles for the current site"
}, },
"findStylesForSite": {
"message": "Find more styles for this site",
"description": "Text for a link that gets a list of styles for the current site"
},
"findStylesInline": {
"message": "Inline",
"description": "Text for a checkbox that opens search results 'inline' (within the Stylus popup window)"
},
"findStylesInlineTooltip": {
"message": "Display search results inside this window.",
"description": "Text for a checkbox that displays search results within the Stylus popup."
},
"genericAdd": { "genericAdd": {
"message": "Add", "message": "Add",
"description": "Used in various places for an action that adds something" "description": "Used in various places for an action that adds something"
@ -502,13 +493,6 @@
"message": "Saved", "message": "Saved",
"description": "Used in various parts of the UI to indicate that something was saved" "description": "Used in various parts of the UI to indicate that something was saved"
}, },
"genericSize": {
"message": "Size"
},
"genericTest": {
"message": "Test",
"description": "Label for the action that runs some test e.g. opens the regexp tester panel in the editor"
},
"genericTitle": { "genericTitle": {
"message": "Title", "message": "Title",
"description": "Used in various parts of the UI to indicate the title of something" "description": "Used in various parts of the UI to indicate the title of something"
@ -520,10 +504,6 @@
"gettingStyles": { "gettingStyles": {
"message": "Getting all styles..." "message": "Getting all styles..."
}, },
"headerResizerHint": {
"message": "Hold Shift to resize only in this type of UI, i.e. editor, manager, installer",
"description": "Tooltip for the header panel resizer"
},
"helpAlt": { "helpAlt": {
"message": "Help", "message": "Help",
"description": "Alternate text for help buttons" "description": "Alternate text for help buttons"
@ -622,6 +602,18 @@
"message": "Update style", "message": "Update style",
"description": "Label for update button" "description": "Label for update button"
}, },
"installPreferSchemeLabel": {
"message": "The style should be applied:"
},
"installPreferSchemeNone": {
"message": "Always"
},
"installPreferSchemeDark": {
"message": "In Dark Mode"
},
"installPreferSchemeLight": {
"message": "In Light Mode"
},
"installUpdate": { "installUpdate": {
"message": "Install update", "message": "Install update",
"description": "Label for the button to install an update for a single style" "description": "Label for the button to install an update for a single style"
@ -751,7 +743,7 @@
"description": "Label for the checkbox that toggles grayed out mode of applies-to favicons in the new UI on manage page" "description": "Label for the checkbox that toggles grayed out mode of applies-to favicons in the new UI on manage page"
}, },
"manageFaviconsHelp": { "manageFaviconsHelp": {
"message": "Stylus uses an external service https://icons.duckduckgo.com", "message": "Stylus uses an external service https://www.google.com/s2/favicons",
"description": "Label for the checkbox that toggles applies-to favicons in the new UI on manage page" "description": "Label for the checkbox that toggles applies-to favicons in the new UI on manage page"
}, },
"manageFilters": { "manageFilters": {
@ -766,9 +758,6 @@
"message": "Number of applies-to items", "message": "Number of applies-to items",
"description": "Label for the numeric input box to limit max number of applies-to targets in the new UI on manage page" "description": "Label for the numeric input box to limit max number of applies-to targets in the new UI on manage page"
}, },
"manageMinColumnWidth": {
"message": "Minimum column width (in pixels; 9999 disables multi-column mode)"
},
"manageNewStyleAsUsercss": { "manageNewStyleAsUsercss": {
"message": "as Usercss", "message": "as Usercss",
"description": "VERY SHORT label for the checkbox next to the 'Write new style' button in the style manager" "description": "VERY SHORT label for the checkbox next to the 'Write new style' button in the style manager"
@ -1079,17 +1068,14 @@
"message": "Exposes the top site domain in each iframe.\nEnables writing iframe-specific CSS like this:\nhtml[stylus-iframe$$=\"twitter.com\"] h1 { display:none }", "message": "Exposes the top site domain in each iframe.\nEnables writing iframe-specific CSS like this:\nhtml[stylus-iframe$$=\"twitter.com\"] h1 { display:none }",
"description": "Add attribute to iframe; make sure to include the double $$ in the css example, or the `$=` will be omitted in the displayed text." "description": "Add attribute to iframe; make sure to include the double $$ in the css example, or the `$=` will be omitted in the displayed text."
}, },
"optionsAdvancedExposeStyleName": {
"message": "Expose style name"
},
"optionsAdvancedExposeStyleNameNote": {
"message": "Exposes the style name in the page to facilitate debugging of styles in devtools. Please reload the tab(s) to apply the new setting."
},
"optionsAdvancedNewStyleAsUsercss": { "optionsAdvancedNewStyleAsUsercss": {
"message": "Write new style as usercss" "message": "Write new style as usercss"
}, },
"optionsAdvancedAutoSwitchScheme": {
"message": "Toggle Light/Dark Mode styles automatically"
},
"optionsAdvancedAutoSwitchSchemeNever": { "optionsAdvancedAutoSwitchSchemeNever": {
"message": "Disabled. The dark/light setting in styles is ignored." "message": "Never"
}, },
"optionsAdvancedAutoSwitchSchemeBySystem": { "optionsAdvancedAutoSwitchSchemeBySystem": {
"message": "By system preference" "message": "By system preference"
@ -1140,9 +1126,6 @@
"message": "Options", "message": "Options",
"description": "Heading for options section on manage page." "description": "Heading for options section on manage page."
}, },
"optionsIconAuto": {
"message": "Match the Dark/Light mode"
},
"optionsIconDark": { "optionsIconDark": {
"message": "Dark browser themes" "message": "Dark browser themes"
}, },
@ -1165,7 +1148,7 @@
"message": "Reset options" "message": "Reset options"
}, },
"optionsStylusThemes": { "optionsStylusThemes": {
"message": "Click Stylus icon in the browser toolbar on any Stylus page including this one, then click 'Find styles'" "message": "Find a Stylus UI theme"
}, },
"optionsSubheading": { "optionsSubheading": {
"message": "More Options", "message": "More Options",
@ -1217,15 +1200,6 @@
} }
} }
}, },
"optionsSyncUsername": {
"message": "Username"
},
"optionsSyncPassword": {
"message": "Password"
},
"optionsSyncUrl": {
"message": "URL"
},
"optionsSyncStatusRelogin": { "optionsSyncStatusRelogin": {
"message": "Session expired, please login again." "message": "Session expired, please login again."
}, },
@ -1285,10 +1259,6 @@
"message": "Click to see available hotkeys", "message": "Click to see available hotkeys",
"description": "Tooltip displayed when hovering the right edge of the extension popup" "description": "Tooltip displayed when hovering the right edge of the extension popup"
}, },
"popupManageSiteStyles": {
"message": "Manage site styles",
"description": "Item in the dropdown menu for the 'Manage' button in the popup that opens manager with styles applicable for current site."
},
"popupManageTooltip": { "popupManageTooltip": {
"message": "Shift-click or right-click opens manager with styles applicable for current site", "message": "Shift-click or right-click opens manager with styles applicable for current site",
"description": "Tooltip for the 'Manage' button in the popup." "description": "Tooltip for the 'Manage' button in the popup."
@ -1313,21 +1283,6 @@
"message": "Styles before commands", "message": "Styles before commands",
"description": "Label for the checkbox controlling section order in the popup." "description": "Label for the checkbox controlling section order in the popup."
}, },
"preferScheme": {
"message": "Dark/Light mode preference"
},
"preferSchemeAlways": {
"message": "Currently ignored (the style always applies) because the global Dark/Light mode is disabled"
},
"preferSchemeDark": {
"message": "Dark"
},
"preferSchemeLight": {
"message": "Light"
},
"preferSchemeNone": {
"message": "None (always applied)"
},
"prefShowBadge": { "prefShowBadge": {
"message": "Number of styles active for the current site", "message": "Number of styles active for the current site",
"description": "Label for the checkbox controlling toolbar badge text." "description": "Label for the checkbox controlling toolbar badge text."
@ -1366,8 +1321,8 @@
"message": "Reading styles..." "message": "Reading styles..."
}, },
"reload": { "reload": {
"message": "Reload", "message": "Reload Stylus extension",
"description": "Context menu to reload the extension when installed in developer mode" "description": "Context menu reload"
}, },
"replace": { "replace": {
"message": "Replace", "message": "Replace",
@ -1381,18 +1336,12 @@
"message": "Replace with", "message": "Replace with",
"description": "Label before the replace-with input field in the editor shown on Ctrl-H etc." "description": "Label before the replace-with input field in the editor shown on Ctrl-H etc."
}, },
"restoreTemplate": {
"message": "Restore the default template.\n\n(The currently open editor pages won't change.)"
},
"retrieveBckp": { "retrieveBckp": {
"message": "Import styles" "message": "Import styles"
}, },
"retrieveDropboxSync": { "retrieveDropboxSync": {
"message": "Dropbox Import" "message": "Dropbox Import"
}, },
"saveAsTemplate": {
"message": "Save as template"
},
"search": { "search": {
"message": "Search", "message": "Search",
"description": "Label before the search input field in the editor shown on Ctrl-F" "description": "Label before the search input field in the editor shown on Ctrl-F"
@ -1444,7 +1393,7 @@
"description": "Text for label that shows the number of times a search result was installed during last week" "description": "Text for label that shows the number of times a search result was installed during last week"
}, },
"searchStyleQueryHint": { "searchStyleQueryHint": {
"message": "Search style names (case-sensitively if an uppercase letter is used):\nsome words - all these words in any order\n\"some phrase\" - this exact phrase without quotes\n/foo.*bar/i - regular expression without spaces (use \\s instead)", "message": "Search style names case-insensitively:\nsome words - all words in any order\n\"some phrase\" - this exact phrase without quotes\n2020 - a year like this also shows styles updated in 2020",
"description": "Tooltip shown for the text input in the popup's inline style finder" "description": "Tooltip shown for the text input in the popup's inline style finder"
}, },
"searchStylesAll": { "searchStylesAll": {
@ -1491,10 +1440,6 @@
"message": "Sections", "message": "Sections",
"description": "Header for the table of contents block listing style section names in the left panel of the classic editor" "description": "Header for the table of contents block listing style section names in the left panel of the classic editor"
}, },
"settings": {
"message": "Settings",
"description": "Generic label/title for settings"
},
"shortcuts": { "shortcuts": {
"message": "Shortcuts", "message": "Shortcuts",
"description": "Go to shortcut configuration" "description": "Go to shortcut configuration"
@ -1502,9 +1447,6 @@
"shortcutsNote": { "shortcutsNote": {
"message": "Define keyboard shortcuts" "message": "Define keyboard shortcuts"
}, },
"shortcutsNoteFF": {
"message": "In Firefox 66+ you can open the built-in shortcuts UI manually:\n1) right-click Stylus icon in the toolbar and choose 'Manage'\n(alternatively, open about:addons via the main menu or Ctrl-Shift-A),\n2) in the page that opens click the cog wheel icon in the top right corner,\n3) choose 'Manage extension shortcuts'.\n\nYou can also customize the shortcuts here."
},
"sortDateNewestFirst": { "sortDateNewestFirst": {
"message": "newest first", "message": "newest first",
"description": "Text added to indicate that sorting a date would add the newest entries at the top" "description": "Text added to indicate that sorting a date would add the newest entries at the top"
@ -1637,6 +1579,10 @@
"message": "Number of sections not applied due to incorrect usage of 'regexp()'", "message": "Number of sections not applied due to incorrect usage of 'regexp()'",
"description": "Tooltip in the popup for styles that were applied only partially" "description": "Tooltip in the popup for styles that were applied only partially"
}, },
"styleRegexpTestButton": {
"message": "RegExp test",
"description": "RegExp test button label in the editor shown when applies-to list has a regexp value"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "Matching tabs", "message": "Matching tabs",
"description": "RegExp test report: label for the fully matching expressions" "description": "RegExp test report: label for the fully matching expressions"
@ -1665,10 +1611,6 @@
"message": "Save", "message": "Save",
"description": "Label for save button for style editing" "description": "Label for save button for style editing"
}, },
"styleSettings": {
"message": "Style settings",
"description": "Label/title for style settings dialog"
},
"styleToMozillaFormatHelp": { "styleToMozillaFormatHelp": {
"message": "The Mozilla format of the code can be submitted to userstyles.org and used with the classic Stylish for Firefox", "message": "The Mozilla format of the code can be submitted to userstyles.org and used with the classic Stylish for Firefox",
"description": "Help info for the Mozilla format header section that converts the code to/from Mozilla format" "description": "Help info for the Mozilla format header section that converts the code to/from Mozilla format"
@ -1698,6 +1640,9 @@
"message": "As a security precaution, the browser prohibits extensions from affecting its built-in pages (like chrome://version, the standard new tab page as of Chrome 61, about:addons, and so on) as well as other extensions' pages. Each browser also restricts access to its own extensions gallery (like Chrome Web Store or AMO).", "message": "As a security precaution, the browser prohibits extensions from affecting its built-in pages (like chrome://version, the standard new tab page as of Chrome 61, about:addons, and so on) as well as other extensions' pages. Each browser also restricts access to its own extensions gallery (like Chrome Web Store or AMO).",
"description": "Sub-note in the toolbar pop-up when on a URL Stylus can't affect" "description": "Sub-note in the toolbar pop-up when on a URL Stylus can't affect"
}, },
"styleOriginLabel": {
"message": "Style origin"
},
"styleUpdateUrlLabel": { "styleUpdateUrlLabel": {
"message": "Update URL" "message": "Update URL"
}, },
@ -1707,21 +1652,6 @@
"styleIncludeLabel": { "styleIncludeLabel": {
"message": "Custom included sites" "message": "Custom included sites"
}, },
"styleInjectionImportance": {
"message": "Toggle style's importance"
},
"styleInjectionOrder": {
"message": "Style injection order",
"description": "Tooltip for the button in the manager to open the dialog and also the title of this dialog"
},
"styleInjectionOrderHint": {
"message": "Drag'n'drop a style to change its position. Styles are injected sequentially in the order shown below so a style further down the list can override the earlier styles.",
"description": "Hint in the injection order dialog in the manager"
},
"styleInjectionOrderHint_prio": {
"message": "Important styles listed below are always injected last so they can override any newly installed styles. Click the style's mark to toggle its importance.",
"description": "Hint at the bottom of the injection order dialog in the manager"
},
"styleExcludeLabel": { "styleExcludeLabel": {
"message": "Custom excluded sites" "message": "Custom excluded sites"
}, },
@ -1859,6 +1789,10 @@
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "Replace the default template for new Usercss styles with the current code?" "message": "Replace the default template for new Usercss styles with the current code?"
}, },
"usercssReplaceTemplateName": {
"message": "Empty @name replaces the default template",
"description": "The text shown after @name when creating a new Usercss style"
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "Insert code here...", "message": "Insert code here...",
"description": "The code placeholder comment in a new style created by clicking 'Write style' in the popup" "description": "The code placeholder comment in a new style created by clicking 'Write style' in the popup"

View File

@ -29,7 +29,7 @@
"message": "URLs en el dominio" "message": "URLs en el dominio"
}, },
"appliesHelp": { "appliesHelp": {
"message": "Utilice los controles 'Se aplica a' para limitar las URL a las que se aplica el código de esta sección." "message": "Utilice los controles 'Se aplica a' para limitar a qué URLs se aplica el código de esta sección."
}, },
"appliesLabel": { "appliesLabel": {
"message": "Se aplica a" "message": "Se aplica a"
@ -68,7 +68,7 @@
"message": "Respaldo" "message": "Respaldo"
}, },
"backupMessage": { "backupMessage": {
"message": "Para importar el archivo de copia de seguridad, arrástrelo a esta página o haga clic en el botón Importar.\n\nPara exportar una copia de seguridad compatible con Stylus anterior a la versión 1.5.18, haga clic en el triángulo del botón Exportar y pulse en Modo compatible." "message": "Al exportar hará una copia de respaldo de TODOS los estilos instalados. Para restaurar una copia de respaldo, importe el archivo o arrástrelo a esta página."
}, },
"bckpInstStyles": { "bckpInstStyles": {
"message": "Exportar estilos" "message": "Exportar estilos"
@ -128,7 +128,7 @@
"message": "Al hacer doble clic se seleccionan los tokens" "message": "Al hacer doble clic se seleccionan los tokens"
}, },
"cm_selectByTokensTooltip": { "cm_selectByTokensTooltip": {
"message": "Ejemplos de tokens: .foo-bar-2 #aabbcc 0.32 !important\nCuando está desactivado: se seleccionan las palabras delimitadas por puntos." "message": "Ejemplos de tokens: .foo-bar-2 #aabbcc 0.32 !important\nCuando está deshabilitado: se seleccionan las palabras delimitadas por puntos."
}, },
"cm_smartIndent": { "cm_smartIndent": {
"message": "Usar sangría inteligente" "message": "Usar sangría inteligente"
@ -140,7 +140,7 @@
"message": "Temas" "message": "Temas"
}, },
"colorpickerPaletteHint": { "colorpickerPaletteHint": {
"message": "Haga clic derecho en una muestra para desplazarse por las líneas del código fuente" "message": "Haz clic con el botón derecho en una muestra para mostrar las líneas de código fuente"
}, },
"colorpickerSwitchFormatTooltip": { "colorpickerSwitchFormatTooltip": {
"message": "Alternar formatos: HEX -> RGB -> HSL.\nMayús+Clic para invertir la dirección.\nTambién con las teclas RePág (Retroceso de página), AvPág (Avance de página)." "message": "Alternar formatos: HEX -> RGB -> HSL.\nMayús+Clic para invertir la dirección.\nTambién con las teclas RePág (Retroceso de página), AvPág (Avance de página)."
@ -200,10 +200,10 @@
"message": "Copiar al portapapeles" "message": "Copiar al portapapeles"
}, },
"customNameHint": { "customNameHint": {
"message": "Introduzca aquí un nombre personalizado para cambiar el nombre del estilo en la interfaz sin que se interrumpan sus actualizaciones" "message": "Ingresa un nombre personalizado aquí para cambiar el nombre de estilo del diseño sin romper sus actualizaciones"
}, },
"customNameResetHint": { "customNameResetHint": {
"message": "Dejar de usar el nombre personalizado, cambiar al nombre propio del estilo" "message": "Dejar de usar el nombre personalizado, cambiar al nombre del estilo"
}, },
"dateAbbrYear": { "dateAbbrYear": {
"message": "$value$a", "message": "$value$a",
@ -220,13 +220,13 @@
"message": "Fecha de actualización" "message": "Fecha de actualización"
}, },
"dbError": { "dbError": {
"message": "Se ha producido un error al utilizar la base de datos de Stylus. ¿Desea visitar una página web con posibles soluciones?" "message": "Ocurrió un error con la base de datos de Stylus. ¿Deseas visitar una página web con posibles soluciones?"
}, },
"defaultTheme": { "defaultTheme": {
"message": "predeterminado" "message": "predeterminado"
}, },
"deleteStyleConfirm": { "deleteStyleConfirm": {
"message": "¿Está seguro que desea eliminar este estilo?" "message": "¿Estás seguro de que quieres eliminar este estilo?"
}, },
"deleteStyleLabel": { "deleteStyleLabel": {
"message": "Eliminar" "message": "Eliminar"
@ -237,22 +237,8 @@
"disableAllStyles": { "disableAllStyles": {
"message": "Desactivar todos los estilos" "message": "Desactivar todos los estilos"
}, },
"disableAllStylesOff": {
"message": "Los estilos están desactivados"
},
"disableStyleLabel": { "disableStyleLabel": {
"message": "Desactivar" "message": "Deshabilitar"
},
"draftAction": {
"message": "Elija 'Sí' para cargar este proyecto o 'No' para descartarlo."
},
"draftTitle": {
"message": "Proyecto de recuperación, creado$date$",
"placeholders": {
"date": {
"content": "$1"
}
}
}, },
"dragDropMessage": { "dragDropMessage": {
"message": "Arrastra tu archivo de respaldo en cualquier lugar de esta página para importar." "message": "Arrastra tu archivo de respaldo en cualquier lugar de esta página para importar."
@ -280,21 +266,15 @@
} }
} }
}, },
"editorSettings": {
"message": "Configuración del editor"
},
"enableStyleLabel": { "enableStyleLabel": {
"message": "Activar" "message": "Habilitar"
}, },
"excludeStyleByDomainLabel": { "excludeStyleByDomainLabel": {
"message": "Excluir el dominio actual" "message": "Excluir el dominio Actual"
}, },
"excludeStyleByUrlLabel": { "excludeStyleByUrlLabel": {
"message": "Excluir la URL actual" "message": "Excluir la URL actual"
}, },
"exportCompatible": {
"message": "Exportar (modo compatible)"
},
"exportLabel": { "exportLabel": {
"message": "Exportar" "message": "Exportar"
}, },
@ -328,11 +308,20 @@
} }
}, },
"filteredStylesAllHidden": { "filteredStylesAllHidden": {
"message": "Los filtros aplicados actualmente no coinciden con ningún estilo" "message": "Los filtros actualmente aplicados no coinciden con estilo alguno"
}, },
"findStyles": { "findStyles": {
"message": "Buscar estilos" "message": "Buscar estilos"
}, },
"findStylesForSite": {
"message": "Buscar más estilos para este sitio"
},
"findStylesInline": {
"message": "Dentro"
},
"findStylesInlineTooltip": {
"message": "Muestra los resultados de búsqueda dentro de esta ventana."
},
"genericAdd": { "genericAdd": {
"message": "Añadir" "message": "Añadir"
}, },
@ -343,10 +332,10 @@
"message": "Descripción" "message": "Descripción"
}, },
"genericDisabledLabel": { "genericDisabledLabel": {
"message": "Desactivado" "message": "Deshabilitado"
}, },
"genericEnabledLabel": { "genericEnabledLabel": {
"message": "Activado" "message": "Habilitado"
}, },
"genericHistoryLabel": { "genericHistoryLabel": {
"message": "Historial" "message": "Historial"
@ -363,9 +352,6 @@
"genericSavedMessage": { "genericSavedMessage": {
"message": "Guardado" "message": "Guardado"
}, },
"genericTest": {
"message": "Prueba"
},
"genericTitle": { "genericTitle": {
"message": "Título" "message": "Título"
}, },
@ -375,9 +361,6 @@
"gettingStyles": { "gettingStyles": {
"message": "Obteniendo todos los estilos..." "message": "Obteniendo todos los estilos..."
}, },
"headerResizerHint": {
"message": "Presione Mayúsculas para cambiar el tamaño solo en este tipo de interfaz. Por ejemplo Editor, Administrador, Instalador"
},
"helpAlt": { "helpAlt": {
"message": "Ayuda" "message": "Ayuda"
}, },
@ -388,7 +371,7 @@
"message": "Pulsa un atajo de teclado" "message": "Pulsa un atajo de teclado"
}, },
"hostDisabled": { "hostDisabled": {
"message": "Este host ha sido desactivado debido a un error en la versión actual del navegador utilizado." "message": "Este host ha sido deshabilitado debido a un error en la versión actual del navegador que se está utilizando."
}, },
"importAppendLabel": { "importAppendLabel": {
"message": "Adicionar al estilo" "message": "Adicionar al estilo"
@ -400,10 +383,10 @@
"message": "Importar" "message": "Importar"
}, },
"importPreprocessor": { "importPreprocessor": {
"message": "Los estilos con <code>@preprocessor</code> no funcionarán en el modo clásico. Puedes cambiar el editor al modo Usercss: 1) Abre el administrador de estilos. 2) Activa la casilla 'como UserCSS'. 3) Haz clic en 'Escribir un estilo nuevo'\n\n¿Quieres importarlo de todos modos?" "message": "Los estilos con <code>@preprocessor</code> no funcionarán en el modo clásico. Puedes cambiar el editor para usar el modo UserCSS: 1) Abre el administrador de estilos. 2) Activa la casilla «como UserCSS». 3) Haz clic en «Escribir un estilo nuevo»\n\n¿Quieres importarlo de todos modos?"
}, },
"importPreprocessorTitle": { "importPreprocessorTitle": {
"message": "Posible problema debido a @preprocessor" "message": "Problema potencial debido a @preprocessor"
}, },
"importReplaceLabel": { "importReplaceLabel": {
"message": "Sobrescribir estilo" "message": "Sobrescribir estilo"
@ -473,18 +456,9 @@
"linkGetHelp": { "linkGetHelp": {
"message": "Obtener ayuda" "message": "Obtener ayuda"
}, },
"linkGetShareStyles": {
"message": "Obtener y compartir estilos"
},
"linkGetShareStylesInfo": {
"message": "El nuevo sitio userstyles.world, gestionado por la comunidad, ha sido creado por los creadores de usertyles para sustituir a userstyles.org, que ha sido muy lento y no ha respondido durante el último año, por lo que muchos creadores han dejado de actualizar sus estilos."
},
"linkGetStyles": { "linkGetStyles": {
"message": "Obtener estilos" "message": "Obtener estilos"
}, },
"linkGetStylesInfo": {
"message": "Este repositorio fue creado por un miembro de la comunidad userstyle para suplir el lento y disfuncional userstyles.org. El repositorio se actualiza aproximadamente una vez al día."
},
"linkTranslate": { "linkTranslate": {
"message": "Traducir" "message": "Traducir"
}, },
@ -497,7 +471,7 @@
} }
}, },
"linterCSSLintSettings": { "linterCSSLintSettings": {
"message": "(Establezca la regla como: 0 = desactivado; 1 = advertencia; 2 = error)" "message": "(Establecer regla como: 0 = deshabilitada; 1 = advertencia; 2 = error)"
}, },
"linterConfigPopupTitle": { "linterConfigPopupTitle": {
"message": "Establecer configuración de $linter$ reglas", "message": "Establecer configuración de $linter$ reglas",
@ -552,7 +526,7 @@
"message": "Atenuado" "message": "Atenuado"
}, },
"manageFaviconsHelp": { "manageFaviconsHelp": {
"message": "Stylus usa un servicio externo https://icons.duckduckgo.com" "message": "Stylus usa un servicio externo https://www.google.com/s2/favicons"
}, },
"manageFilters": { "manageFilters": {
"message": "Filtros" "message": "Filtros"
@ -570,10 +544,10 @@
"message": "Nuevo diseño de la administración" "message": "Nuevo diseño de la administración"
}, },
"manageOnlyDisabled": { "manageOnlyDisabled": {
"message": "Solo estilos desactivados" "message": "Solo estilos deshabilitados"
}, },
"manageOnlyEnabled": { "manageOnlyEnabled": {
"message": "Solamente estilos activados" "message": "Solo estilos habilitados"
}, },
"manageOnlyExternal": { "manageOnlyExternal": {
"message": "Solo estilos externos" "message": "Solo estilos externos"
@ -812,15 +786,6 @@
"optionsAdvanced": { "optionsAdvanced": {
"message": "Avanzado" "message": "Avanzado"
}, },
"optionsAdvancedAutoSwitchSchemeBySystem": {
"message": "Por preferencia del sistema"
},
"optionsAdvancedAutoSwitchSchemeByTime": {
"message": "Por la noche:"
},
"optionsAdvancedAutoSwitchSchemeNever": {
"message": "Desactivado. Se ignora la configuración de oscuro/claro en los estilos."
},
"optionsAdvancedContextDelete": { "optionsAdvancedContextDelete": {
"message": "Añadir 'Eliminar' al menú contextual del editor" "message": "Añadir 'Eliminar' al menú contextual del editor"
}, },
@ -830,12 +795,6 @@
"optionsAdvancedExposeIframesNote": { "optionsAdvancedExposeIframesNote": {
"message": "Muestra el dominio del sitio principal en cada iframe.\nPermite escribir código CSS específico para iframes, como en el ejemplo siguiente:\nhtml[stylus-iframe$$=\"twitter.com\"] h1 { display:none }" "message": "Muestra el dominio del sitio principal en cada iframe.\nPermite escribir código CSS específico para iframes, como en el ejemplo siguiente:\nhtml[stylus-iframe$$=\"twitter.com\"] h1 { display:none }"
}, },
"optionsAdvancedExposeStyleName": {
"message": "Exponer el nombre del estilo"
},
"optionsAdvancedExposeStyleNameNote": {
"message": "Expone el nombre del estilo en la página para facilitar la depuración de los estilos en devtools. Recargue las pestañas para aplicar la nueva configuración."
},
"optionsAdvancedNewStyleAsUsercss": { "optionsAdvancedNewStyleAsUsercss": {
"message": "Escribir nuevo estilo como UserCSS" "message": "Escribir nuevo estilo como UserCSS"
}, },
@ -852,7 +811,7 @@
"message": "Activa esta opción si aparecen y desaparecen rápidamente contenidos sin estilo al cargarse páginas (el efecto es más visible con temas oscuros).\n\nLa explicación técnica es que Chrome/Chromium pospone la comunicación asincrónica de las extensiones. Esta función intenta mejorar la velocidad de carga de las páginas, aunque no siempre es efectiva y puede causar que los estilos se apliquen con retraso. Para evitar este problema (ya que las extensiones del tipo WebExtensions no pueden usar una API sincrónica), Stylus ofrece esta opción para usar la API web XMLHttpRequest sincrónica (en desuso) para obtener los estilos correspondientes. No debería causar problemas, ya que la petición se completa en solo unos milisegundos, mientras se carga la página del servidor.\n\nDe todos modos, Chromium mostrará una advertencia en la consola de herramientas de desarrollador. Para evitar que se muestren este tipo de advertencias en el futuro, haz clic con el botón derecho sobre una advertencia y selecciona la opción para ocultarla." "message": "Activa esta opción si aparecen y desaparecen rápidamente contenidos sin estilo al cargarse páginas (el efecto es más visible con temas oscuros).\n\nLa explicación técnica es que Chrome/Chromium pospone la comunicación asincrónica de las extensiones. Esta función intenta mejorar la velocidad de carga de las páginas, aunque no siempre es efectiva y puede causar que los estilos se apliquen con retraso. Para evitar este problema (ya que las extensiones del tipo WebExtensions no pueden usar una API sincrónica), Stylus ofrece esta opción para usar la API web XMLHttpRequest sincrónica (en desuso) para obtener los estilos correspondientes. No debería causar problemas, ya que la petición se completa en solo unos milisegundos, mientras se carga la página del servidor.\n\nDe todos modos, Chromium mostrará una advertencia en la consola de herramientas de desarrollador. Para evitar que se muestren este tipo de advertencias en el futuro, haz clic con el botón derecho sobre una advertencia y selecciona la opción para ocultarla."
}, },
"optionsBadgeDisabled": { "optionsBadgeDisabled": {
"message": "Color de fondo cuando se desactiva" "message": "Color de fondo cuando está deshabilitado"
}, },
"optionsBadgeNormal": { "optionsBadgeNormal": {
"message": "Color de fondo" "message": "Color de fondo"
@ -881,9 +840,6 @@
"optionsHeading": { "optionsHeading": {
"message": "Opciones" "message": "Opciones"
}, },
"optionsIconAuto": {
"message": "Adaptar el modo oscuro/claro"
},
"optionsIconDark": { "optionsIconDark": {
"message": "Temas de navegador oscuros" "message": "Temas de navegador oscuros"
}, },
@ -906,7 +862,7 @@
"message": "Restablecer opciones" "message": "Restablecer opciones"
}, },
"optionsStylusThemes": { "optionsStylusThemes": {
"message": "Haga clic en el icono de Stylus en la barra de herramientas del navegador y luego haga clic en 'Buscar estilos'." "message": "Buscar un tema de Stylus"
}, },
"optionsSubheading": { "optionsSubheading": {
"message": "Más opciones" "message": "Más opciones"
@ -923,9 +879,6 @@
"optionsSyncNone": { "optionsSyncNone": {
"message": "Ninguno" "message": "Ninguno"
}, },
"optionsSyncPassword": {
"message": "Contraseña"
},
"optionsSyncStatusConnected": { "optionsSyncStatusConnected": {
"message": "Conectado" "message": "Conectado"
}, },
@ -969,14 +922,11 @@
"optionsSyncSyncNow": { "optionsSyncSyncNow": {
"message": "Sincronizar ahora" "message": "Sincronizar ahora"
}, },
"optionsSyncUsername": {
"message": "Usuario"
},
"optionsUpdateImportNote": { "optionsUpdateImportNote": {
"message": "Al importar los respaldos de estilos desde una versión antigua o desde Stylish, comprueba una vez las actualizaciones manualmente en el administrador de estilos para asegurarte de que todos los estilos estén actualizados." "message": "Al importar los respaldos de estilos desde una versión antigua o desde Stylish, comprueba una vez las actualizaciones manualmente en el administrador de estilos para asegurarte de que todos los estilos estén actualizados."
}, },
"optionsUpdateInterval": { "optionsUpdateInterval": {
"message": "Intervalo de actualización automática del estilo en horas (escriba 0 para desactivar)" "message": "Intervalo de actualización automática en horas (especificar 0 para deshabilitar)"
}, },
"overwriteFileExport": { "overwriteFileExport": {
"message": "¿Desea sobrescribir un archivo existente?" "message": "¿Desea sobrescribir un archivo existente?"
@ -1009,14 +959,11 @@
"message": "Útil para temas oscuros en el nuevo Chrome ya que no pinta los bordes laterales" "message": "Útil para temas oscuros en el nuevo Chrome ya que no pinta los bordes laterales"
}, },
"popupHotkeysInfo": { "popupHotkeysInfo": {
"message": "<1>-<9>, <0>, también en el teclado numérico - acciona el enésimo estilo (0 es 10)\n<A>-<Z> acciona el primer estilo con un nombre que comienza con la letra\n<Shift> abre el editor en lugar de accionar\n<Numpad +> activa los estilos listados\n<Numpad > desactiva los estilos listados\n<Numpad *> y < ` > (acento grave) - acciona los estilos inicialmente activados; no se aplica a los estilos posteriormente activados mientras la ventana emergente está abierta para que pueda restaurar la selección inicial después de probar las cosas: simplemente desactive todo, luego accione, por ejemplo <Numpad > <Numpad *>\nMás información en la wiki" "message": "<1>-<9>, <0>, también en el teclado numérico - acciona el n-esimo estilo (0 es 10)\n<A>-<Z> acciona el primer estilo con un nombre que comienza con la letra\n<Shift> abre el editor en lugar de accionar\n<Numpad +> habilita los estilos listados\n<Numpad > deshabilita los estilos listados\n<Numpad *> y <`> (acento grave) - acciona los estilos habilitados inicialmente; no se aplica a los estilos habilitados subsecuentemente mientras el cuadro emergente está abierto, así que puede restaurar la selección inicial tras probar el material: simplemente deshabilite todo, y luego accione, es decir <Numpad > <Numpad *>\nMás información en el wiki"
}, },
"popupHotkeysTooltip": { "popupHotkeysTooltip": {
"message": "Haz clic para ver los atajos de teclado disponibles" "message": "Haz clic para ver los atajos de teclado disponibles"
}, },
"popupManageSiteStyles": {
"message": "Administrar estilos del sitio"
},
"popupManageTooltip": { "popupManageTooltip": {
"message": "Mayús+clic o clic secundario abre el administrador con estilos aplicables para el sitio actual." "message": "Mayús+clic o clic secundario abre el administrador con estilos aplicables para el sitio actual."
}, },
@ -1030,7 +977,7 @@
"message": "Abrir editor en una nueva ventana" "message": "Abrir editor en una nueva ventana"
}, },
"popupOpenEditInWindowTooltip": { "popupOpenEditInWindowTooltip": {
"message": "También se activa al desacoplar la pestaña del editor de una ventana del navegador,\ny se desactiva acoplando una única pestaña del editor en otra ventana." "message": "También se habilita al desacoplar la pestaña del editor de una ventana de navegador,\ny se deshabilita al acoplar una única pestaña de editor en otra ventana."
}, },
"popupStylesFirst": { "popupStylesFirst": {
"message": "Estilos antes que las órdenes" "message": "Estilos antes que las órdenes"
@ -1038,21 +985,6 @@
"prefShowBadge": { "prefShowBadge": {
"message": "Número de estilos activos en el sitio actual" "message": "Número de estilos activos en el sitio actual"
}, },
"preferScheme": {
"message": "Preferencia de modo oscuro/claro"
},
"preferSchemeAlways": {
"message": "De momento se ignora (el estilo siempre se aplica) porque el modo global oscuro/claro está desactivado"
},
"preferSchemeDark": {
"message": "Oscuro"
},
"preferSchemeLight": {
"message": "Claro"
},
"preferSchemeNone": {
"message": "Ninguno (siempre aplicado)"
},
"previewLabel": { "previewLabel": {
"message": "Vista previa en tiempo real" "message": "Vista previa en tiempo real"
}, },
@ -1081,7 +1013,7 @@
"message": "Leyendo los estilos..." "message": "Leyendo los estilos..."
}, },
"reload": { "reload": {
"message": "Recargar" "message": "Recargar extensión Stylus"
}, },
"replace": { "replace": {
"message": "Reemplazar" "message": "Reemplazar"
@ -1092,18 +1024,12 @@
"replaceWith": { "replaceWith": {
"message": "Reemplazar con" "message": "Reemplazar con"
}, },
"restoreTemplate": {
"message": "Restaurar la plantilla predeterminada.\n\n(Las páginas del editor actualmente abiertas no cambiarán.)"
},
"retrieveBckp": { "retrieveBckp": {
"message": "Importar estilos" "message": "Importar estilos"
}, },
"retrieveDropboxSync": { "retrieveDropboxSync": {
"message": "Importar desde Dropbox" "message": "Importar desde Dropbox"
}, },
"saveAsTemplate": {
"message": "Guardar como plantilla"
},
"search": { "search": {
"message": "Buscar" "message": "Buscar"
}, },
@ -1132,7 +1058,7 @@
"message": "El estilo se ha instalado, pero no es válido para la URL del sitio actual." "message": "El estilo se ha instalado, pero no es válido para la URL del sitio actual."
}, },
"searchResultNotMatchingNote": { "searchResultNotMatchingNote": {
"message": "Pruebe solicitando al autor de este estilo que añada la URL.\n\nTambién puede abrir el estilo en el administrador y editarlo\nusted mismo, pero tenga en cuenta que esto desactiva las\nactualizaciones automáticas para este estilo." "message": "Intenta pedir al autor de este estilo de usuario que añada la URL.\n\nTambién puedes abrir el estilo en el administrador y editarlo tú mismo,\npero ten en cuenta que deshabilita las actualizaciones automáticas de\neste estilo."
}, },
"searchResultRating": { "searchResultRating": {
"message": "Valoración" "message": "Valoración"
@ -1143,6 +1069,9 @@
"searchResultWeeklyCount": { "searchResultWeeklyCount": {
"message": "Instalaciones semanales" "message": "Instalaciones semanales"
}, },
"searchStyleQueryHint": {
"message": "La búsqueda de nombres de estilo no distingue mayúsculas de minúsculas:\nalgunas palabras: todas las palabras en cualquier orden\n\"una frase\": esta frase exacta (sin comillas)\n2020: al escribir un año, se muestran estilos que se actualizaron ese año"
},
"searchStylesAll": { "searchStylesAll": {
"message": "Todos" "message": "Todos"
}, },
@ -1176,18 +1105,12 @@
"sections": { "sections": {
"message": "Secciones" "message": "Secciones"
}, },
"settings": {
"message": "Configuración"
},
"shortcuts": { "shortcuts": {
"message": "Atajos" "message": "Atajos"
}, },
"shortcutsNote": { "shortcutsNote": {
"message": "Defina atajos de teclado" "message": "Defina atajos de teclado"
}, },
"shortcutsNoteFF": {
"message": "En Firefox 66+ puedes abrir manualmente la interfaz de atajos integrada:\n1) Clic derecho en el icono Stylus de la barra de herramientas y pulse 'Gestionar extensión'.\n(o bien, abra about:addons mediante el menú principal o Ctrl-Shift-A),\n2) En la página que se abre, haga clic en el icono de la rueda dentada en la esquina superior derecha,\n3) Elija 'Administrar atajos de extensiones'.\n\nTambién puede personalizar los accesos directos aquí."
},
"sortDateNewestFirst": { "sortDateNewestFirst": {
"message": "los más nuevos primero" "message": "los más nuevos primero"
}, },
@ -1204,7 +1127,7 @@
"message": "Título descendentemente" "message": "Título descendentemente"
}, },
"sortStylesHelp": { "sortStylesHelp": {
"message": "Elija el tipo de ordenamiento que desea aplicar a las entradas instaladas desde el menú desplegable de ordenamiento. La configuración predeterminada aplica un ordenamiento ascendente (de la A a la Z) a los títulos de las entradas. El ordenamiento dentro del grupo 'Título descendente' aplicará un ordenamiento descendente (de la Z a la A) al título.\nHay otros preajustes que permiten ordenar las entradas por múltiples criterios. Imagínese que es como ordenar una tabla con múltiples columnas y que cada categoría en una selección (entre los signos de suma) representa una columna, o un grupo.\nPor ejemplo, si la configuración es 'Activado (primero) + Título', las entradas se ordenarían de manera que todas las entradas activadas se sitúen al principio de la lista, y luego se aplica un ordenamiento ascendente del título de la entrada (de la A a la Z) a las entradas activadas y desactivadas por separado." "message": "Escoja el tipo de orden a aplicar a las entradas instaladas desde el menú desplegable de ordenación. La configuración predeterminada aplica un orden ascendente (A a Z) a los títulos de las entradas. Las ordenaciones del grupo \"Título descendentemente\" aplicarán un orden descendente (Z a A) al título.\nHay otros preajustes que permitirán ordenar las entradas según múltiples criterios. Piense en esto como en ordenar una tabla con múltiples columnas, y en cada categoría en una selección (entre los signos más) representa una columna o grupo.\nPor ejemplo, si la configuración es \"Habilitados (primero) + Título\", las entradas se ordenarían de forma que las entradas habilitadas quedarían en la parte superior de la lista, luego se aplica un orden ascendente (A a Z) de títulos de las entradas tanto para las entradas habilitadas como las deshabilitadas de forma separada."
}, },
"sortStylesHelpTitle": { "sortStylesHelpTitle": {
"message": "Ordenar contenidos" "message": "Ordenar contenidos"
@ -1233,30 +1156,12 @@
"styleEnabledLabel": { "styleEnabledLabel": {
"message": "Activado" "message": "Activado"
}, },
"styleExcludeLabel": {
"message": "Sitios excluidos personalizados"
},
"styleFromMozillaFormatError": { "styleFromMozillaFormatError": {
"message": "No se pudo importar desde el formato Mozilla" "message": "No se pudo importar desde el formato Mozilla"
}, },
"styleFromMozillaFormatPrompt": { "styleFromMozillaFormatPrompt": {
"message": "Pegue el código de formato Mozilla" "message": "Pegue el código de formato Mozilla"
}, },
"styleIncludeLabel": {
"message": "Sitios incluidos personalizados"
},
"styleInjectionImportance": {
"message": "Alternar la importancia del estilo"
},
"styleInjectionOrder": {
"message": "Orden de inyección de estilo"
},
"styleInjectionOrderHint": {
"message": "Arrastre y suelte un estilo para cambiar su posición. Los estilos se inyectan secuencialmente en el orden que se muestra a continuación, por lo que un estilo que esté más abajo en la lista puede anular los estilos anteriores."
},
"styleInjectionOrderHint_prio": {
"message": "Los estilos importantes que se indican a continuación se inyectan siempre en último lugar para que puedan anular cualquier estilo recién instalado. Haga clic en la marca del estilo para cambiar su importancia."
},
"styleInstall": { "styleInstall": {
"message": "¿Quiere instalar «$stylename$» en Stylus?", "message": "¿Quiere instalar «$stylename$» en Stylus?",
"placeholders": { "placeholders": {
@ -1299,15 +1204,6 @@
"styleNotAppliedRegexpProblemTooltip": { "styleNotAppliedRegexpProblemTooltip": {
"message": "El estilo no se aplicó debido a su uso incorrecto de 'regexp()'" "message": "El estilo no se aplicó debido a su uso incorrecto de 'regexp()'"
}, },
"styleNotAppliedSchemeDark": {
"message": "Este estilo solo se aplica en el modo oscuro"
},
"styleNotAppliedSchemeLight": {
"message": "Este estilo solo se aplica en el modo claro"
},
"stylePreferSchemeLabel": {
"message": "Modo oscuro/claro"
},
"styleRegexpInvalidExplanation": { "styleRegexpInvalidExplanation": {
"message": "Algunas reglas «regexp()» que no se pudieron compilar en absoluto." "message": "Algunas reglas «regexp()» que no se pudieron compilar en absoluto."
}, },
@ -1317,6 +1213,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "Número de secciones no aplicadas debido a un uso incorrecto de 'regexp()'" "message": "Número de secciones no aplicadas debido a un uso incorrecto de 'regexp()'"
}, },
"styleRegexpTestButton": {
"message": "Probar regexp"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "Pestañas coincidentes" "message": "Pestañas coincidentes"
}, },
@ -1338,9 +1237,6 @@
"styleSaveLabel": { "styleSaveLabel": {
"message": "Guardar" "message": "Guardar"
}, },
"styleSettings": {
"message": "Configuración del estilo"
},
"styleToMozillaFormatHelp": { "styleToMozillaFormatHelp": {
"message": "El formato Mozilla del código se puede enviar a userstyles.org y usarse con el Stylish para Firefox clásico." "message": "El formato Mozilla del código se puede enviar a userstyles.org y usarse con el Stylish para Firefox clásico."
}, },
@ -1358,9 +1254,6 @@
"styleUpdateDiscardChanges": { "styleUpdateDiscardChanges": {
"message": "El estilo se ha modificado fuera del editor. ¿Desea recargar el estilo?" "message": "El estilo se ha modificado fuera del editor. ¿Desea recargar el estilo?"
}, },
"styleUpdateUrlLabel": {
"message": "Actualizar URL"
},
"stylusUnavailableForURL": { "stylusUnavailableForURL": {
"message": "Stylus no funciona en páginas como esta." "message": "Stylus no funciona en páginas como esta."
}, },
@ -1376,16 +1269,8 @@
"syncError": { "syncError": {
"message": "No se pudo sincronizar" "message": "No se pudo sincronizar"
}, },
"syncErrorLock": {
"message": "La base de datos ya está en uso. El bloqueo expirará en $TIME$",
"placeholders": {
"time": {
"content": "$1"
}
}
},
"syncErrorRelogin": { "syncErrorRelogin": {
"message": "Sincronización fallida. Se ha cerrado la sesión.\nIntenta reiniciar la sesión en las opciones de Stylus." "message": "No se pudo sincronizar.\nIntenta volver a iniciar sesión en las opciones de Stylus:\nprimero haz clic en 'desconectar', y luego en 'conectar'."
}, },
"syncStorageErrorSaving": { "syncStorageErrorSaving": {
"message": "El valor no se puede guardar. Trate de reducir la longitud del texto." "message": "El valor no se puede guardar. Trate de reducir la longitud del texto."
@ -1476,6 +1361,9 @@
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "¿Reemplazar con el código actual la plantilla predeterminada para nuevos estilos UserCSS?" "message": "¿Reemplazar con el código actual la plantilla predeterminada para nuevos estilos UserCSS?"
}, },
"usercssReplaceTemplateName": {
"message": "@name vacío reemplaza la plantilla predeterminada"
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "Inserte el código aquí..." "message": "Inserte el código aquí..."
}, },

File diff suppressed because it is too large Load Diff

View File

@ -67,6 +67,9 @@
"backupButtons": { "backupButtons": {
"message": "Varunda" "message": "Varunda"
}, },
"backupMessage": {
"message": "Vali fail või lohista see siia lehele."
},
"bckpInstStyles": { "bckpInstStyles": {
"message": "Ekspordi stiilid" "message": "Ekspordi stiilid"
}, },
@ -290,6 +293,15 @@
"findStyles": { "findStyles": {
"message": "Leia stiile" "message": "Leia stiile"
}, },
"findStylesForSite": {
"message": "Leia sellele saidile veel stiile"
},
"findStylesInline": {
"message": "Aknasisene"
},
"findStylesInlineTooltip": {
"message": "Näita otsingu tulemusi selles aknas."
},
"genericAdd": { "genericAdd": {
"message": "Lisa" "message": "Lisa"
}, },
@ -485,7 +497,7 @@
"message": "Tee halliks" "message": "Tee halliks"
}, },
"manageFaviconsHelp": { "manageFaviconsHelp": {
"message": "Stylus kasutab välist teenust https://icons.duckduckgo.com" "message": "Stylus kasutab välist teenust https://www.google.com/s2/favicons"
}, },
"manageFilters": { "manageFilters": {
"message": "Filtrid" "message": "Filtrid"
@ -865,9 +877,6 @@
"sectionRestore": { "sectionRestore": {
"message": "Taasta eemaldatud jaotis" "message": "Taasta eemaldatud jaotis"
}, },
"sections": {
"message": "Jaotised"
},
"shortcuts": { "shortcuts": {
"message": "Otseteed" "message": "Otseteed"
}, },
@ -970,6 +979,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "\"regexp()\" vale kasutuse tõttu rakendamata jaotiste arv" "message": "\"regexp()\" vale kasutuse tõttu rakendamata jaotiste arv"
}, },
"styleRegexpTestButton": {
"message": "Regulaaravaldise katsetus"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "Vastavad kaardid" "message": "Vastavad kaardid"
}, },
@ -1044,9 +1056,6 @@
"unreachableFileHint": { "unreachableFileHint": {
"message": "Stylus saab ligi pääseda file:// URLidele ainult siis, kui märgistad vastava kasti Stylus laiendusel chrome://extensions lehel" "message": "Stylus saab ligi pääseda file:// URLidele ainult siis, kui märgistad vastava kasti Stylus laiendusel chrome://extensions lehel"
}, },
"unreachableMozSiteHintOldFF": {
"message": "Ainult Firefox 59 ja uuem on võimalik seadistada lubama WebExtensionsil lisada stiilielemente CSP-kaitstud saitidele nagu see."
},
"unzipStyles": { "unzipStyles": {
"message": "Stiilide lahtipakkimine..." "message": "Stiilide lahtipakkimine..."
}, },
@ -1106,6 +1115,9 @@
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "Asendad vaikimisi malli uutes kasutajacss stiilides praeguse koodiga?" "message": "Asendad vaikimisi malli uutes kasutajacss stiilides praeguse koodiga?"
}, },
"usercssReplaceTemplateName": {
"message": "Tühi @name asendab vaikimisi malli"
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "Sisesta kood siia..." "message": "Sisesta kood siia..."
}, },

View File

@ -52,12 +52,6 @@
"checkingForUpdate": { "checkingForUpdate": {
"message": "Tarkistetaan..." "message": "Tarkistetaan..."
}, },
"confirmDelete": {
"message": "Poista"
},
"confirmSave": {
"message": "Tallenna"
},
"deleteStyleConfirm": { "deleteStyleConfirm": {
"message": "Oletko varma että haluat poistaa tämän tyylin?" "message": "Oletko varma että haluat poistaa tämän tyylin?"
}, },
@ -70,9 +64,6 @@
"disableStyleLabel": { "disableStyleLabel": {
"message": "Poista Käytöstä" "message": "Poista Käytöstä"
}, },
"editDeleteText": {
"message": "Poista"
},
"editStyleHeading": { "editStyleHeading": {
"message": "Muokkaa Tyyliä" "message": "Muokkaa Tyyliä"
}, },
@ -90,11 +81,8 @@
"enableStyleLabel": { "enableStyleLabel": {
"message": "Aktivoi" "message": "Aktivoi"
}, },
"genericAdd": { "findStylesForSite": {
"message": "Lisää" "message": "Hae lisää tyylejä tälle sivustolle"
},
"genericEnabledLabel": {
"message": "Aktivoitu"
}, },
"helpAlt": { "helpAlt": {
"message": "Apu" "message": "Apu"
@ -129,9 +117,6 @@
"sectionRemove": { "sectionRemove": {
"message": "Poista osio" "message": "Poista osio"
}, },
"sections": {
"message": "Osiot"
},
"styleBadRegexp": { "styleBadRegexp": {
"message": "Regexp ei kelpaa." "message": "Regexp ei kelpaa."
}, },

View File

@ -68,7 +68,7 @@
"message": "Sauvegarde" "message": "Sauvegarde"
}, },
"backupMessage": { "backupMessage": {
"message": "Pour importer le fichier de sauvegarder, glissez-déposez-le sur dans page ou cliquez sur le bouton Importer.\n\nPour export une sauvegarde compatible avec une version de Stylus plus ancienne que 1.5.18, effectuez un clic droit ou un appuie sur la touche Maj + clic sur le bouton Exporter." "message": "Sélectionner un fichier ou le glisser-déposer sur cette page"
}, },
"bckpInstStyles": { "bckpInstStyles": {
"message": "Exporter des styles" "message": "Exporter des styles"
@ -199,28 +199,6 @@
"copy": { "copy": {
"message": "Copier dans le presse-papier" "message": "Copier dans le presse-papier"
}, },
"customNameHint": {
"message": "Entrez un nom personnalisé ici pour renommer le style dans l'IU sans casser les mises à jour"
},
"customNameResetHint": {
"message": "Arrête d'utiliser le nom personnalisé, change vers le propre nom du style"
},
"dateAbbrDay": {
"message": "$value$j",
"placeholders": {
"value": {
"content": "$1"
}
}
},
"dateAbbrYear": {
"message": "$value$a",
"placeholders": {
"value": {
"content": "$1"
}
}
},
"dateInstalled": { "dateInstalled": {
"message": "Date d'installation" "message": "Date d'installation"
}, },
@ -245,23 +223,9 @@
"disableAllStyles": { "disableAllStyles": {
"message": "Désactiver tous les styles" "message": "Désactiver tous les styles"
}, },
"disableAllStylesOff": {
"message": "Les styles sont désactivés"
},
"disableStyleLabel": { "disableStyleLabel": {
"message": "Désactiver" "message": "Désactiver"
}, },
"draftAction": {
"message": "Choisissez « Oui » pour charger ce brouillon ou « Non » pour l'abandonner."
},
"draftTitle": {
"message": "Sauvegarde du brouillon, créée $date$",
"placeholders": {
"date": {
"content": "$1"
}
}
},
"dragDropMessage": { "dragDropMessage": {
"message": "Glisser votre fichier de sauvegarde nimporte où sur cette page pour limporter." "message": "Glisser votre fichier de sauvegarde nimporte où sur cette page pour limporter."
}, },
@ -288,9 +252,6 @@
} }
} }
}, },
"editorSettings": {
"message": "Paramètres de léditeur"
},
"enableStyleLabel": { "enableStyleLabel": {
"message": "Activer" "message": "Activer"
}, },
@ -300,9 +261,6 @@
"excludeStyleByUrlLabel": { "excludeStyleByUrlLabel": {
"message": "Exclure lURL actuelle" "message": "Exclure lURL actuelle"
}, },
"exportCompatible": {
"message": "Export (mode de compatibilité)"
},
"exportLabel": { "exportLabel": {
"message": "Exporter" "message": "Exporter"
}, },
@ -338,6 +296,15 @@
"findStyles": { "findStyles": {
"message": "Trouver des styles" "message": "Trouver des styles"
}, },
"findStylesForSite": {
"message": "Rechercher d'autres styles pour ce site"
},
"findStylesInline": {
"message": "Dans la popup"
},
"findStylesInlineTooltip": {
"message": "Affiche les résultats de recherche dans cette fenêtre"
},
"genericAdd": { "genericAdd": {
"message": "Ajouter" "message": "Ajouter"
}, },
@ -377,9 +344,6 @@
"gettingStyles": { "gettingStyles": {
"message": "Récupération de tous les styles…" "message": "Récupération de tous les styles…"
}, },
"headerResizerHint": {
"message": "Maintenir la touche Maj pour redimensionner uniquement dans ce type d'interface, par exemple, éditeur, gestionnaire, installateur"
},
"helpAlt": { "helpAlt": {
"message": "Aide" "message": "Aide"
}, },
@ -401,12 +365,6 @@
"importLabel": { "importLabel": {
"message": "Importer" "message": "Importer"
}, },
"importPreprocessor": {
"message": "Les styles avec un <code>@preprocessor</code> ne fonctionnera pas en mode classique. Vous pouvez changer l'éditeur en mode Usercss : 1) Ouvrez le gestionnaire de styles, 2) Activer l'option \"en tant que Usercss\", 3) Cliquez \"écrire un nouveau style\"\n\nImporter de toute façon ?"
},
"importPreprocessorTitle": {
"message": "Problème potentiel à cause de @preprocessor"
},
"importReplaceLabel": { "importReplaceLabel": {
"message": "Remplacer le style" "message": "Remplacer le style"
}, },
@ -475,18 +433,9 @@
"linkGetHelp": { "linkGetHelp": {
"message": "Consulter l'aide" "message": "Consulter l'aide"
}, },
"linkGetShareStyles": {
"message": "Obtenir et partager les styles"
},
"linkGetShareStylesInfo": {
"message": "Le nouveau userstyles.world géré par la communauté est créé par les auteurs d'userstyles dans le but de remplacer userstyles.org, qui a été tellement lent et inconscient durant l'année dernière que beaucoup d'auteurs ont arrêté de mettre à jour leurs styles."
},
"linkGetStyles": { "linkGetStyles": {
"message": "Obtenir des styles" "message": "Obtenir des styles"
}, },
"linkGetStylesInfo": {
"message": "Ce site d'archive à été créé par un membre de la communauté userstyle pour archiver le lent et inconscient site userstyles.org. Cette archive est mise à jour approximativement chaque jour."
},
"linkTranslate": { "linkTranslate": {
"message": "Traduire" "message": "Traduire"
}, },
@ -554,7 +503,7 @@
"message": "Grisés" "message": "Grisés"
}, },
"manageFaviconsHelp": { "manageFaviconsHelp": {
"message": "Stylus utilise le service externe https://icons.duckduckgo.com" "message": "Stylus utilise le service externe https://www.google.com/s2/favicons"
}, },
"manageFilters": { "manageFilters": {
"message": "Filtres" "message": "Filtres"
@ -760,17 +709,6 @@
} }
} }
}, },
"meta_unknownMetaTypo": {
"message": "Peut-être @$keyOk$? Métadonnée inconnue: @$keyErr$",
"placeholders": {
"keyErr": {
"content": "$1"
},
"keyOk": {
"content": "$2"
}
}
},
"meta_unknownPreprocessor": { "meta_unknownPreprocessor": {
"message": "@preprocessor inconnu: $preprocessor$", "message": "@preprocessor inconnu: $preprocessor$",
"placeholders": { "placeholders": {
@ -796,9 +734,6 @@
"noStylesForSite": { "noStylesForSite": {
"message": "Aucun style n'est installé pour ce site." "message": "Aucun style n'est installé pour ce site."
}, },
"numberedLine": {
"message": "Ligne :"
},
"openManage": { "openManage": {
"message": "Gestion" "message": "Gestion"
}, },
@ -808,15 +743,6 @@
"optionsAdvanced": { "optionsAdvanced": {
"message": "Avancé" "message": "Avancé"
}, },
"optionsAdvancedAutoSwitchSchemeBySystem": {
"message": "Par préférence système"
},
"optionsAdvancedAutoSwitchSchemeByTime": {
"message": "Par horaire nocturne :"
},
"optionsAdvancedAutoSwitchSchemeNever": {
"message": "Désactivé. Le paramètre clair/obscur dans les styles est ignoré."
},
"optionsAdvancedContextDelete": { "optionsAdvancedContextDelete": {
"message": "Ajouter « Supprimer » dans le menu contextuel de lextension" "message": "Ajouter « Supprimer » dans le menu contextuel de lextension"
}, },
@ -826,24 +752,9 @@
"optionsAdvancedExposeIframesNote": { "optionsAdvancedExposeIframesNote": {
"message": "Expose le domaine principal dans chaque iframe.\nPermet décrire du CSS spécifique aux iframe tel que :\nhtml[stylus-iframe$$=\"twitter.com\"] h1 { display:none }" "message": "Expose le domaine principal dans chaque iframe.\nPermet décrire du CSS spécifique aux iframe tel que :\nhtml[stylus-iframe$$=\"twitter.com\"] h1 { display:none }"
}, },
"optionsAdvancedExposeStyleName": {
"message": "Afficher le nom du style"
},
"optionsAdvancedExposeStyleNameNote": {
"message": "Afficher le nom du style dans la page pour faciliter le débogage des styles dans les outils de développement. Veuillez recharger le ou les onglets pour appliquer ce nouveau paramètre."
},
"optionsAdvancedNewStyleAsUsercss": { "optionsAdvancedNewStyleAsUsercss": {
"message": "Écrire un nouveau style en tant que usercss" "message": "Écrire un nouveau style en tant que usercss"
}, },
"optionsAdvancedPatchCsp": {
"message": "Corrige <code>CSP</code> pour permettre les ressources de style"
},
"optionsAdvancedPatchCspNote": {
"message": "Activez cela si les styles comportent des images ou des polices qui échoue à charger sur les sites avec une politique de sécurité de contenus stricte <code>CSP</code> (<code>Content-Security-Policy</code>).\n\nActiver cette option permettra d'alléger les restrictions du <code>CSP</code>, permettant les styles essentiels de charger. Cette option n'est entendue que pour les utilisateurs expérimentés qui comprennent les potentielles implications de sécurité que cela introduit, et accepte la responsabilité de surveiller le contenu qu'ils autorisent. Veuillez lire les attaques basé sur le CSS pour plus dinformation.\n\nAussi sachez, que cette option en particulier n'est pas garanti de fonctionner si une autre extension modifie la réponse réseau avant."
},
"optionsAdvancedStyleViaXhr": {
"message": "Mode d'injection instantanée"
},
"optionsBadgeDisabled": { "optionsBadgeDisabled": {
"message": "Couleur d'arrière plan si désactivé" "message": "Couleur d'arrière plan si désactivé"
}, },
@ -904,9 +815,6 @@
"optionsSyncNone": { "optionsSyncNone": {
"message": "Aucun" "message": "Aucun"
}, },
"optionsSyncPassword": {
"message": "Mot de passe"
},
"optionsSyncStatusConnected": { "optionsSyncStatusConnected": {
"message": "Connecté" "message": "Connecté"
}, },
@ -941,18 +849,12 @@
} }
} }
}, },
"optionsSyncStatusRelogin": {
"message": "Session expirée, veuillez vous reconnecter à nouveau."
},
"optionsSyncStatusSyncing": { "optionsSyncStatusSyncing": {
"message": "Synchronisation..." "message": "Synchronisation..."
}, },
"optionsSyncSyncNow": { "optionsSyncSyncNow": {
"message": "Synchroniser maintenant" "message": "Synchroniser maintenant"
}, },
"optionsSyncUsername": {
"message": "Nom dutilisateur"
},
"optionsUpdateImportNote": { "optionsUpdateImportNote": {
"message": "Quand vous importez des sauvegardes de style dune ancienne version ou de Stylish, faites une vérification manuellement pour vous assurez que tous les styles sont à jour." "message": "Quand vous importez des sauvegardes de style dune ancienne version ou de Stylish, faites une vérification manuellement pour vous assurez que tous les styles sont à jour."
}, },
@ -1001,9 +903,6 @@
"popupMenuButtonTooltip": { "popupMenuButtonTooltip": {
"message": "Actions" "message": "Actions"
}, },
"popupOpenEditInPopup": {
"message": "Utiliser une simple fenêtre (pas d'omnibox)"
},
"popupOpenEditInWindow": { "popupOpenEditInWindow": {
"message": "Ouvrir l'éditeur dans une nouvelle fenêtre" "message": "Ouvrir l'éditeur dans une nouvelle fenêtre"
}, },
@ -1016,41 +915,17 @@
"prefShowBadge": { "prefShowBadge": {
"message": "Afficher le nombre de styles actifs pour le site actuel sur le boutton Stylus" "message": "Afficher le nombre de styles actifs pour le site actuel sur le boutton Stylus"
}, },
"preferSchemeDark": {
"message": "Obscur"
},
"preferSchemeLight": {
"message": "Clair"
},
"preferSchemeNone": {
"message": "Aucun (quand appliqué)"
},
"previewLabel": { "previewLabel": {
"message": "Prévisualiser en direct" "message": "Prévisualiser en direct"
}, },
"previewTooltip": { "previewTooltip": {
"message": "Applique temporairement les changements sans sauvegarder.\nSauvegarde le style pour rendre les changements permanents." "message": "Applique temporairement les changements sans sauvegarder.\nSauvegarde le style pour rendre les changements permanents."
}, },
"publish": {
"message": "Publier"
},
"publishPush": {
"message": "Pousser la mise à jour"
},
"publishReconnect": {
"message": "Essayez de vous déconnecter et de publier à nouveau"
},
"publishStyle": {
"message": "Publier le style"
},
"publishUsw": {
"message": "Utiliser <userstyles.world>"
},
"readingStyles": { "readingStyles": {
"message": "Lecture des styles…" "message": "Lecture des styles…"
}, },
"reload": { "reload": {
"message": "Recharger" "message": "Recharger l´extension Stylus"
}, },
"replace": { "replace": {
"message": "Remplacer" "message": "Remplacer"
@ -1067,18 +942,12 @@
"retrieveDropboxSync": { "retrieveDropboxSync": {
"message": "Importer depuis Dropbox" "message": "Importer depuis Dropbox"
}, },
"saveAsTemplate": {
"message": "Sauvegarder comme modèle"
},
"search": { "search": {
"message": "Rechercher" "message": "Rechercher"
}, },
"searchCaseSensitive": { "searchCaseSensitive": {
"message": "Sensible à la casse" "message": "Sensible à la casse"
}, },
"searchGlobalStyles": {
"message": "Chercher aussi des styles globaux."
},
"searchNumberOfResults": { "searchNumberOfResults": {
"message": "Nombre de correspondances" "message": "Nombre de correspondances"
}, },
@ -1094,12 +963,6 @@
"searchResultNoneFound": { "searchResultNoneFound": {
"message": "Aucun style trouvé pour ce site" "message": "Aucun style trouvé pour ce site"
}, },
"searchResultNotMatching": {
"message": "Ce style est installé mais il ne s'applique pas au lien du site actuel."
},
"searchResultNotMatchingNote": {
"message": "Essaye de demander lauteur pour ajouter le lien l'URL.\n\nVous pouvez aussi ouvrir le style dans le gestionnaire et l'éditer soit-même,\nmais soyez avertis que cela désactive les mises à jour automatiques pour ce style."
},
"searchResultRating": { "searchResultRating": {
"message": "Note" "message": "Note"
}, },
@ -1109,21 +972,6 @@
"searchResultWeeklyCount": { "searchResultWeeklyCount": {
"message": "Installations hebdomadaires" "message": "Installations hebdomadaires"
}, },
"searchStylesAll": {
"message": "Tout"
},
"searchStylesCode": {
"message": "Code CSS"
},
"searchStylesMatchUrl": {
"message": "Par lien"
},
"searchStylesMeta": {
"message": "Meta-données"
},
"searchStylesName": {
"message": "Nom"
},
"sectionAdd": { "sectionAdd": {
"message": "Ajouter une section" "message": "Ajouter une section"
}, },
@ -1133,9 +981,6 @@
"sectionRestore": { "sectionRestore": {
"message": "Restaurer la section supprimée" "message": "Restaurer la section supprimée"
}, },
"settings": {
"message": "Paramètres"
},
"shortcuts": { "shortcuts": {
"message": "Raccourcis" "message": "Raccourcis"
}, },
@ -1169,9 +1014,6 @@
"styleBeautify": { "styleBeautify": {
"message": "Embellir " "message": "Embellir "
}, },
"styleBeautifyHint": {
"message": "Astuce : Cliquez-droit le bouton \"Beautify\" ou utilisez le raccourci clavier définit ci-dessous pour beautify sans montrer le panneau."
},
"styleBeautifyIndentConditional": { "styleBeautifyIndentConditional": {
"message": "Indenter @media, @supports" "message": "Indenter @media, @supports"
}, },
@ -1187,9 +1029,6 @@
"styleEnabledLabel": { "styleEnabledLabel": {
"message": "Activé" "message": "Activé"
}, },
"styleExcludeLabel": {
"message": "Personnalisation des sites exclus"
},
"styleFromMozillaFormatError": { "styleFromMozillaFormatError": {
"message": "Échec de l'importation depuis le format Mozilla" "message": "Échec de l'importation depuis le format Mozilla"
}, },
@ -1232,21 +1071,9 @@
"styleMozillaFormatHeading": { "styleMozillaFormatHeading": {
"message": "Format Mozilla" "message": "Format Mozilla"
}, },
"styleName": {
"message": "Nom du style"
},
"styleNotAppliedRegexpProblemTooltip": { "styleNotAppliedRegexpProblemTooltip": {
"message": "Le style n'a pu s'appliquer en raison d'une utilisation erronée de 'regexp()'" "message": "Le style n'a pu s'appliquer en raison d'une utilisation erronée de 'regexp()'"
}, },
"styleNotAppliedSchemeDark": {
"message": "Ce style est uniquement appliqué en mode sombre"
},
"styleNotAppliedSchemeLight": {
"message": "Ce style est uniquement appliqué en mode clair"
},
"stylePreferSchemeLabel": {
"message": "Mode clair/sombre"
},
"styleRegexpInvalidExplanation": { "styleRegexpInvalidExplanation": {
"message": "Quelques règles 'regexp()' qui nont pas pu être compilées" "message": "Quelques règles 'regexp()' qui nont pas pu être compilées"
}, },
@ -1256,6 +1083,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "Nombre de sections non appliquées à cause dune utilisation incorrecte de 'regexp()'" "message": "Nombre de sections non appliquées à cause dune utilisation incorrecte de 'regexp()'"
}, },
"styleRegexpTestButton": {
"message": "Test dexpression rationnelle"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "Onglets correspondants" "message": "Onglets correspondants"
}, },
@ -1277,9 +1107,6 @@
"styleSaveLabel": { "styleSaveLabel": {
"message": "Enregistrer" "message": "Enregistrer"
}, },
"styleSettings": {
"message": "Paramètres du style"
},
"styleToMozillaFormatHelp": { "styleToMozillaFormatHelp": {
"message": "Le code au format Mozilla peut être utilisé dans Stylish for Firefox et envoyé à userstyles.org." "message": "Le code au format Mozilla peut être utilisé dans Stylish for Firefox et envoyé à userstyles.org."
}, },
@ -1297,9 +1124,6 @@
"styleUpdateDiscardChanges": { "styleUpdateDiscardChanges": {
"message": "Le style a été changé en dehors de léditeur. Voulez-vous recharger le style ?" "message": "Le style a été changé en dehors de léditeur. Voulez-vous recharger le style ?"
}, },
"styleUpdateUrlLabel": {
"message": "URL de mise à jour"
},
"stylusUnavailableForURL": { "stylusUnavailableForURL": {
"message": "Stylus ne fonctionne pas sur les pages de ce genre" "message": "Stylus ne fonctionne pas sur les pages de ce genre"
}, },
@ -1312,17 +1136,6 @@
"syncDropboxStyles": { "syncDropboxStyles": {
"message": "Exporter vers Dropbox" "message": "Exporter vers Dropbox"
}, },
"syncError": {
"message": "Synchronisation échouée"
},
"syncErrorLock": {
"message": "Cette base de données est déjà utilisée. Le verrouillage expirera le $TIME$",
"placeholders": {
"time": {
"content": "$1"
}
}
},
"syncStorageErrorSaving": { "syncStorageErrorSaving": {
"message": "La valeur ne peut pas être sauvegardée. Essayez de réduire la quantité de texte." "message": "La valeur ne peut pas être sauvegardée. Essayez de réduire la quantité de texte."
}, },
@ -1347,12 +1160,6 @@
"unreachableFileHint": { "unreachableFileHint": {
"message": "Stylus peut accéder aux URL file:// uniquement si vous cochez la case correspondante pour lextension Stylus sur la page chrome://extensions." "message": "Stylus peut accéder aux URL file:// uniquement si vous cochez la case correspondante pour lextension Stylus sur la page chrome://extensions."
}, },
"unreachableMozSiteHint": {
"message": "Dans Firefox 60 et plus récent vous devez retirer ce domaine de <extensions.webextensions.restrictedDomains> dans <about:config>."
},
"unreachableMozSiteHintOldFF": {
"message": "Seulement dans Firefox 59 et plus récent que les extensions-web peuvent être configurés pour autoriser de rajouter des éléments de style sur les sites protégés CSP comme celui-ci."
},
"unzipStyles": { "unzipStyles": {
"message": "Décompression des styles…" "message": "Décompression des styles…"
}, },
@ -1412,6 +1219,9 @@
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "Remplacer le modèle par défaut pour les nouveaux styles Usercss par le code actuel ?" "message": "Remplacer le modèle par défaut pour les nouveaux styles Usercss par le code actuel ?"
}, },
"usercssReplaceTemplateName": {
"message": "Un @name vide remplace le modèle par défaut"
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "Insérer le code ici..." "message": "Insérer le code ici..."
}, },

View File

@ -67,6 +67,9 @@
"backupButtons": { "backupButtons": {
"message": "גיבוי" "message": "גיבוי"
}, },
"backupMessage": {
"message": "בחר קובץ או גרור ושחרר אותו בדף זה."
},
"bckpInstStyles": { "bckpInstStyles": {
"message": "ייצא עיצובים" "message": "ייצא עיצובים"
}, },
@ -293,6 +296,15 @@
"findStyles": { "findStyles": {
"message": "מצא עיצובים" "message": "מצא עיצובים"
}, },
"findStylesForSite": {
"message": "מצא סגנונות נוספים לאתר זה"
},
"findStylesInline": {
"message": "מוטבע"
},
"findStylesInlineTooltip": {
"message": "הצג תוצאות חיפוש בחלון זה."
},
"genericAdd": { "genericAdd": {
"message": "הוספה" "message": "הוספה"
}, },
@ -484,6 +496,9 @@
"manageFaviconsGray": { "manageFaviconsGray": {
"message": "האפרת האייקונים" "message": "האפרת האייקונים"
}, },
"manageFaviconsHelp": {
"message": "Stylus משתמש בשירות חיצוני https://www.google.com/s2/favicons"
},
"manageFilters": { "manageFilters": {
"message": "מסננים" "message": "מסננים"
}, },
@ -688,9 +703,6 @@
"optionsSyncSyncNow": { "optionsSyncSyncNow": {
"message": "סנכרן כעת" "message": "סנכרן כעת"
}, },
"optionsSyncUrl": {
"message": "כתובת אתר"
},
"optionsUpdateImportNote": { "optionsUpdateImportNote": {
"message": "בעת ייבוא גיבויים לסגנון מגרסה ישנה או מ־Stylish, בדוק באופן חד פעמי אם יש עדכונים באופן ידני במנהל הסגנונות כדי לוודא שכל הסגנונות מעודכנים." "message": "בעת ייבוא גיבויים לסגנון מגרסה ישנה או מ־Stylish, בדוק באופן חד פעמי אם יש עדכונים באופן ידני במנהל הסגנונות כדי לוודא שכל הסגנונות מעודכנים."
}, },
@ -754,6 +766,9 @@
"readingStyles": { "readingStyles": {
"message": "קורא עיצובים..." "message": "קורא עיצובים..."
}, },
"reload": {
"message": "טען מחדש את Stylus"
},
"replace": { "replace": {
"message": "החלף" "message": "החלף"
}, },
@ -811,9 +826,6 @@
"sectionRestore": { "sectionRestore": {
"message": "שחזר סעיף שהוסר" "message": "שחזר סעיף שהוסר"
}, },
"sections": {
"message": "סעיפים"
},
"shortcuts": { "shortcuts": {
"message": "קיצורי מקשים" "message": "קיצורי מקשים"
}, },
@ -907,6 +919,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "מספר המקטעים שלא הוחלו עקב שימוש שגוי ב־'regexp()'" "message": "מספר המקטעים שלא הוחלו עקב שימוש שגוי ב־'regexp()'"
}, },
"styleRegexpTestButton": {
"message": "בדוק RegExp"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "כרטיסיות תואמות" "message": "כרטיסיות תואמות"
}, },

View File

@ -67,6 +67,9 @@
"backupButtons": { "backupButtons": {
"message": "Biztonsági mentés" "message": "Biztonsági mentés"
}, },
"backupMessage": {
"message": "Válassz ki egy fájlt vagy húzd erre az oldalra!"
},
"bckpInstStyles": { "bckpInstStyles": {
"message": "Stílusok exportálása" "message": "Stílusok exportálása"
}, },
@ -287,6 +290,15 @@
"findStyles": { "findStyles": {
"message": "Stílusok keresése" "message": "Stílusok keresése"
}, },
"findStylesForSite": {
"message": "További stílusok keresése ehhez az oldalhoz"
},
"findStylesInline": {
"message": "Helyben"
},
"findStylesInlineTooltip": {
"message": "Keresési eredmények megjelenítése ebben az ablakban."
},
"genericAdd": { "genericAdd": {
"message": "Hozzáadás" "message": "Hozzáadás"
}, },
@ -476,7 +488,7 @@
"message": "Megjelenítés szürkítve" "message": "Megjelenítés szürkítve"
}, },
"manageFaviconsHelp": { "manageFaviconsHelp": {
"message": "A Stylus külső szolgáltatást használ (https://icons.duckduckgo.com)" "message": "A Stylus külső szolgáltatást használ (https://www.google.com/s2/favicons)"
}, },
"manageFilters": { "manageFilters": {
"message": "Szűrők" "message": "Szűrők"
@ -710,9 +722,6 @@
"openManage": { "openManage": {
"message": "Kezelés" "message": "Kezelés"
}, },
"openOptions": {
"message": "Beállítások"
},
"openStylesManager": { "openStylesManager": {
"message": "Stíluskezelő megnyitása" "message": "Stíluskezelő megnyitása"
}, },
@ -966,9 +975,6 @@
"sectionRestore": { "sectionRestore": {
"message": "Eltávolított szekció visszaállítása" "message": "Eltávolított szekció visszaállítása"
}, },
"sections": {
"message": "Szekciók"
},
"shortcuts": { "shortcuts": {
"message": "Gyorsbillentyűk" "message": "Gyorsbillentyűk"
}, },
@ -1071,6 +1077,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "A nem alkalmazott szeckiók száma helytelen 'regexp()' használat miatt" "message": "A nem alkalmazott szeckiók száma helytelen 'regexp()' használat miatt"
}, },
"styleRegexpTestButton": {
"message": "RegExp tesztelése"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "Illeszkedő fülek" "message": "Illeszkedő fülek"
}, },
@ -1142,9 +1151,6 @@
"unreachableFileHint": { "unreachableFileHint": {
"message": "A Stylus csak akkor képes hozzáférni a file:// URL-ekhez, ha engedélyezed az erre vonatkozó beállítást a Stylus kiegészítőre a chrome://extensions oldalon." "message": "A Stylus csak akkor képes hozzáférni a file:// URL-ekhez, ha engedélyezed az erre vonatkozó beállítást a Stylus kiegészítőre a chrome://extensions oldalon."
}, },
"unreachableMozSiteHintOldFF": {
"message": "Csak a Firefox 59 vagy annál újabb állítható be az ilyen CSP-védett oldalak stílusának átszabása WebExtensions kiegészítőkön keresztül."
},
"unzipStyles": { "unzipStyles": {
"message": "Stílusok kibontása..." "message": "Stílusok kibontása..."
}, },
@ -1204,6 +1210,9 @@
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "Le legyen cserélve az alapértelmezett sablon az új Usercss stílusokhoz a jelenlegi kóddal?" "message": "Le legyen cserélve az alapértelmezett sablon az új Usercss stílusokhoz a jelenlegi kóddal?"
}, },
"usercssReplaceTemplateName": {
"message": "Az üres @name lecseréli az alapértelmezett sablont"
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "Írj kódot ide…" "message": "Írj kódot ide…"
}, },

View File

@ -1,9 +1,6 @@
{ {
"InaccessibleFileHint": {
"message": "Stylus non può accedere ad alcuni tipi di file (ad es. pdf & JSON)"
},
"addStyleLabel": { "addStyleLabel": {
"message": "Scrivi un nuovo stile" "message": "Scrivi nuovo stile"
}, },
"addStyleTitle": { "addStyleTitle": {
"message": "Aggiungi stili" "message": "Aggiungi stili"
@ -62,7 +59,7 @@
"message": "Autore" "message": "Autore"
}, },
"backupMessage": { "backupMessage": {
"message": "Per importare il file di backup, selezionalo e rilascialo in questa pagina oppure utilizza il bottone Importa\n\nPer esportare un backup compatibile con Stylus versione 1.5.18 e oltre, selezionalo col tasto destro oppure shift-click il pulsante Esporta" "message": "Seleziona un file o trascinalo in questa pagina."
}, },
"bckpInstStyles": { "bckpInstStyles": {
"message": "Esporta stili" "message": "Esporta stili"
@ -127,9 +124,6 @@
"cm_theme": { "cm_theme": {
"message": "Tema" "message": "Tema"
}, },
"colorpickerSwitchFormatTooltip": {
"message": "Cambia formato: HEX -> RGB -> HSL.\nShift-click per invertire la direzione.\nAnche con i tasti PgUp (PaginaSu), PgDn (PaginaGiù)."
},
"colorpickerTooltip": { "colorpickerTooltip": {
"message": "Apri selettore colore" "message": "Apri selettore colore"
}, },
@ -166,18 +160,6 @@
"confirmYes": { "confirmYes": {
"message": "Si" "message": "Si"
}, },
"connectingDropboxNotAllowed": {
"message": "La connessione a Dropbox è disponibile soltanto nelle app installate direttamente dal webstore"
},
"copied": {
"message": "Copiato negli appunti"
},
"copy": {
"message": "Copia negli appunti"
},
"customNameHint": {
"message": "Inserisci qui un nome personalizzato per rinominare lo stile nell'interfaccia utente (UI) senza rompere i suoi aggiornamenti"
},
"dateInstalled": { "dateInstalled": {
"message": "Data installazione" "message": "Data installazione"
}, },
@ -257,6 +239,12 @@
"findStyles": { "findStyles": {
"message": "Trova stili" "message": "Trova stili"
}, },
"findStylesForSite": {
"message": "Trova più stili per questo sito"
},
"findStylesInlineTooltip": {
"message": "Visualizza risultati in questa finestra."
},
"genericAdd": { "genericAdd": {
"message": "Aggiungi" "message": "Aggiungi"
}, },
@ -411,6 +399,9 @@
"liveReloadLabel": { "liveReloadLabel": {
"message": "Ricaricamento live" "message": "Ricaricamento live"
}, },
"manageFaviconsHelp": {
"message": "Stylus utilizza un servizio esterno https://www.google.com/s2/favicons"
},
"manageFilters": { "manageFilters": {
"message": "Filtri" "message": "Filtri"
}, },
@ -497,9 +488,6 @@
"openManage": { "openManage": {
"message": "Gestisci gli stili installati" "message": "Gestisci gli stili installati"
}, },
"openOptions": {
"message": "Opzioni"
},
"openStylesManager": { "openStylesManager": {
"message": "Apri gestore stili" "message": "Apri gestore stili"
}, },
@ -638,9 +626,6 @@
"sectionRemove": { "sectionRemove": {
"message": "Rimuovi sezione" "message": "Rimuovi sezione"
}, },
"sections": {
"message": "Sezioni"
},
"shortcuts": { "shortcuts": {
"message": "Scorciatoie" "message": "Scorciatoie"
}, },
@ -728,6 +713,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "Numero di sezioni non applicato a causa dell'uso errato di 'regexp()'" "message": "Numero di sezioni non applicato a causa dell'uso errato di 'regexp()'"
}, },
"styleRegexpTestButton": {
"message": "Test RegExp"
},
"styleRegexpTestInvalid": { "styleRegexpTestInvalid": {
"message": "Regexp invalida ignorata" "message": "Regexp invalida ignorata"
}, },
@ -766,9 +754,6 @@
"unreachableContentScript": { "unreachableContentScript": {
"message": "Impossibile comunicare con la pagina. Prova a ricaricare la scheda." "message": "Impossibile comunicare con la pagina. Prova a ricaricare la scheda."
}, },
"unreachableMozSiteHintOldFF": {
"message": "Solo Firefox 59 e successivi possono essere configurati per consentire alle WebExtensions di aggiungere elementi degli stili su siti CSP-protected come questo."
},
"updateAllCheckSucceededNoUpdate": { "updateAllCheckSucceededNoUpdate": {
"message": "Nessun aggiornamento trovato" "message": "Nessun aggiornamento trovato"
}, },

View File

@ -68,7 +68,7 @@
"message": "バックアップ" "message": "バックアップ"
}, },
"backupMessage": { "backupMessage": {
"message": "バックアップファイルをインポートする場合、このページにドラッグ&ドロップするか、インポートボタンをクリックしてください。\nまた、Stylus 1.5.18 より古い形式でバックアップしたい場合は、エクスポートボタンを 右クリック もしくは shift-クリック してください。" "message": "ファイルを選択するか、このページにドラッグ&ドロップしてください。"
}, },
"bckpInstStyles": { "bckpInstStyles": {
"message": "スタイルをエクスポート" "message": "スタイルをエクスポート"
@ -226,23 +226,9 @@
"disableAllStyles": { "disableAllStyles": {
"message": "すべてのスタイルをオフにする" "message": "すべてのスタイルをオフにする"
}, },
"disableAllStylesOff": {
"message": "全スタイルをOFFにする"
},
"disableStyleLabel": { "disableStyleLabel": {
"message": "無効化" "message": "無効化"
}, },
"draftAction": {
"message": "このデータをロードするならば「はい」を、破棄するならば「いいえ」を選択してください。"
},
"draftTitle": {
"message": "$date$に作成されたデータ",
"placeholders": {
"date": {
"content": "$1"
}
}
},
"dragDropMessage": { "dragDropMessage": {
"message": "このページの任意の場所にバックアップファイルをドロップしてインポートします。" "message": "このページの任意の場所にバックアップファイルをドロップしてインポートします。"
}, },
@ -269,9 +255,6 @@
} }
} }
}, },
"editorSettings": {
"message": "エディタ設定"
},
"enableStyleLabel": { "enableStyleLabel": {
"message": "有効化" "message": "有効化"
}, },
@ -281,9 +264,6 @@
"excludeStyleByUrlLabel": { "excludeStyleByUrlLabel": {
"message": "現在のURLを除外" "message": "現在のURLを除外"
}, },
"exportCompatible": {
"message": "エクスポート(互換モード)"
},
"exportLabel": { "exportLabel": {
"message": "エクスポート" "message": "エクスポート"
}, },
@ -322,6 +302,15 @@
"findStyles": { "findStyles": {
"message": "スタイルを検索" "message": "スタイルを検索"
}, },
"findStylesForSite": {
"message": "このサイト用のスタイルを検索"
},
"findStylesInline": {
"message": "結果を下に表示"
},
"findStylesInlineTooltip": {
"message": "検索結果をこのウィンドウに表示"
},
"genericAdd": { "genericAdd": {
"message": "追加" "message": "追加"
}, },
@ -355,12 +344,6 @@
"genericSavedMessage": { "genericSavedMessage": {
"message": "保存しました" "message": "保存しました"
}, },
"genericSize": {
"message": "サイズ"
},
"genericTest": {
"message": "テスト"
},
"genericTitle": { "genericTitle": {
"message": "タイトル" "message": "タイトル"
}, },
@ -370,9 +353,6 @@
"gettingStyles": { "gettingStyles": {
"message": "全スタイルを取得中..." "message": "全スタイルを取得中..."
}, },
"headerResizerHint": {
"message": "この種のUIエディタ、管理、インストーラの中では、Shiftを押しながらリサイズしてください"
},
"helpAlt": { "helpAlt": {
"message": "ヘルプ" "message": "ヘルプ"
}, },
@ -550,7 +530,7 @@
"message": "ファビコンをグレー表示" "message": "ファビコンをグレー表示"
}, },
"manageFaviconsHelp": { "manageFaviconsHelp": {
"message": "Stylusは外部サービスを使用します https://icons.duckduckgo.com" "message": "Stylusは外部サービスを使用します https://www.google.com/s2/favicons"
}, },
"manageFilters": { "manageFilters": {
"message": "フィルター" "message": "フィルター"
@ -561,9 +541,6 @@
"manageMaxTargets": { "manageMaxTargets": {
"message": "適用先欄の表示件数" "message": "適用先欄の表示件数"
}, },
"manageMinColumnWidth": {
"message": "最小カラム幅 (ピクセル単位。9999にすると、マルチカラムモードを無効にします)"
},
"manageNewStyleAsUsercss": { "manageNewStyleAsUsercss": {
"message": "Usercssとして" "message": "Usercssとして"
}, },
@ -813,15 +790,6 @@
"optionsAdvanced": { "optionsAdvanced": {
"message": "上級者向け" "message": "上級者向け"
}, },
"optionsAdvancedAutoSwitchSchemeBySystem": {
"message": "システム設定による"
},
"optionsAdvancedAutoSwitchSchemeByTime": {
"message": "夜間時間による"
},
"optionsAdvancedAutoSwitchSchemeNever": {
"message": "無効。スタイルの暗い/明るい設定は無視されます。"
},
"optionsAdvancedContextDelete": { "optionsAdvancedContextDelete": {
"message": "エディタのコンテキストメニューに「削除」を追加する" "message": "エディタのコンテキストメニューに「削除」を追加する"
}, },
@ -831,12 +799,6 @@
"optionsAdvancedExposeIframesNote": { "optionsAdvancedExposeIframesNote": {
"message": "各iframeにトップサイトドメインを公開します。\n次のようにiframe用のCSSを書くことができるようになります:\nhtml[stylus-iframe$$=\"twitter.com\"] h1 { display:none }" "message": "各iframeにトップサイトドメインを公開します。\n次のようにiframe用のCSSを書くことができるようになります:\nhtml[stylus-iframe$$=\"twitter.com\"] h1 { display:none }"
}, },
"optionsAdvancedExposeStyleName": {
"message": "スタイル名を公開"
},
"optionsAdvancedExposeStyleNameNote": {
"message": "開発ツールでスタイルのデバッグを容易にするため、ページ内にスタイル名を公開します。タブをリロードして新しい設定を適用してください。"
},
"optionsAdvancedNewStyleAsUsercss": { "optionsAdvancedNewStyleAsUsercss": {
"message": "新しいスタイルを usercss として作成します" "message": "新しいスタイルを usercss として作成します"
}, },
@ -882,9 +844,6 @@
"optionsHeading": { "optionsHeading": {
"message": "オプション" "message": "オプション"
}, },
"optionsIconAuto": {
"message": "暗い/明るいモード設定に合わせます"
},
"optionsIconDark": { "optionsIconDark": {
"message": "暗いブラウザのテーマ" "message": "暗いブラウザのテーマ"
}, },
@ -907,7 +866,7 @@
"message": "オプションをリセット" "message": "オプションをリセット"
}, },
"optionsStylusThemes": { "optionsStylusThemes": {
"message": "このページを含む任意のStylusのページで、ブラウザのツールバー内のStylusアイコンをクリックして、「スタイルを見つける」をクリックします" "message": "StylusのUIテーマを見つける"
}, },
"optionsSubheading": { "optionsSubheading": {
"message": "その他のオプション" "message": "その他のオプション"
@ -924,9 +883,6 @@
"optionsSyncNone": { "optionsSyncNone": {
"message": "未選択" "message": "未選択"
}, },
"optionsSyncPassword": {
"message": "パスワード"
},
"optionsSyncStatusConnected": { "optionsSyncStatusConnected": {
"message": "接続状態" "message": "接続状態"
}, },
@ -970,9 +926,6 @@
"optionsSyncSyncNow": { "optionsSyncSyncNow": {
"message": "すぐに同期" "message": "すぐに同期"
}, },
"optionsSyncUsername": {
"message": "ユーザ名"
},
"optionsUpdateImportNote": { "optionsUpdateImportNote": {
"message": "旧バージョンまたはStylishからスタイルのバックアップをインポートする場合は、スタイルマネージャで一度手動で更新チェックを行い、すべてのスタイルが確実に更新されるようにしてください。" "message": "旧バージョンまたはStylishからスタイルのバックアップをインポートする場合は、スタイルマネージャで一度手動で更新チェックを行い、すべてのスタイルが確実に更新されるようにしてください。"
}, },
@ -1015,9 +968,6 @@
"popupHotkeysTooltip": { "popupHotkeysTooltip": {
"message": "クリックすると使用可能なホットキーを表示します" "message": "クリックすると使用可能なホットキーを表示します"
}, },
"popupManageSiteStyles": {
"message": "サイトのスタイルを管理"
},
"popupManageTooltip": { "popupManageTooltip": {
"message": "シフトを押しながらクリック または 右クリック で、現在のサイトに適用可能なスタイルの管理画面を開きます" "message": "シフトを押しながらクリック または 右クリック で、現在のサイトに適用可能なスタイルの管理画面を開きます"
}, },
@ -1039,21 +989,6 @@
"prefShowBadge": { "prefShowBadge": {
"message": "現在のサイトで有効なスタイルの数を表示" "message": "現在のサイトで有効なスタイルの数を表示"
}, },
"preferScheme": {
"message": "暗い/明るいモード設定"
},
"preferSchemeAlways": {
"message": "グローバルな暗い/明るいモード設定が無効になっているため、現在は無視されます(スタイルは常に適用されます)"
},
"preferSchemeDark": {
"message": "暗い"
},
"preferSchemeLight": {
"message": "明るい"
},
"preferSchemeNone": {
"message": "なし(常に適用)"
},
"previewLabel": { "previewLabel": {
"message": "自動プレビュー" "message": "自動プレビュー"
}, },
@ -1082,7 +1017,7 @@
"message": "スタイルを読み込み中..." "message": "スタイルを読み込み中..."
}, },
"reload": { "reload": {
"message": "リロード" "message": "Stylus拡張をリロードする"
}, },
"replace": { "replace": {
"message": "置換" "message": "置換"
@ -1093,18 +1028,12 @@
"replaceWith": { "replaceWith": {
"message": "次に置換" "message": "次に置換"
}, },
"restoreTemplate": {
"message": "デフォルトのテンプレートに戻す。\n\n現在エディタで開いているものは変化しません。"
},
"retrieveBckp": { "retrieveBckp": {
"message": "スタイルをインポート" "message": "スタイルをインポート"
}, },
"retrieveDropboxSync": { "retrieveDropboxSync": {
"message": "Dropboxからインポート" "message": "Dropboxからインポート"
}, },
"saveAsTemplate": {
"message": "テンプレートとして保存"
},
"search": { "search": {
"message": "検索" "message": "検索"
}, },
@ -1145,7 +1074,7 @@
"message": "週間インストール数" "message": "週間インストール数"
}, },
"searchStyleQueryHint": { "searchStyleQueryHint": {
"message": "スタイル名を検索します (大文字を使用すると、大文字小文字を区別して検索します) :\n複数の単語 - すべての単語を (順不同で) 含む\n\"複数の単語からなるフレーズ\" - 正確なフレーズを (引用符は除いて) 探す\n/foo.*bar/i - 正規表現 (空白は使用不可。空白を使いたい場合は、代わりに \\s を使ってください)" "message": "スタイル名を大文字小文字の区別なく検索します:\n複数の単語 - 全単語を順番の区別なく検索します\n\"複数の単語からなるフレーズ\" - 正確なフレーズを (引用符は除いて) 検索します\n2020 - このように数値 (年) を指定すると、2020年に更新されたスタイルも結果に表示します"
}, },
"searchStylesAll": { "searchStylesAll": {
"message": "すべて" "message": "すべて"
@ -1180,18 +1109,12 @@
"sections": { "sections": {
"message": "セクション" "message": "セクション"
}, },
"settings": {
"message": "設定"
},
"shortcuts": { "shortcuts": {
"message": "ショートカット" "message": "ショートカット"
}, },
"shortcutsNote": { "shortcutsNote": {
"message": "キーボードショートカットを定義する" "message": "キーボードショートカットを定義する"
}, },
"shortcutsNoteFF": {
"message": "Firefox 66+ では、ビルトインのショートカットUIを手動で開けます。\n1ツールバーのStylusアイコンを右クリックして、「管理」を選択します。\nもしくは、メインメニューでabout:addonsを開くかCtrl-Shift-Aを押します\n2開いたページの右上隅にある歯車のアイコンをクリックします。\n3「拡張機能のショートカットの管理」を選択します。\n\nまた、ショートカットをここで設定することもできます。"
},
"sortDateNewestFirst": { "sortDateNewestFirst": {
"message": "新しい順" "message": "新しい順"
}, },
@ -1237,30 +1160,12 @@
"styleEnabledLabel": { "styleEnabledLabel": {
"message": "有効" "message": "有効"
}, },
"styleExcludeLabel": {
"message": "含めないサイトを設定"
},
"styleFromMozillaFormatError": { "styleFromMozillaFormatError": {
"message": "Mozilla形式のインポートに失敗しました" "message": "Mozilla形式のインポートに失敗しました"
}, },
"styleFromMozillaFormatPrompt": { "styleFromMozillaFormatPrompt": {
"message": "Mozilla形式のコードを貼り付ける" "message": "Mozilla形式のコードを貼り付ける"
}, },
"styleIncludeLabel": {
"message": "含めるサイトを設定"
},
"styleInjectionImportance": {
"message": "スタイルの重要度を設定/解除する"
},
"styleInjectionOrder": {
"message": "スタイルの適用順"
},
"styleInjectionOrderHint": {
"message": "ドラッグ&ドロップでスタイルの位置を変更できます。スタイルは表示の順番に適用されるため、リストのより下にあるスタイルは、上のものを上書きできます。"
},
"styleInjectionOrderHint_prio": {
"message": "以下に表示される重要なスタイルは、常に最後に挿入されるため、新しくインストールしたスタイルを上書きできます。スタイルをクリックして重要度を設定/解除してください。"
},
"styleInstall": { "styleInstall": {
"message": "「$stylename$」を Stylus にインストールしますか?", "message": "「$stylename$」を Stylus にインストールしますか?",
"placeholders": { "placeholders": {
@ -1300,15 +1205,6 @@
"styleNotAppliedRegexpProblemTooltip": { "styleNotAppliedRegexpProblemTooltip": {
"message": "'regexp()' の誤った使用のためスタイルを適用できませんでした" "message": "'regexp()' の誤った使用のためスタイルを適用できませんでした"
}, },
"styleNotAppliedSchemeDark": {
"message": "スタイルはダークモード時のみ適用されます"
},
"styleNotAppliedSchemeLight": {
"message": "スタイルはライトモード時のみ適用されます"
},
"stylePreferSchemeLabel": {
"message": "暗い/明るい モード"
},
"styleRegexpInvalidExplanation": { "styleRegexpInvalidExplanation": {
"message": "いくつかの 'regexp()' のルールはコンパイルできませんでした" "message": "いくつかの 'regexp()' のルールはコンパイルできませんでした"
}, },
@ -1318,6 +1214,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "'regexp()' の誤った使用のためいくつかのセクションを適用できませんでした" "message": "'regexp()' の誤った使用のためいくつかのセクションを適用できませんでした"
}, },
"styleRegexpTestButton": {
"message": "正規表現をテスト"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "一致するタブ" "message": "一致するタブ"
}, },
@ -1339,9 +1238,6 @@
"styleSaveLabel": { "styleSaveLabel": {
"message": "保存" "message": "保存"
}, },
"styleSettings": {
"message": "スタイル設定"
},
"styleToMozillaFormatHelp": { "styleToMozillaFormatHelp": {
"message": "Mozilla形式のコードは、userstyles.org に投稿することができ、また従来の Stylish for Firefox でも使用できます" "message": "Mozilla形式のコードは、userstyles.org に投稿することができ、また従来の Stylish for Firefox でも使用できます"
}, },
@ -1359,9 +1255,6 @@
"styleUpdateDiscardChanges": { "styleUpdateDiscardChanges": {
"message": "このスタイルはエディタの外部で変更されました。このスタイルをリロードしますか?" "message": "このスタイルはエディタの外部で変更されました。このスタイルをリロードしますか?"
}, },
"styleUpdateUrlLabel": {
"message": "更新URL"
},
"stylusUnavailableForURL": { "stylusUnavailableForURL": {
"message": "このページではStylusは動作しません。" "message": "このページではStylusは動作しません。"
}, },
@ -1377,16 +1270,8 @@
"syncError": { "syncError": {
"message": "同期に失敗" "message": "同期に失敗"
}, },
"syncErrorLock": {
"message": "データベースが使用中です。\nロック状態は$TIME$に解除されます。",
"placeholders": {
"time": {
"content": "$1"
}
}
},
"syncErrorRelogin": { "syncErrorRelogin": {
"message": "同期に失敗しました。ログアウトした可能性があります。\nStylusのオプション画面で再ログインしてください。" "message": "同期に失敗しました。\nStylusのオプション画面で、再ログインしてください :\n「切断」をクリック後、「接続」をクリック"
}, },
"syncStorageErrorSaving": { "syncStorageErrorSaving": {
"message": "値を保存できません。テキストの量を減らしてください。" "message": "値を保存できません。テキストの量を減らしてください。"
@ -1477,6 +1362,9 @@
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "現在のコードで、新しいUsercssスタイルのデフォルト・テンプレートを置き換えますか" "message": "現在のコードで、新しいUsercssスタイルのデフォルト・テンプレートを置き換えますか"
}, },
"usercssReplaceTemplateName": {
"message": "@name が指定されていません"
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "ここにコードを挿入..." "message": "ここにコードを挿入..."
}, },

View File

@ -67,6 +67,9 @@
"backupButtons": { "backupButtons": {
"message": "백업" "message": "백업"
}, },
"backupMessage": {
"message": "파일을 선택하거나, 이 페이지로 파일을 드래그앤드롭하세요."
},
"bckpInstStyles": { "bckpInstStyles": {
"message": "스타일 내보내기" "message": "스타일 내보내기"
}, },
@ -133,9 +136,6 @@
"cm_theme": { "cm_theme": {
"message": "테마" "message": "테마"
}, },
"colorpickerPaletteHint": {
"message": "견본을 우클릭하여 소스 코드와 번갈아 가며 확인"
},
"colorpickerSwitchFormatTooltip": { "colorpickerSwitchFormatTooltip": {
"message": "16 진수-> RGB -> HSL 순서로 형식을 변환합니다.\nShift+클릭을 이용해 역순으로 변환할 수 있습니다.\nPgUp(PageUp), PgDn(PageDown) 키도 사용 가능합니다." "message": "16 진수-> RGB -> HSL 순서로 형식을 변환합니다.\nShift+클릭을 이용해 역순으로 변환할 수 있습니다.\nPgUp(PageUp), PgDn(PageDown) 키도 사용 가능합니다."
}, },
@ -302,15 +302,21 @@
"findStyles": { "findStyles": {
"message": "스타일 찾기" "message": "스타일 찾기"
}, },
"findStylesForSite": {
"message": "현재 사이트에 맞는 스타일 찾기"
},
"findStylesInline": {
"message": "팝업창 내에서"
},
"findStylesInlineTooltip": {
"message": "이 창에서 검색 결과 표시"
},
"genericAdd": { "genericAdd": {
"message": "추가" "message": "추가"
}, },
"genericClone": { "genericClone": {
"message": "복제" "message": "복제"
}, },
"genericDescription": {
"message": "설명"
},
"genericDisabledLabel": { "genericDisabledLabel": {
"message": "비활성화됨" "message": "비활성화됨"
}, },
@ -439,18 +445,9 @@
"linkGetHelp": { "linkGetHelp": {
"message": "도움말" "message": "도움말"
}, },
"linkGetShareStyles": {
"message": "스타일 주고받기"
},
"linkGetShareStylesInfo": {
"message": "커뮤니티에 의해 새롭게 운영되는 userstyles.world 사이트는 userstyle 투고자들이 userstyle.org를 대체하기 위해 만들었습니다. userstyle.org는 지난 몇 년간 많은 투고자들이 스타일을 업데이트하는 것을 멈춰서 느리고 둔감해졌습니다."
},
"linkGetStyles": { "linkGetStyles": {
"message": "스타일 찾기" "message": "스타일 찾기"
}, },
"linkGetStylesInfo": {
"message": "본 아카이브 사이트는 느리고 응답이 늦는 userstyles.org를 백업하기 위해 Userstyle 커뮤니티 회원에 의해 제작되었습니다. 하루에 약 한 번 아카이브 내 콘텐츠가 갱신됩니다."
},
"linkStylusWiki": { "linkStylusWiki": {
"message": "위키" "message": "위키"
}, },
@ -521,7 +518,7 @@
"message": "회색으로 표시" "message": "회색으로 표시"
}, },
"manageFaviconsHelp": { "manageFaviconsHelp": {
"message": "Stylus는 https://icons.duckduckgo.com 외부 서비스를 이용합니다" "message": "Stylus는 https://www.google.com/s2/favicons 외부 서비스를 이용합니다"
}, },
"manageFilters": { "manageFilters": {
"message": "필터" "message": "필터"
@ -727,17 +724,6 @@
} }
} }
}, },
"meta_unknownMetaTypo": {
"message": "혹시 @$keyOk$입니까? 알 수 없는 메타데이터: @$keyErr$",
"placeholders": {
"keyErr": {
"content": "$1"
},
"keyOk": {
"content": "$2"
}
}
},
"meta_unknownPreprocessor": { "meta_unknownPreprocessor": {
"message": "알 수 없는 @preprocessor $preprocessor$", "message": "알 수 없는 @preprocessor $preprocessor$",
"placeholders": { "placeholders": {
@ -796,15 +782,9 @@
"optionsAdvancedPatchCsp": { "optionsAdvancedPatchCsp": {
"message": "스타일 자원을 허용하도록 <code>CSP</code>패치하기" "message": "스타일 자원을 허용하도록 <code>CSP</code>패치하기"
}, },
"optionsAdvancedPatchCspNote": {
"message": "엄격한 <code>콘텐츠 보안 정책</code>(<code>Content-Security-Policy; CSP</code>)이 적용된 사이트에서 사진이나 글꼴이 포함된 스타일을 불러올 수 없는 경우 이 설정을 켜십시오.\n\n설정을 켜면 <code>CSP</code> 제한이 풀려, 필수적인 스타일 콘텐츠를 불러올 수 있도록 합니다. 이 설정은 잠재적인 보안 영향을 이해하고, 콘텐츠 모니터링 허용 시 발생하는 문제에 대한 책임을 질 수 있는 사용자에게만 권장됩니다. 자세한 정보를 알고 싶다면 CSS 기반 공격에 대해 알아 보십시오.\n\n또, 이 설정은 설치된 다른 확장 프로그램이 네트워크 응답을 먼저 수정하는 경우 작동하지 않을 수도 있으므로 이 점에 유의하십시오."
},
"optionsAdvancedStyleViaXhr": { "optionsAdvancedStyleViaXhr": {
"message": "즉시 주입 모드" "message": "즉시 주입 모드"
}, },
"optionsAdvancedStyleViaXhrNote": {
"message": "만약 브라우징 도중 스타일이 적용되지 않은 콘텐츠가 깜빡거리며 나오는 경우(FOUC), 특히 다크 테마를 사용하는 중 눈에 두드러지게 깜빡이는 경우 이 설정을 켜십시오.\n\n기술적으로 Chrome/Chromium이 확장 프로그램과의 비동기 통신을 미루기 때문에 발생하는 문제이며, 페이지를 더 빨리 불러오려는 시도이지만 보통은 무의미하고 스타일이 늦게 적용되도록 하는 요인으로 작용합니다. 확장 프로그램에는 이를 회피하기 위한 동기형 API가 제공되지 않으므로, Stylus는 \"비권장\" 상태인 동기형 XMLHttpRquest 웹 API를 사용하여 스타일을 가져오는 설정을 제공합니다. 페이지를 서버에서 내려받는 몇 밀리초 내에 이런 과정이 끝나므로 로드 속도에는 악영향이 없습니다.\n\n그럼에도 불구하고 Chromium 브라우저에서는 개발자 도구의 콘솔에 경고를 출력할 것입니다. 경고를 우클릭하여 숨기면 이후에는 경고가 표시되지 않습니다."
},
"optionsBadgeDisabled": { "optionsBadgeDisabled": {
"message": "비활성화 시의 배경 색" "message": "비활성화 시의 배경 색"
}, },
@ -856,6 +836,9 @@
"optionsResetButton": { "optionsResetButton": {
"message": "설정 초기화" "message": "설정 초기화"
}, },
"optionsStylusThemes": {
"message": "스타일러스 UI 테마 찾기"
},
"optionsSubheading": { "optionsSubheading": {
"message": "추가 옵션" "message": "추가 옵션"
}, },
@ -983,27 +966,12 @@
"previewTooltip": { "previewTooltip": {
"message": "변경 사항은 저장되지 않고 일시적으로 적용됩니다.\n영구적으로 변경하려면 스타일을 저장하세요." "message": "변경 사항은 저장되지 않고 일시적으로 적용됩니다.\n영구적으로 변경하려면 스타일을 저장하세요."
}, },
"publish": {
"message": "배포"
},
"publishPush": {
"message": "업데이트 푸시"
},
"publishReconnect": {
"message": "연결을 해제한 뒤 배포를 다시 시도해보세요"
},
"publishRetry": {
"message": "Stylus에서는 계속 이 스타일을 배포하려고 하고 있습니다. 하지만 인증 창이 뜨지 않는 경우 다시 시도할 수 있습니다. 지금 다시 시도하시겠습니까?"
},
"publishStyle": {
"message": "스타일 배포"
},
"publishUsw": {
"message": "<userstyles.world> 사용"
},
"readingStyles": { "readingStyles": {
"message": "스타일 읽어들이는 중..." "message": "스타일 읽어들이는 중..."
}, },
"reload": {
"message": "Stylus 확장 프로그램 리로드"
},
"replace": { "replace": {
"message": "바꾸기" "message": "바꾸기"
}, },
@ -1064,9 +1032,6 @@
"searchStylesCode": { "searchStylesCode": {
"message": "CSS 코드" "message": "CSS 코드"
}, },
"searchStylesHelp": {
"message": "</> 또는 <Ctrl-F> 키를 누르면 검색창에 포커스합니다.\nDefault mode is plain text search for all space-separated terms in any order.\n정확한 단어 검색: 검색어를 큰따옴표로 감쌉니다. 예: <\".header ~ div\">\n정규표현식: 빗금 및 플래그 문자를 포함합니다. 예: </body.*?\\ba\\b/i>\nURL로 찾기: 완전히 특정된 URL에 적용되는 스타일을 검색합니다. 예: https://www.example.org/\n메타데이터로 찾기: 이름, \"적용 대상\" 지정자, 설치 URL, 업데이트 URL 등 usercss 스타일의 모든 메타데이터 블록을 기반으로 검색합니다."
},
"searchStylesMatchUrl": { "searchStylesMatchUrl": {
"message": "URL별" "message": "URL별"
}, },
@ -1181,9 +1146,6 @@
"styleMozillaFormatHeading": { "styleMozillaFormatHeading": {
"message": "Mozilla 형식" "message": "Mozilla 형식"
}, },
"styleName": {
"message": "스타일 이름"
},
"styleNotAppliedRegexpProblemTooltip": { "styleNotAppliedRegexpProblemTooltip": {
"message": "잘못된 'regexp()'의 사용으로 인해 스타일을 적용할 수 없습니다" "message": "잘못된 'regexp()'의 사용으로 인해 스타일을 적용할 수 없습니다"
}, },
@ -1196,6 +1158,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "잘못된 'regexp()' 사용으로 인해 몇몇 섹션을 적용할 수 없습니다." "message": "잘못된 'regexp()' 사용으로 인해 몇몇 섹션을 적용할 수 없습니다."
}, },
"styleRegexpTestButton": {
"message": "정규 표현식 테스트"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "일치하는 탭 목록" "message": "일치하는 탭 목록"
}, },
@ -1273,12 +1238,6 @@
"unreachableFileHint": { "unreachableFileHint": {
"message": "Stylus가 file:// URL에 접근할 수 있도록 하려면 chrome://extensions 페이지에서 파일 URL에 대한 액세스를 허용해야 합니다." "message": "Stylus가 file:// URL에 접근할 수 있도록 하려면 chrome://extensions 페이지에서 파일 URL에 대한 액세스를 허용해야 합니다."
}, },
"unreachableMozSiteHint": {
"message": "Firefox 60 이후의 버전에서는 <about:config> 내의 <extensions.webextensions.restrictedDomains>에서 이 도메인을 제거해야 합니다. "
},
"unreachableMozSiteHintOldFF": {
"message": "Firefox 59 버전 이상에서만 이처럼 CSP 보호 정책이 적용된 사이트에 웹 확장 기능으로 스타일 요소를 추가할 수 있도록 설정 가능합니다."
},
"unzipStyles": { "unzipStyles": {
"message": "스타일 압축 푸는 중..." "message": "스타일 압축 푸는 중..."
}, },
@ -1338,6 +1297,9 @@
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "현재 코드로 새 Usercss 스타일의 기본 템플릿을 대체하시겠습니까?" "message": "현재 코드로 새 Usercss 스타일의 기본 템플릿을 대체하시겠습니까?"
}, },
"usercssReplaceTemplateName": {
"message": "@name을 비우면 기본 템플릿이 대체됩니다."
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "코드를 여기 입력하세요" "message": "코드를 여기 입력하세요"
}, },

View File

@ -62,13 +62,13 @@
"message": "Alle updates toepassen" "message": "Alle updates toepassen"
}, },
"author": { "author": {
"message": "Maker" "message": "Auteur"
}, },
"backupButtons": { "backupButtons": {
"message": "Back-up" "message": "Back-up"
}, },
"backupMessage": { "backupMessage": {
"message": "Sleep het back-upbestand naar deze pagina of klik op de knop Importeren om het te importeren.\n\nRechtsklik of shift-klik op de knop Exporteren om een compatibele back-up voor Stylus ouder dan 1.5.18 te exporteren." "message": "Selecteer een bestand of sleep het naar deze pagina."
}, },
"bckpInstStyles": { "bckpInstStyles": {
"message": "Stijlen exporteren" "message": "Stijlen exporteren"
@ -98,7 +98,7 @@
"message": "Automatisch aanvullen tijdens typen" "message": "Automatisch aanvullen tijdens typen"
}, },
"cm_colorpicker": { "cm_colorpicker": {
"message": "Kleurkiezers voor CSS-kleuren" "message": "Kleurkiezer voor CSS-kleuren"
}, },
"cm_indentWithTabs": { "cm_indentWithTabs": {
"message": "Tabs met slimme inspringing gebruiken" "message": "Tabs met slimme inspringing gebruiken"
@ -245,23 +245,9 @@
"disableAllStyles": { "disableAllStyles": {
"message": "Alle stijlen uitschakelen" "message": "Alle stijlen uitschakelen"
}, },
"disableAllStylesOff": {
"message": "Stijlen zijn uitgeschakeld"
},
"disableStyleLabel": { "disableStyleLabel": {
"message": "Uitschakelen" "message": "Uitschakelen"
}, },
"draftAction": {
"message": "Klik op Ja om dit concept te laden, of op Nee om het te verwerpen."
},
"draftTitle": {
"message": "Conceptherstel; gemaakt: $date$",
"placeholders": {
"date": {
"content": "$1"
}
}
},
"dragDropMessage": { "dragDropMessage": {
"message": "Sleep uw back-upbestand naar deze pagina om het te importeren." "message": "Sleep uw back-upbestand naar deze pagina om het te importeren."
}, },
@ -288,9 +274,6 @@
} }
} }
}, },
"editorSettings": {
"message": "Editor-instellingen"
},
"enableStyleLabel": { "enableStyleLabel": {
"message": "Inschakelen" "message": "Inschakelen"
}, },
@ -300,9 +283,6 @@
"excludeStyleByUrlLabel": { "excludeStyleByUrlLabel": {
"message": "De huidige URL uitsluiten" "message": "De huidige URL uitsluiten"
}, },
"exportCompatible": {
"message": "Exporteren (compatibele modus)"
},
"exportLabel": { "exportLabel": {
"message": "Exporteren" "message": "Exporteren"
}, },
@ -338,6 +318,12 @@
"findStyles": { "findStyles": {
"message": "Stijlen zoeken" "message": "Stijlen zoeken"
}, },
"findStylesForSite": {
"message": "Meer stijlen voor deze website zoeken"
},
"findStylesInlineTooltip": {
"message": "Zoekresultaten binnen dit venster weergeven"
},
"genericAdd": { "genericAdd": {
"message": "Toevoegen" "message": "Toevoegen"
}, },
@ -371,12 +357,6 @@
"genericSavedMessage": { "genericSavedMessage": {
"message": "Opgeslagen" "message": "Opgeslagen"
}, },
"genericSize": {
"message": "Grootte"
},
"genericTest": {
"message": "Testen"
},
"genericTitle": { "genericTitle": {
"message": "Titel" "message": "Titel"
}, },
@ -386,9 +366,6 @@
"gettingStyles": { "gettingStyles": {
"message": "Alle stijlen ophalen..." "message": "Alle stijlen ophalen..."
}, },
"headerResizerHint": {
"message": "Houd Shift ingedrukt om alleen in dit type UI de grootte te wijzigen, m.a.w. editor, beheerder, installer"
},
"helpAlt": { "helpAlt": {
"message": "Hulp" "message": "Hulp"
}, },
@ -563,7 +540,7 @@
"message": "Niet beschikbaar" "message": "Niet beschikbaar"
}, },
"manageFaviconsHelp": { "manageFaviconsHelp": {
"message": "Stylus gebruikt een externe dienst: https://icons.duckduckgo.com" "message": "Stylus gebruikt een externe dienst: https://www.google.com/s2/favicons"
}, },
"manageHeading": { "manageHeading": {
"message": "Geïnstalleerde stijlen" "message": "Geïnstalleerde stijlen"
@ -571,9 +548,6 @@
"manageMaxTargets": { "manageMaxTargets": {
"message": "Aantal Van toepassing op-items" "message": "Aantal Van toepassing op-items"
}, },
"manageMinColumnWidth": {
"message": "Minimale kolombreedte (in pixels; 9999 schakelt de modus met meerdere kolommen uit)"
},
"manageNewStyleAsUsercss": { "manageNewStyleAsUsercss": {
"message": "als Usercss" "message": "als Usercss"
}, },
@ -823,15 +797,6 @@
"optionsAdvanced": { "optionsAdvanced": {
"message": "Geavanceerd" "message": "Geavanceerd"
}, },
"optionsAdvancedAutoSwitchSchemeBySystem": {
"message": "Systeemvoorkeur volgen"
},
"optionsAdvancedAutoSwitchSchemeByTime": {
"message": "Door nachttijd:"
},
"optionsAdvancedAutoSwitchSchemeNever": {
"message": "Uitgeschakeld. De instelling voor donker/licht in stijlen wordt genegeerd."
},
"optionsAdvancedContextDelete": { "optionsAdvancedContextDelete": {
"message": "Verwijderen toevoegen in contextmenu van editor" "message": "Verwijderen toevoegen in contextmenu van editor"
}, },
@ -841,12 +806,6 @@
"optionsAdvancedExposeIframesNote": { "optionsAdvancedExposeIframesNote": {
"message": "Legt het bovenliggende domein van de website bloot in elk iframe.\nSchakelt schrijven in voor iframe-specifieke CSS, zoals:\nhtml[stylus-iframe$$=\"twitter.com\"] h1 { display:none }" "message": "Legt het bovenliggende domein van de website bloot in elk iframe.\nSchakelt schrijven in voor iframe-specifieke CSS, zoals:\nhtml[stylus-iframe$$=\"twitter.com\"] h1 { display:none }"
}, },
"optionsAdvancedExposeStyleName": {
"message": "Stijlnaam tonen"
},
"optionsAdvancedExposeStyleNameNote": {
"message": "Toont de stijlnaam in de pagina om het opsporen van stijlfouten in devtools mogelijk te maken. Vernieuw de tabbladen om de nieuwe instelling toe te passen."
},
"optionsAdvancedNewStyleAsUsercss": { "optionsAdvancedNewStyleAsUsercss": {
"message": "Nieuwe stijl schrijven als usercss" "message": "Nieuwe stijl schrijven als usercss"
}, },
@ -889,9 +848,6 @@
"optionsHeading": { "optionsHeading": {
"message": "Opties" "message": "Opties"
}, },
"optionsIconAuto": {
"message": "Volgens de Donkere/Lichte modus"
},
"optionsIconDark": { "optionsIconDark": {
"message": "Donkere browserthemas" "message": "Donkere browserthemas"
}, },
@ -914,7 +870,7 @@
"message": "Standaardwaarden" "message": "Standaardwaarden"
}, },
"optionsStylusThemes": { "optionsStylusThemes": {
"message": "Klik op een willekeurige Stylus-pagina (waaronder deze) op het Stylus-pictogram in de browserwerkbalk, en klik daarna op Stijlen zoeken." "message": "Een UI-thema voor Stylus zoeken"
}, },
"optionsSubheading": { "optionsSubheading": {
"message": "Meer opties" "message": "Meer opties"
@ -931,9 +887,6 @@
"optionsSyncNone": { "optionsSyncNone": {
"message": "Geen" "message": "Geen"
}, },
"optionsSyncPassword": {
"message": "Wachtwoord"
},
"optionsSyncStatusConnected": { "optionsSyncStatusConnected": {
"message": "Gekoppeld" "message": "Gekoppeld"
}, },
@ -977,9 +930,6 @@
"optionsSyncSyncNow": { "optionsSyncSyncNow": {
"message": "Nu synchroniseren" "message": "Nu synchroniseren"
}, },
"optionsSyncUsername": {
"message": "Gebruikersnaam"
},
"optionsUpdateImportNote": { "optionsUpdateImportNote": {
"message": "Als u stijlen vanuit een oudere versie of vanuit Stylish importeert, controleer dan eenmalig op updates in de stijlbeheerder om er zeker van te zijn dat alle stijlen zijn bijgewerkt." "message": "Als u stijlen vanuit een oudere versie of vanuit Stylish importeert, controleer dan eenmalig op updates in de stijlbeheerder om er zeker van te zijn dat alle stijlen zijn bijgewerkt."
}, },
@ -1022,9 +972,6 @@
"popupHotkeysTooltip": { "popupHotkeysTooltip": {
"message": "Klik om beschikbare sneltoetsen te tonen" "message": "Klik om beschikbare sneltoetsen te tonen"
}, },
"popupManageSiteStyles": {
"message": "Websitestijlen beheren"
},
"popupManageTooltip": { "popupManageTooltip": {
"message": "Shift-klik of rechtsklik opent de beheerder met stijlen die op de huidige website van toepassing zijn" "message": "Shift-klik of rechtsklik opent de beheerder met stijlen die op de huidige website van toepassing zijn"
}, },
@ -1046,21 +993,6 @@
"prefShowBadge": { "prefShowBadge": {
"message": "Aantal actieve stijlen voor de huidige website" "message": "Aantal actieve stijlen voor de huidige website"
}, },
"preferScheme": {
"message": "Voorkeur voor Donkere/Lichte modus"
},
"preferSchemeAlways": {
"message": "Momenteel genegeerd (de stijl is altijd van toepassing), omdat de globale Donkere/Lichte modus is uitgeschakeld"
},
"preferSchemeDark": {
"message": "Donker"
},
"preferSchemeLight": {
"message": "Licht"
},
"preferSchemeNone": {
"message": "Geen (altijd toegepast)"
},
"previewLabel": { "previewLabel": {
"message": "Live-voorbeeld" "message": "Live-voorbeeld"
}, },
@ -1089,7 +1021,7 @@
"message": "Stijlen lezen..." "message": "Stijlen lezen..."
}, },
"reload": { "reload": {
"message": "Opnieuw laden" "message": "Stylus-extensie herladen"
}, },
"replace": { "replace": {
"message": "Vervangen" "message": "Vervangen"
@ -1100,18 +1032,12 @@
"replaceWith": { "replaceWith": {
"message": "Vervangen door" "message": "Vervangen door"
}, },
"restoreTemplate": {
"message": "De standaardsjabloon herstellen.\n\n(De momenteel geopende editorpaginas worden niet gewijzigd.)"
},
"retrieveBckp": { "retrieveBckp": {
"message": "Stijlen importeren" "message": "Stijlen importeren"
}, },
"retrieveDropboxSync": { "retrieveDropboxSync": {
"message": "Dropbox - Importeren" "message": "Dropbox - Importeren"
}, },
"saveAsTemplate": {
"message": "Opslaan als sjabloon"
},
"search": { "search": {
"message": "Zoeken" "message": "Zoeken"
}, },
@ -1152,7 +1078,7 @@
"message": "Wekelijks aantal installaties" "message": "Wekelijks aantal installaties"
}, },
"searchStyleQueryHint": { "searchStyleQueryHint": {
"message": "Stijlnamen doorzoeken (hoofdlettergevoelig als een hoofdletter wordt gebruikt):\nenkele woorden - al deze woorden in willekeurige volgorde\n\"bepaalde woordgroep\" - deze exacte woordgroep zonder aanhalingstekens\n/foo.*bar/i - reguliere expressie zonder spaties (gebruik in plaats daarvan \\s)" "message": "Stijlnamen niet hoofdlettergevoelig doorzoeken:\nbepaalde woorden - alle woorden in willekeurige volgorde\n\"bepaalde woordgroep\" - deze exacte woordgroep zonder aanhalingstekens\n2020 - een jaar als dit toont ook stijlen die in 2020 zijn bijgewerkt"
}, },
"searchStylesAll": { "searchStylesAll": {
"message": "Alles" "message": "Alles"
@ -1184,18 +1110,12 @@
"sections": { "sections": {
"message": "Secties" "message": "Secties"
}, },
"settings": {
"message": "Instellingen"
},
"shortcuts": { "shortcuts": {
"message": "Sneltoetsen" "message": "Sneltoetsen"
}, },
"shortcutsNote": { "shortcutsNote": {
"message": "Sneltoetsen definiëren" "message": "Sneltoetsen definiëren"
}, },
"shortcutsNoteFF": {
"message": "In Firefox 66+ kunt u de ingebouwde UI voor sneltoetsen handmatig openen:\n1) klik met rechts op het Stylus-pictogram in de werkbalk en kies Extensie beheren\n(als alternatief kunt u about:addons openen via het hoofdmenu of Ctrl-Shift-A),\n2) klik in de pagina die wordt geopend op het tandwielpictogram in de rechterbovenhoek,\n3) kies Extensiesneltoetsen beheren.\n\nHier kunt u ook de sneltoetsen aanpassen."
},
"sortDateNewestFirst": { "sortDateNewestFirst": {
"message": "nieuwste eerst" "message": "nieuwste eerst"
}, },
@ -1241,30 +1161,12 @@
"styleEnabledLabel": { "styleEnabledLabel": {
"message": "Ingeschakeld" "message": "Ingeschakeld"
}, },
"styleExcludeLabel": {
"message": "Eigen uitgesloten websites"
},
"styleFromMozillaFormatError": { "styleFromMozillaFormatError": {
"message": "Importeren vanuit Mozilla-opmaak mislukt" "message": "Importeren vanuit Mozilla-opmaak mislukt"
}, },
"styleFromMozillaFormatPrompt": { "styleFromMozillaFormatPrompt": {
"message": "Plak de code in Mozilla-opmaak" "message": "Plak de code in Mozilla-opmaak"
}, },
"styleIncludeLabel": {
"message": "Eigen opgenomen websites"
},
"styleInjectionImportance": {
"message": "Urgentie van stijl bepalen"
},
"styleInjectionOrder": {
"message": "Stijlinjectievolgorde"
},
"styleInjectionOrderHint": {
"message": "Versleep een stijl om de positie ervan te wijzigen. Stijlen worden geïnjecteerd op basis van de onderstaande volgorde, dus een stijl die lager op de lijst staat, kan de eerdere stijlen vervangen."
},
"styleInjectionOrderHint_prio": {
"message": "Belangrijke stijlen hieronder worden altijd als laatste geïnjecteerd, zodat ze eventuele pas geïnstalleerde stijlen kunnen vervangen. Klik op het sterpictogram van een stijl om de urgentie ervan te bepalen."
},
"styleInstall": { "styleInstall": {
"message": "$stylename$ installeren in Stylus?", "message": "$stylename$ installeren in Stylus?",
"placeholders": { "placeholders": {
@ -1307,15 +1209,6 @@
"styleNotAppliedRegexpProblemTooltip": { "styleNotAppliedRegexpProblemTooltip": {
"message": "Stijl is niet toegepast vanwege onjuist gebruik van regexp()" "message": "Stijl is niet toegepast vanwege onjuist gebruik van regexp()"
}, },
"styleNotAppliedSchemeDark": {
"message": "Deze stijl wordt alleen in Donkere modus toegepast"
},
"styleNotAppliedSchemeLight": {
"message": "Deze stijl wordt alleen in Lichte modus toegepast"
},
"stylePreferSchemeLabel": {
"message": "Donkere/Lichte modus"
},
"styleRegexpInvalidExplanation": { "styleRegexpInvalidExplanation": {
"message": "Sommige regexp()-regels konden niet worden gecompileerd." "message": "Sommige regexp()-regels konden niet worden gecompileerd."
}, },
@ -1325,6 +1218,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "Aantal secties dat niet wordt toegepast vanwege onjuist gebruik van regexp()" "message": "Aantal secties dat niet wordt toegepast vanwege onjuist gebruik van regexp()"
}, },
"styleRegexpTestButton": {
"message": "RegExp-test"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "Overeenkomende tabbladen" "message": "Overeenkomende tabbladen"
}, },
@ -1341,14 +1237,11 @@
"message": "Niet volledig overeenkomend, dus overgeslagen" "message": "Niet volledig overeenkomend, dus overgeslagen"
}, },
"styleRegexpTestTitle": { "styleRegexpTestTitle": {
"message": "Lijst met overeenkomende geopende tabbladen (klik op de URL om de focus op het tabblad te leggen)" "message": "Lijst van overeenkomende geopende tabbladen (klik op de URL om de focus op het tabblad te leggen)"
}, },
"styleSaveLabel": { "styleSaveLabel": {
"message": "Opslaan" "message": "Opslaan"
}, },
"styleSettings": {
"message": "Stijlinstellingen"
},
"styleToMozillaFormatHelp": { "styleToMozillaFormatHelp": {
"message": "De Mozilla-opmaak van de code kan bij userstyles.org worden ingediend en met het klassieke Stylish voor Firefox worden gebruikt." "message": "De Mozilla-opmaak van de code kan bij userstyles.org worden ingediend en met het klassieke Stylish voor Firefox worden gebruikt."
}, },
@ -1366,9 +1259,6 @@
"styleUpdateDiscardChanges": { "styleUpdateDiscardChanges": {
"message": "Deze stijl is buiten de editor om gewijzigd. Wilt u de stijl opnieuw laden?" "message": "Deze stijl is buiten de editor om gewijzigd. Wilt u de stijl opnieuw laden?"
}, },
"styleUpdateUrlLabel": {
"message": "Update-URL"
},
"stylusUnavailableForURL": { "stylusUnavailableForURL": {
"message": "Stylus werkt niet op paginas als deze." "message": "Stylus werkt niet op paginas als deze."
}, },
@ -1384,16 +1274,8 @@
"syncError": { "syncError": {
"message": "Synchronisatie mislukt" "message": "Synchronisatie mislukt"
}, },
"syncErrorLock": {
"message": "De database is al in gebruik. De vergrendeling vervalt om $TIME$.",
"placeholders": {
"time": {
"content": "$1"
}
}
},
"syncErrorRelogin": { "syncErrorRelogin": {
"message": "Synchronisatie mislukt. U bent afgemeld.\nProbeer u opnieuw aan te melden in de Stylus-opties." "message": "Synchronisatie mislukt.\nProbeer u opnieuw aan te melden in de Stylus-opties:\nklik eerst op ontkoppelen, daarna op koppelen."
}, },
"syncStorageErrorSaving": { "syncStorageErrorSaving": {
"message": "De waarde kan niet worden opgeslagen. Probeer de hoeveelheid tekst te verminderen." "message": "De waarde kan niet worden opgeslagen. Probeer de hoeveelheid tekst te verminderen."
@ -1484,6 +1366,9 @@
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "Wilt u de standaardsjabloon voor nieuwe Usercss-stijlen vervangen door de huidige code?" "message": "Wilt u de standaardsjabloon voor nieuwe Usercss-stijlen vervangen door de huidige code?"
}, },
"usercssReplaceTemplateName": {
"message": "Lege @name vervangt de standaardsjabloon"
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "Voer hier code in..." "message": "Voer hier code in..."
}, },

View File

@ -71,7 +71,7 @@
"message": "Kopia zapasowa" "message": "Kopia zapasowa"
}, },
"backupMessage": { "backupMessage": {
"message": "Aby zaimportować plik kopii zapasowej, przeciągnij go i upuść na tej stronie lub kliknij przycisk Importuj.\n\nAby wyeksportować kompatybilną kopię zapasową Stylusa w wersji starszej niż 1.5.18, kliknij prawym przyciskiem myszy lub kliknij z wciśniętym klawiszem Shift przycisk Eksportuj." "message": "Wybierz plik lub przeciągnij i upuść go na tę stronę."
}, },
"bckpInstStyles": { "bckpInstStyles": {
"message": "Eksportuj style" "message": "Eksportuj style"
@ -264,23 +264,9 @@
"disableAllStyles": { "disableAllStyles": {
"message": "Wyłącz wszystkie style" "message": "Wyłącz wszystkie style"
}, },
"disableAllStylesOff": {
"message": "Style są wyłączone"
},
"disableStyleLabel": { "disableStyleLabel": {
"message": "Wyłącz" "message": "Wyłącz"
}, },
"draftAction": {
"message": "Wybierz 'Tak', aby załadować tę wersję roboczą lub 'Nie', aby ją odrzucić."
},
"draftTitle": {
"message": "Odzyskiwanie wersji roboczej, utworzonej $date$",
"placeholders": {
"date": {
"content": "$1"
}
}
},
"dragDropMessage": { "dragDropMessage": {
"message": "Upuść twój plik kopii zapasowej gdziekolwiek na tej stronie, aby zaimportować." "message": "Upuść twój plik kopii zapasowej gdziekolwiek na tej stronie, aby zaimportować."
}, },
@ -307,9 +293,6 @@
} }
} }
}, },
"editorSettings": {
"message": "Ustawienia edytora"
},
"enableStyleLabel": { "enableStyleLabel": {
"message": "Włącz" "message": "Włącz"
}, },
@ -319,9 +302,6 @@
"excludeStyleByUrlLabel": { "excludeStyleByUrlLabel": {
"message": "Wyklucz bieżący adres URL" "message": "Wyklucz bieżący adres URL"
}, },
"exportCompatible": {
"message": "Eksportuj (tryb kompatybilny)"
},
"exportLabel": { "exportLabel": {
"message": "Eksportuj" "message": "Eksportuj"
}, },
@ -360,6 +340,15 @@
"findStyles": { "findStyles": {
"message": "Znajdź style" "message": "Znajdź style"
}, },
"findStylesForSite": {
"message": "Znajdź więcej stylów dla tej strony"
},
"findStylesInline": {
"message": "Wstawka"
},
"findStylesInlineTooltip": {
"message": "Wyświetlaj wyniki wyszukiwania w tym oknie."
},
"genericAdd": { "genericAdd": {
"message": "Dodaj" "message": "Dodaj"
}, },
@ -393,12 +382,6 @@
"genericSavedMessage": { "genericSavedMessage": {
"message": "Zapisano" "message": "Zapisano"
}, },
"genericSize": {
"message": "Rozmiar"
},
"genericTest": {
"message": "Testuj"
},
"genericTitle": { "genericTitle": {
"message": "Tytuł" "message": "Tytuł"
}, },
@ -408,9 +391,6 @@
"gettingStyles": { "gettingStyles": {
"message": "Uzyskiwanie wszystkich stylów..." "message": "Uzyskiwanie wszystkich stylów..."
}, },
"headerResizerHint": {
"message": "Przytrzymaj Shift, aby zmienić rozmiar tylko w tego typu interfejsie, tj. edytorze, menedżerze, instalatorze"
},
"helpAlt": { "helpAlt": {
"message": "Pomoc" "message": "Pomoc"
}, },
@ -585,7 +565,7 @@
"message": "Wyszarzone" "message": "Wyszarzone"
}, },
"manageFaviconsHelp": { "manageFaviconsHelp": {
"message": "Stylus korzysta z usługi zewnętrznej https://icons.duckduckgo.com" "message": "Stylus korzysta z usługi zewnętrznej https://www.google.com/s2/favicons"
}, },
"manageFilters": { "manageFilters": {
"message": "Filtry" "message": "Filtry"
@ -596,9 +576,6 @@
"manageMaxTargets": { "manageMaxTargets": {
"message": "Liczba dotyczących elementów " "message": "Liczba dotyczących elementów "
}, },
"manageMinColumnWidth": {
"message": "Minimalna szerokość kolumny (w pikselach; 9999 wyłącza tryb wielokolumnowy)"
},
"manageNewStyleAsUsercss": { "manageNewStyleAsUsercss": {
"message": "jako Usercss" "message": "jako Usercss"
}, },
@ -848,15 +825,6 @@
"optionsAdvanced": { "optionsAdvanced": {
"message": "Zaawansowane" "message": "Zaawansowane"
}, },
"optionsAdvancedAutoSwitchSchemeBySystem": {
"message": "Według preferencji systemowych"
},
"optionsAdvancedAutoSwitchSchemeByTime": {
"message": "W nocy:"
},
"optionsAdvancedAutoSwitchSchemeNever": {
"message": "Wyłączone. Ustawienie ciemny/jasny w stylach jest ignorowane."
},
"optionsAdvancedContextDelete": { "optionsAdvancedContextDelete": {
"message": "Dodaj 'Usuń' do menu kontekstowego edytora" "message": "Dodaj 'Usuń' do menu kontekstowego edytora"
}, },
@ -866,12 +834,6 @@
"optionsAdvancedExposeIframesNote": { "optionsAdvancedExposeIframesNote": {
"message": "Odsłania domenę najwyższego poziomu w każdym elemencie iframe.\nWłącza pisanie CSS specyficznych dla iframe w taki sposób:\nhtml[stylus-iframe$$=\"twitter.com\"] h1 { display:none }" "message": "Odsłania domenę najwyższego poziomu w każdym elemencie iframe.\nWłącza pisanie CSS specyficznych dla iframe w taki sposób:\nhtml[stylus-iframe$$=\"twitter.com\"] h1 { display:none }"
}, },
"optionsAdvancedExposeStyleName": {
"message": "Eksponuj nazwę stylu"
},
"optionsAdvancedExposeStyleNameNote": {
"message": "Eksponuje nazwę stylu na stronie, aby ułatwić debugowanie stylów w narzędziach dla twórców witryn. Załaduj ponownie kartę(-y), aby zastosować nowe ustawienie."
},
"optionsAdvancedNewStyleAsUsercss": { "optionsAdvancedNewStyleAsUsercss": {
"message": "Napisz nowy styl jako usercss" "message": "Napisz nowy styl jako usercss"
}, },
@ -917,9 +879,6 @@
"optionsHeading": { "optionsHeading": {
"message": "Opcje" "message": "Opcje"
}, },
"optionsIconAuto": {
"message": "Dopasuj tryb ciemny/jasny"
},
"optionsIconDark": { "optionsIconDark": {
"message": "Ciemne motywy przeglądarki" "message": "Ciemne motywy przeglądarki"
}, },
@ -942,7 +901,7 @@
"message": "Resetuj opcje" "message": "Resetuj opcje"
}, },
"optionsStylusThemes": { "optionsStylusThemes": {
"message": "Kliknij ikonę Stylusa na pasku narzędzi przeglądarki na dowolnej stronie Stylusa, w tym tej, a następnie kliknij 'Znajdź style'" "message": "Znajdź motyw interfejsu Stylusa"
}, },
"optionsSubheading": { "optionsSubheading": {
"message": "Więcej opcji" "message": "Więcej opcji"
@ -959,9 +918,6 @@
"optionsSyncNone": { "optionsSyncNone": {
"message": "Brak" "message": "Brak"
}, },
"optionsSyncPassword": {
"message": "Hasło"
},
"optionsSyncStatusConnected": { "optionsSyncStatusConnected": {
"message": "Połączono" "message": "Połączono"
}, },
@ -1005,12 +961,6 @@
"optionsSyncSyncNow": { "optionsSyncSyncNow": {
"message": "Synchronizuj teraz" "message": "Synchronizuj teraz"
}, },
"optionsSyncUrl": {
"message": "Adres URL"
},
"optionsSyncUsername": {
"message": "Nazwa użytkownika"
},
"optionsUpdateImportNote": { "optionsUpdateImportNote": {
"message": "Podczas importowania kopii zapasowych stylu ze starej wersji lub ze Stylish jednorazowo sprawdź aktualizacje ręcznie w menedżerze stylów, aby upewnić się, że wszystkie style są zaktualizowane." "message": "Podczas importowania kopii zapasowych stylu ze starej wersji lub ze Stylish jednorazowo sprawdź aktualizacje ręcznie w menedżerze stylów, aby upewnić się, że wszystkie style są zaktualizowane."
}, },
@ -1053,9 +1003,6 @@
"popupHotkeysTooltip": { "popupHotkeysTooltip": {
"message": "Kliknij, aby zobaczyć dostępne skróty klawiszowe" "message": "Kliknij, aby zobaczyć dostępne skróty klawiszowe"
}, },
"popupManageSiteStyles": {
"message": "Zarządzaj stylami witryny"
},
"popupManageTooltip": { "popupManageTooltip": {
"message": "Shift + kliknięcie lub kliknięcie prawym przyciskiem otwiera menedżera ze stylami obowiązującymi dla bieżącej witryny" "message": "Shift + kliknięcie lub kliknięcie prawym przyciskiem otwiera menedżera ze stylami obowiązującymi dla bieżącej witryny"
}, },
@ -1077,21 +1024,6 @@
"prefShowBadge": { "prefShowBadge": {
"message": "Liczba aktywnych stylów dla bieżącej witryny" "message": "Liczba aktywnych stylów dla bieżącej witryny"
}, },
"preferScheme": {
"message": "Preferencje trybu ciemnego/jasnego"
},
"preferSchemeAlways": {
"message": "Obecnie ignorowane (styl zawsze obowiązuje), ponieważ globalny tryb ciemny/jasny jest wyłączony"
},
"preferSchemeDark": {
"message": "Ciemny"
},
"preferSchemeLight": {
"message": "Jasny"
},
"preferSchemeNone": {
"message": "Brak (zawsze stosowane)"
},
"previewLabel": { "previewLabel": {
"message": "Podgląd na żywo" "message": "Podgląd na żywo"
}, },
@ -1120,7 +1052,7 @@
"message": "Odczytywanie stylów..." "message": "Odczytywanie stylów..."
}, },
"reload": { "reload": {
"message": "Przeładuj" "message": "Przeładuj rozszerzenie Stylus"
}, },
"replace": { "replace": {
"message": "Zamień" "message": "Zamień"
@ -1131,18 +1063,12 @@
"replaceWith": { "replaceWith": {
"message": "Zamień na" "message": "Zamień na"
}, },
"restoreTemplate": {
"message": "Przywróć szablon domyślny.\n\n(Aktualnie otwarte strony edytora nie ulegną zmianie.)"
},
"retrieveBckp": { "retrieveBckp": {
"message": "Importuj style" "message": "Importuj style"
}, },
"retrieveDropboxSync": { "retrieveDropboxSync": {
"message": "Importuj z Dropboksa" "message": "Importuj z Dropboksa"
}, },
"saveAsTemplate": {
"message": "Zapisz jako szablon"
},
"search": { "search": {
"message": "Szukaj" "message": "Szukaj"
}, },
@ -1183,7 +1109,7 @@
"message": "Tygodniowa liczba instalacji" "message": "Tygodniowa liczba instalacji"
}, },
"searchStyleQueryHint": { "searchStyleQueryHint": {
"message": "Szukaj nazwy stylów (z uwzględnieniem wielkości liter, jeśli używana jest wielka litera):\njakieś słowa wszystkie te słowa w dowolnej kolejności\n\"jakaś fraza\" ta fraza bez cudzysłowów\n/foo.*bar/i wyrażenie regularne bez spacji (zamiast tego użyj \\s)" "message": "Szukaj nazw stylów bez rozróżniania wielkości liter:\njakieś słowa - wszystkie słowa w dowolnej kolejności\n\"jakieś zdanie\" - dokładnie to zdanie bez cudzysłowów\n2020 - rok jak ten pokazuje również style zaktualizowane w 2020"
}, },
"searchStylesAll": { "searchStylesAll": {
"message": "Wszystkie" "message": "Wszystkie"
@ -1218,18 +1144,12 @@
"sections": { "sections": {
"message": "Sekcje" "message": "Sekcje"
}, },
"settings": {
"message": "Ustawienia"
},
"shortcuts": { "shortcuts": {
"message": "Skróty" "message": "Skróty"
}, },
"shortcutsNote": { "shortcutsNote": {
"message": "Zdefiniuj skróty klawiaturowe" "message": "Zdefiniuj skróty klawiaturowe"
}, },
"shortcutsNoteFF": {
"message": "W przeglądarce Firefox 66+ możesz ręcznie otworzyć interfejs wbudowanych skrótów:\n1) kliknij prawym przyciskiem myszy ikonę Stylusa na pasku narzędzi i wybierz 'Zarządzaj'\n(alternatywnie otwórz about:addon z menu głównego lub Ctrl-Shift-A),\n2) na stronie, która się otworzy, kliknij ikonę koła zębatego w prawym górnym rogu,\n3) wybierz 'Zarządzaj skrótami rozszerzeń'.\n\nMożesz także dostosować skróty tutaj."
},
"sortDateNewestFirst": { "sortDateNewestFirst": {
"message": "najpierw najnowsze" "message": "najpierw najnowsze"
}, },
@ -1275,30 +1195,12 @@
"styleEnabledLabel": { "styleEnabledLabel": {
"message": "Włączony" "message": "Włączony"
}, },
"styleExcludeLabel": {
"message": "Niestandardowe wykluczone witryny"
},
"styleFromMozillaFormatError": { "styleFromMozillaFormatError": {
"message": "Nie udało się zaimportować z formatu Mozilla" "message": "Nie udało się zaimportować z formatu Mozilla"
}, },
"styleFromMozillaFormatPrompt": { "styleFromMozillaFormatPrompt": {
"message": "Wprowadź kod w formacie Mozilla" "message": "Wprowadź kod w formacie Mozilla"
}, },
"styleIncludeLabel": {
"message": "Niestandardowe uwzględnione witryny"
},
"styleInjectionImportance": {
"message": "Przełącz ważność stylu"
},
"styleInjectionOrder": {
"message": "Kolejność wstrzykiwania stylów"
},
"styleInjectionOrderHint": {
"message": "Przeciągnij i upuść styl, aby zmienić jego pozycję. Style są wstrzykiwane sekwencyjnie w kolejności pokazanej poniżej, dzięki czemu styl znajdujący się dalej na liście może zastąpić wcześniejsze style."
},
"styleInjectionOrderHint_prio": {
"message": "Ważne style wymienione poniżej są zawsze wstrzykiwane jako ostatnie, dzięki czemu mogą zastąpić nowo zainstalowane style. Kliknij oznaczenie stylu, aby zmienić jego ważność."
},
"styleInstall": { "styleInstall": {
"message": "Zainstalować '$stylename$' do Stylusa?", "message": "Zainstalować '$stylename$' do Stylusa?",
"placeholders": { "placeholders": {
@ -1341,15 +1243,6 @@
"styleNotAppliedRegexpProblemTooltip": { "styleNotAppliedRegexpProblemTooltip": {
"message": "Styl nie został zastosowany z powodu nieprawidłowego użycia 'regexp()'" "message": "Styl nie został zastosowany z powodu nieprawidłowego użycia 'regexp()'"
}, },
"styleNotAppliedSchemeDark": {
"message": "Ten styl jest stosowany tylko w trybie ciemnym"
},
"styleNotAppliedSchemeLight": {
"message": "Ten styl jest stosowany tylko w trybie jasnym"
},
"stylePreferSchemeLabel": {
"message": "Tryb ciemny/jasny"
},
"styleRegexpInvalidExplanation": { "styleRegexpInvalidExplanation": {
"message": "Niektóre reguły 'regexp()', których nie można było w ogóle skompilować." "message": "Niektóre reguły 'regexp()', których nie można było w ogóle skompilować."
}, },
@ -1359,6 +1252,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "Liczba sekcji, które nie zostały zastosowane z powodu nieprawidłowego użycia 'regexp()'" "message": "Liczba sekcji, które nie zostały zastosowane z powodu nieprawidłowego użycia 'regexp()'"
}, },
"styleRegexpTestButton": {
"message": "Test RegExp"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "Dopasowane karty" "message": "Dopasowane karty"
}, },
@ -1380,9 +1276,6 @@
"styleSaveLabel": { "styleSaveLabel": {
"message": "Zapisz" "message": "Zapisz"
}, },
"styleSettings": {
"message": "Ustawienia stylu"
},
"styleToMozillaFormatHelp": { "styleToMozillaFormatHelp": {
"message": "Kod w formacie Mozilla może być przesłany do userstyles.org i użyty z klasycznym dodatkiem Stylish dla Firefoksa" "message": "Kod w formacie Mozilla może być przesłany do userstyles.org i użyty z klasycznym dodatkiem Stylish dla Firefoksa"
}, },
@ -1400,9 +1293,6 @@
"styleUpdateDiscardChanges": { "styleUpdateDiscardChanges": {
"message": "Styl zmieniono poza edytorem. Czy chcesz przeładować styl?" "message": "Styl zmieniono poza edytorem. Czy chcesz przeładować styl?"
}, },
"styleUpdateUrlLabel": {
"message": "Adres URL aktualizacji"
},
"stylusUnavailableForURL": { "stylusUnavailableForURL": {
"message": "Stylus nie działa na takich stronach." "message": "Stylus nie działa na takich stronach."
}, },
@ -1418,16 +1308,8 @@
"syncError": { "syncError": {
"message": "Synchronizacja nie powiodła się" "message": "Synchronizacja nie powiodła się"
}, },
"syncErrorLock": {
"message": "Baza danych jest już w użyciu. Blokada wygaśnie o $TIME$",
"placeholders": {
"time": {
"content": "$1"
}
}
},
"syncErrorRelogin": { "syncErrorRelogin": {
"message": "Synchronizacja nie powiodła się. Wylogowano.\nSpróbuj ponownie zalogować się w opcjach Stylusa." "message": "Synchronizacja nie powiodła się.\nSpróbuj ponownie zalogować się w opcjach Stylusa:\nkliknij najpierw 'rozłącz' , następnie 'połącz'."
}, },
"syncStorageErrorSaving": { "syncStorageErrorSaving": {
"message": "Nie można zapisać wartości. Spróbuj zmniejszyć ilość tekstu." "message": "Nie można zapisać wartości. Spróbuj zmniejszyć ilość tekstu."
@ -1518,6 +1400,9 @@
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "Zastąpić domyślny szablon dla nowych stylów Usercss aktualnym kodem?" "message": "Zastąpić domyślny szablon dla nowych stylów Usercss aktualnym kodem?"
}, },
"usercssReplaceTemplateName": {
"message": "Puste @name zastępuje szablon domyślny"
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "Wstaw kod tutaj..." "message": "Wstaw kod tutaj..."
}, },

View File

@ -64,6 +64,9 @@
"author": { "author": {
"message": "Autor" "message": "Autor"
}, },
"backupMessage": {
"message": "Selecione um arquivo ou arraste e solte nessa página."
},
"bckpInstStyles": { "bckpInstStyles": {
"message": "Exportar estilos" "message": "Exportar estilos"
}, },
@ -121,9 +124,6 @@
"cm_selectByTokens": { "cm_selectByTokens": {
"message": "Clicar duas vezes seleciona tokens" "message": "Clicar duas vezes seleciona tokens"
}, },
"cm_selectByTokensTooltip": {
"message": "Exemplos de tokens: .foo-bar-2 #aabbcc 0.32 !Important\nQuando desativado: as palavras delimitadas por pontuação são selecionadas."
},
"cm_smartIndent": { "cm_smartIndent": {
"message": "Usar indentação inteligente" "message": "Usar indentação inteligente"
}, },
@ -231,9 +231,6 @@
"disableAllStyles": { "disableAllStyles": {
"message": "Desativar todos os estilos" "message": "Desativar todos os estilos"
}, },
"disableAllStylesOff": {
"message": "Estilos estão desligados"
},
"disableStyleLabel": { "disableStyleLabel": {
"message": "Desativar" "message": "Desativar"
}, },
@ -310,15 +307,21 @@
"findStyles": { "findStyles": {
"message": "Encontrar estilos" "message": "Encontrar estilos"
}, },
"findStylesForSite": {
"message": "Procurar mais estilos para este site"
},
"findStylesInline": {
"message": "Em linha"
},
"findStylesInlineTooltip": {
"message": "Mostrar resultados dentro dessa janela"
},
"genericAdd": { "genericAdd": {
"message": "Adicionar" "message": "Adicionar"
}, },
"genericClone": { "genericClone": {
"message": "Clonar" "message": "Clonar"
}, },
"genericDescription": {
"message": "Descrição"
},
"genericDisabledLabel": { "genericDisabledLabel": {
"message": "Desativado" "message": "Desativado"
}, },
@ -507,63 +510,27 @@
"liveReloadInstallHintFF": { "liveReloadInstallHintFF": {
"message": "Mantenha juntamente esta guia e a guia original abertas para atualizar automaticamente o estilo sob mudanças externas." "message": "Mantenha juntamente esta guia e a guia original abertas para atualizar automaticamente o estilo sob mudanças externas."
}, },
"liveReloadLabel": {
"message": "Recarregamento dinâmico"
},
"manageFavicons": {
"message": "Favicons em colunas de aplica-se a"
},
"manageFaviconsGray": {
"message": "Acinzentado(s)"
},
"manageFaviconsHelp": {
"message": "O Stylus usa um serviço externo https://icons.duckduckgo.com"
},
"manageFilters": { "manageFilters": {
"message": "Filtros" "message": "Filtros"
}, },
"manageHeading": { "manageHeading": {
"message": "Estilos instalados" "message": "Estilos instalados"
}, },
"manageMaxTargets": {
"message": "Número de aplica-se a itens"
},
"manageNewStyleAsUsercss": { "manageNewStyleAsUsercss": {
"message": "como UserCSS" "message": "como UserCSS"
}, },
"manageNewUI": {
"message": "Nova interface do gestor"
},
"manageOnlyDisabled": { "manageOnlyDisabled": {
"message": "Somente estilos desativados" "message": "Somente estilos desativados"
}, },
"manageOnlyEnabled": { "manageOnlyEnabled": {
"message": "Apenas estilos habilitados" "message": "Apenas estilos habilitados"
}, },
"manageOnlyExternal": {
"message": "Apenas estilos externos"
},
"manageOnlyLocal": {
"message": "Apenas estilos criados localmente"
},
"manageOnlyLocalTooltip": {
"message": "(os estilos não instalados através de uma página userstyles.org)"
},
"manageOnlyNonUsercss": { "manageOnlyNonUsercss": {
"message": "Apenas estilos sem UserCSS" "message": "Apenas estilos sem UserCSS"
}, },
"manageOnlyUpdates": {
"message": "Apenas com atualizações ou problemas"
},
"manageOnlyUsercss": { "manageOnlyUsercss": {
"message": "Apenas estilos com UserCSS" "message": "Apenas estilos com UserCSS"
}, },
"menuShowBadge": {
"message": "Mostrar a contagem de estilos ativados"
},
"meta_invalidCheckboxDefault": {
"message": "Inválida @var checkbox: o valor deve ser 0 ou 1"
},
"meta_invalidNumber": { "meta_invalidNumber": {
"message": "Espera-se um número" "message": "Espera-se um número"
}, },
@ -634,15 +601,6 @@
"optionsActions": { "optionsActions": {
"message": "Ações" "message": "Ações"
}, },
"optionsAdvanced": {
"message": "Avançadas"
},
"optionsAdvancedContextDelete": {
"message": "Adicionar 'Eliminar' no menu de contexto do editor"
},
"optionsAdvancedExposeIframes": {
"message": "Expor iframes via HTML[stylus-iframe]"
},
"optionsAdvancedNewStyleAsUsercss": { "optionsAdvancedNewStyleAsUsercss": {
"message": "Escrever novo estilo como UserCSS" "message": "Escrever novo estilo como UserCSS"
}, },
@ -658,12 +616,6 @@
"optionsCheckUpdate": { "optionsCheckUpdate": {
"message": "Verifique e instale todas as atualizações disponíveis" "message": "Verifique e instale todas as atualizações disponíveis"
}, },
"optionsCustomizeBadge": {
"message": "Distintivo no ícone da barra de ferramentas"
},
"optionsCustomizeIcon": {
"message": "Ícone da barra de ferramentas"
},
"optionsCustomizeSync": { "optionsCustomizeSync": {
"message": "Sincronizar para a nuvem" "message": "Sincronizar para a nuvem"
}, },
@ -673,12 +625,6 @@
"optionsHeading": { "optionsHeading": {
"message": "Opções" "message": "Opções"
}, },
"optionsIconDark": {
"message": "Temas escuros do browser"
},
"optionsIconLight": {
"message": "Temas claros do browser"
},
"optionsOpen": { "optionsOpen": {
"message": "Abrir" "message": "Abrir"
}, },
@ -688,12 +634,6 @@
"optionsPopupWidth": { "optionsPopupWidth": {
"message": "Largura do popup (em pixels)" "message": "Largura do popup (em pixels)"
}, },
"optionsReset": {
"message": "Restabelecer as opções aos valores predefinidos"
},
"optionsResetButton": {
"message": "Restabelecer opções"
},
"optionsSubheading": { "optionsSubheading": {
"message": "Mais Opções" "message": "Mais Opções"
}, },
@ -706,9 +646,6 @@
"optionsSyncNone": { "optionsSyncNone": {
"message": "Nenhum" "message": "Nenhum"
}, },
"optionsSyncPassword": {
"message": "Senha"
},
"optionsSyncStatusConnected": { "optionsSyncStatusConnected": {
"message": "Conectado" "message": "Conectado"
}, },
@ -727,86 +664,20 @@
"optionsSyncSyncNow": { "optionsSyncSyncNow": {
"message": "Sincronizar agora" "message": "Sincronizar agora"
}, },
"optionsUpdateImportNote": {
"message": "Ao importar uma cópia de segurança de estilo da versão antiga ou do Stylish, faça uma verificação única de atualizações manualmente no gestor de estilos para garantir que todos os estilos sejam atualizados."
},
"optionsUpdateInterval": {
"message": "Intervalo de atualização automática do estilo de usuário em horas (especifique 0 para desativar)"
},
"overwriteFileExport": { "overwriteFileExport": {
"message": "Você gostaria de substituir um arquivo existente?" "message": "Você gostaria de substituir um arquivo existente?"
}, },
"paginationCurrent": {
"message": "Pagina atual"
},
"paginationEstimated": {
"message": "Número estimado de páginas"
},
"paginationNext": {
"message": "Próxima página"
},
"paginationPrevious": {
"message": "Pagina anterior"
},
"paginationTotal": {
"message": "Páginas totais"
},
"parseUsercssError": { "parseUsercssError": {
"message": "Não foi possível analisar o UserCSS:" "message": "Não foi possível analisar o UserCSS:"
}, },
"popupBorders": {
"message": "Adicionar margens laterais brancas "
},
"popupBordersTooltip": {
"message": "Útil para temas escuros no novo Chrome, já que não pinta mais as margens laterais"
},
"popupHotkeysInfo": {
"message": "<1>- <9>,<0>, também no teclado numérico - alterna o Nth estilo (0 é 10)\n<A>- <Z>alterna o primeiro estilo com um nome que começa com a letra\n<Shift>abre o editor em vez de alternar\n<Numpad +>ativa estilos listados\n<Numpad >desativa estilos listados\n<Numpad *>e <`> (backtick) - alterna os estilos inicialmente ativados; não se aplica a estilos habilitados subsequentemente enquanto o popup está aberto, para que você possa restaurar a seleção inicial depois de testar o material: basta desabilitar todos e, em seguida, alternar, i.e. <Numpad ><Numpad *>\nMais informações no wiki"
},
"popupHotkeysTooltip": {
"message": "Clique para ver as teclas de atalho disponíveis"
},
"popupManageTooltip": {
"message": "Shift-clique ou clique com o botão direito abre o gestor com estilos aplicáveis ao site atual"
},
"popupOpenEditInWindow": {
"message": "Abra o editor em uma nova janela"
},
"popupOpenEditInWindowTooltip": {
"message": "Também ativado ao desanexar o separador do editor de uma janela do browser, e desativado por anexar um separador único do editor a outra janela."
},
"popupStylesFirst": {
"message": "Estilos antes de comandos"
},
"prefShowBadge": { "prefShowBadge": {
"message": "Número de estilos ativos para o site atual" "message": "Número de estilos ativos para o site atual"
}, },
"preferSchemeDark": {
"message": "Escuro"
},
"preferSchemeLight": {
"message": "Claro"
},
"preferSchemeNone": {
"message": "Nenhum (sempre aplicado)"
},
"previewLabel": {
"message": "Pré-visualização dinâmica"
},
"previewTooltip": {
"message": "Temporariamente aplica as alterações sem guardar.\nGuarde o estilo para tornar as alterações permanentes."
},
"publish": {
"message": "Publicar"
},
"publishStyle": {
"message": "Publicar estilo"
},
"readingStyles": { "readingStyles": {
"message": "Lendo estilos..." "message": "Lendo estilos..."
}, },
"reload": { "reload": {
"message": "Recarregar" "message": "Recarregar a extensão do Stylus"
}, },
"replace": { "replace": {
"message": "Substituir" "message": "Substituir"
@ -826,39 +697,9 @@
"search": { "search": {
"message": "Buscar" "message": "Buscar"
}, },
"searchCaseSensitive": {
"message": "Sensível a maiúsculas e minúsculas"
},
"searchGlobalStyles": {
"message": "Também buscar estilos globais"
},
"searchNumberOfResults": {
"message": "Número de correspondências"
},
"searchNumberOfResults2": {
"message": "Número de correspondências no código e aplica-se a valores"
},
"searchRegexp": { "searchRegexp": {
"message": "Use a sintaxe /re/ para busca por regexp" "message": "Use a sintaxe /re/ para busca por regexp"
}, },
"searchResultInstallCount": {
"message": "Instalações totais"
},
"searchResultNoneFound": {
"message": "Nenhum estilo encontrado para este site."
},
"searchResultRating": {
"message": "Classificação"
},
"searchResultUpdated": {
"message": "Atualizado"
},
"searchResultWeeklyCount": {
"message": "Instalações semanais"
},
"searchStylesCode": {
"message": "Código CSS"
},
"sectionAdd": { "sectionAdd": {
"message": "Adicionar outra seção" "message": "Adicionar outra seção"
}, },
@ -868,39 +709,9 @@
"sectionRemove": { "sectionRemove": {
"message": "Remover seção" "message": "Remover seção"
}, },
"sectionRestore": {
"message": "Restaurar secção removida"
},
"sections": {
"message": "Seções"
},
"shortcuts": { "shortcuts": {
"message": "Atalhos" "message": "Atalhos"
}, },
"shortcutsNote": {
"message": "Definir atalhos de teclado"
},
"sortDateNewestFirst": {
"message": "mais recente primeiro"
},
"sortDateOldestFirst": {
"message": "mais antigos primeiro"
},
"sortLabel": {
"message": "Selecione uma ordenação para aplicar aos estilos instalados"
},
"sortLabelTitleAsc": {
"message": "Título Ascendente"
},
"sortLabelTitleDesc": {
"message": "Título Descendente"
},
"sortStylesHelp": {
"message": "Escolha o tipo de ordenação a ser aplicado às entradas instaladas na lista suspensa de ordenação. A configuração predefinida aplica uma ordem crescente (A a Z) aos títulos de entrada. As ordenações dentro do grupo \"Título Decrescente\" aplicarão uma classificação decrescente (Z a A) ao título. Existem outras predefinições que permitirão classificar as entradas por vários critérios. Pense sobre isso como ordenar uma tabela com várias colunas e cada categoria em cada seleção (entre os sinais de mais) representa uma coluna ou grupo. Por exemplo, se a configuração for \"Ativado (primeiro) + Título\", as entradas serão ordenadas de modo que todas as entradas ativadas sejam classificadas no topo da lista, então uma classificação crescente de título de entrada (A a Z) será aplicada a ambas as entradas ativadas e desativadas separadamente."
},
"sortStylesHelpTitle": {
"message": "Ordenar conteúdos"
},
"styleBadRegexp": { "styleBadRegexp": {
"message": "Expressão regular é inválida" "message": "Expressão regular é inválida"
}, },
@ -910,12 +721,6 @@
"styleBeautifyHint": { "styleBeautifyHint": {
"message": "Dica: clique com o botão direito no botão \"Embelezar\" ou use o atalho de teclado definido para embelezar sem mostrar esse painel" "message": "Dica: clique com o botão direito no botão \"Embelezar\" ou use o atalho de teclado definido para embelezar sem mostrar esse painel"
}, },
"styleBeautifyIndentConditional": {
"message": "Indentar @media, @supports"
},
"styleBeautifyPreserveNewlines": {
"message": "Preserve novas linhas"
},
"styleCancelEditLabel": { "styleCancelEditLabel": {
"message": "Voltar ao gerenciamento" "message": "Voltar ao gerenciamento"
}, },
@ -925,12 +730,6 @@
"styleEnabledLabel": { "styleEnabledLabel": {
"message": "Ativado" "message": "Ativado"
}, },
"styleFromMozillaFormatError": {
"message": "Falha ao importar do formato Mozilla"
},
"styleFromMozillaFormatPrompt": {
"message": "Colar o código formato-Mozilla"
},
"styleInstall": { "styleInstall": {
"message": "Instalar \"$stylename$\" no Stylus?", "message": "Instalar \"$stylename$\" no Stylus?",
"placeholders": { "placeholders": {
@ -939,79 +738,18 @@
} }
} }
}, },
"styleInstallFailed": {
"message": "Falha ao instalar o estilo de usuário!\n$error$",
"placeholders": {
"error": {
"content": "$1"
}
}
},
"styleInstallOverwrite": {
"message": "$stylename$já está instalado. Substituir?\nVersão:$oldVersion$-> $newVersion$",
"placeholders": {
"newVersion": {
"content": "$3"
},
"oldVersion": {
"content": "$2"
},
"stylename": {
"content": "$1"
}
}
},
"styleMissingName": { "styleMissingName": {
"message": "Insira um nome" "message": "Insira um nome"
}, },
"styleMozillaFormatHeading": { "styleMozillaFormatHeading": {
"message": "Formato Mozilla" "message": "Formato Mozilla"
}, },
"styleName": {
"message": "Nome do estilo"
},
"styleNotAppliedRegexpProblemTooltip": {
"message": "O estilo não foi aplicado devido ao uso incorreto de 'regexp ()'"
},
"stylePreferSchemeLabel": {
"message": "Modo Escuro/Claro"
},
"styleRegexpInvalidExplanation": {
"message": "Algumas regras de 'regexp()' que não puderam ser compiladas."
},
"styleRegexpPartialExplanation": {
"message": "Este estilo usa regexps parcialmente correspondentes em violação da <a href='https://developer.mozilla.org/docs/Web/CSS/@document'>CSS4 @document specification</a> que requer um URL correspondente inteiro. As secções de CSS afetadas não foram aplicadas nesta página. Este estilo foi provavelmente criado no Stylish-for-Chrome o qual verifica incorretamente as regras 'regexp()' desde a primeira versão (bug conhecido)."
},
"styleRegexpProblemTooltip": {
"message": "Número de secções não aplicadas devido ao uso incorreto de 'regexp ()'"
},
"styleRegexpTestFull": {
"message": "Separadores correspondentes"
},
"styleRegexpTestInvalid": {
"message": "Regexps inválidos ignorados"
},
"styleRegexpTestNone": {
"message": "Nenhum separador correspondente"
},
"styleRegexpTestNote": {
"message": "Nota: use um único \\ para escapar no campo de entrada regexp, que será automaticamente convertido para \\\\ no código de estilo conforme especificação para strings entre aspas em CSS."
},
"styleRegexpTestPartial": {
"message": "Não corresponde totalmente, portanto ignorado"
},
"styleRegexpTestTitle": {
"message": "Lista de separadores correspondentes abertos (clique no URL para focar no separador)"
},
"styleSaveLabel": { "styleSaveLabel": {
"message": "Salvar" "message": "Salvar"
}, },
"styleToMozillaFormatHelp": { "styleToMozillaFormatHelp": {
"message": "O formato Mozilla do código pode ser usado com o Stylish para Firefox e pode ser enviado para userstyles.org." "message": "O formato Mozilla do código pode ser usado com o Stylish para Firefox e pode ser enviado para userstyles.org."
}, },
"styleToMozillaFormatTitle": {
"message": "Estilo no formato Mozilla"
},
"styleUpdate": { "styleUpdate": {
"message": "Você tem certeza que quer atualizar '$stylename$'?", "message": "Você tem certeza que quer atualizar '$stylename$'?",
"placeholders": { "placeholders": {
@ -1020,57 +758,21 @@
} }
} }
}, },
"styleUpdateDiscardChanges": {
"message": "O estilo é alterado fora do editor. Gostaria de recarregar o estilo?"
},
"styleUpdateUrlLabel": {
"message": "Atualizar URL"
},
"stylusUnavailableForURL": {
"message": "O Stylus não funciona em páginas como esta."
},
"stylusUnavailableForURLdetails": {
"message": "Como precaução de segurança, o browser proíbe extensões de afetar as páginas embutidas (como chrome://version, a página de novo separador predefinido no Chrome 61, about:addons, e assim sucessivamente) tal como páginas de outras extensões. Cada browser também restringe acesso à sua própria galeria de extensões (como Chrome Web Store ou AMO)"
},
"syncDropboxStyles": { "syncDropboxStyles": {
"message": "Exportar para Dropbox" "message": "Exportar para Dropbox"
}, },
"syncStorageErrorSaving": {
"message": "O valor não pode ser guardado. Tente reduzir a quantidade de texto."
},
"toggleStyle": {
"message": "Alternar estilo"
},
"undo": { "undo": {
"message": "Desfazer" "message": "Desfazer"
}, },
"undoGlobal": { "undoGlobal": {
"message": "Desfazer todas as seções" "message": "Desfazer todas as seções"
}, },
"unreachableAMO": {
"message": "O Firefox proíbe o acesso ao site."
},
"unreachableAMOHint": {
"message": "Para permitir o acesso abra<about:config>,clique com o botão direito na lista, clique em \"Novo\", depois em \"Booleano\", cole <privacy.resistFingerprinting.block_mozAddonManager> e clique em OK,<true>,OK, recarregue a página <addons.mozilla.org>."
},
"unreachableContentScript": {
"message": "Não foi possível comunicar com a página. Tente recarregar o separador."
},
"unreachableFileHint": {
"message": "O Stylus pode aceder URLs file:// apenas se ativar a checkbox correspondente para a extensão Stylus na página chrome://extensions"
},
"unreachableMozSiteHintOldFF": {
"message": "Somente o Firefox 59 e o mais recente podem ser configurados para permitir que WebExtensions incluam elementos de estilo em sites protegidos por CSP como este."
},
"unzipStyles": { "unzipStyles": {
"message": "Descompactando estilos..." "message": "Descompactando estilos..."
}, },
"updateAllCheckSucceededNoUpdate": { "updateAllCheckSucceededNoUpdate": {
"message": "Nenhuma atualização encontrada." "message": "Nenhuma atualização encontrada."
}, },
"updateAllCheckSucceededSomeEdited": {
"message": "Alguns estilos que podem ser atualizados não foram verificados para evitar perder possíveis edições locais. As atualizações podem ser forçadas ao verificar individualmente, ou fazendo outra verificação para todos os estilos (edições locais vão ser sobrescrevidas)"
},
"updateCheckFailBadResponseCode": { "updateCheckFailBadResponseCode": {
"message": "A atualização falhou: o servidor respondeu com código $code$.", "message": "A atualização falhou: o servidor respondeu com código $code$.",
"placeholders": { "placeholders": {
@ -1082,12 +784,6 @@
"updateCheckFailServerUnreachable": { "updateCheckFailServerUnreachable": {
"message": "A atualização falhou: servidor inacessível." "message": "A atualização falhou: servidor inacessível."
}, },
"updateCheckHistory": {
"message": "Histórico de verificação de atualizações"
},
"updateCheckManualUpdateForce": {
"message": "Instalar atualização (edições locais vão ser sobrescritas)"
},
"updateCheckManualUpdateHint": { "updateCheckManualUpdateHint": {
"message": "Forçar uma atualização irá sobrescrever qualquer alteração local." "message": "Forçar uma atualização irá sobrescrever qualquer alteração local."
}, },
@ -1109,18 +805,12 @@
"uploadingFile": { "uploadingFile": {
"message": "Enviando arquivo..." "message": "Enviando arquivo..."
}, },
"usercssAvoidOverwriting": {
"message": "Por favor modifique o valor de @name ou @namespace para evitar sobrescrever um estilo existente."
},
"usercssConfigIncomplete": {
"message": "O estilo foi atualizado ou eliminado após a exibição do diálogo de configuração. Essas variáveis não foram guardadas para evitar corromper os metadados do estilo:"
},
"usercssEditorNamePlaceholder": {
"message": "Especificar @name no código"
},
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "Substituir o template padrão por novos estilos com UserCSS com o código atual?" "message": "Substituir o template padrão por novos estilos com UserCSS com o código atual?"
}, },
"usercssReplaceTemplateName": {
"message": "@nome vazio substitui o template padrão"
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "Insira o código aqui..." "message": "Insira o código aqui..."
}, },

View File

@ -1,7 +1,4 @@
{ {
"InaccessibleFileHint": {
"message": "Stylus não pode acessar alguns tipos de arquivos (ex: arquivos pdf e json)."
},
"addStyleLabel": { "addStyleLabel": {
"message": "Escrever novo estilo" "message": "Escrever novo estilo"
}, },
@ -67,6 +64,9 @@
"backupButtons": { "backupButtons": {
"message": "Cópia de segurança" "message": "Cópia de segurança"
}, },
"backupMessage": {
"message": "Selecione um ficheiro ou arraste e solte-o nesta página."
},
"bckpInstStyles": { "bckpInstStyles": {
"message": "Exportar estilos" "message": "Exportar estilos"
}, },
@ -133,9 +133,6 @@
"cm_theme": { "cm_theme": {
"message": "Tema" "message": "Tema"
}, },
"colorpickerPaletteHint": {
"message": "Clique com o botão direito em uma amostra para percorrer suas linhas de código"
},
"colorpickerSwitchFormatTooltip": { "colorpickerSwitchFormatTooltip": {
"message": "Mudar formatos: HEX -> RGB -> HSL.\nShift-clique para inverter a direção.\nTambém através das teclas PgUp (PageUp), PgDn (PageDown)." "message": "Mudar formatos: HEX -> RGB -> HSL.\nShift-clique para inverter a direção.\nTambém através das teclas PgUp (PageUp), PgDn (PageDown)."
}, },
@ -181,32 +178,6 @@
"confirmYes": { "confirmYes": {
"message": "Sim" "message": "Sim"
}, },
"connectingDropbox": {
"message": "Conectando ao Dropbox..."
},
"connectingDropboxNotAllowed": {
"message": "Conectar ao Dropbox somente é disponível em apps instalados diretamente da loja web"
},
"copied": {
"message": "Copiado para a área de transferência"
},
"copy": {
"message": "Copiar para a área de transferência"
},
"customNameHint": {
"message": "Digite um nome personalizado para renomear o estilo na UI sem quebrar suas atualizações"
},
"customNameResetHint": {
"message": "Deixar de usar o nome personalizado, usar o próprio nome do estilo"
},
"dateAbbrYear": {
"message": "$value$a",
"placeholders": {
"value": {
"content": "$1"
}
}
},
"dateInstalled": { "dateInstalled": {
"message": "Data de instalação" "message": "Data de instalação"
}, },
@ -237,9 +208,6 @@
"dragDropMessage": { "dragDropMessage": {
"message": "Solte o ficheiro da sua cópia de segurança em qualquer sítio nesta página para importar." "message": "Solte o ficheiro da sua cópia de segurança em qualquer sítio nesta página para importar."
}, },
"dragDropUsercssTabstrip": {
"message": "Para instalar o arquivo, solte-o na linha das abas (a área onde os títulos das abas são mostrados)."
},
"editDeleteText": { "editDeleteText": {
"message": "Eliminar" "message": "Eliminar"
}, },
@ -263,18 +231,9 @@
"enableStyleLabel": { "enableStyleLabel": {
"message": "Ativar" "message": "Ativar"
}, },
"excludeStyleByDomainLabel": {
"message": "Excluir o domínio atual"
},
"excludeStyleByUrlLabel": {
"message": "Excluir a URL atual"
},
"exportLabel": { "exportLabel": {
"message": "Exportar" "message": "Exportar"
}, },
"exportSavedSuccess": {
"message": "Arquivo salvo com sucesso"
},
"externalLink": { "externalLink": {
"message": "Hiperligação externa" "message": "Hiperligação externa"
}, },
@ -301,6 +260,15 @@
"findStyles": { "findStyles": {
"message": "Localizar estilos" "message": "Localizar estilos"
}, },
"findStylesForSite": {
"message": "Encontrar mais estilos para este site"
},
"findStylesInline": {
"message": "inline"
},
"findStylesInlineTooltip": {
"message": "Exibir os resultados da pesquisa dentro desta janela."
},
"genericAdd": { "genericAdd": {
"message": "Adicionar" "message": "Adicionar"
}, },
@ -334,9 +302,6 @@
"genericUnknown": { "genericUnknown": {
"message": "Desconhecido" "message": "Desconhecido"
}, },
"gettingStyles": {
"message": "Obtendo todos os estilos..."
},
"helpAlt": { "helpAlt": {
"message": "Ajuda" "message": "Ajuda"
}, },
@ -346,9 +311,6 @@
"helpKeyMapHotkey": { "helpKeyMapHotkey": {
"message": "Prima uma tecla de atalho" "message": "Prima uma tecla de atalho"
}, },
"hostDisabled": {
"message": "Este hospedeiro foi desabilitado devido a um bug na versão atual que o navegador utilizado se encontra"
},
"importAppendLabel": { "importAppendLabel": {
"message": "Acrescentar ao estilo" "message": "Acrescentar ao estilo"
}, },
@ -358,12 +320,6 @@
"importLabel": { "importLabel": {
"message": "Importar" "message": "Importar"
}, },
"importPreprocessor": {
"message": "Estilos com <code>@preprocessor</code> não irão funcionar no modo clássico. Você pode trocar o editor para o modo UserCSS: 1) abre o gerenciador de estilos, 2) ative a caixa \"como UserCSS\", 3) clique \"Escrever novo estilo\"\n\nDeseja importar mesmo assim?"
},
"importPreprocessorTitle": {
"message": "Possível problema causado pelo @preprocessor"
},
"importReplaceLabel": { "importReplaceLabel": {
"message": "Sobrescrever estilo" "message": "Sobrescrever estilo"
}, },
@ -486,12 +442,6 @@
"liveReloadError": { "liveReloadError": {
"message": "Ocorreu um erro ao vigiar o arquivo" "message": "Ocorreu um erro ao vigiar o arquivo"
}, },
"liveReloadInstallHint": {
"message": "Mantenha esta guia aberta para atualizar automaticamente o estilo sob mudanças externas."
},
"liveReloadInstallHintFF": {
"message": "Mantenha juntamente esta guia e a guia original abertas para atualizar automaticamente o estilo sob mudanças externas."
},
"liveReloadLabel": { "liveReloadLabel": {
"message": "Recarregamento dinâmico" "message": "Recarregamento dinâmico"
}, },
@ -502,7 +452,7 @@
"message": "Acinzentado(s)" "message": "Acinzentado(s)"
}, },
"manageFaviconsHelp": { "manageFaviconsHelp": {
"message": "O Stylus usa um serviço externo https://icons.duckduckgo.com" "message": "O Stylus usa um serviço externo https://www.google.com/s2/favicons"
}, },
"manageFilters": { "manageFilters": {
"message": "Filtros" "message": "Filtros"
@ -546,73 +496,12 @@
"menuShowBadge": { "menuShowBadge": {
"message": "Mostrar a contagem de estilos ativados" "message": "Mostrar a contagem de estilos ativados"
}, },
"meta_invalidCheckboxDefault": {
"message": "Inválida @var checkbox: o valor deve ser 0 ou 1"
},
"meta_invalidNumber": {
"message": "Espera-se um número"
},
"meta_invalidRange": {
"message": "@var inválido $type$: valor deve ser um número ou um vetor",
"placeholders": {
"type": {
"content": "$1"
}
}
},
"meta_invalidString": {
"message": "Espera-se um texto entre aspas"
},
"meta_invalidWord": {
"message": "Espera-se uma palavra"
},
"meta_missingChar": {
"message": "Caracteres esperados: $chars$",
"placeholders": {
"chars": {
"content": "$1"
}
}
},
"meta_missingMandatory": {
"message": "Metadata obrigatório não encontrado: $keys$",
"placeholders": {
"keys": {
"content": "$1"
}
}
},
"meta_unknownMeta": {
"message": "Metadata desconhecido: $key$",
"placeholders": {
"key": {
"content": "$1"
}
}
},
"meta_unknownVarType": {
"message": "Tipo desconhecido da variável @$varkey$: $vartype$",
"placeholders": {
"varkey": {
"content": "$1"
},
"vartype": {
"content": "$2"
}
}
},
"noFileToImport": {
"message": "Para importar seus estilos, você deve exportar primeiro."
},
"noStylesForSite": { "noStylesForSite": {
"message": "Nenhum estilo instalado para este site." "message": "Nenhum estilo instalado para este site."
}, },
"openManage": { "openManage": {
"message": "Gerir" "message": "Gerir"
}, },
"openOptions": {
"message": "Opções"
},
"openStylesManager": { "openStylesManager": {
"message": "Abrir gestor de estilos" "message": "Abrir gestor de estilos"
}, },
@ -649,9 +538,6 @@
"optionsCustomizeIcon": { "optionsCustomizeIcon": {
"message": "Ícone da barra de ferramentas" "message": "Ícone da barra de ferramentas"
}, },
"optionsCustomizeSync": {
"message": "Sincronizar para a nuvem"
},
"optionsCustomizeUpdate": { "optionsCustomizeUpdate": {
"message": "Atualizações" "message": "Atualizações"
}, },
@ -682,42 +568,12 @@
"optionsSubheading": { "optionsSubheading": {
"message": "Mais Opções" "message": "Mais Opções"
}, },
"optionsSyncConnect": {
"message": "Conectar"
},
"optionsSyncDisconnect": {
"message": "Desconectar"
},
"optionsSyncNone": {
"message": "Nenhum"
},
"optionsSyncStatusConnected": {
"message": "Conectado"
},
"optionsSyncStatusConnecting": {
"message": "Conectando..."
},
"optionsSyncStatusDisconnected": {
"message": "Desconectado"
},
"optionsSyncStatusDisconnecting": {
"message": "Desconectando..."
},
"optionsSyncStatusSyncing": {
"message": "Sincronizando..."
},
"optionsSyncSyncNow": {
"message": "Sincronizar agora"
},
"optionsUpdateImportNote": { "optionsUpdateImportNote": {
"message": "Ao importar uma cópia de segurança de estilo da versão antiga ou do Stylish, faça uma verificação única de atualizações manualmente no gestor de estilos para garantir que todos os estilos sejam atualizados." "message": "Ao importar uma cópia de segurança de estilo da versão antiga ou do Stylish, faça uma verificação única de atualizações manualmente no gestor de estilos para garantir que todos os estilos sejam atualizados."
}, },
"optionsUpdateInterval": { "optionsUpdateInterval": {
"message": "Intervalo de atualização automática do estilo de usuário em horas (especifique 0 para desativar)" "message": "Intervalo de atualização automática do estilo de usuário em horas (especifique 0 para desativar)"
}, },
"overwriteFileExport": {
"message": "Você gostaria de substituir um arquivo existente?"
},
"paginationCurrent": { "paginationCurrent": {
"message": "Pagina atual" "message": "Pagina atual"
}, },
@ -769,9 +625,6 @@
"previewTooltip": { "previewTooltip": {
"message": "Temporariamente aplica as alterações sem guardar.\nGuarde o estilo para tornar as alterações permanentes." "message": "Temporariamente aplica as alterações sem guardar.\nGuarde o estilo para tornar as alterações permanentes."
}, },
"readingStyles": {
"message": "Lendo estilos..."
},
"replace": { "replace": {
"message": "Substituir" "message": "Substituir"
}, },
@ -784,9 +637,6 @@
"retrieveBckp": { "retrieveBckp": {
"message": "Importar estilos" "message": "Importar estilos"
}, },
"retrieveDropboxSync": {
"message": "Importar do Dropbox"
},
"search": { "search": {
"message": "Pesquisar" "message": "Pesquisar"
}, },
@ -829,9 +679,6 @@
"sectionRestore": { "sectionRestore": {
"message": "Restaurar secção removida" "message": "Restaurar secção removida"
}, },
"sections": {
"message": "Secções"
},
"shortcuts": { "shortcuts": {
"message": "Atalhos" "message": "Atalhos"
}, },
@ -865,9 +712,6 @@
"styleBeautify": { "styleBeautify": {
"message": "Embelezar" "message": "Embelezar"
}, },
"styleBeautifyHint": {
"message": "Dica: clique com o botão direito no botão \"Embelezar\" ou use o atalho de teclado definido para embelezar sem mostrar esse painel"
},
"styleBeautifyIndentConditional": { "styleBeautifyIndentConditional": {
"message": "Indentar @media, @supports" "message": "Indentar @media, @supports"
}, },
@ -937,6 +781,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "Número de secções não aplicadas devido ao uso incorreto de 'regexp ()'" "message": "Número de secções não aplicadas devido ao uso incorreto de 'regexp ()'"
}, },
"styleRegexpTestButton": {
"message": "Testar RegExp"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "Separadores correspondentes" "message": "Separadores correspondentes"
}, },
@ -981,9 +828,6 @@
"stylusUnavailableForURLdetails": { "stylusUnavailableForURLdetails": {
"message": "Como precaução de segurança, o browser proíbe extensões de afetar as páginas embutidas (como chrome://version, a página de novo separador predefinido no Chrome 61, about:addons, e assim sucessivamente) tal como páginas de outras extensões. Cada browser também restringe acesso à sua própria galeria de extensões (como Chrome Web Store ou AMO)" "message": "Como precaução de segurança, o browser proíbe extensões de afetar as páginas embutidas (como chrome://version, a página de novo separador predefinido no Chrome 61, about:addons, e assim sucessivamente) tal como páginas de outras extensões. Cada browser também restringe acesso à sua própria galeria de extensões (como Chrome Web Store ou AMO)"
}, },
"syncDropboxStyles": {
"message": "Exportar para Dropbox"
},
"syncStorageErrorSaving": { "syncStorageErrorSaving": {
"message": "O valor não pode ser guardado. Tente reduzir a quantidade de texto." "message": "O valor não pode ser guardado. Tente reduzir a quantidade de texto."
}, },
@ -1008,12 +852,6 @@
"unreachableFileHint": { "unreachableFileHint": {
"message": "O Stylus pode aceder URLs file:// apenas se ativar a checkbox correspondente para a extensão Stylus na página chrome://extensions" "message": "O Stylus pode aceder URLs file:// apenas se ativar a checkbox correspondente para a extensão Stylus na página chrome://extensions"
}, },
"unreachableMozSiteHintOldFF": {
"message": "Somente o Firefox 59 e o mais recente podem ser configurados para permitir que WebExtensions incluam elementos de estilo em sites protegidos por CSP como este."
},
"unzipStyles": {
"message": "Descompactando estilos..."
},
"updateAllCheckSucceededNoUpdate": { "updateAllCheckSucceededNoUpdate": {
"message": "Nenhuma atualização encontrada." "message": "Nenhuma atualização encontrada."
}, },
@ -1055,9 +893,6 @@
"updatesCurrentlyInstalled": { "updatesCurrentlyInstalled": {
"message": "Atualizações instaladas:" "message": "Atualizações instaladas:"
}, },
"uploadingFile": {
"message": "Enviando arquivo..."
},
"usercssAvoidOverwriting": { "usercssAvoidOverwriting": {
"message": "Por favor modifique o valor de @name ou @namespace para evitar sobrescrever um estilo existente." "message": "Por favor modifique o valor de @name ou @namespace para evitar sobrescrever um estilo existente."
}, },
@ -1070,6 +905,9 @@
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "Substituir o modelo predefinido para novos estilos de Usercss com o código atual?" "message": "Substituir o modelo predefinido para novos estilos de Usercss com o código atual?"
}, },
"usercssReplaceTemplateName": {
"message": "@name vazio substitui o modelo predefinido"
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "Insira o código aqui..." "message": "Insira o código aqui..."
}, },
@ -1081,8 +919,5 @@
}, },
"writeStyleForURL": { "writeStyleForURL": {
"message": "este URL" "message": "este URL"
},
"zipStyles": {
"message": "Compactando estilos..."
} }
} }

View File

@ -61,6 +61,9 @@
"author": { "author": {
"message": "Autor" "message": "Autor"
}, },
"backupMessage": {
"message": "Selectați un fișier sau drag-and-drop aici"
},
"bckpInstStyles": { "bckpInstStyles": {
"message": "Exportați teme" "message": "Exportați teme"
}, },
@ -230,6 +233,12 @@
"findStyles": { "findStyles": {
"message": "Găsiți teme" "message": "Găsiți teme"
}, },
"findStylesForSite": {
"message": "Gasiți mai multe teme pentru acest site."
},
"findStylesInlineTooltip": {
"message": "Arătați rezultatele căutării în această pagină."
},
"genericAdd": { "genericAdd": {
"message": "Adaugă" "message": "Adaugă"
}, },
@ -404,7 +413,7 @@
"message": "Hașurat" "message": "Hașurat"
}, },
"manageFaviconsHelp": { "manageFaviconsHelp": {
"message": "Stylus folosește un serviciu extern https://icons.duckduckgo.com" "message": "Stylus folosește un serviciu extern https://www.google.com/s2/favicons"
}, },
"manageFilters": { "manageFilters": {
"message": "Filtre" "message": "Filtre"
@ -445,18 +454,12 @@
"menuShowBadge": { "menuShowBadge": {
"message": "Afișați numărul temelor active" "message": "Afișați numărul temelor active"
}, },
"meta_invalidCheckboxDefault": {
"message": "@var checkbox invalidă: valuarea trebuie să fie 0 sau 1"
},
"noStylesForSite": { "noStylesForSite": {
"message": "Nicio temă instalată pentru acest site." "message": "Nicio temă instalată pentru acest site."
}, },
"openManage": { "openManage": {
"message": "Managerul" "message": "Managerul"
}, },
"openOptions": {
"message": "Opțiuni"
},
"openStylesManager": { "openStylesManager": {
"message": "Deschideți managerul de teme" "message": "Deschideți managerul de teme"
}, },
@ -622,9 +625,6 @@
"sectionRestore": { "sectionRestore": {
"message": "Restaurează o secțiune ștearsă" "message": "Restaurează o secțiune ștearsă"
}, },
"sections": {
"message": "Secțiuni"
},
"shortcutsNote": { "shortcutsNote": {
"message": "Creeați keyboard shortcuts" "message": "Creeați keyboard shortcuts"
}, },
@ -789,9 +789,6 @@
"unreachableFileHint": { "unreachableFileHint": {
"message": "Stylus poate accesa file:// URLs doar când este activată opțiunea respectivă din pagina cu setări chrome://extensions" "message": "Stylus poate accesa file:// URLs doar când este activată opțiunea respectivă din pagina cu setări chrome://extensions"
}, },
"unreachableMozSiteHintOldFF": {
"message": "Doar Firefox 59 sau mai nou poate fi configurat să permită WebExtension-urilor să adauge elemente la site-uri CSP-protected precum acesta."
},
"updateAllCheckSucceededNoUpdate": { "updateAllCheckSucceededNoUpdate": {
"message": "Niciun update găsit." "message": "Niciun update găsit."
}, },
@ -845,6 +842,9 @@
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "Înlocuiți tema de bază a formatului Usercss cu acest cod?" "message": "Înlocuiți tema de bază a formatului Usercss cu acest cod?"
}, },
"usercssReplaceTemplateName": {
"message": "@name este gol și înlocuiețte valoarea de bază"
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "Introduce cod aici..." "message": "Introduce cod aici..."
}, },

View File

@ -68,7 +68,7 @@
"message": "Резервное копирование" "message": "Резервное копирование"
}, },
"backupMessage": { "backupMessage": {
"message": "Чтобы импортировать архив стилей, перетащите файл в эту страницу или нажмите кнопку Импорт.\n\nЧтобы экспортировать совместимый архив для старого Stylus ранее чем 1.5.18, кликните на кнопку Экспорт правой кнопкой мыши или с нажатой клавишей Shift." "message": "Нажмите «Импорт», чтобы выбрать файл или просто перетащите его на эту страницу"
}, },
"bckpInstStyles": { "bckpInstStyles": {
"message": "Экспорт стилей" "message": "Экспорт стилей"
@ -267,17 +267,6 @@
"disableStyleLabel": { "disableStyleLabel": {
"message": "Отключить" "message": "Отключить"
}, },
"draftAction": {
"message": "Выберите «Да» для загрузки черновика или «Нет», чтобы выкинуть его."
},
"draftTitle": {
"message": "Восстановление черновика, созданного $date$",
"placeholders": {
"date": {
"content": "$1"
}
}
},
"dragDropMessage": { "dragDropMessage": {
"message": "Перетащите файл с резервной копией стилей в любое место этой страницы, чтобы импортировать его." "message": "Перетащите файл с резервной копией стилей в любое место этой страницы, чтобы импортировать его."
}, },
@ -304,9 +293,6 @@
} }
} }
}, },
"editorSettings": {
"message": "Настройки редактирования"
},
"enableStyleLabel": { "enableStyleLabel": {
"message": "Включить" "message": "Включить"
}, },
@ -316,9 +302,6 @@
"excludeStyleByUrlLabel": { "excludeStyleByUrlLabel": {
"message": "Исключить текущий URL" "message": "Исключить текущий URL"
}, },
"exportCompatible": {
"message": "Экспорт (режим совместимости)"
},
"exportLabel": { "exportLabel": {
"message": "Экспорт" "message": "Экспорт"
}, },
@ -357,6 +340,15 @@
"findStyles": { "findStyles": {
"message": "Найти стили" "message": "Найти стили"
}, },
"findStylesForSite": {
"message": "Найти ещё стили для этого веб-сайта"
},
"findStylesInline": {
"message": "и показать здесь"
},
"findStylesInlineTooltip": {
"message": "Показывать найденные стили в этом окне."
},
"genericAdd": { "genericAdd": {
"message": "Добавить" "message": "Добавить"
}, },
@ -390,9 +382,6 @@
"genericSavedMessage": { "genericSavedMessage": {
"message": "Сохранено" "message": "Сохранено"
}, },
"genericTest": {
"message": "Тест"
},
"genericTitle": { "genericTitle": {
"message": "Имя" "message": "Имя"
}, },
@ -402,9 +391,6 @@
"gettingStyles": { "gettingStyles": {
"message": "Получение всех стилей..." "message": "Получение всех стилей..."
}, },
"headerResizerHint": {
"message": "С клавишей Shift размер меняется только для такого же типа страниц, т.е. редактор, менеджер, установщик"
},
"helpAlt": { "helpAlt": {
"message": "Справка" "message": "Справка"
}, },
@ -500,18 +486,9 @@
"linkGetHelp": { "linkGetHelp": {
"message": "Помощь" "message": "Помощь"
}, },
"linkGetShareStyles": {
"message": "Поиск/публикация стилей"
},
"linkGetShareStylesInfo": {
"message": "Новый сайт userstyles.world, созданный и развиваемый сообществом энтузиастов и авторов пользовательских стилей с целью заменить userstyles.org, который стал таким медленным и зависающим за последний год, что многие авторы перестали обновлять свои стили."
},
"linkGetStyles": { "linkGetStyles": {
"message": "Скачать стили" "message": "Скачать стили"
}, },
"linkGetStylesInfo": {
"message": "Архивный сайт от одного энтузиаста и автора пользовательских стилей, зеркальная копия userstyles.org, ныне медленного и зависающего. Архив обновляется примерно раз в день."
},
"linkStylusWiki": { "linkStylusWiki": {
"message": "Вики" "message": "Вики"
}, },
@ -582,7 +559,7 @@
"message": "Обесцвечивать" "message": "Обесцвечивать"
}, },
"manageFaviconsHelp": { "manageFaviconsHelp": {
"message": "Используется сторонний сервис https://icons.duckduckgo.com" "message": "Используется сторонний сервис https://www.google.com/s2/favicons"
}, },
"manageFilters": { "manageFilters": {
"message": "Фильтры" "message": "Фильтры"
@ -842,15 +819,6 @@
"optionsAdvanced": { "optionsAdvanced": {
"message": "Другое" "message": "Другое"
}, },
"optionsAdvancedAutoSwitchSchemeBySystem": {
"message": "По настройке операционной системы"
},
"optionsAdvancedAutoSwitchSchemeByTime": {
"message": "В ночное время:"
},
"optionsAdvancedAutoSwitchSchemeNever": {
"message": "Отключен. Настройка режима в стилях игнорируется."
},
"optionsAdvancedContextDelete": { "optionsAdvancedContextDelete": {
"message": "Показывать команду \"Удалить\" в контекстном меню редактора" "message": "Показывать команду \"Удалить\" в контекстном меню редактора"
}, },
@ -860,12 +828,6 @@
"optionsAdvancedExposeIframesNote": { "optionsAdvancedExposeIframesNote": {
"message": "Выставляет верхний домен сайта в каждом iframe.\nПозволяет писать iframe-specific CSS следующим образом:\nhtml[stylus-iframe$$=\"twitter.com\"] h1 { display:none }" "message": "Выставляет верхний домен сайта в каждом iframe.\nПозволяет писать iframe-specific CSS следующим образом:\nhtml[stylus-iframe$$=\"twitter.com\"] h1 { display:none }"
}, },
"optionsAdvancedExposeStyleName": {
"message": "Проставлять имя стиля"
},
"optionsAdvancedExposeStyleNameNote": {
"message": "Проставляет имя стиля внутри страницы чтобы облегчить отладку стилей в инструментах разработчика (devtools). Чтобы применить новую настройку пожалуйста обновите вкладку со страницей."
},
"optionsAdvancedNewStyleAsUsercss": { "optionsAdvancedNewStyleAsUsercss": {
"message": "Создавать стили в формате usercss" "message": "Создавать стили в формате usercss"
}, },
@ -911,9 +873,6 @@
"optionsHeading": { "optionsHeading": {
"message": "Настройки" "message": "Настройки"
}, },
"optionsIconAuto": {
"message": "В соответствии с ночным/дневным режимом"
},
"optionsIconDark": { "optionsIconDark": {
"message": "Тёмный интерфейс браузера" "message": "Тёмный интерфейс браузера"
}, },
@ -936,7 +895,7 @@
"message": "Сброс настроек" "message": "Сброс настроек"
}, },
"optionsStylusThemes": { "optionsStylusThemes": {
"message": "Нажмите иконку Stylus в верхней панели браузера на любой странице Stylus, в том числе и этой, затем нажмите «Найти стили»" "message": "Найти тему интерфейса Stylus"
}, },
"optionsSubheading": { "optionsSubheading": {
"message": "Дополнительно" "message": "Дополнительно"
@ -953,9 +912,6 @@
"optionsSyncNone": { "optionsSyncNone": {
"message": "Ничего" "message": "Ничего"
}, },
"optionsSyncPassword": {
"message": "Пароль"
},
"optionsSyncStatusConnected": { "optionsSyncStatusConnected": {
"message": "Подключено" "message": "Подключено"
}, },
@ -999,12 +955,6 @@
"optionsSyncSyncNow": { "optionsSyncSyncNow": {
"message": "Синхронизировать" "message": "Синхронизировать"
}, },
"optionsSyncUrl": {
"message": "URL адрес"
},
"optionsSyncUsername": {
"message": "Имя"
},
"optionsUpdateImportNote": { "optionsUpdateImportNote": {
"message": "После импорта базы стилей из старой версии или из Stylish запустите проверку на обновления из менеджера стилей, чтобы удостовериться в обновлении всех стилей." "message": "После импорта базы стилей из старой версии или из Stylish запустите проверку на обновления из менеджера стилей, чтобы удостовериться в обновлении всех стилей."
}, },
@ -1047,9 +997,6 @@
"popupHotkeysTooltip": { "popupHotkeysTooltip": {
"message": "Показать горячие клавиши" "message": "Показать горячие клавиши"
}, },
"popupManageSiteStyles": {
"message": "Управлять стилями сайта"
},
"popupManageTooltip": { "popupManageTooltip": {
"message": "Shift-ЛКМ или ПКМ откроет менеджер с стилями только для этого сайта." "message": "Shift-ЛКМ или ПКМ откроет менеджер с стилями только для этого сайта."
}, },
@ -1071,21 +1018,6 @@
"prefShowBadge": { "prefShowBadge": {
"message": "Показывать количество активных стилей для открытого сайта" "message": "Показывать количество активных стилей для открытого сайта"
}, },
"preferScheme": {
"message": "Ночной/дневной режим"
},
"preferSchemeAlways": {
"message": "Пока что игнорируется (стиль всегда включен), т.к. общий режим ночи/дня отключен"
},
"preferSchemeDark": {
"message": "Ночной"
},
"preferSchemeLight": {
"message": "Дневной"
},
"preferSchemeNone": {
"message": "Нет (всегда включен)"
},
"previewLabel": { "previewLabel": {
"message": "Предпросмотр" "message": "Предпросмотр"
}, },
@ -1113,6 +1045,9 @@
"readingStyles": { "readingStyles": {
"message": "Чтение стилей..." "message": "Чтение стилей..."
}, },
"reload": {
"message": "Перезагрузить расширение Stylus"
},
"replace": { "replace": {
"message": "Заменить" "message": "Заменить"
}, },
@ -1122,18 +1057,12 @@
"replaceWith": { "replaceWith": {
"message": "Заменить на" "message": "Заменить на"
}, },
"restoreTemplate": {
"message": "Восстановить шаблон по-умолчанию.\n\n(Не влияет на уже открытые страницы редактирования)"
},
"retrieveBckp": { "retrieveBckp": {
"message": "Импорт стилей" "message": "Импорт стилей"
}, },
"retrieveDropboxSync": { "retrieveDropboxSync": {
"message": "Импорт Dropbox" "message": "Импорт Dropbox"
}, },
"saveAsTemplate": {
"message": "Сохранить как шаблон"
},
"search": { "search": {
"message": "Поиск" "message": "Поиск"
}, },
@ -1173,6 +1102,9 @@
"searchResultWeeklyCount": { "searchResultWeeklyCount": {
"message": "Загрузок за неделю" "message": "Загрузок за неделю"
}, },
"searchStyleQueryHint": {
"message": "Поиск стилистических имён по падежам:\nнекоторые слова - все слова в любом порядке\n\"какая-то фраза\" - именно эта фраза без кавычек\n2020 - такой год также показывает стили, обновлённые в 2020 году"
},
"searchStylesAll": { "searchStylesAll": {
"message": "Все" "message": "Все"
}, },
@ -1206,18 +1138,12 @@
"sections": { "sections": {
"message": "Разделы" "message": "Разделы"
}, },
"settings": {
"message": "Настройки"
},
"shortcuts": { "shortcuts": {
"message": "Клавиши" "message": "Клавиши"
}, },
"shortcutsNote": { "shortcutsNote": {
"message": "Назначить клавишу" "message": "Назначить клавишу"
}, },
"shortcutsNoteFF": {
"message": "В Firefox 66+ вы можете открыть интерфейс клавиатурных сочетаний самостоятельно:\n1) правой кнопкой мыши на иконке Stylus в панели браузера, затем «Менеджер»\n(либо откройте about:addons из главного меню или нажмите Ctrl-Shift-A),\n2) на странице, которая откроется, нажмите иконку шестеренки в правом верхнем углу,\n3) выберите «Управление горячими клавишами расширений».\n\nТакже настроить клавиши можно и здесь."
},
"sortDateNewestFirst": { "sortDateNewestFirst": {
"message": "новые сверху" "message": "новые сверху"
}, },
@ -1263,30 +1189,12 @@
"styleEnabledLabel": { "styleEnabledLabel": {
"message": "Включено" "message": "Включено"
}, },
"styleExcludeLabel": {
"message": "Личный список исключенных сайтов"
},
"styleFromMozillaFormatError": { "styleFromMozillaFormatError": {
"message": "Ошибка импорта формата Mozilla" "message": "Ошибка импорта формата Mozilla"
}, },
"styleFromMozillaFormatPrompt": { "styleFromMozillaFormatPrompt": {
"message": "Вставьте содержимое стиля в формате Mozilla" "message": "Вставьте содержимое стиля в формате Mozilla"
}, },
"styleIncludeLabel": {
"message": "Личный список включенных сайтов"
},
"styleInjectionImportance": {
"message": "Переключить важность стиля"
},
"styleInjectionOrder": {
"message": "Порядок применения стилей"
},
"styleInjectionOrderHint": {
"message": "Перетащите стиль для изменения его позиции. Стили применяются последовательно в нижеуказанном порядке, так что последующий стиль может изменить эффект предыдущих."
},
"styleInjectionOrderHint_prio": {
"message": "Важные стили всегда применяются после новоустановленных стилей, чтобы иметь «последнее слово». Для изменения важности стиля нажмите на его значок."
},
"styleInstall": { "styleInstall": {
"message": "Установить \"$stylename$\" в Stylus?", "message": "Установить \"$stylename$\" в Stylus?",
"placeholders": { "placeholders": {
@ -1329,15 +1237,6 @@
"styleNotAppliedRegexpProblemTooltip": { "styleNotAppliedRegexpProblemTooltip": {
"message": "Стиль не был применён из-за некорректного regexp()" "message": "Стиль не был применён из-за некорректного regexp()"
}, },
"styleNotAppliedSchemeDark": {
"message": "Стиль активен только в ночном режиме"
},
"styleNotAppliedSchemeLight": {
"message": "Стиль активен только в дневном режиме"
},
"stylePreferSchemeLabel": {
"message": "Ночной/дневной режим"
},
"styleRegexpInvalidExplanation": { "styleRegexpInvalidExplanation": {
"message": "Некоторые 'regexp()' выражения не удалось скомпилировать." "message": "Некоторые 'regexp()' выражения не удалось скомпилировать."
}, },
@ -1347,6 +1246,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "Кол-во пропущенных разделов из-за неправильного regexp()" "message": "Кол-во пропущенных разделов из-за неправильного regexp()"
}, },
"styleRegexpTestButton": {
"message": "Тест регулярки"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "Соответствующие вкладки" "message": "Соответствующие вкладки"
}, },
@ -1368,9 +1270,6 @@
"styleSaveLabel": { "styleSaveLabel": {
"message": "Сохранить" "message": "Сохранить"
}, },
"styleSettings": {
"message": "Настройки стиля"
},
"styleToMozillaFormatHelp": { "styleToMozillaFormatHelp": {
"message": "Формат кода Mozilla можно отправлять на сайт userstyles.org и использовать в дополнении Stylish для Firefox." "message": "Формат кода Mozilla можно отправлять на сайт userstyles.org и использовать в дополнении Stylish для Firefox."
}, },
@ -1388,9 +1287,6 @@
"styleUpdateDiscardChanges": { "styleUpdateDiscardChanges": {
"message": "Стиль был изменён вне редактора. Перезагрузить?" "message": "Стиль был изменён вне редактора. Перезагрузить?"
}, },
"styleUpdateUrlLabel": {
"message": "URL адрес обновлений"
},
"stylusUnavailableForURL": { "stylusUnavailableForURL": {
"message": "Такие адреса не поддерживаются." "message": "Такие адреса не поддерживаются."
}, },
@ -1406,16 +1302,8 @@
"syncError": { "syncError": {
"message": "Сбой синхронизации" "message": "Сбой синхронизации"
}, },
"syncErrorLock": {
"message": "Хранилище данных уже занято. Доступ закрыт до $TIME$",
"placeholders": {
"time": {
"content": "$1"
}
}
},
"syncErrorRelogin": { "syncErrorRelogin": {
"message": "Ошибка синхронизации. Произведен выход из учетной записи.\n\nПопробуйте подключиться еще раз в настройках Stylus." "message": "Синхронизация не удалась.\nПопробуйте повторно войти в систему в опциях Stylus:\nсначала нажмите \"отсоединить\", затем \"подключить\"."
}, },
"syncStorageErrorSaving": { "syncStorageErrorSaving": {
"message": "Ошибка сохранения. Попробуйте уменьшить количество текста." "message": "Ошибка сохранения. Попробуйте уменьшить количество текста."
@ -1506,6 +1394,9 @@
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "Заменить шаблон по умолчанию для нового стиля в формате Usercss текущим кодом?" "message": "Заменить шаблон по умолчанию для нового стиля в формате Usercss текущим кодом?"
}, },
"usercssReplaceTemplateName": {
"message": "Пустой @name заменяет шаблон по умолчанию"
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "Место для CSS кода..." "message": "Место для CSS кода..."
}, },

View File

@ -76,15 +76,9 @@
"cm_theme": { "cm_theme": {
"message": "Тема" "message": "Тема"
}, },
"confirmDelete": {
"message": "Избриши"
},
"confirmNo": { "confirmNo": {
"message": "Не" "message": "Не"
}, },
"confirmSave": {
"message": "Сачувај"
},
"confirmStop": { "confirmStop": {
"message": "Заустави" "message": "Заустави"
}, },
@ -112,9 +106,6 @@
"disableStyleLabel": { "disableStyleLabel": {
"message": "Онемогући" "message": "Онемогући"
}, },
"editDeleteText": {
"message": "Избриши"
},
"editGotoLine": { "editGotoLine": {
"message": "Иди на ред (или line:col)" "message": "Иди на ред (или line:col)"
}, },
@ -138,11 +129,8 @@
"exportLabel": { "exportLabel": {
"message": "Извези" "message": "Извези"
}, },
"genericAdd": { "findStylesForSite": {
"message": "Додај" "message": "Пронађи још стилова за овај сајт"
},
"genericEnabledLabel": {
"message": "Омогућено"
}, },
"helpAlt": { "helpAlt": {
"message": "Помоћ" "message": "Помоћ"
@ -206,15 +194,9 @@
"openManage": { "openManage": {
"message": "Управљај инсталираним стиловима" "message": "Управљај инсталираним стиловима"
}, },
"openOptions": {
"message": "Опције"
},
"optionsHeading": { "optionsHeading": {
"message": "Опције" "message": "Опције"
}, },
"optionsSyncUrl": {
"message": "УРЛ"
},
"popupStylesFirst": { "popupStylesFirst": {
"message": "Излистај стилове пре команди у менију дугмета на алатној траци" "message": "Излистај стилове пре команди у менију дугмета на алатној траци"
}, },
@ -245,9 +227,6 @@
"sectionRemove": { "sectionRemove": {
"message": "Уклони одељак" "message": "Уклони одељак"
}, },
"sections": {
"message": "Одељци"
},
"styleBadRegexp": { "styleBadRegexp": {
"message": "Регуларни израз је неисправан." "message": "Регуларни израз је неисправан."
}, },

View File

@ -70,6 +70,9 @@
"backupButtons": { "backupButtons": {
"message": "Säkerhetskopiera" "message": "Säkerhetskopiera"
}, },
"backupMessage": {
"message": "Välj en fil eller dra och släpp till den här sidan."
},
"bckpInstStyles": { "bckpInstStyles": {
"message": "Exportera stilar" "message": "Exportera stilar"
}, },
@ -287,6 +290,12 @@
"findStyles": { "findStyles": {
"message": "Hitta stilar" "message": "Hitta stilar"
}, },
"findStylesForSite": {
"message": "Hitta fler stilar för denna webbplats"
},
"findStylesInlineTooltip": {
"message": "Visa sökresultat i det här fönstret."
},
"genericAdd": { "genericAdd": {
"message": "Lägg till" "message": "Lägg till"
}, },
@ -473,7 +482,7 @@
"message": "Nedtonade" "message": "Nedtonade"
}, },
"manageFaviconsHelp": { "manageFaviconsHelp": {
"message": "Stylus använder en extern tjänst https://icons.duckduckgo.com" "message": "Stylus använder en extern tjänst https://www.google.com/s2/favicons"
}, },
"manageFilters": { "manageFilters": {
"message": "Filter" "message": "Filter"
@ -815,9 +824,6 @@
"optionsSyncSyncNow": { "optionsSyncSyncNow": {
"message": "Synkronisera nu" "message": "Synkronisera nu"
}, },
"optionsSyncUrl": {
"message": "Webbadress"
},
"optionsUpdateImportNote": { "optionsUpdateImportNote": {
"message": "När du importerar säkerhetskopior av stilar från gammal version eller från Stylish, gör en engångskontroll för uppdateringar manuellt i stilhanteraren för att säkerställa att alla stilar uppdateras." "message": "När du importerar säkerhetskopior av stilar från gammal version eller från Stylish, gör en engångskontroll för uppdateringar manuellt i stilhanteraren för att säkerställa att alla stilar uppdateras."
}, },
@ -956,9 +962,6 @@
"sectionRestore": { "sectionRestore": {
"message": "Återställ borttagen sektion" "message": "Återställ borttagen sektion"
}, },
"sections": {
"message": "Sektioner"
},
"shortcuts": { "shortcuts": {
"message": "Genvägar" "message": "Genvägar"
}, },
@ -1058,6 +1061,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "Antal avsnitt som inte tillämpas på grund av felaktig användning av \"regexp()\"" "message": "Antal avsnitt som inte tillämpas på grund av felaktig användning av \"regexp()\""
}, },
"styleRegexpTestButton": {
"message": "RegExp-test"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "Matchande flikar" "message": "Matchande flikar"
}, },
@ -1129,9 +1135,6 @@
"unreachableFileHint": { "unreachableFileHint": {
"message": "Stylus kan endast komma åt fil:// webbadresser om du aktiverar motsvarande kryssruta för Stylus-tillägg på chrome://extensions-sidan." "message": "Stylus kan endast komma åt fil:// webbadresser om du aktiverar motsvarande kryssruta för Stylus-tillägg på chrome://extensions-sidan."
}, },
"unreachableMozSiteHintOldFF": {
"message": "Endast Firefox 59 och nyare kan konfigureras för att tillåta WebExtensions att lägga till stilelement på CSP-skyddade webbplatser som den här."
},
"unzipStyles": { "unzipStyles": {
"message": "Packar upp stilar..." "message": "Packar upp stilar..."
}, },
@ -1191,6 +1194,9 @@
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "Ersätt standardmallen för nya Usercss-stilar med den aktuella koden?" "message": "Ersätt standardmallen för nya Usercss-stilar med den aktuella koden?"
}, },
"usercssReplaceTemplateName": {
"message": "Tom @name ersätter standardmallen"
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "Lägg in kod här..." "message": "Lägg in kod här..."
}, },

View File

@ -22,12 +22,6 @@
"appliesToEverything": { "appliesToEverything": {
"message": "అన్నిటికీ" "message": "అన్నిటికీ"
}, },
"confirmDelete": {
"message": "తొలగించు"
},
"confirmSave": {
"message": "భద్రపరచు"
},
"deleteStyleConfirm": { "deleteStyleConfirm": {
"message": "మీరు నజంగానే ఈ శైలిని తొలగించాలనుకుంటున్నారా?" "message": "మీరు నజంగానే ఈ శైలిని తొలగించాలనుకుంటున్నారా?"
}, },
@ -37,18 +31,12 @@
"disableStyleLabel": { "disableStyleLabel": {
"message": "అచేతనించు" "message": "అచేతనించు"
}, },
"editDeleteText": {
"message": "తొలగించు"
},
"editStyleLabel": { "editStyleLabel": {
"message": "మార్చు" "message": "మార్చు"
}, },
"enableStyleLabel": { "enableStyleLabel": {
"message": "చేతనించు" "message": "చేతనించు"
}, },
"genericAdd": {
"message": "చేర్చు"
},
"helpAlt": { "helpAlt": {
"message": "సహాయం" "message": "సహాయం"
}, },
@ -58,9 +46,6 @@
"manageTitle": { "manageTitle": {
"message": "స్టైలిష్" "message": "స్టైలిష్"
}, },
"sections": {
"message": "విభాగాలు"
},
"styleSaveLabel": { "styleSaveLabel": {
"message": "భద్రపరచు" "message": "భద్రపరచు"
} }

View File

@ -58,6 +58,9 @@
"backupButtons": { "backupButtons": {
"message": "Yedek" "message": "Yedek"
}, },
"backupMessage": {
"message": "Bir dosya seçin veya bu sayfaya sürükleyip bırakın."
},
"bckpInstStyles": { "bckpInstStyles": {
"message": "Dışa aktar" "message": "Dışa aktar"
}, },
@ -284,6 +287,15 @@
"findStyles": { "findStyles": {
"message": "Stil bul" "message": "Stil bul"
}, },
"findStylesForSite": {
"message": "Bu site için başka stiller bul"
},
"findStylesInline": {
"message": "Hizada"
},
"findStylesInlineTooltip": {
"message": "Arama sonuçlarını bu pencerede görüntüleyin."
},
"genericAdd": { "genericAdd": {
"message": "Ekle" "message": "Ekle"
}, },
@ -414,7 +426,7 @@
"message": "Gri renkte" "message": "Gri renkte"
}, },
"manageFaviconsHelp": { "manageFaviconsHelp": {
"message": "Stylus harici bir servis kullanır https://icons.duckduckgo.com" "message": "Stylus harici bir servis kullanır https://www.google.com/s2/favicons"
}, },
"manageFilters": { "manageFilters": {
"message": "Filtreler" "message": "Filtreler"
@ -452,9 +464,6 @@
"openManage": { "openManage": {
"message": "Yüklü stilleri yönet" "message": "Yüklü stilleri yönet"
}, },
"openOptions": {
"message": "Seçenekler"
},
"openStylesManager": { "openStylesManager": {
"message": "Stil yöneticisini aç" "message": "Stil yöneticisini aç"
}, },
@ -602,9 +611,6 @@
"sectionRemove": { "sectionRemove": {
"message": "Bölümü kaldır" "message": "Bölümü kaldır"
}, },
"sections": {
"message": "Bölümler"
},
"shortcuts": { "shortcuts": {
"message": "Kısayollar" "message": "Kısayollar"
}, },
@ -658,6 +664,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "'Regexp ()' yanlış kullanımı nedeniyle uygulanmayan bölüm sayısı" "message": "'Regexp ()' yanlış kullanımı nedeniyle uygulanmayan bölüm sayısı"
}, },
"styleRegexpTestButton": {
"message": "RegExp testi"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "Eşleşen sekmeler" "message": "Eşleşen sekmeler"
}, },
@ -773,6 +782,9 @@
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "Yeni Usercss stilleri için varsayılan şablonu geçerli kodla değiştir?" "message": "Yeni Usercss stilleri için varsayılan şablonu geçerli kodla değiştir?"
}, },
"usercssReplaceTemplateName": {
"message": "Boş @name, varsayılan şablonun yerini alır"
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "Kodu buraya ekle..." "message": "Kodu buraya ekle..."
}, },

View File

@ -61,6 +61,9 @@
"backupButtons": { "backupButtons": {
"message": "Резервне копіювання" "message": "Резервне копіювання"
}, },
"backupMessage": {
"message": "Виберіть файл або перетягніть на цю сторінку."
},
"bckpInstStyles": { "bckpInstStyles": {
"message": "Експорт стилів" "message": "Експорт стилів"
}, },
@ -97,12 +100,18 @@
"disableStyleLabel": { "disableStyleLabel": {
"message": "Вимкнути" "message": "Вимкнути"
}, },
"editDeleteText": {
"message": "Видалити"
},
"findStyles": { "findStyles": {
"message": "Знайти стилі" "message": "Знайти стилі"
}, },
"findStylesForSite": {
"message": "Знайти більше стилів для цього сайту"
},
"findStylesInline": {
"message": "і показати тут"
},
"findStylesInlineTooltip": {
"message": "Показувати знайдені стилі в цьому вікні."
},
"genericAdd": { "genericAdd": {
"message": "Додати" "message": "Додати"
}, },
@ -169,20 +178,11 @@
"importReportTitle": { "importReportTitle": {
"message": "Імпорт стилів закінчено" "message": "Імпорт стилів закінчено"
}, },
"installUpdate": {
"message": "Встановити оновлення"
},
"manageFavicons": { "manageFavicons": {
"message": "Піктограми для цільових сайтів" "message": "Піктограми для цільових сайтів"
}, },
"manageFilters": {
"message": "Фільтри"
},
"manageHeading": {
"message": "Встановити Styles"
},
"manageNewUI": { "manageNewUI": {
"message": "Новий макет інтерфейсу управління користувача" "message": "Новий інтерфейс"
}, },
"meta_unknownJSONLiteral": { "meta_unknownJSONLiteral": {
"message": "Невірний JSON: $literal$не є дійсним літералом JSON", "message": "Невірний JSON: $literal$не є дійсним літералом JSON",
@ -193,13 +193,7 @@
} }
}, },
"openManage": { "openManage": {
"message": "Керування" "message": "Менеджер"
},
"openOptions": {
"message": "Налаштування"
},
"optionsHeading": {
"message": "Налаштування"
}, },
"optionsReset": { "optionsReset": {
"message": "Скидання налаштувань до значень за замовчуванням" "message": "Скидання налаштувань до значень за замовчуванням"
@ -213,39 +207,9 @@
"optionsSyncLogin": { "optionsSyncLogin": {
"message": "Логін" "message": "Логін"
}, },
"optionsSyncStatusRelogin": {
"message": "Сеанс закінчився, будь ласка, увійдіть ще раз."
},
"paginationNext": {
"message": "Наступна сторінка"
},
"paginationPrevious": {
"message": "Попередня сторінка"
},
"replace": {
"message": "Замінити"
},
"replaceAll": {
"message": "Замінити все"
},
"retrieveBckp": { "retrieveBckp": {
"message": "Імпорт стилів" "message": "Імпорт стилів"
}, },
"search": {
"message": "Пошук"
},
"searchStylesAll": {
"message": "Усі"
},
"searchStylesCode": {
"message": "CSS код"
},
"searchStylesHelp": {
"message": "</> або <Ctrl-F>клавіша фокусує поле пошуку.\nРежим за замовчуванням — це пошук у звичайному тексті для всіх термінів, розділених пробілами, у будь-якому порядку.\nТочні слова: оберніть запит у подвійні лапки, напр. <.header ~ div\">\nРегулярні вирази: включають косі риски та прапорці, напр.</body.*?\\ba\\b/i>\n«By URL» в селекторі області: знаходить стилі, які застосовуються до повністю вказаної URL-адреси, напр. https://www.example.org/\n\"Metadata\" в селектрі області: шукає в іменах, \"applies to\" специфікаторів, URL-адреси встановлення, URL-адресі оновлення та всьому блоку метаданих для стилів CSS користувача."
},
"searchStylesName": {
"message": "Назва"
},
"sectionCode": { "sectionCode": {
"message": "Код" "message": "Код"
}, },
@ -256,29 +220,14 @@
"message": "Облагородити" "message": "Облагородити"
}, },
"styleCancelEditLabel": { "styleCancelEditLabel": {
"message": "Повернутися до керування" "message": "Всі стилі"
},
"styleEnabledLabel": {
"message": "Увімкнено"
},
"stylePreferSchemeLabel": {
"message": "Темна/Світла тема"
},
"styleSaveLabel": {
"message": "Зберегти"
}, },
"syncErrorRelogin": { "syncErrorRelogin": {
"message": "Помилка синхронізації. Ви вийшли із системи. \nСпробуйте повторно увійти до системи в налаштуваннях Stylus." "message": "Помилка синхронізації.\nСпробуйте повторно ввійти в налаштування Stylus:\nнатисніть спочатку «від’єднати», а потім «підключити». "
}, },
"toggleStyle": { "toggleStyle": {
"message": "Включити/виключити стиль" "message": "Включити/виключити стиль"
}, },
"writeStyleFor": {
"message": "Створити стиль для:"
},
"writeStyleForURL": {
"message": "цей URL"
},
"zipStyles": { "zipStyles": {
"message": "Запаковування стилів ... " "message": "Запаковування стилів ... "
} }

View File

@ -1,379 +0,0 @@
{
"InaccessibleFileHint": {
"message": "Stylus không thể truy cập một số kiểu tập tin (chẳng hạn như PDF và JSON)."
},
"addStyleLabel": {
"message": "Viết bảng định kiểu mới"
},
"addStyleTitle": {
"message": "Thêm bảng định kiểu"
},
"alphaChannel": {
"message": "Độ mờ"
},
"appliesAdd": {
"message": "Thêm"
},
"appliesDisplay": {
"message": "Áp dụng với: $applies$",
"placeholders": {
"applies": {
"content": "$1"
}
}
},
"appliesDisplayTruncatedSuffix": {
"message": "và một số khác"
},
"appliesDomainOption": {
"message": "Các địa chỉ thuộc tên miền này"
},
"appliesHelp": {
"message": "Dùng tuỳ chọn \"Áp dụng với\" để giới hạn các địa chỉ cho đoạn mã này"
},
"appliesLabel": {
"message": "Áp dụng với"
},
"appliesLineWidgetLabel": {
"message": "Hiển thị thông tin \"Áp dụng với\""
},
"appliesLineWidgetWarning": {
"message": "Không hoạt động với CSS tối giản"
},
"appliesRegexpOption": {
"message": "URL khớp với biểu thức chính quy"
},
"appliesRemove": {
"message": "Xoá"
},
"appliesRemoveError": {
"message": "Không thể xoá mục \"Áp dụng với\" cuối cùng"
},
"appliesSpecify": {
"message": "Chỉ định"
},
"appliesToEverything": {
"message": "Tất cả"
},
"appliesUrlPrefixOption": {
"message": "URL bắt đầu bằng"
},
"author": {
"message": "Tác giả"
},
"backupButtons": {
"message": "Sao lưu"
},
"backupMessage": {
"message": "Để nhập tập tin sao lưu, kéo và thả nó vào trang này hoặc nhấp vào nút Nhập.\n\nĐể xuất một bản sao lưu tương thích với Stylus trước phiên bản 1.5.18, nhấp chuột phải hoặc nhấn giữ Shift khi nhấp chuột trái vào nút Xuất."
},
"bckpInstStyles": {
"message": "Xuất bảng định kiểu"
},
"checkForUpdate": {
"message": "Kiểm tra bản cập nhật mới"
},
"checkingForUpdate": {
"message": "Đang kiểm tra..."
},
"clickToUninstall": {
"message": "Nhấp để huỷ kích hoạt"
},
"cm_autoCloseBrackets": {
"message": "Tự động đóng ngoặc và nháy"
},
"cm_autoCloseBracketsTooltip": {
"message": "Tự động thêm dấu đóng tương ứng khi nhập một trong các dấu (, [, {, ' và \"."
},
"cm_autocompleteOnTyping": {
"message": "Tự động hoàn thành"
},
"cm_colorpicker": {
"message": "Bộ chọn màu cho màu CSS"
},
"cm_indentWithTabs": {
"message": "Lùi đầu dòng thông minh bằng tab"
},
"cm_lineWrapping": {
"message": "Gập dòng dài"
},
"cm_linter": {
"message": "Trình phân tích cú pháp"
},
"cm_matchHighlight": {
"message": "Làm nổi"
},
"cm_matchHighlightSelection": {
"message": "Chỉ vùng được chọn"
},
"cm_matchHighlightToken": {
"message": "Token nằm dưới con trỏ văn bản"
},
"cm_selectByTokens": {
"message": "Nhấp đúp để chọn token"
},
"cm_selectByTokensTooltip": {
"message": "Ví dụ về token: .foo-bar-2 #aabbcc 0.32 !important\nKhi tắt: Chọn từ (phân tách bằng dấu câu)."
},
"cm_smartIndent": {
"message": "Lùi đầu dòng thông minh"
},
"cm_tabSize": {
"message": "Chiều rộng tab"
},
"cm_theme": {
"message": "Chủ đề"
},
"colorpickerSwitchFormatTooltip": {
"message": "Đổi định dạng: HEX → RGB → HSL.\nNhấn giữ phím Shift khi nhấp để đảo thứ tự.\nPhím tắt: PgUp và PgDn."
},
"colorpickerTooltip": {
"message": "Mở bộ chọn màu"
},
"configOnChange": {
"message": "khi thay đổi"
},
"configOnChangeTooltip": {
"message": "Tự động lưu và áp dụng"
},
"configureStyle": {
"message": "Thiết lập"
},
"configureStyleOnHomepage": {
"message": "Thiết lập trên trang chủ"
},
"confirmCancel": {
"message": "Huỷ"
},
"confirmClose": {
"message": "Đóng"
},
"confirmDefault": {
"message": "Dùng mặc định"
},
"confirmDelete": {
"message": "Xoá"
},
"confirmDiscardChanges": {
"message": "Huỷ thay đổi?"
},
"confirmNo": {
"message": "Không"
},
"confirmSave": {
"message": "Lưu"
},
"confirmStop": {
"message": "Dừng"
},
"confirmYes": {
"message": "Có"
},
"connectingDropbox": {
"message": "Đang kết nối với Dropbox..."
},
"connectingDropboxNotAllowed": {
"message": "Tính năng kết nối với Dropbox chỉ khả dụng khi cài ứng dụng trực tiếp từ cửa hàng web"
},
"copied": {
"message": "Đã chép vào khay nhớ tạm"
},
"copy": {
"message": "Chép vào khay nhớ tạm"
},
"dateAbbrDay": {
"message": "$value$ ngày",
"placeholders": {
"value": {
"content": "$1"
}
}
},
"dateAbbrHour": {
"message": "$value$ giờ",
"placeholders": {
"value": {
"content": "$1"
}
}
},
"dateAbbrMonth": {
"message": "$value$ tháng",
"placeholders": {
"value": {
"content": "$1"
}
}
},
"dateAbbrYear": {
"message": "$value$ năm",
"placeholders": {
"value": {
"content": "$1"
}
}
},
"dateInstalled": {
"message": "Ngày cài đặt"
},
"dateUpdated": {
"message": "Ngày cập nhật"
},
"defaultTheme": {
"message": "mặc định"
},
"deleteStyleConfirm": {
"message": "Bạn có chắc chắn muốn xoá bảng định kiểu này không?"
},
"deleteStyleLabel": {
"message": "Xoá"
},
"disableAllStyles": {
"message": "Tắt tất cả bảng định kiểu"
},
"disableAllStylesOff": {
"message": "Bật tất cả bảng định kiểu"
},
"disableStyleLabel": {
"message": "Vô hiệu hoá"
},
"draftAction": {
"message": "Chọn \"Có\" để tải bản nháp hoặc \"Không\" để xoá nó đi."
},
"editDeleteText": {
"message": "Xoá"
},
"editGotoLine": {
"message": "Đi đến dòng (hoặc dòng:cột)"
},
"editStyleHeading": {
"message": "Sửa bảng định kiểu"
},
"editStyleLabel": {
"message": "Sửa"
},
"editStyleTitle": {
"message": "Sửa bảng định kiểu $stylename$",
"placeholders": {
"stylename": {
"content": "$1"
}
}
},
"editorSettings": {
"message": "Cài đặt trình soạn thảo"
},
"enableStyleLabel": {
"message": "Kích hoạt"
},
"exportCompatible": {
"message": "Xuất (chế độ tương thích)"
},
"exportLabel": {
"message": "Xuất"
},
"exportSavedSuccess": {
"message": "Lưu thành công"
},
"externalFeedback": {
"message": "Phản hồi"
},
"externalHomepage": {
"message": "Trang chủ"
},
"externalLink": {
"message": "Liên kết ngoài"
},
"externalSupport": {
"message": "Ủng hộ"
},
"genericAdd": {
"message": "Thêm"
},
"genericDescription": {
"message": "Mô tả"
},
"genericDisabledLabel": {
"message": "Vô hiệu hoá"
},
"genericEnabledLabel": {
"message": "Kích hoạt"
},
"genericError": {
"message": "Lỗi"
},
"genericHistoryLabel": {
"message": "Lịch sử"
},
"genericNext": {
"message": "Sau"
},
"genericPrevious": {
"message": "Trước"
},
"genericResetLabel": {
"message": "Đặt lại"
},
"genericSavedMessage": {
"message": "Đã lưu"
},
"genericTest": {
"message": "Thứ"
},
"genericTitle": {
"message": "Tiêu đề"
},
"genericUnknown": {
"message": "Không xác định"
},
"helpAlt": {
"message": "Trợ giúp"
},
"importLabel": {
"message": "Nhập"
},
"importReportLegendAdded": {
"message": "đã thêm"
},
"importReportLegendIdentical": {
"message": "Đã bỏ qua các tệp trùng lặp"
},
"importReportLegendInvalid": {
"message": "Đã bỏ qua các tệp không hợp lệ"
},
"importReportLegendUpdatedBoth": {
"message": "đã cập nhật siêu thông tin và mã"
},
"importReportLegendUpdatedCode": {
"message": "đã cập nhật mã"
},
"importReportLegendUpdatedMeta": {
"message": "đã cập nhật siêu thông tin"
},
"importReportTitle": {
"message": "Đã nhập xong"
},
"installUpdateFromLabel": {
"message": "Kiểm tra bản cập nhật mới"
},
"license": {
"message": "Giấy phép"
},
"linterCSSLintIncompatible": {
"message": "CSSLint không hỗ trợ bộ tiền xử lý $preprocessorname$",
"placeholders": {
"preprocessorname": {
"content": "$1"
}
}
},
"linterJSONError": {
"message": "Định dạng JSON không hợp lệ"
},
"styleEnabledLabel": {
"message": "Kích hoạt"
},
"styleSaveLabel": {
"message": "Lưu"
}
}

View File

@ -71,7 +71,7 @@
"message": "备份" "message": "备份"
}, },
"backupMessage": { "backupMessage": {
"message": "选择/拖拽 JSON 备份文件到本页面来导入备份。\n\n若要导出 Stylus V1.5.18 之前的兼容备份请右击或Shift+左击「导出」按钮。" "message": "拖拽JSON备份文件到本页面也可导入。"
}, },
"bckpInstStyles": { "bckpInstStyles": {
"message": "导出所有样式" "message": "导出所有样式"
@ -270,17 +270,6 @@
"disableStyleLabel": { "disableStyleLabel": {
"message": "禁用" "message": "禁用"
}, },
"draftAction": {
"message": "选择“是”以加载此草稿,或“否”以丢弃它。"
},
"draftTitle": {
"message": "恢复 $date$ 个小时前的草稿",
"placeholders": {
"date": {
"content": "$1"
}
}
},
"dragDropMessage": { "dragDropMessage": {
"message": "拖放JSON备份文件到管理器页面即可导入!" "message": "拖放JSON备份文件到管理器页面即可导入!"
}, },
@ -307,9 +296,6 @@
} }
} }
}, },
"editorSettings": {
"message": "编辑器设置"
},
"enableStyleLabel": { "enableStyleLabel": {
"message": "启用" "message": "启用"
}, },
@ -319,9 +305,6 @@
"excludeStyleByUrlLabel": { "excludeStyleByUrlLabel": {
"message": "排除当前链接" "message": "排除当前链接"
}, },
"exportCompatible": {
"message": "导出(兼容模式)"
},
"exportLabel": { "exportLabel": {
"message": "导出" "message": "导出"
}, },
@ -360,15 +343,21 @@
"findStyles": { "findStyles": {
"message": "查找样式" "message": "查找样式"
}, },
"findStylesForSite": {
"message": "查找该域名的在线样式"
},
"findStylesInline": {
"message": "嵌入此页"
},
"findStylesInlineTooltip": {
"message": "将搜索结果嵌入到此页面显示"
},
"genericAdd": { "genericAdd": {
"message": "添加" "message": "添加"
}, },
"genericClone": { "genericClone": {
"message": "创建副本" "message": "创建副本"
}, },
"genericDescription": {
"message": "描述"
},
"genericDisabledLabel": { "genericDisabledLabel": {
"message": "禁用" "message": "禁用"
}, },
@ -393,9 +382,6 @@
"genericSavedMessage": { "genericSavedMessage": {
"message": "已保存" "message": "已保存"
}, },
"genericTest": {
"message": "测试"
},
"genericTitle": { "genericTitle": {
"message": "标题" "message": "标题"
}, },
@ -405,9 +391,6 @@
"gettingStyles": { "gettingStyles": {
"message": "正在获取所有样式..." "message": "正在获取所有样式..."
}, },
"headerResizerHint": {
"message": "仅在此类 编辑器/管理器/安装器 UI , 按住 Shift 可调整大小"
},
"helpAlt": { "helpAlt": {
"message": "帮助" "message": "帮助"
}, },
@ -503,18 +486,9 @@
"linkGetHelp": { "linkGetHelp": {
"message": "帮助" "message": "帮助"
}, },
"linkGetShareStyles": {
"message": "获取|分享 样式"
},
"linkGetShareStylesInfo": {
"message": "由社区驱动的新站点 userstyles.world 是由 userstyle 作者创建的,目的是取代 userstyles.org该站点在过去一年中缓慢且反应迟钝以至于许多作者停止更新他们的样式。"
},
"linkGetStyles": { "linkGetStyles": {
"message": "获取样式" "message": "获取样式"
}, },
"linkGetStylesInfo": {
"message": "该存档站点由 userstyle 社区成员创建,约每天更新一次其内容,用于备份缓慢且无响应的 userstyles.org。 "
},
"linkTranslate": { "linkTranslate": {
"message": "翻译" "message": "翻译"
}, },
@ -582,7 +556,7 @@
"message": "显示为灰色图标" "message": "显示为灰色图标"
}, },
"manageFaviconsHelp": { "manageFaviconsHelp": {
"message": "Stylus 使用外部服务 https://icons.duckduckgo.com 来获取图标" "message": "Stylus 使用外部服务 https://www.google.com/s2/favicons 来获取图标"
}, },
"manageFilters": { "manageFilters": {
"message": "过滤器" "message": "过滤器"
@ -623,6 +597,9 @@
"manageOnlyUsercss": { "manageOnlyUsercss": {
"message": "只显示 UserCSS" "message": "只显示 UserCSS"
}, },
"manageTitle": {
"message": "Stylus管理器"
},
"menuShowBadge": { "menuShowBadge": {
"message": "计数器角标" "message": "计数器角标"
}, },
@ -788,17 +765,6 @@
} }
} }
}, },
"meta_unknownMetaTypo": {
"message": "可能的 @$keyOk$ ? 未知元数据 @$keyErr$",
"placeholders": {
"keyErr": {
"content": "$1"
},
"keyOk": {
"content": "$2"
}
}
},
"meta_unknownPreprocessor": { "meta_unknownPreprocessor": {
"message": "未知的预处理器 @preprocessor$preprocessor$", "message": "未知的预处理器 @preprocessor$preprocessor$",
"placeholders": { "placeholders": {
@ -842,15 +808,6 @@
"optionsAdvanced": { "optionsAdvanced": {
"message": "高级设置" "message": "高级设置"
}, },
"optionsAdvancedAutoSwitchSchemeBySystem": {
"message": "按系统偏好设置"
},
"optionsAdvancedAutoSwitchSchemeByTime": {
"message": "按夜间时间"
},
"optionsAdvancedAutoSwitchSchemeNever": {
"message": "已停用。樣式中的深色/淺色設定會被忽略。"
},
"optionsAdvancedContextDelete": { "optionsAdvancedContextDelete": {
"message": "向编辑器右键菜单添加“删除”" "message": "向编辑器右键菜单添加“删除”"
}, },
@ -860,12 +817,6 @@
"optionsAdvancedExposeIframesNote": { "optionsAdvancedExposeIframesNote": {
"message": "给每个iframe内嵌框架的html注入 stylus-iframe=\"父域名hostname\" 属性(值)\n\n用途: 用作iframe选择器来一键确定 iframe 父窗(window.top) 页面 的唯一选择器.\n\n示例 html[stylus-iframe] 或 html[stylus-iframe$=\"twitter.com\"] h1 {...}\n\n详见源码github.com/openstyles/stylus/blob/master/content/apply.js#L270" "message": "给每个iframe内嵌框架的html注入 stylus-iframe=\"父域名hostname\" 属性(值)\n\n用途: 用作iframe选择器来一键确定 iframe 父窗(window.top) 页面 的唯一选择器.\n\n示例 html[stylus-iframe] 或 html[stylus-iframe$=\"twitter.com\"] h1 {...}\n\n详见源码github.com/openstyles/stylus/blob/master/content/apply.js#L270"
}, },
"optionsAdvancedExposeStyleName": {
"message": "暴露样式名称"
},
"optionsAdvancedExposeStyleNameNote": {
"message": "在页面中暴露样式名称以方便在 DevTools 中调试样式。请重新加载标签页以应用新设置。"
},
"optionsAdvancedNewStyleAsUsercss": { "optionsAdvancedNewStyleAsUsercss": {
"message": "将新样式的格式设为UserCSS" "message": "将新样式的格式设为UserCSS"
}, },
@ -911,9 +862,6 @@
"optionsHeading": { "optionsHeading": {
"message": "选项" "message": "选项"
}, },
"optionsIconAuto": {
"message": "符合深色/淺色模式"
},
"optionsIconDark": { "optionsIconDark": {
"message": "高对比度暗色图标" "message": "高对比度暗色图标"
}, },
@ -936,7 +884,7 @@
"message": "恢复默认值" "message": "恢复默认值"
}, },
"optionsStylusThemes": { "optionsStylusThemes": {
"message": "點擊任何 Stylus 頁面(包含這個)的瀏覽器工具列中的 Stylus 圖示,然後點擊「尋找樣式」" "message": "查找 Stylus UI 主题ᐝ"
}, },
"optionsSubheading": { "optionsSubheading": {
"message": "附加选项" "message": "附加选项"
@ -953,9 +901,6 @@
"optionsSyncNone": { "optionsSyncNone": {
"message": "无" "message": "无"
}, },
"optionsSyncPassword": {
"message": "密码"
},
"optionsSyncStatusConnected": { "optionsSyncStatusConnected": {
"message": "已连接" "message": "已连接"
}, },
@ -990,21 +935,12 @@
} }
} }
}, },
"optionsSyncStatusRelogin": {
"message": "工作階段已過期,請再次登入。"
},
"optionsSyncStatusSyncing": { "optionsSyncStatusSyncing": {
"message": "同步中..." "message": "同步中..."
}, },
"optionsSyncSyncNow": { "optionsSyncSyncNow": {
"message": "现在同步" "message": "现在同步"
}, },
"optionsSyncUrl": {
"message": "URL "
},
"optionsSyncUsername": {
"message": "用户名"
},
"optionsUpdateImportNote": { "optionsUpdateImportNote": {
"message": "从旧版的 Stylus 或 Stylish 中导入备份样式时,\n请手动检测升级一次以确保所有样式都可更新到最新版本。" "message": "从旧版的 Stylus 或 Stylish 中导入备份样式时,\n请手动检测升级一次以确保所有样式都可更新到最新版本。"
}, },
@ -1047,9 +983,6 @@
"popupHotkeysTooltip": { "popupHotkeysTooltip": {
"message": "查看Popup列表快捷键" "message": "查看Popup列表快捷键"
}, },
"popupManageSiteStyles": {
"message": "管理网站样式"
},
"popupManageTooltip": { "popupManageTooltip": {
"message": "右击 || Shift+左击: 打开管理器且筛选当前URL(不含iframe)" "message": "右击 || Shift+左击: 打开管理器且筛选当前URL(不含iframe)"
}, },
@ -1071,50 +1004,17 @@
"prefShowBadge": { "prefShowBadge": {
"message": "计数器角标 (或图标右键)" "message": "计数器角标 (或图标右键)"
}, },
"preferScheme": {
"message": "深色/淺色模式偏好設定"
},
"preferSchemeAlways": {
"message": "目前被忽略(樣式一律套用),因為全域深色/淺色模式已被停用"
},
"preferSchemeDark": {
"message": "深色"
},
"preferSchemeLight": {
"message": "淺色"
},
"preferSchemeNone": {
"message": "無(一律套用)"
},
"previewLabel": { "previewLabel": {
"message": "实时预览" "message": "实时预览"
}, },
"previewTooltip": { "previewTooltip": {
"message": "无需保存即可临时预览样式效果" "message": "无需保存即可临时预览样式效果"
}, },
"publish": {
"message": "发布"
},
"publishPush": {
"message": "发布更新"
},
"publishReconnect": {
"message": "尝试断开连接然后再次发布"
},
"publishRetry": {
"message": "Stylus 仍在尝试发布此样式,但如果您没有看到身份验证活动或弹出窗口,您可以重试, 现在重试 "
},
"publishStyle": {
"message": "发布样式"
},
"publishUsw": {
"message": "使用 <userstyles.world>"
},
"readingStyles": { "readingStyles": {
"message": "正在读取样式..." "message": "正在读取样式..."
}, },
"reload": { "reload": {
"message": "重启" "message": "重启 Stylus"
}, },
"replace": { "replace": {
"message": "替换" "message": "替换"
@ -1125,18 +1025,12 @@
"replaceWith": { "replaceWith": {
"message": "替换为" "message": "替换为"
}, },
"restoreTemplate": {
"message": "還原預設範本。\n\n不會變更目前開啟的編輯器頁面。"
},
"retrieveBckp": { "retrieveBckp": {
"message": "导入所有样式" "message": "导入所有样式"
}, },
"retrieveDropboxSync": { "retrieveDropboxSync": {
"message": "从 Dropbox 导入" "message": "从 Dropbox 导入"
}, },
"saveAsTemplate": {
"message": "另存为模板"
},
"search": { "search": {
"message": "搜索" "message": "搜索"
}, },
@ -1161,12 +1055,6 @@
"searchResultNoneFound": { "searchResultNoneFound": {
"message": "没有找到与此页面相关的样式。" "message": "没有找到与此页面相关的样式。"
}, },
"searchResultNotMatching": {
"message": "样式已安装但不适于当前 URL"
},
"searchResultNotMatchingNote": {
"message": "尝试请求该用户样式的作者添加 URL。\n\n您也可以在管理器中打开样式自己编辑\n但请注意这会禁用此样式的自动更新。"
},
"searchResultRating": { "searchResultRating": {
"message": "评价" "message": "评价"
}, },
@ -1212,18 +1100,12 @@
"sections": { "sections": {
"message": "章节" "message": "章节"
}, },
"settings": {
"message": "设置"
},
"shortcuts": { "shortcuts": {
"message": "快捷键" "message": "快捷键"
}, },
"shortcutsNote": { "shortcutsNote": {
"message": "设置快捷键" "message": "设置快捷键"
}, },
"shortcutsNoteFF": {
"message": "在 Firefox 66 或更新的版本中,您可以手動開啟內建的快捷鍵使用者介面:\n1) 右鍵點擊工具列中的 Stylus 圖示並選擇「管理」\n或是透過主選單或 Ctrl-Shift-A 開啟 about:addons\n2) 在開啟的頁面中點擊右上角的齒輪圖示,\n3) 選擇「管理擴充套件快捷鍵」。\n\n您也可以在此自訂快捷鍵。"
},
"sortDateNewestFirst": { "sortDateNewestFirst": {
"message": "最新的优先" "message": "最新的优先"
}, },
@ -1269,30 +1151,12 @@
"styleEnabledLabel": { "styleEnabledLabel": {
"message": "启用" "message": "启用"
}, },
"styleExcludeLabel": {
"message": "自定义排除网站"
},
"styleFromMozillaFormatError": { "styleFromMozillaFormatError": {
"message": "导入 Mozilla 格式失败" "message": "导入 Mozilla 格式失败"
}, },
"styleFromMozillaFormatPrompt": { "styleFromMozillaFormatPrompt": {
"message": "粘贴 Mozilla 格式代码" "message": "粘贴 Mozilla 格式代码"
}, },
"styleIncludeLabel": {
"message": "自定义包括网站"
},
"styleInjectionImportance": {
"message": "切换样式的优先级"
},
"styleInjectionOrder": {
"message": "樣式注入順序"
},
"styleInjectionOrderHint": {
"message": "拖曳樣式可變更其位置。樣式按下列順序注入,所以清單下方的樣式可覆寫較早樣式。"
},
"styleInjectionOrderHint_prio": {
"message": "下面列出的重要样式始终是最后注入的,因此它们可以覆盖任何新安装的样式。单击样式的标记以切换其重要性。"
},
"styleInstall": { "styleInstall": {
"message": "要将“$stylename$”安装到 Stylus 中吗?", "message": "要将“$stylename$”安装到 Stylus 中吗?",
"placeholders": { "placeholders": {
@ -1329,21 +1193,9 @@
"styleMozillaFormatHeading": { "styleMozillaFormatHeading": {
"message": "Mozilla 格式" "message": "Mozilla 格式"
}, },
"styleName": {
"message": "樣式名稱"
},
"styleNotAppliedRegexpProblemTooltip": { "styleNotAppliedRegexpProblemTooltip": {
"message": "正则表达式错误,样式无法正常运行" "message": "正则表达式错误,样式无法正常运行"
}, },
"styleNotAppliedSchemeDark": {
"message": "此样式仅在深色模式下应用"
},
"styleNotAppliedSchemeLight": {
"message": "此样式仅在浅色模式下应用"
},
"stylePreferSchemeLabel": {
"message": "深色/浅色模式"
},
"styleRegexpInvalidExplanation": { "styleRegexpInvalidExplanation": {
"message": "部分正则表达式无法生效。" "message": "部分正则表达式无法生效。"
}, },
@ -1353,6 +1205,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "多个部分代码无法正常处理正则表达式" "message": "多个部分代码无法正常处理正则表达式"
}, },
"styleRegexpTestButton": {
"message": "正则测试"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "匹配到标签页的正则" "message": "匹配到标签页的正则"
}, },
@ -1374,9 +1229,6 @@
"styleSaveLabel": { "styleSaveLabel": {
"message": "保存" "message": "保存"
}, },
"styleSettings": {
"message": "样式设置"
},
"styleToMozillaFormatHelp": { "styleToMozillaFormatHelp": {
"message": "导入 FireFox 格式即 @-moz-document ...的 CSS 代码后,会自动转换成 Stylus 使用的分段式 CSS 代码。\n反过来分段式的 CSS 也可以导出为 FireFox 格式。\n需要注意的是如果你要向 userstyles.org 提交你的代码,则必须使用 FireFox 格式。\n\n导入快捷键: 剪贴板含有 @-moz-document ....代码,则可以直接在编辑器里 Ctrl+V 会自动弹出导入对话框" "message": "导入 FireFox 格式即 @-moz-document ...的 CSS 代码后,会自动转换成 Stylus 使用的分段式 CSS 代码。\n反过来分段式的 CSS 也可以导出为 FireFox 格式。\n需要注意的是如果你要向 userstyles.org 提交你的代码,则必须使用 FireFox 格式。\n\n导入快捷键: 剪贴板含有 @-moz-document ....代码,则可以直接在编辑器里 Ctrl+V 会自动弹出导入对话框"
}, },
@ -1394,9 +1246,6 @@
"styleUpdateDiscardChanges": { "styleUpdateDiscardChanges": {
"message": "样式已经在编辑器外被修改。需要重新加载样式吗?" "message": "样式已经在编辑器外被修改。需要重新加载样式吗?"
}, },
"styleUpdateUrlLabel": {
"message": "更新 URL"
},
"stylusUnavailableForURL": { "stylusUnavailableForURL": {
"message": "Stylus 无法介入到此类页面" "message": "Stylus 无法介入到此类页面"
}, },
@ -1409,20 +1258,6 @@
"syncDropboxStyles": { "syncDropboxStyles": {
"message": "导出至 Dropbox" "message": "导出至 Dropbox"
}, },
"syncError": {
"message": "同步失敗"
},
"syncErrorLock": {
"message": "数据库已在使用中。锁定将在 $TIME$ 过期",
"placeholders": {
"time": {
"content": "$1"
}
}
},
"syncErrorRelogin": {
"message": "同步失敗。您已被登出。\n嘗試在 Stylus 選項中重新登入。"
},
"syncStorageErrorSaving": { "syncStorageErrorSaving": {
"message": "不能保存该值,请尝试减少文本数量。" "message": "不能保存该值,请尝试减少文本数量。"
}, },
@ -1447,12 +1282,6 @@
"unreachableFileHint": { "unreachableFileHint": {
"message": "! Stylus 无法介入到官方商店页面 !\n若是文件页面 或 小号无痕页面 请检查:\n1) 右键 - Stylus图标 并点击-\"管理扩展程序\"\n2) 勾选 - \"允许访问文件网址\" 以在 file:// 工作\n3) 勾选 - \"在无痕模式下启用\" 以在无痕页面和小号标签页工作 (有的浏览器带有小号功能、如CentBrowser)" "message": "! Stylus 无法介入到官方商店页面 !\n若是文件页面 或 小号无痕页面 请检查:\n1) 右键 - Stylus图标 并点击-\"管理扩展程序\"\n2) 勾选 - \"允许访问文件网址\" 以在 file:// 工作\n3) 勾选 - \"在无痕模式下启用\" 以在无痕页面和小号标签页工作 (有的浏览器带有小号功能、如CentBrowser)"
}, },
"unreachableMozSiteHint": {
"message": "在 Firefox ⩾60 版本里, 你需要在 <about:config> 里移除 extensions.webextensions.restrictedDomains"
},
"unreachableMozSiteHintOldFF": {
"message": "仅 Firefox 59 或更新的版本才能让你设置 WebExtensions 在例如这样一个有 CSP 保护的页面上新增样式。"
},
"unzipStyles": { "unzipStyles": {
"message": "正在解压样式..." "message": "正在解压样式..."
}, },
@ -1512,6 +1341,9 @@
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "使用当前的 UserStyle 替换为新的UserCSS默认模板 ?" "message": "使用当前的 UserStyle 替换为新的UserCSS默认模板 ?"
}, },
"usercssReplaceTemplateName": {
"message": "该赋值为空的保存可设置默认模板"
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "在此插入代码..." "message": "在此插入代码..."
}, },

View File

@ -12,7 +12,7 @@
"message": "透明度" "message": "透明度"
}, },
"appliesAdd": { "appliesAdd": {
"message": "添加" "message": "添加部分"
}, },
"appliesDisplay": { "appliesDisplay": {
"message": "应用于:$applies$", "message": "应用于:$applies$",
@ -35,7 +35,7 @@
"message": "应用于:" "message": "应用于:"
}, },
"appliesLineWidgetLabel": { "appliesLineWidgetLabel": {
"message": "显示「应用于」信息" "message": "显示应用于部件"
}, },
"appliesLineWidgetWarning": { "appliesLineWidgetWarning": {
"message": "对经过压缩的 CSS 无效" "message": "对经过压缩的 CSS 无效"
@ -71,7 +71,7 @@
"message": "备份" "message": "备份"
}, },
"backupMessage": { "backupMessage": {
"message": "选择/拖拽 JSON 备份文件到本页面来导入备份。\n\n若要导出 Stylus V1.5.18 之前的兼容备份请右击或Shift+左击「导出」按钮。" "message": "选择备份文件,或将 JSON 备份文件拖放到本页面,即可导入备份。"
}, },
"bckpInstStyles": { "bckpInstStyles": {
"message": "导出所有样式" "message": "导出所有样式"
@ -259,33 +259,19 @@
"message": "删除" "message": "删除"
}, },
"description": { "description": {
"message": "Stylus 是一个调整网页外观的用户样式管理器。它可让您轻松为许多热门网站安装主题和皮肤。" "message": "Stylus 是一个调整网页外观的用户样式管理器。它可让您轻松为许多热门网站网站安装主题和皮肤。"
}, },
"disableAllStyles": { "disableAllStyles": {
"message": "禁用所有样式" "message": "禁用所有样式"
}, },
"disableAllStylesOff": {
"message": "已禁用样式"
},
"disableStyleLabel": { "disableStyleLabel": {
"message": "禁用" "message": "禁用"
}, },
"draftAction": {
"message": "选择“是”以加载此草稿,或“否”以丢弃它。"
},
"draftTitle": {
"message": "恢复 $date$ 个小时前的草稿",
"placeholders": {
"date": {
"content": "$1"
}
}
},
"dragDropMessage": { "dragDropMessage": {
"message": "把 JSON 备份文件拖放到该页面任意位置即可导入" "message": "把 JSON 备份文件拖放到该页面任意位置即可导入"
}, },
"dragDropUsercssTabstrip": { "dragDropUsercssTabstrip": {
"message": "要安装文件,就将其放在标签页条(显示标签页标题的区域)上。" "message": "要安装文件,就将其放在选项卡条(显示选项卡标题的区域)上。"
}, },
"editDeleteText": { "editDeleteText": {
"message": "删除" "message": "删除"
@ -307,9 +293,6 @@
} }
} }
}, },
"editorSettings": {
"message": "编辑器设置"
},
"enableStyleLabel": { "enableStyleLabel": {
"message": "启用" "message": "启用"
}, },
@ -319,9 +302,6 @@
"excludeStyleByUrlLabel": { "excludeStyleByUrlLabel": {
"message": "排除当前链接" "message": "排除当前链接"
}, },
"exportCompatible": {
"message": "导出(兼容模式)"
},
"exportLabel": { "exportLabel": {
"message": "导出" "message": "导出"
}, },
@ -344,7 +324,7 @@
"message": "UserCSS 文档" "message": "UserCSS 文档"
}, },
"filteredStyles": { "filteredStyles": {
"message": "已显示 $numShown$ 个,共 $numTotal$ 个", "message": "共 $numTotal$ 个,已显示 $numShown$ 个",
"placeholders": { "placeholders": {
"numShown": { "numShown": {
"content": "$1" "content": "$1"
@ -360,6 +340,15 @@
"findStyles": { "findStyles": {
"message": "查找更多样式" "message": "查找更多样式"
}, },
"findStylesForSite": {
"message": "查找适合此网站的更多样式"
},
"findStylesInline": {
"message": "嵌入到此页面"
},
"findStylesInlineTooltip": {
"message": "在此弹窗内显示搜索结果。"
},
"genericAdd": { "genericAdd": {
"message": "添加" "message": "添加"
}, },
@ -393,12 +382,6 @@
"genericSavedMessage": { "genericSavedMessage": {
"message": "已保存" "message": "已保存"
}, },
"genericSize": {
"message": "大小"
},
"genericTest": {
"message": "测试"
},
"genericTitle": { "genericTitle": {
"message": "标题" "message": "标题"
}, },
@ -408,9 +391,6 @@
"gettingStyles": { "gettingStyles": {
"message": "正在获取所有样式..." "message": "正在获取所有样式..."
}, },
"headerResizerHint": {
"message": "仅在此类 编辑器/管理器/安装器 UI , 按住 Shift 可调整大小"
},
"helpAlt": { "helpAlt": {
"message": "帮助" "message": "帮助"
}, },
@ -510,13 +490,13 @@
"message": "获取|分享 样式" "message": "获取|分享 样式"
}, },
"linkGetShareStylesInfo": { "linkGetShareStylesInfo": {
"message": "由社区驱动的新站点 userstyles.world 是用户样式的作者们创建的,目的是取代 userstyles.org。userstyles.org 在过去一年中运行缓慢且反应迟钝,以至于许多作者都不再更新他们的样式。" "message": "由社区驱动的新站点 userstyles.world 是由 userstyle 作者创建的,目的是取代 userstyles.org该站点在过去一年中缓慢且反应迟钝以至于许多作者停止更新他们的样式。"
}, },
"linkGetStyles": { "linkGetStyles": {
"message": "获取样式" "message": "获取样式"
}, },
"linkGetStylesInfo": { "linkGetStylesInfo": {
"message": "该存档站点是一位用户样式社区的成员创建的,约每天更新一次其内容,用于备份运行缓慢且反应迟钝的 userstyles.org。" "message": "该存档站点由 userstyle 社区成员创建,约每天更新一次其内容,用于备份缓慢且无响应的 userstyles.org。 "
}, },
"linkTranslate": { "linkTranslate": {
"message": "翻译" "message": "翻译"
@ -570,22 +550,22 @@
"message": "查看文件时发生错误" "message": "查看文件时发生错误"
}, },
"liveReloadInstallHint": { "liveReloadInstallHint": {
"message": "保持此标签页为打开状态,以便在外部更改时自动更新样式。" "message": "保持此选项卡为打开状态,将在外部更改后自动更新样式。"
}, },
"liveReloadInstallHintFF": { "liveReloadInstallHintFF": {
"message": "保持此标签页和原始标签页处于打开状态,以便在外部更改时自动更新样式。" "message": "保持此选项卡和原始选项卡处于打开状态,将在外部更改时自动重新更新样式。"
}, },
"liveReloadLabel": { "liveReloadLabel": {
"message": "动态刷新" "message": "动态刷新"
}, },
"manageFavicons": { "manageFavicons": {
"message": "显示「应用于」列的网站图标favicon" "message": "显示 \"应用于\" 的favicon图标"
}, },
"manageFaviconsGray": { "manageFaviconsGray": {
"message": "显示为灰色图标" "message": "显示为灰色图标"
}, },
"manageFaviconsHelp": { "manageFaviconsHelp": {
"message": "Stylus 使用外部服务 https://icons.duckduckgo.com 来获取图标" "message": "Stylus 使用外部服务 https://www.google.com/s2/favicons 来获取图标"
}, },
"manageFilters": { "manageFilters": {
"message": "过滤器" "message": "过滤器"
@ -845,15 +825,6 @@
"optionsAdvanced": { "optionsAdvanced": {
"message": "高级设置" "message": "高级设置"
}, },
"optionsAdvancedAutoSwitchSchemeBySystem": {
"message": "按系统偏好设置"
},
"optionsAdvancedAutoSwitchSchemeByTime": {
"message": "按夜间时间"
},
"optionsAdvancedAutoSwitchSchemeNever": {
"message": "停用。忽略样式的深色/浅色模式设置。"
},
"optionsAdvancedContextDelete": { "optionsAdvancedContextDelete": {
"message": "向编辑器右键菜单添加“删除”" "message": "向编辑器右键菜单添加“删除”"
}, },
@ -863,12 +834,6 @@
"optionsAdvancedExposeIframesNote": { "optionsAdvancedExposeIframesNote": {
"message": "给每个iframe框架的html注入window.top父域名的内联属性(值)\n即 html[stylus-iframe=\"hostname\"] \n\n用途: 确定或排除 iframe选择器以避免伤及无辜.\nhtml:not([stylus-iframe]) {...}\nhtml[stylus-iframe] 或 html[stylus-iframe$=\"twitter.com\"] h1 {...}\n\ngithub.com/openstyles/stylus/blob/master/content/apply.js#L270" "message": "给每个iframe框架的html注入window.top父域名的内联属性(值)\n即 html[stylus-iframe=\"hostname\"] \n\n用途: 确定或排除 iframe选择器以避免伤及无辜.\nhtml:not([stylus-iframe]) {...}\nhtml[stylus-iframe] 或 html[stylus-iframe$=\"twitter.com\"] h1 {...}\n\ngithub.com/openstyles/stylus/blob/master/content/apply.js#L270"
}, },
"optionsAdvancedExposeStyleName": {
"message": "暴露样式名称"
},
"optionsAdvancedExposeStyleNameNote": {
"message": "在页面中暴露样式名称以方便在 DevTools 中调试样式。请重新加载标签页以应用新设置。"
},
"optionsAdvancedNewStyleAsUsercss": { "optionsAdvancedNewStyleAsUsercss": {
"message": "将新样式的格式设为 UserCSS" "message": "将新样式的格式设为 UserCSS"
}, },
@ -902,6 +867,9 @@
"optionsCustomizeIcon": { "optionsCustomizeIcon": {
"message": "工具栏图标风格" "message": "工具栏图标风格"
}, },
"optionsCustomizePopup": {
"message": "Popup "
},
"optionsCustomizeSync": { "optionsCustomizeSync": {
"message": "同步到云端" "message": "同步到云端"
}, },
@ -911,14 +879,11 @@
"optionsHeading": { "optionsHeading": {
"message": "选项" "message": "选项"
}, },
"optionsIconAuto": {
"message": "跟随深色/浅色模式"
},
"optionsIconDark": { "optionsIconDark": {
"message": "深色浏览器主题" "message": "高对比度暗色图标"
}, },
"optionsIconLight": { "optionsIconLight": {
"message": "浅色浏览器主题" "message": "低对比度亮色图标"
}, },
"optionsOpen": { "optionsOpen": {
"message": "打开" "message": "打开"
@ -936,7 +901,7 @@
"message": "恢复默认值" "message": "恢复默认值"
}, },
"optionsStylusThemes": { "optionsStylusThemes": {
"message": "在任意 Stylus 页面(包括这个)点击浏览器工具栏的 Stylus 图标,然后点击「寻找样式」" "message": "查找 Stylus UI 主题ᐝ"
}, },
"optionsSubheading": { "optionsSubheading": {
"message": "附加选项" "message": "附加选项"
@ -953,9 +918,6 @@
"optionsSyncNone": { "optionsSyncNone": {
"message": "无" "message": "无"
}, },
"optionsSyncPassword": {
"message": "密码"
},
"optionsSyncStatusConnected": { "optionsSyncStatusConnected": {
"message": "已连接" "message": "已连接"
}, },
@ -969,7 +931,7 @@
"message": "正在断开连接..." "message": "正在断开连接..."
}, },
"optionsSyncStatusPull": { "optionsSyncStatusPull": {
"message": "正在拉取样式 $loaded$ / $total$", "message": "正在获取样式 $loaded$ 中的 $total$",
"placeholders": { "placeholders": {
"loaded": { "loaded": {
"content": "$1" "content": "$1"
@ -980,7 +942,7 @@
} }
}, },
"optionsSyncStatusPush": { "optionsSyncStatusPush": {
"message": "正在推送样式 $loaded$ / $total$", "message": "正在上传样式 $loaded$ 中的 $total$",
"placeholders": { "placeholders": {
"loaded": { "loaded": {
"content": "$1" "content": "$1"
@ -999,9 +961,6 @@
"optionsSyncSyncNow": { "optionsSyncSyncNow": {
"message": "现在同步" "message": "现在同步"
}, },
"optionsSyncUsername": {
"message": "用户名"
},
"optionsUpdateImportNote": { "optionsUpdateImportNote": {
"message": "从旧版本的 Stylus 或 Stylish 中导入样式备份时,请在样式管理器中手动检测升级一次,以确保所有样式都可更新到最新版本。" "message": "从旧版本的 Stylus 或 Stylish 中导入样式备份时,请在样式管理器中手动检测升级一次,以确保所有样式都可更新到最新版本。"
}, },
@ -1039,14 +998,11 @@
"message": "对于新 Chrome 中的暗色主题很有用,因为它不再绘制边框" "message": "对于新 Chrome 中的暗色主题很有用,因为它不再绘制边框"
}, },
"popupHotkeysInfo": { "popupHotkeysInfo": {
"message": "<1>-<9>, <0> 开启/关闭第 N 个样式0 就是 10\n<A>-<Z> 开启/关闭相应英文首字母的首个样式\n附加 <Shift> 打开编辑器而不是开启/关闭\n<Numpad +> 启用列出的样式\n<Numpad > 禁用列出的样式\n<Numpad *> 或 <`>(反引号)- 开启/关闭已启用的首个样式,当弹出菜单开启时不应用后来启用的样式,因此你可以在测试完成后恢复初始状态:简单地禁用所有样式,然后切换如 <Numpad > <Numpad *>\n更多信息见 Wiki" "message": "<1>-<9>, <0> 按第1 - 10个列表 来ON/OFF\n<A>-<Z> 按英文首字母 来ON/OFF\n附加<Shift>: 打开对应列表的编辑器\n<Numpad +> ON 全部列表\n<Numpad > OFF 全部列表\n<Numpad *> 或 <`> 仅针对Popup弹出时的初始ON列表, 它只会ON/OFF初始ON列表, 故:\n <Numpad > <Numpad *> 能快速恢复初始状态.\n 更多信息见Wiki"
}, },
"popupHotkeysTooltip": { "popupHotkeysTooltip": {
"message": "查看 Popup 快捷键" "message": "查看 Popup 快捷键"
}, },
"popupManageSiteStyles": {
"message": "管理网站样式"
},
"popupManageTooltip": { "popupManageTooltip": {
"message": "右键单击或 Shift + 左键单击可打开管理器并显示适用于当前网站的样式" "message": "右键单击或 Shift + 左键单击可打开管理器并显示适用于当前网站的样式"
}, },
@ -1068,21 +1024,6 @@
"prefShowBadge": { "prefShowBadge": {
"message": "在当前网站生效的样式数量" "message": "在当前网站生效的样式数量"
}, },
"preferScheme": {
"message": "深色/浅色模式偏好设置"
},
"preferSchemeAlways": {
"message": "目前已忽略(总是应用的样式),因为已停用全局深色/浅色模式。"
},
"preferSchemeDark": {
"message": "深色"
},
"preferSchemeLight": {
"message": "浅色"
},
"preferSchemeNone": {
"message": "无(总是应用)"
},
"previewLabel": { "previewLabel": {
"message": "实时预览" "message": "实时预览"
}, },
@ -1093,7 +1034,7 @@
"message": "发布" "message": "发布"
}, },
"publishPush": { "publishPush": {
"message": "推送更新" "message": "发布更新"
}, },
"publishReconnect": { "publishReconnect": {
"message": "尝试断开连接然后再次发布" "message": "尝试断开连接然后再次发布"
@ -1111,7 +1052,7 @@
"message": "正在读取样式..." "message": "正在读取样式..."
}, },
"reload": { "reload": {
"message": "重启" "message": "重启 Stylus"
}, },
"replace": { "replace": {
"message": "替换" "message": "替换"
@ -1122,18 +1063,12 @@
"replaceWith": { "replaceWith": {
"message": "替换为" "message": "替换为"
}, },
"restoreTemplate": {
"message": "恢复默认模板。\n\n不会改变当前打开的编辑器页面"
},
"retrieveBckp": { "retrieveBckp": {
"message": "导入所有样式" "message": "导入所有样式"
}, },
"retrieveDropboxSync": { "retrieveDropboxSync": {
"message": "从 Dropbox 导入" "message": "从 Dropbox 导入"
}, },
"saveAsTemplate": {
"message": "另存为模板"
},
"search": { "search": {
"message": "搜索" "message": "搜索"
}, },
@ -1153,7 +1088,7 @@
"message": "/regex/ 用 / 包裹语法来正则搜索" "message": "/regex/ 用 / 包裹语法来正则搜索"
}, },
"searchResultInstallCount": { "searchResultInstallCount": {
"message": "总安装次数" "message": "总安装次数"
}, },
"searchResultNoneFound": { "searchResultNoneFound": {
"message": "没有找到与此页面相关的样式。" "message": "没有找到与此页面相关的样式。"
@ -1173,6 +1108,9 @@
"searchResultWeeklyCount": { "searchResultWeeklyCount": {
"message": "本周安装次数" "message": "本周安装次数"
}, },
"searchStyleQueryHint": {
"message": "空格多词 -- 同时精确匹配(无需双引号)\n2020 -- 也含更新日期的匹配结果\n大小写不敏感"
},
"searchStylesAll": { "searchStylesAll": {
"message": "全部" "message": "全部"
}, },
@ -1206,18 +1144,12 @@
"sections": { "sections": {
"message": "章节" "message": "章节"
}, },
"settings": {
"message": "设置"
},
"shortcuts": { "shortcuts": {
"message": "快捷键" "message": "快捷键"
}, },
"shortcutsNote": { "shortcutsNote": {
"message": "设置快捷键" "message": "设置快捷键"
}, },
"shortcutsNoteFF": {
"message": "在 Firefox 66 及之后更新的版本中:\n1) 右键单击工具栏的的 Stylus 图标,选择「管理」\n也可以通过主菜单或 Ctrl-Shift-A 打开 about:addons\n2) 在打开的页面点击右上角的齿轮图标;\n3) 选择「管理扩展快捷键」。\n\n您也可以在这自定义快捷键。"
},
"sortDateNewestFirst": { "sortDateNewestFirst": {
"message": "最新的优先" "message": "最新的优先"
}, },
@ -1263,30 +1195,12 @@
"styleEnabledLabel": { "styleEnabledLabel": {
"message": "启用" "message": "启用"
}, },
"styleExcludeLabel": {
"message": "自定义排除网站"
},
"styleFromMozillaFormatError": { "styleFromMozillaFormatError": {
"message": "导入 Mozilla 格式失败" "message": "导入 Mozilla 格式失败"
}, },
"styleFromMozillaFormatPrompt": { "styleFromMozillaFormatPrompt": {
"message": "粘贴 Mozilla 格式代码" "message": "粘贴 Mozilla 格式代码"
}, },
"styleIncludeLabel": {
"message": "自定义包括网站"
},
"styleInjectionImportance": {
"message": "切换样式的优先级"
},
"styleInjectionOrder": {
"message": "样式注入顺序"
},
"styleInjectionOrderHint": {
"message": "拖拽样式可更改排序。样式会按如下顺序注入,所以在列表更下方样式可覆盖较前面的样式。"
},
"styleInjectionOrderHint_prio": {
"message": "下面列出的重要样式始终是最后注入的,因此它们可以覆盖任何新安装的样式。单击样式的标记以切换其重要性。"
},
"styleInstall": { "styleInstall": {
"message": "要将“$stylename$”安装到 Stylus 中吗?", "message": "要将“$stylename$”安装到 Stylus 中吗?",
"placeholders": { "placeholders": {
@ -1329,15 +1243,6 @@
"styleNotAppliedRegexpProblemTooltip": { "styleNotAppliedRegexpProblemTooltip": {
"message": "正则表达式错误,样式无法正常运行" "message": "正则表达式错误,样式无法正常运行"
}, },
"styleNotAppliedSchemeDark": {
"message": "此样式仅在深色模式下应用"
},
"styleNotAppliedSchemeLight": {
"message": "此样式仅在浅色模式下应用"
},
"stylePreferSchemeLabel": {
"message": "深色/浅色模式"
},
"styleRegexpInvalidExplanation": { "styleRegexpInvalidExplanation": {
"message": "部分正则表达式无法生效。" "message": "部分正则表达式无法生效。"
}, },
@ -1347,6 +1252,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "多个部分代码无法正常处理正则表达式" "message": "多个部分代码无法正常处理正则表达式"
}, },
"styleRegexpTestButton": {
"message": "正则测试"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "匹配到标签页的正则" "message": "匹配到标签页的正则"
}, },
@ -1368,9 +1276,6 @@
"styleSaveLabel": { "styleSaveLabel": {
"message": "保存" "message": "保存"
}, },
"styleSettings": {
"message": "样式设置"
},
"styleToMozillaFormatHelp": { "styleToMozillaFormatHelp": {
"message": "导入 FireFox 格式即 @-moz-document ...的 CSS 代码后,会自动转换成 Stylus 使用的分段式 CSS 代码。\n反过来分段式的 CSS 也可以导出为 FireFox 格式。\n需要注意的是如果你要向 userstyles.org 提交你的代码,则必须使用 FireFox 格式。\n\n导入快捷键: 剪贴板含有 @-moz-document ....代码,则可以直接在编辑器里 Ctrl+V 会自动弹出导入对话框" "message": "导入 FireFox 格式即 @-moz-document ...的 CSS 代码后,会自动转换成 Stylus 使用的分段式 CSS 代码。\n反过来分段式的 CSS 也可以导出为 FireFox 格式。\n需要注意的是如果你要向 userstyles.org 提交你的代码,则必须使用 FireFox 格式。\n\n导入快捷键: 剪贴板含有 @-moz-document ....代码,则可以直接在编辑器里 Ctrl+V 会自动弹出导入对话框"
}, },
@ -1388,11 +1293,8 @@
"styleUpdateDiscardChanges": { "styleUpdateDiscardChanges": {
"message": "样式已经在编辑器外被修改。需要重新加载样式吗?" "message": "样式已经在编辑器外被修改。需要重新加载样式吗?"
}, },
"styleUpdateUrlLabel": {
"message": "更新 URL"
},
"stylusUnavailableForURL": { "stylusUnavailableForURL": {
"message": "Stylus 不能在此类页面上工作" "message": "Stylus 无法介入到此类页面"
}, },
"stylusUnavailableForURLdetails": { "stylusUnavailableForURLdetails": {
"message": "出于安全考虑,浏览器禁止扩展程序影响其内置页面(例如 chrome://versionChrome 61 后的标准新标签页about:addons 等等)以及其他扩展程序的页面。每个浏览器也限制了对于自己扩展程序库的介入〔例如 Chrome 网上应用店、Firefox 附加组件addons.mozilla.org。" "message": "出于安全考虑,浏览器禁止扩展程序影响其内置页面(例如 chrome://versionChrome 61 后的标准新标签页about:addons 等等)以及其他扩展程序的页面。每个浏览器也限制了对于自己扩展程序库的介入〔例如 Chrome 网上应用店、Firefox 附加组件addons.mozilla.org。"
@ -1406,16 +1308,8 @@
"syncError": { "syncError": {
"message": "同步失败" "message": "同步失败"
}, },
"syncErrorLock": {
"message": "数据库已在使用中。锁定将在 $TIME$ 过期",
"placeholders": {
"time": {
"content": "$1"
}
}
},
"syncErrorRelogin": { "syncErrorRelogin": {
"message": "同步失败。你已退出登录。\n请尝试在 Stylus 选项里重新登录。" "message": "同步失败\n请尝试在 Stylus 选项里重新登录\n先点击「断开连接」再点击「连接」。"
}, },
"syncStorageErrorSaving": { "syncStorageErrorSaving": {
"message": "不能保存该值,请尝试减少文本数量。" "message": "不能保存该值,请尝试减少文本数量。"
@ -1506,6 +1400,9 @@
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "使用当前 UserStyle 代码替换为新的默认模板吗 ?" "message": "使用当前 UserStyle 代码替换为新的默认模板吗 ?"
}, },
"usercssReplaceTemplateName": {
"message": "@name 为空值 可设置新的默认模板"
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "在此插入代码..." "message": "在此插入代码..."
}, },

View File

@ -71,7 +71,7 @@
"message": "備份" "message": "備份"
}, },
"backupMessage": { "backupMessage": {
"message": "要匯入備份檔案,請將其拖曳至此頁面或點擊匯入按鈕。\n\n要匯出相容於比 1.5.18 還舊的 Stylus 版本的備份,請右鍵點擊或按住 Shift 然後點擊匯出按鈕。" "message": "選取檔案並拖曳到此頁面。"
}, },
"bckpInstStyles": { "bckpInstStyles": {
"message": "匯出樣式" "message": "匯出樣式"
@ -264,23 +264,9 @@
"disableAllStyles": { "disableAllStyles": {
"message": "停用所有樣式" "message": "停用所有樣式"
}, },
"disableAllStylesOff": {
"message": "樣式已關閉"
},
"disableStyleLabel": { "disableStyleLabel": {
"message": "停用" "message": "停用"
}, },
"draftAction": {
"message": "選擇「是」以載入此草稿,或「否」以放棄"
},
"draftTitle": {
"message": "還原草稿,已建立 $date$",
"placeholders": {
"date": {
"content": "$1"
}
}
},
"dragDropMessage": { "dragDropMessage": {
"message": "將您的備份檔拖曳到此頁面的任何地方以匯入。" "message": "將您的備份檔拖曳到此頁面的任何地方以匯入。"
}, },
@ -307,9 +293,6 @@
} }
} }
}, },
"editorSettings": {
"message": "編輯器設定"
},
"enableStyleLabel": { "enableStyleLabel": {
"message": "啟用" "message": "啟用"
}, },
@ -319,9 +302,6 @@
"excludeStyleByUrlLabel": { "excludeStyleByUrlLabel": {
"message": "排除目前的 URL" "message": "排除目前的 URL"
}, },
"exportCompatible": {
"message": "匯出(相容模式)"
},
"exportLabel": { "exportLabel": {
"message": "匯出" "message": "匯出"
}, },
@ -360,6 +340,15 @@
"findStyles": { "findStyles": {
"message": "尋找樣式" "message": "尋找樣式"
}, },
"findStylesForSite": {
"message": "查找更多適合此網站的樣式"
},
"findStylesInline": {
"message": "嵌入"
},
"findStylesInlineTooltip": {
"message": "在此視窗中顯示搜尋結果。"
},
"genericAdd": { "genericAdd": {
"message": "新增" "message": "新增"
}, },
@ -393,12 +382,6 @@
"genericSavedMessage": { "genericSavedMessage": {
"message": "已儲存" "message": "已儲存"
}, },
"genericSize": {
"message": "大小"
},
"genericTest": {
"message": "測試"
},
"genericTitle": { "genericTitle": {
"message": "標題" "message": "標題"
}, },
@ -408,9 +391,6 @@
"gettingStyles": { "gettingStyles": {
"message": "正在取得所有樣式……" "message": "正在取得所有樣式……"
}, },
"headerResizerHint": {
"message": "按住 Shift 以僅在此類型的 UI 中調整大小,例如編輯器、管理程式、安裝程式等"
},
"helpAlt": { "helpAlt": {
"message": "說明" "message": "說明"
}, },
@ -585,7 +565,7 @@
"message": "灰階淡出" "message": "灰階淡出"
}, },
"manageFaviconsHelp": { "manageFaviconsHelp": {
"message": "Stylus 使用外部服務 https://icons.duckduckgo.com" "message": "Stylus 使用外部服務 https://www.google.com/s2/favicons"
}, },
"manageFilters": { "manageFilters": {
"message": "過濾器" "message": "過濾器"
@ -596,9 +576,6 @@
"manageMaxTargets": { "manageMaxTargets": {
"message": "已套用項目的數量" "message": "已套用項目的數量"
}, },
"manageMinColumnWidth": {
"message": "最小欄位寬度以像素為單位9999 停用多欄模式)"
},
"manageNewStyleAsUsercss": { "manageNewStyleAsUsercss": {
"message": "做為 Usercss" "message": "做為 Usercss"
}, },
@ -848,15 +825,6 @@
"optionsAdvanced": { "optionsAdvanced": {
"message": "進階" "message": "進階"
}, },
"optionsAdvancedAutoSwitchSchemeBySystem": {
"message": "按系統偏好設定"
},
"optionsAdvancedAutoSwitchSchemeByTime": {
"message": "到夜間:"
},
"optionsAdvancedAutoSwitchSchemeNever": {
"message": "已停用。樣式中的深色/淺色設定會被忽略。"
},
"optionsAdvancedContextDelete": { "optionsAdvancedContextDelete": {
"message": "在編輯器的右鍵選單中加入「刪除」" "message": "在編輯器的右鍵選單中加入「刪除」"
}, },
@ -866,12 +834,6 @@
"optionsAdvancedExposeIframesNote": { "optionsAdvancedExposeIframesNote": {
"message": "公開每個 iframe 中的頂級頁面網域。\n啟用編寫特別用於 iframe 的 CSS如這個\nhtml[stylus-iframe$$=\"twitter.com\"] h1 { display:none }" "message": "公開每個 iframe 中的頂級頁面網域。\n啟用編寫特別用於 iframe 的 CSS如這個\nhtml[stylus-iframe$$=\"twitter.com\"] h1 { display:none }"
}, },
"optionsAdvancedExposeStyleName": {
"message": "發佈樣式名稱"
},
"optionsAdvancedExposeStyleNameNote": {
"message": "在頁面中發佈樣式名稱以方便在 devtools 中對樣式進行除錯。請重新載入分頁以套用新設定。"
},
"optionsAdvancedNewStyleAsUsercss": { "optionsAdvancedNewStyleAsUsercss": {
"message": "以 usercss 編寫新樣式" "message": "以 usercss 編寫新樣式"
}, },
@ -917,9 +879,6 @@
"optionsHeading": { "optionsHeading": {
"message": "選項" "message": "選項"
}, },
"optionsIconAuto": {
"message": "符合深色/淺色模式"
},
"optionsIconDark": { "optionsIconDark": {
"message": "暗色瀏覽器主題" "message": "暗色瀏覽器主題"
}, },
@ -942,7 +901,7 @@
"message": "重設選項" "message": "重設選項"
}, },
"optionsStylusThemes": { "optionsStylusThemes": {
"message": "點擊任何 Stylus 頁面(包含這個)的瀏覽器工具列中的 Stylus 圖示,然後點擊「尋找樣式」" "message": "尋找 Sytlus UI 佈景主題"
}, },
"optionsSubheading": { "optionsSubheading": {
"message": "更多選項" "message": "更多選項"
@ -959,9 +918,6 @@
"optionsSyncNone": { "optionsSyncNone": {
"message": "無" "message": "無"
}, },
"optionsSyncPassword": {
"message": "密碼"
},
"optionsSyncStatusConnected": { "optionsSyncStatusConnected": {
"message": "已連線" "message": "已連線"
}, },
@ -1005,9 +961,6 @@
"optionsSyncSyncNow": { "optionsSyncSyncNow": {
"message": "立刻同步" "message": "立刻同步"
}, },
"optionsSyncUsername": {
"message": "使用者名稱"
},
"optionsUpdateImportNote": { "optionsUpdateImportNote": {
"message": "當從舊版本或是從 Stylish 匯入樣式備份時,在樣式管理員中手動進行一次更新檢查,以確保所有樣式都被更新。" "message": "當從舊版本或是從 Stylish 匯入樣式備份時,在樣式管理員中手動進行一次更新檢查,以確保所有樣式都被更新。"
}, },
@ -1050,9 +1003,6 @@
"popupHotkeysTooltip": { "popupHotkeysTooltip": {
"message": "點選以檢視可用的快速鍵" "message": "點選以檢視可用的快速鍵"
}, },
"popupManageSiteStyles": {
"message": "管理網站樣式"
},
"popupManageTooltip": { "popupManageTooltip": {
"message": "Shift + 點選或右鍵 + 點選以在管理員中開啟目前頁面可用的樣式" "message": "Shift + 點選或右鍵 + 點選以在管理員中開啟目前頁面可用的樣式"
}, },
@ -1074,21 +1024,6 @@
"prefShowBadge": { "prefShowBadge": {
"message": "在工具欄按鈕上顯示當前網站已生效的樣式表數目。" "message": "在工具欄按鈕上顯示當前網站已生效的樣式表數目。"
}, },
"preferScheme": {
"message": "深色/淺色模式偏好設定"
},
"preferSchemeAlways": {
"message": "目前被忽略(樣式一律套用),因為全域深色/淺色模式已被停用"
},
"preferSchemeDark": {
"message": "深色"
},
"preferSchemeLight": {
"message": "淺色"
},
"preferSchemeNone": {
"message": "無(一律套用)"
},
"previewLabel": { "previewLabel": {
"message": "即時預覽" "message": "即時預覽"
}, },
@ -1117,7 +1052,7 @@
"message": "正在讀取樣式……" "message": "正在讀取樣式……"
}, },
"reload": { "reload": {
"message": "重" "message": "重新載入 Stylus 附加元件"
}, },
"replace": { "replace": {
"message": "取代" "message": "取代"
@ -1128,18 +1063,12 @@
"replaceWith": { "replaceWith": {
"message": "取代為" "message": "取代為"
}, },
"restoreTemplate": {
"message": "還原預設範本。\n\n不會變更目前開啟的編輯器頁面。"
},
"retrieveBckp": { "retrieveBckp": {
"message": "匯入樣式" "message": "匯入樣式"
}, },
"retrieveDropboxSync": { "retrieveDropboxSync": {
"message": "Dropbox 匯入" "message": "Dropbox 匯入"
}, },
"saveAsTemplate": {
"message": "另存為範本"
},
"search": { "search": {
"message": "搜尋" "message": "搜尋"
}, },
@ -1180,7 +1109,7 @@
"message": "每週安裝" "message": "每週安裝"
}, },
"searchStyleQueryHint": { "searchStyleQueryHint": {
"message": "搜尋樣式名稱(若使用大寫字母,則區分大小寫):\n一些字 - 以任何順序符合所有字\n\"一些詞\" - 精確符合引號內的詞\n/foo.*bar/i - 沒有空格的正規表示式(使用 \\s 代替)" "message": "搜尋樣式名稱時是區分大小寫的:\nsome words - 以任意順序搜尋所有文字\n\"some phrase\" - 精確符合引號內的詞語\n2020 - 如此年份顯示在2020年更新的樣式"
}, },
"searchStylesAll": { "searchStylesAll": {
"message": "全部" "message": "全部"
@ -1215,18 +1144,12 @@
"sections": { "sections": {
"message": "樣式段" "message": "樣式段"
}, },
"settings": {
"message": "設定"
},
"shortcuts": { "shortcuts": {
"message": "快速鍵" "message": "快速鍵"
}, },
"shortcutsNote": { "shortcutsNote": {
"message": "自訂鍵盤快速鍵" "message": "自訂鍵盤快速鍵"
}, },
"shortcutsNoteFF": {
"message": "在 Firefox 66 或更新的版本中,您可以手動開啟內建的快捷鍵使用者介面:\n1) 右鍵點擊工具列中的 Stylus 圖示並選擇「管理」\n或是透過主選單或 Ctrl-Shift-A 開啟 about:addons\n2) 在開啟的頁面中點擊右上角的齒輪圖示,\n3) 選擇「管理擴充套件快捷鍵」。\n\n您也可以在此自訂快捷鍵。"
},
"sortDateNewestFirst": { "sortDateNewestFirst": {
"message": "最新的優先" "message": "最新的優先"
}, },
@ -1272,30 +1195,12 @@
"styleEnabledLabel": { "styleEnabledLabel": {
"message": "已啟用" "message": "已啟用"
}, },
"styleExcludeLabel": {
"message": "自訂排除網站"
},
"styleFromMozillaFormatError": { "styleFromMozillaFormatError": {
"message": "從 Mozilla 格式匯入失敗" "message": "從 Mozilla 格式匯入失敗"
}, },
"styleFromMozillaFormatPrompt": { "styleFromMozillaFormatPrompt": {
"message": "貼上 Mozilla 格式代碼" "message": "貼上 Mozilla 格式代碼"
}, },
"styleIncludeLabel": {
"message": "自訂包含網站"
},
"styleInjectionImportance": {
"message": "切換樣式重要程度"
},
"styleInjectionOrder": {
"message": "樣式注入順序"
},
"styleInjectionOrderHint": {
"message": "拖曳樣式可變更其位置。樣式按下列順序注入,所以清單下方的樣式可覆寫較早樣式。"
},
"styleInjectionOrderHint_prio": {
"message": "下方列出的重要樣式一律最後注入,因此它們會覆寫新安裝的樣式。點擊樣式的標記以切換其重要程度。"
},
"styleInstall": { "styleInstall": {
"message": "安裝 '$stylename$' 到 Stylus ", "message": "安裝 '$stylename$' 到 Stylus ",
"placeholders": { "placeholders": {
@ -1338,15 +1243,6 @@
"styleNotAppliedRegexpProblemTooltip": { "styleNotAppliedRegexpProblemTooltip": {
"message": "因為不正確的 'regexp()' 使用導致未套用" "message": "因為不正確的 'regexp()' 使用導致未套用"
}, },
"styleNotAppliedSchemeDark": {
"message": "此樣式僅於深色模式中套用"
},
"styleNotAppliedSchemeLight": {
"message": "此樣式僅於淺色模式中套用"
},
"stylePreferSchemeLabel": {
"message": "深色/淺色模式"
},
"styleRegexpInvalidExplanation": { "styleRegexpInvalidExplanation": {
"message": "部份 'regexp()' 規則可能不再能被編譯。" "message": "部份 'regexp()' 規則可能不再能被編譯。"
}, },
@ -1356,6 +1252,9 @@
"styleRegexpProblemTooltip": { "styleRegexpProblemTooltip": {
"message": "因為不正確的 'regexp()' 使用導致未套用的樣式段數量" "message": "因為不正確的 'regexp()' 使用導致未套用的樣式段數量"
}, },
"styleRegexpTestButton": {
"message": "正規表示式測試"
},
"styleRegexpTestFull": { "styleRegexpTestFull": {
"message": "符合的分頁" "message": "符合的分頁"
}, },
@ -1377,9 +1276,6 @@
"styleSaveLabel": { "styleSaveLabel": {
"message": "儲存" "message": "儲存"
}, },
"styleSettings": {
"message": "樣式設定"
},
"styleToMozillaFormatHelp": { "styleToMozillaFormatHelp": {
"message": "Mozilla格式的樣式代碼能在火狐版Stylus使用也可以提交至 userstyles.org 。" "message": "Mozilla格式的樣式代碼能在火狐版Stylus使用也可以提交至 userstyles.org 。"
}, },
@ -1397,9 +1293,6 @@
"styleUpdateDiscardChanges": { "styleUpdateDiscardChanges": {
"message": "樣式已在編輯器外變更。您想要重新載入樣式嗎?" "message": "樣式已在編輯器外變更。您想要重新載入樣式嗎?"
}, },
"styleUpdateUrlLabel": {
"message": "更新 URL"
},
"stylusUnavailableForURL": { "stylusUnavailableForURL": {
"message": "Stylus 不能在諸如此類的網頁上生效。" "message": "Stylus 不能在諸如此類的網頁上生效。"
}, },
@ -1415,16 +1308,8 @@
"syncError": { "syncError": {
"message": "同步失敗" "message": "同步失敗"
}, },
"syncErrorLock": {
"message": "資料庫已在使用中。鎖將於 $TIME$ 過期",
"placeholders": {
"time": {
"content": "$1"
}
}
},
"syncErrorRelogin": { "syncErrorRelogin": {
"message": "同步失敗。您已被登出。\n嘗試在 Stylus 選項中重新登入。" "message": "同步失敗。\n重是在 Stylus 選項重新登入:\n先點擊「斷線」然後「連線」。"
}, },
"syncStorageErrorSaving": { "syncStorageErrorSaving": {
"message": "無法儲存值。嘗試減少文字量。" "message": "無法儲存值。嘗試減少文字量。"
@ -1515,6 +1400,9 @@
"usercssReplaceTemplateConfirmation": { "usercssReplaceTemplateConfirmation": {
"message": "為新的 Usercss 樣式取代預設的範本為目前的程式碼?" "message": "為新的 Usercss 樣式取代預設的範本為目前的程式碼?"
}, },
"usercssReplaceTemplateName": {
"message": "清空 @name 取代目前範本"
},
"usercssReplaceTemplateSectionBody": { "usercssReplaceTemplateSectionBody": {
"message": "在此插入程式碼……" "message": "在此插入程式碼……"
}, },

View File

@ -6,9 +6,15 @@
/* global syncMan */ /* global syncMan */
/* global updateMan */ /* global updateMan */
/* global usercssMan */ /* global usercssMan */
/* global usoApi */
/* global uswApi */ /* global uswApi */
/* global FIREFOX UA activateTab openURL */ // toolbox.js /* global
FIREFOX
URLS
activateTab
download
findExistingTab
openURL
*/ // toolbox.js
/* global colorScheme */ // color-scheme.js /* global colorScheme */ // color-scheme.js
'use strict'; 'use strict';
@ -35,12 +41,17 @@ addAPI(/** @namespace API */ {
sync: syncMan, sync: syncMan,
updater: updateMan, updater: updateMan,
usercss: usercssMan, usercss: usercssMan,
uso: usoApi,
usw: uswApi, usw: uswApi,
colorScheme, colorScheme,
/** @type {BackgroundWorker} */ /** @type {BackgroundWorker} */
worker: createWorker({url: '/background/background-worker'}), worker: createWorker({url: '/background/background-worker'}),
download(url, opts) {
return typeof url === 'string' && url.startsWith(URLS.uso) &&
this.sender.url.startsWith(URLS.uso) &&
download(url, opts || {});
},
/** @returns {string} */ /** @returns {string} */
getTabUrlPrefix() { getTabUrlPrefix() {
return this.sender.tab.url.match(/^([\w-]+:\/+[^/#]+)/)[1]; return this.sender.tab.url.match(/^([\w-]+:\/+[^/#]+)/)[1];
@ -58,24 +69,10 @@ addAPI(/** @namespace API */ {
async openEditor(params) { async openEditor(params) {
const u = new URL(chrome.runtime.getURL('edit.html')); const u = new URL(chrome.runtime.getURL('edit.html'));
u.search = new URLSearchParams(params); u.search = new URLSearchParams(params);
const wnd = chrome.windows && prefs.get('openEditInWindow'); const wnd = prefs.get('openEditInWindow');
const wndPos = wnd && prefs.get('windowPosition'); const wndPos = wnd && prefs.get('windowPosition');
const wndBase = wnd && prefs.get('openEditInWindow.popup') ? {type: 'popup'} : {}; const wndBase = wnd && prefs.get('openEditInWindow.popup') ? {type: 'popup'} : {};
const ffBug = wnd && FIREFOX; // https://bugzil.la/1271047 const ffBug = wnd && FIREFOX; // https://bugzil.la/1271047
if (wndPos) {
const {left, top, width, height} = wndPos;
const r = left + width;
const b = top + height;
const peek = 32;
if (isNaN(r) || r < peek || left > screen.availWidth - peek || width < 100) {
delete wndPos.left;
delete wndPos.width;
}
if (isNaN(b) || b < peek || top > screen.availHeight - peek || height < 100) {
delete wndPos.top;
delete wndPos.height;
}
}
const tab = await openURL({ const tab = await openURL({
url: `${u}`, url: `${u}`,
currentWindow: null, currentWindow: null,
@ -87,25 +84,27 @@ addAPI(/** @namespace API */ {
/** @returns {Promise<chrome.tabs.Tab>} */ /** @returns {Promise<chrome.tabs.Tab>} */
async openManage({options = false, search, searchMode} = {}) { async openManage({options = false, search, searchMode} = {}) {
const setUrlParams = url => { let url = chrome.runtime.getURL('manage.html');
const u = new URL(url); if (search) {
if (search) u.searchParams.set('search', search); url += `?search=${encodeURIComponent(search)}&searchMode=${searchMode}`;
if (searchMode) u.searchParams.set('searchMode', searchMode);
if (options) u.hash = '#stylus-options';
return u.href;
};
const base = chrome.runtime.getURL('manage.html');
const url = setUrlParams(base);
const tabs = await browser.tabs.query({url: base + '*'});
const same = tabs.find(t => t.url === url);
let tab = same || tabs[0];
if (!tab) {
API.prefsDb.get('badFavs'); // prime the cache to avoid flicker/delay when opening the page
tab = await openURL({url, newTab: true});
} else if (!same) {
msg.sendTab(tab.id, {method: 'pushState', url: setUrlParams(tab.url)});
} }
return activateTab(tab); // activateTab unminimizes the window if (options) {
url += '#stylus-options';
}
const tab = await findExistingTab({
url,
currentWindow: null,
ignoreHash: true,
ignoreSearch: true,
});
if (tab) {
await activateTab(tab);
if (url !== (tab.pendingUrl || tab.url)) {
await msg.sendTab(tab.id, {method: 'pushState', url}).catch(console.error);
}
return tab;
}
return openURL({url, ignoreExisting: true}).then(activateTab); // activateTab unminimizes the window
}, },
/** /**
@ -158,25 +157,10 @@ if (chrome.commands) {
} }
chrome.runtime.onInstalled.addListener(({reason, previousVersion}) => { chrome.runtime.onInstalled.addListener(({reason, previousVersion}) => {
if (reason === 'install') { if (reason === 'update') {
if (UA.mobile) prefs.set('manage.newUI', false); const [a, b, c] = (previousVersion || '').split('.');
if (UA.windows) prefs.set('editor.keyMap', 'sublime'); if (a <= 1 && b <= 5 && c <= 13) { // 1.5.13
} require(['/background/remove-unused-storage']);
// TODO: remove this before 1.5.23 as it's only for a few users who installed git 26b75e77
if (reason === 'update' && previousVersion === '1.5.22') {
for (const dbName of ['drafts', prefs.STORAGE_KEY]) {
try {
indexedDB.open(dbName).onsuccess = async e => {
const idb = /** @type IDBDatabase */ e.target.result;
const ta = idb.objectStoreNames[0] === 'data' && idb.transaction(['data']);
if (ta && ta.objectStore('data').autoIncrement) {
ta.abort();
idb.close();
await new Promise(setTimeout);
indexedDB.deleteDatabase(dbName);
}
};
} catch (e) {}
} }
} }
}); });
@ -208,6 +192,6 @@ Promise.all([
require(['/background/context-menus']), require(['/background/context-menus']),
]).then(() => { ]).then(() => {
bgReady._resolveAll(); bgReady._resolveAll();
msg.ready = true; msg.isBgReady = true;
msg.broadcast({method: 'backgroundReady'}); msg.broadcast({method: 'backgroundReady'});
}); });

View File

@ -4,58 +4,33 @@
'use strict'; 'use strict';
const colorScheme = (() => { const colorScheme = (() => {
let systemPreferDark = false;
let timePreferDark = false;
const changeListeners = new Set(); const changeListeners = new Set();
const kSTATE = 'schemeSwitcher.enabled';
const kSTART = 'schemeSwitcher.nightStart';
const kEND = 'schemeSwitcher.nightEnd';
const SCHEMES = ['dark', 'light'];
const isDark = {
never: null,
dark: true,
light: false,
system: false,
time: false,
};
let isDarkNow = false;
prefs.subscribe(kSTATE, () => update()); const checkTime = ['schemeSwitcher.nightStart', 'schemeSwitcher.nightEnd'];
prefs.subscribe([kSTART, kEND], (key, value) => { prefs.subscribe(checkTime, (key, value) => {
updateTimePreferDark(); updateTimePreferDark();
createAlarm(key, value); createAlarm(key, value);
}, {runNow: true}); });
chrome.alarms.onAlarm.addListener(({name}) => { checkTime.forEach(key => createAlarm(key, prefs.get(key)));
if (name === kSTART || name === kEND) {
prefs.subscribe(['schemeSwitcher.enabled'], emitChange);
chrome.alarms.onAlarm.addListener(info => {
if (checkTime.includes(info.name)) {
updateTimePreferDark(); updateTimePreferDark();
} }
}); });
return { updateSystemPreferDark();
SCHEMES, updateTimePreferDark();
onChange(listener) {
changeListeners.add(listener);
},
isDark: () => isDarkNow,
/** @param {StyleObj} _ */
shouldIncludeStyle({preferScheme: ps}) {
return prefs.get(kSTATE) === 'never' ||
!SCHEMES.includes(ps) ||
isDarkNow === (ps === 'dark');
},
updateSystemPreferDark(val) {
update('system', val);
return true;
},
};
function calcTime(key) { return {shouldIncludeStyle, onChange, updateSystemPreferDark};
const [h, m] = prefs.get(key).split(':');
return (h * 3600 + m * 60) * 1000;
}
function createAlarm(key, value) { function createAlarm(key, value) {
const date = new Date(); const date = new Date();
const [h, m] = value.split(':'); applyDate(date, value);
date.setHours(h, m, 0, 0);
if (date.getTime() < Date.now()) { if (date.getTime() < Date.now()) {
date.setDate(date.getDate() + 1); date.setDate(date.getDate() + 1);
} }
@ -65,27 +40,61 @@ const colorScheme = (() => {
}); });
} }
function updateTimePreferDark() { function shouldIncludeStyle(style) {
const now = Date.now() - new Date().setHours(0, 0, 0, 0); const isDark = style.preferScheme === 'dark';
const start = calcTime(kSTART); const isLight = style.preferScheme === 'light';
const end = calcTime(kEND); if (!isDark && !isLight) {
const val = start > end ? return true;
now >= start || now < end : }
now >= start && now < end; const switcherState = prefs.get('schemeSwitcher.enabled');
update('time', val); if (switcherState === 'never') {
return true;
}
if (switcherState === 'system') {
return systemPreferDark && isDark ||
!systemPreferDark && isLight;
}
return timePreferDark && isDark ||
!timePreferDark && isLight;
} }
function update(type, val) { function updateSystemPreferDark() {
if (type) { const oldValue = systemPreferDark;
if (isDark[type] === val) return; systemPreferDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
isDark[type] = val; if (systemPreferDark !== oldValue) {
emitChange();
} }
val = isDark[prefs.get(kSTATE)]; return true;
if (isDarkNow !== val) { }
isDarkNow = val;
for (const listener of changeListeners) { function updateTimePreferDark() {
listener(isDarkNow); const oldValue = timePreferDark;
} const date = new Date();
const now = date.getTime();
applyDate(date, prefs.get('schemeSwitcher.nightStart'));
const start = date.getTime();
applyDate(date, prefs.get('schemeSwitcher.nightEnd'));
const end = date.getTime();
timePreferDark = start > end ?
now >= start || now < end :
now >= start && now < end;
if (timePreferDark !== oldValue) {
emitChange();
}
}
function applyDate(date, time) {
const [h, m] = time.split(':').map(Number);
date.setHours(h, m, 0, 0);
}
function onChange(listener) {
changeListeners.add(listener);
}
function emitChange() {
for (const listener of changeListeners) {
listener();
} }
} }
})(); })();

View File

@ -5,19 +5,16 @@
* Common stuff that's loaded first so it's immediately available to all background scripts * Common stuff that's loaded first so it's immediately available to all background scripts
*/ */
window.bgReady = {}; /* global bgReady */ /* exported
addAPI
bgReady
compareRevision
*/
const bgReady = {};
bgReady.styles = new Promise(r => (bgReady._resolveStyles = r)); bgReady.styles = new Promise(r => (bgReady._resolveStyles = r));
bgReady.all = new Promise(r => (bgReady._resolveAll = r)); bgReady.all = new Promise(r => (bgReady._resolveAll = r));
const uuidIndex = Object.assign(new Map(), {
custom: {},
/** `obj` must have a unique `id`, a UUIDv4 `_id`, and Date.now() for `_rev`. */
addCustomId(obj, {get = () => obj, set}) {
Object.defineProperty(uuidIndex.custom, obj.id, {get, set});
},
});
/* exported addAPI */
function addAPI(methods) { function addAPI(methods) {
for (const [key, val] of Object.entries(methods)) { for (const [key, val] of Object.entries(methods)) {
const old = API[key]; const old = API[key];
@ -29,64 +26,6 @@ function addAPI(methods) {
} }
} }
/* exported createCache */ function compareRevision(rev1, rev2) {
/** Creates a FIFO limit-size map. */ return rev1 - rev2;
function createCache({size = 1000, onDeleted} = {}) {
const map = new Map();
const buffer = Array(size);
let index = 0;
let lastIndex = 0;
return {
get(id) {
const item = map.get(id);
return item && item.data;
},
set(id, data) {
if (map.size === size) {
// full
map.delete(buffer[lastIndex].id);
if (onDeleted) {
onDeleted(buffer[lastIndex].id, buffer[lastIndex].data);
}
lastIndex = (lastIndex + 1) % size;
}
const item = {id, data, index};
map.set(id, item);
buffer[index] = item;
index = (index + 1) % size;
},
delete(id) {
const item = map.get(id);
if (!item) {
return false;
}
map.delete(item.id);
const lastItem = buffer[lastIndex];
lastItem.index = item.index;
buffer[item.index] = lastItem;
lastIndex = (lastIndex + 1) % size;
if (onDeleted) {
onDeleted(item.id, item.data);
}
return true;
},
clear() {
map.clear();
index = lastIndex = 0;
},
has: id => map.has(id),
*entries() {
for (const [id, item] of map) {
yield [id, item.data];
}
},
*values() {
for (const item of map.values()) {
yield item.data;
}
},
get size() {
return map.size;
},
};
} }

View File

@ -1,61 +1,80 @@
/* global browserCommands */// background.js /* global browserCommands */// background.js
/* global msg */ /* global msg */
/* global prefs */ /* global prefs */
/* global CHROME URLS ignoreChromeError */// toolbox.js /* global CHROME FIREFOX URLS ignoreChromeError */// toolbox.js
'use strict'; 'use strict';
chrome.management.getSelf(ext => { (() => {
const contextMenus = Object.assign({ const contextMenus = {
'show-badge': { 'show-badge': {
title: 'menuShowBadge', title: 'menuShowBadge',
click: togglePref, click: info => prefs.set(info.menuItemId, info.checked),
}, },
'disableAll': { 'disableAll': {
title: 'disableAllStyles', title: 'disableAllStyles',
click: browserCommands.styleDisableAll, click: browserCommands.styleDisableAll,
}, },
'open-manager': { 'open-manager': {
title: 'optionsOpenManager', title: 'openStylesManager',
click: browserCommands.openManage, click: browserCommands.openManage,
}, },
'open-options': { 'open-options': {
title: 'openOptions', title: 'openOptions',
click: browserCommands.openOptions, click: browserCommands.openOptions,
}, },
}, ext.installType === 'development' && {
'reload': { 'reload': {
presentIf: async () => (await browser.management.getSelf()).installType === 'development',
title: 'reload', title: 'reload',
click: browserCommands.reload, click: browserCommands.reload,
}, },
}, CHROME && {
'editor.contextDelete': { 'editor.contextDelete': {
presentIf: () => !FIREFOX && prefs.get('editor.contextDelete'),
title: 'editDeleteText', title: 'editDeleteText',
type: 'normal', type: 'normal',
contexts: ['editable'], contexts: ['editable'],
documentUrlPatterns: [URLS.ownOrigin + '*'], documentUrlPatterns: [URLS.ownOrigin + 'edit*'],
click: (info, tab) => { click: (info, tab) => {
msg.sendTab(tab.id, {method: 'editDeleteText'}, undefined, 'extension') msg.sendTab(tab.id, {method: 'editDeleteText'}, undefined, 'extension')
.catch(msg.ignoreError); .catch(msg.ignoreError);
}, },
}, },
}); };
// "Delete" item in context menu for browsers that don't have it
if (CHROME &&
// looking at the end of UA string
/(Vivaldi|Safari)\/[\d.]+$/.test(navigator.userAgent) &&
// skip forks with Flash as those are likely to have the menu e.g. CentBrowser
!Array.from(navigator.plugins).some(p => p.name === 'Shockwave Flash')) {
prefs.__defaults['editor.contextDelete'] = true;
}
const keys = Object.keys(contextMenus);
prefs.subscribe(keys.filter(id => typeof prefs.defaults[id] === 'boolean'),
CHROME >= 62 && CHROME <= 64 ? toggleCheckmarkBugged : toggleCheckmark);
prefs.subscribe(keys.filter(id => contextMenus[id].presentIf && prefs.knownKeys.includes(id)),
togglePresence);
createContextMenus(keys);
createContextMenus(Object.keys(contextMenus));
chrome.contextMenus.onClicked.addListener((info, tab) => chrome.contextMenus.onClicked.addListener((info, tab) =>
contextMenus[info.menuItemId].click(info, tab)); contextMenus[info.menuItemId].click(info, tab));
function createContextMenus(ids) { async function createContextMenus(ids) {
for (const id of ids) { for (const id of ids) {
const item = Object.assign({id, contexts: ['browser_action']}, contextMenus[id]); let item = contextMenus[id];
if (item.presentIf && !await item.presentIf()) {
continue;
}
item = Object.assign({id}, item);
delete item.presentIf;
item.title = chrome.i18n.getMessage(item.title); item.title = chrome.i18n.getMessage(item.title);
if (typeof prefs.defaults[id] === 'boolean') { if (!item.type && typeof prefs.defaults[id] === 'boolean') {
if (item.type) { item.type = 'checkbox';
prefs.subscribe(id, togglePresence); item.checked = prefs.get(id);
} else { }
item.type = 'checkbox'; if (!item.contexts) {
item.checked = prefs.get(id); item.contexts = ['browser_action'];
prefs.subscribe(id, CHROME >= 62 && CHROME <= 64 ? toggleCheckmarkBugged : toggleCheckmark);
}
} }
delete item.click; delete item.click;
chrome.contextMenus.create(item, ignoreChromeError); chrome.contextMenus.create(item, ignoreChromeError);
@ -72,11 +91,6 @@ chrome.management.getSelf(ext => {
createContextMenus([id]); createContextMenus([id]);
} }
/** @param {chrome.contextMenus.OnClickData} info */
function togglePref(info) {
prefs.set(info.menuItemId, info.checked);
}
function togglePresence(id, checked) { function togglePresence(id, checked) {
if (checked) { if (checked) {
createContextMenus([id]); createContextMenus([id]);
@ -84,4 +98,4 @@ chrome.management.getSelf(ext => {
chrome.contextMenus.remove(id, ignoreChromeError); chrome.contextMenus.remove(id, ignoreChromeError);
} }
} }
}); })();

View File

@ -2,17 +2,17 @@
'use strict'; 'use strict';
/* exported createChromeStorageDB */ /* exported createChromeStorageDB */
function createChromeStorageDB(PREFIX) { function createChromeStorageDB() {
let INC; let INC;
const isMain = !PREFIX;
if (!PREFIX) PREFIX = 'style-';
return { const PREFIX = 'style-';
const METHODS = {
delete(id) { delete(id) {
return chromeLocal.remove(PREFIX + id); return chromeLocal.remove(PREFIX + id);
}, },
// FIXME: we don't use this method at all. Should we remove this?
get(id) { get(id) {
return chromeLocal.getValue(PREFIX + id); return chromeLocal.getValue(PREFIX + id);
}, },
@ -21,9 +21,7 @@ function createChromeStorageDB(PREFIX) {
const all = await chromeLocal.get(); const all = await chromeLocal.get();
if (!INC) prepareInc(all); if (!INC) prepareInc(all);
return Object.entries(all) return Object.entries(all)
.map(([key, val]) => key.startsWith(PREFIX) && .map(([key, val]) => key.startsWith(PREFIX) && Number(key.slice(PREFIX.length)) && val)
(!isMain || Number(key.slice(PREFIX.length))) &&
val)
.filter(Boolean); .filter(Boolean);
}, },
@ -61,4 +59,8 @@ function createChromeStorageDB(PREFIX) {
} }
} }
} }
return function dbExecChromeStorage(method, ...args) {
return METHODS[method](...args);
};
} }

View File

@ -1,8 +1,5 @@
/* global addAPI */// common.js
/* global chromeLocal */// storage-util.js /* global chromeLocal */// storage-util.js
/* global cloneError */// worker-util.js /* global cloneError */// worker-util.js
/* global deepCopy */// toolbox.js
/* global prefs */
'use strict'; 'use strict';
/* /*
@ -14,49 +11,16 @@
/* exported db */ /* exported db */
const db = (() => { const db = (() => {
let exec = async (...args) => ( const DATABASE = 'stylish';
exec = await tryUsingIndexedDB().catch(useChromeStorage) const STORE = 'styles';
)(...args);
const DB = 'stylish';
const FALLBACK = 'dbInChromeStorage'; const FALLBACK = 'dbInChromeStorage';
const ID_AS_KEY = {[DB]: true}; const dbApi = {
const getStoreName = dbName => dbName === DB ? 'styles' : 'data'; async exec(...args) {
const cache = {}; dbApi.exec = await tryUsingIndexedDB().catch(useChromeStorage);
const proxies = {}; return dbApi.exec(...args);
const proxyHandler = { },
get: ({dbName}, cmd) =>
(...args) =>
(dbName === DB ? exec : cachedExec)(dbName, cmd, ...args),
}; };
/** return dbApi;
* @param {string} dbName
* @return {IDBObjectStore | {putMany: function(items:?[]):Promise<?[]>}}
*/
const getProxy = dbName => proxies[dbName] || (
(proxies[dbName] = new Proxy({dbName}, proxyHandler))
);
addAPI(/** @namespace API */ {
drafts: getProxy('drafts'),
/** Storage for big items that may exceed 8kB limit of chrome.storage.sync.
* To make an item syncable register it with uuidIndex.addCustomId. */
prefsDb: getProxy(prefs.STORAGE_KEY),
});
return {
styles: getProxy(DB),
};
async function cachedExec(dbName, cmd, a, b) {
const hub = cache[dbName] || (cache[dbName] = {});
const res = cmd === 'get' && a in hub ? hub[a] : await exec(...arguments);
if (cmd === 'get') {
hub[a] = deepCopy(res);
} else if (cmd === 'put') {
hub[ID_AS_KEY[dbName] ? a.id : b] = deepCopy(a);
} else if (cmd === 'delete') {
delete hub[a];
}
return res;
}
async function tryUsingIndexedDB() { async function tryUsingIndexedDB() {
// we use chrome.storage.local fallback if IndexedDB doesn't save data, // we use chrome.storage.local fallback if IndexedDB doesn't save data,
@ -76,9 +40,9 @@ const db = (() => {
async function testDB() { async function testDB() {
const id = `${performance.now()}.${Math.random()}.${Date.now()}`; const id = `${performance.now()}.${Math.random()}.${Date.now()}`;
await dbExecIndexedDB(DB, 'put', {id}); await dbExecIndexedDB('put', {id});
const e = await dbExecIndexedDB(DB, 'get', id); const e = await dbExecIndexedDB('get', id);
await dbExecIndexedDB(DB, 'delete', e.id); // throws if `e` or id is null await dbExecIndexedDB('delete', e.id); // throws if `e` or id is null
} }
async function useChromeStorage(err) { async function useChromeStorage(err) {
@ -88,18 +52,12 @@ const db = (() => {
console.warn('Failed to access indexedDB. Switched to storage API.', err); console.warn('Failed to access indexedDB. Switched to storage API.', err);
} }
await require(['/background/db-chrome-storage']); /* global createChromeStorageDB */ await require(['/background/db-chrome-storage']); /* global createChromeStorageDB */
const BASES = {}; return createChromeStorageDB();
return (dbName, method, ...args) => (
BASES[dbName] || (
BASES[dbName] = createChromeStorageDB(dbName !== DB && `${dbName}-`)
)
)[method](...args);
} }
async function dbExecIndexedDB(dbName, method, ...args) { async function dbExecIndexedDB(method, ...args) {
const mode = method.startsWith('get') ? 'readonly' : 'readwrite'; const mode = method.startsWith('get') ? 'readonly' : 'readwrite';
const storeName = getStoreName(dbName); const store = (await open()).transaction([STORE], mode).objectStore(STORE);
const store = (await open(dbName)).transaction([storeName], mode).objectStore(storeName);
const fn = method === 'putMany' ? putMany : storeRequest; const fn = method === 'putMany' ? putMany : storeRequest;
return fn(store, method, ...args); return fn(store, method, ...args);
} }
@ -117,34 +75,21 @@ const db = (() => {
return Promise.all(items.map(item => storeRequest(store, 'put', item))); return Promise.all(items.map(item => storeRequest(store, 'put', item)));
} }
function open(name) { function open() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const request = indexedDB.open(name, 2); const request = indexedDB.open(DATABASE, 2);
request.onsuccess = e => resolve(create(e)); request.onsuccess = () => resolve(request.result);
request.onerror = reject; request.onerror = reject;
request.onupgradeneeded = create; request.onupgradeneeded = create;
}); });
} }
function create(event) { function create(event) {
/** @type IDBDatabase */ if (event.oldVersion === 0) {
const idb = event.target.result; event.target.result.createObjectStore(STORE, {
const dbName = idb.name;
const sn = getStoreName(dbName);
if (!idb.objectStoreNames.contains(sn)) {
if (event.type === 'success') {
idb.close();
return new Promise(resolve => {
indexedDB.deleteDatabase(dbName).onsuccess = () => {
resolve(open(dbName));
};
});
}
idb.createObjectStore(sn, ID_AS_KEY[dbName] ? {
keyPath: 'id', keyPath: 'id',
autoIncrement: true, autoIncrement: true,
} : undefined); });
} }
return idb;
} }
})(); })();

View File

@ -1,20 +1,19 @@
/* global API */// msg.js /* global API */// msg.js
/* global addAPI bgReady */// common.js /* global addAPI bgReady */// common.js
/* global colorScheme */
/* global prefs */ /* global prefs */
/* global tabMan */ /* global tabMan */
/* global CHROME FIREFOX UA debounce ignoreChromeError */// toolbox.js /* global CHROME FIREFOX VIVALDI debounce ignoreChromeError */// toolbox.js
'use strict'; 'use strict';
/* exported iconMan */ /* exported iconMan */
const iconMan = (() => { const iconMan = (() => {
const ICON_SIZES = FIREFOX || CHROME && !UA.vivaldi ? [16, 32] : [19, 38]; const ICON_SIZES = FIREFOX || CHROME >= 55 && !VIVALDI ? [16, 32] : [19, 38];
const staleBadges = new Set(); const staleBadges = new Set();
const imageDataCache = new Map(); const imageDataCache = new Map();
const badgeOvr = {color: '', text: ''}; const badgeOvr = {color: '', text: ''};
// https://github.com/openstyles/stylus/issues/1287 Fenix can't use custom ImageData // https://github.com/openstyles/stylus/issues/1287 Fenix can't use custom ImageData
const FIREFOX_ANDROID = FIREFOX && UA.mobile; const FIREFOX_ANDROID = FIREFOX && navigator.userAgent.includes('Android');
let isDark;
// https://github.com/openstyles/stylus/issues/335 // https://github.com/openstyles/stylus/issues/335
let hasCanvas = FIREFOX_ANDROID ? false : loadImage(`/images/icon/${ICON_SIZES[0]}.png`) let hasCanvas = FIREFOX_ANDROID ? false : loadImage(`/images/icon/${ICON_SIZES[0]}.png`)
.then(({data}) => (hasCanvas = data.some(b => b !== 255))); .then(({data}) => (hasCanvas = data.some(b => b !== 255)));
@ -38,17 +37,13 @@ const iconMan = (() => {
chrome.webNavigation.onCommitted.addListener(({tabId, frameId}) => { chrome.webNavigation.onCommitted.addListener(({tabId, frameId}) => {
if (!frameId) tabMan.set(tabId, 'styleIds', undefined); if (!frameId) tabMan.set(tabId, 'styleIds', undefined);
}); });
chrome.runtime.onConnect.addListener(port => { chrome.runtime.onConnect.addListener(port => {
if (port.name === 'iframe') { if (port.name === 'iframe') {
port.onDisconnect.addListener(onPortDisconnected); port.onDisconnect.addListener(onPortDisconnected);
} }
}); });
colorScheme.onChange(val => {
isDark = val;
if (prefs.get('iconset') === -1) {
debounce(refreshAllIcons);
}
});
bgReady.all.then(() => { bgReady.all.then(() => {
prefs.subscribe([ prefs.subscribe([
'disableAll', 'disableAll',
@ -100,10 +95,9 @@ const iconMan = (() => {
} }
function getIconName(hasStyles = false) { function getIconName(hasStyles = false) {
const i = prefs.get('iconset'); const iconset = prefs.get('iconset') === 1 ? 'light/' : '';
const prefix = i === 0 || i === -1 && isDark ? '' : 'light/';
const postfix = prefs.get('disableAll') ? 'x' : !hasStyles ? 'w' : ''; const postfix = prefs.get('disableAll') ? 'x' : !hasStyles ? 'w' : '';
return `${prefix}$SIZE$${postfix}`; return `${iconset}$SIZE$${postfix}`;
} }
function refreshIcon(tabId, force = false) { function refreshIcon(tabId, force = false) {

View File

@ -0,0 +1,15 @@
/* global chromeLocal */// storage-util.js
'use strict';
// Removing unused stuff from storage on extension update
// TODO: delete this by the middle of 2021
try {
localStorage.clear();
} catch (e) {}
setTimeout(async () => {
const del = Object.keys(await chromeLocal.get())
.filter(key => key.startsWith('usoSearchCache'));
if (del.length) chromeLocal.remove(del);
}, 15e3);

View File

@ -1,7 +1,7 @@
/* global API msg */// msg.js /* global API msg */// msg.js
/* global CHROME URLS deepEqual isEmptyObj mapObj stringAsRegExp tryRegExp tryURL */// toolbox.js /* global CHROME URLS isEmptyObj stringAsRegExp tryRegExp tryURL */// toolbox.js
/* global bgReady createCache uuidIndex */// common.js /* global bgReady compareRevision */// common.js
/* global calcStyleDigest styleCodeEmpty */// sections-util.js /* global calcStyleDigest styleCodeEmpty styleSectionGlobal */// sections-util.js
/* global db */ /* global db */
/* global prefs */ /* global prefs */
/* global tabMan */ /* global tabMan */
@ -18,26 +18,18 @@ The live preview feature relies on `runtime.connect` and `port.onDisconnect`
to cleanup the temporary code. See livePreview in /edit. to cleanup the temporary code. See livePreview in /edit.
*/ */
const styleUtil = {};
/* exported styleMan */
const styleMan = (() => { const styleMan = (() => {
Object.assign(styleUtil, {
id2style,
handleSave,
uuid2style,
});
//#region Declarations //#region Declarations
/** @typedef {{ /** @typedef {{
style: StyleObj, style: StyleObj
preview?: StyleObj, preview?: StyleObj
appliesTo: Set<string>, appliesTo: Set<string>
}} StyleMapData */ }} StyleMapData */
/** @type {Map<number,StyleMapData>} */ /** @type {Map<number,StyleMapData>} */
const dataMap = new Map(); const dataMap = new Map();
const uuidIndex = new Map();
/** @typedef {Object<styleId,{id: number, code: string[]}>} StyleSectionsToApply */ /** @typedef {Object<styleId,{id: number, code: string[]}>} StyleSectionsToApply */
/** @type {Map<string,{maybeMatch: Set<styleId>, sections: StyleSectionsToApply}>} */ /** @type {Map<string,{maybeMatch: Set<styleId>, sections: StyleSectionsToApply}>} */
const cachedStyleForUrl = createCache({ const cachedStyleForUrl = createCache({
@ -63,55 +55,18 @@ const styleMan = (() => {
name: style => `ID: ${style.id}`, name: style => `ID: ${style.id}`,
_id: () => uuidv4(), _id: () => uuidv4(),
_rev: () => Date.now(), _rev: () => Date.now(),
_usw: () => ({}),
}; };
const DELETE_IF_NULL = ['id', 'customName', 'md5Url', 'originalMd5']; const DELETE_IF_NULL = ['id', 'customName', 'md5Url', 'originalMd5'];
const INJ_ORDER = 'injectionOrder';
const order = {main: {}, prio: {}};
const orderWrap = {
id: INJ_ORDER,
value: mapObj(order, () => []),
_id: `${chrome.runtime.id}-${INJ_ORDER}`,
_rev: 0,
};
uuidIndex.addCustomId(orderWrap, {set: setOrder});
class MatchQuery {
constructor(url) {
this.url = url;
}
get urlWithoutHash() {
return this._set('urlWithoutHash', this.url.split('#', 1)[0]);
}
get urlWithoutParams() {
return this._set('urlWithoutParams', this.url.split(/[?#]/, 1)[0]);
}
get domain() {
return this._set('domain', tryURL(this.url).hostname);
}
get isOwnPage() {
return this._set('isOwnPage', this.url.startsWith(URLS.ownOrigin));
}
_set(name, value) {
Object.defineProperty(this, name, {value});
return value;
}
}
/** @type {Promise|boolean} will be `true` to avoid wasting a microtask tick on each `await` */ /** @type {Promise|boolean} will be `true` to avoid wasting a microtask tick on each `await` */
let ready = Promise.all([init(), prefs.ready]); let ready = init();
chrome.runtime.onConnect.addListener(port => { chrome.runtime.onConnect.addListener(handleLivePreview);
if (port.name === 'livePreview') { // function handleColorScheme() {
handleLivePreview(port); colorScheme.onChange(() => {
} else if (port.name.startsWith('draft:')) { for (const {style: data} of dataMap.values()) {
handleDraft(port); if (data.preferScheme === 'dark' || data.preferScheme === 'light') {
} broadcastStyleUpdated(data, 'colorScheme', undefined, false);
});
colorScheme.onChange(value => {
msg.broadcastExtension({method: 'colorScheme', value});
for (const {style} of dataMap.values()) {
if (colorScheme.SCHEMES.includes(style.preferScheme)) {
broadcastStyleUpdated(style, 'colorScheme');
} }
} }
}); });
@ -124,28 +79,22 @@ const styleMan = (() => {
/** @returns {Promise<number>} style id */ /** @returns {Promise<number>} style id */
async delete(id, reason) { async delete(id, reason) {
if (ready.then) await ready; if (ready.then) await ready;
const {style, appliesTo} = dataMap.get(id); const data = id2data(id);
const sync = reason !== 'sync'; const {style, appliesTo} = data;
const uuid = style._id; await db.exec('delete', id);
db.styles.delete(id); if (reason !== 'sync') {
if (sync) API.sync.delete(uuid, Date.now()); API.sync.delete(style._id, Date.now());
}
for (const url of appliesTo) { for (const url of appliesTo) {
const cache = cachedStyleForUrl.get(url); const cache = cachedStyleForUrl.get(url);
if (cache) delete cache.sections[id]; if (cache) delete cache.sections[id];
} }
dataMap.delete(id); dataMap.delete(id);
uuidIndex.delete(uuid); uuidIndex.delete(style._id);
mapObj(orderWrap.value, (group, type) => {
delete order[type][id];
const i = group.indexOf(uuid);
if (i >= 0) group.splice(i, 1);
});
setOrder(orderWrap, {calc: false});
if (style._usw && style._usw.token) { if (style._usw && style._usw.token) {
// Must be called after the style is deleted from dataMap // Must be called after the style is deleted from dataMap
API.usw.revoke(id); API.usw.revoke(id);
} }
API.drafts.delete(id);
await msg.broadcast({ await msg.broadcast({
method: 'styleDeleted', method: 'styleDeleted',
style: {id}, style: {id},
@ -153,6 +102,17 @@ const styleMan = (() => {
return id; return id;
}, },
/** @returns {Promise<number>} style id */
async deleteByUUID(_id, rev) {
if (ready.then) await ready;
const id = uuidIndex.get(_id);
const oldDoc = id && id2style(id);
if (oldDoc && compareRevision(oldDoc._rev, rev) <= 0) {
// FIXME: does it make sense to set reason to 'sync' in deleteByUUID?
return styleMan.delete(id, 'sync');
}
},
/** @returns {Promise<StyleObj>} */ /** @returns {Promise<StyleObj>} */
async editSave(style) { async editSave(style) {
if (ready.then) await ready; if (ready.then) await ready;
@ -162,14 +122,12 @@ const styleMan = (() => {
}, },
/** @returns {Promise<?StyleObj>} */ /** @returns {Promise<?StyleObj>} */
async find(...filters) { async find(filter) {
if (ready.then) await ready; if (ready.then) await ready;
for (const filter of filters) { const filterEntries = Object.entries(filter);
const filterEntries = Object.entries(filter); for (const {style} of dataMap.values()) {
for (const {style} of dataMap.values()) { if (filterEntries.every(([key, val]) => style[key] === val)) {
if (filterEntries.every(([key, val]) => style[key] === val)) { return style;
return style;
}
} }
} }
return null; return null;
@ -178,51 +136,21 @@ const styleMan = (() => {
/** @returns {Promise<StyleObj[]>} */ /** @returns {Promise<StyleObj[]>} */
async getAll() { async getAll() {
if (ready.then) await ready; if (ready.then) await ready;
return getAllAsArray(); return Array.from(dataMap.values(), data2style);
}, },
/** @returns {Promise<Object<string,StyleObj[]>>}>} */ /** @returns {Promise<StyleObj>} */
async getAllOrdered(keys) { async getByUUID(uuid) {
if (ready.then) await ready; if (ready.then) await ready;
const res = mapObj(orderWrap.value, group => group.map(uuid2style).filter(Boolean)); return id2style(uuidIndex.get(uuid));
if (res.main.length + res.prio.length < dataMap.size) {
for (const {style} of dataMap.values()) {
if (!(style.id in order.main) && !(style.id in order.prio)) {
res.main.push(style);
}
}
}
return keys
? mapObj(res, group => group.map(style => mapObj(style, null, keys)))
: res;
},
getOrder: () => orderWrap.value,
/** @returns {Promise<string | {[remoteId:string]: styleId}>}>} */
async getRemoteInfo(id) {
if (ready.then) await ready;
if (id) return calcRemoteId(id2style(id));
const res = {};
for (const {style} of dataMap.values()) {
const [rid, vars] = calcRemoteId(style);
if (rid) res[rid] = [style.id, vars];
}
return res;
}, },
/** @returns {Promise<StyleSectionsToApply>} */ /** @returns {Promise<StyleSectionsToApply>} */
async getSectionsByUrl(url, id, isInitialApply) { async getSectionsByUrl(url, id, isInitialApply) {
if (ready.then) await ready; if (ready.then) await ready;
if (isInitialApply && prefs.get('disableAll')) { if (isInitialApply && prefs.get('disableAll')) {
return { return {disableAll: true};
cfg: {
disableAll: true,
},
};
} }
// TODO: enable in FF when it supports sourceURL comment in style elements (also options.html)
const {exposeStyleName} = CHROME && prefs.__values;
const sender = CHROME && this && this.sender || {}; const sender = CHROME && this && this.sender || {};
if (sender.frameId === 0) { if (sender.frameId === 0) {
/* Chrome hides text frament from location.href of the page e.g. #:~:text=foo /* Chrome hides text frament from location.href of the page e.g. #:~:text=foo
@ -241,9 +169,9 @@ const styleMan = (() => {
} else if (cache.maybeMatch.size) { } else if (cache.maybeMatch.size) {
buildCache(cache, url, Array.from(cache.maybeMatch, id2data).filter(Boolean)); buildCache(cache, url, Array.from(cache.maybeMatch, id2data).filter(Boolean));
} }
return Object.assign({cfg: {exposeStyleName, order}}, return id
id ? mapObj(cache.sections, null, [id]) ? cache.sections[id] ? {[id]: cache.sections[id]} : {}
: cache.sections); : cache.sections;
}, },
/** @returns {Promise<StyleObj>} */ /** @returns {Promise<StyleObj>} */
@ -260,8 +188,8 @@ const styleMan = (() => {
const result = []; const result = [];
const styles = id const styles = id
? [id2style(id)].filter(Boolean) ? [id2style(id)].filter(Boolean)
: getAllAsArray(); : Array.from(dataMap.values(), data2style);
const query = new MatchQuery(url); const query = createMatchQuery(url);
for (const style of styles) { for (const style of styles) {
let excluded = false; let excluded = false;
let excludedScheme = false; let excludedScheme = false;
@ -283,7 +211,10 @@ const styleMan = (() => {
excludedScheme = true; excludedScheme = true;
} }
for (const section of style.sections) { for (const section of style.sections) {
const match = urlMatchSection(query, section, true); if (styleSectionGlobal(section) && styleCodeEmpty(section.code)) {
continue;
}
const match = urlMatchSection(query, section);
if (match) { if (match) {
if (match === 'sloppy') { if (match === 'sloppy') {
sloppy = true; sloppy = true;
@ -309,10 +240,11 @@ const styleMan = (() => {
await usercssMan.buildCode(style); await usercssMan.buildCode(style);
} }
} }
const events = await db.styles.putMany(items); const events = await db.exec('putMany', items);
return Promise.all(items.map((item, i) => return Promise.all(items.map((item, i) => {
handleSave(item, {reason: 'import'}, events[i]) afterSave(item, events[i]);
)); return handleSave(item, {reason: 'import'});
}));
}, },
/** @returns {Promise<StyleObj>} */ /** @returns {Promise<StyleObj>} */
@ -325,13 +257,33 @@ const styleMan = (() => {
return saveStyle(style, {reason}); return saveStyle(style, {reason});
}, },
save: saveStyle, /** @returns {Promise<?StyleObj>} */
async putByUUID(doc) {
async setOrder(value) {
if (ready.then) await ready; if (ready.then) await ready;
return setOrder({value}, {broadcast: true, sync: true}); const id = uuidIndex.get(doc._id);
if (id) {
doc.id = id;
} else {
delete doc.id;
}
const oldDoc = id && id2style(id);
let diff = -1;
if (oldDoc) {
diff = compareRevision(oldDoc._rev, doc._rev);
if (diff > 0) {
API.sync.put(oldDoc._id, oldDoc._rev);
return;
}
}
if (diff < 0) {
doc.id = await db.exec('put', doc);
uuidIndex.set(doc._id, doc.id);
return handleSave(doc, {reason: 'sync'});
}
}, },
save: saveStyle,
/** @returns {Promise<number>} style id */ /** @returns {Promise<number>} style id */
async toggle(id, enabled) { async toggle(id, enabled) {
if (ready.then) await ready; if (ready.then) await ready;
@ -354,8 +306,7 @@ const styleMan = (() => {
async config(id, prop, value) { async config(id, prop, value) {
if (ready.then) await ready; if (ready.then) await ready;
const style = Object.assign({}, id2style(id)); const style = Object.assign({}, id2style(id));
const {preview = {}} = dataMap.get(id); style[prop] = value;
style[prop] = preview[prop] = value;
return saveStyle(style, {reason: 'config'}); return saveStyle(style, {reason: 'config'});
}, },
}; };
@ -370,23 +321,12 @@ const styleMan = (() => {
/** @returns {?StyleObj} */ /** @returns {?StyleObj} */
function id2style(id) { function id2style(id) {
return (dataMap.get(Number(id)) || {}).style; return (dataMap.get(id) || {}).style;
} }
/** @returns {?StyleObj} */ /** @returns {?StyleObj} */
function uuid2style(uuid) { function data2style(data) {
return id2style(uuidIndex.get(uuid)); return data && data.style;
}
function calcRemoteId({md5Url, updateUrl, usercssData: ucd} = {}) {
let id;
id = (id = /\d+/.test(md5Url) || URLS.extractUsoArchiveId(updateUrl)) && `uso-${id}`
|| (id = URLS.extractUSwId(updateUrl)) && `usw-${id}`
|| '';
return id && [
id,
ucd && !isEmptyObj(ucd.vars),
];
} }
/** @returns {StyleObj} */ /** @returns {StyleObj} */
@ -407,7 +347,6 @@ const styleMan = (() => {
style, style,
appliesTo: new Set(), appliesTo: new Set(),
}); });
uuidIndex.set(style._id, style.id);
} }
/** @returns {StyleObj} */ /** @returns {StyleObj} */
@ -417,12 +356,10 @@ const styleMan = (() => {
style); style);
} }
function handleDraft(port) {
const id = port.name.split(':').pop();
port.onDisconnect.addListener(() => API.drafts.delete(Number(id) || id));
}
function handleLivePreview(port) { function handleLivePreview(port) {
if (port.name !== 'livePreview') {
return;
}
let id; let id;
port.onMessage.addListener(style => { port.onMessage.addListener(style => {
if (!id) id = style.id; if (!id) id = style.id;
@ -474,10 +411,10 @@ const styleMan = (() => {
cache.maybeMatch.add(id); cache.maybeMatch.add(id);
continue; continue;
} }
const code = getAppliedCode(new MatchQuery(url), style); const code = getAppliedCode(createMatchQuery(url), style);
if (code) { if (code) {
updated.add(url); updated.add(url);
buildCacheEntry(cache, style, code); cache.sections[id] = {id, code};
} else { } else {
excluded.add(url); excluded.add(url);
delete cache.sections[id]; delete cache.sections[id];
@ -511,24 +448,29 @@ const styleMan = (() => {
fixKnownProblems(style); fixKnownProblems(style);
} }
async function saveStyle(style, handlingOptions) { function afterSave(style, newId) {
beforeSave(style); if (style.id == null) {
const newId = await db.styles.put(style); style.id = newId;
return handleSave(style, handlingOptions, newId); }
uuidIndex.set(style._id, style.id);
API.sync.put(style._id, style._rev);
} }
function handleSave(style, {reason, broadcast = true}, id = style.id) { async function saveStyle(style, handlingOptions) {
if (style.id == null) style.id = id; beforeSave(style);
const data = id2data(id); const newId = await db.exec('put', style);
afterSave(style, newId);
return handleSave(style, handlingOptions);
}
function handleSave(style, {reason, broadcast = true}) {
const data = id2data(style.id);
const method = data ? 'styleUpdated' : 'styleAdded'; const method = data ? 'styleUpdated' : 'styleAdded';
if (!data) { if (!data) {
storeInMap(style); storeInMap(style);
} else { } else {
data.style = style; data.style = style;
} }
if (reason !== 'sync') {
API.sync.putDoc(style);
}
if (broadcast) broadcastStyleUpdated(style, reason, method); if (broadcast) broadcastStyleUpdated(style, reason, method);
return style; return style;
} }
@ -553,14 +495,15 @@ const styleMan = (() => {
} }
async function init() { async function init() {
const orderPromise = API.prefsDb.get(orderWrap.id); const styles = await db.exec('getAll') || [];
const styles = await db.styles.getAll() || [];
const updated = await Promise.all(styles.map(fixKnownProblems).filter(Boolean)); const updated = await Promise.all(styles.map(fixKnownProblems).filter(Boolean));
if (updated.length) { if (updated.length) {
await db.styles.putMany(updated); await db.exec('putMany', updated);
}
for (const style of styles) {
storeInMap(style);
uuidIndex.set(style._id, style.id);
} }
setOrder(await orderPromise, {store: false});
styles.forEach(storeInMap);
ready = true; ready = true;
bgReady._resolveStyles(); bgReady._resolveStyles();
} }
@ -644,56 +587,40 @@ const styleMan = (() => {
return true; return true;
} }
function urlMatchSection(query, section, skipEmptyGlobal) { function urlMatchSection(query, section) {
let dd, ddL, pp, ppL, rr, rrL, uu, uuL;
if ( if (
(dd = section.domains) && (ddL = dd.length) && dd.some(urlMatchDomain, query) || section.domains &&
(pp = section.urlPrefixes) && (ppL = pp.length) && pp.some(urlMatchPrefix, query) || section.domains.some(d => d === query.domain || query.domain.endsWith(`.${d}`))
/* Per the specification the fragment portion is ignored in @-moz-document:
https://www.w3.org/TR/2012/WD-css3-conditional-20120911/#url-of-doc
but the spec is outdated and doesn't account for SPA sites,
so we only respect it for `url()` function */
(uu = section.urls) && (uuL = uu.length) && (
uu.includes(query.url) ||
uu.includes(query.urlWithoutHash)
) ||
(rr = section.regexps) && (rrL = rr.length) && rr.some(urlMatchRegexp, query)
) { ) {
return true; return true;
} }
if (section.urlPrefixes && section.urlPrefixes.some(p => p && query.url.startsWith(p))) {
return true;
}
// as per spec the fragment portion is ignored in @-moz-document:
// https://www.w3.org/TR/2012/WD-css3-conditional-20120911/#url-of-doc
// but the spec is outdated and doesn't account for SPA sites
// so we only respect it for `url()` function
if (section.urls && (
section.urls.includes(query.url) ||
section.urls.includes(query.urlWithoutHash)
)) {
return true;
}
if (section.regexps && section.regexps.some(r => compileRe(r).test(query.url))) {
return true;
}
/* /*
According to CSS4 @document specification the entire URL must match. According to CSS4 @document specification the entire URL must match.
Stylish-for-Chrome implemented it incorrectly since the very beginning. Stylish-for-Chrome implemented it incorrectly since the very beginning.
We'll detect styles that abuse the bug by finding the sections that We'll detect styles that abuse the bug by finding the sections that
would have been applied by Stylish but not by us as we follow the spec. would have been applied by Stylish but not by us as we follow the spec.
*/ */
if (rrL && rr.some(urlMatchRegexpSloppy, query)) { if (section.regexps && section.regexps.some(r => compileSloppyRe(r).test(query.url))) {
return 'sloppy'; return 'sloppy';
} }
// TODO: check for invalid regexps? // TODO: check for invalid regexps?
return !rrL && !ppL && !uuL && !ddL && return styleSectionGlobal(section);
!query.isOwnPage && // We allow only intentionally targeted sections for own pages
(!skipEmptyGlobal || !styleCodeEmpty(section.code));
}
/** @this {MatchQuery} */
function urlMatchDomain(d) {
const _d = this.domain;
return d === _d ||
_d[_d.length - d.length - 1] === '.' && _d.endsWith(d);
}
/** @this {MatchQuery} */
function urlMatchPrefix(p) {
return p && this.url.startsWith(p);
}
/** @this {MatchQuery} */
function urlMatchRegexp(r) {
return (!this.isOwnPage || /\bextension\b/.test(r)) &&
compileRe(r).test(this.url);
}
/** @this {MatchQuery} */
function urlMatchRegexpSloppy(r) {
return (!this.isOwnPage || /\bextension\b/.test(r)) &&
compileSloppyRe(r).test(this.url);
} }
function createCompiler(compile) { function createCompiler(compile) {
@ -733,28 +660,45 @@ const styleMan = (() => {
'$'; '$';
} }
function buildCache(cache, url, styleList) { function createMatchQuery(url) {
const query = new MatchQuery(url); let urlWithoutHash;
for (const {style, appliesTo, preview} of styleList) { let urlWithoutParams;
const code = getAppliedCode(query, preview || style); let domain;
if (code) { return {
buildCacheEntry(cache, style, code); url,
appliesTo.add(url); get urlWithoutHash() {
} if (!urlWithoutHash) {
} urlWithoutHash = url.split('#')[0];
} }
return urlWithoutHash;
function buildCacheEntry(cache, style, code = style.code) { },
cache.sections[style.id] = { get urlWithoutParams() {
code, if (!urlWithoutParams) {
id: style.id, const u = tryURL(url);
name: style.customName || style.name, urlWithoutParams = u.origin + u.pathname;
}
return urlWithoutParams;
},
get domain() {
if (!domain) {
const u = tryURL(url);
domain = u.hostname;
}
return domain;
},
}; };
} }
/** @returns {StyleObj[]} */ function buildCache(cache, url, styleList) {
function getAllAsArray() { const query = createMatchQuery(url);
return Array.from(dataMap.values(), v => v.style); for (const {style, appliesTo, preview} of styleList) {
const code = getAppliedCode(query, preview || style);
if (code) {
const id = style.id;
cache.sections[id] = {id, code};
appliesTo.add(url);
}
}
} }
/** uuidv4 helper: converts to a 4-digit hex string and adds "-" at required positions */ /** uuidv4 helper: converts to a 4-digit hex string and adds "-" at required positions */
@ -762,30 +706,66 @@ const styleMan = (() => {
return (num + 0x10000).toString(16).slice(-4) + (i >= 1 && i <= 4 ? '-' : ''); return (num + 0x10000).toString(16).slice(-4) + (i >= 1 && i <= 4 ? '-' : '');
} }
async function setOrder(data, {broadcast, calc = true, store = true, sync} = {}) {
if (!data || !data.value || deepEqual(data.value, orderWrap.value)) {
return;
}
Object.assign(orderWrap, data, sync && {_rev: Date.now()});
if (calc) {
for (const [type, group] of Object.entries(data.value)) {
const dst = order[type] = {};
group.forEach((uuid, i) => {
const id = uuidIndex.get(uuid);
if (id) dst[id] = i;
});
}
}
if (broadcast) {
msg.broadcast({method: 'styleSort', order});
}
if (store) {
await API.prefsDb.put(orderWrap, orderWrap.id);
}
if (sync) {
API.sync.putDoc(orderWrap);
}
}
//#endregion //#endregion
})(); })();
/** Creates a FIFO limit-size map. */
function createCache({size = 1000, onDeleted} = {}) {
const map = new Map();
const buffer = Array(size);
let index = 0;
let lastIndex = 0;
return {
get(id) {
const item = map.get(id);
return item && item.data;
},
set(id, data) {
if (map.size === size) {
// full
map.delete(buffer[lastIndex].id);
if (onDeleted) {
onDeleted(buffer[lastIndex].id, buffer[lastIndex].data);
}
lastIndex = (lastIndex + 1) % size;
}
const item = {id, data, index};
map.set(id, item);
buffer[index] = item;
index = (index + 1) % size;
},
delete(id) {
const item = map.get(id);
if (!item) {
return false;
}
map.delete(item.id);
const lastItem = buffer[lastIndex];
lastItem.index = item.index;
buffer[item.index] = lastItem;
lastIndex = (lastIndex + 1) % size;
if (onDeleted) {
onDeleted(item.id, item.data);
}
return true;
},
clear() {
map.clear();
index = lastIndex = 0;
},
has: id => map.has(id),
*entries() {
for (const [id, item] of map) {
yield [id, item.data];
}
},
*values() {
for (const item of map.values()) {
yield item.data;
}
},
get size() {
return map.size;
},
};
}

View File

@ -56,7 +56,6 @@
return NOP; return NOP;
} }
return API.styles.getSectionsByUrl(url, id).then(sections => { return API.styles.getSectionsByUrl(url, id).then(sections => {
delete sections.cfg;
const tasks = []; const tasks = [];
for (const section of Object.values(sections)) { for (const section of Object.values(sections)) {
const styleId = section.id; const styleId = section.id;

View File

@ -1,5 +1,5 @@
/* global API */// msg.js /* global API */// msg.js
/* global CHROME URLS ignoreChromeError */// toolbox.js /* global CHROME ignoreChromeError */// toolbox.js
/* global prefs */ /* global prefs */
'use strict'; 'use strict';
@ -49,12 +49,6 @@
if (CHROME && !off) { if (CHROME && !off) {
chrome.webNavigation.onCommitted.addListener(injectData, {url: [{urlPrefix: 'http'}]}); chrome.webNavigation.onCommitted.addListener(injectData, {url: [{urlPrefix: 'http'}]});
} }
if (CHROME) {
chrome.webRequest.onBeforeRequest.addListener(openNamedStyle, {
urls: [URLS.ownOrigin + '*.user.css'],
types: ['main_frame'],
}, ['blocking']);
}
state.csp = csp; state.csp = csp;
state.off = off; state.off = off;
state.xhr = xhr; state.xhr = xhr;
@ -152,14 +146,6 @@
} }
} }
/** @param {chrome.webRequest.WebRequestBodyDetails} req */
function openNamedStyle(req) {
if (!req.url.includes('?')) { // skipping our usercss installer
chrome.tabs.update(req.tabId, {url: 'edit.html?id=' + req.url.split('#')[1]});
return {cancel: true};
}
}
function req2key(req) { function req2key(req) {
return req.tabId + ':' + req.frameId; return req.tabId + ':' + req.frameId;
} }

View File

@ -1,10 +1,8 @@
/* global API msg */// msg.js /* global API msg */// msg.js
/* global bgReady uuidIndex */// common.js /* global chromeLocal */// storage-util.js
/* global chromeLocal chromeSync */// storage-util.js /* global compareRevision */// common.js
/* global db */
/* global iconMan */ /* global iconMan */
/* global prefs */ /* global prefs */
/* global styleUtil */
/* global tokenMan */ /* global tokenMan */
'use strict'; 'use strict';
@ -20,7 +18,6 @@ const syncMan = (() => {
disconnecting: 'disconnecting', disconnecting: 'disconnecting',
}); });
const STORAGE_KEY = 'sync/state/'; const STORAGE_KEY = 'sync/state/';
const NO_LOGIN = ['webdav'];
const status = /** @namespace SyncManager.Status */ { const status = /** @namespace SyncManager.Status */ {
STATES, STATES,
state: STATES.disconnected, state: STATES.disconnected,
@ -30,12 +27,11 @@ const syncMan = (() => {
errorMessage: null, errorMessage: null,
login: false, login: false,
}; };
const compareRevision = (rev1, rev2) => rev1 - rev2;
let lastError = null; let lastError = null;
let ctrl; let ctrl;
let currentDrive; let currentDrive;
/** @type {Promise|boolean} will be `true` to avoid wasting a microtask tick on each `await` */ /** @type {Promise|boolean} will be `true` to avoid wasting a microtask tick on each `await` */
let ready = bgReady.styles.then(() => { let ready = prefs.ready.then(() => {
ready = true; ready = true;
prefs.subscribe('sync.enabled', prefs.subscribe('sync.enabled',
(_, val) => val === 'none' (_, val) => val === 'none'
@ -82,21 +78,11 @@ const syncMan = (() => {
} }
}, },
async putDoc({_id, _rev}) { async put(...args) {
if (ready.then) await ready; if (ready.then) await ready;
if (!currentDrive) return; if (!currentDrive) return;
schedule(); schedule();
return ctrl.put(_id, _rev); return ctrl.put(...args);
},
async setDriveOptions(driveName, options) {
const key = `secure/sync/driveOptions/${driveName}`;
await chromeSync.setValue(key, options);
},
async getDriveOptions(driveName) {
const key = `secure/sync/driveOptions/${driveName}`;
return await chromeSync.getValue(key) || {};
}, },
async start(name, fromPref = false) { async start(name, fromPref = false) {
@ -104,14 +90,14 @@ const syncMan = (() => {
if (!ctrl) await initController(); if (!ctrl) await initController();
if (currentDrive) return; if (currentDrive) return;
currentDrive = await getDrive(name); currentDrive = getDrive(name);
ctrl.use(currentDrive); ctrl.use(currentDrive);
status.state = STATES.connecting; status.state = STATES.connecting;
status.currentDriveName = currentDrive.name; status.currentDriveName = currentDrive.name;
emitStatusChange(); emitStatusChange();
if (fromPref || NO_LOGIN.includes(currentDrive.name)) { if (fromPref) {
status.login = true; status.login = true;
} else { } else {
try { try {
@ -179,35 +165,19 @@ const syncMan = (() => {
//#region Utils //#region Utils
async function initController() { async function initController() {
await require(['/vendor/db-to-cloud/db-to-cloud']); /* global dbToCloud */ await require(['/vendor/db-to-cloud/db-to-cloud.min']); /* global dbToCloud */
ctrl = dbToCloud.dbToCloud({ ctrl = dbToCloud.dbToCloud({
onGet: styleUtil.uuid2style, onGet(id) {
async onPut(doc) { return API.styles.getByUUID(id);
const id = uuidIndex.get(doc._id);
const oldCust = uuidIndex.custom[id];
const oldDoc = oldCust || styleUtil.id2style(id);
const diff = oldDoc ? compareRevision(oldDoc._rev, doc._rev) : -1;
if (!diff) return;
if (diff > 0) {
syncMan.putDoc(oldDoc);
} else if (oldCust) {
uuidIndex.custom[id] = doc;
} else {
delete doc.id;
if (id) doc.id = id;
doc.id = await db.styles.put(doc);
await styleUtil.handleSave(doc, {reason: 'sync'});
}
}, },
onDelete(_id, rev) { onPut(doc) {
const id = uuidIndex.get(_id); return API.styles.putByUUID(doc);
const oldDoc = styleUtil.id2style(id); },
return oldDoc && onDelete(id, rev) {
compareRevision(oldDoc._rev, rev) <= 0 && return API.styles.deleteByUUID(id, rev);
API.styles.delete(id, 'sync');
}, },
async onFirstSync() { async onFirstSync() {
for (const i of Object.values(uuidIndex.custom).concat(await API.styles.getAll())) { for (const i of await API.styles.getAll()) {
ctrl.put(i._id, i._rev); ctrl.put(i._id, i._rev);
} }
}, },
@ -270,25 +240,15 @@ const syncMan = (() => {
} }
} }
async function getDrive(name) { function getDrive(name) {
if (name === 'dropbox' || name === 'google' || name === 'onedrive' || name === 'webdav') { if (name === 'dropbox' || name === 'google' || name === 'onedrive') {
const options = await syncMan.getDriveOptions(name); return dbToCloud.drive[name]({
options.getAccessToken = () => tokenMan.getToken(name); getAccessToken: () => tokenMan.getToken(name),
options.fetch = name === 'webdav' ? fetchWebDAV.bind(options) : fetch; });
return dbToCloud.drive[name](options);
} }
throw new Error(`unknown cloud name: ${name}`); throw new Error(`unknown cloud name: ${name}`);
} }
/** @this {Object} DriveOptions */
function fetchWebDAV(url, init = {}) {
init.credentials = 'omit'; // circumventing nextcloud CSRF token error
init.headers = Object.assign({}, init.headers, {
Authorization: `Basic ${btoa(`${this.username || ''}:${this.password || ''}`)}`,
});
return fetch(url, init);
}
function schedule(delay = SYNC_DELAY) { function schedule(delay = SYNC_DELAY) {
chrome.alarms.create('syncNow', { chrome.alarms.create('syncNow', {
delayInMinutes: delay, // fractional values are supported delayInMinutes: delay, // fractional values are supported

View File

@ -44,6 +44,9 @@ const tokenMan = (() => {
clientSecret: '9Pj=TpsrStq8K@1BiwB9PIWLppM:@s=w', clientSecret: '9Pj=TpsrStq8K@1BiwB9PIWLppM:@s=w',
authURL: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize', authURL: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
tokenURL: 'https://login.microsoftonline.com/common/oauth2/v2.0/token', tokenURL: 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
redirect_uri: FIREFOX ?
'https://clngdbkpkpeebahjckkjfobafhncgmne.chromiumapp.org/' :
'https://' + location.hostname + '.chromiumapp.org/',
scopes: ['Files.ReadWrite.AppFolder', 'offline_access'], scopes: ['Files.ReadWrite.AppFolder', 'offline_access'],
}, },
userstylesworld: { userstylesworld: {
@ -57,9 +60,8 @@ const tokenMan = (() => {
}, },
}; };
const NETWORK_LATENCY = 30; // seconds const NETWORK_LATENCY = 30; // seconds
const DEFAULT_REDIRECT_URI = 'https://clngdbkpkpeebahjckkjfobafhncgmne.chromiumapp.org/';
let alwaysUseTab = !chrome.windows || (FIREFOX ? false : null); let alwaysUseTab = FIREFOX ? false : null;
class TokenError extends Error { class TokenError extends Error {
constructor(provider, message) { constructor(provider, message) {
@ -144,14 +146,14 @@ const tokenMan = (() => {
} }
async function authUser(keys, name, interactive = false, hooks = null) { async function authUser(keys, name, interactive = false, hooks = null) {
await require(['/vendor/webext-launch-web-auth-flow/webext-launch-web-auth-flow']); await require(['/vendor/webext-launch-web-auth-flow/webext-launch-web-auth-flow.min']);
/* global webextLaunchWebAuthFlow */ /* global webextLaunchWebAuthFlow */
const provider = AUTH[name]; const provider = AUTH[name];
const state = Math.random().toFixed(8).slice(2); const state = Math.random().toFixed(8).slice(2);
const query = { const query = {
response_type: provider.flow, response_type: provider.flow,
client_id: provider.clientId, client_id: provider.clientId,
redirect_uri: provider.redirect_uri || DEFAULT_REDIRECT_URI, redirect_uri: provider.redirect_uri || chrome.identity.getRedirectURL(),
state, state,
}; };
if (provider.scopes) { if (provider.scopes) {
@ -167,13 +169,13 @@ const tokenMan = (() => {
const url = `${provider.authURL}?${new URLSearchParams(query)}`; const url = `${provider.authURL}?${new URLSearchParams(query)}`;
const width = Math.min(screen.availWidth - 100, 800); const width = Math.min(screen.availWidth - 100, 800);
const height = Math.min(screen.availHeight - 100, 800); const height = Math.min(screen.availHeight - 100, 800);
const wnd = !alwaysUseTab && await browser.windows.getLastFocused(); const wnd = await browser.windows.getLastFocused();
const finalUrl = await webextLaunchWebAuthFlow({ const finalUrl = await webextLaunchWebAuthFlow({
url, url,
alwaysUseTab, alwaysUseTab,
interactive, interactive,
redirect_uri: query.redirect_uri, redirect_uri: query.redirect_uri,
windowOptions: wnd && Object.assign({ windowOptions: Object.assign({
state: 'normal', state: 'normal',
width, width,
height, height,
@ -248,7 +250,7 @@ const tokenMan = (() => {
// Workaround for https://github.com/openstyles/stylus/issues/1182 // Workaround for https://github.com/openstyles/stylus/issues/1182
// Note that modern Vivaldi isn't exposed in `navigator.userAgent` but it adds `extData` to tabs // Note that modern Vivaldi isn't exposed in `navigator.userAgent` but it adds `extData` to tabs
const anyTab = await getActiveTab() || (await browser.tabs.query({}))[0]; const anyTab = await getActiveTab() || (await browser.tabs.query({}))[0];
if (anyTab && !(anyTab.extData || anyTab.vivExtData)) { if (anyTab && !anyTab.extData) {
return false; return false;
} }
let bugged = true; let bugged = true;

View File

@ -1,6 +1,6 @@
/* global API */// msg.js /* global API */// msg.js
/* global RX_META URLS debounce deepMerge download ignoreChromeError */// toolbox.js /* global RX_META URLS debounce download ignoreChromeError */// toolbox.js
/* global calcStyleDigest styleSectionsEqual */ // sections-util.js /* global calcStyleDigest styleJSONseemsValid styleSectionsEqual */ // sections-util.js
/* global chromeLocal */// storage-util.js /* global chromeLocal */// storage-util.js
/* global compareVersion */// cmpver.js /* global compareVersion */// cmpver.js
/* global db */ /* global db */
@ -23,7 +23,6 @@ const updateMan = (() => {
ERROR_JSON: 'error: JSON is invalid', ERROR_JSON: 'error: JSON is invalid',
ERROR_VERSION: 'error: version is older than installed style', ERROR_VERSION: 'error: version is older than installed style',
}; };
const USO_STYLES_API = `${URLS.uso}api/v1/styles/`;
const RH_ETAG = {responseHeaders: ['etag']}; // a hashsum of file contents const RH_ETAG = {responseHeaders: ['etag']}; // a hashsum of file contents
const RX_DATE2VER = new RegExp([ const RX_DATE2VER = new RegExp([
/^(\d{4})/, /^(\d{4})/,
@ -38,7 +37,6 @@ const updateMan = (() => {
503, // service unavailable 503, // service unavailable
429, // too many requests 429, // too many requests
]; ];
let usoReferers = 0;
let lastUpdateTime; let lastUpdateTime;
let checkingAll = false; let checkingAll = false;
let logQueue = []; let logQueue = [];
@ -65,7 +63,7 @@ const updateMan = (() => {
checkingAll = true; checkingAll = true;
const port = observe && chrome.runtime.connect({name: 'updater'}); const port = observe && chrome.runtime.connect({name: 'updater'});
const styles = (await API.styles.getAll()) const styles = (await API.styles.getAll())
.filter(style => style.updateUrl && style.updatable !== false); .filter(style => style.updateUrl);
if (port) port.postMessage({count: styles.length}); if (port) port.postMessage({count: styles.length});
log(''); log('');
log(`${save ? 'Scheduled' : 'Manual'} update check for ${styles.length} styles`); log(`${save ? 'Scheduled' : 'Manual'} update check for ${styles.length} styles`);
@ -80,17 +78,17 @@ const updateMan = (() => {
/** /**
* @param {{ * @param {{
id?: number, id?: number
style?: StyleObj, style?: StyleObj
port?: chrome.runtime.Port, port?: chrome.runtime.Port
save?: boolean, save?: boolean = true
ignoreDigest?: boolean, ignoreDigest?: boolean
}} opts }} opts
* @returns {{ * @returns {{
style: StyleObj, style: StyleObj
updated?: boolean, updated?: boolean
error?: any, error?: any
STATES: UpdaterStates, STATES: UpdaterStates
}} }}
Original style digests are calculated in these cases: Original style digests are calculated in these cases:
@ -115,13 +113,12 @@ const updateMan = (() => {
save, save,
} = opts; } = opts;
if (!id) id = style.id; if (!id) id = style.id;
const {md5Url} = style; const ucd = style.usercssData;
let {usercssData: ucd, updateUrl} = style;
let res, state; let res, state;
try { try {
await checkIfEdited(); await checkIfEdited();
res = { res = {
style: await (ucd && !md5Url ? updateUsercss : updateUSO)().then(maybeSave), style: await (ucd ? updateUsercss : updateUSO)().then(maybeSave),
updated: true, updated: true,
}; };
state = STATES.UPDATED; state = STATES.UPDATED;
@ -130,7 +127,7 @@ const updateMan = (() => {
err && err.message || err && err.message ||
err; err;
res = {error, style, STATES}; res = {error, style, STATES};
state = `${STATES.SKIPPED} (${Array.isArray(err) ? err[0].message : error})`; state = `${STATES.SKIPPED} (${error})`;
} }
log(`${state} #${id} ${style.customName || style.name}`); log(`${state} #${id} ${style.customName || style.name}`);
if (port) port.postMessage(res); if (port) port.postMessage(res);
@ -145,45 +142,76 @@ const updateMan = (() => {
} }
async function updateUSO() { async function updateUSO() {
const md5 = await tryDownload(md5Url); const url = URLS.makeUsoArchiveCodeUrl(style.md5Url.match(/\d+/)[0]);
const req = await tryDownload(url, RH_ETAG).catch(() => null);
if (req) {
return updateToUSOArchive(url, req);
}
const md5 = await tryDownload(style.md5Url);
if (!md5 || md5.length !== 32) { if (!md5 || md5.length !== 32) {
return Promise.reject(STATES.ERROR_MD5); return Promise.reject(STATES.ERROR_MD5);
} }
if (md5 === style.originalMd5 && style.originalDigest && !ignoreDigest) { if (md5 === style.originalMd5 && style.originalDigest && !ignoreDigest) {
return Promise.reject(STATES.SAME_MD5); return Promise.reject(STATES.SAME_MD5);
} }
let varsUrl = ''; const json = await tryDownload(style.updateUrl, {responseType: 'json'});
if (!ucd) { if (!styleJSONseemsValid(json)) {
ucd = {}; return Promise.reject(STATES.ERROR_JSON);
varsUrl = updateUrl;
updateUrl = style.updateUrl = `${USO_STYLES_API}${md5Url.match(/\/(\d+)/)[1]}`;
}
usoSpooferStart();
let json;
try {
json = await tryDownload(style.updateUrl, {responseType: 'json'});
json = await updateUsercss(json.css) ||
(await API.uso.toUsercss(json)).style;
if (varsUrl) await API.uso.useVarsUrl(json, varsUrl);
} finally {
usoSpooferStop();
} }
// USO may not provide a correctly updated originalMd5 (#555) // USO may not provide a correctly updated originalMd5 (#555)
json.originalMd5 = md5; json.originalMd5 = md5;
return json; return json;
} }
async function updateUsercss(css) { async function updateToUSOArchive(url, req) {
const m2 = getUsoEmbeddedMeta(req.response);
if (m2) {
url = (await m2).updateUrl;
req = await tryDownload(url, RH_ETAG);
}
const json = await API.usercss.buildMeta({
id,
etag: req.headers.etag,
md5Url: null,
originalMd5: null,
sourceCode: req.response,
updateUrl: url,
url: URLS.extractUsoArchiveInstallUrl(url),
});
const varUrlValues = style.updateUrl.split('?')[1];
const varData = json.usercssData.vars;
if (varUrlValues && varData) {
const IK = 'ik-';
const IK_LEN = IK.length;
for (let [key, val] of new URLSearchParams(varUrlValues)) {
if (!key.startsWith(IK)) continue;
key = key.slice(IK_LEN);
const varDef = varData[key];
if (!varDef) continue;
if (varDef.options) {
let sel = val.startsWith(IK) && getVarOptByName(varDef, val.slice(IK_LEN));
if (!sel) {
key += '-custom';
sel = getVarOptByName(varDef, key + '-dropdown');
if (sel) varData[key].value = val;
}
if (sel) varDef.value = sel.name;
} else {
varDef.value = val;
}
}
}
return API.usercss.buildCode(json);
}
async function updateUsercss() {
let oldVer = ucd.version; let oldVer = ucd.version;
let {etag: oldEtag, updateUrl} = style; let {etag: oldEtag, updateUrl} = style;
const m2 = (css || URLS.extractUsoArchiveId(updateUrl)) && let m2 = URLS.extractUsoArchiveId(updateUrl) && getUsoEmbeddedMeta();
await getUsoEmbeddedMeta(css); if (m2 && (m2 = await m2).updateUrl) {
if (m2 && m2.updateUrl) {
updateUrl = m2.updateUrl; updateUrl = m2.updateUrl;
oldVer = m2.usercssData.version || '0'; oldVer = m2.usercssData.version || '0';
oldEtag = ''; oldEtag = '';
} else if (css) {
return;
} }
if (oldEtag && oldEtag === await downloadEtag()) { if (oldEtag && oldEtag === await downloadEtag()) {
return Promise.reject(STATES.SAME_CODE); return Promise.reject(STATES.SAME_CODE);
@ -206,7 +234,7 @@ const updateMan = (() => {
if (err && etag && !style.etag) { if (err && etag && !style.etag) {
// first check of ETAG, gonna write it directly to DB as it's too trivial to sync or announce // first check of ETAG, gonna write it directly to DB as it's too trivial to sync or announce
style.etag = etag; style.etag = etag;
await db.styles.put(style); await db.exec('put', style);
} }
return err return err
? Promise.reject(err) ? Promise.reject(err)
@ -236,7 +264,6 @@ const updateMan = (() => {
let {retryDelay = 1000} = opts; let {retryDelay = 1000} = opts;
while (true) { while (true) {
try { try {
params = deepMerge(params || {}, {headers: {'Cache-Control': 'no-cache'}});
return await download(url, params); return await download(url, params);
} catch (code) { } catch (code) {
if (!RETRY_ERRORS.includes(code) || if (!RETRY_ERRORS.includes(code) ||
@ -256,7 +283,8 @@ const updateMan = (() => {
} }
function getDateFromVer(style) { function getDateFromVer(style) {
const m = RX_DATE2VER.exec((style.usercssData || {}).version); const m = URLS.extractUsoArchiveId(style.updateUrl) &&
style.usercssData.version.match(RX_DATE2VER);
if (m) { if (m) {
m[2]--; // month is 0-based in `Date` constructor m[2]--; // month is 0-based in `Date` constructor
return new Date(...m.slice(1)).getTime(); return new Date(...m.slice(1)).getTime();
@ -265,10 +293,13 @@ const updateMan = (() => {
/** UserCSS metadata may be embedded in the original USO style so let's use its updateURL */ /** UserCSS metadata may be embedded in the original USO style so let's use its updateURL */
function getUsoEmbeddedMeta(code = style.sourceCode) { function getUsoEmbeddedMeta(code = style.sourceCode) {
const isRaw = arguments[0]; const m = code.includes('@updateURL') && code.replace(RX_META, '').match(RX_META);
const m = code.includes('@updateURL') && (isRaw ? code : code.replace(RX_META, '')).match(RX_META);
return m && API.usercss.buildMeta({sourceCode: m[0]}).catch(() => null); return m && API.usercss.buildMeta({sourceCode: m[0]}).catch(() => null);
} }
function getVarOptByName(varDef, name) {
return varDef.options.find(o => o.name === name);
}
} }
function schedule() { function schedule() {
@ -317,32 +348,4 @@ const updateMan = (() => {
logLastWriteTime = Date.now(); logLastWriteTime = Date.now();
logQueue = []; logQueue = [];
} }
function usoSpooferStart() {
if (++usoReferers === 1) {
chrome.webRequest.onBeforeSendHeaders.addListener(
usoSpoofer,
{types: ['xmlhttprequest'], urls: [USO_STYLES_API + '*']},
['blocking', 'requestHeaders', chrome.webRequest.OnBeforeSendHeadersOptions.EXTRA_HEADERS]
.filter(Boolean));
}
}
function usoSpooferStop() {
if (--usoReferers <= 0) {
usoReferers = 0;
chrome.webRequest.onBeforeSendHeaders.removeListener(usoSpoofer);
}
}
/** @param {chrome.webRequest.WebResponseHeadersDetails | browser.webRequest._OnBeforeSendHeadersDetails} info */
function usoSpoofer(info) {
if (info.tabId < 0 && URLS.ownOrigin.startsWith(info.initiator || info.originUrl || '')) {
const {requestHeaders: hh} = info;
const i = (hh.findIndex(h => /^referer$/i.test(h.name)) + 1 || hh.push({})) - 1;
hh[i].name = 'referer';
hh[i].value = URLS.uso;
return {requestHeaders: hh};
}
}
})(); })();

View File

@ -74,10 +74,6 @@ bgReady.all.then(() => {
) && download(url); ) && download(url);
} }
function makeInstallerUrl(url) {
return `${URLS.installUsercss}?updateUrl=${encodeURIComponent(url)}`;
}
function makeUsercssGlobs(host, path) { function makeUsercssGlobs(host, path) {
return '%css,%css?*,%styl,%styl?*'.replace(/%/g, `*://${host}${path}.user.`).split(','); return '%css,%css?*,%styl,%styl?*'.replace(/%/g, `*://${host}${path}.user.`).split(',');
} }
@ -86,11 +82,11 @@ bgReady.all.then(() => {
if (url.includes('.user.') && if (url.includes('.user.') &&
/^(https?|file|ftps?):/.test(url) && /^(https?|file|ftps?):/.test(url) &&
/\.user\.(css|styl)$/.test(url.split(/[#?]/, 1)[0]) && /\.user\.(css|styl)$/.test(url.split(/[#?]/, 1)[0]) &&
!oldUrl.startsWith(makeInstallerUrl(url))) { !oldUrl.startsWith(URLS.installUsercss)) {
const inTab = url.startsWith('file:') && !chrome.app; const inTab = url.startsWith('file:') && !chrome.app;
const code = await (inTab ? loadFromFile : loadFromUrl)(tabId, url); const code = await (inTab ? loadFromFile : loadFromUrl)(tabId, url);
if (!/^\s*</.test(code) && RX_META.test(code)) { if (!/^\s*</.test(code) && RX_META.test(code)) {
await openInstallerPage(tabId, url, {code, inTab}); openInstallerPage(tabId, url, {code, inTab});
} }
} }
} }
@ -103,33 +99,25 @@ bgReady.all.then(() => {
openInstallerPage(tabId, url, {}); openInstallerPage(tabId, url, {});
// Silently suppress navigation. // Silently suppress navigation.
// Don't redirect to the install URL as it'll flash the text! // Don't redirect to the install URL as it'll flash the text!
return {cancel: true}; return {redirectUrl: 'javascript:void 0'}; // eslint-disable-line no-script-url
} }
} }
async function openInstallerPage(tabId, url, {code, inTab} = {}) { function openInstallerPage(tabId, url, {code, inTab} = {}) {
const newUrl = makeInstallerUrl(url); const newUrl = `${URLS.installUsercss}?updateUrl=${encodeURIComponent(url)}`;
if (inTab) { if (inTab) {
const tab = await browser.tabs.get(tabId); browser.tabs.get(tabId).then(tab =>
return openURL({ openURL({
url: `${newUrl}&tabId=${tabId}`, url: `${newUrl}&tabId=${tabId}`,
active: tab.active, active: tab.active,
index: tab.index + 1, index: tab.index + 1,
openerTabId: tabId, openerTabId: tabId,
currentWindow: null, currentWindow: null,
}); }));
} } else {
const timer = setTimeout(clearInstallCode, 10e3, url); const timer = setTimeout(clearInstallCode, 10e3, url);
installCodeCache[url] = {code, timer}; installCodeCache[url] = {code, timer};
try { chrome.tabs.update(tabId, {url: newUrl});
await browser.tabs.update(tabId, {url: newUrl});
} catch (err) {
// FIXME: remove this when kiwi supports tabs.update
// https://github.com/openstyles/stylus/issues/1367
if (/Tabs cannot be edited right now/i.test(err.message)) {
return browser.tabs.create({url: newUrl});
}
throw err;
} }
} }

View File

@ -12,12 +12,10 @@ const usercssMan = {
name: null, name: null,
}), }),
/** `src` is a style or vars */ async assignVars(style, oldStyle) {
async assignVars(style, src) {
const meta = style.usercssData; const meta = style.usercssData;
const meta2 = src.usercssData; const vars = meta.vars;
const {vars} = meta; const oldVars = (oldStyle.usercssData || {}).vars;
const oldVars = meta2 ? meta2.vars : src;
if (vars && oldVars) { if (vars && oldVars) {
// The type of var might be changed during the update. Set value to null if the value is invalid. // The type of var might be changed during the update. Set value to null if the value is invalid.
for (const [key, v] of Object.entries(vars)) { for (const [key, v] of Object.entries(vars)) {
@ -45,7 +43,7 @@ const usercssMan = {
let log; let log;
if (!metaOnly) { if (!metaOnly) {
if (vars || assignVars) { if (vars || assignVars) {
await usercssMan.assignVars(style, vars || dup); await usercssMan.assignVars(style, vars ? {usercssData: {vars}} : dup);
} }
await usercssMan.buildCode(style); await usercssMan.buildCode(style);
log = style.log; // extracting the non-enumerable prop, otherwise it won't survive messaging log = style.log; // extracting the non-enumerable prop, otherwise it won't survive messaging
@ -139,18 +137,17 @@ const usercssMan = {
} }
}, },
async install(style, opts) { async install(style) {
return API.styles.install(await usercssMan.parse(style, opts)); return API.styles.install(await usercssMan.parse(style));
}, },
async parse(style, {dup, vars} = {}) { async parse(style) {
style = await usercssMan.buildMeta(style); style = await usercssMan.buildMeta(style);
// preserve style.vars during update // preserve style.vars during update
if (dup || (dup = await usercssMan.find(style))) { const dup = await usercssMan.find(style);
if (dup) {
style.id = dup.id; style.id = dup.id;
} await usercssMan.assignVars(style, dup);
if (vars || (vars = dup)) {
await usercssMan.assignVars(style, vars);
} }
return usercssMan.buildCode(style); return usercssMan.buildCode(style);
}, },

View File

@ -1,158 +0,0 @@
/* global URLS stringAsRegExp */// toolbox.js
/* global usercssMan */
'use strict';
const usoApi = {};
(() => {
const pingers = {};
usoApi.pingback = (usoId, delay) => {
clearTimeout(pingers[usoId]);
delete pingers[usoId];
if (delay > 0) {
return new Promise(resolve => (pingers[usoId] = setTimeout(ping, delay, usoId, resolve)));
} else if (delay !== false) {
return ping(usoId);
}
};
/**
* Replicating USO-Archive format
* https://github.com/33kk/uso-archive/blob/flomaster/lib/uso.js
* https://github.com/33kk/uso-archive/blob/flomaster/lib/converters.js
*/
usoApi.toUsercss = async (data, {metaOnly = true, varsUrl} = {}) => {
const badKeys = {};
const newKeys = [];
const descr = JSON.stringify(data.description.trim());
const vars = (data.style_settings || []).map(makeVar, {badKeys, newKeys}).join('');
const sourceCode = `\
/* ==UserStyle==
@name ${data.name}
@namespace USO Archive
@version ${data.updated.replace(/-/g, '').replace(/[T:]/g, '.').slice(0, 14)}
@description ${/^"['`]|\\/.test(descr) ? descr : descr.slice(1, -1)}
@author ${(data.user || {}).name || '?'}
@license ${makeLicense(data.license)}${vars ? '\n@preprocessor uso' + vars : ''}`
.replace(/\*\//g, '*\\/') +
`==/UserStyle== */\n${newKeys[0] ? useNewKeys(data.css, badKeys) : data.css}`;
const {style} = await usercssMan.build({sourceCode, metaOnly});
usoApi.useVarsUrl(style, varsUrl);
return {style, badKeys, newKeys};
};
usoApi.useVarsUrl = (style, url) => {
if (!/\?ik-/.test(url)) {
return;
}
const cfg = {badKeys: {}, newKeys: []};
const {vars} = style.usercssData;
if (!vars) {
return;
}
for (let [key, val] of new URLSearchParams(url.split('?')[1])) {
if (!key.startsWith('ik-')) continue;
key = makeKey(key.slice(3), cfg);
const v = vars[key];
if (!v) continue;
if (v.options) {
let sel = val.startsWith('ik-') && optByName(v, makeKey(val.slice(3), cfg));
if (!sel) {
key += '-custom';
sel = optByName(v, key + '-dropdown');
if (sel) vars[key].value = val;
}
if (sel) v.value = sel.name;
} else {
v.value = val;
}
}
return true;
};
async function ping(id, resolve) {
await fetch(`${URLS.uso}styles/install/${id}?source=stylish-ch`);
if (resolve) resolve(true);
return true;
}
function makeKey(key, {badKeys, newKeys}) {
let res = badKeys[key];
if (!res) {
res = key.replace(/[^-\w]/g, '-');
res += newKeys.includes(res) ? '-' : '';
if (key !== res) {
badKeys[key] = res;
newKeys.push(res);
}
}
return res;
}
function makeLicense(s) {
return !s ? 'NO-REDISTRIBUTION' :
s === 'publicdomain' ? 'CC0-1.0' :
s.startsWith('ccby') ? `${s.toUpperCase().match(/(..)/g).join('-')}-4.0` :
s;
}
function makeVar({
label,
setting_type: type,
install_key: ik,
style_setting_options: opts,
}) {
const cfg = this;
let value, suffix;
ik = makeKey(ik, cfg);
label = JSON.stringify(label);
switch (type) {
case 'color':
value = opts[0].value;
break;
case 'text':
value = JSON.stringify(opts[0].value);
break;
case 'image': {
const ikCust = `${ik}-custom`;
opts.push({
label: 'Custom',
install_key: `${ikCust}-dropdown`,
value: `/*[[${ikCust}]]*/`,
});
suffix = `\n@advanced text ${ikCust} ${label.slice(0, -1)} (Custom)" "https://foo.com/123.jpg"`;
type = 'dropdown';
} // fallthrough
case 'dropdown':
value = '';
for (const o of opts) {
const def = o.default ? '*' : '';
const val = o.value;
const s = ` ${makeKey(o.install_key, cfg)} ${JSON.stringify(o.label + def)} <<<EOT${
val.includes('\n') ? '\n' : ' '}${val} EOT;\n`;
value = def ? s + value : value + s;
}
value = `{\n${value}}`;
break;
default:
value = '"ERROR: unknown type"';
}
return `\n@advanced ${type} ${ik} ${label} ${value}${suffix || ''}`;
}
function optByName(v, name) {
return v.options.find(o => o.name === name);
}
function useNewKeys(css, badKeys) {
const rxsKeys = stringAsRegExp(Object.keys(badKeys).join('\n'), '', true).replace(/\n/g, '|');
const rxUsoVars = new RegExp(`(/\\*\\[\\[)(${rxsKeys})(?=]]\\*/)`, 'g');
return css.replace(rxUsoVars, (s, a, key) => a + badKeys[key]);
}
})();

View File

@ -35,7 +35,7 @@ const uswApi = (() => {
const maxKeyLen = meta.reduce((res, [k]) => Math.max(res, k.length), 0); const maxKeyLen = meta.reduce((res, [k]) => Math.max(res, k.length), 0);
return [ return [
'/* ==UserStyle==', '/* ==UserStyle==',
...meta.map(([k, v]) => v && `${k}${' '.repeat(maxKeyLen - k.length + 2)}${v}`).filter(Boolean), ...meta.map(([k, v]) => `${k}${' '.repeat(maxKeyLen - k.length + 2)}${v || ''}`),
'==/UserStyle== */', '==/UserStyle== */',
].join('\n') + '\n\n'; ].join('\n') + '\n\n';
} }
@ -77,15 +77,14 @@ const uswApi = (() => {
*/ */
async publish(id, sourceCode) { async publish(id, sourceCode) {
const style = await API.styles.get(id); const style = await API.styles.get(id);
const code = style.usercssData ? sourceCode
: fakeUsercssHeader(style) + sourceCode;
const data = (style._usw || {}).token const data = (style._usw || {}).token
? style._usw ? style._usw
: await linkStyle(style, code); : await linkStyle(style, sourceCode);
const header = style.usercssData ? '' : fakeUsercssHeader(style);
return uswFetch(`style/${data.id}`, data.token, { return uswFetch(`style/${data.id}`, data.token, {
method: 'POST', method: 'POST',
headers: {'Content-Type': 'application/json'}, headers: {'Content-Type': 'application/json'},
body: JSON.stringify({code}), body: JSON.stringify({code: header + sourceCode}),
}); });
}, },

View File

@ -5,7 +5,6 @@
(() => { (() => {
if (window.INJECTED === 1) return; if (window.INJECTED === 1) return;
window.INJECTED = 1;
/** true -> when the page styles are received, /** true -> when the page styles are received,
* false -> when disableAll mode is on at start, the styles won't be sent * false -> when disableAll mode is on at start, the styles won't be sent
@ -14,16 +13,11 @@
let hasStyles = false; let hasStyles = false;
let isDisabled = false; let isDisabled = false;
let isTab = !chrome.tabs || location.pathname !== '/popup.html'; let isTab = !chrome.tabs || location.pathname !== '/popup.html';
const order = {main: [], prio: []};
const calcOrder = ({id}) =>
(order.prio[id] || 0) * 1e6 ||
order.main[id] ||
id + .5e6; // no order = at the end of `main`
const isFrame = window !== parent; const isFrame = window !== parent;
const isFrameAboutBlank = isFrame && location.href === 'about:blank'; const isFrameAboutBlank = isFrame && location.href === 'about:blank';
const isUnstylable = !chrome.app && document instanceof XMLDocument; const isUnstylable = !chrome.app && document instanceof XMLDocument;
const styleInjector = StyleInjector({ const styleInjector = StyleInjector({
compare: (a, b) => calcOrder(a) - calcOrder(b), compare: (a, b) => a.id - b.id,
onUpdate: onInjectorUpdate, onUpdate: onInjectorUpdate,
}); });
// dynamic iframes don't have a URL yet so we'll use their parent's URL (hash isn't inherited) // dynamic iframes don't have a URL yet so we'll use their parent's URL (hash isn't inherited)
@ -44,23 +38,20 @@
/* about:blank iframes are often used by sites for file upload or background tasks /* about:blank iframes are often used by sites for file upload or background tasks
* and they may break if unexpected DOM stuff is present at `load` event * and they may break if unexpected DOM stuff is present at `load` event
* so we'll add the styles only if the iframe becomes visible */ * so we'll add the styles only if the iframe becomes visible */
const {IntersectionObserver} = window;
const xoEventId = `${Math.random()}`; const xoEventId = `${Math.random()}`;
/** @type IntersectionObserver */ /** @type IntersectionObserver */
let xo; let xo;
window[Symbol.for('xo')] = (el, cb) => { if (IntersectionObserver) {
if (!xo) xo = new IntersectionObserver(onIntersect, {rootMargin: '100%'}); window[Symbol.for('xo')] = (el, cb) => {
el.addEventListener(xoEventId, cb, {once: true}); if (!xo) xo = new IntersectionObserver(onIntersect, {rootMargin: '100%'});
xo.observe(el); el.addEventListener(xoEventId, cb, {once: true});
}; xo.observe(el);
};
// FIXME: move this to background page when following bugs are fixed: }
// https://bugzil.la/1587723, https://crbug.com/968651
const mqDark = matchMedia('(prefers-color-scheme: dark)');
mqDark.onchange = e => API.colorScheme.updateSystemPreferDark(e.matches);
mqDark.onchange(mqDark);
// Declare all vars before init() or it'll throw due to "temporal dead zone" of const/let // Declare all vars before init() or it'll throw due to "temporal dead zone" of const/let
init(); const ready = init();
// the popup needs a check as it's not a tab but can be opened in a tab manually for whatever reason // the popup needs a check as it's not a tab but can be opened in a tab manually for whatever reason
if (!isTab) { if (!isTab) {
@ -71,17 +62,19 @@
} }
msg.onTab(applyOnMessage); msg.onTab(applyOnMessage);
window.addEventListener('pageshow', e => {
if (e.isTrusted && e.persisted) { // bfcache
updateCount();
}
});
if (!chrome.tabs) { if (!chrome.tabs) {
window.dispatchEvent(new CustomEvent(orphanEventId)); window.dispatchEvent(new CustomEvent(orphanEventId));
window.addEventListener(orphanEventId, orphanCheck, true); window.addEventListener(orphanEventId, orphanCheck, true);
} }
// detect media change in content script
// FIXME: move this to background page when following bugs are fixed:
// https://bugzilla.mozilla.org/show_bug.cgi?id=1561546
// https://bugs.chromium.org/p/chromium/issues/detail?id=968651
const media = window.matchMedia('(prefers-color-scheme: dark)');
media.addListener(() => API.colorScheme.updateSystemPreferDark().catch(console.error));
function onInjectorUpdate() { function onInjectorUpdate() {
if (!isOrphaned) { if (!isOrphaned) {
updateCount(); updateCount();
@ -107,10 +100,7 @@
parentStyles && await new Promise(onFrameElementInView) && parentStyles || parentStyles && await new Promise(onFrameElementInView) && parentStyles ||
!isFrameAboutBlank && chrome.app && !chrome.tabs && tryCatch(getStylesViaXhr) || !isFrameAboutBlank && chrome.app && !chrome.tabs && tryCatch(getStylesViaXhr) ||
await API.styles.getSectionsByUrl(matchUrl, null, true); await API.styles.getSectionsByUrl(matchUrl, null, true);
if (styles.cfg) { isDisabled = styles.disableAll;
isDisabled = styles.cfg.disableAll;
Object.assign(order, styles.cfg.order);
}
hasStyles = !isDisabled; hasStyles = !isDisabled;
if (hasStyles) { if (hasStyles) {
window[SYM] = styles; window[SYM] = styles;
@ -176,11 +166,6 @@
} }
break; break;
case 'styleSort':
Object.assign(order, request.order);
styleInjector.sort();
break;
case 'urlChanged': case 'urlChanged':
if (!hasStyles && isDisabled || matchUrl === request.url) break; if (!hasStyles && isDisabled || matchUrl === request.url) break;
matchUrl = request.url; matchUrl = request.url;
@ -190,6 +175,13 @@
}); });
break; break;
case 'backgroundReady':
ready.catch(err =>
msg.isIgnorableError(err)
? init()
: console.error(err));
break;
case 'updateCount': case 'updateCount':
updateCount(); updateCount();
break; break;
@ -239,7 +231,11 @@
} }
function onFrameElementInView(cb) { function onFrameElementInView(cb) {
parent[parent.Symbol.for('xo')](frameElement, cb); if (IntersectionObserver) {
parent[parent.Symbol.for('xo')](frameElement, cb);
} else {
requestAnimationFrame(cb);
}
} }
/** @param {IntersectionObserverEntry[]} entries */ /** @param {IntersectionObserverEntry[]} entries */
@ -259,11 +255,10 @@
} }
function orphanCheck() { function orphanCheck() {
if (chrome.runtime.id) return; if (tryCatch(() => chrome.i18n.getUILanguage())) return;
// In Chrome content script is orphaned on an extension update/reload // In Chrome content script is orphaned on an extension update/reload
// so we need to detach event listeners // so we need to detach event listeners
window.removeEventListener(orphanEventId, orphanCheck, true); window.removeEventListener(orphanEventId, orphanCheck, true);
mqDark.onchange = null;
isOrphaned = true; isOrphaned = true;
setTimeout(styleInjector.clear, 1000); // avoiding FOUC setTimeout(styleInjector.clear, 1000); // avoiding FOUC
tryCatch(msg.off, applyOnMessage); tryCatch(msg.off, applyOnMessage);

View File

@ -1,324 +1,378 @@
/* global API */// msg.js /* global API msg */// msg.js
'use strict'; 'use strict';
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
/^\/styles\/(\d+)(\/([^/]*))?([?#].*)?$/.test(location.pathname) && (async () => { /^\/styles\/(\d+)(\/([^/]*))?([?#].*)?$/.test(location.pathname) && (() => {
if (window.INJECTED_USO === 1) return; const styleId = RegExp.$1;
window.INJECTED_USO = 1;
const usoId = RegExp.$1;
const USO = 'https://userstyles.org';
const apiUrl = `${USO}/api/v1/styles/${usoId}`;
const md5Url = `https://update.userstyles.org/${usoId}.md5`;
const CLICK = [
['#install_stylish_style_button', onInstall],
['#update_stylish_style_button', onInstall],
['.customize_style_button', onCustomize],
['.uninstall_stylish_style_button', onUninstall],
];
const pageEventId = `${performance.now()}${Math.random()}`; const pageEventId = `${performance.now()}${Math.random()}`;
const contentEventId = pageEventId + ':';
const orphanEventId = chrome.runtime.id; // id won't be available in the orphaned script
const $ = (sel, base = document) => base.querySelector(sel);
const toggleListener = (isOn, ...args) => (isOn ? addEventListener : removeEventListener)(...args);
const togglePageListener = isOn => toggleListener(isOn, contentEventId, onPageEvent, true);
const mo = new MutationObserver(onMutation); window.dispatchEvent(new CustomEvent(chrome.runtime.id + '-install'));
const observeColors = isOn => window.addEventListener(chrome.runtime.id + '-install', orphanCheck, true);
isOn ? mo.observe(document.body, {subtree: true, attributes: true, attributeFilter: ['value']})
: mo.disconnect();
let style, dup, md5, pageData, badKeys; document.addEventListener('stylishInstallChrome', onClick);
document.addEventListener('stylishUpdateChrome', onClick);
runInPage(inPageContext, pageEventId, contentEventId, usoId, apiUrl); msg.on(onMessage);
addEventListener(orphanEventId, orphanCheck, true);
addEventListener('click', onClick, true);
togglePageListener(true);
[md5, dup] = await Promise.all([ let currentMd5;
fetch(md5Url).then(r => r.text()), const md5Url = getMeta('stylish-md5-url') || `https://update.userstyles.org/${styleId}.md5`;
API.styles.find({md5Url}, {installationUrl: `https://uso.kkx.one/style/${usoId}`}) Promise.all([
.then(sendVarsToPage), API.styles.find({md5Url}),
document.body || new Promise(resolve => addEventListener('load', resolve, {once: true})), getResource(md5Url),
]); onDOMready(),
]).then(checkUpdatability);
if (!dup) { document.documentElement.appendChild(
sendStylishEvent('styleCanBeInstalledChrome'); Object.assign(document.createElement('script'), {
} else if (dup.originalMd5 && dup.originalMd5 !== md5 || !dup.usercssData || !dup.md5Url) { textContent: `(${inPageContext})('${pageEventId}')`,
// allow update if 1) changed, 2) is a classic USO style, 3) is from USO-archive }));
sendStylishEvent('styleCanBeUpdatedChrome');
} else {
sendStylishEvent('styleAlreadyInstalledChrome');
}
async function onClick(e) { function onMessage(msg) {
for (const [sel, fn] of CLICK) { switch (msg.method) {
const el = e.target.closest(sel); case 'ping':
if (!el) continue; // orphaned content script check
try { return true;
el.disabled = true; case 'openSettings':
await fn(e); openSettings();
} catch (e) { return true;
alert(chrome.i18n.getMessage('styleInstallFailed', e.message || e));
} finally {
el.disabled = false;
}
} }
} }
function onCustomize() { /* since we are using "stylish-code-chrome" meta key on all browsers and
const ss = $('#style-settings'); US.o does not provide "advanced settings" on this url if browser is not Chrome,
const willShow = !ss || !ss.offsetHeight; we need to fix this URL using "stylish-update-url" meta key
observeColors(willShow); */
toggleListener(willShow, 'change', onChange); function getStyleURL() {
const textUrl = getMeta('stylish-update-url') || '';
const jsonUrl = getMeta('stylish-code-chrome') ||
textUrl.replace(/styles\/(\d+)\/[^?]*/, 'styles/chrome/$1.json');
const paramsMissing = !jsonUrl.includes('?') && textUrl.includes('?');
return jsonUrl + (paramsMissing ? textUrl.replace(/^[^?]+/, '') : '');
} }
async function onInstall(e) { function checkUpdatability([installedStyle, md5]) {
const {id} = dup; // TODO: remove the following statement when USO is fixed
e.stopPropagation(); document.dispatchEvent(new CustomEvent(pageEventId, {
if (!style) await buildStyle(); detail: installedStyle && installedStyle.updateUrl,
style = dup = await API.usercss.install(style, { }));
dup: {id}, currentMd5 = md5;
vars: getPageVars(), if (!installedStyle) {
}); sendEvent({type: 'styleCanBeInstalledChrome'});
sendStylishEvent('styleInstalledChrome'); return;
API.uso.pingback(id); }
} const isCustomizable = /\?/.test(installedStyle.updateUrl);
const md5Url = getMeta('stylish-md5-url');
if (md5Url && installedStyle.md5Url && installedStyle.originalMd5) {
reportUpdatable(isCustomizable || md5 !== installedStyle.originalMd5);
} else {
getStyleJson().then(json => {
reportUpdatable(
isCustomizable ||
!json ||
!styleSectionsEqual(json, installedStyle));
});
}
function onUninstall() { function prepareInstallButton() {
const {id} = dup; return new Promise(resolve => {
dup = style = false; const observer = new MutationObserver(check);
observeColors(false); observer.observe(document.documentElement, {
removeEventListener('change', onChange); childList: true,
return API.styles.delete(id); subtree: true,
} });
check();
function onChange({target: el}) { function check() {
if (dup && el.matches('[name^="ik-"], [type=file]')) { if (document.querySelector('#install_style_button')) {
API.usercss.configVars(dup.id, getPageVars()); resolve();
observer.disconnect();
}
}
});
}
function reportUpdatable(isUpdatable) {
prepareInstallButton().then(() => {
sendEvent({
type: isUpdatable
? 'styleCanBeUpdatedChrome'
: 'styleAlreadyInstalledChrome',
detail: {
updateUrl: installedStyle.updateUrl,
},
});
});
} }
} }
function onMutation(mutations) {
for (const {target: el} of mutations) { function sendEvent(event) {
if (el.style.display === 'none' && sendEvent.lastEvent = event;
/^ik-/.test(el.name) && let {type, detail = null} = event;
/^#[\da-f]{6}$/.test(el.value)) { if (typeof cloneInto !== 'undefined') {
onChange({target: el}); // Firefox requires explicit cloning, however USO can't process our messages anyway
} // because USO tries to use a global "event" variable deprecated in Firefox
detail = cloneInto({detail}, document); /* global cloneInto */
} else {
detail = {detail};
}
document.dispatchEvent(new CustomEvent(type, detail));
}
function onClick(event) {
if (onClick.processing || !orphanCheck()) {
return;
}
onClick.processing = true;
doInstall()
.then(() => {
if (!event.type.includes('Update')) {
// FIXME: sometimes the button is broken i.e. the button sends
// 'install' instead of 'update' event while the style is already
// install.
// This triggers an incorrect install count but we don't really care.
return getResource(getMeta('stylish-install-ping-url-chrome'));
}
})
.catch(console.error)
.then(done);
function done() {
setTimeout(() => {
onClick.processing = false;
});
} }
} }
function onPageEvent(e) { function doInstall() {
pageData = e.detail; let oldStyle;
togglePageListener(false); return API.styles.find({
md5Url: getMeta('stylish-md5-url') || location.href,
})
.then(_oldStyle => {
oldStyle = _oldStyle;
return oldStyle ?
oldStyle.name :
getResource(getMeta('stylish-description'));
})
.then(name => {
const props = {};
if (oldStyle) {
props.id = oldStyle.id;
}
return saveStyleCode(oldStyle ? 'styleUpdate' : 'styleInstall', name, props);
});
} }
async function buildStyle() { async function saveStyleCode(message, name, addProps = {}) {
if (!pageData) pageData = await (await fetch(apiUrl)).json(); const isNew = message === 'styleInstall';
({style, badKeys} = await API.uso.toUsercss(pageData, {varsUrl: dup.updateUrl})); const needsConfirmation = isNew || !saveStyleCode.confirmed;
Object.assign(style, { if (needsConfirmation && !confirm(chrome.i18n.getMessage(message, [name]))) {
md5Url, return Promise.reject();
id: dup.id, }
originalMd5: md5, saveStyleCode.confirmed = true;
updateUrl: apiUrl, enableUpdateButton(false);
}); const json = await getStyleJson();
} if (!json) {
prompt(chrome.i18n.getMessage('styleInstallFailed', ''),
'https://github.com/openstyles/stylus/issues/195');
return;
}
// Update originalMd5 since USO changed it (2018-11-11) to NOT match the current md5
const style = await API.styles.install(Object.assign(json, addProps, {originalMd5: currentMd5}));
if (!isNew && style.updateUrl.includes('?')) {
enableUpdateButton(true);
} else {
sendEvent({type: 'styleInstalledChrome'});
}
function getPageVars() { function enableUpdateButton(state) {
const {vars} = (style || dup).usercssData; const important = s => s.replace(/;/g, '!important;');
for (const el of document.querySelectorAll('[name^="ik-"]')) { const button = document.getElementById('update_style_button');
const name = el.name.slice(3); // dropping "ik-" if (button) {
const ik = (badKeys || {})[name] || name; button.style.cssText = state ? '' : important('pointer-events: none; opacity: .35;');
const v = vars[ik] || false; const icon = button.querySelector('img[src*=".svg"]');
const isImage = el.type === 'radio'; if (icon) {
if (v && (!isImage || el.checked)) { icon.style.cssText = state ? '' : important('transition: transform 5s; transform: rotate(0);');
const val = el.value; if (state) {
const isFile = val === 'user-upload'; setTimeout(() => (icon.style.cssText += important('transform: rotate(10turn);')));
if (isImage && (isFile || val === 'user-url')) { }
const el2 = $(`[type=${isFile ? 'file' : 'url'}]`, el.parentElement);
const ikCust = `${ik}-custom`;
v.value = `${ikCust}-dropdown`;
vars[ikCust].value = isFile ? getFileUriFromPage(el2) : el2.value;
} else {
v.value = v.type === 'select' ? val.replace(/^ik-/, '') : val;
} }
} }
} }
return vars;
} }
function getFileUriFromPage(el) { function getMeta(name) {
togglePageListener(true); const e = document.querySelector(`link[rel="${name}"]`);
sendPageEvent(el); return e ? e.getAttribute('href') : null;
return pageData;
} }
function runInPage(fn, ...args) { async function getResource(url, opts) {
const div = document.createElement('div'); try {
div.attachShadow({mode: 'closed'}) return url.startsWith('#')
.appendChild(document.createElement('script')) ? document.getElementById(url.slice(1)).textContent
.textContent = `(${fn})(${JSON.stringify(args).slice(1, -1)})`; : await API.download(url, opts);
document.documentElement.appendChild(div).remove(); } catch (error) {
} alert('Error\n' + error.message);
return Promise.reject(error);
function sendPageEvent(data) { }
dispatchEvent(data instanceof Node }
? new MouseEvent(pageEventId, {relatedTarget: data})
: new CustomEvent(pageEventId, {detail: data})); // USO providing md5Url as "https://update.update.userstyles.org/#####.md5"
//* global cloneInto */// WARNING! Firefox requires cloning of an object `detail` // instead of "https://update.userstyles.org/#####.md5"
} async function getStyleJson() {
try {
function sendStylishEvent(type) { const style = await getResource(getStyleURL(), {responseType: 'json'});
document.dispatchEvent(new Event(type)); const codeElement = document.getElementById('stylish-code');
} if (!style || !Array.isArray(style.sections) || style.sections.length ||
codeElement && !codeElement.textContent.trim()) {
function sendVarsToPage(style) { return style;
if (style) { }
const vars = (style.usercssData || {}).vars || `${style.updateUrl}`.split('?')[1]; const code = await getResource(getMeta('stylish-update-url'));
if (vars) sendPageEvent('vars:' + JSON.stringify(vars)); style.sections = (await API.worker.parseMozFormat({code})).sections;
if (style.md5Url) style.md5Url = style.md5Url.replace('update.update', 'update');
return style;
} catch (e) {}
}
/**
* The sections are checked in successive order because it matters when many sections
* match the same URL and they have rules with the same CSS specificity
* @param {Object} a - first style object
* @param {Object} b - second style object
* @returns {?boolean}
*/
function styleSectionsEqual({sections: a}, {sections: b}) {
const targets = ['urls', 'urlPrefixes', 'domains', 'regexps'];
return a && b && a.length === b.length && a.every(sameSection);
function sameSection(secA, i) {
return equalOrEmpty(secA.code, b[i].code, 'string', (a, b) => a === b) &&
targets.every(target => equalOrEmpty(secA[target], b[i][target], 'array', arrayMirrors));
}
function equalOrEmpty(a, b, type, comparator) {
const typeA = type === 'array' ? Array.isArray(a) : typeof a === type;
const typeB = type === 'array' ? Array.isArray(b) : typeof b === type;
return typeA && typeB && comparator(a, b) ||
(a == null || typeA && !a.length) &&
(b == null || typeB && !b.length);
}
function arrayMirrors(a, b) {
return a.length === b.length &&
a.every(el => b.includes(el)) &&
b.every(el => a.includes(el));
}
}
function onDOMready() {
return document.readyState !== 'loading'
? Promise.resolve()
: new Promise(resolve => document.addEventListener('DOMContentLoaded', resolve, {once: true}));
}
function openSettings(countdown = 10e3) {
const button = document.querySelector('.customize_button');
if (button) {
button.dispatchEvent(new MouseEvent('click', {bubbles: true}));
setTimeout(function pollArea(countdown = 2000) {
const area = document.getElementById('advancedsettings_area');
if (area || countdown < 0) {
(area || button).scrollIntoView({behavior: 'smooth', block: area ? 'end' : 'center'});
} else {
setTimeout(pollArea, 100, countdown - 100);
}
}, 500);
} else if (countdown > 0) {
setTimeout(openSettings, 100, countdown - 100);
} }
return style || false;
} }
function orphanCheck() { function orphanCheck() {
if (chrome.runtime.id) return true; try {
removeEventListener(orphanEventId, orphanCheck, true); if (chrome.i18n.getUILanguage()) {
removeEventListener('click', onClick, true); return true;
removeEventListener('change', onChange); }
sendPageEvent('quit'); } catch (e) {}
observeColors(false); // In Chrome content script is orphaned on an extension update/reload
togglePageListener(false); // so we need to detach event listeners
window.removeEventListener(chrome.runtime.id + '-install', orphanCheck, true);
document.removeEventListener('stylishInstallChrome', onClick);
document.removeEventListener('stylishUpdateChrome', onClick);
try {
msg.off(onMessage);
} catch (e) {}
} }
})(); })();
function inPageContext(eventId, eventIdHost, styleId, apiUrl) { function inPageContext(eventId) {
let done, orphaned, vars; document.currentScript.remove();
// `chrome` may be empty if no extensions use externally_connectable but USO needs it
if (!window.chrome) window.chrome = {runtime: {sendMessage: () => {}}};
const EXT_ID = 'fjnbnpbmkenffdnngjfgmeleoegfcffe';
const {defineProperty} = Object;
const {dispatchEvent, CustomEvent, removeEventListener} = window;
const apply = Map.call.bind(Map.apply);
const OVR = [
[chrome.runtime, 'sendMessage', (fn, me, args) => {
const [id, /*msg*/, opts, cb = opts] = args;
if (id !== EXT_ID) return apply(fn, me, args);
if (typeof cb !== 'function') return Promise.resolve(true);
cb(true);
}],
[Response.prototype, 'json', async (fn, me, args) => {
const res = await apply(fn, me, args);
try {
if (!done && me.url === apiUrl) {
done = true;
send(res);
setVars(res);
}
} catch (e) {}
return res;
}],
[window, 'fetch', (fn, me, args) =>
args[0] === `chrome-extension://${EXT_ID}/index.html`
? Promise.resolve(new Response('<!doctype html><html lang="en"></html>'))
: apply(fn, me, args),
],
];
OVR.forEach(([obj, name, caller], i) => {
const orig = obj[name];
const ovr = new Proxy(orig, {
apply(fn, me, args) {
if (orphaned) restore(obj, name, ovr, fn);
return (orphaned ? apply : caller)(fn, me, args);
},
});
defineProperty(obj, name, {value: ovr});
OVR[i] = [obj, name, ovr, orig]; // same args as restore()
});
/* We set `isInstalled` at page start intentionally not trying to replicate Stylish login events.
* This difference allows USO site to detect presence of Stylus (or another similar extension). */
window.isInstalled = true; window.isInstalled = true;
addEventListener(eventId, onCommand, true); const origMethods = {
function onCommand(e) { json: Response.prototype.json,
if (e.detail === 'quit') { byId: document.getElementById,
removeEventListener(eventId, onCommand, true); };
OVR.forEach(restore); let vars;
done = orphaned = true; // USO bug workaround: prevent errors in console after install and busy cursor
} else if (/^vars:/.test(e.detail)) { document.getElementById = id =>
vars = JSON.parse(e.detail.slice(5)); origMethods.byId.call(document, id) ||
} else if (e.relatedTarget) { (/^(stylish-code|stylish-installed-style-installed-\w+|post-install-ad|style-install-unknown)$/.test(id)
send(e.relatedTarget.uploadedData); ? Object.assign(document.createElement('p'), {className: 'afterdownload-ad'})
} : null);
} // USO bug workaround: use the actual image data in customized settings
function restore(obj, name, ovr, orig) { // same order as OVR after patching document.addEventListener(eventId, ({detail}) => {
if (obj[name] === ovr) { vars = /\?/.test(detail) && new URL(detail).searchParams;
defineProperty(obj, name, {value: orig}); if (!vars) Response.prototype.json = origMethods.json;
} }, {once: true});
} Response.prototype.json = async function () {
function send(data) { const json = await origMethods.json.apply(this, arguments);
dispatchEvent(new CustomEvent(eventIdHost, {__proto: null, detail: data})); if (vars && json && Array.isArray(json.style_settings)) {
} Response.prototype.json = origMethods.json;
function setVars(json) { const images = new Map();
const images = new Map(); for (const ss of json.style_settings) {
const isNew = typeof vars === 'object'; let value = vars.get('ik-' + ss.install_key);
const badKeys = {}; if (!value || !(ss.style_setting_options || [])[0]) {
const newKeys = []; continue;
const makeKey = ({install_key: key}) => {
let res = isNew ? badKeys[key] : key;
if (!res) {
res = key.replace(/[^-\w]/g, '-');
res += newKeys.includes(res) ? '-' : '';
if (key !== res) {
badKeys[key] = res;
newKeys.push(res);
} }
} if (value.startsWith('ik-')) {
return res; value = value.replace(/^ik-/, '');
}; const def = ss.style_setting_options.find(item => item.default);
if (!isNew) vars = new URLSearchParams(vars); if (!def || def.install_key !== value) {
for (const ss of json.style_settings || []) { if (def) def.default = false;
const ik = makeKey(ss); for (const item of ss.style_setting_options) {
let value = isNew ? (vars[ik] || {}).value : vars.get('ik-' + ik); if (item.install_key === value) {
if (value == null || !(ss.style_setting_options || [])[0]) { item.default = true;
continue; break;
} }
if (ss.setting_type === 'image') {
let isListed;
for (const opt of ss.style_setting_options) {
isListed |= opt.default = (opt.install_key === value);
}
images.set(ik, {url: isNew && !isListed ? vars[`${ik}-custom`].value : value, isListed});
} else if (value.startsWith('ik-') || isNew && vars[ik].type === 'select') {
value = value.replace(/^ik-/, '');
const def = ss.style_setting_options.find(item => item.default);
if (!def || makeKey(def) !== value) {
if (def) def.default = false;
for (const item of ss.style_setting_options) {
if (makeKey(item) === value) {
item.default = true;
break;
} }
} }
} else if (ss.setting_type === 'image') {
let isListed;
for (const opt of ss.style_setting_options) {
isListed |= opt.default = (opt.value === value);
}
images.set(ss.install_key, {url: value, isListed});
} else {
const item = ss.style_setting_options[0];
if (item.value !== value && item.install_key === 'placeholder') {
item.value = value;
}
} }
} else { }
const item = ss.style_setting_options[0]; if (images.size) {
if (item.value !== value && item.install_key === 'placeholder') { new MutationObserver((_, observer) => {
item.value = value; if (document.getElementById('style-settings')) {
} observer.disconnect();
for (const [name, {url, isListed}] of images) {
const elRadio = document.querySelector(`input[name="ik-${name}"][value="user-url"]`);
const elUrl = elRadio &&
document.getElementById(elRadio.id.replace('url-choice', 'user-url'));
if (elUrl) {
elRadio.checked = !isListed;
elUrl.value = url;
}
}
}
}).observe(document, {childList: true, subtree: true});
} }
} }
if (!images.size) return; return json;
new MutationObserver((_, observer) => { };
if (!document.getElementById('style-settings')) return;
observer.disconnect();
for (const [name, {url, isListed}] of images) {
const elRadio = document.querySelector(`input[name="ik-${name}"][value="user-url"]`);
const elUrl = elRadio && document.getElementById(elRadio.id.replace('url-choice', 'user-url'));
if (elUrl) {
elRadio.checked = !isListed;
elUrl.value = url;
}
}
}).observe(document, {childList: true, subtree: true});
}
} }

View File

@ -9,14 +9,12 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({
const PATCH_ID = 'transition-patch'; const PATCH_ID = 'transition-patch';
// styles are out of order if any of these elements is injected between them // styles are out of order if any of these elements is injected between them
const ORDERED_TAGS = new Set(['head', 'body', 'frameset', 'style', 'link']); const ORDERED_TAGS = new Set(['head', 'body', 'frameset', 'style', 'link']);
const docRewriteObserver = RewriteObserver(sort); const docRewriteObserver = RewriteObserver(_sort);
const docRootObserver = RootObserver(sortIfNeeded); const docRootObserver = RootObserver(_sortIfNeeded);
const toSafeChar = c => String.fromCharCode(0xFF00 + c.charCodeAt(0) - 0x20);
const list = []; const list = [];
const table = new Map(); const table = new Map();
let isEnabled = true; let isEnabled = true;
let isTransitionPatched = chrome.app && CSS.supports('accent-color', 'red'); // Chrome 93 let isTransitionPatched;
let exposeStyleName;
// will store the original method refs because the page can override them // will store the original method refs because the page can override them
let creationDoc, createElement, createElementNS; let creationDoc, createElement, createElementNS;
@ -25,24 +23,24 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({
list, list,
async apply(styleMap) { async apply(styleMap) {
const styles = styleMapToArray(styleMap); const styles = _styleMapToArray(styleMap);
const value = !styles.length const value = !styles.length
? [] ? []
: await docRootObserver.evade(() => { : await docRootObserver.evade(() => {
if (!isTransitionPatched && isEnabled) { if (!isTransitionPatched && isEnabled) {
applyTransitionPatch(styles); _applyTransitionPatch(styles);
} }
return styles.map(addUpdate); return styles.map(_addUpdate);
}); });
emitUpdate(); _emitUpdate();
return value; return value;
}, },
clear() { clear() {
addRemoveElements(false); _addRemoveElements(false);
list.length = 0; list.length = 0;
table.clear(); table.clear();
emitUpdate(); _emitUpdate();
}, },
clearOrphans() { clearOrphans() {
@ -55,12 +53,12 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({
}, },
remove(id) { remove(id) {
remove(id); _remove(id);
emitUpdate(); _emitUpdate();
}, },
replace(styleMap) { replace(styleMap) {
const styles = styleMapToArray(styleMap); const styles = _styleMapToArray(styleMap);
const added = new Set(styles.map(s => s.id)); const added = new Set(styles.map(s => s.id));
const removed = []; const removed = [];
for (const style of list) { for (const style of list) {
@ -68,24 +66,22 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({
removed.push(style.id); removed.push(style.id);
} }
} }
styles.forEach(addUpdate); styles.forEach(_addUpdate);
removed.forEach(remove); removed.forEach(_remove);
emitUpdate(); _emitUpdate();
}, },
toggle(enable) { toggle(enable) {
if (isEnabled === enable) return; if (isEnabled === enable) return;
isEnabled = enable; isEnabled = enable;
if (!enable) toggleObservers(false); if (!enable) _toggleObservers(false);
addRemoveElements(enable); _addRemoveElements(enable);
if (enable) toggleObservers(true); if (enable) _toggleObservers(true);
}, },
sort: sort,
}; };
function add(style) { function _add(style) {
const el = style.el = createStyle(style); const el = style.el = _createStyle(style.id, style.code);
const i = list.findIndex(item => compare(item, style) > 0); const i = list.findIndex(item => compare(item, style) > 0);
table.set(style.id, style); table.set(style.id, style);
if (isEnabled) { if (isEnabled) {
@ -95,7 +91,7 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({
return el; return el;
} }
function addRemoveElements(add) { function _addRemoveElements(add) {
for (const {el} of list) { for (const {el} of list) {
if (add) { if (add) {
document.documentElement.appendChild(el); document.documentElement.appendChild(el);
@ -105,11 +101,11 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({
} }
} }
function addUpdate(style) { function _addUpdate(style) {
return table.has(style.id) ? update(style) : add(style); return table.has(style.id) ? _update(style) : _add(style);
} }
function applyTransitionPatch(styles) { function _applyTransitionPatch(styles) {
isTransitionPatched = true; isTransitionPatched = true;
// CSS transition bug workaround: since we insert styles asynchronously, // CSS transition bug workaround: since we insert styles asynchronously,
// the browsers, especially Firefox, may apply all transitions on page load // the browsers, especially Firefox, may apply all transitions on page load
@ -118,20 +114,19 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({
!styles.some(s => s.code.includes('transition'))) { !styles.some(s => s.code.includes('transition'))) {
return; return;
} }
const el = createStyle({id: PATCH_ID, code: ` const el = _createStyle(PATCH_ID, `
:root:not(#\\0):not(#\\0) * { :root:not(#\\0):not(#\\0) * {
transition: none !important; transition: none !important;
} }
`}); `);
document.documentElement.appendChild(el); document.documentElement.appendChild(el);
// wait for the next paint to complete // wait for the next paint to complete
// note: requestAnimationFrame won't fire in inactive tabs // note: requestAnimationFrame won't fire in inactive tabs
requestAnimationFrame(() => setTimeout(() => el.remove())); requestAnimationFrame(() => setTimeout(() => el.remove()));
} }
function createStyle(style = {}) { function _createStyle(id, code = '') {
const {id} = style; if (!creationDoc) _initCreationDoc();
if (!creationDoc) initCreationDoc();
let el; let el;
if (document.documentElement instanceof SVGSVGElement) { if (document.documentElement instanceof SVGSVGElement) {
// SVG document style // SVG document style
@ -151,27 +146,18 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({
el.type = 'text/css'; el.type = 'text/css';
// SVG className is not a string, but an instance of SVGAnimatedString // SVG className is not a string, but an instance of SVGAnimatedString
el.classList.add('stylus'); el.classList.add('stylus');
setTextAndName(el, style); el.textContent = code;
return el; return el;
} }
function setTextAndName(el, {id, code = '', name}) { function _toggleObservers(shouldStart) {
if (exposeStyleName && name) {
el.dataset.name = name;
name = encodeURIComponent(name.replace(/[?#/']/g, toSafeChar));
code += `\n/*# sourceURL=${chrome.runtime.getURL(name)}.user.css#${id} */`;
}
el.textContent = code;
}
function toggleObservers(shouldStart) {
const onOff = shouldStart && isEnabled ? 'start' : 'stop'; const onOff = shouldStart && isEnabled ? 'start' : 'stop';
docRewriteObserver[onOff](); docRewriteObserver[onOff]();
docRootObserver[onOff](); docRootObserver[onOff]();
} }
function emitUpdate() { function _emitUpdate() {
toggleObservers(list.length); _toggleObservers(list.length);
onUpdate(); onUpdate();
} }
@ -182,11 +168,11 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({
and since userAgent.navigator can be spoofed via about:config or devtools, and since userAgent.navigator can be spoofed via about:config or devtools,
we're checking for getPreventDefault that was removed in FF59 we're checking for getPreventDefault that was removed in FF59
*/ */
function initCreationDoc() { function _initCreationDoc() {
creationDoc = !Event.prototype.getPreventDefault && document.wrappedJSObject; creationDoc = !Event.prototype.getPreventDefault && document.wrappedJSObject;
if (creationDoc) { if (creationDoc) {
({createElement, createElementNS} = creationDoc); ({createElement, createElementNS} = creationDoc);
const el = document.documentElement.appendChild(createStyle()); const el = document.documentElement.appendChild(_createStyle());
const isApplied = el.sheet; const isApplied = el.sheet;
el.remove(); el.remove();
if (isApplied) return; if (isApplied) return;
@ -195,7 +181,7 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({
({createElement, createElementNS} = document); ({createElement, createElementNS} = document);
} }
function remove(id) { function _remove(id) {
const style = table.get(id); const style = table.get(id);
if (!style) return; if (!style) return;
table.delete(id); table.delete(id);
@ -203,14 +189,14 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({
style.el.remove(); style.el.remove();
} }
function sort() { function _sort() {
docRootObserver.evade(() => { docRootObserver.evade(() => {
list.sort(compare); list.sort(compare);
addRemoveElements(true); _addRemoveElements(true);
}); });
} }
function sortIfNeeded() { function _sortIfNeeded() {
let needsSort; let needsSort;
let el = list.length && list[0].el; let el = list.length && list[0].el;
if (!el) { if (!el) {
@ -231,29 +217,22 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({
// some styles are not injected to the document // some styles are not injected to the document
if (i < list.length) needsSort = true; if (i < list.length) needsSort = true;
} }
if (needsSort) sort(); if (needsSort) _sort();
return needsSort; return needsSort;
} }
function styleMapToArray(styleMap) { function _styleMapToArray(styleMap) {
if (styleMap.cfg) { return Object.values(styleMap).map(s => ({
({exposeStyleName} = styleMap.cfg); id: s.id,
delete styleMap.cfg; code: s.code.join(''),
}
return Object.values(styleMap).map(({id, code, name}) => ({
id,
name,
code: code.join(''),
})); }));
} }
function update(newStyle) { function _update({id, code}) {
const {id, code} = newStyle;
const style = table.get(id); const style = table.get(id);
if (style.code !== code || if (style.code !== code) {
style.name !== newStyle.name && exposeStyleName) {
style.code = code; style.code = code;
setTextAndName(style.el, newStyle); style.el.textContent = code;
} }
} }
@ -262,14 +241,14 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({
let root; let root;
let observing = false; let observing = false;
let timer; let timer;
const observer = new MutationObserver(check); const observer = new MutationObserver(_check);
return {start, stop}; return {start, stop};
function start() { function start() {
if (observing) return; if (observing) return;
// detect dynamic iframes rewritten after creation by the embedder i.e. externally // detect dynamic iframes rewritten after creation by the embedder i.e. externally
root = document.documentElement; root = document.documentElement;
timer = setTimeout(check); timer = setTimeout(_check);
observer.observe(document, {childList: true}); observer.observe(document, {childList: true});
observing = true; observing = true;
} }
@ -281,7 +260,7 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({
observing = false; observing = false;
} }
function check() { function _check() {
if (root !== document.documentElement) { if (root !== document.documentElement) {
root = document.documentElement; root = document.documentElement;
onChange(); onChange();
@ -311,7 +290,7 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({
function evade(fn) { function evade(fn) {
const restore = observing && start; const restore = observing && start;
stop(); stop();
return new Promise(resolve => run(fn, resolve, waitForRoot)) return new Promise(resolve => _run(fn, resolve, _waitForRoot))
.then(restore); .then(restore);
} }
@ -329,7 +308,7 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({
observing = false; observing = false;
} }
function run(fn, resolve, wait) { function _run(fn, resolve, wait) {
if (document.documentElement) { if (document.documentElement) {
resolve(fn()); resolve(fn());
return true; return true;
@ -337,8 +316,8 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({
if (wait) wait(fn, resolve); if (wait) wait(fn, resolve);
} }
function waitForRoot(...args) { function _waitForRoot(...args) {
new MutationObserver((_, observer) => run(...args) && observer.disconnect()) new MutationObserver((_, observer) => _run(...args) && observer.disconnect())
.observe(document, {childList: true}); .observe(document, {childList: true});
} }
} }

268
edit.html
View File

@ -5,8 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="global.css" rel="stylesheet"> <link href="global.css" rel="stylesheet">
<link href="global-dark.css" rel="stylesheet"> <link id="cm-theme" rel="stylesheet">
<style id="cm-theme"></style>
<script src="js/polyfill.js"></script> <script src="js/polyfill.js"></script>
<script src="js/toolbox.js"></script> <script src="js/toolbox.js"></script>
@ -18,7 +17,7 @@
<script src="content/apply.js"></script> <script src="content/apply.js"></script>
<script src="js/sections-util.js"></script> <script src="js/sections-util.js"></script>
<script src="js/storage-util.js"></script> <script src="js/event-emitter.js"></script>
<script src="edit/codemirror-themes.js"></script> <!-- must precede base.js --> <script src="edit/codemirror-themes.js"></script> <!-- must precede base.js -->
<script src="edit/base.js"></script> <script src="edit/base.js"></script>
@ -41,15 +40,15 @@
<script src="vendor/codemirror/addon/lint/lint.js"></script> <script src="vendor/codemirror/addon/lint/lint.js"></script>
<script src="vendor/codemirror/addon/hint/show-hint.js"></script> <script src="vendor/codemirror/addon/hint/show-hint.js"></script>
<script src="vendor/codemirror/addon/hint/css-hint.js"></script> <script src="vendor/codemirror/addon/hint/css-hint.js"></script>
<script src="vendor/codemirror/keymap/emacs.js"></script>
<script src="vendor/codemirror/keymap/sublime.js"></script> <script src="vendor/codemirror/keymap/sublime.js"></script>
<script src="vendor/codemirror/keymap/vim.js"></script>
<script src="vendor-overwrites/codemirror-addon/match-highlighter.js"></script> <script src="vendor-overwrites/codemirror-addon/match-highlighter.js"></script>
<script src="vendor/lz-string-unsafe/lz-string-unsafe.min.js"></script>
<script src="js/color/color-converter.js"></script> <script src="js/color/color-converter.js"></script>
<script src="js/color/color-mimicry.js"></script> <script src="js/color/color-mimicry.js"></script>
<script src="js/color/color-picker.js"></script> <script src="js/color/color-picker.js"></script>
<script src="js/color/color-view.js"></script> <script src="js/color/color-view.js"></script>
<script src="js/storage-util.js"></script>
<script src="js/worker-util.js"></script> <script src="js/worker-util.js"></script>
<script src="edit/util.js"></script> <script src="edit/util.js"></script>
@ -63,24 +62,26 @@
<script src="edit/sections-editor-section.js"></script> <script src="edit/sections-editor-section.js"></script>
<script src="edit/sections-editor.js"></script> <script src="edit/sections-editor.js"></script>
<script src="edit/usw-integration.js"></script> <script src="edit/usw-integration.js"></script>
<script src="edit/settings.js"></script>
<script src="edit/edit.js"></script>
<template data-id="appliesTo"> <template data-id="appliesTo">
<li class="applies-to-item"> <li class="applies-to-item">
<div class="select-resizer"> <div class="select-resizer">
<select name="applies-type" class="applies-type style-contributor"> <select name="applies-type" class="applies-type style-contributor">
<option value="url" i18n="appliesUrlOption"></option> <option value="url" i18n-text="appliesUrlOption"></option>
<option value="url-prefix" i18n="appliesUrlPrefixOption"></option> <option value="url-prefix" i18n-text="appliesUrlPrefixOption"></option>
<option value="domain" i18n="appliesDomainOption"></option> <option value="domain" i18n-text="appliesDomainOption"></option>
<option value="regexp" i18n="appliesRegexpOption"></option> <option value="regexp" i18n-text="appliesRegexpOption"></option>
</select> </select>
<svg class="svg-icon select-arrow"><use xlink:href="#svg-icon-select-arrow"/></svg> <svg class="svg-icon select-arrow"><use xlink:href="#svg-icon-select-arrow"/></svg>
</div> </div>
<div class="applies-value-wrapper"> <div class="applies-value-wrapper">
<input name="applies-value" class="applies-value style-contributor" spellcheck="false"> <input name="applies-value" class="applies-value style-contributor" spellcheck="false">
<a class="remove-applies-to" i18n="appliesRemove, title:appliesRemove" tabindex="0"> <a class="remove-applies-to" i18n-text="appliesRemove" i18n-title="appliesRemove" tabindex="0">
<svg class="svg-icon remove"><use xlink:href="#svg-icon-minus"/></svg> <svg class="svg-icon remove"><use xlink:href="#svg-icon-minus"/></svg>
</a> </a>
<a class="add-applies-to" i18n="appliesAdd, title:appliesAdd" tabindex="0"> <a class="add-applies-to" i18n-text="appliesAdd" i18n-title="appliesAdd" tabindex="0">
<svg class="svg-icon add"><use xlink:href="#svg-icon-plus"/></svg> <svg class="svg-icon add"><use xlink:href="#svg-icon-plus"/></svg>
</a> </a>
</div> </div>
@ -88,8 +89,8 @@
</template> </template>
<template data-id="appliesToEverything"> <template data-id="appliesToEverything">
<li class="applies-to-everything" i18n="appliesToEverything"> <li class="applies-to-everything" i18n-text="appliesToEverything">
<a class="add-applies-to" i18n="appliesAdd, title:appliesAdd" tabindex="0"> <a class="add-applies-to" i18n-text="appliesAdd" i18n-title="appliesAdd" tabindex="0">
<svg class="svg-icon add"><use xlink:href="#svg-icon-plus"/></svg> <svg class="svg-icon add"><use xlink:href="#svg-icon-plus"/></svg>
</a> </a>
</li> </li>
@ -99,11 +100,11 @@
<div class="section"> <div class="section">
<!-- not using DIV to make our CSS work for #sections > div:only-of-type .remove-section --> <!-- not using DIV to make our CSS work for #sections > div:only-of-type .remove-section -->
<p class="deleted-section"> <p class="deleted-section">
<button class="restore-section" i18n="sectionRestore"></button> <button class="restore-section" i18n-text="sectionRestore"></button>
</p> </p>
<label i18n="sectionCode" class="code-label"></label> <label i18n-text="sectionCode" class="code-label"></label>
<div class="applies-to"> <div class="applies-to">
<label i18n="appliesLabel, title:appliesHelp" data-cmd="note"> <label i18n-text="appliesLabel">
<a class="svg-inline-wrapper applies-to-help" tabindex="0"> <a class="svg-inline-wrapper applies-to-help" tabindex="0">
<svg class="svg-icon info"><use xlink:href="#svg-icon-help"/></svg> <svg class="svg-icon info"><use xlink:href="#svg-icon-help"/></svg>
</a> </a>
@ -111,13 +112,13 @@
<ul class="applies-to-list"></ul> <ul class="applies-to-list"></ul>
</div> </div>
<div class="edit-actions"> <div class="edit-actions">
<button class="remove-section" i18n="sectionRemove"></button> <button class="remove-section" i18n-text="sectionRemove"></button>
<button class="add-section" i18n="long-text:sectionAdd, short-text:genericAdd"></button> <button class="add-section" i18n-long-text="sectionAdd" i18n-short-text="genericAdd"></button>
<button class="clone-section" i18n="genericClone"></button> <button class="clone-section" i18n-text="genericClone"></button>
<button class="move-section-up"></button> <button class="move-section-up"></button>
<button class="move-section-down"></button> <button class="move-section-down"></button>
<button class="beautify-section" i18n="styleBeautify"></button> <button class="beautify-section" i18n-text="styleBeautify"></button>
<button class="test-regexp" i18n="genericTest"></button> <button class="test-regexp" i18n-text="styleRegexpTestButton"></button>
</div> </div>
</div> </div>
</template> </template>
@ -127,27 +128,27 @@
<div data-type="main"> <div data-type="main">
<div data-type="content"></div> <div data-type="content"></div>
<div data-type="actions"> <div data-type="actions">
<a data-action="case" i18n="title:searchCaseSensitive" tabindex="0">Aa</a> <a data-action="case" i18n-title="searchCaseSensitive" tabindex="0">Aa</a>
<a data-action="prev" i18n="title:genericPrevious" data-hotkey-tooltip="findPrev" tabindex="0"> <a data-action="prev" i18n-title="genericPrevious" data-hotkey-tooltip="findPrev" tabindex="0">
<svg class="svg-icon" style="transform: rotate(180deg)"><use xlink:href="#svg-icon-v"/></svg> <svg class="svg-icon" style="transform: rotate(180deg)"><use xlink:href="#svg-icon-v"/></svg>
</a> </a>
<a data-action="next" i18n="title:genericNext" data-hotkey-tooltip="findNext" tabindex="0"> <a data-action="next" i18n-title="genericNext" data-hotkey-tooltip="findNext" tabindex="0">
<svg class="svg-icon"><use xlink:href="#svg-icon-v"/></svg> <svg class="svg-icon"><use xlink:href="#svg-icon-v"/></svg>
</a> </a>
<a data-action="close" i18n="title:confirmClose" data-hotkey-tooltip="=Esc" tabindex="0"> <a data-action="close" i18n-title="confirmClose" data-hotkey-tooltip="=Esc" tabindex="0">
<svg class="svg-icon dismiss"><use xlink:href="#svg-icon-close"/></svg> <svg class="svg-icon dismiss"><use xlink:href="#svg-icon-close"/></svg>
</a> </a>
</div> </div>
</div> </div>
<div data-type="status"> <div data-type="status">
<div class="CodeMirror-search-hint" i18n-text="searchRegexp"></div> <div class="CodeMirror-search-hint" i18n-text="searchRegexp"></div>
<div data-type="tally" i18n="title:searchNumberOfResults"></div> <div data-type="tally" i18n-title="searchNumberOfResults"></div>
</div> </div>
</div> </div>
</template> </template>
<template data-id="clearSearch"> <template data-id="clearSearch">
<div data-type="hover" i18n="title:confirmDelete"> <div data-type="hover" i18n-title="confirmDelete">
<svg data-action="clear" class="svg-icon"><use xlink:href="#svg-icon-close"></use></svg> <svg data-action="clear" class="svg-icon"><use xlink:href="#svg-icon-close"></use></svg>
</div> </div>
</template> </template>
@ -156,7 +157,7 @@
<div data-type="content"> <div data-type="content">
<div data-type="input-wrapper"> <div data-type="input-wrapper">
<textarea class="CodeMirror-search-field" rows="1" spellcheck="false" required <textarea class="CodeMirror-search-field" rows="1" spellcheck="false" required
i18n="placeholder:search"></textarea> i18n-placeholder="search"></textarea>
</div> </div>
</div> </div>
</template> </template>
@ -165,36 +166,36 @@
<div data-type="content"> <div data-type="content">
<div data-type="input-wrapper"> <div data-type="input-wrapper">
<textarea data-type="replace-from" <textarea data-type="replace-from"
i18n="placeholder:replace" i18n-placeholder="replace"
class="CodeMirror-search-field" rows="1" required class="CodeMirror-search-field" rows="1" required
spellcheck="false"></textarea> spellcheck="false"></textarea>
</div> </div>
<div data-type="input-wrapper"> <div data-type="input-wrapper">
<textarea data-type="replace-to" <textarea data-type="replace-to"
i18n="placeholder:replaceWith" i18n-placeholder="replaceWith"
class="CodeMirror-search-field" rows="1" required class="CodeMirror-search-field" rows="1" required
spellcheck="false"></textarea> spellcheck="false"></textarea>
</div> </div>
<button data-action="replace" i18n="replace" disabled></button> <button data-action="replace" i18n-text="replace" disabled></button>
<button data-action="replaceAll" i18n="replaceAll" disabled></button> <button data-action="replaceAll" i18n-text="replaceAll" disabled></button>
<button data-action="undo" i18n="undo" disabled></button> <button data-action="undo" i18n-text="undo" disabled></button>
<!-- <!--
Using a separate set of buttons because Using a separate set of buttons because
1. FF can display tooltips only when specified on the <button>, ignores the nested <title> in <svg> 1. FF can display tooltips only when specified on the <button>, ignores the nested <title> in <svg>
2. the icon doesn't fill the entire button area so tooltips aren't shown when the edges are hovered 2. the icon doesn't fill the entire button area so tooltips aren't shown when the edges are hovered
--> -->
<button class="hidden" data-action="replace" i18n="title:replace" disabled> <button class="hidden" data-action="replace" i18n-title="replace" disabled>
<svg class="svg-icon" viewBox="0 0 20 20"> <svg class="svg-icon" viewBox="0 0 20 20">
<polygon points="15.83 4.75 8.76 11.82 5.2 8.26 3.51 9.95 8.76 15.19 17.52 6.43 15.83 4.75"/> <polygon points="15.83 4.75 8.76 11.82 5.2 8.26 3.51 9.95 8.76 15.19 17.52 6.43 15.83 4.75"/>
</svg> </svg>
</button> </button>
<button class="hidden" data-action="replaceAll" i18n="title:replaceAll" disabled> <button class="hidden" data-action="replaceAll" i18n-title="replaceAll" disabled>
<svg class="svg-icon" viewBox="0 0 20 20"> <svg class="svg-icon" viewBox="0 0 20 20">
<polygon points="15.8,1.8 8.8,8.8 5.2,5.3 3.5,6.9 8.8,12.2 17.5,3.4 "/> <polygon points="15.8,1.8 8.8,8.8 5.2,5.3 3.5,6.9 8.8,12.2 17.5,3.4 "/>
<polygon points="15.8,7.8 8.8,14.8 5.2,11.3 3.5,12.9 8.8,18.2 17.5,9.4 "/> <polygon points="15.8,7.8 8.8,14.8 5.2,11.3 3.5,12.9 8.8,18.2 17.5,9.4 "/>
</svg> </svg>
</button> </button>
<button class="hidden" data-action="undo" i18n="title:undo" disabled> <button class="hidden" data-action="undo" i18n-title="undo" disabled>
<svg class="svg-icon" viewBox="0 0 20 20"> <svg class="svg-icon" viewBox="0 0 20 20">
<path d="M11.3,5.5H8.7V1.4L1.9,6.5l6.8,5.1V7.5h2.6c1.8,0,3.2,1.4,3.2,3.2s-1.4,3.2-3.2,3.2H7.8v2h3.5c2.9,0,5.2-2.3,5.2-5.2S14.2,5.5,11.3,5.5z"/> <path d="M11.3,5.5H8.7V1.4L1.9,6.5l6.8,5.1V7.5h2.6c1.8,0,3.2,1.4,3.2,3.2s-1.4,3.2-3.2,3.2H7.8v2h3.5c2.9,0,5.2-2.3,5.2-5.2S14.2,5.5,11.3,5.5z"/>
</svg> </svg>
@ -203,7 +204,7 @@
</template> </template>
<template data-id="jumpToLine"> <template data-id="jumpToLine">
<span i18n="editGotoLine">: <input class="CodeMirror-jump-field" type="text"></span> <span i18n-text="editGotoLine">: <input class="CodeMirror-jump-field" type="text"></span>
</template> </template>
<template data-id="regexpTestPartial"> <template data-id="regexpTestPartial">
@ -211,15 +212,15 @@
</template> </template>
<template data-id="resizeGrip"> <template data-id="resizeGrip">
<div class="resize-grip" i18n="title:cm_resizeGripHint"></div> <div class="resize-grip" i18n-title="cm_resizeGripHint"></div>
</template> </template>
<template data-id="keymapHelp"> <template data-id="keymapHelp">
<table class="keymap-list"> <table class="keymap-list">
<thead> <thead>
<tr> <tr>
<th><input i18n="placeholder:helpKeyMapHotkey" type="search"></th> <th><input i18n-placeholder="helpKeyMapHotkey" type="search" class="can-close-on-esc"></th>
<th><input i18n="placeholder:helpKeyMapCommand" type="search"></th> <th><input i18n-placeholder="helpKeyMapCommand" type="search" class="can-close-on-esc" spellcheck="false"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -239,20 +240,18 @@
<link href="vendor/codemirror/addon/search/matchesonscrollbar.css" rel="stylesheet"> <link href="vendor/codemirror/addon/search/matchesonscrollbar.css" rel="stylesheet">
<link href="js/color/color-picker.css" rel="stylesheet"> <link href="js/color/color-picker.css" rel="stylesheet">
<link href="edit/codemirror-default.css" rel="stylesheet"> <link href="edit/codemirror-default.css" rel="stylesheet">
<link href="edit/edit.css" rel="stylesheet">
<link rel="stylesheet" href="edit/tab.css">
<link rel="stylesheet" href="edit/settings.css">
</head>
<template data-id="body"> <!-- https://crbug.com/1288447 --> <body id="stylus-edit">
<div id="header"> <div id="header">
<h1 id="heading" i18n="data-edit:editStyleHeading, data-add:addStyleTitle"> <h1 id="heading" i18n-data-edit="editStyleHeading" i18n-data-add="addStyleTitle"></h1>
<a class="usercss-only"
href="https://github.com/openstyles/stylus/wiki/Usercss"
i18n="title:externalUsercssDocument" target="_blank">
<svg class="svg-icon info"><use xlink:href="#svg-icon-help"/></svg>
</a>
</h1>
<section id="basic-info"> <section id="basic-info">
<div id="basic-info-name"> <div id="basic-info-name">
<input id="name" class="style-contributor" spellcheck="false"> <input id="name" class="style-contributor" spellcheck="false">
<a id="reset-name" i18n="title:customNameResetHint" tabindex="0" hidden> <a id="reset-name" i18n-title="customNameResetHint" tabindex="0" hidden>
<svg class="svg-icon" viewBox="0 0 20 20"> <svg class="svg-icon" viewBox="0 0 20 20">
<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 <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
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 "/>
@ -262,99 +261,87 @@
</div> </div>
<div id="basic-info-enabled"> <div id="basic-info-enabled">
<label id="enabled-label" <label id="enabled-label"
i18n="styleEnabledLabel, title:toggleStyle" i18n-text="styleEnabledLabel"
i18n-title="toggleStyle"
data-hotkey-tooltip="toggleStyle"> data-hotkey-tooltip="toggleStyle">
<input type="checkbox" id="enabled" class="style-contributor"> <input type="checkbox" id="enabled" class="style-contributor">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg> <svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
</label> </label>
<label id="preview-label" i18n="previewLabel, title:previewTooltip"> <label id="preview-label" i18n-text="previewLabel" i18n-title="previewTooltip">
<input type="checkbox" id="editor.livePreview"> <input type="checkbox" id="editor.livePreview">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg> <svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
</label> </label>
<label id="disableAll-label" i18n="data-on:disableAllStyles, data-off:disableAllStylesOff"> <span id="preview-errors" class="hidden">!</span>
<input id="disableAll" type="checkbox">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
</label>
<span id="preview-errors" hidden>!</span>
</div> </div>
</section> </section>
<section id="actions"> <section id="actions">
<div class="buttons"> <div>
<div class="split-btn"> <button id="save-button" i18n-text="styleSaveLabel" data-hotkey-tooltip="save" disabled></button>
<button id="save-button" i18n="styleSaveLabel" data-hotkey-tooltip="save" disabled></button <button id="beautify" i18n-text="styleBeautify"></button>
><button class="split-btn-pedal usercss-only" i18n="menu-tpl:saveAsTemplate"></button> <a href="manage.html" tabindex="-1"><button id="cancel-button" i18n-text="styleCancelEditLabel"></button></a>
</div>
<button id="beautify" i18n="styleBeautify"></button>
<button id="style-settings-btn" i18n="settings"></button>
<button id="cancel-button" i18n="title:styleCancelEditLabel"></button>
</div> </div>
<div id="mozilla-format-buttons" class="buttons sectioned-only"> <div id="mozilla-format-buttons" class="sectioned-only">
<button id="from-mozilla" i18n="importLabel"></button> <button id="from-mozilla" i18n-text="importLabel"></button>
<button id="to-mozilla" i18n="exportLabel"></button> <button id="to-mozilla" i18n-text="exportLabel"></button>
<a id="to-mozilla-help" class="svg-inline-wrapper" tabindex="0" <a id="to-mozilla-help" class="svg-inline-wrapper" tabindex="0"
i18n="title:styleMozillaFormatHeading"> i18n-title="styleMozillaFormatHeading">
<svg class="svg-icon info"><use xlink:href="#svg-icon-help"/></svg> <svg class="svg-icon info"><use xlink:href="#svg-icon-help"/></svg>
</a> </a>
</div> </div>
</section> </section>
<div id="details-wrapper"> <div id="details-wrapper">
<details id="options" data-pref="editor.options.expanded" class="ignore-pref-if-compact"> <details id="options" data-pref="editor.options.expanded" class="ignore-pref-if-compact">
<summary><h2 id="options-heading" i18n="editorSettings"></h2></summary> <summary><h2 id="options-heading" i18n-text="optionsHeading"></h2></summary>
<div id="options-wrapper"> <div id="options-wrapper">
<div class="options-column"> <div class="options-column">
<div class="option"> <div class="option">
<label id="lineWrapping-label" i18n="cm_lineWrapping"> <label id="lineWrapping-label" i18n-text="cm_lineWrapping">
<input id="editor.lineWrapping" type="checkbox"> <input id="editor.lineWrapping" type="checkbox">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg> <svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
</label> </label>
</div> </div>
<div class="option"> <div class="option">
<label id="smartIndent-label" i18n="cm_smartIndent"> <label id="smartIndent-label" i18n-text="cm_smartIndent">
<input id="editor.smartIndent" type="checkbox"> <input id="editor.smartIndent" type="checkbox">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg> <svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
</label> </label>
</div> </div>
<div class="option"> <div class="option">
<label id="indentWithTabs-label" i18n="cm_indentWithTabs"> <label id="indentWithTabs-label" i18n-text="cm_indentWithTabs">
<input id="editor.indentWithTabs" type="checkbox"> <input id="editor.indentWithTabs" type="checkbox">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg> <svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
</label> </label>
</div> </div>
<div class="option"> <div class="option">
<label i18n="cm_autoCloseBrackets, title:cm_autoCloseBracketsTooltip"> <label i18n-text="cm_autoCloseBrackets" i18n-title="cm_autoCloseBracketsTooltip">
<input id="editor.autoCloseBrackets" type="checkbox"> <input id="editor.autoCloseBrackets" type="checkbox">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg> <svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
</label> </label>
</div> </div>
<div class="option"> <div class="option">
<label i18n="cm_autocompleteOnTyping"> <label i18n-text="cm_autocompleteOnTyping">
<input id="editor.autocompleteOnTyping" type="checkbox"> <input id="editor.autocompleteOnTyping" type="checkbox">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg> <svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
</label> </label>
</div> </div>
<div class="option"> <div class="option">
<label i18n="cm_selectByTokens, title:cm_selectByTokensTooltip"> <label i18n-text="cm_selectByTokens"
i18n-title="cm_selectByTokensTooltip">
<input id="editor.selectByTokens" type="checkbox"> <input id="editor.selectByTokens" type="checkbox">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg> <svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
</label> </label>
</div> </div>
<div class="option sectioned-only">
<label i18n="cm_arrowKeysTraverse">
<input id="editor.arrowKeysTraverse" type="checkbox">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
</label>
</div>
<div class="option"> <div class="option">
<label i18n="cm_colorpicker"> <label i18n-text="cm_colorpicker">
<input id="editor.colorpicker" type="checkbox"> <input id="editor.colorpicker" type="checkbox">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg> <svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
</label> </label>
<a id="colorpicker-settings" class="svg-inline-wrapper" i18n="title:shortcutsNote" tabindex="0"> <a id="colorpicker-settings" class="svg-inline-wrapper" i18n-title="shortcutsNote" tabindex="0">
<svg class="svg-icon settings"><use xlink:href="#svg-icon-config"/></svg> <svg class="svg-icon settings"><use xlink:href="#svg-icon-config"/></svg>
</a> </a>
</div> </div>
<div class="option usercss-only"> <div class="option usercss-only">
<label i18n="appliesLineWidgetLabel, title:appliesLineWidgetWarning"> <label i18n-text="appliesLineWidgetLabel" i18n-title="appliesLineWidgetWarning">
<input id="editor.appliesToLineWidget" type="checkbox"> <input id="editor.appliesToLineWidget" type="checkbox">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg> <svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
</label> </label>
@ -362,11 +349,11 @@
</div> </div>
<div class="options-column"> <div class="options-column">
<div class="option aligned"> <div class="option aligned">
<label id="tabSize-label" for="editor.tabSize" i18n="cm_tabSize"></label> <label id="tabSize-label" for="editor.tabSize" i18n-text="cm_tabSize"></label>
<input id="editor.tabSize" type="number" min="0"> <input id="editor.tabSize" type="number" min="0">
</div> </div>
<div class="option aligned"> <div class="option aligned">
<label id="keyMap-label" for="editor.keyMap" i18n="cm_keyMap"></label> <label id="keyMap-label" for="editor.keyMap" i18n-text="cm_keyMap"></label>
<div class="select-resizer"> <div class="select-resizer">
<select id="editor.keyMap"></select> <select id="editor.keyMap"></select>
<svg class="svg-icon select-arrow"><use xlink:href="#svg-icon-select-arrow"/></svg> <svg class="svg-icon select-arrow"><use xlink:href="#svg-icon-select-arrow"/></svg>
@ -376,34 +363,34 @@
</a> </a>
</div> </div>
<div class="option aligned"> <div class="option aligned">
<label id="theme-label" for="editor.theme" i18n="cm_theme"></label> <label id="theme-label" for="editor.theme" i18n-text="cm_theme"></label>
<div class="select-resizer"> <div class="select-resizer">
<select id="editor.theme"></select> <select id="editor.theme"></select>
<svg class="svg-icon select-arrow"><use xlink:href="#svg-icon-select-arrow"/></svg> <svg class="svg-icon select-arrow"><use xlink:href="#svg-icon-select-arrow"/></svg>
</div> </div>
</div> </div>
<div class="option aligned"> <div class="option aligned">
<label id="highlight-label" for="editor.matchHighlight" i18n="cm_matchHighlight"></label> <label id="highlight-label" for="editor.matchHighlight" i18n-text="cm_matchHighlight"></label>
<div class="select-resizer"> <div class="select-resizer">
<select id="editor.matchHighlight"> <select id="editor.matchHighlight">
<option i18n="cm_matchHighlightToken" value="token"> <option i18n-text="cm_matchHighlightToken" value="token">
<option i18n="cm_matchHighlightSelection" value="selection"> <option i18n-text="cm_matchHighlightSelection" value="selection">
<option i18n="genericDisabledLabel" value=""> <option i18n-text="genericDisabledLabel" value="">
</select> </select>
<svg class="svg-icon select-arrow"><use xlink:href="#svg-icon-select-arrow"/></svg> <svg class="svg-icon select-arrow"><use xlink:href="#svg-icon-select-arrow"/></svg>
</div> </div>
</div> </div>
<div class="option aligned"> <div class="option aligned">
<label id="linter-label" for="editor.linter" i18n="cm_linter"></label> <label id="linter-label" for="editor.linter" i18n-text="cm_linter"></label>
<div class="select-resizer"> <div class="select-resizer">
<select id="editor.linter"> <select id="editor.linter">
<option value="csslint" selected>CSSLint</option> <option value="csslint" selected>CSSLint</option>
<option value="stylelint">Stylelint</option> <option value="stylelint">Stylelint</option>
<option value="" i18n="genericDisabledLabel"></option> <option value="" i18n-text="genericDisabledLabel"></option>
</select> </select>
<svg class="svg-icon select-arrow"><use xlink:href="#svg-icon-select-arrow"/></svg> <svg class="svg-icon select-arrow"><use xlink:href="#svg-icon-select-arrow"/></svg>
</div> </div>
<a id="linter-settings" class="svg-inline-wrapper" i18n="title:linterConfigTooltip" tabindex="0"> <a id="linter-settings" class="svg-inline-wrapper" i18n-title="linterConfigTooltip" tabindex="0">
<svg class="svg-icon settings"><use xlink:href="#svg-icon-config"/></svg> <svg class="svg-icon settings"><use xlink:href="#svg-icon-config"/></svg>
</a> </a>
</div> </div>
@ -411,44 +398,92 @@
</div> </div>
</details> </details>
<details id="publish" data-pref="editor.publish.expanded" class="ignore-pref-if-compact"> <details id="publish" data-pref="editor.publish.expanded" class="ignore-pref-if-compact">
<summary><h2 i18n="publish"></h2></summary> <summary><h2 i18n-text="publish"></h2></summary>
<div> <div>
<a id="usw-url" href="https://userstyles.world" target="_blank">&nbsp;</a> <a id="usw-url" href="https://userstyles.world" target="_blank">&nbsp;</a>
<div id="usw-link-info"> <div id="usw-link-info">
<dl><dt i18n="styleName"></dt><dd data-usw="name"></dd></dl> <dl><dt i18n-text="styleName"></dt><dd data-usw="name"></dd></dl>
<dl><dt i18n="genericDescription"></dt><dd data-usw="description"></dd></dl> <dl><dt i18n-text="genericDescription"></dt><dd data-usw="description"></dd></dl>
</div> </div>
<div> <div>
<button id="usw-publish-style" <button id="usw-publish-style"
i18n="data-publish:publishStyle, data-push:publishPush"></button> i18n-data-publish="publishStyle"
<button id="usw-disconnect" i18n="optionsSyncDisconnect"></button> i18n-data-push="publishPush"></button>
<button id="usw-disconnect" i18n-text="optionsSyncDisconnect"></button>
<span id="usw-progress"></span> <span id="usw-progress"></span>
</div> </div>
</div> </div>
</details> </details>
<details id="sections-list" data-pref="editor.toc.expanded" class="ignore-pref-if-compact"> <details id="sections-list" data-pref="editor.toc.expanded" class="ignore-pref-if-compact">
<summary><h2 i18n="sections"></h2></summary> <summary><h2 i18n-text="sections"></h2></summary>
<ol id="toc"></ol> <ol id="toc"></ol>
</details> </details>
<details id="lint" data-pref="editor.lint.expanded" class="ignore-pref-if-compact" hidden> <details id="lint" data-pref="editor.lint.expanded" class="ignore-pref-if-compact">
<summary> <summary>
<h2><span i18n="linterIssues"></span><span id="issue-count"></span> <h2 i18n-text="linterIssues">: <span id="issue-count"></span>
<a id="lint-help" class="svg-inline-wrapper intercepts-click" tabindex="0"> <a id="lint-help" class="svg-inline-wrapper intercepts-click" tabindex="0">
<svg class="svg-icon info"><use xlink:href="#svg-icon-help"/></svg> <svg class="svg-icon info"><use xlink:href="#svg-icon-help"/></svg>
</a> </a>
</h2> </h2>
</summary> </summary>
<div class="lint-report-container"></div> <div class="lint-scroll-container">
<div class="lint-report-container"></div>
</div>
</details> </details>
</div> </div>
<div id="header-resizer" i18n="title:headerResizerHint"></div> <div id="footer">
<div id="footer" class="hidden">
<a href="https://github.com/openstyles/stylus/wiki/Usercss" <a href="https://github.com/openstyles/stylus/wiki/Usercss"
i18n="externalUsercssDocument" i18n-text="externalUsercssDocument"
target="_blank"></a> target="_blank"></a>
</div> </div>
</div> </div>
<section id="sections"></section> <div class="main tab-container">
<div class="tab-bar">
<div class="tab-bar-item active" i18n-text="editorCodeLabel"></div>
<div class="tab-bar-item" i18n-text="editorSettingLabel"></div>
</div>
<div class="tab-panel">
<section id="sections" class="active"></section>
<fieldset class="style-settings" disabled>
<!-- <label class="style-origin">
<span class="form-label" i18n-text="styleOriginLabel"></span>
<input id="styleOrigin" type="text">
</label> -->
<label class="form-group style-update-url">
<span class="form-label" i18n-text="styleUpdateUrlLabel"></span>
<input type="text">
</label>
<div class="form-group style-prefer-scheme radio-group">
<!-- FIXME: should we use a different message from install page? -->
<span class="form-label" i18n-text="installPreferSchemeLabel"></span>
<label class="radio-item">
<input type="radio" name="preferScheme" value="none">
<span class="radio-label" i18n-text="installPreferSchemeNone"></span>
</label>
<label class="radio-item">
<input type="radio" name="preferScheme" value="dark">
<span class="radio-label" i18n-text="installPreferSchemeDark"></span>
</label>
<label class="radio-item">
<input type="radio" name="preferScheme" value="light">
<span class="radio-label" i18n-text="installPreferSchemeLight"></span>
</label>
</div>
<label class="form-group style-include">
<span class="form-label" i18n-text="styleIncludeLabel"></span>
<textarea spellcheck="false" placeholder="*://site1.com/*&#10;*://site2.com/*"></textarea>
</label>
<label class="form-group style-exclude">
<span class="form-label" i18n-text="styleExcludeLabel"></span>
<textarea spellcheck="false" placeholder="*://site1.com/*&#10;*://site2.com/*"></textarea>
</label>
<!-- <label class="style-always-important">
<input type="checkbox">
<span class="form-label" i18n-text="styleAlwaysImportantLabel"></span>
</label> -->
</fieldset>
</div>
</div>
<div id="help-popup"> <div id="help-popup">
<div class="title"></div><svg id="sections-help" class="svg-icon dismiss"><use xlink:href="#svg-icon-close"/></svg> <div class="title"></div><svg id="sections-help" class="svg-icon dismiss"><use xlink:href="#svg-icon-close"/></svg>
<div class="contents"></div> <div class="contents"></div>
@ -460,10 +495,8 @@
<path d="M0 0v8h8v-2h-1v1h-6v-6h1v-1h-2zm4 0l1.5 1.5-2.5 2.5 1 1 2.5-2.5 1.5 1.5v-4h-4z"></path> <path d="M0 0v8h8v-2h-1v1h-6v-6h1v-1h-2zm4 0l1.5 1.5-2.5 2.5 1 1 2.5-2.5 1.5 1.5v-4h-4z"></path>
</symbol> </symbol>
<symbol id="svg-icon-help" viewBox="0 0 14 16" i18n="alt:helpAlt"> <symbol id="svg-icon-help" viewBox="0 0 14 16" i18n-alt="helpAlt">
<circle cx="7" cy="5" r="1"/> <path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path>
<path d="M8,8c0-0.5-0.5-1-1-1H6C5.5,7,5,7.4,5,8h1v3c0,0.5,0.5,1,1,1h1c0.5,0,1-0.4,1-1H8V8z"/>
<path d="M7,1c3.9,0,7,3.1,7,7s-3.1,7-7,7s-7-3.1-7-7S3.1,1,7,1z M7,2.3C3.9,2.3,1.3,4.9,1.3,8s2.6,5.7,5.7,5.7s5.7-2.6,5.7-5.7S10.1,2.3,7,2.3C7,2.3,7,2.3,7,2.3z"/>
</symbol> </symbol>
<symbol id="svg-icon-close" viewBox="0 0 12 16"> <symbol id="svg-icon-close" viewBox="0 0 12 16">
@ -487,21 +520,14 @@
</symbol> </symbol>
<symbol id="svg-icon-plus" viewBox="0 0 8 8"> <symbol id="svg-icon-plus" viewBox="0 0 8 8">
<path d="M3 0v3h-3v2h3v3h2v-3h3v-2h-3v-3h-2z"/> <path fill-rule="evenodd" d="M3 0v3h-3v2h3v3h2v-3h3v-2h-3v-3h-2z"/>
</symbol> </symbol>
<symbol id="svg-icon-minus" viewBox="0 0 8 8"> <symbol id="svg-icon-minus" viewBox="0 0 8 8">
<path d="M0 3v2h8v-2h-8z"/> <path fill-rule="evenodd" d="M0 3v2h8v-2h-8z"/>
</symbol> </symbol>
</svg> </svg>
</template> <script src="edit/tab.js"></script>
<link href="edit/edit.css" rel="stylesheet">
<script src="js/dark-themer.js"></script> <!-- must be last in HEAD to avoid FOUC -->
</head>
<body id="stylus-edit">
<script src="edit/edit.js"></script>
</body> </body>
</html> </html>

View File

@ -12,7 +12,7 @@
const USO_VAR = 'uso-variable'; const USO_VAR = 'uso-variable';
const USO_VALID_VAR = 'variable-3 ' + USO_VAR; const USO_VALID_VAR = 'variable-3 ' + USO_VAR;
const USO_INVALID_VAR = 'error ' + USO_VAR; const USO_INVALID_VAR = 'error ' + USO_VAR;
const rxPROP = /^(prop(erty)?|variable-2|string-2)\b/; const rxPROP = /^(prop(erty)?|variable-2)\b/;
const rxVAR = /(^|[^-.\w\u0080-\uFFFF])var\(/iyu; const rxVAR = /(^|[^-.\w\u0080-\uFFFF])var\(/iyu;
const rxCONSUME = /([-\w]*\s*:\s?)?/yu; const rxCONSUME = /([-\w]*\s*:\s?)?/yu;
const cssMime = CodeMirror.mimeModes['text/css']; const cssMime = CodeMirror.mimeModes['text/css'];
@ -41,7 +41,6 @@
const {line, ch} = pos; const {line, ch} = pos;
const {styles, text} = cm.getLineHandle(line); const {styles, text} = cm.getLineHandle(line);
const {style, index} = cm.getStyleAtPos({styles, pos: ch}) || {}; const {style, index} = cm.getStyleAtPos({styles, pos: ch}) || {};
const isLessLang = cm.doc.mode.helperType === 'less';
const isStylusLang = cm.doc.mode.name === 'stylus'; const isStylusLang = cm.doc.mode.name === 'stylus';
const type = style && style.split(' ', 1)[0] || 'prop?'; const type = style && style.split(' ', 1)[0] || 'prop?';
if (!type || type === 'comment' || type === 'string') { if (!type || type === 'comment' || type === 'string') {
@ -87,7 +86,6 @@
'@supports', '@supports',
'@viewport', '@viewport',
]; ];
if (isLessLang) list = findAllCssVars(cm, left, '\\s*:').concat(list);
break; break;
case '#': // prevents autocomplete for #hex colors case '#': // prevents autocomplete for #hex colors
@ -144,16 +142,16 @@
leftLC = leftLC.replace(/^[^\w\s]\s*/, ''); leftLC = leftLC.replace(/^[^\w\s]\s*/, '');
} }
if (prop.startsWith('--')) prop = 'color'; // assuming 90% of variables are colors if (prop.startsWith('--')) prop = 'color'; // assuming 90% of variables are colors
if (!cssProps) await initCssProps(); if (!cssValues) cssValues = await linterMan.worker.getCssPropsValues();
list = [...new Set([...cssValues.all[prop] || [], ...cssValues.global])]; list = [...new Set([...cssValues.own[prop] || [], ...cssValues.global])];
end = prev + execAt(/(\s*[-a-z(]+)?/y, prev, text)[0].length; end = prev + execAt(/(\s*[-a-z(]+)?/y, prev, text)[0].length;
} }
} }
// properties and media features // properties and media features
if (!list && if (!list &&
/^(prop(erty|\?)|atom|error|tag)/.test(type) && /^(prop(erty|\?)|atom|error)/.test(type) &&
/^(block|atBlock_parens|maybeprop)/.test(getTokenState())) { /^(block|atBlock_parens|maybeprop)/.test(getTokenState())) {
if (!cssProps) await initCssProps(); if (!cssProps) initCssProps();
if (type === 'prop?') { if (type === 'prop?') {
prev += leftLC.length; prev += leftLC.length;
leftLC = ''; leftLC = '';
@ -176,9 +174,8 @@
}; };
} }
async function initCssProps() { function initCssProps() {
cssValues = await linterMan.worker.getCssPropsValues(); cssProps = addSuffix(cssMime.propertyKeywords);
cssProps = addSuffix(cssValues.all);
cssMedia = [].concat(...Object.entries(cssMime).map(getMediaKeys).filter(Boolean)).sort(); cssMedia = [].concat(...Object.entries(cssMime).map(getMediaKeys).filter(Boolean)).sort();
} }
@ -198,15 +195,13 @@
!style.startsWith(USO_VALID_VAR) && !style.startsWith(USO_INVALID_VAR); !style.startsWith(USO_VALID_VAR) && !style.startsWith(USO_INVALID_VAR);
} }
function findAllCssVars(cm, leftPart, rightPart = '') { function findAllCssVars(cm, leftPart) {
// simplified regex without CSS escapes // simplified regex without CSS escapes
const [, prefixed, named] = leftPart.match(/^(--|@)?(\S)?/);
const rx = new RegExp( const rx = new RegExp(
'(?:^|[\\s/;{])(' + '(?:^|[\\s/;{])(' +
(prefixed ? leftPart : '--') + (leftPart.startsWith('--') ? leftPart : '--') +
(named ? '' : '[a-zA-Z_\u0080-\uFFFF]') + (leftPart.length <= 2 ? '[a-zA-Z_\u0080-\uFFFF]' : '') +
'[-0-9a-zA-Z_\u0080-\uFFFF]*)' + '[-0-9a-zA-Z_\u0080-\uFFFF]*)',
rightPart,
'g'); 'g');
const list = new Set(); const list = new Set();
cm.eachLine(({text}) => { cm.eachLine(({text}) => {

View File

@ -1,44 +1,43 @@
/* global $$ $ $create messageBoxProxy setInputValue setupLivePrefs */// dom.js /* global $ $$ $create setupLivePrefs waitForSelector */// dom.js
/* global API */// msg.js /* global API */// msg.js
/* global CODEMIRROR_THEMES */ /* global CODEMIRROR_THEMES */
/* global CodeMirror */ /* global CodeMirror */
/* global MozDocMapper */// sections-util.js /* global MozDocMapper */// sections-util.js
/* global chromeSync */// storage-util.js
/* global initBeautifyButton */// beautify.js /* global initBeautifyButton */// beautify.js
/* global prefs */ /* global prefs */
/* global t */// localization.js /* global t */// localization.js
/* global FIREFOX getOwnTab sessionStore tryJSONparse tryURL */// toolbox.js /* global
FIREFOX
debounce
getOwnTab
sessionStore
tryJSONparse
tryURL
*/// toolbox.js
/* global EventEmitter */
'use strict'; 'use strict';
/** /**
* @type Editor * @type Editor
* @namespace Editor * @namespace Editor
*/ */
const editor = { const editor = Object.assign(EventEmitter(), {
style: null, style: null,
dirty: DirtyReporter(), dirty: DirtyReporter(),
isUsercss: false, isUsercss: false,
isWindowed: false, isWindowed: false,
livePreview: LivePreview(), lazyKeymaps: {
emacs: '/vendor/codemirror/keymap/emacs',
vim: '/vendor/codemirror/keymap/vim',
},
livePreview: null,
/** @type {'customName'|'name'} */ /** @type {'customName'|'name'} */
nameTarget: 'name', nameTarget: 'name',
previewDelay: 200, // Chrome devtools uses 200 previewDelay: 200, // Chrome devtools uses 200
saving: false,
scrollInfo: null, scrollInfo: null,
cancel: () => location.assign('/manage.html'), onStyleUpdated() {
document.documentElement.classList.toggle('is-new-style', !editor.style.id);
updateClass() {
$.rootCL.toggle('is-new-style', !editor.style.id);
},
updateTheme(name) {
if (!CODEMIRROR_THEMES[name]) {
name = 'default';
prefs.set('editor.theme', name);
}
$('#cm-theme').dataset.theme = name;
$('#cm-theme').textContent = CODEMIRROR_THEMES[name] || '';
}, },
updateTitle(isDirty = editor.dirty.isDirty()) { updateTitle(isDirty = editor.dirty.isDirty()) {
@ -49,24 +48,37 @@ const editor = {
customName || name || t('styleMissingName') customName || name || t('styleMissingName')
} - Stylus`; // the suffix enables external utilities to process our windows e.g. pin on top } - Stylus`; // the suffix enables external utilities to process our windows e.g. pin on top
}, },
}; });
//#region pre-init //#region pre-init
(() => { const baseInit = (() => {
const mqCompact = matchMedia('(max-width: 850px)'); const domReady = waitForSelector('#sections');
const toggleCompact = mq => $.rootCL.toggle('compact-layout', mq.matches);
mqCompact.on('change', toggleCompact); return {
toggleCompact(mqCompact); domReady,
Object.assign(editor, /** @namespace Editor */ { ready: Promise.all([
mqCompact, domReady,
styleReady: prefs.ready.then(loadStyle), loadStyle(),
}); prefs.ready.then(() =>
Promise.all([
loadTheme(),
loadKeymaps(),
])),
]),
};
/** Preloads vim/emacs keymap only if it's the active one, otherwise will load later */
function loadKeymaps() {
const km = prefs.get('editor.keyMap');
return /emacs/i.test(km) && require([editor.lazyKeymaps.emacs]) ||
/vim/i.test(km) && require([editor.lazyKeymaps.vim]);
}
async function loadStyle() { async function loadStyle() {
const params = new URLSearchParams(location.search); const params = new URLSearchParams(location.search);
let id = Number(params.get('id')); const id = Number(params.get('id'));
const style = id && await API.styles.get(id) || { const style = id && await API.styles.get(id) || {
id: id = null, // resetting the non-existent id
name: params.get('domain') || name: params.get('domain') ||
tryURL(params.get('url-prefix')).hostname || tryURL(params.get('url-prefix')).hostname ||
'', '',
@ -76,37 +88,90 @@ const editor = {
], ],
}; };
// switching the mode here to show the correct page ASAP, usually before DOMContentLoaded // switching the mode here to show the correct page ASAP, usually before DOMContentLoaded
const isUC = Boolean(style.usercssData || !id && prefs.get('newStyleAsUsercss')); editor.isUsercss = Boolean(style.usercssData || !style.id && prefs.get('newStyleAsUsercss'));
Object.assign(editor, /** @namespace Editor */ { editor.style = style;
style, editor.onStyleUpdated();
isUsercss: isUC,
template: isUC && !id && chromeSync.getLZValue(chromeSync.LZ_KEY.usercssTemplate), // promise
});
editor.updateClass();
editor.updateTheme(prefs.get('editor.theme'));
editor.updateTitle(false); editor.updateTitle(false);
$.rootCL.add(isUC ? 'usercss' : 'sectioned'); document.documentElement.classList.toggle('usercss', editor.isUsercss);
sessionStore.justEditedStyleId = id || ''; sessionStore.justEditedStyleId = style.id || '';
// no such style so let's clear the invalid URL parameters // no such style so let's clear the invalid URL parameters
if (!id) history.replaceState({}, '', location.pathname); if (!style.id) history.replaceState({}, '', location.pathname);
}
/** Preloads the theme so CodeMirror can use the correct metrics in its first render */
async function loadTheme() {
const theme = prefs.get('editor.theme');
if (!CODEMIRROR_THEMES.includes(theme)) {
prefs.set('editor.theme', 'default');
return;
}
if (theme !== 'default') {
const el = $('#cm-theme');
const el2 = await require([`/vendor/codemirror/theme/${theme}.css`]);
el2.id = el.id;
el.remove();
// FF containers take more time to load CSS
for (let retry = 0; !el2.sheet && ++retry <= 10;) {
await new Promise(requestAnimationFrame);
}
}
} }
})(); })();
//#endregion
//#region init layout/resize
// baseInit.domReady.then(() => {
// let headerHeight;
// detectLayout(true);
// window.on('resize', () => detectLayout());
// function detectLayout(now) {
// const compact = window.innerWidth <= 850;
// if (compact) {
// document.body.classList.add('compact-layout');
// if (!editor.isUsercss) {
// if (now) fixedHeader();
// else debounce(fixedHeader, 250);
// window.on('scroll', fixedHeader, {passive: true});
// }
// } else {
// document.body.classList.remove('compact-layout', 'fixed-header');
// window.off('scroll', fixedHeader);
// }
// for (const el of $$('details[data-pref]')) {
// el.open = compact ? false : prefs.get(el.dataset.pref);
// }
// }
// function fixedHeader() {
// const headerFixed = $('.fixed-header');
// if (!headerFixed) headerHeight = $('#header').clientHeight;
// const scrollPoint = headerHeight - 43;
// if (window.scrollY >= scrollPoint && !headerFixed) {
// $('body').style.setProperty('--fixed-padding', ` ${headerHeight}px`);
// $('body').classList.add('fixed-header');
// } else if (window.scrollY < scrollPoint && headerFixed) {
// $('body').classList.remove('fixed-header');
// }
// }
// });
//#endregion //#endregion
//#region init header //#region init header
/* exported EditorHeader */ baseInit.ready.then(() => {
function EditorHeader() {
initBeautifyButton($('#beautify')); initBeautifyButton($('#beautify'));
initKeymapElement(); initKeymapElement();
initNameArea(); initNameArea();
initThemeElement(); initThemeElement();
setupLivePrefs(); setupLivePrefs();
window.on('load', () => { require(Object.values(editor.lazyKeymaps), () => {
initKeymapElement();
prefs.subscribe('editor.keyMap', showHotkeyInTooltip, {runNow: true}); prefs.subscribe('editor.keyMap', showHotkeyInTooltip, {runNow: true});
window.on('showHotkeyInTooltip', showHotkeyInTooltip); window.on('showHotkeyInTooltip', showHotkeyInTooltip);
}, {once: true}); });
function findKeyForCommand(command, map) { function findKeyForCommand(command, map) {
if (typeof map === 'string') map = CodeMirror.keyMap[map]; if (typeof map === 'string') map = CodeMirror.keyMap[map];
@ -132,12 +197,19 @@ function EditorHeader() {
nameEl.title = isCustomName ? t('customNameHint') : ''; nameEl.title = isCustomName ? t('customNameHint') : '';
nameEl.on('input', () => { nameEl.on('input', () => {
editor.updateName(true); editor.updateName(true);
resetEl.hidden = !editor.style.customName; resetEl.hidden = false;
}); });
resetEl.hidden = !editor.style.customName; resetEl.hidden = !editor.style.customName;
resetEl.onclick = () => { resetEl.onclick = () => {
editor.style.customName = null; // to delete it from db const {style} = editor;
setInputValue(nameEl, editor.style.name); nameEl.focus();
nameEl.select();
// trying to make it undoable via Ctrl-Z
if (!document.execCommand('insertText', false, style.name)) {
nameEl.value = style.name;
editor.updateName(true);
}
style.customName = null; // to delete it from db
resetEl.hidden = true; resetEl.hidden = true;
}; };
const enabledEl = $('#enabled'); const enabledEl = $('#enabled');
@ -147,7 +219,7 @@ function EditorHeader() {
function initThemeElement() { function initThemeElement() {
$('#editor.theme').append(...[ $('#editor.theme').append(...[
$create('option', {value: 'default'}, t('defaultTheme')), $create('option', {value: 'default'}, t('defaultTheme')),
...Object.keys(CODEMIRROR_THEMES).map(s => $create('option', s)), ...CODEMIRROR_THEMES.map(s => $create('option', s)),
]); ]);
// move the theme after built-in CSS so that its same-specificity selectors win // move the theme after built-in CSS so that its same-specificity selectors win
document.head.appendChild($('#cm-theme')); document.head.appendChild($('#cm-theme'));
@ -203,7 +275,7 @@ function EditorHeader() {
} }
} }
} }
} });
//#endregion //#endregion
//#region init windowed mode //#region init windowed mode
@ -220,17 +292,22 @@ function EditorHeader() {
} }
} }
getOwnTab().then(tab => { getOwnTab().then(async tab => {
ownTabId = tab.id; ownTabId = tab.id;
// use browser history back when 'back to manage' is clicked
if (sessionStore['manageStylesHistory' + ownTabId] === location.href) { if (sessionStore['manageStylesHistory' + ownTabId] === location.href) {
editor.cancel = () => history.back(); await baseInit.domReady;
$('#cancel-button').onclick = event => {
event.stopPropagation();
event.preventDefault();
history.back();
};
} }
}); });
async function initWindowedMode() { async function initWindowedMode() {
chrome.tabs.onAttached.addListener(onTabAttached); chrome.tabs.onAttached.addListener(onTabAttached);
// Chrome 96+ bug: the type is 'app' for a window that was restored via Ctrl-Shift-T const isSimple = (await browser.windows.getCurrent()).type === 'popup';
const isSimple = ['app', 'popup'].includes((await browser.windows.getCurrent()).type);
if (isSimple) require(['/edit/embedded-popup']); if (isSimple) require(['/edit/embedded-popup']);
editor.isWindowed = isSimple || ( editor.isWindowed = isSimple || (
history.length === 1 && history.length === 1 &&
@ -266,15 +343,9 @@ function EditorHeader() {
function DirtyReporter() { function DirtyReporter() {
const data = new Map(); const data = new Map();
const listeners = new Set(); const listeners = new Set();
const dataListeners = new Set();
const notifyChange = wasDirty => { const notifyChange = wasDirty => {
const isDirty = data.size > 0; if (wasDirty !== (data.size > 0)) {
const flipped = isDirty !== wasDirty; listeners.forEach(cb => cb());
if (flipped) {
listeners.forEach(cb => cb(isDirty));
}
if (flipped || isDirty) {
dataListeners.forEach(cb => cb(isDirty));
} }
}; };
/** @namespace DirtyReporter */ /** @namespace DirtyReporter */
@ -291,19 +362,17 @@ function DirtyReporter() {
saved.newValue = value; saved.newValue = value;
saved.type = 'modify'; saved.type = 'modify';
} }
} else {
return;
} }
notifyChange(wasDirty); notifyChange(wasDirty);
}, },
clear(...objs) { clear(obj) {
if (data.size && ( const wasDirty = data.size > 0;
objs.length if (obj === undefined) {
? objs.map(data.delete, data).includes(true) data.clear();
: (data.clear(), true) } else {
)) { data.delete(obj);
notifyChange(true);
} }
notifyChange(wasDirty);
}, },
has(key) { has(key) {
return data.has(key); return data.has(key);
@ -317,8 +386,6 @@ function DirtyReporter() {
if (!saved) { if (!saved) {
if (oldValue !== newValue) { if (oldValue !== newValue) {
data.set(obj, {type: 'modify', savedValue: oldValue, newValue}); data.set(obj, {type: 'modify', savedValue: oldValue, newValue});
} else {
return;
} }
} else if (saved.type === 'modify') { } else if (saved.type === 'modify') {
if (saved.savedValue === newValue) { if (saved.savedValue === newValue) {
@ -328,17 +395,12 @@ function DirtyReporter() {
} }
} else if (saved.type === 'add') { } else if (saved.type === 'add') {
saved.newValue = newValue; saved.newValue = newValue;
} else {
return;
} }
notifyChange(wasDirty); notifyChange(wasDirty);
}, },
onChange(cb, add = true) { onChange(cb, add = true) {
listeners[add ? 'add' : 'delete'](cb); listeners[add ? 'add' : 'delete'](cb);
}, },
onDataChange(cb, add = true) {
dataListeners[add ? 'add' : 'delete'](cb);
},
remove(obj, value) { remove(obj, value) {
const wasDirty = data.size > 0; const wasDirty = data.size > 0;
const saved = data.get(obj); const saved = data.get(obj);
@ -348,80 +410,10 @@ function DirtyReporter() {
data.delete(obj); data.delete(obj);
} else if (saved.type === 'modify') { } else if (saved.type === 'modify') {
saved.type = 'remove'; saved.type = 'remove';
} else {
return;
} }
notifyChange(wasDirty); notifyChange(wasDirty);
}, },
}; };
} }
function LivePreview() {
let el;
let data;
let port;
let preprocess;
let enabled = prefs.get('editor.livePreview');
prefs.subscribe('editor.livePreview', (key, value) => {
if (!value) {
if (port) {
port.disconnect();
port = null;
}
} else if (data && data.id && (data.enabled || editor.dirty.has('enabled'))) {
createPreviewer();
updatePreviewer(data);
}
enabled = value;
});
return {
/**
* @param {Function} [fn] - preprocessor
*/
init(fn) {
preprocess = fn;
},
update(newData) {
data = newData;
if (!port) {
if (!data.id || !data.enabled || !enabled) {
return;
}
createPreviewer();
}
updatePreviewer(data);
},
};
function createPreviewer() {
port = chrome.runtime.connect({name: 'livePreview'});
port.onDisconnect.addListener(err => {
throw err;
});
el = $('#preview-errors');
el.onclick = () => messageBoxProxy.alert(el.title, 'pre');
}
async function updatePreviewer(data) {
try {
port.postMessage(preprocess ? await preprocess(data) : data);
el.hidden = true;
} catch (err) {
if (Array.isArray(err)) {
err = err.map(e => e.message || e).join('\n');
} else if (err && err.index != null) {
// FIXME: this would fail if editors[0].getValue() !== data.sourceCode
const pos = editor.getEditors()[0].posFromIndex(err.index);
err.message = `${pos.line}:${pos.ch} ${err.message || err}`;
}
el.title = err.message || `${err}`;
el.hidden = false;
}
}
}
//#endregion //#endregion

View File

@ -65,7 +65,7 @@ function beautifyEditor(cm, options, ui) {
window.scrollTo(scrollX, scrollY); window.scrollTo(scrollX, scrollY);
cm.beautifyChange[cm.changeGeneration()] = true; cm.beautifyChange[cm.changeGeneration()] = true;
if (ui) { if (ui) {
$('button[role="close"]', helpPopup.div).disabled = false; $('#help-popup button[role="close"]').disabled = false;
} }
} }
} }
@ -82,13 +82,12 @@ function createBeautifyUI(scope, options) {
$createOption('}', 'newline_between_rules'), $createOption('}', 'newline_between_rules'),
$createLabeledCheckbox('preserve_newlines', 'styleBeautifyPreserveNewlines'), $createLabeledCheckbox('preserve_newlines', 'styleBeautifyPreserveNewlines'),
$createLabeledCheckbox('indent_conditional', 'styleBeautifyIndentConditional'), $createLabeledCheckbox('indent_conditional', 'styleBeautifyIndentConditional'),
editor.isUsercss && $createLabeledCheckbox('indent_mozdoc', '', '... @-moz-document'),
]), ]),
$create('p.beautify-hint', [ $create('p.beautify-hint', [
$create('span', t('styleBeautifyHint') + '\u00A0'), $create('span', t('styleBeautifyHint') + '\u00A0'),
createHotkeyInput('editor.beautify.hotkey', { createHotkeyInput('editor.beautify.hotkey', {
buttons: false, buttons: false,
onDone: () => moveFocus(helpPopup.div, 0), onDone: () => moveFocus($('#help-popup'), 0),
}), }),
]), ]),
$create('.buttons', [ $create('.buttons', [
@ -114,16 +113,16 @@ function createBeautifyUI(scope, options) {
}, },
}, t(scope.length === 1 ? 'undo' : 'undoGlobal')), }, t(scope.length === 1 ? 'undo' : 'undoGlobal')),
]), ]),
]), ]));
{
className: 'wide', $('#help-popup').className = 'wide';
});
$('.beautify-options').onchange = ({target}) => { $('.beautify-options').onchange = ({target}) => {
const value = target.type === 'checkbox' ? target.checked : target.selectedIndex > 0; const value = target.type === 'checkbox' ? target.checked : target.selectedIndex > 0;
const elLine = target.closest('[newline]');
if (elLine) elLine.setAttribute('newline', value);
prefs.set('editor.beautify', Object.assign(options, {[target.dataset.option]: value})); prefs.set('editor.beautify', Object.assign(options, {[target.dataset.option]: value}));
if (target.parentNode.hasAttribute('newline')) {
target.parentNode.setAttribute('newline', value.toString());
}
beautify(scope, false); beautify(scope, false);
}; };
@ -149,7 +148,7 @@ function createBeautifyUI(scope, options) {
); );
} }
function $createLabeledCheckbox(optionName, i18nKey, text) { function $createLabeledCheckbox(optionName, i18nKey) {
return ( return (
$create('label', {style: 'display: block; clear: both;'}, [ $create('label', {style: 'display: block; clear: both;'}, [
$create('input', { $create('input', {
@ -159,7 +158,7 @@ function createBeautifyUI(scope, options) {
}), }),
$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'})),
i18nKey ? t(i18nKey) : text, t(i18nKey),
]) ])
); );
} }

View File

@ -4,23 +4,13 @@
z-index: 999; z-index: 999;
} }
.CodeMirror-hint:hover { .CodeMirror-hint:hover {
color: var(--bg); color: white;
background: #08f; background: #08f;
} }
.CodeMirror { .CodeMirror {
border: solid var(--c80) 1px; border: solid #CCC 1px;
transition: box-shadow .1s; transition: box-shadow .1s;
} }
.CodeMirror {
color: inherit;
background-color: inherit;
border: solid var(--c80) 1px;
transition: box-shadow .1s;
}
.CodeMirror-gutters {
background-color: var(--c95);
border-color: var(--c85);
}
#stylus#stylus .CodeMirror { #stylus#stylus .CodeMirror {
/* Using a specificity hack to override userstyles */ /* Using a specificity hack to override userstyles */
/* Not using the ring-color hack as it became ugly in new Chrome */ /* Not using the ring-color hack as it became ugly in new Chrome */
@ -36,7 +26,7 @@
width: 5em; width: 5em;
} }
.CodeMirror-search-hint { .CodeMirror-search-hint {
color: var(--c50); color: #888;
} }
.CodeMirror-activeline .applies-to:before { .CodeMirror-activeline .applies-to:before {
background-color: hsla(214, 100%, 90%, 0.15); background-color: hsla(214, 100%, 90%, 0.15);
@ -75,10 +65,6 @@
.CodeMirror-linenumber { .CodeMirror-linenumber {
cursor: pointer; /* for bookmarking */ cursor: pointer; /* for bookmarking */
} }
.cm-matchhighlight,
.CodeMirror-selection-highlight-scrollbar {
background: hsla(200, 100%, 50%, var(--match-hl-opacity, .1));
}
/* Custom stuff we add to CodeMirror */ /* Custom stuff we add to CodeMirror */
@ -88,61 +74,3 @@
.gutter-bookmark { .gutter-bookmark {
background: linear-gradient(0deg, hsla(180, 100%, 30%, .75) 2px, hsla(180, 100%, 30%, .2) 2px); background: linear-gradient(0deg, hsla(180, 100%, 30%, .75) 2px, hsla(180, 100%, 30%, .2) 2px);
} }
@media screen and (prefers-color-scheme: dark), dark {
.CodeMirror {
--match-hl-opacity: .18;
}
.CodeMirror-dialog {
background-color: #333;
}
.CodeMirror-dialog-top {
border-color: #555;
}
.CodeMirror-activeline-background {
background: hsl(180, 21%, 18%);
}
.CodeMirror-selected,
.CodeMirror-focused .CodeMirror-selected,
.CodeMirror-line::selection,
.CodeMirror-line > span::selection,
.CodeMirror-line > span > span::selection {
background: #444;
}
.CodeMirror-line::-moz-selection,
.CodeMirror-line > span::-moz-selection,
.CodeMirror-line > span > span::-moz-selection {
/* TODO: remove this when strict_min_version >= 62 */
background: #444;
}
.cm-s-default div.CodeMirror-cursor {
border-left: 1px solid #fff;
}
/* Using Chromium's dark devtools colors */
.cm-s-default .cm-atom,
.cm-s-default .cm-number { color: #a1f7b5 }
.cm-s-default .cm-attribute { color: #6194c6 }
.cm-s-default .cm-bracket { color: #997 }
.cm-s-default .cm-builtin,
.cm-s-default .cm-link { color: #9fb4d6 }
.cm-s-default .cm-comment { color: #747474 }
.cm-s-default .cm-qualifier { color: #ffa34f }
.cm-s-default .cm-def,
.cm-s-default .cm-header,
.cm-s-default .cm-tag,
.cm-s-default .cm-type { color: #5db0d7 }
.cm-s-default .cm-hr { color: #999 }
.cm-s-default .cm-keyword { color: #9a7fd5 }
.cm-s-default .cm-meta { color: #ddfb55 }
.cm-s-default .cm-operator { color: #d2c057 }
.cm-s-default .cm-string { color: #f28b54 }
.cm-s-default .cm-variable { color: #d9d9d9 }
.cm-s-default .cm-variable-2 { color: #72b9ff }
.cm-s-default .cm-variable-3 { color: #9bbbdc }
@keyframes highlight {
from {
background-color: #888;
}
}
}

View File

@ -1,6 +1,5 @@
/* global $ */// dom.js /* global $ */// dom.js
/* global CodeMirror */ /* global CodeMirror */
/* global UA */// toolbox.js
/* global editor */ /* global editor */
/* global prefs */ /* global prefs */
/* global t */// localization.js /* global t */// localization.js
@ -26,7 +25,7 @@
matchBrackets: true, matchBrackets: true,
hintOptions: {}, hintOptions: {},
lintReportDelay: prefs.get('editor.lintReportDelay'), lintReportDelay: prefs.get('editor.lintReportDelay'),
styleActiveLine: {nonEmpty: true}, styleActiveLine: true,
theme: prefs.get('editor.theme'), theme: prefs.get('editor.theme'),
keyMap: prefs.get('editor.keyMap'), keyMap: prefs.get('editor.keyMap'),
extraKeys: Object.assign(CodeMirror.defaults.extraKeys || {}, { extraKeys: Object.assign(CodeMirror.defaults.extraKeys || {}, {
@ -42,7 +41,7 @@
Object.assign(CodeMirror.defaults, defaults, prefs.get('editor.options')); Object.assign(CodeMirror.defaults, defaults, prefs.get('editor.options'));
// Adding hotkeys to some keymaps except 'basic' which is primitive by design // Adding hotkeys to some keymaps except 'basic' which is primitive by design
{ require(Object.values(typeof editor === 'object' && editor.lazyKeymaps || {}), () => {
const KM = CodeMirror.keyMap; const KM = CodeMirror.keyMap;
const extras = Object.values(CodeMirror.defaults.extraKeys); const extras = Object.values(CodeMirror.defaults.extraKeys);
if (!extras.includes('jumpToLine')) { if (!extras.includes('jumpToLine')) {
@ -63,7 +62,7 @@
if (!extras.includes('blockComment')) { if (!extras.includes('blockComment')) {
KM.sublime['Shift-Ctrl-/'] = 'commentSelection'; KM.sublime['Shift-Ctrl-/'] = 'commentSelection';
} }
if (UA.windows) { if (navigator.appVersion.includes('Windows')) {
// 'pcDefault' keymap on Windows should have F3/Shift-F3/Ctrl-R // 'pcDefault' keymap on Windows should have F3/Shift-F3/Ctrl-R
if (!extras.includes('findNext')) KM.pcDefault['F3'] = 'findNext'; if (!extras.includes('findNext')) KM.pcDefault['F3'] = 'findNext';
if (!extras.includes('findPrev')) KM.pcDefault['Shift-F3'] = 'findPrev'; if (!extras.includes('findPrev')) KM.pcDefault['Shift-F3'] = 'findPrev';
@ -90,7 +89,7 @@
} }
} }
} }
} });
Object.assign(CodeMirror.prototype, { Object.assign(CodeMirror.prototype, {
/** /**
@ -102,7 +101,6 @@
const m = this.doc.mode; const m = this.doc.mode;
if (force || (m.helperType ? m.helperType !== pp : m.name !== name)) { if (force || (m.helperType ? m.helperType !== pp : m.name !== name)) {
this.setOption('mode', name); this.setOption('mode', name);
this.doc.mode.lineComment = ''; // stylelint chokes on line comments a lot
} }
}, },
/** Superfast GC-friendly check that runs until the first non-space line */ /** Superfast GC-friendly check that runs until the first non-space line */

View File

@ -1,3 +1,4 @@
/* global $ */// dom.js
/* global CodeMirror */ /* global CodeMirror */
/* global editor */ /* global editor */
/* global prefs */ /* global prefs */
@ -31,7 +32,7 @@
globalSetOption(key, value) { globalSetOption(key, value) {
CodeMirror.defaults[key] = value; CodeMirror.defaults[key] = value;
if (cms.size > 4 && lazyOpt.names.includes(key)) { if (cms.size > 4 && lazyOpt && lazyOpt.names.includes(key)) {
lazyOpt.set(key, value); lazyOpt.set(key, value);
} else { } else {
cms.forEach(cm => cm.setOption(key, value)); cms.forEach(cm => cm.setOption(key, value));
@ -47,10 +48,8 @@
cm.lastActive = Date.now(); cm.lastActive = Date.now();
}; };
const onCmBlur = cm => { const onCmBlur = cm => {
rerouteHotkeys.toggle(true);
setTimeout(() => { setTimeout(() => {
/* Delaying to next tick to avoid double-processing of the currently processed keyboard event
* when it bubbles up from CodeMirror to `document` where the rerouter listens */
rerouteHotkeys.toggle(true);
const {wrapper} = cm.display; const {wrapper} = cm.display;
wrapper.classList.toggle('CodeMirror-active', wrapper.contains(document.activeElement)); wrapper.classList.toggle('CodeMirror-active', wrapper.contains(document.activeElement));
}); });
@ -67,7 +66,6 @@
k.slice('editor.'.length); k.slice('editor.'.length);
const prefKeys = prefs.knownKeys.filter(k => const prefKeys = prefs.knownKeys.filter(k =>
k !== 'editor.colorpicker' && // handled in colorpicker-helper.js k !== 'editor.colorpicker' && // handled in colorpicker-helper.js
k !== 'editor.arrowKeysTraverse' && // handled in sections-editor.js
prefToCmOpt(k) in CodeMirror.defaults); prefToCmOpt(k) in CodeMirror.defaults);
const {insertTab, insertSoftTab} = CodeMirror.commands; const {insertTab, insertSoftTab} = CodeMirror.commands;
@ -83,7 +81,6 @@
const opt = (showToken || value === 'selection') && { const opt = (showToken || value === 'selection') && {
showToken, showToken,
annotateScrollbar: true, annotateScrollbar: true,
delay: 0,
onUpdate: updateMatchHighlightCount, onUpdate: updateMatchHighlightCount,
}; };
cm.setOption('highlightSelectionMatches', opt || null); cm.setOption('highlightSelectionMatches', opt || null);
@ -97,13 +94,17 @@
} }
prefs.subscribe(prefKeys, (key, val) => { prefs.subscribe(prefKeys, (key, val) => {
if (key === 'editor.theme') editor.updateTheme(val); const name = prefToCmOpt(key);
cmFactory.globalSetOption(prefToCmOpt(key), val); if (name === 'theme') {
loadCmTheme(val);
} else {
cmFactory.globalSetOption(name, val);
}
}); });
// lazy propagation // lazy propagation
lazyOpt = { lazyOpt = window.IntersectionObserver && {
names: ['theme', 'lineWrapping'], names: ['theme', 'lineWrapping'],
set(key, value) { set(key, value) {
const {observer, queue} = lazyOpt; const {observer, queue} = lazyOpt;
@ -177,6 +178,25 @@
//#endregion //#endregion
//#region CM option handlers //#region CM option handlers
async function loadCmTheme(name) {
let el2;
const el = $('#cm-theme');
if (name === 'default') {
el.href = '';
} else {
const path = `/vendor/codemirror/theme/${name}.css`;
if (el.href !== location.origin + path) {
// avoid flicker: wait for the second stylesheet to load, then apply the theme
el2 = await require([path]);
}
}
cmFactory.globalSetOption('theme', name);
if (el2) {
el.remove();
el2.id = el.id;
}
}
function updateMatchHighlightCount(cm, state) { function updateMatchHighlightCount(cm, state) {
cm.display.wrapper.dataset.matchHighlightCount = state.matchesonscroll.matches.length; cm.display.wrapper.dataset.matchHighlightCount = state.matchesonscroll.matches.length;
} }

File diff suppressed because one or more lines are too long

View File

@ -1,68 +0,0 @@
/* global messageBoxProxy */// dom.js
/* global API */// msg.js
/* global clamp debounce */// toolbox.js
/* global editor */
/* global prefs */
/* global t */// localization.js
'use strict';
(async function AutosaveDrafts() {
const makeId = () => editor.style.id || 'new';
let delay;
let port;
connectPort();
const draft = await API.drafts.get(makeId());
if (draft && draft.isUsercss === editor.isUsercss) {
const date = makeRelativeDate(draft.date);
if (await messageBoxProxy.confirm(t('draftAction'), 'danger', t('draftTitle', date))) {
await editor.replaceStyle(draft.style, draft);
} else {
API.drafts.delete(makeId());
}
}
editor.dirty.onChange(isDirty => isDirty ? connectPort() : port.disconnect());
editor.dirty.onDataChange(isDirty => debounce(updateDraft, isDirty ? delay : 0));
prefs.subscribe('editor.autosaveDraft', (key, val) => {
delay = clamp(val * 1000 | 0, 1000, 2 ** 32 - 1);
const t = debounce.timers.get(updateDraft);
if (t != null) debounce(updateDraft, t ? delay : 0);
}, {runNow: true});
function connectPort() {
port = chrome.runtime.connect({name: 'draft:' + makeId()});
}
function makeRelativeDate(date) {
let delta = (Date.now() - date) / 1000;
if (delta >= 0 && Intl.RelativeTimeFormat) {
for (const [span, unit, frac = 1] of [
[60, 'second', 0],
[60, 'minute', 0],
[24, 'hour'],
[7, 'day'],
[4, 'week'],
[12, 'month'],
[1e99, 'year'],
]) {
if (delta < span) {
return new Intl.RelativeTimeFormat({style: 'short'}).format(-delta.toFixed(frac), unit);
}
delta /= span;
}
}
return date.toLocaleString();
}
function updateDraft(isDirty = editor.dirty.isDirty()) {
if (!isDirty) return;
API.drafts.put({
date: Date.now(),
isUsercss: editor.isUsercss,
style: editor.getValue(true),
si: editor.makeScrollInfo(),
}, makeId());
}
})();

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +1,37 @@
/* global $$ $ $create */// dom.js /* global $ $create messageBoxProxy waitForSheet */// dom.js
/* global API msg */// msg.js /* global msg API */// msg.js
/* global CodeMirror */ /* global CodeMirror */
/* global SectionsEditor */ /* global SectionsEditor */
/* global SourceEditor */ /* global SourceEditor */
/* global baseInit */
/* global clipString createHotkeyInput helpPopup */// util.js /* global clipString createHotkeyInput helpPopup */// util.js
/* global closeCurrentTab deepEqual mapObj sessionStore tryJSONparse */// toolbox.js /* global closeCurrentTab deepEqual sessionStore tryJSONparse */// toolbox.js
/* global cmFactory */ /* global cmFactory */
/* global editor EditorHeader */// base.js /* global editor */
/* global linterMan */ /* global linterMan */
/* global prefs */ /* global prefs */
/* global t */// localization.js /* global t */// localization.js
/* global StyleSettings */// settings.js
'use strict'; 'use strict';
//#region init //#region init
document.body.appendChild(t.template.body); baseInit.ready.then(async () => {
await waitForSheet();
EditorMethods(); (editor.isUsercss ? SourceEditor : SectionsEditor)();
editor.styleReady.then(async () => { StyleSettings(editor);
EditorHeader(); await editor.ready;
dispatchEvent(new Event('domReady')); editor.ready = true;
await (editor.isUsercss ? SourceEditor : SectionsEditor)();
editor.dirty.onChange(editor.updateDirty); editor.dirty.onChange(editor.updateDirty);
prefs.subscribe('editor.linter', () => linterMan.run());
prefs.subscribe('editor.linter', (key, value) => {
document.body.classList.toggle('linter-disabled', value === '');
linterMan.run();
});
// enabling after init to prevent flash of validation failure on an empty name // enabling after init to prevent flash of validation failure on an empty name
$('#name').required = !editor.isUsercss; $('#name').required = !editor.isUsercss;
$('#save-button').onclick = editor.save; $('#save-button').onclick = editor.save;
$('#cancel-button').onclick = editor.cancel;
const elSec = $('#sections-list'); const elSec = $('#sections-list');
// editor.toc.expanded pref isn't saved in compact-layout so prefs.subscribe won't work // editor.toc.expanded pref isn't saved in compact-layout so prefs.subscribe won't work
@ -45,65 +48,36 @@ editor.styleReady.then(async () => {
require(['/edit/linter-dialogs'], () => linterMan.showLintConfig()); require(['/edit/linter-dialogs'], () => linterMan.showLintConfig());
$('#lint-help').onclick = () => $('#lint-help').onclick = () =>
require(['/edit/linter-dialogs'], () => linterMan.showLintHelp()); require(['/edit/linter-dialogs'], () => linterMan.showLintHelp());
$('#style-settings-btn').onclick = () => require([
'/edit/settings.css',
'/edit/settings', /* global StyleSettings */
], () => StyleSettings());
require([ require([
'/edit/autocomplete', '/edit/autocomplete',
'/edit/drafts',
'/edit/global-search', '/edit/global-search',
]); ]);
}); });
editor.styleReady.then(async () => {
// Set up mini-header on scroll
const {isUsercss} = editor;
const el = $create({
style: `
top: 0;
height: 1px;
position: absolute;
visibility: hidden;
`.replace(/;/g, '!important;'),
});
const scroller = isUsercss ? $('.CodeMirror-scroll') : document.body;
const xoRoot = isUsercss ? scroller : undefined;
const xo = new IntersectionObserver(onScrolled, {root: xoRoot});
scroller.appendChild(el);
onCompactToggled(editor.mqCompact);
editor.mqCompact.on('change', onCompactToggled);
/** @param {MediaQueryList} mq */
function onCompactToggled(mq) {
for (const el of $$('details[data-pref]')) {
el.open = mq.matches ? false : prefs.get(el.dataset.pref);
}
if (mq.matches) {
xo.observe(el);
} else {
xo.disconnect();
}
}
/** @param {IntersectionObserverEntry[]} entries */
function onScrolled(entries) {
const h = $('#header');
const sticky = !entries.pop().isIntersecting;
if (!isUsercss) scroller.style.paddingTop = sticky ? h.offsetHeight + 'px' : '';
h.classList.toggle('sticky', sticky);
}
});
//#endregion //#endregion
//#region events //#region events
const IGNORE_UPDATE_REASONS = [
'editPreview',
'editPreviewEnd',
'editSave',
// https://github.com/openstyles/stylus/issues/807 is closed without fix
// 'config,
];
msg.onExtension(request => { msg.onExtension(request => {
const {style} = request; const {style} = request;
switch (request.method) { switch (request.method) {
case 'styleUpdated': case 'styleUpdated':
if (editor.style.id === style.id) { if (editor.style.id === style.id && !IGNORE_UPDATE_REASONS.includes(request.reason)) {
handleExternalUpdate(request); if (request.reason === 'toggle') {
editor.emit('styleToggled', request.style);
} else {
API.styles.get(request.style.id)
.then(style => {
editor.emit('styleChange', style, request.reason);
});
}
} }
break; break;
case 'styleDeleted': case 'styleDeleted':
@ -111,47 +85,17 @@ msg.onExtension(request => {
closeCurrentTab(); closeCurrentTab();
} }
break; break;
case 'editDeleteText':
document.execCommand('delete');
break;
} }
}); });
async function handleExternalUpdate({style, reason}) {
if (reason === 'editPreview' ||
reason === 'editPreviewEnd') {
return;
}
if (reason === 'editSave' && editor.saving) {
editor.saving = false;
return;
}
if (reason === 'toggle') {
if (editor.dirty.isDirty()) {
editor.toggleStyle(style.enabled);
} else {
Object.assign(editor.style, style);
}
editor.updateMeta();
editor.updateLivePreview();
return;
}
style = await API.styles.get(style.id);
if (reason === 'config') {
delete style.sourceCode;
delete style.sections;
delete style.name;
delete style.enabled;
Object.assign(editor.style, style);
} else {
await editor.replaceStyle(style);
}
window.dispatchEvent(new Event('styleSettings'));
}
window.on('beforeunload', e => { window.on('beforeunload', e => {
let pos; let pos;
if (editor.isWindowed && if (editor.isWindowed &&
document.visibilityState === 'visible' && document.visibilityState === 'visible' &&
prefs.get('openEditInWindow') && prefs.get('openEditInWindow') &&
screenX !== -32000 && // Chrome uses this value for minimized windows
( // only if not maximized ( // only if not maximized
screenX > 0 || outerWidth < screen.availWidth || screenX > 0 || outerWidth < screen.availWidth ||
screenY > 0 || outerHeight < screen.availHeight || screenY > 0 || outerHeight < screen.availHeight ||
@ -168,7 +112,16 @@ window.on('beforeunload', e => {
prefs.set('windowPosition', pos); prefs.set('windowPosition', pos);
} }
sessionStore.windowPos = JSON.stringify(pos || {}); sessionStore.windowPos = JSON.stringify(pos || {});
sessionStore['editorScrollInfo' + editor.style.id] = JSON.stringify(editor.makeScrollInfo()); sessionStore['editorScrollInfo' + editor.style.id] = JSON.stringify({
scrollY: window.scrollY,
cms: editor.getEditors().map(cm => /** @namespace EditorScrollInfo */({
bookmarks: (cm.state.sublimeBookmarks || []).map(b => b.find()),
focus: cm.hasFocus(),
height: cm.display.wrapper.style.height.replace('100vh', ''),
parentHeight: cm.display.wrapper.parentElement.offsetHeight,
sel: cm.isClean() && [cm.doc.sel.ranges, cm.doc.sel.primIndex],
})),
});
const activeElement = document.activeElement; const activeElement = document.activeElement;
if (activeElement) { if (activeElement) {
// blurring triggers 'change' or 'input' event if needed // blurring triggers 'change' or 'input' event if needed
@ -185,7 +138,7 @@ window.on('beforeunload', e => {
//#endregion //#endregion
//#region editor methods //#region editor methods
function EditorMethods() { (() => {
const toc = []; const toc = [];
const {dirty} = editor; const {dirty} = editor;
let {style} = editor; let {style} = editor;
@ -207,35 +160,15 @@ function EditorMethods() {
applyScrollInfo(cm, si = (editor.scrollInfo.cms || [])[0]) { applyScrollInfo(cm, si = (editor.scrollInfo.cms || [])[0]) {
if (si && si.sel) { if (si && si.sel) {
const bmOpts = {sublimeBookmark: true, clearWhenEmpty: false}; // copied from sublime.js const bmOpts = {sublimeBookmark: true, clearWhenEmpty: false}; // copied from sublime.js
cm.setSelections(...si.sel, {scroll: false}); cm.operation(() => {
cm.state.sublimeBookmarks = si.bookmarks.map(b => cm.markText(b.from, b.to, bmOpts)); cm.setSelections(...si.sel, {scroll: false});
Object.assign(cm.display.scroller, si.scroll); // for source editor cm.scrollIntoView(cm.getCursor(), si.parentHeight / 2);
Object.assign(cm.doc, si.scroll); // for sectioned editor cm.state.sublimeBookmarks = si.bookmarks.map(b => cm.markText(b.from, b.to, bmOpts));
});
} }
}, },
makeScrollInfo() { toggleStyle(enabled = style.enabled) {
return {
scrollY: window.scrollY,
cms: editor.getEditors().map(cm => /** @namespace EditorScrollInfo */({
bookmarks: (cm.state.sublimeBookmarks || []).map(b => b.find()),
focus: cm.hasFocus(),
height: cm.display.wrapper.style.height.replace('100vh', ''),
parentHeight: cm.display.wrapper.parentElement.offsetHeight,
scroll: mapObj(cm.doc, null, ['scrollLeft', 'scrollTop']),
sel: [cm.doc.sel.ranges, cm.doc.sel.primIndex],
})),
};
},
async save() {
if (dirty.isDirty()) {
editor.saving = true;
await editor.saveImpl();
}
},
toggleStyle(enabled = !style.enabled) {
$('#enabled').checked = enabled; $('#enabled').checked = enabled;
editor.updateEnabledness(enabled); editor.updateEnabledness(enabled);
}, },
@ -303,18 +236,79 @@ function EditorMethods() {
el.classList.add(cls); el.classList.add(cls);
} }
}, },
useSavedStyle(newStyle) {
if (style.id !== newStyle.id) {
history.replaceState({}, '', `?id=${newStyle.id}`);
}
sessionStore.justEditedStyleId = newStyle.id;
Object.assign(style, newStyle);
editor.updateClass();
editor.updateMeta();
},
}); });
} })();
//#endregion
//#region editor livePreview
editor.livePreview = (() => {
let data;
let port;
let preprocess;
let enabled = prefs.get('editor.livePreview');
prefs.subscribe('editor.livePreview', (key, value) => {
if (!value) {
if (port) {
port.disconnect();
port = null;
}
} else if (data && data.id && (data.enabled || editor.dirty.has('enabled'))) {
createPreviewer();
updatePreviewer(data);
}
enabled = value;
});
return {
/**
* @param {Function} [fn] - preprocessor
*/
init(fn) {
preprocess = fn;
},
update(newData) {
data = newData;
if (!port) {
if (!data.id || !data.enabled || !enabled) {
return;
}
createPreviewer();
}
updatePreviewer(data);
},
};
function createPreviewer() {
port = chrome.runtime.connect({name: 'livePreview'});
port.onDisconnect.addListener(err => {
throw err;
});
}
async function updatePreviewer(data) {
const errorContainer = $('#preview-errors');
try {
port.postMessage(preprocess ? await preprocess(data) : data);
errorContainer.classList.add('hidden');
} catch (err) {
if (Array.isArray(err)) {
err = err.join('\n');
} else if (err && err.index != null) {
// FIXME: this would fail if editors[0].getValue() !== data.sourceCode
const pos = editor.getEditors()[0].posFromIndex(err.index);
err.message = `${pos.line}:${pos.ch} ${err.message || err}`;
}
errorContainer.classList.remove('hidden');
errorContainer.onclick = () => {
messageBoxProxy.alert(err.message || `${err}`, 'pre');
};
}
}
})();
//#endregion //#endregion
//#region colorpickerHelper //#region colorpickerHelper
@ -372,6 +366,8 @@ function EditorMethods() {
cmFactory.globalSetOption('colorpicker', defaults.colorpicker); cmFactory.globalSetOption('colorpicker', defaults.colorpicker);
}, {runNow: true}); }, {runNow: true});
await baseInit.domReady;
$('#colorpicker-settings').onclick = function (event) { $('#colorpicker-settings').onclick = function (event) {
event.preventDefault(); event.preventDefault();
const input = createHotkeyInput('editor.colorpicker.hotkey', {onDone: () => helpPopup.close()}); const input = createHotkeyInput('editor.colorpicker.hotkey', {onDone: () => helpPopup.close()});

View File

@ -2,7 +2,9 @@
'use strict'; 'use strict';
(() => { (() => {
let sugarss = false; const hasCurlyBraceError = warning =>
warning.text === 'Unnecessary curly bracket (CssSyntaxError)';
let sugarssFallback;
/** @namespace EditorWorker */ /** @namespace EditorWorker */
createWorkerApi({ createWorkerApi({
@ -26,7 +28,6 @@
// moving vendor-prefixed props to the end // moving vendor-prefixed props to the end
const cmp = (a, b) => a[0] === '-' && b[0] !== '-' ? 1 : a < b ? -1 : a > b; const cmp = (a, b) => a[0] === '-' && b[0] !== '-' ? 1 : a < b ? -1 : a > b;
for (const [k, v] of Object.entries(Properties)) { for (const [k, v] of Object.entries(Properties)) {
res[k] = false;
if (typeof v === 'string') { if (typeof v === 'string') {
let last = ''; let last = '';
const uniq = []; const uniq = [];
@ -43,7 +44,7 @@
if (uniq.length) res[k] = uniq; if (uniq.length) res[k] = uniq;
} }
} }
return {all: res, global: GlobalKeywords}; return {own: res, global: GlobalKeywords};
}, },
getRules(linter) { getRules(linter) {
@ -65,32 +66,23 @@
async stylelint(opts) { async stylelint(opts) {
require(['/vendor/stylelint-bundle/stylelint-bundle.min']); /* global stylelint */ require(['/vendor/stylelint-bundle/stylelint-bundle.min']); /* global stylelint */
// Stylus-lang allows a trailing ";" but sugarss doesn't, so we monkeypatch it try {
stylelint.SugarSSParser.prototype.checkSemicolon = tt => { let res;
while (tt.length && tt[tt.length - 1][0] === ';') tt.pop(); let pass = 0;
}; /* sugarss is used for stylus-lang by default,
for (const pass of opts.mode === 'stylus' ? [sugarss, !sugarss] : [-1]) { but it fails on normal css syntax so we retry in css mode. */
/* We try sugarss (for indented stylus-lang), then css mode, switching them on failure, const isSugarSS = opts.syntax === 'sugarss';
* so that the succeeding syntax will be used next time first. */ if (sugarssFallback && isSugarSS) opts.syntax = sugarssFallback;
opts.config.customSyntax = !pass ? 'sugarss' : ''; while (
try { ++pass <= 2 &&
const res = await stylelint.createLinter(opts)._lintSource(opts); (res = (await stylelint.lint(opts)).results[0]) &&
if (pass !== -1) sugarss = pass; isSugarSS && res.warnings.some(hasCurlyBraceError)
return collectStylelintResults(res, opts); ) sugarssFallback = opts.syntax = 'css';
} catch (e) { delete res._postcssResult; // huge and unused
const fatal = pass === -1 || return res;
!pass && !/^CssSyntaxError:.+?Unnecessary curly bracket/.test(e) || } catch (e) {
pass && !/^CssSyntaxError:.+?Unknown word[\s\S]*?\.decl\s/.test(`${e}${e.stack}`); delete e.postcssNode; // huge, unused, non-transferable
if (fatal) { throw e;
return [{
from: {line: e.line - 1, ch: e.column - 1},
to: {line: e.line - 1, ch: e.column - 1},
message: e.reason,
severity: 'error',
rule: e.name,
}];
}
}
} }
}, },
}); });
@ -145,32 +137,4 @@
return options; return options;
}, },
}; };
function collectStylelintResults({messages}, {mode}) {
/* We hide nonfatal "//" warnings since we lint with sugarss without applying @preprocessor.
* We can't easily pre-remove "//" comments which may be inside strings, comments, url(), etc.
* And even if we did, it'd be wrong to hide potential bugs in stylus-lang like #1460 */
const isLess = mode === 'text/x-less';
const slashCommentAllowed = isLess || mode === 'stylus';
const res = [];
for (const m of messages) {
if (/deprecation|invalidOption/.test(m.stylelintType)) {
continue;
}
const {rule} = m;
const msg = m.text.replace(/^Unexpected\s+/, '').replace(` (${rule})`, '');
if (slashCommentAllowed && msg.includes('"//"') ||
isLess && /^unknown at-rule "@[-\w]+:"/.test(msg) /* LESS variables */) {
continue;
}
res.push({
from: {line: m.line - 1, ch: m.column - 1},
to: {line: m.endLine - 1, ch: m.endColumn - 1},
message: msg[0].toUpperCase() + msg.slice(1),
severity: m.severity,
rule,
});
}
return res;
}
})(); })();

View File

@ -1,5 +1,6 @@
/* global $ $create $remove getEventKeyName */// dom.js /* global $ $create $remove getEventKeyName */// dom.js
/* global CodeMirror */ /* global CodeMirror */
/* global baseInit */// base.js
/* global prefs */ /* global prefs */
/* global t */// localization.js /* global t */// localization.js
'use strict'; 'use strict';
@ -19,13 +20,12 @@
title: t('optionsCustomizePopup') + '\n' + POPUP_HOTKEY, title: t('optionsCustomizePopup') + '\n' + POPUP_HOTKEY,
onclick: embedPopup, onclick: embedPopup,
}); });
$.root.appendChild(btn); document.documentElement.appendChild(btn);
$.rootCL.add('popup-window'); baseInit.domReady.then(() => {
window.on('domReady', () => {
document.body.appendChild(btn); document.body.appendChild(btn);
// Adding a dummy command to show in keymap help popup // Adding a dummy command to show in keymap help popup
CodeMirror.defaults.extraKeys[POPUP_HOTKEY] = 'openStylusPopup'; CodeMirror.defaults.extraKeys[POPUP_HOTKEY] = 'openStylusPopup';
}, {once: true}); });
prefs.subscribe('iconset', (_, val) => { prefs.subscribe('iconset', (_, val) => {
const prefix = `images/icon/${val ? 'light/' : ''}`; const prefix = `images/icon/${val ? 'light/' : ''}`;
@ -60,9 +60,14 @@
const body = pw.document.body; const body = pw.document.body;
pw.on('keydown', removePopupOnEsc); pw.on('keydown', removePopupOnEsc);
pw.close = removePopup; pw.close = removePopup;
new pw.IntersectionObserver(onIntersect).observe(body.appendChild( if (pw.IntersectionObserver) {
$create('div', {style: {height: '1px', marginTop: '-1px'}}) new pw.IntersectionObserver(onIntersect).observe(body.appendChild(
)); $create('div', {style: {height: '1px', marginTop: '-1px'}})
));
} else {
frame.dataset.loaded = '';
frame.height = body.scrollHeight;
}
new pw.MutationObserver(onMutation).observe(body, { new pw.MutationObserver(onMutation).observe(body, {
attributes: true, attributes: true,
attributeFilter: ['style'], attributeFilter: ['style'],

View File

@ -1,4 +1,4 @@
/* global $ $$ $create $remove focusAccessibility setInputValue toggleDataset */// dom.js /* global $ $$ $create $remove focusAccessibility toggleDataset */// dom.js
/* global CodeMirror */ /* global CodeMirror */
/* global chromeLocal */// storage-util.js /* global chromeLocal */// storage-util.js
/* global colorMimicry */ /* global colorMimicry */
@ -54,7 +54,7 @@
undoHistory: [], undoHistory: [],
searchInApplies: !editor.isUsercss, searchInApplies: !document.documentElement.classList.contains('usercss'),
}; };
//endregion //endregion
@ -588,7 +588,7 @@
input: colorMimicry($('input:not(:disabled)'), {bg: 'backgroundColor'}), input: colorMimicry($('input:not(:disabled)'), {bg: 'backgroundColor'}),
icon: colorMimicry($$('svg.info')[1], {fill: 'fill'}), icon: colorMimicry($$('svg.info')[1], {fill: 'fill'}),
}; };
$.root.appendChild( document.documentElement.appendChild(
$(DIALOG_STYLE_SELECTOR) || $(DIALOG_STYLE_SELECTOR) ||
$create('style' + DIALOG_STYLE_SELECTOR) $create('style' + DIALOG_STYLE_SELECTOR)
).textContent = ` ).textContent = `
@ -607,10 +607,10 @@
} }
#search-replace-dialog[data-type="replace"] button:hover svg, #search-replace-dialog[data-type="replace"] button:hover svg,
#search-replace-dialog svg:hover { #search-replace-dialog svg:hover {
fill: var(--cmin); fill: inherit;
} }
#search-replace-dialog [data-action="case"]:hover { #search-replace-dialog [data-action="case"]:hover {
color: var(--cmin); color: inherit;
} }
#search-replace-dialog [data-action="clear"] { #search-replace-dialog [data-action="clear"] {
background-color: ${colors.input.bg.replace(/[^,]+$/, '') + '.75)'}; background-color: ${colors.input.bg.replace(/[^,]+$/, '') + '.75)'};
@ -930,5 +930,18 @@
}))); })));
} }
function setInputValue(input, value) {
input.focus();
input.select();
// using execCommand to add to the input's undo history
document.execCommand(value ? 'insertText' : 'delete', false, value);
// some versions of Firefox ignore execCommand
if (input.value !== value) {
input.value = value;
input.dispatchEvent(new Event('input', {bubbles: true}));
}
}
//endregion //endregion
})(); })();

View File

@ -202,7 +202,35 @@ linterMan.DEFAULTS = {
getConfig: config => ({ getConfig: config => ({
rules: Object.assign({}, DEFAULTS.stylelint.rules, config && config.rules), rules: Object.assign({}, DEFAULTS.stylelint.rules, config && config.rules),
}), }),
lint: (code, config, mode) => worker.stylelint({code, config, mode}), async lint(code, config, mode) {
const isLess = mode === 'text/x-less';
const isStylus = mode === 'stylus';
const syntax = isLess ? 'less' : isStylus ? 'sugarss' : 'css';
const raw = await worker.stylelint({code, config, syntax});
if (!raw) {
return [];
}
// Hiding the errors about "//" comments as we're preprocessing only when saving/applying
// and we can't just pre-remove the comments since "//" may be inside a string token
const slashCommentAllowed = isLess || isStylus;
const res = [];
for (const w of raw.warnings) {
const msg = w.text.match(/^(?:Unexpected\s+)?(.*?)\s*\([^()]+\)$|$/)[1] || w.text;
if (!slashCommentAllowed || !(
w.rule === 'no-invalid-double-slash-comments' ||
w.rule === 'property-no-unknown' && msg.includes('"//"')
)) {
res.push({
from: {line: w.line - 1, ch: w.column - 1},
to: {line: w.line - 1, ch: w.column},
message: msg.slice(0, 1).toUpperCase() + msg.slice(1),
severity: w.severity,
rule: w.rule,
});
}
}
return res;
},
}, },
}; };
@ -287,7 +315,7 @@ linterMan.DEFAULTS = {
function updateCount() { function updateCount() {
const issueCount = Array.from(tables.values()) const issueCount = Array.from(tables.values())
.reduce((sum, table) => sum + table.trs.length, 0); .reduce((sum, table) => sum + table.trs.length, 0);
$('#lint').hidden = !issueCount; $('#lint').classList.toggle('hidden', issueCount === 0);
$('#issue-count').textContent = issueCount; $('#issue-count').textContent = issueCount;
} }
@ -303,20 +331,19 @@ linterMan.DEFAULTS = {
} }
function createTable(cm) { function createTable(cm) {
const caption = $create('.caption'); const caption = $create('caption');
const table = $create('table'); const tbody = $create('tbody');
const report = $create('.report', [caption, table]); const table = $create('table', [caption, tbody]);
const trs = []; const trs = [];
return { return {
element: report, element: table,
trs, trs,
updateAnnotations, updateAnnotations,
updateCaption, updateCaption,
}; };
function updateCaption() { function updateCaption() {
const t = editor.getEditorTitle(cm); caption.textContent = editor.getEditorTitle(cm);
Object.assign(caption, typeof t == 'string' ? {textContent: t} : t);
} }
function updateAnnotations(lines) { function updateAnnotations(lines) {
@ -328,20 +355,20 @@ linterMan.DEFAULTS = {
} else { } else {
tr = createTr(); tr = createTr();
trs.push(tr); trs.push(tr);
table.appendChild(tr.element); tbody.append(tr.element);
} }
tr.update(anno); tr.update(anno);
i++; i++;
} }
if (i === 0) { if (i === 0) {
trs.length = 0; trs.length = 0;
table.textContent = ''; tbody.textContent = '';
} else { } else {
while (trs.length > i) { while (trs.length > i) {
trs.pop().element.remove(); trs.pop().element.remove();
} }
} }
report.classList.toggle('empty', !trs.length); table.classList.toggle('empty', trs.length === 0);
function *getAnnotations() { function *getAnnotations() {
for (const line of lines.filter(Boolean)) { for (const line of lines.filter(Boolean)) {

View File

@ -4,7 +4,9 @@
/* global colorMimicry */ /* global colorMimicry */
/* global editor */ /* global editor */
/* global msg */ /* global msg */
/* global prefs */
/* global t */// localization.js /* global t */// localization.js
/* global tryCatch */// toolbox.js
'use strict'; 'use strict';
/* exported MozSectionWidget */ /* exported MozSectionWidget */
@ -38,12 +40,11 @@ function MozSectionWidget(cm, finder = MozSectionFinder(cm)) {
}; };
function init() { function init() {
const hint = {title: t('appliesHelp')};
enabled = true; enabled = true;
TPL = { TPL = {
container: container:
$create('div' + C_CONTAINER, [ $create('div' + C_CONTAINER, [
$create(C_LABEL, hint, t('appliesLabel')), $create(C_LABEL, t('appliesLabel')),
$create('ul' + C_LIST), $create('ul' + C_LIST),
]), ]),
listItem: listItem:
@ -52,9 +53,8 @@ function MozSectionWidget(cm, finder = MozSectionFinder(cm)) {
$create('li.applies-to-everything', t('appliesToEverything')), $create('li.applies-to-everything', t('appliesToEverything')),
}; };
Object.assign($(C_TYPE, TPL.listItem), hint);
$(C_VALUE, TPL.listItem).after( $(C_VALUE, TPL.listItem).after(
$create('button.test-regexp', t('genericTest'))); $create('button.test-regexp', t('styleRegexpTestButton')));
CLICK_ROUTE = { CLICK_ROUTE = {
'.test-regexp': showRegExpTester, '.test-regexp': showRegExpTester,
@ -156,7 +156,6 @@ function MozSectionWidget(cm, finder = MozSectionFinder(cm)) {
} }
if (msg.style || msg.styles || if (msg.style || msg.styles ||
msg.prefs && 'disableAll' in msg.prefs || msg.prefs && 'disableAll' in msg.prefs ||
msg.method === 'colorScheme' ||
msg.method === 'styleDeleted') { msg.method === 'styleDeleted') {
requestAnimationFrame(updateWidgetStyle); requestAnimationFrame(updateWidgetStyle);
} }
@ -164,6 +163,11 @@ function MozSectionWidget(cm, finder = MozSectionFinder(cm)) {
function updateWidgetStyle() { function updateWidgetStyle() {
funcHeight = 0; funcHeight = 0;
if (prefs.get('editor.theme') !== 'default' &&
!tryCatch(() => $('#cm-theme').sheet.cssRules)) {
requestAnimationFrame(updateWidgetStyle);
return;
}
const MIN_LUMA = .05; const MIN_LUMA = .05;
const MIN_LUMA_DIFF = .4; const MIN_LUMA_DIFF = .4;
const color = { const color = {
@ -199,6 +203,7 @@ function MozSectionWidget(cm, finder = MozSectionFinder(cm)) {
color: ${fore}; color: ${fore};
} }
${C_CONTAINER} input, ${C_CONTAINER} input,
${C_CONTAINER} button,
${C_CONTAINER} select { ${C_CONTAINER} select {
background: rgba(255, 255, 255, ${ background: rgba(255, 255, 255, ${
Math.max(MIN_LUMA, Math.pow(Math.max(0, color.gutter.bgLuma - MIN_LUMA * 2), 2)).toFixed(2) Math.max(MIN_LUMA, Math.pow(Math.max(0, color.gutter.bgLuma - MIN_LUMA * 2), 2)).toFixed(2)
@ -212,7 +217,7 @@ function MozSectionWidget(cm, finder = MozSectionFinder(cm)) {
transition: none; transition: none;
} }
`; `;
$.root.appendChild(actualStyle); document.documentElement.appendChild(actualStyle);
} }
/** /**
@ -269,14 +274,13 @@ function MozSectionWidget(cm, finder = MozSectionFinder(cm)) {
let widget = old && old.widget; let widget = old && old.widget;
const height = Math.round(funcHeight * (sec.funcs.length || 1)) || undefined; const height = Math.round(funcHeight * (sec.funcs.length || 1)) || undefined;
const node = renderContainer(sec, widget); const node = renderContainer(sec, widget);
if (widget && widget.line.lineNo() === sec.start.line) { if (widget) {
widget.node = node; widget.node = node;
if (height && height !== widget.height) { if (height && height !== widget.height) {
widget.height = height; widget.height = height;
widget.changed(); widget.changed();
} }
} else { } else {
if (widget) widget.clear();
widget = cm.addLineWidget(sec.start.line, node, { widget = cm.addLineWidget(sec.start.line, node, {
coverGutter: true, coverGutter: true,
noHScroll: true, noHScroll: true,

View File

@ -5,6 +5,7 @@
'use strict'; 'use strict';
const regexpTester = (() => { const regexpTester = (() => {
const GET_FAVICON_URL = 'https://www.google.com/s2/favicons?domain=';
const OWN_ICON = chrome.runtime.getManifest().icons['16']; const OWN_ICON = chrome.runtime.getManifest().icons['16'];
const cachedRegexps = new Map(); const cachedRegexps = new Map();
let currentRegexps = []; let currentRegexps = [];
@ -92,7 +93,7 @@ const regexpTester = (() => {
for (const [url, match] of urls.entries()) { for (const [url, match] of urls.entries()) {
const faviconUrl = url.startsWith(URLS.ownOrigin) const faviconUrl = url.startsWith(URLS.ownOrigin)
? OWN_ICON ? OWN_ICON
: URLS.favicon(new URL(url).hostname); : GET_FAVICON_URL + new URL(url).hostname;
const icon = $create('img', {src: faviconUrl}); const icon = $create('img', {src: faviconUrl});
if (match.text.length === url.length) { if (match.text.length === url.length) {
full.push($create('a', {tabIndex: 0}, [ full.push($create('a', {tabIndex: 0}, [

View File

@ -1,4 +1,4 @@
/* global $ toggleDataset */// dom.js /* global $ */// dom.js
/* global MozDocMapper trimCommentLabel */// util.js /* global MozDocMapper trimCommentLabel */// util.js
/* global cmFactory */ /* global cmFactory */
/* global debounce tryRegExp */// toolbox.js /* global debounce tryRegExp */// toolbox.js
@ -23,7 +23,7 @@ function createSection(originalSection, genId, si) {
const elLabel = $('.code-label', el); const elLabel = $('.code-label', el);
const cm = cmFactory.create(wrapper => { const cm = cmFactory.create(wrapper => {
// making it tall during initial load so IntersectionObserver sees only one adjacent CM // making it tall during initial load so IntersectionObserver sees only one adjacent CM
if (editor.loading) { if (editor.ready !== true) {
wrapper.style.height = si ? si.height : '100vh'; wrapper.style.height = si ? si.height : '100vh';
} }
elLabel.after(wrapper); elLabel.after(wrapper);
@ -31,13 +31,11 @@ function createSection(originalSection, genId, si) {
value: originalSection.code, value: originalSection.code,
}); });
el.CodeMirror = cm; // used by getAssociatedEditor el.CodeMirror = cm; // used by getAssociatedEditor
cm.el = el;
editor.applyScrollInfo(cm, si); editor.applyScrollInfo(cm, si);
const changeListeners = new Set(); const changeListeners = new Set();
const appliesToContainer = $('.applies-to', el); const appliesToContainer = $('.applies-to-list', el);
const appliesToList = $('.applies-to-list', el);
const appliesTo = []; const appliesTo = [];
MozDocMapper.forEachProp(originalSection, (type, value) => MozDocMapper.forEachProp(originalSection, (type, value) =>
insertApplyAfter({type, value})); insertApplyAfter({type, value}));
@ -115,21 +113,66 @@ function createSection(originalSection, genId, si) {
changeGeneration = newGeneration; changeGeneration = newGeneration;
emitSectionChange('code'); emitSectionChange('code');
}); });
cm.display.wrapper.on('keydown', event => handleKeydown(cm, event), true);
$('.test-regexp', el).onclick = () => updateRegexpTester(true); $('.test-regexp', el).onclick = () => updateRegexpTester(true);
initBeautifyButton($('.beautify-section', el), [cm]); initBeautifyButton($('.beautify-section', el), [cm]);
} }
function handleKeydown(cm, event) {
if (event.shiftKey || event.altKey || event.metaKey) {
return;
}
const {key} = event;
const {line, ch} = cm.getCursor();
switch (key) {
case 'ArrowLeft':
if (line || ch) {
return;
}
// fallthrough
case 'ArrowUp':
cm = line === 0 && editor.prevEditor(cm, false);
if (!cm) {
return;
}
event.preventDefault();
event.stopPropagation();
cm.setCursor(cm.doc.size - 1, key === 'ArrowLeft' ? 1e20 : ch);
break;
case 'ArrowRight':
if (line < cm.doc.size - 1 || ch < cm.getLine(line).length - 1) {
return;
}
// fallthrough
case 'ArrowDown':
cm = line === cm.doc.size - 1 && editor.nextEditor(cm, false);
if (!cm) {
return;
}
event.preventDefault();
event.stopPropagation();
cm.setCursor(0, 0);
break;
}
}
async function updateRegexpTester(toggle) { async function updateRegexpTester(toggle) {
const isLoaded = typeof regexpTester === 'object' || const isLoaded = typeof regexpTester === 'object';
toggle && await require(['/edit/regexp-tester']); /* global regexpTester */ if (toggle && !isLoaded) {
if (toggle != null) { await require(['/edit/regexp-tester']); /* global regexpTester */
}
if (toggle != null && isLoaded) {
regexpTester.toggle(toggle); regexpTester.toggle(toggle);
} }
const regexps = appliesTo.filter(a => a.type === 'regexp') const regexps = appliesTo.filter(a => a.type === 'regexp')
.map(a => a.value); .map(a => a.value);
const hasRe = regexps.length > 0; if (regexps.length) {
if (hasRe && isLoaded) regexpTester.update(regexps); el.classList.add('has-regexp');
el.classList.toggle('has-regexp', hasRe); if (isLoaded) regexpTester.update(regexps);
} else {
el.classList.remove('has-regexp');
if (isLoaded) regexpTester.toggle(false);
}
} }
function updateTocEntry(origin) { function updateTocEntry(origin) {
@ -197,13 +240,11 @@ function createSection(originalSection, genId, si) {
function insertApplyAfter(init, base) { function insertApplyAfter(init, base) {
const apply = createApply(init); const apply = createApply(init);
appliesTo.splice(base ? appliesTo.indexOf(base) + 1 : appliesTo.length, 0, apply); appliesTo.splice(base ? appliesTo.indexOf(base) + 1 : appliesTo.length, 0, apply);
appliesToList.insertBefore(apply.el, base ? base.el.nextSibling : null); appliesToContainer.insertBefore(apply.el, base ? base.el.nextSibling : null);
toggleDataset(appliesToContainer, 'all', init.all);
dirty.add(apply, apply); dirty.add(apply, apply);
if (appliesTo.length > 1 && appliesTo[0].all) { if (appliesTo.length > 1 && appliesTo[0].all) {
removeApply(appliesTo[0]); removeApply(appliesTo[0]);
} }
if (base) requestAnimationFrame(shrinkSectionBy1);
emitSectionChange('apply'); emitSectionChange('apply');
return apply; return apply;
} }
@ -312,15 +353,6 @@ function createSection(originalSection, genId, si) {
dirty.add(`${dirtyPrefix}.value`, value); dirty.add(`${dirtyPrefix}.value`, value);
} }
} }
function shrinkSectionBy1() {
const cmEl = cm.display.wrapper;
const cmH = cmEl.offsetHeight;
const viewH = el.parentElement.offsetHeight;
if (el.offsetHeight > viewH && cmH > Math.min(viewH / 2, cm.display.sizer.offsetHeight + 30)) {
cmEl.style.height = (cmH - appliesToContainer.offsetHeight / (appliesTo.length || 1) | 0) + 'px';
}
}
} }
function createResizeGrip(cm) { function createResizeGrip(cm) {
@ -349,7 +381,8 @@ function createResizeGrip(cm) {
cm.display.lineDiv.offsetParent.offsetTop + cm.display.lineDiv.offsetParent.offsetTop +
/* borders */ /* borders */
wrapper.offsetHeight - wrapper.clientHeight; wrapper.offsetHeight - wrapper.clientHeight;
document.body.classList.add('resizing-v'); wrapper.style.pointerEvents = 'none';
document.body.style.cursor = 's-resize';
document.on('mousemove', resize); document.on('mousemove', resize);
document.on('mouseup', resizeStop); document.on('mouseup', resizeStop);
@ -365,7 +398,8 @@ function createResizeGrip(cm) {
function resizeStop() { function resizeStop() {
document.off('mouseup', resizeStop); document.off('mouseup', resizeStop);
document.off('mousemove', resize); document.off('mousemove', resize);
document.body.classList.remove('resizing-v'); wrapper.style.pointerEvents = '';
document.body.style.cursor = '';
} }
}; };

View File

@ -1,13 +1,12 @@
/* global $ $create $remove messageBoxProxy */// dom.js /* global $ $$ $create $remove messageBoxProxy */// dom.js
/* global API */// msg.js /* global API */// msg.js
/* global CodeMirror */ /* global CodeMirror */
/* global RX_META debounce */// toolbox.js /* global FIREFOX RX_META debounce ignoreChromeError sessionStore */// toolbox.js
/* global MozDocMapper clipString helpPopup rerouteHotkeys showCodeMirrorPopup */// util.js /* global MozDocMapper clipString helpPopup rerouteHotkeys showCodeMirrorPopup */// util.js
/* global createSection */// sections-editor-section.js /* global createSection */// sections-editor-section.js
/* global editor */ /* global editor */
/* global linterMan */ /* global linterMan */
/* global prefs */ /* global prefs */
/* global styleSectionsEqual */ // sections-util.js
/* global t */// localization.js /* global t */// localization.js
'use strict'; 'use strict';
@ -17,25 +16,26 @@ function SectionsEditor() {
const container = $('#sections'); const container = $('#sections');
/** @type {EditorSection[]} */ /** @type {EditorSection[]} */
const sections = []; const sections = [];
const xo = new IntersectionObserver(refreshOnViewListener, {rootMargin: '100%'}); const xo = window.IntersectionObserver &&
new IntersectionObserver(refreshOnViewListener, {rootMargin: '100%'});
let INC_ID = 0; // an increment id that is used by various object to track the order let INC_ID = 0; // an increment id that is used by various object to track the order
let sectionOrder = ''; let sectionOrder = '';
let headerOffset; // in compact mode the header is at the top so it reduces the available height let headerOffset; // in compact mode the header is at the top so it reduces the available height
let cmExtrasHeight; // resize grip + borders let cmExtrasHeight; // resize grip + borders
let upDownJumps;
updateMeta(); updateHeader();
rerouteHotkeys.toggle(true); // enabled initially because we don't always focus a CodeMirror rerouteHotkeys.toggle(true); // enabled initially because we don't always focus a CodeMirror
editor.livePreview.init(); editor.livePreview.init();
container.classList.add('section-editor');
$('#to-mozilla').on('click', showMozillaFormat); $('#to-mozilla').on('click', showMozillaFormat);
$('#to-mozilla-help').on('click', showToMozillaHelp); $('#to-mozilla-help').on('click', showToMozillaHelp);
$('#from-mozilla').on('click', () => showMozillaFormatImport()); $('#from-mozilla').on('click', () => showMozillaFormatImport());
document.on('wheel', scrollEntirePageOnCtrlShift, {passive: false}); document.on('wheel', scrollEntirePageOnCtrlShift, {passive: false});
CodeMirror.defaults.extraKeys['Shift-Ctrl-Wheel'] = 'scrollWindow'; CodeMirror.defaults.extraKeys['Shift-Ctrl-Wheel'] = 'scrollWindow';
prefs.subscribe('editor.arrowKeysTraverse', (_, val) => { if (!FIREFOX) {
for (const {cm} of sections) handleKeydownSetup(cm, val); $$('input:not([type]), input[type=text], input[type=search], input[type=number]')
upDownJumps = val; .forEach(e => e.on('mousedown', toggleContextMenuDelete));
}, {runNow: true}); }
/** @namespace Editor */ /** @namespace Editor */
Object.assign(editor, { Object.assign(editor, {
@ -44,18 +44,14 @@ function SectionsEditor() {
closestVisible, closestVisible,
updateLivePreview, updateLivePreview,
updateMeta,
getEditors() { getEditors() {
return sections.filter(s => !s.removed).map(s => s.cm); return sections.filter(s => !s.removed).map(s => s.cm);
}, },
getEditorTitle(cm) { getEditorTitle(cm) {
const index = editor.getEditors().indexOf(cm) + 1; const index = editor.getEditors().indexOf(cm);
return { return `${t('sectionCode')} ${index + 1}`;
textContent: `#${index}`,
title: `${t('sectionCode')} ${index}`,
};
}, },
getValue(asObject) { getValue(asObject) {
@ -76,62 +72,83 @@ function SectionsEditor() {
} }
}, },
nextEditor(cm, upDown) { nextEditor(cm, cycle = true) {
return !upDown || cm !== findLast(sections, s => !s.removed).cm return cycle || cm !== findLast(sections, s => !s.removed).cm
? nextPrevEditor(cm, 1, upDown) ? nextPrevEditor(cm, 1)
: null; : null;
}, },
prevEditor(cm, upDown) { prevEditor(cm, cycle = true) {
return !upDown || cm !== sections.find(s => !s.removed).cm return cycle || cm !== sections.find(s => !s.removed).cm
? nextPrevEditor(cm, -1, upDown) ? nextPrevEditor(cm, -1)
: null; : null;
}, },
async replaceStyle(newStyle, draft) { async replaceStyle(newStyle) {
const sameCode = styleSectionsEqual(newStyle, getModel()); dirty.clear();
if (!sameCode && !draft && !await messageBoxProxy.confirm(t('styleUpdateDiscardChanges'))) {
return;
}
if (!draft) {
dirty.clear();
}
// FIXME: avoid recreating all editors? // FIXME: avoid recreating all editors?
if (!sameCode) { await initSections(newStyle.sections, {replace: true});
await initSections(newStyle.sections, { Object.assign(style, newStyle);
keepDirty: draft, editor.onStyleUpdated();
replace: true, updateHeader();
si: draft && draft.si, // Go from new style URL to edit style URL
}); if (style.id && !/[&?]id=/.test(location.search)) {
history.replaceState({}, document.title, `${location.pathname}?id=${style.id}`);
} }
editor.useSavedStyle(newStyle);
updateLivePreview(); updateLivePreview();
}, },
async saveImpl() { async save() {
if (!dirty.isDirty()) {
return;
}
let newStyle = getModel(); let newStyle = getModel();
if (!validate(newStyle)) { if (!validate(newStyle)) {
return; return;
} }
newStyle = await API.styles.editSave(newStyle); newStyle = await API.styles.editSave(newStyle);
dirty.clear(); destroyRemovedSections();
editor.useSavedStyle(newStyle); if (!style.id) {
editor.emit('styleChange', newStyle, 'new');
}
sessionStore.justEditedStyleId = newStyle.id;
editor.replaceStyle(newStyle, false);
}, },
scrollToEditor(cm, partial) { scrollToEditor(cm) {
const cc = partial && cm.cursorCoords(true, 'window'); const {el} = sections.find(s => s.cm === cm);
const {top: y1, bottom: y2} = cm.el.getBoundingClientRect(); const r = el.getBoundingClientRect();
const rc = container.getBoundingClientRect(); const h = window.innerHeight;
const rcY1 = Math.max(rc.top, 0); if (r.bottom > h && r.top > 0 ||
const rcY2 = Math.min(rc.bottom, innerHeight); r.bottom < h && r.top < 0) {
const bad = partial window.scrollBy(0, (r.top + r.bottom - h) / 2 | 0);
? cc.top < rcY1 || cc.top > rcY2 - 30 }
: y1 >= rcY1 ^ y2 <= rcY2;
if (bad) window.scrollBy(0, (y1 + y2 - rcY2 + rcY1) / 2 | 0);
}, },
}); });
return initSections(style.sections); editor.ready = initSections(style.sections);
editor.on('styleToggled', newStyle => {
if (!dirty.isDirty()) {
Object.assign(style, newStyle);
} else {
editor.toggleStyle(newStyle.enabled);
}
updateHeader();
updateLivePreview();
});
editor.on('styleChange', (newStyle, reason) => {
if (reason === 'new') return; // nothing is new for us
if (reason === 'config') {
delete newStyle.sections;
delete newStyle.name;
delete newStyle.enabled;
Object.assign(style, newStyle);
updateLivePreview();
return;
}
editor.replaceStyle(newStyle);
});
/** @param {EditorSection} section */ /** @param {EditorSection} section */
function fitToContent(section) { function fitToContent(section) {
@ -299,36 +316,10 @@ function SectionsEditor() {
} }
} }
function handleKeydown(event) { function nextPrevEditor(cm, direction) {
if (event.shiftKey || event.altKey || event.metaKey ||
event.key !== 'ArrowUp' && event.key !== 'ArrowDown') {
return;
}
let pos;
let cm = this.CodeMirror;
const {line, ch} = cm.getCursor();
if (event.key === 'ArrowUp') {
cm = line === 0 && editor.prevEditor(cm, true);
pos = cm && [cm.doc.size - 1, ch];
} else {
cm = line === cm.doc.size - 1 && editor.nextEditor(cm, true);
pos = cm && [0, 0];
}
if (cm) {
cm.setCursor(...pos);
event.preventDefault();
event.stopPropagation();
}
}
function handleKeydownSetup(cm, state) {
cm.display.wrapper[state ? 'on' : 'off']('keydown', handleKeydown, true);
}
function nextPrevEditor(cm, direction, upDown) {
const editors = editor.getEditors(); const editors = editor.getEditors();
cm = editors[(editors.indexOf(cm) + direction + editors.length) % editors.length]; cm = editors[(editors.indexOf(cm) + direction + editors.length) % editors.length];
editor.scrollToEditor(cm, upDown); editor.scrollToEditor(cm);
cm.focus(); cm.focus();
return cm; return cm;
} }
@ -430,7 +421,7 @@ function SectionsEditor() {
} }
function lockPageUI(locked) { function lockPageUI(locked) {
$.root.style.pointerEvents = locked ? 'none' : ''; document.documentElement.style.pointerEvents = locked ? 'none' : '';
if (popup.codebox) { if (popup.codebox) {
popup.classList.toggle('ready', locked ? false : !popup.codebox.isBlank()); popup.classList.toggle('ready', locked ? false : !popup.codebox.isBlank());
popup.codebox.options.readOnly = locked; popup.codebox.options.readOnly = locked;
@ -486,7 +477,19 @@ function SectionsEditor() {
return true; return true;
} }
function updateMeta() { function destroyRemovedSections() {
for (let i = 0; i < sections.length;) {
if (!sections[i].removed) {
i++;
continue;
}
sections[i].destroy();
sections[i].el.remove();
sections.splice(i, 1);
}
}
function updateHeader() {
$('#name').value = style.customName || style.name || ''; $('#name').value = style.customName || style.name || '';
$('#enabled').checked = style.enabled !== false; $('#enabled').checked = style.enabled !== false;
$('#url').href = style.url || ''; $('#url').href = style.url || '';
@ -504,15 +507,14 @@ function SectionsEditor() {
async function initSections(src, { async function initSections(src, {
focusOn = 0, focusOn = 0,
replace = false, replace = false,
keepDirty = false, keepDirty = false, // used by import
si = editor.scrollInfo,
} = {}) { } = {}) {
Object.assign(editor, /** @namespace Editor */ {loading: true});
if (replace) { if (replace) {
sections.forEach(s => s.remove(true)); sections.forEach(s => s.remove(true));
sections.length = 0; sections.length = 0;
container.textContent = ''; container.textContent = '';
} }
let si = editor.scrollInfo;
if (si && si.cms && si.cms.length === src.length) { if (si && si.cms && si.cms.length === src.length) {
si.scrollY2 = si.scrollY + window.innerHeight; si.scrollY2 = si.scrollY + window.innerHeight;
container.style.height = si.scrollY2 + 'px'; container.style.height = si.scrollY2 + 'px';
@ -540,12 +542,9 @@ function SectionsEditor() {
if (!keepDirty) dirty.clear(); if (!keepDirty) dirty.clear();
if (i === focusOn) sections[i].cm.focus(); if (i === focusOn) sections[i].cm.focus();
} }
if (!si || si.cms.every(cm => !cm.height)) { if (!si) requestAnimationFrame(fitToAvailableSpace);
requestAnimationFrame(fitToAvailableSpace);
}
container.style.removeProperty('height'); container.style.removeProperty('height');
setGlobalProgress(); setGlobalProgress();
editor.loading = false;
} }
/** @param {EditorSection} section */ /** @param {EditorSection} section */
@ -611,9 +610,6 @@ function SectionsEditor() {
cm.focus(); cm.focus();
editor.scrollToEditor(cm); editor.scrollToEditor(cm);
} }
if (upDownJumps) {
handleKeydownSetup(cm, true);
}
updateSectionOrder(); updateSectionOrder();
updateLivePreview(); updateLivePreview();
section.onChange(updateLivePreview); section.onChange(updateLivePreview);
@ -646,6 +642,7 @@ function SectionsEditor() {
/** @param {EditorSection} section */ /** @param {EditorSection} section */
function registerEvents(section) { function registerEvents(section) {
const {el, cm} = section; const {el, cm} = section;
$('.applies-to-help', el).onclick = () => helpPopup.show(t('appliesLabel'), t('appliesHelp'));
$('.remove-section', el).onclick = () => removeSection(section); $('.remove-section', el).onclick = () => removeSection(section);
$('.add-section', el).onclick = () => insertSectionAfter(undefined, section); $('.add-section', el).onclick = () => insertSectionAfter(undefined, section);
$('.clone-section', el).onclick = () => insertSectionAfter(section.getModel(), section); $('.clone-section', el).onclick = () => insertSectionAfter(section.getModel(), section);
@ -653,13 +650,16 @@ function SectionsEditor() {
$('.move-section-down', el).onclick = () => moveSectionDown(section); $('.move-section-down', el).onclick = () => moveSectionDown(section);
$('.restore-section', el).onclick = () => restoreSection(section); $('.restore-section', el).onclick = () => restoreSection(section);
cm.on('paste', maybeImportOnPaste); cm.on('paste', maybeImportOnPaste);
if (!FIREFOX) {
cm.on('mousedown', (cm, event) => toggleContextMenuDelete.call(cm, event));
}
} }
function maybeImportOnPaste(cm, event) { function maybeImportOnPaste(cm, event) {
const text = event.clipboardData.getData('text') || ''; const text = event.clipboardData.getData('text') || '';
if (/@-moz-document/i.test(text) && if (/@-moz-document/i.test(text) &&
/@-moz-document\s+(url|url-prefix|domain|regexp)\(/i /@-moz-document\s+(url|url-prefix|domain|regexp)\(/i
.test(text.replace(/\/\*([^*]+|\*(?!\/))*(\*\/|$)/g, '')) .test(text.replace(/\/\*([^*]|\*(?!\/))*(\*\/|$)/g, ''))
) { ) {
event.preventDefault(); event.preventDefault();
showMozillaFormatImport(text); showMozillaFormatImport(text);
@ -670,7 +670,7 @@ function SectionsEditor() {
if (code) { if (code) {
linterMan.enableForEditor(cm, code); linterMan.enableForEditor(cm, code);
} }
if (force) { if (force || !xo) {
refreshOnViewNow(cm); refreshOnViewNow(cm);
} else { } else {
xo.observe(cm.display.wrapper); xo.observe(cm.display.wrapper);
@ -697,4 +697,15 @@ function SectionsEditor() {
linterMan.enableForEditor(cm); linterMan.enableForEditor(cm);
cm.refresh(); cm.refresh();
} }
function toggleContextMenuDelete(event) {
if (chrome.contextMenus && event.button === 2 && prefs.get('editor.contextDelete')) {
chrome.contextMenus.update('editor.contextDelete', {
enabled: Boolean(
this.selectionStart !== this.selectionEnd ||
this.somethingSelected && this.somethingSelected()
),
}, ignoreChromeError);
}
}
} }

View File

@ -1,47 +1,46 @@
#help-popup.style-settings-popup.dirty .title::after {
content: ' *';
}
.compact-layout #help-popup.style-settings-popup {
width: 90%;
}
.style-settings { .style-settings {
padding: 0 1px; /* for focus outline */ padding: 0.7rem 1.7rem;
border: 0; border: 0;
margin: 0; margin: 0;
} }
.style-settings > * { .form-group {
display: block; display: block;
margin: 1rem 0; margin: .6em 0;
padding: 0; padding: 0;
} }
.style-settings > :first-child { .form-label {
margin-top: 0; display: inline-block;
margin: .3em 0;
} }
.style-settings > :last-child { [disabled] .form-label {
margin-bottom: 0; opacity: 0.4;
} }
.style-settings input:disabled ~ label { .form-group input[type=text],
opacity: .5; .form-group input[type=number],
} .form-group select,
.style-settings .w100 { .form-group textarea {
display: block; display: block;
width: 100%; width: 100%;
margin-top: .25em;
box-sizing: border-box; box-sizing: border-box;
} }
.radio-group .form-label {
display: block;
}
.radio-item {
display: flex;
margin: 0.3em 0 .3em;
padding: 0;
align-items: center;
width: max-content;
}
.radio-item input {
margin: 0 0.6em 0 0;
}
[disabled] .radio-label {
opacity: 0.4;
}
.style-settings textarea { .style-settings textarea {
resize: vertical; resize: vertical;
min-width: 33vw;
min-height: 2.5em; min-height: 2.5em;
max-height: 50vh; max-height: 50vh;
} }
.style-settings textarea:not(:placeholder-shown) {
min-width: 50vw;
}
.style-settings .radio-wrapper {
display: inline-flex;
padding: 0 .8em 0 0;
}
a[data-cmd=note] {
vertical-align: text-bottom;
}

View File

@ -1,40 +0,0 @@
<div>
<fieldset class="style-settings">
<div class="rel">
<input id="ss-updatable" type="checkbox">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
<label i18n="installUpdateFromLabel" for="ss-updatable"></label>
<input id="ss-update-url" type="url" class="w100" i18n="placeholder:styleUpdateUrlLabel">
</div>
<div id="ss-scheme">
<div i18n="preferScheme">
<div><small id="ss-scheme-off" i18n="preferSchemeAlways" hidden></small></div>
</div>
<label i18n="+preferSchemeNone" class="radio-wrapper">
<input name="ss-scheme" type="radio" value="none">
</label>
<label i18n="+preferSchemeDark" class="radio-wrapper">
<input name="ss-scheme" type="radio" value="dark">
</label>
<label i18n="+preferSchemeLight" class="radio-wrapper">
<input name="ss-scheme" type="radio" value="light">
</label>
</div>
<label i18n="styleIncludeLabel">
<textarea id="ss-inclusions" spellcheck="false" class="w100"
placeholder="*://site1.com/*&#10;*://site2.com/*"></textarea>
</label>
<label i18n="styleExcludeLabel">
<textarea id="ss-exclusions" spellcheck="false" class="w100"
placeholder="*://site1.com/*&#10;*://site2.com/*"></textarea>
</label>
</fieldset>
<div class="buttons">
<button id="ss-save" i18n="confirmSave" disabled></button>
<label i18n="+configOnChange, title:configOnChangeTooltip">
<input id="config.autosave" type="checkbox">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
</label>
<button id="ss-close" i18n="confirmClose"></button>
</div>
</div>

View File

@ -1,124 +1,84 @@
/* global $ moveFocus setupLivePrefs */// dom.js /* global $ $$ */// dom.js
/* global API */// msg.js /* global API */// msg.js
/* global editor */ /* exported StyleSettings */
/* global helpPopup */// util.js
/* global prefs */
/* global t */// localization.js
/* global debounce tryURL */// toolbox.js
'use strict'; 'use strict';
/* exported StyleSettings */ function StyleSettings(editor) {
async function StyleSettings() { let {style} = editor;
const AUTOSAVE_DELAY = 500; // same as config-dialog.js
const SS_ID = 'styleSettings'; const inputs = [
const PASS = val => val; createInput('.style-update-url input', () => style.updateUrl || '',
await t.fetchTemplate('/edit/settings.html', SS_ID); e => API.styles.config(style.id, 'updateUrl', e.target.value)),
const {style} = editor; createRadio('.style-prefer-scheme input', () => style.preferScheme || 'none',
const ui = t.template[SS_ID].cloneNode(true); e => API.styles.config(style.id, 'preferScheme', e.target.value)),
const elAuto = $('#config\\.autosave', ui); ...[
const elSave = $('#ss-save', ui); ['.style-include', 'inclusions'],
const elUpd = $('#ss-updatable', ui); ['.style-exclude', 'exclusions'],
const pendingSetters = new Map(); ].map(createArea),
const updaters = [
initCheckbox(elUpd, 'updatable', tryURL(style.updateUrl).href),
initInput('#ss-update-url', 'updateUrl', '', {
validate(el) {
elUpd.disabled = !el.value || !el.validity.valid;
return el.validity.valid;
},
}),
initRadio('ss-scheme', 'preferScheme', 'none'),
initArea('inclusions'),
initArea('exclusions'),
]; ];
update();
prefs.subscribe('schemeSwitcher.enabled', (_, val) => {
$('#ss-scheme-off', ui).hidden = val !== 'never';
}, {runNow: true});
window.on(SS_ID, update);
window.on('closeHelp', () => window.off(SS_ID, update), {once: true});
helpPopup.show(t(SS_ID), ui, {
className: 'style-settings-popup',
});
elSave.onclick = save;
$('#ss-close', ui).onclick = helpPopup.close;
setupLivePrefs([elAuto.id]);
moveFocus(ui, 0);
function autosave(el, setter) { update(style);
pendingSetters.set(el, setter);
helpPopup.div.classList.add('dirty');
elSave.disabled = false;
if (elAuto.checked) debounce(save, AUTOSAVE_DELAY);
}
function initArea(type) { editor.on('styleChange', update);
return initInput(`#ss-${type}`, type, [], {
get: textToList,
set: list => list.join('\n'),
validate(el) {
const val = el.value;
el.rows = val.match(/^/gm).length + !val.endsWith('\n');
},
});
}
function initCheckbox(el, key, defVal) {
return initInput(el, key, Boolean(defVal), {dom: 'checked'});
}
function initInput(el, key, defVal, {
dom = 'value', // DOM property name
get = PASS, // transformer function(val) after getting DOM value
set = PASS, // transformer function(val) before setting DOM value
validate = PASS, // function(el) - return `false` to prevent saving
} = {}) {
if (typeof el === 'string') {
el = $(el, ui);
}
el.oninput = () => {
if (validate(el) !== false) {
autosave(el, {dom, get, key});
}
};
return () => {
let val = style[key];
val = set(val != null ? val : defVal);
// Skipping if unchanged to preserve the Undo history of the input
if (el[dom] !== val) el[dom] = val;
validate(el);
};
}
function initRadio(name, key, defVal) {
$(`#${name}`, ui).oninput = e => {
if (e.target.checked) {
autosave(e.target, {key});
}
};
return () => {
const val = style[key] || defVal;
const el = $(`[name="${name}"][value="${val}"]`, ui);
el.checked = true;
};
}
function save() {
pendingSetters.forEach(saveValue);
pendingSetters.clear();
helpPopup.div.classList.remove('dirty');
elSave.disabled = true;
}
function saveValue({dom = 'value', get = PASS, key}, el) {
return API.styles.config(style.id, key, get(el[dom]));
}
function textToList(text) { function textToList(text) {
return text.split(/\n/).map(s => s.trim()).filter(Boolean); const list = text.split(/\s*\r?\n\s*/g);
return list.filter(Boolean);
} }
function update() { function update(newStyle, reason) {
updaters.forEach(fn => fn()); if (!newStyle.id) return;
if (reason === 'editSave') return;
style = newStyle;
$('.style-settings').disabled = false;
inputs.forEach(i => i.update());
}
function createArea([parentSel, type]) {
const sel = parentSel + ' textarea';
const el = $(sel);
el.on('input', () => {
const val = el.value;
el.rows = val.match(/^/gm).length + !val.endsWith('\n');
});
return createInput(sel,
() => {
const list = style[type] || [];
const text = list.join('\n');
el.rows = (list.length || 1) + 1;
return text;
},
() => API.styles.config(style.id, type, textToList(el.value))
);
}
function createRadio(selector, getter, setter) {
const els = $$(selector);
for (const el of els) {
el.addEventListener('change', e => {
if (el.checked) {
setter(e);
}
});
}
return {
update() {
for (const el of els) {
if (el.value === getter()) {
el.checked = true;
}
}
},
};
}
function createInput(selector, getter, setter) {
const el = $(selector);
el.addEventListener('change', setter);
return {
update() {
el.value = getter();
},
};
} }
} }

View File

@ -4,7 +4,7 @@
/* global MozDocMapper */// util.js /* global MozDocMapper */// util.js
/* global MozSectionFinder */ /* global MozSectionFinder */
/* global MozSectionWidget */ /* global MozSectionWidget */
/* global RX_META debounce */// toolbox.js /* global RX_META debounce sessionStore */// toolbox.js
/* global chromeSync */// storage-util.js /* global chromeSync */// storage-util.js
/* global cmFactory */ /* global cmFactory */
/* global editor */ /* global editor */
@ -14,31 +14,23 @@
'use strict'; 'use strict';
/* exported SourceEditor */ /* exported SourceEditor */
async function SourceEditor() { function SourceEditor() {
const {style, /** @type DirtyReporter */dirty} = editor; const {style, /** @type DirtyReporter */dirty} = editor;
const DEFAULT_TEMPLATE = `
/* ==UserStyle==
@name ${''/* a trick to preserve the trailing spaces */}
@namespace github.com/openstyles/stylus
@version 1.0.0
@description A new userstyle
@author Me
==/UserStyle== */
`.replace(/^\s+/gm, '');
let savedGeneration; let savedGeneration;
let placeholderName = '';
let prevMode = NaN; let prevMode = NaN;
$$remove('.sectioned-only'); $$remove('.sectioned-only');
$('#header').on('wheel', headerOnScroll); $('#header').on('wheel', headerOnScroll);
$('#sections').textContent = ''; $('#sections').textContent = '';
$('#sections').appendChild($create('.single-editor')); $('#sections').appendChild($create('.single-editor'));
$('#save-button').on('split-btn', saveTemplate);
if (!style.id) setupNewStyle(style);
const cm = cmFactory.create($('.single-editor')); const cm = cmFactory.create($('.single-editor'));
const sectionFinder = MozSectionFinder(cm); const sectionFinder = MozSectionFinder(cm);
const sectionWidget = MozSectionWidget(cm, sectionFinder); const sectionWidget = MozSectionWidget(cm, sectionFinder);
editor.livePreview.init(preprocess); editor.livePreview.init(preprocess);
if (!style.id) setupNewStyle(await editor.template);
createMetaCompiler(meta => { createMetaCompiler(meta => {
style.usercssData = meta; style.usercssData = meta;
style.name = meta.name; style.name = meta.name;
@ -53,17 +45,10 @@ async function SourceEditor() {
sections: sectionFinder.sections, sections: sectionFinder.sections,
replaceStyle, replaceStyle,
updateLivePreview, updateLivePreview,
updateMeta,
closestVisible: () => cm, closestVisible: () => cm,
getEditors: () => [cm], getEditors: () => [cm],
getEditorTitle: () => '', getEditorTitle: () => '',
getValue: asObject => asObject getValue: () => cm.getValue(),
? {
customName: style.customName,
enabled: style.enabled,
sourceCode: cm.getValue(),
}
: cm.getValue(),
getSearchableInputs: () => [], getSearchableInputs: () => [],
prevEditor: nextPrevSection.bind(null, -1), prevEditor: nextPrevSection.bind(null, -1),
nextEditor: nextPrevSection.bind(null, 1), nextEditor: nextPrevSection.bind(null, 1),
@ -75,7 +60,8 @@ async function SourceEditor() {
cm.focus(); cm.focus();
} }
}, },
async saveImpl() { async save() {
if (!dirty.isDirty()) return;
const sourceCode = cm.getValue(); const sourceCode = cm.getValue();
try { try {
const {customName, enabled, id} = style; const {customName, enabled, id} = style;
@ -84,12 +70,21 @@ async function SourceEditor() {
messageBoxProxy.alert(t('usercssAvoidOverwriting'), 'danger', t('genericError')); messageBoxProxy.alert(t('usercssAvoidOverwriting'), 'danger', t('genericError'));
} else { } else {
res = await API.usercss.editSave({customName, enabled, id, sourceCode}); res = await API.usercss.editSave({customName, enabled, id, sourceCode});
if (!id) {
editor.emit('styleChange', res.style, 'new');
}
// Awaiting inside `try` so that exceptions go to our `catch` // Awaiting inside `try` so that exceptions go to our `catch`
await replaceStyle(res.style); await replaceStyle(res.style);
} }
showLog(res); showLog(res);
} catch (err) { } catch (err) {
showSaveError(err); const i = err.index;
const isNameEmpty = i > 0 &&
err.code === 'missingValue' &&
sourceCode.slice(sourceCode.lastIndexOf('\n', i - 1), i).trim().endsWith('@name');
return isNameEmpty
? saveTemplate(sourceCode)
: showSaveError(err);
} }
}, },
scrollToEditor: () => {}, scrollToEditor: () => {},
@ -101,6 +96,7 @@ async function SourceEditor() {
'editor.toc.expanded': (k, val) => sectionFinder.onOff(editor.updateToc, val), 'editor.toc.expanded': (k, val) => sectionFinder.onOff(editor.updateToc, val),
}, {runNow: true}); }, {runNow: true});
editor.applyScrollInfo(cm);
cm.clearHistory(); cm.clearHistory();
cm.markClean(); cm.markClean();
savedGeneration = cm.changeGeneration(); savedGeneration = cm.changeGeneration();
@ -120,7 +116,26 @@ async function SourceEditor() {
if (!$isTextInput(document.activeElement)) { if (!$isTextInput(document.activeElement)) {
cm.focus(); cm.focus();
} }
editor.applyScrollInfo(cm); // WARNING! Place it after all cm.XXX calls that change scroll pos editor.on('styleToggled', newStyle => {
if (dirty.isDirty()) {
editor.toggleStyle(newStyle.enabled);
} else {
style.enabled = newStyle.enabled;
}
updateMeta();
updateLivePreview();
});
editor.on('styleChange', (newStyle, reason) => {
if (reason === 'new') return;
if (reason === 'config') {
delete newStyle.sourceCode;
delete newStyle.name;
Object.assign(style, newStyle);
updateLivePreview();
return;
}
replaceStyle(newStyle);
});
async function preprocess(style) { async function preprocess(style) {
const res = await API.usercss.build({ const res = await API.usercss.build({
@ -168,21 +183,34 @@ async function SourceEditor() {
return name; return name;
} }
function setupNewStyle(tpl) { async function setupNewStyle(style) {
const comment = `/* ${t('usercssReplaceTemplateSectionBody')} */`; style.sections[0].code = ' '.repeat(prefs.get('editor.tabSize')) +
const sec0 = style.sections[0]; `/* ${t('usercssReplaceTemplateSectionBody')} */`;
sec0.code = ' '.repeat(prefs.get('editor.tabSize')) + comment; let section = MozDocMapper.styleToCss(style);
if (Object.keys(sec0).length === 1) { // the only key is 'code' if (!section.includes('@-moz-document')) {
sec0.domains = ['example.com']; style.sections[0].domains = ['example.com'];
section = MozDocMapper.styleToCss(style);
} }
style.name = [style.name, new Date().toLocaleString()].filter(Boolean).join(' - '); const DEFAULT_CODE = `
style.sourceCode = (tpl || DEFAULT_TEMPLATE) /* ==UserStyle==
.replace(/(@name)(?:([\t\x20]+).*|\n)/, (_, k, space) => `${k}${space || ' '}${style.name}`) @name ${''/* a trick to preserve the trailing spaces */}
.replace(/\s*@-moz-document[^{]*{([^}]*)}\s*$/g, // stripping dummy sections @namespace github.com/openstyles/stylus
(s, body) => body.trim() === comment ? '\n\n' : s) @version 1.0.0
.trim() + @description A new userstyle
'\n\n' + @author Me
MozDocMapper.styleToCss(style); ==/UserStyle== */
`.replace(/^\s+/gm, '');
dirty.clear('sourceGeneration');
style.sourceCode = '';
placeholderName = `${style.name || t('usercssReplaceTemplateName')} - ${new Date().toLocaleString()}`;
let code = await chromeSync.getLZValue(chromeSync.LZ_KEY.usercssTemplate);
code = code || DEFAULT_CODE;
code = code.replace(/@name(\s*)(?=[\r\n])/, (str, space) =>
`${str}${space ? '' : ' '}${placeholderName}`);
// strip the last dummy section if any, add an empty line followed by the section
style.sourceCode = code.replace(/\s*@-moz-document[^{]*{[^}]*}\s*$|\s+$/g, '') + '\n\n' + section;
cm.startOperation(); cm.startOperation();
cm.setValue(style.sourceCode); cm.setValue(style.sourceCode);
cm.clearHistory(); cm.clearHistory();
@ -194,60 +222,57 @@ async function SourceEditor() {
function updateMeta() { function updateMeta() {
const name = style.customName || style.name; const name = style.customName || style.name;
$('#name').value = name; if (name !== placeholderName) {
$('#name').value = name;
}
$('#enabled').checked = style.enabled; $('#enabled').checked = style.enabled;
$('#url').href = style.url; $('#url').href = style.url;
editor.updateName(); editor.updateName();
cm.setPreprocessor((style.usercssData || {}).preprocessor); cm.setPreprocessor((style.usercssData || {}).preprocessor);
} }
async function replaceStyle(newStyle, draft) { function replaceStyle(newStyle) {
dirty.clear('name'); dirty.clear('name');
const sameCode = newStyle.sourceCode === cm.getValue(); const sameCode = newStyle.sourceCode === cm.getValue();
if (sameCode) { if (sameCode) {
savedGeneration = cm.changeGeneration(); savedGeneration = cm.changeGeneration();
dirty.clear('sourceGeneration'); dirty.clear('sourceGeneration');
editor.useSavedStyle(newStyle); updateEnvironment();
dirty.clear('enabled'); dirty.clear('enabled');
updateLivePreview(); updateLivePreview();
return; return;
} }
if (draft || await messageBoxProxy.confirm(t('styleUpdateDiscardChanges'))) { Promise.resolve(messageBoxProxy.confirm(t('styleUpdateDiscardChanges'))).then(ok => {
editor.useSavedStyle(newStyle); if (!ok) return;
updateEnvironment();
if (!sameCode) { if (!sameCode) {
const si0 = draft && draft.si.cms[0]; const cursor = cm.getCursor();
const cursor = !si0 && cm.getCursor();
cm.setValue(style.sourceCode); cm.setValue(style.sourceCode);
if (si0) { cm.setCursor(cursor);
editor.applyScrollInfo(cm, si0);
} else {
cm.setCursor(cursor);
}
savedGeneration = cm.changeGeneration(); savedGeneration = cm.changeGeneration();
} }
if (sameCode) { if (sameCode) {
// the code is same but the environment is changed // the code is same but the environment is changed
updateLivePreview(); updateLivePreview();
} }
if (!draft) { dirty.clear();
dirty.clear(); });
function updateEnvironment() {
if (style.id !== newStyle.id) {
history.replaceState({}, '', `?id=${newStyle.id}`);
} }
sessionStore.justEditedStyleId = newStyle.id;
Object.assign(style, newStyle);
editor.onStyleUpdated();
updateMeta();
} }
} }
async function saveTemplate() { async function saveTemplate(code) {
const res = await messageBoxProxy.show({ if (await messageBoxProxy.confirm(t('usercssReplaceTemplateConfirmation'))) {
contents: t('usercssReplaceTemplateConfirmation'),
className: 'center',
buttons: [t('confirmYes'), t('confirmNo'), {
textContent: t('genericResetLabel'),
title: t('restoreTemplate'),
}],
});
if (res.enter || res.button !== 1) {
const key = chromeSync.LZ_KEY.usercssTemplate; const key = chromeSync.LZ_KEY.usercssTemplate;
const code = res.button === 2 ? DEFAULT_TEMPLATE : cm.getValue();
await chromeSync.setLZValue(key, code); await chromeSync.setLZValue(key, code);
if (await chromeSync.getLZValue(key) !== code) { if (await chromeSync.getLZValue(key) !== code) {
messageBoxProxy.alert(t('syncStorageErrorSaving')); messageBoxProxy.alert(t('syncStorageErrorSaving'));

28
edit/tab.css Normal file
View File

@ -0,0 +1,28 @@
.tab-container {
display: flex;
flex-direction: column;
}
.tab-bar {
display: flex;
flex-direction: row;
border-bottom: 1px solid silver;
padding: 5px 5px 0 15px;
}
.tab-bar-item {
margin: 0 0.3em;
padding: 0.3em 0.6em;
border: 1px solid silver;
border-bottom: none;
background: silver;
cursor: pointer;
}
.tab-bar-item.active {
background: white;
}
.tab-panel {
flex-grow: 1;
}
.tab-panel > :not(.active) {
display: none;
}

19
edit/tab.js Normal file
View File

@ -0,0 +1,19 @@
'use strict';
(() => {
for (const container of document.querySelectorAll('.tab-container')) {
init(container);
}
function init(container) {
const tabButtons = [...container.querySelector('.tab-bar').children];
const tabPanels = [...container.querySelector('.tab-panel').children];
tabButtons.forEach((button, i) => button.addEventListener('click', () => activate(i)));
function activate(index) {
const toggleActive = (button, i) => button.classList.toggle('active', i === index);
tabButtons.forEach(toggleActive);
tabPanels.forEach(toggleActive);
}
}
})();

View File

@ -1,6 +1,7 @@
/* global $ $create $remove messageBoxProxy showSpinner toggleDataset */// dom.js /* global $ $create $remove messageBoxProxy showSpinner toggleDataset */// dom.js
/* global API msg */// msg.js /* global API msg */// msg.js
/* global URLS */// toolbox.js /* global URLS */// toolbox.js
/* global baseInit */
/* global editor */ /* global editor */
/* global t */// localization.js /* global t */// localization.js
'use strict'; 'use strict';
@ -21,11 +22,11 @@
} }
}); });
window.on('domReady', () => { baseInit.ready.then(() => {
updateUI(); updateUI();
$('#usw-publish-style').onclick = disableWhileActive(publishStyle); $('#usw-publish-style').onclick = disableWhileActive(publishStyle);
$('#usw-disconnect').onclick = disableWhileActive(disconnect); $('#usw-disconnect').onclick = disableWhileActive(disconnect);
}, {once: true}); });
async function publishStyle() { async function publishStyle() {
const {id} = editor.style; const {id} = editor.style;

View File

@ -7,54 +7,47 @@
const helpPopup = { const helpPopup = {
/** show(title = '', body) {
* @param {string} title - plain text
* @param {string|Node} body - Node, html or plain text
* @param {Node} [props] - DOM props for the popup element
* @returns {Element} the popup
*/
show(title = '', body, props) {
const div = $('#help-popup'); const div = $('#help-popup');
const contents = $('.contents', div); const contents = $('.contents', div);
div.style = '';
div.className = ''; div.className = '';
contents.textContent = ''; contents.textContent = '';
Object.assign(div, props);
if (body) { if (body) {
contents.appendChild(typeof body === 'string' ? t.HTML(body) : body); contents.appendChild(typeof body === 'string' ? t.HTML(body) : body);
} }
$('.title', div).textContent = title; $('.title', div).textContent = title;
$('.dismiss', div).onclick = helpPopup.close; $('.dismiss', div).onclick = helpPopup.close;
window.on('keydown', helpPopup.close, true); window.on('keydown', helpPopup.close, true);
div.style.display = 'block'; // reset any inline styles
div.style = 'display: block';
helpPopup.originalFocus = document.activeElement; helpPopup.originalFocus = document.activeElement;
helpPopup.div = div;
moveFocus(div, 0);
return div; return div;
}, },
close(event) { close(event) {
let el;
const canClose = const canClose =
!event || !event ||
event.type === 'click' || event.type === 'click' || (
getEventKeyName(event) === 'Escape' && !$('.CodeMirror-hints, #message-box') && ( getEventKeyName(event) === 'Escape' &&
!(el = document.activeElement) || !$('.CodeMirror-hints, #message-box') && (
!el.closest('#search-replace-dialog') !document.activeElement ||
!document.activeElement.closest('#search-replace-dialog') &&
document.activeElement.matches(':not(input), .can-close-on-esc')
)
); );
const {div} = helpPopup; const div = $('#help-popup');
if (!canClose || !div) { if (!canClose || !div) {
return; return;
} }
if (event && (el = div.codebox) && !el.options.readOnly && !el.isClean()) { if (event && div.codebox && !div.codebox.options.readOnly && !div.codebox.isClean()) {
setTimeout(async () => { setTimeout(async () => {
const ok = await messageBoxProxy.confirm(t('confirmDiscardChanges')); const ok = await messageBoxProxy.confirm(t('confirmDiscardChanges'));
return ok && helpPopup.close(); return ok && helpPopup.close();
}); });
return; return;
} }
if (div.contains(document.activeElement) && (el = helpPopup.originalFocus)) { if (div.contains(document.activeElement) && helpPopup.originalFocus) {
el.focus(); helpPopup.originalFocus.focus();
} }
const contents = $('.contents', div); const contents = $('.contents', div);
div.style.display = ''; div.style.display = '';
@ -177,7 +170,8 @@ function createHotkeyInput(prefId, {buttons = true, onDone}) {
/* exported showCodeMirrorPopup */ /* exported showCodeMirrorPopup */
function showCodeMirrorPopup(title, html, options) { function showCodeMirrorPopup(title, html, options) {
const popup = helpPopup.show(title, html, {className: 'big'}); const popup = helpPopup.show(title, html);
popup.classList.add('big');
let cm = popup.codebox = CodeMirror($('.contents', popup), Object.assign({ let cm = popup.codebox = CodeMirror($('.contents', popup), Object.assign({
mode: 'css', mode: 'css',
@ -192,7 +186,7 @@ function showCodeMirrorPopup(title, html, options) {
}, options)); }, options));
cm.focus(); cm.focus();
$.root.style.pointerEvents = 'none'; document.documentElement.style.pointerEvents = 'none';
popup.style.pointerEvents = 'auto'; popup.style.pointerEvents = 'auto';
const onKeyDown = event => { const onKeyDown = event => {
@ -207,7 +201,7 @@ function showCodeMirrorPopup(title, html, options) {
window.on('closeHelp', () => { window.on('closeHelp', () => {
window.off('keydown', onKeyDown, true); window.off('keydown', onKeyDown, true);
$.root.style.removeProperty('pointer-events'); document.documentElement.style.removeProperty('pointer-events');
cm = popup.codebox = null; cm = popup.codebox = null;
}, {once: true}); }, {once: true});

View File

@ -1,160 +0,0 @@
@media screen and (prefers-color-scheme: dark), dark {
:root {
/* Comfortable dark themes don't use absolutes so the range is compressed */
--c00: hsl(0, 0%, 80%);
--c10: hsl(0, 0%, 73.5%);
--c20: hsl(0, 0%, 66%);
--c30: hsl(0, 0%, 59.5%);
--c40: hsl(0, 0%, 53%);
--c45: hsl(0, 0%, 49.75%);
--c50: hsl(0, 0%, 46.5%);
--c60: hsl(0, 0%, 40%);
--c65: hsl(0, 0%, 36.75%);
--c70: hsl(0, 0%, 33.5%);
--c75: hsl(0, 0%, 30.25%);
--c80: hsl(0, 0%, 27%);
--c85: hsl(0, 0%, 23.75%);
--c90: hsl(0, 0%, 20.5%);
--c95: hsl(0, 0%, 17.25%);
--c100: hsl(0, 0%, 14%);
/* min/max are exposed in case we want to use an overdrive color for emphasis */
--cmin: hsl(0, 0%, 100%);
--cmax: hsl(0, 0%, 0%);
--accent-1: hsl(180, 100%, 95%);
--accent-3: hsl(180, 30%, 18%);
--input-bg: var(--c95);
--red1: hsl(0, 85%, 55%);
}
textarea,
input[type=url],
input[type=time] {
background-color: var(--input-bg);
color: var(--fg);
}
input::-webkit-inner-spin-button {
filter: invert(.8);
}
input[type=radio]:checked:after {
background-color: var(--fg);
}
input[type=time]::-webkit-calendar-picker-indicator {
filter: invert(1);
}
select {
background-color: var(--bg);
}
.onoffswitch {
--knob: var(--c50);
}
.CodeMirror-scrollbar-filler,
.CodeMirror-gutter-filler {
background-color: var(--bg) !important;
border: 0;
}
::-webkit-scrollbar {
width: 17px;
height: 17px;
background: var(--bg);
}
::-webkit-scrollbar-corner {
background: var(--bg);
border: 0;
}
/* buttons */
::-webkit-scrollbar-button:single-button {
height: 17px;
width: 17px;
background-size: 9px;
background-position: 4px 7px;
background-repeat: no-repeat;
}
::-webkit-scrollbar-button:horizontal:single-button {
background-position: 7px 4px;
}
/* up */
::-webkit-scrollbar-button:single-button:vertical:decrement {
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='2' height='2' fill='hsl(0, 0%, 35%)'><polygon points='1,0 0,1 2,1'/></svg>");
}
::-webkit-scrollbar-button:single-button:vertical:decrement:hover {
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='2' height='2' fill='hsl(0, 0%, 45%)'><polygon points='1,0 0,1 2,1'/></svg>");
}
::-webkit-scrollbar-button:single-button:vertical:decrement:active {
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='2' height='2' fill='hsl(0, 0%, 55%)'><polygon points='1,0 0,1 2,1'/></svg>");
}
/* down */
::-webkit-scrollbar-button:single-button:vertical:increment {
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='2' height='2' fill='hsl(0, 0%, 35%)'><polygon points='0,0 2,0 1,1'/></svg>");
}
::-webkit-scrollbar-button:single-button:vertical:increment:hover {
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='2' height='2' fill='hsl(0, 0%, 45%)'><polygon points='0,0 2,0 1,1'/></svg>");
}
::-webkit-scrollbar-button:single-button:vertical:increment:active {
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='2' height='2' fill='hsl(0, 0%, 55%)'><polygon points='0,0 2,0 1,1'/></svg>");
}
/* left */
::-webkit-scrollbar-button:single-button:horizontal:decrement {
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='2' height='2' fill='hsl(0, 0%, 35%)'><polygon points='0,1 1,2 1,0'/></svg>");
}
::-webkit-scrollbar-button:single-button:horizontal:decrement:hover {
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='2' height='2' fill='hsl(0, 0%, 45%)'><polygon points='0,1 1,2 1,0'/></svg>");
}
::-webkit-scrollbar-button:single-button:horizontal:decrement:active {
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='2' height='2' fill='hsl(0, 0%, 55%)'><polygon points='0,1 1,2 1,0'/></svg>");
}
/* right */
::-webkit-scrollbar-button:single-button:horizontal:increment {
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='2' height='2' fill='hsl(0, 0%, 35%)'><polygon points='0,0 0,2 1,1'/></svg>");
}
::-webkit-scrollbar-button:single-button:horizontal:increment:hover {
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='2' height='2' fill='hsl(0, 0%, 45%)'><polygon points='0,0 0,2 1,1'/></svg>");
}
::-webkit-scrollbar-button:single-button:horizontal:increment:active {
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='2' height='2' fill='hsl(0, 0%, 55%)'><polygon points='0,0 0,2 1,1'/></svg>");
}
::-webkit-scrollbar-track-piece {
background: hsl(0, 0%, 17%);
border: 1px solid var(--bg);
}
::-webkit-scrollbar-track-piece:hover {
background: hsl(0, 0%, 20%);
}
::-webkit-scrollbar-track-piece:active {
background: hsl(0, 0%, 25%);
}
::-webkit-scrollbar-thumb {
background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='1' height='1' fill='hsl(0, 0%, 30%)'><rect width='1' height='1'/></svg>") 2px 2px no-repeat;
}
::-webkit-scrollbar-thumb:horizontal {
background-size: 100% 13px;
}
::-webkit-scrollbar-thumb:vertical {
background-size: 13px 100%;
}
::-webkit-scrollbar-thumb:hover {
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='1' height='1' fill='hsl(0, 0%, 33%)'><rect width='1' height='1'/></svg>");
}
::-webkit-scrollbar-thumb:active {
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='1' height='1' fill='hsl(0, 0%, 40%)'><rect width='1' height='1'/></svg>");
}
::-webkit-resizer {
background: var(--input-bg) linear-gradient(-45deg,
transparent 3px, #888 3px,
#888 4px, transparent 4px,
transparent 6px, #888 6px,
#888 7px, transparent 7px) no-repeat;
border: 2px solid transparent;
}
:-webkit-autofill {
box-shadow: 0 0 0 1000px var(--input-bg) inset;
-webkit-text-fill-color: #fff;
}
@supports (-moz-appearance: none) {
/* Workarounds for FF bugs/quirks */
textarea {
border: 1px solid var(--c65);
}
* {
scrollbar-color: var(--c75) var(--bg);
}
}
}

View File

@ -1,52 +1,21 @@
@supports not (accent-color: red) { html#stylus #header *:not(#\1transition-suppressor) {
/* This suppresses a bug in all? browsers: they apply transitions during page load. /* This suppresses a bug in all? browsers: they apply transitions during page load.
* It was fixed by crrev.com/886802 in Chrome 93, which we detect via `accent-color`.
* Using an increased specificity to override sane selectors in user styles. * Using an increased specificity to override sane selectors in user styles.
* Using \1 to simplify js code because \0 is converted to \xFFFD per spec. */ * Using \1 to simplify js code because \0 is converted to \xFFFD per spec. */
html#stylus #header *:not(#\1transition-suppressor) { transition: none !important;
transition: none !important;
}
}
:root {
--family: Arial, "Helvetica Neue", Helvetica, system-ui, sans-serif;
--input-height: 22px;
--cmin: hsl(0, 0%, 00%);
--c00: hsl(0, 0%, 00%);
--c10: hsl(0, 0%, 10%);
--c20: hsl(0, 0%, 20%);
--c30: hsl(0, 0%, 30%);
--c40: hsl(0, 0%, 40%);
--c45: hsl(0, 0%, 45%);
--c50: hsl(0, 0%, 50%);
--c60: hsl(0, 0%, 60%);
--c65: hsl(0, 0%, 65%);
--c70: hsl(0, 0%, 70%);
--c75: hsl(0, 0%, 75%);
--c80: hsl(0, 0%, 80%);
--c85: hsl(0, 0%, 85%);
--c90: hsl(0, 0%, 90%);
--c95: hsl(0, 0%, 95%);
--c100: hsl(0, 0%, 100%);
--cmax: hsl(0, 0%, 100%);
--bg: var(--c100);
--fg: var(--c00);
--accent-1: hsl(180, 100%, 15%);
--accent-2: hsl(180, 50%, 40%);
--accent-3: hsl(180, 40%, 69%);
--red1: hsl(0, 70%, 45%);
} }
body { body {
font: normal 12px var(--family); font: normal 12px Arial, system-ui, sans-serif;
background-color: var(--bg);
color: var(--fg);
margin: 0;
} }
body:lang(ja) { body:lang(ja) {
font-family: Arial, 'Meiryo UI', 'MS Gothic', system-ui, sans-serif; font-family: Arial, 'Meiryo UI', 'MS Gothic', system-ui, sans-serif;
} }
body:lang(zh-CN) { body:lang(zh-CN) {
font-family: Arial, 'Microsoft YaHei UI', 'Microsoft YaHei', system-ui, sans-serif; font-family: Arial, 'Microsoft YaHei UI', 'Microsoft YaHei', system-ui, sans-serif;
} }
body:lang(zh-TW), body:lang(zh-TW),
body:lang(zh-HK) { body:lang(zh-HK) {
font-family: Arial, 'Microsoft JhengHei UI', 'Microsoft JhengHei', system-ui, sans-serif; font-family: Arial, 'Microsoft JhengHei UI', 'Microsoft JhengHei', system-ui, sans-serif;
@ -61,12 +30,11 @@ button {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
padding: 2px 7px; padding: 2px 7px;
border: 1px solid var(--c60); border: 1px solid hsl(0, 0%, 62%);
font: inherit; font: inherit;
font-size: 13px; font-size: 13px;
line-height: 1.2; color: #000;
color: var(--fg); background-color: hsl(0, 0%, 100%);
background-color: var(--bg);
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAeCAYAAADtlXTHAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QwGBBwIHvKt6QAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAAL0lEQVQI12NoaGgQZ2JgYGBkYmBgYGZiYGBggrMY4VxsYsyoskQQCB2MWAxAMhkADVECDhlW9CoAAAAASUVORK5CYII='); background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAeCAYAAADtlXTHAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QwGBBwIHvKt6QAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAAL0lEQVQI12NoaGgQZ2JgYGBkYmBgYGZiYGBggrMY4VxsYsyoskQQCB2MWAxAMhkADVECDhlW9CoAAAAASUVORK5CYII=');
background-repeat: repeat-x; background-repeat: repeat-x;
background-size: 100% 100%; background-size: 100% 100%;
@ -74,55 +42,39 @@ button {
} }
button:not(:disabled):hover { button:not(:disabled):hover {
background-color: var(--c95); background-color: hsl(0, 0%, 95%);
border-color: var(--c50); border-color: hsl(0, 0%, 52%);
} }
button:active { button:active {
background-color: var(--c95); background-color: hsl(0, 0%, 95%);
border-color: var(--c50); border-color: hsl(0, 0%, 52%);
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAeCAYAAADtlXTHAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QwJARIWJNZvuQAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAAMElEQVQI12NoaGgIZmJgYPjLxMDA8I+JgYHhP5z1Dy7xH5X7jxQCzWQ0A9DEILYBABm5HtJk2jPHAAAAAElFTkSuQmCC'); background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAeCAYAAADtlXTHAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QwJARIWJNZvuQAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAAMElEQVQI12NoaGgIZmJgYPjLxMDA8I+JgYHhP5z1Dy7xH5X7jxQCzWQ0A9DEILYBABm5HtJk2jPHAAAAAElFTkSuQmCC');
background-repeat: repeat-x; background-repeat: repeat-x;
background-size: 100% 100%; background-size: 100% 100%;
} }
button .svg-icon {
cursor: auto;
}
[data-ui-theme="light"] button .svg-icon {
/* Our svgs are pixel-aligned so the default #000 looks too strong */
fill: #333;
}
/* For some odd reason these hovers appear lighter than all other button hovers in every browser */ /* For some odd reason these hovers appear lighter than all other button hovers in every browser */
#message-box-buttons button:not(:disabled):hover { #message-box-buttons button:not(:disabled):hover {
background-color: var(--c90); background-color: hsl(0, 0%, 90%);
border-color: var(--c50); border-color: hsl(0, 0%, 50%);
} }
input { input {
font: inherit; font: inherit;
border: 1px solid var(--c65); border: 1px solid hsl(0, 0%, 66%);
transition: border-color .1s, box-shadow .1s; transition: border-color .1s, box-shadow .1s;
} }
input:not([type]), input:not([type]),
input[type=text],
input[type=number],
input[type=search] { input[type=search] {
background: var(--bg); background: #fff;
color: var(--fg); color: #000;
height: var(--input-height); height: 22px;
min-height: var(--input-height)!important; min-height: 22px!important;
line-height: var(--input-height); line-height: 22px;
box-sizing: border-box;
padding: 0 3px; padding: 0 3px;
border: 1px solid var(--c65); border: 1px solid hsl(0, 0%, 66%);
}
input:invalid {
background-color: rgba(255, 0, 0, 0.1);
color: darkred;
} }
.svg-icon { .svg-icon {
@ -131,11 +83,11 @@ input:invalid {
transition: fill .5s; transition: fill .5s;
width: 20px; width: 20px;
height: 20px; height: 20px;
fill: var(--c40); fill: #666;
} }
.svg-icon:hover { .svg-icon:hover {
fill: var(--fg); fill: #000;
} }
.svg-icon.info { .svg-icon.info {
@ -154,7 +106,7 @@ input:invalid {
height: 8px; height: 8px;
width: 8px; width: 8px;
display: none; display: none;
fill: var(--fg); fill: #000;
margin: 2px 0 0 2px; margin: 2px 0 0 2px;
} }
@ -169,7 +121,7 @@ input[type="checkbox"]:not(.slider) {
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
border: 1px solid var(--c45); border: 1px solid hsl(0, 0%, 46%);
height: 12px; height: 12px;
width: 12px; width: 12px;
display: inline-flex; display: inline-flex;
@ -180,8 +132,8 @@ input[type="checkbox"]:not(.slider) {
} }
input[type="checkbox"]:not(.slider):hover { input[type="checkbox"]:not(.slider):hover {
border-color: var(--c30); border-color: hsl(0, 0%, 32%);
background-color: var(--c80); background-color: hsl(0, 0%, 82%);
} }
input[type="checkbox"]:not(.slider):checked + .svg-icon.checked { input[type="checkbox"]:not(.slider):checked + .svg-icon.checked {
@ -193,33 +145,29 @@ input[type="checkbox"]:not(.slider):checked + .svg-icon.checked {
input[type="checkbox"]:not(.slider):disabled { input[type="checkbox"]:not(.slider):disabled {
background-color: transparent; background-color: transparent;
border-color: var(--c50); border-color: hsl(0, 0%, 50%);
} }
input[type="checkbox"]:not(.slider):disabled + .svg-icon.checked { input[type="checkbox"]:not(.slider):disabled + .svg-icon.checked {
fill: var(--c50); fill: hsl(0, 0%, 50%);
} }
input[type="checkbox"]:not(.slider):disabled + .svg-icon.checked + span { input[type="checkbox"]:not(.slider):disabled + .svg-icon.checked + span {
color: var(--c50); color: hsl(0, 0%, 50%);
} }
label { label {
transition: color .1s; transition: color .1s;
} }
.checkbox-wrapper {
padding-left: 16px;
position: relative;
}
select { select {
-moz-appearance: none; -moz-appearance: none;
-webkit-appearance: none; -webkit-appearance: none;
height: var(--input-height); height: 22px;
font: inherit; font: inherit;
color: var(--fg); color: #000;
background-color: transparent; background-color: transparent;
border: 1px solid var(--c65); border: 1px solid hsl(0, 0%, 66%);
padding: 0 20px 0 6px; padding: 0 20px 0 6px;
transition: color .5s; transition: color .5s;
} }
@ -237,7 +185,7 @@ select {
display: inline-flex; display: inline-flex;
height: 14px; height: 14px;
width: 14px; width: 14px;
fill: var(--fg); fill: #000;
position: absolute; position: absolute;
top: 4px; top: 4px;
right: 4px; right: 4px;
@ -247,15 +195,15 @@ select {
input[type="radio"] { input[type="radio"] {
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none; -moz-appearance: none;
background: var(--c90); background: hsl(0, 0%, 88%);
border-radius: 50%; border-radius: 50%;
border: 1px solid var(--c60); border: 1px solid hsl(0, 0%, 60%);
cursor: default; cursor: default;
height: 13px; height: 13px;
width: 13px; width: 13px;
position: relative; position: relative;
margin: 0 4px 1px 0;
} }
input[type="radio"]:after { input[type="radio"]:after {
content: ''; content: '';
background-color: transparent; background-color: transparent;
@ -269,15 +217,11 @@ input[type="radio"]:after {
top: 2px; top: 2px;
position: absolute; position: absolute;
} }
input[type="radio"]:checked:after { input[type="radio"]:checked:after {
background-color: var(--c30); background-color: hsl(0, 0%, 30%);
transform: scale(1); transform: scale(1);
} }
.radio-wrapper {
display: flex;
align-items: center;
line-height: 1.5;
}
/* restore disabled state dimming */ /* restore disabled state dimming */
button:disabled, button:disabled,
@ -289,7 +233,7 @@ select[disabled] > option {
select:disabled + .select-arrow, select:disabled + .select-arrow,
select[disabled] + .select-arrow { select[disabled] + .select-arrow {
fill: var(--c50); fill: hsl(0, 0%, 50%);
} }
summary { summary {
@ -301,32 +245,6 @@ summary {
.hidden { .hidden {
display: none !important; display: none !important;
} }
.rel {
position: relative;
}
.abs {
position: absolute;
}
html:not(.all-disabled) body:not(#stylus-popup) #disableAll-label:not([data-persist]) {
display: none;
}
html:not(.all-disabled) #disableAll-label::before {
content: attr(data-on);
}
.all-disabled #disableAll-label::before {
content: attr(data-off);
}
.all-disabled #disableAll-label {
font-weight: bold;
color: var(--red1);
}
.all-disabled #disableAll-label .svg-icon {
fill: var(--red1);
}
.all-disabled #disableAll {
border-color: var(--red1);
}
:focus, :focus,
.CodeMirror-focused, .CodeMirror-focused,
@ -334,7 +252,6 @@ html:not(.all-disabled) #disableAll-label::before {
textarea[data-focused-via-click]:focus, textarea[data-focused-via-click]:focus,
input:not([type])[data-focused-via-click]:focus, /* same as "text" */ input:not([type])[data-focused-via-click]:focus, /* same as "text" */
input[type="text"][data-focused-via-click]:focus, input[type="text"][data-focused-via-click]:focus,
input[type="url"][data-focused-via-click]:focus,
input[type="search"][data-focused-via-click]:focus, input[type="search"][data-focused-via-click]:focus,
input[type="number"][data-focused-via-click]:focus { input[type="number"][data-focused-via-click]:focus {
/* Using box-shadow instead of the ugly outline in new Chrome */ /* Using box-shadow instead of the ugly outline in new Chrome */
@ -348,95 +265,24 @@ input[type="number"][data-focused-via-click]:focus {
box-shadow: none; box-shadow: none;
} }
/* header resizer */
:root {
--header-width: 280px;
--header-resizer-width: 8px;
}
#header-resizer {
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: var(--header-resizer-width);
box-sizing: border-box;
cursor: e-resize;
border-width: 0 1px;
border-style: solid;
color: hsla(0, 0%, 50%, .5);
border-color: currentColor;
pointer-events: auto;
}
#header-resizer:active {
border-color: var(--c50);
}
#header-resizer::after {
content: '';
position: absolute;
border-right: 2px dotted currentColor;
left: 2px;
width: 0;
height: 100%;
}
body.resizing-h {
cursor: e-resize;
}
body.resizing-v {
cursor: n-resize;
}
body.resizing-h > *,
body.resizing-v > * {
pointer-events: none;
-moz-user-select: none;
user-select: none;
}
/* header resizer - end */
.split-btn {
position: relative;
white-space: nowrap;
--menu-pad: .5em;
}
.split-btn-pedal {
margin-left: -1px !important;
padding-left: .25em !important;
padding-right: .25em !important;
min-width: 0 !important;
}
.split-btn-pedal::after {
--side: 4px;
content: '';
border: var(--side) solid transparent;
display: inline-block;
border-top: calc(var(--side) * 1.3) solid currentColor;
vertical-align: bottom;
}
.split-btn.active .split-btn-pedal {
box-shadow: inset 0 0 100px rgba(0, 0, 0, .2);
}
.split-btn-menu {
background: var(--bg);
position: absolute;
box-shadow: 2px 3px 7px rgba(0, 0, 0, .5);
border: 1px solid hsl(180deg, 50%, 50%);
white-space: nowrap;
cursor: pointer;
padding: .25em 0;
z-index: 1000;
}
.split-btn-menu > * {
padding: var(--menu-pad) 1em;
display: block;
}
.split-btn-menu > :hover {
background-color: hsla(180deg, 50%, 50%, .25);
color: var(--fg);
}
@supports (-moz-appearance: none) { @supports (-moz-appearance: none) {
.moz-appearance-bug .svg-icon.checked,
.moz-appearance-bug .onoffswitch input,
.moz-appearance-bug input[type="radio"]:after {
display: none !important;
}
.moz-appearance-bug input[type="checkbox"] {
-moz-appearance: checkbox !important;
}
.moz-appearance-bug input[type="radio"] {
-moz-appearance: radio !important;
}
.firefox select { .firefox select {
padding: 0 20px 0 2px; padding: 0 20px 0 2px;
line-height: var(--input-height)!important; line-height: 22px!important;
} }
svg { svg {
@ -446,9 +292,9 @@ body.resizing-v > * {
/* We can customize everything about number inputs except arrows. They're horrible in Linux FF, so we'll hide them unless hovered or focused. */ /* We can customize everything about number inputs except arrows. They're horrible in Linux FF, so we'll hide them unless hovered or focused. */
.firefox.non-windows input[type="number"] { .firefox.non-windows input[type="number"] {
-moz-appearance: textfield; -moz-appearance: textfield;
background: var(--bg); background: #fff;
color: var(--fg); color: #000;
border: 1px solid var(--c65); border: 1px solid hsl(0, 0%, 66%);
} }
.firefox.non-windows input[type="number"]:not(:disabled):hover, .firefox.non-windows input[type="number"]:not(:disabled):hover,
@ -457,14 +303,18 @@ body.resizing-v > * {
} }
.firefox.non-windows input[type="color"] { .firefox.non-windows input[type="color"] {
background: var(--bg); background: #fff;
border: 1px solid var(--c65); border: 1px solid hsl(0, 0%, 66%);
padding: 4px; padding: 4px;
} }
}
@media (max-width: 850px) { /* Firefox cannot handle fractions in font-size */
#header-resizer { .firefox button:not(.install) {
display: none !important; line-height: 13px;
padding: 3px 7px;
}
.firefox.moz-appearance-bug button:not(.install) {
padding: 2px 4px;
} }
} }

View File

@ -1,103 +0,0 @@
.injection-order > div {
height: 100%;
max-width: 80vw;
}
.injection-order #incremental-search {
transform: scaleY(.55);
transform-origin: top;
}
.injection-order #message-box-contents,
.injection-order section {
padding: 0;
overflow: hidden;
display: flex;
flex-direction: column;
}
.injection-order section[data-main] {
flex: 1 0;
}
.injection-order header {
padding: 1rem;
width: 0;
min-width: 100%;
box-sizing: border-box;
}
.injection-order ol {
padding: 0;
margin: 0;
font-size: 14px;
overflow-y: auto;
}
.injection-order ol:empty {
display: none;
}
.injection-order [data-prio] header {
background-color: hsla(40, 80%, 50%, 0.4);
}
.injection-order [data-prio] {
height: min-content;
min-height: 2em;
max-height: 50%;
}
.injection-order-entry {
display: flex;
justify-content: space-between;
position: relative; /* for incremental-search */
padding: 1px 1px 1px 1rem; /* keyboard focus outline */
color: var(--fg);
transition: transform .25s ease-in-out;
z-index: 1;
user-select: none;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: move;
}
.injection-order-entry a[href] {
padding: .4em 0;
cursor: inherit;
}
.injection-order-entry.enabled a[href] {
font-weight: bold;
}
.injection-order-entry a {
text-decoration: none;
}
.injection-order-entry a[href]:hover {
text-decoration: underline;
}
.injection-order-toggle {
display: flex;
align-items: center;
padding: 0 .5rem;
cursor: pointer;
opacity: .5;
transition: .15s;
}
.injection-order-toggle::after {
content: '\2606';
font-size: 20px;
line-height: 1;
transition: .15s;
}
.injection-order-entry:hover .injection-order-toggle {
opacity: 1;
}
[data-prio] .injection-order-toggle::after {
content: '\2605';
}
.injection-order-toggle:hover::after {
color: hsl(30, 80%, 50%);
}
.injection-order [data-prio] header,
.injection-order ol,
.injection-order #message-box-buttons,
.injection-order-entry:nth-child(n + 2) {
border-top: 1px solid rgba(128, 128, 128, .25);
}
.injection-order .draggable-list-target {
position: relative;
background: lightcyan;
transition: none;
z-index: 100;
}

View File

@ -1,83 +0,0 @@
/* global $create messageBoxProxy */// dom.js
/* global API */// msg.js
/* global DraggableList */
/* global t */// localization.js
'use strict';
/* exported InjectionOrder */
async function InjectionOrder(show, el, selector) {
if (!show) {
return messageBoxProxy.close();
}
const SEL_ENTRY = '.injection-order-entry';
const groups = await API.styles.getAllOrdered(['_id', 'id', 'name', 'enabled']);
const ols = {};
const parts = {};
const entry = $create('li' + SEL_ENTRY, [
parts.name = $create('a', {
target: '_blank',
draggable: false,
}),
$create('a.injection-order-toggle', {
tabIndex: 0,
draggable: false,
title: t('styleInjectionImportance'),
}),
]);
await messageBoxProxy.show({
title: t('styleInjectionOrder'),
contents: $create('fragment', Object.entries(groups).map(makeList)),
className: 'center-dialog ' + selector.slice(1),
blockScroll: true,
buttons: [t('confirmClose')],
});
function makeEntry(style) {
entry.classList.toggle('enabled', style.enabled);
parts.name.href = '/edit.html?id=' + style.id;
parts.name.textContent = style.name;
return Object.assign(entry.cloneNode(true), {
styleNameLC: style.name.toLocaleLowerCase(),
});
}
function makeList([type, styles]) {
const ids = groups[type] = styles.map(s => s._id);
const ol = ols[type] = $create('ol.scroller');
let maxTranslateY;
ol.append(...styles.map(makeEntry));
ol.on('d:dragstart', ({detail: d}) => {
d.origin.dataTransfer.setDragImage(new Image(), 0, 0);
maxTranslateY =
ol.scrollHeight + ol.offsetTop - d.dragTarget.offsetHeight - d.dragTarget.offsetTop;
});
ol.on('d:dragmove', ({detail: d}) => {
d.origin.stopPropagation(); // preserves dropEffect
d.origin.dataTransfer.dropEffect = 'move';
const y = Math.min(d.currentPos.y - d.startPos.y, maxTranslateY);
d.dragTarget.style.transform = `translateY(${y}px)`;
});
ol.on('d:dragend', ({detail: d}) => {
const [item] = ids.splice(d.originalIndex, 1);
ids.splice(d.spliceIndex, 0, item);
ol.insertBefore(d.dragTarget, d.insertBefore);
API.styles.setOrder(groups);
});
ol.on('click', e => {
if (e.target.closest('.injection-order-toggle')) {
const el = e.target.closest(SEL_ENTRY);
const i = [].indexOf.call(el.parentNode.children, el);
const [item] = ids.splice(i, 1);
const type2 = type === 'main' ? 'prio' : 'main';
groups[type2].push(item);
ols[type2].appendChild(el);
API.styles.setOrder(groups);
}
});
DraggableList(ol, {scrollContainer: ol});
return $create('section', {dataset: {[type]: ''}}, [
$create('header', t(`styleInjectionOrderHint${type === 'main' ? '' : '_' + type}`)),
ol,
]);
}
}

View File

@ -7,125 +7,86 @@
<title>Loading...</title> <title>Loading...</title>
<link href="global.css" rel="stylesheet"> <link href="global.css" rel="stylesheet">
<link href="global-dark.css" rel="stylesheet">
<script src="js/polyfill.js"></script> <script src="js/polyfill.js"></script>
<script src="js/msg.js"></script> <script src="js/msg.js"></script>
<script src="js/toolbox.js"></script> <script src="js/toolbox.js"></script>
<script src="install-usercss/preinit.js"></script>
<script src="js/prefs.js"></script> <script src="js/prefs.js"></script>
<script src="js/dom.js"></script> <script src="js/dom.js"></script>
<script src="js/localization.js"></script> <script src="js/localization.js"></script>
<script src="install-usercss/preinit.js"></script>
<script src="content/style-injector.js"></script> <script src="content/style-injector.js"></script>
<script src="content/apply.js"></script> <script src="content/apply.js"></script>
<template data-id="jumpToLine">
<span i18n="editGotoLine">: <input class="CodeMirror-jump-field" type="text"></span>
</template>
<script src="vendor/codemirror/lib/codemirror.js"></script>
<script src="vendor/codemirror/mode/css/css.js"></script>
<script src="vendor/codemirror/mode/stylus/stylus.js"></script>
<script src="vendor/codemirror/addon/dialog/dialog.js"></script>
<script src="vendor/codemirror/addon/edit/closebrackets.js"></script>
<script src="vendor/codemirror/addon/scroll/annotatescrollbar.js"></script>
<script src="vendor/codemirror/addon/search/searchcursor.js"></script>
<script src="vendor/codemirror/addon/search/matchesonscrollbar.js"></script>
<script src="vendor/codemirror/addon/comment/comment.js"></script>
<script src="vendor/codemirror/addon/selection/active-line.js"></script>
<script src="vendor/codemirror/addon/edit/matchbrackets.js"></script>
<script src="vendor/codemirror/addon/fold/foldcode.js"></script>
<script src="vendor/codemirror/addon/fold/foldgutter.js"></script>
<script src="vendor/codemirror/addon/fold/brace-fold.js"></script>
<script src="vendor/codemirror/addon/fold/indent-fold.js"></script>
<script src="vendor/codemirror/addon/fold/comment-fold.js"></script>
<script src="vendor/codemirror/addon/lint/lint.js"></script>
<script src="vendor/codemirror/addon/hint/show-hint.js"></script>
<script src="vendor/codemirror/addon/hint/css-hint.js"></script>
<script src="vendor/codemirror/keymap/sublime.js"></script>
<script src="vendor/codemirror/keymap/emacs.js"></script>
<script src="vendor/codemirror/keymap/vim.js"></script>
<script src="vendor-overwrites/codemirror-addon/match-highlighter.js"></script>
<script src="edit/codemirror-default.js"></script>
<script src="edit/codemirror-themes.js"></script>
<script src="js/color/color-converter.js"></script>
<script src="js/color/color-view.js"></script>
<script src="js/sections-util.js"></script>
<script src="js/cmpver.js"></script>
<link href="vendor/codemirror/lib/codemirror.css" rel="stylesheet">
<link href="vendor/codemirror/addon/dialog/dialog.css" rel="stylesheet">
<link href="vendor/codemirror/addon/fold/foldgutter.css" rel="stylesheet">
<link href="vendor/codemirror/addon/search/matchesonscrollbar.css" rel="stylesheet">
<link href="edit/codemirror-default.css" rel="stylesheet">
<link href="spinner.css" rel="stylesheet"> <link href="spinner.css" rel="stylesheet">
<link href="install-usercss/install-usercss.css" rel="stylesheet"> <link href="install-usercss/install-usercss.css" rel="stylesheet">
<script src="js/dark-themer.js"></script> <!-- must be last in HEAD to avoid FOUC -->
</head> </head>
<body id="stylus-install-usercss"> <body id="stylus-install-usercss">
<div id="header"> <div class="container">
<div id="header-contents"> <div id="header">
<h1 class="w100"> <div id="header-content-wrapper">
<span class="meta-name"></span> <h1>
<small class="meta-version"></small> <span class="meta-name"></span>
</h1> <small class="meta-version"></small>
<div id="install-wrapper"> </h1>
<h2 class="install-show" i18n="installButtonInstalled"></h2> <div class="actions">
<button class="install install-hide" i18n="installButton"></button> <h2 hidden class="installed" i18n-text="installButtonInstalled"></h2>
<a class="configure-usercss" i18n="title:configureStyle" tabindex="0"> <button class="install" i18n-text="installButton"></button>
<svg class="svg-icon config"><use xlink:href="#svg-icon-config"></use></svg> <a class="configure-usercss" i18n-title="configureStyle" tabindex="0">
</a> <svg class="svg-icon config"><use xlink:href="#svg-icon-config"></use></svg>
<div class="install-show w100-full"> </a>
<a href="manage.html"><button i18n="openManage"></button></a> <p id="live-reload-install-hint" hidden></p>
<a id="edit" href="edit.html?id="><button i18n="editStyleLabel"></button></a> <label class="set-update-url">
<a id="delete" tabindex="0"><button i18n="deleteStyleLabel"></button></a> <input type="checkbox">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
<span i18n-text="installUpdateFromLabel"></span>
<p></p>
</label>
<label class="live-reload">
<input type="checkbox">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
<span i18n-text="liveReloadLabel"></span>
</label>
<label class="set-prefer-scheme">
<span i18n-text="installPreferSchemeLabel"></span>
<select>
<option value="none" i18n-text="installPreferSchemeNone"></option>
<option value="dark" i18n-text="installPreferSchemeDark"></option>
<option value="light" i18n-text="installPreferSchemeLight"></option>
</select>
</label>
<p hidden class="installed-actions">
<a href="manage.html" tabindex="0"><button i18n-text="openManage"></button></a>
<a href="edit.html?id=" tabindex="0"><button i18n-text="editStyleLabel"></button></a>
<a id="delete" tabindex="0"><button i18n-text="deleteStyleLabel"></button></a>
</p>
</div>
<p class="meta-description"></p>
<div>
<h3 i18n-text="author"></h3>
<span class="meta-author"></span>
</div>
<div>
<h3 i18n-text="license"></h3>
<span class="meta-license"></span>
</div>
<div class="external-link"></div>
<div id="applies-to-wrapper">
<h3 i18n-text="appliesLabel"></h3>
<ul class="applies-to">
</ul>
</div> </div>
</div> </div>
<div id="ss-scheme" class="install-dim"></div>
<div class="set-update-url w100 checkbox-wrapper install-disable">
<label>
<input type="checkbox">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
<span i18n="installUpdateFromLabel"></span>
</label>
<p></p>
</div>
<label class="live-reload checkbox-wrapper">
<input type="checkbox">
<svg class="svg-icon checked"><use xlink:href="#svg-icon-checked"/></svg>
<span i18n="liveReloadLabel"></span>
</label>
<div id="live-reload-install-hint" class="w100" hidden></div>
<div class="meta-description w100 hide-empty"></div>
<div>
<h3 i18n="author"></h3>
<span class="meta-author"></span>
</div>
<div>
<h3 i18n="license"></h3>
<span class="meta-license"></span>
</div>
<div class="external-link hide-empty"></div>
<div class="w100">
<h3 i18n="appliesLabel"></h3>
<ul class="applies-to">
</ul>
</div>
</div> </div>
<div id="header-resizer" i18n="title:headerResizerHint"></div> <div class="main">
</div> <div class="warnings"></div>
<div class="main"> </div>
<div class="warnings"></div>
</div> </div>
<svg xmlns="http://www.w3.org/2000/svg" style="display: none !important;"> <svg xmlns="http://www.w3.org/2000/svg" style="display: none !important;">
<symbol id="svg-icon-help" viewBox="0 0 14 16" i18n="alt:helpAlt">
<circle cx="7" cy="5" r="1"/>
<path d="M8,8c0-0.5-0.5-1-1-1H6C5.5,7,5,7.4,5,8h1v3c0,0.5,0.5,1,1,1h1c0.5,0,1-0.4,1-1H8V8z"/>
<path d="M7,1c3.9,0,7,3.1,7,7s-3.1,7-7,7s-7-3.1-7-7S3.1,1,7,1z M7,2.3C3.9,2.3,1.3,4.9,1.3,8s2.6,5.7,5.7,5.7s5.7-2.6,5.7-5.7S10.1,2.3,7,2.3C7,2.3,7,2.3,7,2.3z"/>
</symbol>
<symbol id="svg-icon-checked" viewBox="0 0 1000 1000"> <symbol id="svg-icon-checked" viewBox="0 0 1000 1000">
<path fill-rule="evenodd" d="M983.2,184.3L853,69.8c-4-3.5-9.3-5.3-14.5-5c-5.3,0.4-10.3,2.8-13.8,6.8L352.3,609.2L184.4,386.9c-3.2-4.2-8-7-13.2-7.8c-5.3-0.8-10.6,0.6-14.9,3.9L18,487.5c-8.8,6.7-10.6,19.3-3.9,28.1L325,927.2c3.6,4.8,9.3,7.7,15.3,8c0.2,0,0.5,0,0.7,0c5.8,0,11.3-2.5,15.1-6.8L985,212.6C992.3,204.3,991.5,191.6,983.2,184.3z"/> <path fill-rule="evenodd" d="M983.2,184.3L853,69.8c-4-3.5-9.3-5.3-14.5-5c-5.3,0.4-10.3,2.8-13.8,6.8L352.3,609.2L184.4,386.9c-3.2-4.2-8-7-13.2-7.8c-5.3-0.8-10.6,0.6-14.9,3.9L18,487.5c-8.8,6.7-10.6,19.3-3.9,28.1L325,927.2c3.6,4.8,9.3,7.7,15.3,8c0.2,0,0.5,0,0.7,0c5.8,0,11.3-2.5,15.1-6.8L985,212.6C992.3,204.3,991.5,191.6,983.2,184.3z"/>
</symbol> </symbol>

View File

@ -1,16 +1,16 @@
body { body {
overflow: hidden; overflow: hidden;
display: flex; margin: 0;
height: 100vh; background: white;
} }
a { a {
color: var(--fg); color: #000;
transition: color .5s; transition: color .5s;
} }
a:hover { a:hover {
color: var(--c40); color: #666;
} }
img.icon { img.icon {
@ -19,32 +19,29 @@ img.icon {
} }
input:disabled + span { input:disabled + span {
color: var(--c50); color: rgb(128, 128, 128);
}
.container {
display: flex;
height: 100vh;
} }
#header, #header,
.warnings { .warnings {
flex: 0 0 var(--header-width); flex: 0 0 280px;
box-sizing: border-box; box-sizing: border-box;
padding: 1rem; padding: 1rem;
border-right: 1px dashed #aaa;
box-shadow: 0 0 50px -18px black; box-shadow: 0 0 50px -18px black;
word-break: break-all;
overflow-wrap: break-word; overflow-wrap: break-word;
overflow-y: auto; overflow-y: auto;
z-index: 100; z-index: 100;
} }
#header {
--child-gap: 1rem;
}
#header-contents > :nth-last-child(n + 2) {
margin-bottom: var(--child-gap);
}
#header.meta-init-error { #header.meta-init-error {
display: none; display: none;
} }
#header-contents ul {
margin: 0;
}
.warnings { .warnings {
display: none; display: none;
@ -52,7 +49,7 @@ input:disabled + span {
flex-basis: auto; flex-basis: auto;
background: #ffe2e2; background: #ffe2e2;
border-right: none; border-right: none;
border-bottom: 1px dashed var(--c65); border-bottom: 1px dashed #aaa;
} }
.has-warnings .warnings { .has-warnings .warnings {
@ -76,45 +73,31 @@ input:disabled + span {
h1 { h1 {
margin-top: 0; margin-top: 0;
display: flex;
align-items: baseline;
flex-wrap: wrap;
} }
.meta-name {
margin-right: .5em; h1 small {
}
.meta-version {
font-size: 0.6em; font-size: 0.6em;
white-space: nowrap;
} }
.meta-version::before { .meta-version::before {
content: "v"; content: " v";
} }
.checkbox-wrapper {
box-sizing: border-box; .actions {
display: block; margin-bottom: 1em;
} }
.set-update-url p {
word-break: break-all; .actions label {
opacity: .5; max-width: -moz-fit-content;
margin: .25em 0 0; max-width: fit-content;
}
#install-wrapper {
display: flex; display: flex;
align-items: center; align-items: center;
flex-wrap: wrap; margin: 0.5em 0;
}
#install-wrapper > :nth-last-child(n + 2) {
margin-right: .5rem;
}
#live-reload-install-hint {
color: darkcyan;
}
.w100 {
width: 100%;
} }
.install { .install {
font-family: Arial, "DejaVu Sans", Verdana, Geneva, sans-serif;
font-size: 14px;
background-color: hsl(0, 0%, 33%); background-color: hsl(0, 0%, 33%);
color: #eee; color: #eee;
border-radius: 4px; border-radius: 4px;
@ -125,6 +108,7 @@ h1 {
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none; -moz-appearance: none;
border-style: none; border-style: none;
margin-bottom: 1ex;
cursor: pointer; cursor: pointer;
box-shadow: inset 0 -1px 0 0 hsl(0, 0%, 24%), inset 0 1px 0 0 hsl(0, 0%, 30%), inset 1px 0 0 0 hsl(0, 0%, 24%); box-shadow: inset 0 -1px 0 0 hsl(0, 0%, 24%), inset 0 1px 0 0 hsl(0, 0%, 30%), inset 1px 0 0 0 hsl(0, 0%, 24%);
transition: color .25s, background-color .25s; transition: color .25s, background-color .25s;
@ -139,7 +123,7 @@ h1 {
.install:hover:not(:disabled) { .install:hover:not(:disabled) {
background-color: hsl(0, 0%, 38%); background-color: hsl(0, 0%, 38%);
color: var(--bg); color: #fff;
text-shadow: none; text-shadow: none;
} }
@ -229,25 +213,44 @@ h1 {
filter: hue-rotate(-18deg) brightness(.7) contrast(2); filter: hue-rotate(-18deg) brightness(.7) contrast(2);
} }
h2 { .install.installed {
display: none;
}
h2.installed.active {
display: inline-block;
font-weight: bold; font-weight: bold;
margin: 0; margin-top: 0;
color: darkcyan; color: darkcyan;
} }
.installed .configure-usercss svg { h2.installed.active ~ .configure-usercss svg {
fill: hsl(180, 100%, 20%); fill: hsl(180, 100%, 20%);
} }
.installed .configure-usercss:hover svg { h2.installed.active ~ .configure-usercss:hover svg {
fill: hsl(180, 100%, 30%); fill: hsl(180, 100%, 30%);
} }
#header-contents > .hide-empty:empty, .actions label input {
body:not(.installed) .install-show, margin: 0 0.5em 0 0;
.installed .install-hide { flex: 0 0 auto;
display: none !important;
} }
.installed .install-dim {
.actions label span {
min-width: 0;
}
.set-update-url {
flex-wrap: wrap;
}
.set-update-url p {
word-break: break-all;
opacity: .5; opacity: .5;
width: 100%;
margin: .25em 0 .25em;
}
label.set-prefer-scheme:not(.unavailable) {
padding-left: 0;
} }
.external { .external {
@ -268,8 +271,8 @@ li {
.main, .main,
.main .CodeMirror { .main .CodeMirror {
height: 100%; height: 100% !important;
width: 100%; width: 100% !important;
border: none; border: none;
} }
@ -288,13 +291,22 @@ li {
} }
#header.meta-init > * { #header.meta-init > * {
opacity: 1;
transition: opacity .5s; transition: opacity .5s;
-moz-user-select: auto;
user-select: auto;
} }
.meta-init[data-arrived-fast="true"] > * { #header.meta-init[data-arrived-fast="true"] > * {
transition-duration: .1s; transition-duration: .1s;
} }
label {
/* FIXME: why do we want to give all labels a padding? */
padding-left: 16px;
position: relative;
}
.lds-spinner { .lds-spinner {
top: 50px; top: 50px;
opacity: .2; opacity: .2;
@ -305,6 +317,7 @@ li {
.configure-usercss .svg-icon.config { .configure-usercss .svg-icon.config {
width: 20px; width: 20px;
height: 20px; height: 20px;
margin-top: -3px;
} }
#message-box.config-dialog { #message-box.config-dialog {
width: 0; width: 0;
@ -319,71 +332,118 @@ li {
@media (max-width: 850px) { @media (max-width: 850px) {
body { body {
overflow: hidden;
}
.container {
flex-direction: column; flex-direction: column;
} }
#header { #header {
border-bottom: 1px dashed var(--c65);
min-height: 6rem;
max-height: 40vh;
resize: vertical;
flex: 0 1 auto; flex: 0 1 auto;
--child-gap: .75rem; border-right: none;
border-bottom: 1px dashed #AAA;
overflow-x: auto;
overflow-y: hidden;
padding: 0;
} }
#header:not(.meta-init) { #header:not(.meta-init) {
min-height: 300px; min-height: 300px;
} }
#header-contents { .main {
flex: 1;
}
#header-content-wrapper {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
align-content: flex-start; padding: .5rem 0 0 1rem;
align-items: flex-start; box-sizing: border-box;
height: min-content;
} }
#header-contents > :not(.w100) { #header-content-wrapper > * {
margin-right: 1rem; flex-grow: 1;
margin: 0;
padding: 0 1rem .5rem 0;
min-width: 0;
} }
.set-update-url { #header-content-wrapper > .meta-description + .flex-wrapper {
display: flex; display: flex;
justify-content: space-between;
flex-wrap: wrap;
padding: 0;
}
#header-content-wrapper > .meta-description + .flex-wrapper > * {
display: flex;
flex-direction: column;
flex: 1;
flex-wrap: wrap;
white-space: nowrap; white-space: nowrap;
padding: 0 1rem .5rem 0;
box-sizing: border-box; box-sizing: border-box;
} }
.set-update-url p { .flex-wrapper ul {
margin: 0 0 0 1rem; margin: 0;
}
#header-content-wrapper > .meta-description {
flex-basis: 100%;
white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.actions {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
}
.set-update-url p {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.actions label {
min-width: 100px;
flex: 1;
}
.actions label span {
white-space: nowrap;
}
.has-warnings #header {
min-height: 4em;
max-height: 20%;
}
.warnings {
max-height: 20%;
}
.warning:not(:last-child) { .warning:not(:last-child) {
border-bottom: 1px dashed #b57c7c; border-bottom: 1px dashed #b57c7c;
padding-bottom: 1em; padding-bottom: 1em;
} }
#header-contents h3 { ul.applies-to,
.actions label {
margin: 0;
}
#header-content-wrapper > h1 {
font-size: 1.75em;
display: flex;
align-items: baseline;
}
#header-content-wrapper > h1 > .meta-version {
padding-left: 3px;
}
#header-content-wrapper > h1 > .meta-name {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
#header-content-wrapper > * h3 {
margin: 0 0 .5rem; margin: 0 0 .5rem;
} }
.install {
flex-shrink: 0;
margin-right: 1em;
}
#message-box.config-dialog > div { #message-box.config-dialog > div {
top: auto; top: auto;
bottom: 3rem; bottom: 3rem;
} }
h1 {
flex-wrap: nowrap;
}
.meta-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.main {
height: auto;
flex: 1;
}
}
@media (min-width: 850px) {
#header {
height: 100% !important; /* overrides user resize */
}
.w100-full {
width: 100%;
margin-top: var(--child-gap);
}
} }
/* Retina-specific stuff here */ /* Retina-specific stuff here */

View File

@ -1,19 +1,12 @@
/* global $$ $ $create $createLink $$remove showSpinner */// dom.js /* global $ $create $createLink $$remove showSpinner */// dom.js
/* global API */// msg.js /* global API */// msg.js
/* global CODEMIRROR_THEMES */
/* global CodeMirror */
/* global URLS closeCurrentTab deepEqual */// toolbox.js /* global URLS closeCurrentTab deepEqual */// toolbox.js
/* global compareVersion */// cmpver.js
/* global messageBox */ /* global messageBox */
/* global prefs */ /* global prefs */
/* global preinit */ /* global preinit */
/* global styleCodeEmpty */// sections-util.js
/* global t */// localization.js /* global t */// localization.js
'use strict'; 'use strict';
const CFG_SEL = '#message-box.config-dialog';
let cfgShown = true;
let cm; let cm;
let initialUrl; let initialUrl;
let installed; let installed;
@ -42,16 +35,34 @@ setTimeout(() => !cm && showSpinner($('#header')), 200);
(async function init() { (async function init() {
const theme = prefs.get('editor.theme'); const theme = prefs.get('editor.theme');
if (theme !== 'default') { if (theme !== 'default') {
document.head.append($create('style', CODEMIRROR_THEMES[theme] || '')); require([`/vendor/codemirror/theme/${theme}.css`]); // not awaiting as it may be absent
} }
const scriptsReady = require([
'/vendor/codemirror/lib/codemirror', /* global CodeMirror */
]).then(() => require([
'/vendor/codemirror/keymap/sublime',
'/vendor/codemirror/keymap/emacs',
'/vendor/codemirror/keymap/vim', // TODO: load conditionally
'/vendor/codemirror/mode/css/css',
'/vendor/codemirror/addon/search/searchcursor',
'/vendor/codemirror/addon/fold/foldcode',
'/vendor/codemirror/addon/fold/foldgutter',
'/vendor/codemirror/addon/fold/brace-fold',
'/vendor/codemirror/addon/fold/indent-fold',
'/vendor/codemirror/addon/selection/active-line',
'/vendor/codemirror/lib/codemirror.css',
'/vendor/codemirror/addon/fold/foldgutter.css',
'/js/cmpver', /* global compareVersion */
'/js/sections-util', /* global styleCodeEmpty */
'/js/color/color-converter',
'/edit/codemirror-default.css',
])).then(() => require([
'/edit/codemirror-default',
'/js/color/color-view',
]));
({tabId, initialUrl} = preinit); ({tabId, initialUrl} = preinit);
liveReload = initLiveReload(); liveReload = initLiveReload();
preinit.tpl.then(el => {
$('#ss-scheme').append(...$('#ss-scheme', el).children);
prefs.subscribe('schemeSwitcher.enabled', (_, val) => {
$('#ss-scheme-off').hidden = val !== 'never';
}, {runNow: true});
});
const [ const [
{dup, style, error, sourceCode}, {dup, style, error, sourceCode},
@ -64,6 +75,7 @@ setTimeout(() => !cm && showSpinner($('#header')), 200);
messageBox.alert(isNaN(error) ? `${error}` : 'HTTP Error ' + error, 'pre'); messageBox.alert(isNaN(error) ? `${error}` : 'HTTP Error ' + error, 'pre');
return; return;
} }
await scriptsReady;
cm = CodeMirror($('.main'), { cm = CodeMirror($('.main'), {
value: sourceCode || style.sourceCode, value: sourceCode || style.sourceCode,
readOnly: true, readOnly: true,
@ -85,10 +97,12 @@ setTimeout(() => !cm && showSpinner($('#header')), 200);
// update UI // update UI
if (versionTest < 0) { if (versionTest < 0) {
$('h1').after($create('.warning', t('versionInvalidOlder'))); $('.actions').parentNode.insertBefore(
$create('.warning', t('versionInvalidOlder')),
$('.actions')
);
} }
$('button.install').onclick = () => { $('button.install').onclick = () => {
shouldShowConfig();
(!dup ? (!dup ?
Promise.resolve(true) : Promise.resolve(true) :
messageBox.confirm($create('span', t('styleInstallOverwrite', [ messageBox.confirm($create('span', t('styleInstallOverwrite', [
@ -122,9 +136,11 @@ setTimeout(() => !cm && showSpinner($('#header')), 200);
updateUrl.href.slice(0, 300) + '...'; updateUrl.href.slice(0, 300) + '...';
// set prefer scheme // set prefer scheme
$('#ss-scheme').onchange = e => { const preferScheme = $('.set-prefer-scheme select');
style.preferScheme = e.target.value; preferScheme.onchange = () => {
style.preferScheme = preferScheme.value;
}; };
preferScheme.onchange();
if (URLS.isLocalhost(initialUrl)) { if (URLS.isLocalhost(initialUrl)) {
$('.live-reload input').onchange = liveReload.onToggled; $('.live-reload input').onchange = liveReload.onToggled;
@ -154,28 +170,41 @@ function updateMeta(style, dup = installedDup) {
!dup ? 'install' : !dup ? 'install' :
versionTest > 0 ? 'update' : versionTest > 0 ? 'update' :
'reinstall'); 'reinstall');
$('.set-update-url').title = dup && dup.updateUrl && $('.set-update-url').title = dup && dup.updateUrl && t('installUpdateFrom', dup.updateUrl) || '';
(t('installUpdateFrom', dup.updateUrl) || '').replace(/\S+$/, '\n$&');
$('.meta-name').textContent = data.name; $('.meta-name').textContent = data.name;
$('.meta-version').textContent = data.version; $('.meta-version').textContent = data.version;
$('.meta-description').textContent = data.description; $('.meta-description').textContent = data.description;
$$('#ss-scheme input').forEach(el => { $('.set-prefer-scheme select').value =
el.checked = el.value === (style.preferScheme || 'none'); style.preferScheme === 'dark' ? 'dark' :
}); style.preferScheme === 'light' ? 'light' : 'none';
replaceChildren($('.meta-author'), makeAuthor(data.author), true); if (data.author) {
replaceChildren($('.meta-license'), data.license, true); $('.meta-author').parentNode.style.display = '';
replaceChildren($('.external-link'), makeExternalLink()); $('.meta-author').textContent = '';
$('.meta-author').appendChild(makeAuthor(data.author));
} else {
$('.meta-author').parentNode.style.display = 'none';
}
$('.meta-license').parentNode.style.display = data.license ? '' : 'none';
$('.meta-license').textContent = data.license;
$('.applies-to').textContent = '';
getAppliesTo(style).then(list => getAppliesTo(style).then(list =>
replaceChildren($('.applies-to'), list.map(s => $create('li', s)))); $('.applies-to').append(...list.map(s => $create('li', s))));
$('.external-link').textContent = '';
const externalLink = makeExternalLink();
if (externalLink) {
$('.external-link').appendChild(externalLink);
}
Object.assign($('.configure-usercss'), { Object.assign($('.configure-usercss'), {
hidden: !data.vars, hidden: !data.vars,
onclick: openConfigDialog, onclick: openConfigDialog,
}); });
if (!data.vars) { if (!data.vars) {
cfgShown = false; $$remove('#message-box.config-dialog');
$$remove(CFG_SEL);
} else if (!deepEqual(data.vars, vars)) { } else if (!deepEqual(data.vars, vars)) {
vars = data.vars; vars = data.vars;
// Use the user-customized vars from the installed style // Use the user-customized vars from the installed style
@ -185,8 +214,6 @@ function updateMeta(style, dup = installedDup) {
v.value = dv.value; v.value = dv.value;
} }
} }
}
if (shouldShowConfig()) {
openConfigDialog(); openConfigDialog();
} }
@ -200,26 +227,26 @@ function updateMeta(style, dup = installedDup) {
if (dup) enablePostActions(); if (dup) enablePostActions();
function makeAuthor(text) { function makeAuthor(text) {
const match = text && text.match(/^(.+?)(?:\s+<(.+?)>)?(?:\s+\((.+?)\))?$/); const match = text.match(/^(.+?)(?:\s+<(.+?)>)?(?:\s+\((.+?)\))?$/);
if (!match) { if (!match) {
return text; return document.createTextNode(text);
} }
const [, name, email, url] = match; const [, name, email, url] = match;
const elems = []; const frag = document.createDocumentFragment();
if (email) { if (email) {
elems.push($createLink(`mailto:${email}`, name)); frag.appendChild($createLink(`mailto:${email}`, name));
} else { } else {
elems.push($create('span', name)); frag.appendChild($create('span', name));
} }
if (url) { if (url) {
elems.push($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',
})) }))
)); ));
} }
return elems; return frag;
} }
function makeExternalLink() { function makeExternalLink() {
@ -247,7 +274,7 @@ function updateMeta(style, dup = installedDup) {
function showError(err) { function showError(err) {
$('.warnings').textContent = ''; $('.warnings').textContent = '';
$('.warnings').classList.toggle('visible', Boolean(err)); $('.warnings').classList.toggle('visible', Boolean(err));
document.body.classList.toggle('has-warnings', Boolean(err)); $('.container').classList.toggle('has-warnings', Boolean(err));
err = Array.isArray(err) ? err : [err]; err = Array.isArray(err) ? err : [err];
if (err[0]) { if (err[0]) {
let i; let i;
@ -283,11 +310,12 @@ function install(style) {
$$remove('.warning'); $$remove('.warning');
$('button.install').disabled = true; $('button.install').disabled = true;
$('button.install').classList.add('installed'); $('button.install').classList.add('installed');
$('#live-reload-install-hint').hidden = !liveReload.enabled; $('#live-reload-install-hint').classList.toggle('hidden', !liveReload.enabled);
$('h2.installed').classList.add('active');
$('.set-update-url input[type=checkbox]').disabled = true;
$('.set-update-url').title = style.updateUrl ? $('.set-update-url').title = style.updateUrl ?
t('installUpdateFrom', style.updateUrl) : ''; t('installUpdateFrom', style.updateUrl) : '';
$$('.install-disable input').forEach(el => (el.disabled = true)); $('.set-prefer-scheme select').disabled = true;
document.body.classList.add('installed');
enablePostActions(); enablePostActions();
updateMeta(style); updateMeta(style);
} }
@ -295,7 +323,9 @@ function install(style) {
function enablePostActions() { function enablePostActions() {
const {id} = installed || installedDup; const {id} = installed || installedDup;
sessionStorage.justEditedStyleId = id; sessionStorage.justEditedStyleId = id;
$('#edit').search = `?id=${id}`; $('h2.installed').hidden = !installed;
$('.installed-actions').hidden = false;
$('.installed-actions a[href*="edit.html"]').search = `?id=${id}`;
$('#delete').onclick = async () => { $('#delete').onclick = async () => {
if (await messageBox.confirm(t('deleteStyleConfirm'), 'danger center', t('confirmDelete'))) { if (await messageBox.confirm(t('deleteStyleConfirm'), 'danger center', t('confirmDelete'))) {
await API.styles.delete(id); await API.styles.delete(id);
@ -404,16 +434,3 @@ function initLiveReload() {
}); });
} }
} }
function shouldShowConfig() {
// TODO: rewrite message-box to support multiple instances or find an existing tiny library
const prev = cfgShown;
cfgShown = $(CFG_SEL) != null;
return prev && !cfgShown;
}
function replaceChildren(el, children, toggleParent) {
if (el.firstChild) el.textContent = '';
if (children) el.append(...Array.isArray(children) ? children : [children]);
if (toggleParent) el.parentNode.hidden = !el.firstChild;
}

View File

@ -1,6 +1,5 @@
/* global API */// msg.js /* global API */// msg.js
/* global closeCurrentTab download */// toolbox.js /* global closeCurrentTab download */// toolbox.js
/* global t */// localization.js
'use strict'; 'use strict';
/* exported preinit */ /* exported preinit */
@ -90,7 +89,5 @@ const preinit = (() => {
return {error, sourceCode}; return {error, sourceCode};
} }
})(), })(),
tpl: t.fetchTemplate('/edit/settings.html', 'styleSettings'),
}; };
})(); })();

View File

@ -1,75 +1,30 @@
'use strict'; 'use strict';
const colorConverter = (NAMED_COLORS => { const colorConverter = (() => {
// All groups in RXS_NUM must use ?: in order to enable \1 in RX_COLOR.rgb
const RXS_NUM = /\s*[+-]?(\.\d+|\d+(\.\d*)?)(e[+-]?\d+)?/.source.replace(/\(/g, '(?:');
const RXS_ANGLE = '(?:deg|g?rad|turn)?';
const expandRe = re => RegExp(re.source.replace(/N/g, RXS_NUM).replace(/A/g, RXS_ANGLE), 'iy');
const RX_COLOR = {
hex: /#([a-f\d]{3}(?:[a-f\d](?:[a-f\d]{2}){0,2})?)\b/iy,
// num_or_angle, pct, pct [ , num_or_pct]?
// num_or_angle pct pct [ / num_or_pct]?
hsl: expandRe(/^NA(\s*(,N%\s*){2}(,N%?\s*)?|(\s+N%){2}\s*(\/N%?\s*)?)$/),
// num_or_angle|none pct|none pct|none [ / num_or_pct|none ]?
hwb: expandRe(/^(NA|none)(\s+(N%|none)){2}\s*(\/(N%?|none)\s*)?$/),
// num, num, num [ , num_or_pct]?
// pct, pct, pct [ , num_or_pct]?
// num num num [ / num_or_pct]?
// pct pct pct [ / num_or_pct]?
rgb: expandRe(/^N(%?)(\s*,N\1\s*,N\1\s*(,N%?\s*)?|\s+N\1\s+N\1\s*(\/N%?\s*)?)$/),
};
const ANGLE_TO_DEG = {
grad: 360 / 400,
rad: 180 / Math.PI,
turn: 360,
};
const TO_HSV = {
hex: RGBtoHSV,
hsl: HSLtoHSV,
hwb: HWBtoHSV,
rgb: RGBtoHSV,
};
const FROM_HSV = {
hex: HSVtoRGB,
hsl: HSVtoHSL,
hwb: HSVtoHWB,
rgb: HSVtoRGB,
};
const guessType = c =>
'r' in c ? 'rgb' :
'w' in c ? 'hwb' :
'v' in c ? 'hsv' :
'l' in c ? 'hsl' :
undefined;
let HEX;
return { return {
parse, parse,
format, format,
formatAlpha, formatAlpha,
fromHSV: (color, type) => FROM_HSV[type](color), RGBtoHSV,
toHSV: color => TO_HSV[color.type || 'rgb'](color), HSVtoRGB,
constrain, HSLtoHSV,
HSVtoHSL,
constrainHue, constrainHue,
guessType,
snapToInt, snapToInt,
testAt,
ALPHA_DIGITS: 3, ALPHA_DIGITS: 3,
NAMED_COLORS, // NAMED_COLORS is added below
RX_COLOR,
}; };
function format(color = '', type = color.type, {hexUppercase, usoMode, round} = {}) { function format(color = '', type = color.type, hexUppercase, usoMode) {
if (!color || !type) return typeof color === 'string' ? color : ''; if (!color || !type) return typeof color === 'string' ? color : '';
const {a, type: src = guessType(color)} = color; const {a} = color;
const aFmt = formatAlpha(a); let aStr = formatAlpha(a);
const aStr = aFmt ? ', ' + aFmt : ''; if (aStr) aStr = ', ' + aStr;
const srcConv = src === 'hex' ? 'rgb' : src; if (type !== 'hsl' && color.type === 'hsl') {
const dstConv = type === 'hex' ? 'rgb' : type; color = HSVtoRGB(HSLtoHSV(color));
color = srcConv === dstConv ? color : FROM_HSV[dstConv](TO_HSV[srcConv](color)); }
round = round ? Math.round : v => v; const {r, g, b, h, s, l} = color;
const {r, g, b, h, s, l, w} = color;
switch (type) { switch (type) {
case 'hex': { case 'hex': {
let res = '#' + hex2(r) + hex2(g) + hex2(b) + (aStr ? hex2(Math.round(a * 255)) : ''); let res = '#' + hex2(r) + hex2(g) + hex2(b) + (aStr ? hex2(Math.round(a * 255)) : '');
@ -81,79 +36,103 @@ const colorConverter = (NAMED_COLORS => {
return usoMode ? rgb : `rgb${aStr ? 'a' : ''}(${rgb}${aStr})`; return usoMode ? rgb : `rgb${aStr ? 'a' : ''}(${rgb}${aStr})`;
} }
case 'hsl': case 'hsl':
return `hsl${aStr ? 'a' : ''}(${round(h)}, ${round(s)}%, ${round(l)}%${aStr})`; return `hsl${aStr ? 'a' : ''}(${h}, ${s}%, ${l}%${aStr})`;
case 'hwb':
return `hwb(${round(h)} ${round(w)}% ${round(b)}%${aFmt ? ' / ' + aFmt : ''})`;
} }
} }
function parse(s) { // Copied from _hexcolor() in parserlib.js
if (typeof s !== 'string' || !(s = s.trim())) { function validateHex(color) {
return; return /^#[a-f\d]+$/i.test(color) && [4, 5, 7, 9].some(n => color.length === n);
} else if (s[0] === '#') { }
return parseHex(s);
} else if (s.endsWith(')') && (s = s.match(/^(hwb|(hsl|rgb)a?)\(\s*([^)]+)/i))) { function validateRGB(nums) {
return parseFunc((s[2] || s[1]).toLowerCase(), s[3]); const isPercentage = nums[0].endsWith('%');
const valid = isPercentage ? validatePercentage : validateNum;
return nums.slice(0, 3).every(valid);
}
function validatePercentage(s) {
if (!s.endsWith('%')) return false;
const n = Number(s.slice(0, -1));
return n >= 0 && n <= 100;
}
function validateNum(s) {
const n = Number(s);
return n >= 0 && n <= 255;
}
function validateHSL(nums) {
return validateAngle(nums[0]) && nums.slice(1, 3).every(validatePercentage);
}
function validateAngle(s) {
return /^-?(\d+|\d*\.\d+)(deg|grad|rad|turn)?$/i.test(s);
}
function validateAlpha(alpha) {
if (alpha.endsWith('%')) {
return validatePercentage(alpha);
}
const n = Number(alpha);
return n >= 0 && n <= 1;
}
function parse(str) {
if (typeof str !== 'string') return;
str = str.trim();
if (!str) return;
if (str[0] !== '#' && !str.includes('(')) {
// eslint-disable-next-line no-use-before-define
str = colorConverter.NAMED_COLORS.get(str);
if (!str) return;
}
if (str[0] === '#') {
if (!validateHex(str)) {
return null;
}
str = str.slice(1);
const [r, g, b, a = 255] = str.length <= 4 ?
str.match(/(.)/g).map(c => parseInt(c + c, 16)) :
str.match(/(..)/g).map(c => parseInt(c, 16));
return {type: 'hex', r, g, b, a: a === 255 ? undefined : a / 255};
}
const [, type, value] = str.match(/^(rgb|hsl)a?\((.*?)\)|$/i);
if (!type) return;
const comma = value.includes(',') && !value.includes('/');
const num = value.trim().split(comma ? /\s*,\s*/ : /\s+(?!\/)|\s*\/\s*/);
if (num.length < 3 || num.length > 4) return;
if (num[3] && !validateAlpha(num[3])) return null;
let a = !num[3] ? 1 : parseFloat(num[3]) / (num[3].endsWith('%') ? 100 : 1);
if (isNaN(a)) a = 1;
const first = num[0];
if (/rgb/i.test(type)) {
if (!validateRGB(num)) {
return null;
}
const k = first.endsWith('%') ? 2.55 : 1;
const [r, g, b] = num.map(s => Math.round(parseFloat(s) * k));
return {type: 'rgb', r, g, b, a};
} else { } else {
return colorConverter.NAMED_COLORS.get(s.toLowerCase()); if (!validateHSL(num)) {
return null;
}
let h = parseFloat(first);
if (first.endsWith('grad')) h *= 360 / 400;
else if (first.endsWith('rad')) h *= 180 / Math.PI;
else if (first.endsWith('turn')) h *= 360;
const s = parseFloat(num[1]);
const l = parseFloat(num[2]);
return {type: 'hsl', h, s, l, a};
} }
} }
function initHexMap() {
HEX = Array(256).fill(-0xFFFF); // ensuring a PACKED_SMI array
for (let i = 48; i < 58; i++) HEX[i] = i - 48; // 0123456789
for (let i = 65; i < 71; i++) HEX[i] = i - 65 + 10; // ABCDEF
for (let i = 97; i < 103; i++) HEX[i] = i - 97 + 10; // abcdef
}
function parseHex(str) {
if (!HEX) initHexMap();
let r, g, b, a;
const len = str.length;
if (len === 4 || len === 5
? (r = HEX[str.charCodeAt(1)] * 0x11) >= 0 &&
(g = HEX[str.charCodeAt(2)] * 0x11) >= 0 &&
(b = HEX[str.charCodeAt(3)] * 0x11) >= 0 &&
(len < 5 || (a = HEX[str.charCodeAt(4)] * 0x11 / 255) >= 0)
: (len === 7 || len === 9) &&
(r = HEX[str.charCodeAt(1)] * 0x10 + HEX[str.charCodeAt(2)]) >= 0 &&
(g = HEX[str.charCodeAt(3)] * 0x10 + HEX[str.charCodeAt(4)]) >= 0 &&
(b = HEX[str.charCodeAt(5)] * 0x10 + HEX[str.charCodeAt(6)]) >= 0 &&
(len < 9 || (a = (HEX[str.charCodeAt(7)] * 0x10 + HEX[str.charCodeAt(8)]) / 255) >= 0)
) {
return {type: 'hex', r, g, b, a};
}
}
function parseFunc(type, val) {
if (!testAt(RX_COLOR[type], 0, val)) {
return;
}
// Not using destructuring because it's slow
const parts = val.trim().split(/\s*[,/]\s*|\s+/);
const n1 = parseFloat(parts[0]);
const n2 = parseFloat(parts[1]);
const n3 = parseFloat(parts[2]);
const nA = parseFloat(parts[3]);
const a = isNaN(nA) ? undefined : constrain(0, 1, parts[3].endsWith('%') ? nA / 100 : nA);
if (type === 'rgb') {
const k = parts[0].endsWith('%') ? 2.55 : 1;
return {
type,
r: constrain(0, 255, Math.round(n1 * k)),
g: constrain(0, 255, Math.round(n2 * k)),
b: constrain(0, 255, Math.round(n3 * k)),
a,
};
}
const h = constrainHue(n1 * (ANGLE_TO_DEG[parts[0].match(/\D*$/)[0].toLowerCase()] || 1));
const n2c = constrain(0, 100, n2 || 0);
const n3c = constrain(0, 100, n3 || 0);
return type === 'hwb'
? {type, h, w: n2c, b: n3c, a}
: {type, h, s: n2c, l: n3c, a};
}
function formatAlpha(a) { function formatAlpha(a) {
return isNaN(a) ? '' : return isNaN(a) ? '' :
(a + .5 * Math.pow(10, -colorConverter.ALPHA_DIGITS)) (a + .5 * Math.pow(10, -colorConverter.ALPHA_DIGITS))
@ -185,8 +164,8 @@ const colorConverter = (NAMED_COLORS => {
}; };
} }
function HSVtoRGB({h, s, v, a}) { function HSVtoRGB({h, s, v}) {
h = constrainHue(h); h = constrainHue(h) % 360;
const C = s * v; const C = s * v;
const X = C * (1 - Math.abs((h / 60) % 2 - 1)); const X = C * (1 - Math.abs((h / 60) % 2 - 1));
const m = v - C; const m = v - C;
@ -201,11 +180,9 @@ const colorConverter = (NAMED_COLORS => {
r: snapToInt(Math.round((r + m) * 255)), r: snapToInt(Math.round((r + m) * 255)),
g: snapToInt(Math.round((g + m) * 255)), g: snapToInt(Math.round((g + m) * 255)),
b: snapToInt(Math.round((b + m) * 255)), b: snapToInt(Math.round((b + m) * 255)),
a,
}; };
} }
function HSLtoHSV({h, s, l, a}) { function HSLtoHSV({h, s, l, a}) {
const t = s * (l < 50 ? l : 100 - l) / 100; const t = s * (l < 50 ? l : 100 - l) / 100;
return { return {
@ -216,41 +193,16 @@ const colorConverter = (NAMED_COLORS => {
}; };
} }
function HSVtoHSL({h, s, v, a}) { function HSVtoHSL({h, s, v}) {
const l = (2 - s) * v / 2; const l = (2 - s) * v / 2;
const t = l < .5 ? l * 2 : 2 - l * 2; const t = l < .5 ? l * 2 : 2 - l * 2;
return { return {
h: constrainHue(h), h: Math.round(constrainHue(h)),
s: t ? s * v / t * 100 : 0, s: Math.round(t ? s * v / t * 100 : 0),
l: l * 100, l: Math.round(l * 100),
a,
}; };
} }
function HWBtoHSV({h, w, b, a}) {
w = constrain(0, 100, w) / 100;
b = constrain(0, 100, b) / 100;
return {
h: constrainHue(h),
s: b === 1 ? 0 : 1 - w / (1 - b),
v: 1 - b,
a,
};
}
function HSVtoHWB({h, s, v, a}) {
return {
h: constrainHue(h),
w: (1 - s) * v * 100,
b: (1 - v) * 100,
a,
};
}
function constrain(min, max, value) {
return value < min ? min : value > max ? max : value;
}
function constrainHue(h) { function constrainHue(h) {
return h < 0 ? h % 360 + 360 : return h < 0 ? h % 360 + 360 :
h > 360 ? h % 360 : h > 360 ? h % 360 :
@ -263,162 +215,159 @@ const colorConverter = (NAMED_COLORS => {
} }
function hex2(val) { function hex2(val) {
return (val < 16 ? '0' : '') + Math.round(val).toString(16); return (val < 16 ? '0' : '') + (val >> 0).toString(16);
} }
})();
function testAt(rx, index, text) { colorConverter.NAMED_COLORS = new Map([
if (!rx) return false; ['transparent', 'rgba(0, 0, 0, 0)'],
rx.lastIndex = index; // CSS4 named colors
return rx.test(text); ['aliceblue', '#f0f8ff'],
} ['antiquewhite', '#faebd7'],
})(new Map([ ['aqua', '#00ffff'],
['transparent', {r: 0, g: 0, b: 0, a: 0, type: 'rgb'}], ['aquamarine', '#7fffd4'],
['aliceblue', {r: 240, g: 248, b: 255, type: 'hex'}], ['azure', '#f0ffff'],
['antiquewhite', {r: 250, g: 235, b: 215, type: 'hex'}], ['beige', '#f5f5dc'],
['aqua', {r: 0, g: 255, b: 255, type: 'hex'}], ['bisque', '#ffe4c4'],
['aquamarine', {r: 127, g: 255, b: 212, type: 'hex'}], ['black', '#000000'],
['azure', {r: 240, g: 255, b: 255, type: 'hex'}], ['blanchedalmond', '#ffebcd'],
['beige', {r: 245, g: 245, b: 220, type: 'hex'}], ['blue', '#0000ff'],
['bisque', {r: 255, g: 228, b: 196, type: 'hex'}], ['blueviolet', '#8a2be2'],
['black', {r: 0, g: 0, b: 0, type: 'hex'}], ['brown', '#a52a2a'],
['blanchedalmond', {r: 255, g: 235, b: 205, type: 'hex'}], ['burlywood', '#deb887'],
['blue', {r: 0, g: 0, b: 255, type: 'hex'}], ['cadetblue', '#5f9ea0'],
['blueviolet', {r: 138, g: 43, b: 226, type: 'hex'}], ['chartreuse', '#7fff00'],
['brown', {r: 165, g: 42, b: 42, type: 'hex'}], ['chocolate', '#d2691e'],
['burlywood', {r: 222, g: 184, b: 135, type: 'hex'}], ['coral', '#ff7f50'],
['cadetblue', {r: 95, g: 158, b: 160, type: 'hex'}], ['cornflowerblue', '#6495ed'],
['chartreuse', {r: 127, g: 255, b: 0, type: 'hex'}], ['cornsilk', '#fff8dc'],
['chocolate', {r: 210, g: 105, b: 30, type: 'hex'}], ['crimson', '#dc143c'],
['coral', {r: 255, g: 127, b: 80, type: 'hex'}], ['cyan', '#00ffff'],
['cornflowerblue', {r: 100, g: 149, b: 237, type: 'hex'}], ['darkblue', '#00008b'],
['cornsilk', {r: 255, g: 248, b: 220, type: 'hex'}], ['darkcyan', '#008b8b'],
['crimson', {r: 220, g: 20, b: 60, type: 'hex'}], ['darkgoldenrod', '#b8860b'],
['cyan', {r: 0, g: 255, b: 255, type: 'hex'}], ['darkgray', '#a9a9a9'],
['darkblue', {r: 0, g: 0, b: 139, type: 'hex'}], ['darkgrey', '#a9a9a9'],
['darkcyan', {r: 0, g: 139, b: 139, type: 'hex'}], ['darkgreen', '#006400'],
['darkgoldenrod', {r: 184, g: 134, b: 11, type: 'hex'}], ['darkkhaki', '#bdb76b'],
['darkgray', {r: 169, g: 169, b: 169, type: 'hex'}], ['darkmagenta', '#8b008b'],
['darkgrey', {r: 169, g: 169, b: 169, type: 'hex'}], ['darkolivegreen', '#556b2f'],
['darkgreen', {r: 0, g: 100, b: 0, type: 'hex'}], ['darkorange', '#ff8c00'],
['darkkhaki', {r: 189, g: 183, b: 107, type: 'hex'}], ['darkorchid', '#9932cc'],
['darkmagenta', {r: 139, g: 0, b: 139, type: 'hex'}], ['darkred', '#8b0000'],
['darkolivegreen', {r: 85, g: 107, b: 47, type: 'hex'}], ['darksalmon', '#e9967a'],
['darkorange', {r: 255, g: 140, b: 0, type: 'hex'}], ['darkseagreen', '#8fbc8f'],
['darkorchid', {r: 153, g: 50, b: 204, type: 'hex'}], ['darkslateblue', '#483d8b'],
['darkred', {r: 139, g: 0, b: 0, type: 'hex'}], ['darkslategray', '#2f4f4f'],
['darksalmon', {r: 233, g: 150, b: 122, type: 'hex'}], ['darkslategrey', '#2f4f4f'],
['darkseagreen', {r: 143, g: 188, b: 143, type: 'hex'}], ['darkturquoise', '#00ced1'],
['darkslateblue', {r: 72, g: 61, b: 139, type: 'hex'}], ['darkviolet', '#9400d3'],
['darkslategray', {r: 47, g: 79, b: 79, type: 'hex'}], ['deeppink', '#ff1493'],
['darkslategrey', {r: 47, g: 79, b: 79, type: 'hex'}], ['deepskyblue', '#00bfff'],
['darkturquoise', {r: 0, g: 206, b: 209, type: 'hex'}], ['dimgray', '#696969'],
['darkviolet', {r: 148, g: 0, b: 211, type: 'hex'}], ['dimgrey', '#696969'],
['deeppink', {r: 255, g: 20, b: 147, type: 'hex'}], ['dodgerblue', '#1e90ff'],
['deepskyblue', {r: 0, g: 191, b: 255, type: 'hex'}], ['firebrick', '#b22222'],
['dimgray', {r: 105, g: 105, b: 105, type: 'hex'}], ['floralwhite', '#fffaf0'],
['dimgrey', {r: 105, g: 105, b: 105, type: 'hex'}], ['forestgreen', '#228b22'],
['dodgerblue', {r: 30, g: 144, b: 255, type: 'hex'}], ['fuchsia', '#ff00ff'],
['firebrick', {r: 178, g: 34, b: 34, type: 'hex'}], ['gainsboro', '#dcdcdc'],
['floralwhite', {r: 255, g: 250, b: 240, type: 'hex'}], ['ghostwhite', '#f8f8ff'],
['forestgreen', {r: 34, g: 139, b: 34, type: 'hex'}], ['gold', '#ffd700'],
['fuchsia', {r: 255, g: 0, b: 255, type: 'hex'}], ['goldenrod', '#daa520'],
['gainsboro', {r: 220, g: 220, b: 220, type: 'hex'}], ['gray', '#808080'],
['ghostwhite', {r: 248, g: 248, b: 255, type: 'hex'}], ['grey', '#808080'],
['gold', {r: 255, g: 215, b: 0, type: 'hex'}], ['green', '#008000'],
['goldenrod', {r: 218, g: 165, b: 32, type: 'hex'}], ['greenyellow', '#adff2f'],
['gray', {r: 128, g: 128, b: 128, type: 'hex'}], ['honeydew', '#f0fff0'],
['grey', {r: 128, g: 128, b: 128, type: 'hex'}], ['hotpink', '#ff69b4'],
['green', {r: 0, g: 128, b: 0, type: 'hex'}], ['indianred', '#cd5c5c'],
['greenyellow', {r: 173, g: 255, b: 47, type: 'hex'}], ['indigo', '#4b0082'],
['honeydew', {r: 240, g: 255, b: 240, type: 'hex'}], ['ivory', '#fffff0'],
['hotpink', {r: 255, g: 105, b: 180, type: 'hex'}], ['khaki', '#f0e68c'],
['indianred', {r: 205, g: 92, b: 92, type: 'hex'}], ['lavender', '#e6e6fa'],
['indigo', {r: 75, g: 0, b: 130, type: 'hex'}], ['lavenderblush', '#fff0f5'],
['ivory', {r: 255, g: 255, b: 240, type: 'hex'}], ['lawngreen', '#7cfc00'],
['khaki', {r: 240, g: 230, b: 140, type: 'hex'}], ['lemonchiffon', '#fffacd'],
['lavender', {r: 230, g: 230, b: 250, type: 'hex'}], ['lightblue', '#add8e6'],
['lavenderblush', {r: 255, g: 240, b: 245, type: 'hex'}], ['lightcoral', '#f08080'],
['lawngreen', {r: 124, g: 252, b: 0, type: 'hex'}], ['lightcyan', '#e0ffff'],
['lemonchiffon', {r: 255, g: 250, b: 205, type: 'hex'}], ['lightgoldenrodyellow', '#fafad2'],
['lightblue', {r: 173, g: 216, b: 230, type: 'hex'}], ['lightgray', '#d3d3d3'],
['lightcoral', {r: 240, g: 128, b: 128, type: 'hex'}], ['lightgrey', '#d3d3d3'],
['lightcyan', {r: 224, g: 255, b: 255, type: 'hex'}], ['lightgreen', '#90ee90'],
['lightgoldenrodyellow', {r: 250, g: 250, b: 210, type: 'hex'}], ['lightpink', '#ffb6c1'],
['lightgray', {r: 211, g: 211, b: 211, type: 'hex'}], ['lightsalmon', '#ffa07a'],
['lightgrey', {r: 211, g: 211, b: 211, type: 'hex'}], ['lightseagreen', '#20b2aa'],
['lightgreen', {r: 144, g: 238, b: 144, type: 'hex'}], ['lightskyblue', '#87cefa'],
['lightpink', {r: 255, g: 182, b: 193, type: 'hex'}], ['lightslategray', '#778899'],
['lightsalmon', {r: 255, g: 160, b: 122, type: 'hex'}], ['lightslategrey', '#778899'],
['lightseagreen', {r: 32, g: 178, b: 170, type: 'hex'}], ['lightsteelblue', '#b0c4de'],
['lightskyblue', {r: 135, g: 206, b: 250, type: 'hex'}], ['lightyellow', '#ffffe0'],
['lightslategray', {r: 119, g: 136, b: 153, type: 'hex'}], ['lime', '#00ff00'],
['lightslategrey', {r: 119, g: 136, b: 153, type: 'hex'}], ['limegreen', '#32cd32'],
['lightsteelblue', {r: 176, g: 196, b: 222, type: 'hex'}], ['linen', '#faf0e6'],
['lightyellow', {r: 255, g: 255, b: 224, type: 'hex'}], ['magenta', '#ff00ff'],
['lime', {r: 0, g: 255, b: 0, type: 'hex'}], ['maroon', '#800000'],
['limegreen', {r: 50, g: 205, b: 50, type: 'hex'}], ['mediumaquamarine', '#66cdaa'],
['linen', {r: 250, g: 240, b: 230, type: 'hex'}], ['mediumblue', '#0000cd'],
['magenta', {r: 255, g: 0, b: 255, type: 'hex'}], ['mediumorchid', '#ba55d3'],
['maroon', {r: 128, g: 0, b: 0, type: 'hex'}], ['mediumpurple', '#9370db'],
['mediumaquamarine', {r: 102, g: 205, b: 170, type: 'hex'}], ['mediumseagreen', '#3cb371'],
['mediumblue', {r: 0, g: 0, b: 205, type: 'hex'}], ['mediumslateblue', '#7b68ee'],
['mediumorchid', {r: 186, g: 85, b: 211, type: 'hex'}], ['mediumspringgreen', '#00fa9a'],
['mediumpurple', {r: 147, g: 112, b: 219, type: 'hex'}], ['mediumturquoise', '#48d1cc'],
['mediumseagreen', {r: 60, g: 179, b: 113, type: 'hex'}], ['mediumvioletred', '#c71585'],
['mediumslateblue', {r: 123, g: 104, b: 238, type: 'hex'}], ['midnightblue', '#191970'],
['mediumspringgreen', {r: 0, g: 250, b: 154, type: 'hex'}], ['mintcream', '#f5fffa'],
['mediumturquoise', {r: 72, g: 209, b: 204, type: 'hex'}], ['mistyrose', '#ffe4e1'],
['mediumvioletred', {r: 199, g: 21, b: 133, type: 'hex'}], ['moccasin', '#ffe4b5'],
['midnightblue', {r: 25, g: 25, b: 112, type: 'hex'}], ['navajowhite', '#ffdead'],
['mintcream', {r: 245, g: 255, b: 250, type: 'hex'}], ['navy', '#000080'],
['mistyrose', {r: 255, g: 228, b: 225, type: 'hex'}], ['oldlace', '#fdf5e6'],
['moccasin', {r: 255, g: 228, b: 181, type: 'hex'}], ['olive', '#808000'],
['navajowhite', {r: 255, g: 222, b: 173, type: 'hex'}], ['olivedrab', '#6b8e23'],
['navy', {r: 0, g: 0, b: 128, type: 'hex'}], ['orange', '#ffa500'],
['oldlace', {r: 253, g: 245, b: 230, type: 'hex'}], ['orangered', '#ff4500'],
['olive', {r: 128, g: 128, b: 0, type: 'hex'}], ['orchid', '#da70d6'],
['olivedrab', {r: 107, g: 142, b: 35, type: 'hex'}], ['palegoldenrod', '#eee8aa'],
['orange', {r: 255, g: 165, b: 0, type: 'hex'}], ['palegreen', '#98fb98'],
['orangered', {r: 255, g: 69, b: 0, type: 'hex'}], ['paleturquoise', '#afeeee'],
['orchid', {r: 218, g: 112, b: 214, type: 'hex'}], ['palevioletred', '#db7093'],
['palegoldenrod', {r: 238, g: 232, b: 170, type: 'hex'}], ['papayawhip', '#ffefd5'],
['palegreen', {r: 152, g: 251, b: 152, type: 'hex'}], ['peachpuff', '#ffdab9'],
['paleturquoise', {r: 175, g: 238, b: 238, type: 'hex'}], ['peru', '#cd853f'],
['palevioletred', {r: 219, g: 112, b: 147, type: 'hex'}], ['pink', '#ffc0cb'],
['papayawhip', {r: 255, g: 239, b: 213, type: 'hex'}], ['plum', '#dda0dd'],
['peachpuff', {r: 255, g: 218, b: 185, type: 'hex'}], ['powderblue', '#b0e0e6'],
['peru', {r: 205, g: 133, b: 63, type: 'hex'}], ['purple', '#800080'],
['pink', {r: 255, g: 192, b: 203, type: 'hex'}], ['rebeccapurple', '#663399'],
['plum', {r: 221, g: 160, b: 221, type: 'hex'}], ['red', '#ff0000'],
['powderblue', {r: 176, g: 224, b: 230, type: 'hex'}], ['rosybrown', '#bc8f8f'],
['purple', {r: 128, g: 0, b: 128, type: 'hex'}], ['royalblue', '#4169e1'],
['rebeccapurple', {r: 102, g: 51, b: 153, type: 'hex'}], ['saddlebrown', '#8b4513'],
['red', {r: 255, g: 0, b: 0, type: 'hex'}], ['salmon', '#fa8072'],
['rosybrown', {r: 188, g: 143, b: 143, type: 'hex'}], ['sandybrown', '#f4a460'],
['royalblue', {r: 65, g: 105, b: 225, type: 'hex'}], ['seagreen', '#2e8b57'],
['saddlebrown', {r: 139, g: 69, b: 19, type: 'hex'}], ['seashell', '#fff5ee'],
['salmon', {r: 250, g: 128, b: 114, type: 'hex'}], ['sienna', '#a0522d'],
['sandybrown', {r: 244, g: 164, b: 96, type: 'hex'}], ['silver', '#c0c0c0'],
['seagreen', {r: 46, g: 139, b: 87, type: 'hex'}], ['skyblue', '#87ceeb'],
['seashell', {r: 255, g: 245, b: 238, type: 'hex'}], ['slateblue', '#6a5acd'],
['sienna', {r: 160, g: 82, b: 45, type: 'hex'}], ['slategray', '#708090'],
['silver', {r: 192, g: 192, b: 192, type: 'hex'}], ['slategrey', '#708090'],
['skyblue', {r: 135, g: 206, b: 235, type: 'hex'}], ['snow', '#fffafa'],
['slateblue', {r: 106, g: 90, b: 205, type: 'hex'}], ['springgreen', '#00ff7f'],
['slategray', {r: 112, g: 128, b: 144, type: 'hex'}], ['steelblue', '#4682b4'],
['slategrey', {r: 112, g: 128, b: 144, type: 'hex'}], ['tan', '#d2b48c'],
['snow', {r: 255, g: 250, b: 250, type: 'hex'}], ['teal', '#008080'],
['springgreen', {r: 0, g: 255, b: 127, type: 'hex'}], ['thistle', '#d8bfd8'],
['steelblue', {r: 70, g: 130, b: 180, type: 'hex'}], ['tomato', '#ff6347'],
['tan', {r: 210, g: 180, b: 140, type: 'hex'}], ['turquoise', '#40e0d0'],
['teal', {r: 0, g: 128, b: 128, type: 'hex'}], ['violet', '#ee82ee'],
['thistle', {r: 216, g: 191, b: 216, type: 'hex'}], ['wheat', '#f5deb3'],
['tomato', {r: 255, g: 99, b: 71, type: 'hex'}], ['white', '#ffffff'],
['turquoise', {r: 64, g: 224, b: 208, type: 'hex'}], ['whitesmoke', '#f5f5f5'],
['violet', {r: 238, g: 130, b: 238, type: 'hex'}], ['yellow', '#ffff00'],
['wheat', {r: 245, g: 222, b: 179, type: 'hex'}], ['yellowgreen', '#9acd32'],
['white', {r: 255, g: 255, b: 255, type: 'hex'}], ]);
['whitesmoke', {r: 245, g: 245, b: 245, type: 'hex'}],
['yellow', {r: 255, g: 255, b: 0, type: 'hex'}],
['yellowgreen', {r: 154, g: 205, b: 50, type: 'hex'}],
]));

View File

@ -18,7 +18,7 @@ function colorMimicry(el, targets, dummyContainer = document.body) {
let numTotal = 0; let numTotal = 0;
const rootStyle = getStyle(document.documentElement); const rootStyle = getStyle(document.documentElement);
for (const k in targets) { for (const k in targets) {
const base = {r: 0, g: 0, b: 0, a: 0}; const base = {r: 255, g: 255, b: 255, a: 1};
blend(base, rootStyle[targets[k]]); blend(base, rootStyle[targets[k]]);
colors[k] = base; colors[k] = base;
numTotal++; numTotal++;
@ -45,10 +45,6 @@ function colorMimicry(el, targets, dummyContainer = document.body) {
el.remove(); el.remove();
} }
for (const k in targets) { for (const k in targets) {
const c = colors[k];
if (!isOpaque(c)) {
blend(colors[k] = {r: 255, g: 255, b: 255, a: 1}, c);
}
const {r, g, b, a} = colors[k]; const {r, g, b, a} = colors[k];
colors[k] = `rgba(${r}, ${g}, ${b}, ${a})`; colors[k] = `rgba(${r}, ${g}, ${b}, ${a})`;
// https://www.w3.org/TR/AERT#color-contrast // https://www.w3.org/TR/AERT#color-contrast
@ -73,7 +69,7 @@ function colorMimicry(el, targets, dummyContainer = document.body) {
base.b = Math.round(b * q1 + base.b * q2); base.b = Math.round(b * q1 + base.b * q2);
base.a = mixedA; base.a = mixedA;
} }
return isOpaque(base); return Math.abs(base.a - 1) < 1e-3;
} }
// speed-up for sequential invocations within the same event loop cycle // speed-up for sequential invocations within the same event loop cycle
@ -90,8 +86,4 @@ function colorMimicry(el, targets, dummyContainer = document.body) {
function clearCache() { function clearCache() {
styleCache.clear(); styleCache.clear();
} }
function isOpaque({a}) {
return Math.abs(a - 1) < 1e-3;
}
} }

View File

@ -3,7 +3,6 @@
'use strict'; 'use strict';
(window.CodeMirror ? window.CodeMirror.prototype : window).colorpicker = function () { (window.CodeMirror ? window.CodeMirror.prototype : window).colorpicker = function () {
const {constrain} = colorConverter;
const cm = window.CodeMirror && this; const cm = window.CodeMirror && this;
const CSS_PREFIX = 'colorpicker-'; const CSS_PREFIX = 'colorpicker-';
const HUE_COLORS = [ const HUE_COLORS = [
@ -41,6 +40,8 @@
let /** @type {HTMLElement} */ $palette; let /** @type {HTMLElement} */ $palette;
const $inputGroups = {}; const $inputGroups = {};
const $inputs = {}; const $inputs = {};
const $rgb = {};
const $hsl = {};
const $hexLettercase = {}; const $hexLettercase = {};
const allowInputFocus = !('ontouchstart' in document) || window.innerHeight > 800; const allowInputFocus = !('ontouchstart' in document) || window.innerHeight > 800;
@ -79,26 +80,11 @@
} }
const el = document.createElement(props.tag || 'div'); const el = document.createElement(props.tag || 'div');
el.className = toArray(cls).map(c => c ? CSS_PREFIX + c : '').join(' '); el.className = toArray(cls).map(c => c ? CSS_PREFIX + c : '').join(' ');
el.append(...toArray(children).filter(Boolean)); el.append(...toArray(children));
if (props) delete props.tag; if (props) delete props.tag;
return Object.assign(el, props); return Object.assign(el, props);
} }
const alphaPattern = /^\s*(0+\.?|0*\.\d+|0*1\.?|0*1\.0*)?\s*$/.source; const alphaPattern = /^\s*(0+\.?|0*\.\d+|0*1\.?|0*1\.0*)?\s*$/.source;
const nestedObj = (obj, key) => (obj[key] || (obj[key] = {}));
const makeNum = (type, channel, props, min, max) =>
$(['input-field', `${type}-${channel}`], [
(nestedObj($inputs, type)[channel] =
$('input', props || {tag: 'input', type: 'number', min, max, step: 1})),
$('title', channel.toUpperCase()),
]);
const ColorGroup = (type, channels) => (
$inputGroups[type] = $(['input-group', type], [
...Object.entries(channels).map(([k, v]) =>
makeNum(type, k, null, v[0], v[1])),
makeNum(type, 'a',
{tag: 'input', type: 'text', pattern: alphaPattern, spellcheck: false}),
])
);
$root = $('popup', { $root = $('popup', {
oninput: setFromInputs, oninput: setFromInputs,
onkeydown: setFromKeyboard, onkeydown: setFromKeyboard,
@ -142,9 +128,42 @@
]), ]),
]), ]),
]), ]),
ColorGroup('rgb', {r: [0, 255], g: [0, 255], b: [0, 255]}), $inputGroups.rgb = $(['input-group', 'rgb'], [
ColorGroup('hsl', {h: [], s: [0, 100], l: [0, 100]}), $(['input-field', 'rgb-r'], [
ColorGroup('hwb', {h: [], w: [0, 100], b: [0, 100]}), $rgb.r = $('input', {tag: 'input', type: 'number', min: 0, max: 255, step: 1}),
$('title', 'R'),
]),
$(['input-field', 'rgb-g'], [
$rgb.g = $('input', {tag: 'input', type: 'number', min: 0, max: 255, step: 1}),
$('title', 'G'),
]),
$(['input-field', 'rgb-b'], [
$rgb.b = $('input', {tag: 'input', type: 'number', min: 0, max: 255, step: 1}),
$('title', 'B'),
]),
$(['input-field', 'rgb-a'], [
$rgb.a = $('input', {tag: 'input', type: 'text', pattern: alphaPattern, spellcheck: false}),
$('title', 'A'),
]),
]),
$inputGroups.hsl = $(['input-group', 'hsl'], [
$(['input-field', 'hsl-h'], [
$hsl.h = $('input', {tag: 'input', type: 'number', step: 1}),
$('title', 'H'),
]),
$(['input-field', 'hsl-s'], [
$hsl.s = $('input', {tag: 'input', type: 'number', min: 0, max: 100, step: 1}),
$('title', 'S'),
]),
$(['input-field', 'hsl-l'], [
$hsl.l = $('input', {tag: 'input', type: 'number', min: 0, max: 100, step: 1}),
$('title', 'L'),
]),
$(['input-field', 'hsl-a'], [
$hsl.a = $('input', {tag: 'input', type: 'text', pattern: alphaPattern, spellcheck: false}),
$('title', 'A'),
]),
]),
$('format-change', [ $('format-change', [
$formatChangeButton = $('format-change-button', {onclick: setFromFormatElement}, '↔'), $formatChangeButton = $('format-change-button', {onclick: setFromFormatElement}, '↔'),
]), ]),
@ -161,26 +180,19 @@
}), }),
]); ]);
const inputsToObj = type => { $inputs.hex = [$hexCode];
const res = {type}; $inputs.rgb = [$rgb.r, $rgb.g, $rgb.b, $rgb.a];
for (const [k, el] of Object.entries($inputs[type])) { $inputs.hsl = [$hsl.h, $hsl.s, $hsl.l, $hsl.a];
res[k] = parseFloat(el.value); const inputsToArray = inputs => inputs.map(el => parseFloat(el.value));
} const inputsToHexString = () => $hexCode.value.trim();
return res; const inputsToRGB = ([r, g, b, a] = inputsToArray($inputs.rgb)) => ({r, g, b, a, type: 'rgb'});
}; const inputsToHSL = ([h, s, l, a] = inputsToArray($inputs.hsl)) => ({h, s, l, a, type: 'hsl'});
for (const [key, val] of Object.entries($inputs)) { Object.defineProperty($inputs.hex, 'color', {get: inputsToHexString});
Object.defineProperty(val, 'color', { Object.defineProperty($inputs.rgb, 'color', {get: inputsToRGB});
get: inputsToObj.bind(null, key), Object.defineProperty($inputs.hsl, 'color', {get: inputsToHSL});
}); Object.defineProperty($inputs, 'color', {get: () => $inputs[currentFormat].color});
}
Object.defineProperty($inputs.hex = [$hexCode], 'color', {
get: () => $hexCode.value.trim(),
});
Object.defineProperty($inputs, 'color', {
get: () => $inputs[currentFormat].color,
});
Object.defineProperty($inputs, 'colorString', { Object.defineProperty($inputs, 'colorString', {
get: () => currentFormat && colorConverter.format($inputs[currentFormat].color, undefined, {round: true}), 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)));
@ -198,7 +210,6 @@
HSV = {}; HSV = {};
currentFormat = ''; currentFormat = '';
options = PUBLIC_API.options = opt; options = PUBLIC_API.options = opt;
if (opt.round !== false) opt.round = true;
prevFocusedElement = document.activeElement; prevFocusedElement = document.activeElement;
userActivity = 0; userActivity = 0;
lastOutputColor = opt.color || ''; lastOutputColor = opt.color || '';
@ -235,19 +246,33 @@
} }
function setColor(color) { function setColor(color) {
if (typeof color === 'string') { switch (typeof color) {
color = colorConverter.parse(color); case 'string':
} else if (typeof color === 'object' && color && !color.type) { color = colorConverter.parse(color);
color = Object.assign({}, color, {type: colorConverter.guessType(color)}); break;
case 'object': {
const {r, g, b, a} = color;
if (!isNaN(r) && !isNaN(g) && !isNaN(b)) {
color = {r, g, b, a, type: 'rgb'};
break;
}
const {h, s, l} = color;
if (!isNaN(h) && !isNaN(s) && !isNaN(l)) {
color = {h, s, l, a, type: 'hsl'};
break;
}
}
// fallthrough
default:
return false;
} }
if (!color || !color.type) { if (color) {
return false; if (!initialized) {
init();
}
setFromColor(color);
} }
if (!initialized) { return Boolean(color);
init();
}
setFromColor(color);
return true;
} }
function getColor(type) { function getColor(type) {
@ -255,7 +280,9 @@
return; return;
} }
readCurrentColorFromRamps(); readCurrentColorFromRamps();
const color = colorConverter.fromHSV(HSV, type); const color = type === 'hsl' ?
colorConverter.HSVtoHSL(HSV) :
colorConverter.HSVtoRGB(HSV);
return type ? colorToString(color, type) : color; return type ? colorToString(color, type) : color;
} }
@ -314,7 +341,7 @@
function setFromFormatElement({shiftKey}) { function setFromFormatElement({shiftKey}) {
userActivity = performance.now(); userActivity = performance.now();
HSV.a = isNaN(HSV.a) ? 1 : HSV.a; HSV.a = isNaN(HSV.a) ? 1 : HSV.a;
const formats = Object.keys($inputGroups); const formats = ['hex', 'rgb', 'hsl'];
const dir = shiftKey ? -1 : 1; const dir = shiftKey ? -1 : 1;
const total = formats.length; const total = formats.length;
if ($inputs.colorString === $inputs.prevColorString) { if ($inputs.colorString === $inputs.prevColorString) {
@ -335,7 +362,7 @@
function setFromInputs(event) { function setFromInputs(event) {
userActivity = event ? performance.now() : userActivity; userActivity = event ? performance.now() : userActivity;
if (Object.values($inputs[currentFormat]).every(validateInput)) { if ($inputs[currentFormat].every(validateInput)) {
setFromColor($inputs.color); setFromColor($inputs.color);
} }
} }
@ -348,7 +375,7 @@
case 'PageDown': case 'PageDown':
if (!ctrl && !alt && !meta) { if (!ctrl && !alt && !meta) {
const el = document.activeElement; const el = document.activeElement;
const inputs = Object.values($inputs[currentFormat]); const inputs = $inputs[currentFormat];
const lastInput = inputs[inputs.length - 1]; const lastInput = inputs[inputs.length - 1];
if (key === 'Tab' && shift && el === inputs[0]) { if (key === 'Tab' && shift && el === inputs[0]) {
maybeFocus(lastInput); maybeFocus(lastInput);
@ -397,8 +424,8 @@
newValue = options.hexUppercase ? newValue.toUpperCase() : newValue.toLowerCase(); newValue = options.hexUppercase ? newValue.toUpperCase() : newValue.toLowerCase();
} else if (!alt) { } else if (!alt) {
value = parseFloat(el.value); value = parseFloat(el.value);
const isHue = el.title === 'H'; const isHue = el === $inputs.hsl[0];
const isAlpha = el === $inputs[currentFormat].a; const isAlpha = el === $inputs[currentFormat][3];
const isRGB = currentFormat === 'rgb'; const isRGB = currentFormat === 'rgb';
const min = isHue ? -360 : 0; const min = isHue ? -360 : 0;
const max = isHue ? 360 : isAlpha ? 1 : isRGB ? 255 : 100; const max = isHue ? 360 : isAlpha ? 1 : isRGB ? 255 : 100;
@ -419,7 +446,7 @@
} }
function validateInput(el) { function validateInput(el) {
const isAlpha = el === $inputs[currentFormat].a; const isAlpha = el === $inputs[currentFormat][3];
let isValid = (isAlpha || el.value.trim()) && el.checkValidity(); let isValid = (isAlpha || el.value.trim()) && el.checkValidity();
if (!isAlpha && !isValid && currentFormat === 'rgb') { if (!isAlpha && !isValid && currentFormat === 'rgb') {
isValid = parseAs(el, parseInt); isValid = parseAs(el, parseInt);
@ -437,7 +464,9 @@
function setFromColor(color) { function setFromColor(color) {
color = typeof color === 'string' ? colorConverter.parse(color) : color; color = typeof color === 'string' ? colorConverter.parse(color) : color;
color = color || colorConverter.parse('#f00'); color = color || colorConverter.parse('#f00');
const newHSV = colorConverter.toHSV(color); const newHSV = color.type === 'hsl' ?
colorConverter.HSLtoHSV(color) :
colorConverter.RGBtoHSV(color);
if (Object.entries(newHSV).every(([k, v]) => v === HSV[k] || Math.abs(v - HSV[k]) < 1e-3)) { if (Object.entries(newHSV).every(([k, v]) => v === HSV[k] || Math.abs(v - HSV[k]) < 1e-3)) {
return; return;
} }
@ -459,7 +488,7 @@
} }
} }
$inputGroups[format].dataset.active = ''; $inputGroups[format].dataset.active = '';
maybeFocus(Object.values($inputs[format])[0]); maybeFocus($inputs[format][0]);
currentFormat = format; currentFormat = format;
} }
@ -481,13 +510,25 @@
} }
function renderInputs() { function renderInputs() {
const rgb = colorConverter.fromHSV(HSV, 'rgb'); const rgb = colorConverter.HSVtoRGB(HSV);
if (currentFormat === 'hex') { switch (currentFormat) {
$hexCode.value = colorToString(rgb, 'hex'); case 'hex':
} else { rgb.a = HSV.a;
for (const [k, v] of Object.entries(colorConverter.fromHSV(HSV, currentFormat))) { $hexCode.value = colorToString(rgb, 'hex');
const el = $inputs[currentFormat][k]; break;
if (el) el.value = k === 'a' ? alphaToString() || 1 : Math.round(v); case 'rgb': {
$rgb.r.value = rgb.r;
$rgb.g.value = rgb.g;
$rgb.b.value = rgb.b;
$rgb.a.value = alphaToString() || 1;
break;
}
case 'hsl': {
const {h, s, l} = colorConverter.HSVtoHSL(HSV);
$hsl.h.value = h;
$hsl.s.value = s;
$hsl.l.value = l;
$hsl.a.value = alphaToString() || 1;
} }
} }
$swatch.style.backgroundColor = colorToString(rgb, 'rgb'); $swatch.style.backgroundColor = colorToString(rgb, 'rgb');
@ -663,7 +704,7 @@
} }
if ( if (
userActivity && userActivity &&
Object.values($inputs[currentFormat]).every(el => el.checkValidity()) $inputs[currentFormat].every(el => el.checkValidity())
) { ) {
lastOutputColor = colorString.replace(/\b0\./g, '.'); lastOutputColor = colorString.replace(/\b0\./g, '.');
if (isCallable) { if (isCallable) {
@ -729,7 +770,7 @@
//region Color conversion utilities //region Color conversion utilities
function colorToString(color, type = currentFormat) { function colorToString(color, type = currentFormat) {
return colorConverter.format(color, type, options); return colorConverter.format(color, type, options.hexUppercase);
} }
function alphaToString(a = HSV.a) { function alphaToString(a = HSV.a) {
@ -737,7 +778,9 @@
} }
function currentColorToString(format = currentFormat, alpha = HSV.a) { function currentColorToString(format = currentFormat, alpha = HSV.a) {
const converted = colorConverter.fromHSV(HSV, format); const converted = format === 'hsl' ?
colorConverter.HSVtoHSL(HSV) :
colorConverter.HSVtoRGB(HSV);
converted.a = isNaN(alpha) || alpha === 1 ? undefined : alpha; converted.a = isNaN(alpha) || alpha === 1 ? undefined : alpha;
return colorToString(converted, format); return colorToString(converted, format);
} }
@ -836,6 +879,10 @@
return bgLuma < .5 ? 'dark' : 'light'; return bgLuma < .5 ? 'dark' : 'light';
} }
function constrain(min, max, value) {
return value < min ? min : value > max ? max : value;
}
function parseAs(el, parser) { function parseAs(el, parser) {
const num = parser(el.value); const num = parser(el.value);
if (!isNaN(num) && if (!isNaN(num) &&

View File

@ -8,28 +8,51 @@
const COLORVIEW_CLASS = 'colorview'; const COLORVIEW_CLASS = 'colorview';
const COLORVIEW_SWATCH_CLASS = COLORVIEW_CLASS + '-swatch'; const COLORVIEW_SWATCH_CLASS = COLORVIEW_CLASS + '-swatch';
const COLORVIEW_SWATCH_CSS = `--${COLORVIEW_SWATCH_CLASS}:`; const COLORVIEW_SWATCH_CSS = `--${COLORVIEW_SWATCH_CLASS}:`;
const CLOSE_POPUP_EVENT = 'close-colorpicker-popup'; const CLOSE_POPUP_EVENT = 'close-colorpicker-popup';
const {RX_COLOR, testAt} = colorConverter; const RXS_NUM = /\s*([+-]?(?:\d+\.?\d*|\d*\.\d+))(?:e[+-]?\d+)?/.source;
const RX_UNSUPPORTED = (s => s && new RegExp(s))([ const RX_COLOR = {
!CSS.supports('color', '#abcd') && /#(.{4}){1,2}$/, hex: /#(?:[a-f\d]{3}(?:[a-f\d](?:[a-f\d]{2}){0,2})?)\b/iy,
!CSS.supports('color', 'hwb(1 0% 0%)') && /^hwb\(/,
!CSS.supports('color', 'rgb(1e2,0,0)') && /\de/, rgb: new RegExp([
!CSS.supports('color', 'rgb(1.5,0,0)') && // num, num, num [ , num_or_pct]?
/^rgba?\((([^,]+,){0,2}[^,]*\.|(\s*\S+\s+){0,2}\S*\.)/, // pct, pct, pct [ , num_or_pct]?
!CSS.supports('color', 'rgb(1,2,3,.5)') && /[^a]\(([^,]+,){3}/, `^((${RXS_NUM}\\s*(,|$)){3}|(${RXS_NUM}%\\s*(,|$)){3})(${RXS_NUM}%?)?\\s*$`,
!CSS.supports('color', 'rgb(1,2,3,50%)') && /\((([^,]+,){3}|(\s*\S+[\s/]+){3}).*?%/, // num num num [ / num_or_pct]?
!CSS.supports('color', 'rgb(1 2 3 / 1)') && /^[^,]+$/, // pct pct pct [ / num_or_pct]?
!CSS.supports('color', 'hsl(1turn, 2%, 3%)') && /deg|g?rad|turn/, `^((${RXS_NUM}\\s*(\\s|$)){3}|(${RXS_NUM}%\\s*(\\s|$)){3})(/${RXS_NUM}%?)?\\s*$`,
].filter(Boolean).map(rx => rx.source).join('|')); ].join('|'), 'iy'),
hsl: new RegExp([
// num_or_angle, pct, pct [ , num_or_pct]?
`^(${RXS_NUM}(|deg|g?rad|turn)\\s*),(${RXS_NUM}%\\s*(,|$)){2}(${RXS_NUM}%?)?\\s*$`,
// num_or_angle pct pct [ / num_or_pct]?
`^(${RXS_NUM}(|deg|g?rad|turn)\\s*)\\s(${RXS_NUM}%\\s*(\\s|$)){2}(/${RXS_NUM}%?)?\\s*$`,
].join('|'), 'iy'),
unsupported: new RegExp([
!CSS.supports('color', '#abcd') && /#(.{4}){1,2}$/,
!CSS.supports('color', 'rgb(1e2,0,0)') && /\de/,
!CSS.supports('color', 'rgb(1.5,0,0)') && /^rgba?\((([^,]+,){0,2}[^,]*\.|(\s*\S+\s+){0,2}\S*\.)/,
!CSS.supports('color', 'rgb(1,2,3,.5)') && /[^a]\(([^,]+,){3}/,
!CSS.supports('color', 'rgb(1,2,3,50%)') && /\((([^,]+,){3}|(\s*\S+[\s/]+){3}).*?%/,
!CSS.supports('color', 'rgb(1 2 3 / 1)') && /^[^,]+$/,
!CSS.supports('color', 'hsl(1turn, 2%, 3%)') && /deg|g?rad|turn/,
].filter(Boolean).map(rx => rx.source).join('|') || '^$', 'i'),
};
if (RX_COLOR.unsupported.source === '^$') {
RX_COLOR.unsupported = null;
}
const RX_DETECT = new RegExp('(^|[\\s(){}[\\]:,/"=])' + const RX_DETECT = new RegExp('(^|[\\s(){}[\\]:,/"=])' +
'(' + '(' +
RX_COLOR.hex.source + '|' + RX_COLOR.hex.source + '|' +
'(?:(?:rgb|hsl)a?|hwb)(?=\\()|(?:' + [...colorConverter.NAMED_COLORS.keys()].join('|') + ')' + '(?:rgb|hsl)a?(?=\\()|(?:' + [...colorConverter.NAMED_COLORS.keys()].join('|') + ')' +
'(?=[\\s;(){}[\\]/"!]|$)' + '(?=[\\s;(){}[\\]/"!]|$)' +
')', 'gi'); ')', 'gi');
const RX_DETECT_FUNC = /((rgb|hsl)a?|hwb)\(/iy; const RX_DETECT_FUNC = /(rgb|hsl)a?\(/iy;
const RX_COMMENT = /\/\*([^*]+|\*(?!\/))*(\*\/|$)/g;
const RX_COMMENT = /\/\*([^*]|\*(?!\/))*(\*\/|$)/g;
const SPACE1K = ' '.repeat(1000); const SPACE1K = ' '.repeat(1000);
// milliseconds to work on invisible colors per one run // milliseconds to work on invisible colors per one run
@ -416,7 +439,7 @@
function getSafeColorValue() { function getSafeColorValue() {
if (isHex && color.length !== 5 && color.length !== 9) return color; if (isHex && color.length !== 5 && color.length !== 9) return color;
if (!RX_UNSUPPORTED || !RX_UNSUPPORTED.test(color)) return color; if (!RX_COLOR.unsupported || !RX_COLOR.unsupported.test(color)) return color;
const value = colorConverter.parse(color); const value = colorConverter.parse(color);
return colorConverter.format(value, 'rgb'); return colorConverter.format(value, 'rgb');
} }
@ -687,6 +710,14 @@
setTimeout(() => el.remove(), DURATION_SEC * 1000); setTimeout(() => el.remove(), DURATION_SEC * 1000);
} }
function testAt(rx, index, text) {
if (!rx) return false;
rx.lastIndex = index;
return rx.test(text);
}
function getStyleAtPos({ function getStyleAtPos({
line, line,
styles = this.getLineHandle(line).styles, styles = this.getLineHandle(line).styles,

View File

@ -112,7 +112,7 @@ class Reporter {
//eslint-disable-next-line no-var //eslint-disable-next-line no-var
var CSSLint = (() => { var CSSLint = (() => {
const RX_EMBEDDED = /\/\*\s*csslint\s+((?:[^*]+|\*(?!\/))+?)\*\//ig; const RX_EMBEDDED = /\/\*\s*csslint\s+((?:[^*]|\*(?!\/))+?)\*\//ig;
const EBMEDDED_RULE_VALUE_MAP = { const EBMEDDED_RULE_VALUE_MAP = {
// error // error
'true': 2, 'true': 2,
@ -330,7 +330,7 @@ CSSLint.Util = {
/** Gets the lower-cased text without vendor prefix */ /** Gets the lower-cased text without vendor prefix */
getPropName(prop) { getPropName(prop) {
return prop._propName || return prop._propName ||
(prop._propName = prop.text.match(parserlib.util.rxVendorPrefix)[2].toLowerCase()); (prop._propName = prop.text.replace(parserlib.util.rxVendorPrefix, '').toLowerCase());
}, },
registerRuleEvents(parser, {start, property, end}) { registerRuleEvents(parser, {start, property, end}) {
@ -1327,13 +1327,14 @@ CSSLint.addRule['known-pseudos'] = [{
const rx = /^(:+)(?:-(\w+)-)?([^(]+)(\()?/i; const rx = /^(:+)(?:-(\w+)-)?([^(]+)(\()?/i;
const allowsFunc = Func + FuncToo; const allowsFunc = Func + FuncToo;
const allowsPrefix = WK + Moz; const allowsPrefix = WK + Moz;
const {lower} = parserlib.util;
const checkSelector = ({parts}) => { const checkSelector = ({parts}) => {
for (const {modifiers} of parts || []) { for (const {modifiers} of parts || []) {
if (!modifiers) continue; if (!modifiers) continue;
for (const mod of modifiers) { for (const mod of modifiers) {
if (mod.type === 'pseudo') { if (mod.type === 'pseudo') {
const {text} = mod; const {text} = mod;
const [all, colons, prefix, name, paren] = rx.exec(text.toLowerCase()) || 0; const [all, colons, prefix, name, paren] = rx.exec(lower(text)) || 0;
const defPrefixed = definitionsPrefixed[name]; const defPrefixed = definitionsPrefixed[name];
const def = definitions[name] || defPrefixed; const def = definitions[name] || defPrefixed;
for (const err of !def ? ['Unknown pseudo'] : [ for (const err of !def ? ['Unknown pseudo'] : [

File diff suppressed because it is too large Load Diff

View File

@ -1,35 +0,0 @@
/* global $ */// dom.js
/* global API msg */// msg.js
'use strict';
/**
* This file must be loaded in a <script> tag placed after all the <link> tags
* that contain dark themes so that the stylesheets are loaded by the time this script runs.
* The CSS must use `@media screen and (prefers-color-scheme: dark), dark {}` that also works
* in old browsers and ensures CSS loads before the first paint, then we toggle the media here,
* which also happens before the first paint unless the browser "yields", but that's abnormal
* and not even a problem in the most popular case of using system dark/light mode.
*/
API.colorScheme.isDark().then(isDark => {
const ON = 'screen';
const OFF = 'not all';
const map = {[ON]: true, [OFF]: false};
toggleDarkStyles();
msg.onExtension(e => {
if (e.method === 'colorScheme') {
isDark = e.value;
toggleDarkStyles();
}
});
function toggleDarkStyles() {
$.root.dataset.uiTheme = isDark ? 'dark' : 'light';
for (const sheet of document.styleSheets) {
for (const {media: m} of sheet.cssRules) {
if (m && m[1] === 'dark' && map[m[0]] !== isDark) {
m.mediaText = `${isDark ? ON : OFF},dark`;
}
}
}
}
});

View File

@ -49,7 +49,7 @@
} }
.config-body label:not(:first-child) { .config-body label:not(:first-child) {
border-top: 1px dotted var(--c80); border-top: 1px dotted #ccc;
} }
.config-body .dirty { .config-body .dirty {
@ -67,7 +67,7 @@
.config-body .onoffswitch { .config-body .onoffswitch {
width: var(--onoffswitch-width); width: var(--onoffswitch-width);
margin: 0; margin: 0;
height: var(--input-height); height: 22px;
box-sizing: border-box; box-sizing: border-box;
vertical-align: middle; vertical-align: middle;
} }
@ -112,7 +112,7 @@
} }
.config-number span, .config-range span { .config-number span, .config-range span {
line-height: var(--input-height); line-height: 22px;
} }
.config-body label:not(.nondefault) .config-reset-icon { .config-body label:not(.nondefault) .config-reset-icon {
@ -125,7 +125,7 @@
.config-reset-icon .svg-icon { .config-reset-icon .svg-icon {
cursor: pointer; cursor: pointer;
fill: var(--c65); fill: #aaa;
width: var(--pad); width: var(--pad);
height: var(--pad); height: var(--pad);
padding: 0 1px; padding: 0 1px;
@ -134,7 +134,7 @@
} }
.config-reset-icon:hover .svg-icon { .config-reset-icon:hover .svg-icon {
fill: var(--c40); fill: #666;
} }
#config-autosave-wrapper { #config-autosave-wrapper {
@ -188,7 +188,7 @@
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
border: 1px solid var(--c50); border: 1px solid gray;
cursor: pointer; cursor: pointer;
opacity: 1; opacity: 1;
z-index: 2; z-index: 2;

View File

@ -26,7 +26,7 @@
position: fixed; position: fixed;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background-color: var(--bg); background-color: white;
box-shadow: 5px 5px 50px rgba(0, 0, 0, 0.225); box-shadow: 5px 5px 50px rgba(0, 0, 0, 0.225);
z-index: 9999991; z-index: 9999991;
-moz-user-select: text; -moz-user-select: text;
@ -68,7 +68,7 @@
#message-box-title { #message-box-title {
font-weight: bold; font-weight: bold;
background-color: var(--accent-3); background-color: rgb(145, 208, 198);
padding: .75rem 24px .75rem 52px; padding: .75rem 24px .75rem 52px;
font-size: 1rem; font-size: 1rem;
position: relative; position: relative;
@ -143,7 +143,7 @@
#message-box-buttons { #message-box-buttons {
padding: .75rem .375rem; padding: .75rem .375rem;
background-color: var(--c95); background-color: #f0f0f0;
text-align: center; text-align: center;
} }

Some files were not shown because too many files have changed in this diff Show More