Fix links & split out edit.css

This commit is contained in:
Rob Garrison 2017-07-12 13:52:44 -05:00
parent 57ff0b6cb7
commit bb33ff3981
10 changed files with 815 additions and 812 deletions

View File

@ -98,7 +98,7 @@ updateIcon({id: undefined}, {});
// browser commands // browser commands
browserCommands = { browserCommands = {
openManage() { openManage() {
openURL({url: '/manage.html'}); openURL({url: 'manage.html'});
}, },
styleDisableAll(info) { styleDisableAll(info) {
prefs.set('disableAll', info ? info.checked : !prefs.get('disableAll')); prefs.set('disableAll', info ? info.checked : !prefs.get('disableAll'));

977
edit.html
View File

@ -1,792 +1,213 @@
<html id="stylus"> <html id="stylus">
<head> <head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<script src="dom.js"></script> <script src="js/dom.js"></script>
<script src="messaging.js"></script> <script src="background/messaging.js"></script>
<script src="prefs.js"></script> <script src="js/prefs.js"></script>
<script src="localization.js"></script> <script src="js/localization.js"></script>
<script src="apply.js"></script> <script src="content/apply.js"></script>
<script src="edit.js"></script> <link rel="stylesheet" href="edit/edit.css">
<script src="edit/edit.js"></script>
<script src="codemirror/lib/codemirror.js"></script> <script src="vendor/codemirror/lib/codemirror.js"></script>
<link rel="stylesheet" href="codemirror/lib/codemirror.css"> <link rel="stylesheet" href="vendor/codemirror/lib/codemirror.css">
<script src="codemirror/mode/css/css.js"></script> <script src="vendor/codemirror/mode/css/css.js"></script>
<link rel="stylesheet" href="codemirror/addon/dialog/dialog.css"> <link rel="stylesheet" href="vendor/codemirror/addon/dialog/dialog.css">
<link rel="stylesheet" href="codemirror/addon/search/matchesonscrollbar.css"> <link rel="stylesheet" href="vendor/codemirror/addon/search/matchesonscrollbar.css">
<script src="codemirror/addon/scroll/annotatescrollbar.js"></script> <script src="vendor/codemirror/addon/scroll/annotatescrollbar.js"></script>
<script src="codemirror/addon/search/matchesonscrollbar.js"></script> <script src="vendor/codemirror/addon/search/matchesonscrollbar.js"></script>
<script src="codemirror-overwrites/addon/search/match-highlighter.js"></script> <script src="vendor-overwrites/codemirror/addon/search/match-highlighter.js"></script>
<script src="codemirror/addon/dialog/dialog.js"></script> <script src="vendor/codemirror/addon/dialog/dialog.js"></script>
<script src="codemirror/addon/search/searchcursor.js"></script> <script src="vendor/codemirror/addon/search/searchcursor.js"></script>
<script src="codemirror/addon/search/search.js"></script> <script src="vendor/codemirror/addon/search/search.js"></script>
<script src="codemirror/addon/comment/comment.js"></script> <script src="vendor/codemirror/addon/comment/comment.js"></script>
<script src="codemirror/addon/selection/active-line.js"></script> <script src="vendor/codemirror/addon/selection/active-line.js"></script>
<link rel="stylesheet" href="codemirror/addon/fold/foldgutter.css" /> <link rel="stylesheet" href="vendor/codemirror/addon/fold/foldgutter.css" />
<script src="codemirror/addon/fold/foldcode.js"></script> <script src="vendor/codemirror/addon/fold/foldcode.js"></script>
<script src="codemirror/addon/fold/foldgutter.js"></script> <script src="vendor/codemirror/addon/fold/foldgutter.js"></script>
<script src="codemirror/addon/fold/brace-fold.js"></script> <script src="vendor/codemirror/addon/fold/brace-fold.js"></script>
<script src="codemirror/addon/fold/comment-fold.js"></script> <script src="vendor/codemirror/addon/fold/comment-fold.js"></script>
<script src="codemirror/addon/edit/matchbrackets.js"></script> <script src="vendor/codemirror/addon/edit/matchbrackets.js"></script>
<link rel="stylesheet" href="codemirror/addon/lint/lint.css" /> <link rel="stylesheet" href="vendor/codemirror/addon/lint/lint.css" />
<script src="csslint/csslint-worker.js"></script> <script src="vendor/csslint/csslint-worker.js"></script>
<script src="codemirror/addon/lint/lint.js"></script> <script src="vendor/codemirror/addon/lint/lint.js"></script>
<script src="codemirror-overwrites/addon/lint/css-lint.js"></script> <script src="vendor-overwrites/codemirror/addon/lint/css-lint.js"></script>
<link rel="stylesheet" href="codemirror/addon/hint/show-hint.css" /> <link rel="stylesheet" href="vendor/codemirror/addon/hint/show-hint.css" />
<script src="codemirror/addon/hint/show-hint.js"></script> <script src="vendor/codemirror/addon/hint/show-hint.js"></script>
<script src="codemirror/addon/hint/css-hint.js"></script> <script src="vendor/codemirror/addon/hint/css-hint.js"></script>
<script src="codemirror/keymap/sublime.js"></script> <script src="vendor/codemirror/keymap/sublime.js"></script>
<script src="codemirror/keymap/emacs.js"></script> <script src="vendor/codemirror/keymap/emacs.js"></script>
<script src="codemirror/keymap/vim.js"></script> <script src="vendor/codemirror/keymap/vim.js"></script>
<link id="cm-theme" rel="stylesheet">
<style type="text/css"> <template data-id="appliesTo">
<li>
<select name="applies-type" class="applies-type style-contributor">
<option value="url" i18n-text="appliesUrlOption"></option>
<option value="url-prefix" i18n-text="appliesUrlPrefixOption"></option>
<option value="domain" i18n-text="appliesDomainOption"></option>
<option value="regexp" i18n-text="appliesRegexpOption"></option>
</select>
<input name="applies-value" class="applies-value style-contributor">
<button class="remove-applies-to" i18n-text="appliesRemove"></button>
<button class="add-applies-to" i18n-text="appliesAdd"></button>
</li>
</template>
<template data-id="appliesToEverything">
<li class="applies-to-everything" i18n-html="appliesToEverything">
<button class="add-applies-to" i18n-text="appliesSpecify"></button>
</li>
</template>
<template data-id="section">
<div>
<label i18n-text="sectionCode"></label>
<textarea class="code"></textarea>
<br>
<div class="applies-to">
<label i18n-text="appliesLabel">
<svg class="svg-icon info applies-to-help"><use xlink:href="#svg-icon-help"/></svg>
</label>
<ul class="applies-to-list"></ul>
</div>
<button class="remove-section" i18n-text="sectionRemove"></button>
<button class="add-section" i18n-text="sectionAdd"></button>
<button class="beautify-section" i18n-text="styleBeautify"></button>
<button class="test-regexp" i18n-text="styleRegexpTestButton"></button>
</div>
</template>
<template data-id="find">
<span i18n-text="search">: <input type="text" class="CodeMirror-search-field" spellcheck="false">
<span class="CodeMirror-search-hint">(<span i18n-text="searchRegexp"></span>)</span>
</span>
</template>
<template data-id="replace">
<span i18n-text="replace">: <input type="text" class="CodeMirror-search-field" spellcheck="false">
<span class="CodeMirror-search-hint">(<span i18n-text="searchRegexp"></span>)</span>
</span>
</template>
<template data-id="replaceAll">
<span i18n-text="replaceAll">: <input type="text" class="CodeMirror-search-field" spellcheck="false">
<span class="CodeMirror-search-hint">(<span i18n-text="searchRegexp"></span>)</span>
</span>
</template>
<template data-id="replaceWith">
<span i18n-text="replaceWith">: <input type="text" class="CodeMirror-search-field" spellcheck="false">
</span>
</template>
<template data-id="replaceConfirm">
<span i18n-text="replace">?
<button i18n-text="confirmYes"></button>
<button i18n-text="confirmNo"></button>
<button i18n-text="confirmStop"></button>
</span>
</template>
<template data-id="jumpToLine">
<span i18n-text="editGotoLine">: <input class="CodeMirror-jump-field" type="text"></span>
</template>
<template data-id="regexpTestPartial">
<a target="_blank" href="https://github.com/stylish-userstyles/stylish/wiki/Applying-styles-to-specific-sites#advanced-matching-with-regular-expressions"><svg class="svg-icon info"><use xlink:href="#svg-icon-help"/></svg></a>
</template>
<template data-id="resizeGrip">
<div class="resize-grip" i18n-title="cm_resizeGripHint"></div>
</template>
</head>
body { <body id="stylus-edit">
margin: 0; <div id="header">
font: 12px arial,sans-serif; <h1 id="heading">&nbsp;</h1> <!-- nbsp allocates the actual height which prevents page shift -->
} <section id="basic-info">
/************ header ************/ <div id="basic-info-name">
#header { <input id="name" class="style-contributor" i18n-placeholder="styleMissingName" spellcheck="false">
width: 280px; <a id="url" target="_blank"><svg class="svg-icon"><use xlink:href="#svg-icon-external-link"/></svg></a>
height: 100vh; </div>
overflow: auto; <div id="basic-info-enabled">
position: fixed; <input type="checkbox" id="enabled" class="style-contributor">
top: 0; <label for="enabled" id="enabled-label" i18n-text="styleEnabledLabel"></label><!--
padding: 15px; --><svg id="toggle-style-help" class="svg-icon info">
border-right: 1px dashed #AAA; <use xlink:href="#svg-icon-help"/>
-webkit-box-shadow: 0 0 3rem -1.2rem black; </svg>
box-sizing: border-box; </div>
} </section>
#header h1 { <section id="actions">
margin-top: 0; <div>
} <button id="save-button" title="Ctrl-S" i18n-text="styleSaveLabel"></button>
#sections { <button id="beautify" i18n-text="styleBeautify"></button>
padding-left: 280px; <a href="manage.html"><button id="cancel-button" i18n-text="styleCancelEditLabel"></button></a>
} </div>
#sections h2 { <div>
margin-top: 1rem; <h2 id="mozilla-format-heading" i18n-text="styleMozillaFormatHeading"><svg id="to-mozilla-help" class="svg-icon info"><use xlink:href="#svg-icon-help"/></svg></h2>
margin-left: 1.7rem; <button id="from-mozilla" i18n-text="importLabel"></button>
} <button id="to-mozilla" i18n-text="exportLabel"></button>
.aligned { </div>
display: table-row; </section>
} <section id="options">
.aligned > *:not(svg) { <h2 id="options-heading" i18n-text="optionsHeading"></h2>
display: table-cell; <div class="option">
margin-top: 0.1rem; <input id="editor.lineWrapping" type="checkbox">
min-height: 1.4rem; <label id="lineWrapping-label" for="editor.lineWrapping" i18n-text="cm_lineWrapping"></label>
} </div>
input[type="checkbox"] { <div class="option">
margin-left: 0.1rem; <input id="editor.smartIndent" type="checkbox">
} <label id="smartIndent-label" for="editor.smartIndent" i18n-text="cm_smartIndent"></label>
/* basic info */ </div>
#basic-info { <div class="option">
margin-bottom: 1rem; <input id="editor.indentWithTabs" type="checkbox">
} <label id="indentWithTabs-label" for="editor.indentWithTabs" i18n-text="cm_indentWithTabs"></label>
#name { </div>
width: 100%; <div class="option">
} <input id="editor.autocompleteOnTyping" type="checkbox">
#basic-info-name { <label for="editor.autocompleteOnTyping" i18n-text="cm_autocompleteOnTyping"></label>
display: flex; </div>
align-items: center; <div class="option aligned">
} <label id="tabSize-label" for="editor.tabSize" i18n-text="cm_tabSize"></label>
#url { <input id="editor.tabSize" type="number" min="0">
margin-left: 0.25rem; </div>
} <div class="option aligned">
#url:not([href^="http"]) { <label id="keyMap-label" for="editor.keyMap" i18n-text="cm_keyMap"></label>
display: none; <select id="editor.keyMap"></select>
} <svg id="keyMap-help" class="svg-icon info"><use xlink:href="#svg-icon-help"/></svg>
#save-button { </div>
opacity: .5; <div class="option aligned">
pointer-events: none; <label id="theme-label" for="editor.theme" i18n-text="cm_theme"></label>
} <select id="editor.theme"></select>
.dirty #save-button { </div>
opacity: 1; <div class="option aligned">
pointer-events: all; <label id="highlight-label" for="editor.matchHighlight" i18n-text="cm_matchHighlight"></label>
} <select id="editor.matchHighlight">
.svg-icon { <option i18n-text="cm_matchHighlightToken" value="token">
cursor: pointer; <option i18n-text="cm_matchHighlightSelection" value="selection">
vertical-align: middle; <option i18n-text="genericDisabledLabel" value="">
transition: fill .5s; </select>
width: 16px; </div>
height: 16px; </section>
} <section id="lint"><h2 i18n-text="issues">: <span id="issue-count"></span><svg id="lint-help" class="svg-icon info"><use xlink:href="#svg-icon-help"/></svg></h2><div></div></section>
.svg-icon:not(.dismiss) { </div>
margin-left: 0.2rem; <section id="sections">
} <h2><span id="sections-heading" i18n-text="styleSectionsTitle"></span><svg id="sections-help" class="svg-icon info"><use xlink:href="#svg-icon-help"/></svg></h2>
h2 .svg-icon, label .svg-icon { </section>
margin-top: -1px; <div id="help-popup">
} <div class="title"></div><svg id="sections-help" class="svg-icon dismiss"><use xlink:href="#svg-icon-close"/></svg></svg>
.svg-icon.info { <div class="contents"></div>
width: 14px; </div>
height: 16px;
}
.svg-icon:hover,
.svg-icon.info {
fill: #666;
}
.svg-icon,
.svg-icon.info:hover {
fill: #000;
}
#enabled {
margin-left: 0;
vertical-align: middle;
}
#enabled-label {
vertical-align: middle;
}
/* actions */
#actions > * {
margin-right: 0.5rem;
margin-bottom: 0.5rem;
}
/* options */
#options [type="number"] {
max-width: 2.5rem;
text-align: right;
}
#options .option > * {
padding-right: 0.25rem;
}
/************ content ***********/
#sections > div {
margin: 0.7rem;
padding: 1rem;
}
#sections > div:not(:first-of-type) {
border-top: 2px solid black;
}
#sections > div:only-of-type .remove-section {
display: none;
}
#sections > div > button:not(:first-of-type) {
margin-left: 0.2rem;
}
.dirty > label::before {
content: "*";
font-weight: bold;
}
#sections {
counter-reset: codebox;
}
#sections > div > label::after {
counter-increment: codebox;
content: counter(codebox);
margin-left: 0.25rem;
}
/* code */
.CodeMirror-hint:hover {
color: white;
background: #08f;
}
.code {
height: 10rem;
width: 40rem;
}
.CodeMirror {
border: solid #CCC 1px;
}
.CodeMirror-scroll {
height: auto;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 6px; /* resize-grip height */
}
.CodeMirror-lint-mark-warning {
background: none;
}
.CodeMirror-vscrollbar {
margin-bottom: 7px; /* make space for resize-grip */
}
.CodeMirror-hscrollbar {
bottom: 7px; /* make space for resize-grip */
}
.CodeMirror-scrollbar-filler {
bottom: 7px; /* make space for resize-grip */
}
.CodeMirror-dialog {
-webkit-animation: highlight 3s ease-out;
}
.CodeMirror-focused {
outline: -webkit-focus-ring-color auto 5px;
outline-offset: -2px;
}
.CodeMirror-search-field {
width: 10em;
}
.CodeMirror-jump-field {
width: 5em;
}
.CodeMirror-search-hint {
color: #888;
}
body[data-match-highlight="token"] .cm-matchhighlight-approved .cm-matchhighlight,
body[data-match-highlight="token"] .CodeMirror-selection-highlight-scrollbar {
animation: fadein-match-highlighter 1s cubic-bezier(.97,.01,.42,.98);
animation-fill-mode: both;
}
body[data-match-highlight="selection"] .cm-matchhighlight-approved .cm-matchhighlight,
body[data-match-highlight="selection"] .CodeMirror-selection-highlight-scrollbar {
background-color: rgba(1, 151, 193, 0.1);
}
@-webkit-keyframes highlight {
from {
background-color: #ff9;
}
to {
background-color: none;
}
}
@keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fadein-match-highlighter {
from { background-color: transparent; }
to { background-color: rgba(1, 151, 193, 0.1); }
}
.resize-grip {
position: absolute;
display: block;
height: 6px;
content: "";
left: 0;
right: 0;
bottom: 0;
z-index: 9;
cursor: n-resize;
background-color: inherit;
border-top-width: 1px;
border-top-style: solid;
border-top-color: inherit;
}
.resize-grip:after {
content: "";
bottom: 2px;
left: 0;
right: 0;
margin: 0 8px;
display: block;
position: absolute;
border-top-width: 2px;
border-top-style: dotted;
border-top-color: inherit;
}
/* applies-to */
.applies-to {
display: flex;
}
.applies-to label {
flex: auto;
margin-top: 0.2rem;
}
.applies-to ul {
flex: auto;
flex-grow: 99;
margin: 0;
padding: 0;
}
.applies-to li {
display: flex;
list-style-type: none;
align-items: center;
margin-bottom: 0.35rem;
}
.applies-to li > *:not(button) {
flex: auto;
min-height: 1.4rem;
margin-left: 0.35rem;
}
.applies-to li .add-applies-to {
visibility: hidden;
text-align: left;
}
.applies-to li:last-child .add-applies-to {
visibility: visible
}
.applies-to li .add-applies-to:first-child {
margin-left: 1rem;
}
.applies-to li .applies-value {
flex-grow: 99;
padding-left: 0.2rem;
}
.applies-to img {
vertical-align: bottom;
}
.test-regexp {
display: none;
}
.has-regexp .test-regexp {
display: inline-block;
}
.regexp-report summary, .regexp-report div {
cursor: pointer;
outline: none;
}
.regexp-report mark {
background-color: rgba(255, 255, 0, .5);
}
.regexp-report details {
margin-left: 1rem;
}
.regexp-report details:not(:last-child) {
margin-bottom: 1rem;
}
.regexp-report summary {
font-weight: bold;
margin-left: -1rem;
margin-bottom: .5rem;
outline: none;
cursor: default;
}
.regexp-report details[data-type="full"] {
color: darkgreen;
}
.regexp-report details[data-type="partial"] {
color: darkgray;
}
.regexp-report details[data-type="invalid"] {
color: maroon;
}
.regexp-report details details {
margin-left: 2rem;
margin-top: .5rem;
}
.regexp-report .svg-icon {
position: absolute;
margin-top: -1px;
}
.regexp-report details div:hover {
text-decoration: underline;
text-decoration-skip: ink;
}
.regexp-report details div img {
width: 16px;
max-height: 16px;
position: absolute;
margin-left: -20px;
margin-top: -1px;
animation: fadein 1s cubic-bezier(.03, .67, .08, .94);
animation-fill-mode: both;
}
/************ help popup ************/
#help-popup {
top: 3rem;
right: 3rem;
max-width: 50vw;
position: fixed;
display: none;
background-color: white;
box-shadow: 3px 3px 30px rgba(0, 0, 0, 0.5);
padding: 0.5rem;
z-index: 99;
}
#help-popup.big {
max-width: 100%;
left: 3rem;
}
#help-popup.big .CodeMirror {
min-height: 2rem;
height: 70vh;
}
#help-popup .title {
font-weight: bold;
background-color: rgba(0,0,0,0.05);
margin: -0.5rem -0.5rem 0.5rem;
padding: .5rem 32px .5rem .5rem;
}
#help-popup .contents {
max-height: calc(100vh - 8rem);
overflow-y: auto;
}
#help-popup .dismiss {
position: absolute;
right: 4px;
top: .5em;
}
.keymap-list { <svg xmlns="http://www.w3.org/2000/svg" style="display: none">
font-size: 85%; <symbol id="svg-icon-external-link" height="16" width="16" viewBox="0 0 8 8">
line-height: 1.0; <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>
border-spacing: 0; </symbol>
word-break: break-all; <symbol id="svg-icon-help" height="16" width="14" viewBox="0 0 14 16" i18n-alt="helpAlt">
} <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>
.keymap-list input { </symbol>
width: 100%; <symbol id="svg-icon-close" height="16" width="12" viewBox="0 0 12 16">
} <path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"></path>
.keymap-list tr:nth-child(odd) { </symbol>
background-color: rgba(0, 0, 0, 0.07); </svg>
}
.keymap-list td:first-child {
white-space: nowrap;
font-family: monospace;
padding-right: 0.5rem;
}
#help-popup button[name^="import"] { </body>
line-height: 1.5rem;
padding: 0 0.5rem;
margin: 0.5rem 0 0 0.5rem;
pointer-events: none;
opacity: 0.5;
float: right;
}
#help-popup.ready button[name^="import"] {
pointer-events: all;
opacity: 1.0;
}
/************ lint ************/
#lint {
display: none;
}
#lint > div {
overflow-y: auto;
}
#lint table {
font-size: 100%;
border-spacing: 0;
margin-bottom: 1rem;
line-height: 1.0;
}
#lint table:last-child {
margin-bottom: 0;
}
#lint caption {
text-align: left;
font-weight: bold;
}
#lint tbody {
font-size: 85%;
cursor: pointer;
}
#lint tr:hover {
background-color: rgba(0, 0, 0, 0.1);
}
#lint td[role="severity"] {
font-size: 0;
width: 16px;
padding-right: 0.25rem;
}
#lint td[role="line"], #lint td[role="sep"] {
text-align: right;
padding-right: 0;
}
#lint td[role="col"] {
text-align: left;
padding-right: 0.25rem;
}
#lint td[role="message"] {
text-align: left;
}
/************ CSS beautifier ************/
.beautify-options {
white-space: nowrap;
font-family: monospace;
}
.beautify-options div {
float: left;
}
.beautify-options div[newline="true"] + div {
clear: left;
}
.beautify-options div[newline="true"] + div span[indent] {
padding-left: 2rem;
}
.beautify-options:after {
clear: both;
display: block;
content: " ";
height: 1rem;
}
.beautify-options span {
font-weight: bold;
}
.beautify-options select {
border: none;
background-color: rgba(0, 0, 0, 0.05);
}
/************ reponsive layouts ************/
@media(max-width:737px) {
#header {
width: auto;
height: auto;
position: inherit;
border-right: none;
border-bottom: 1px dashed #AAA;
}
#header section:not(:last-child) {
margin-bottom: 0.4rem;
}
#header input[type="checkbox"] {
vertical-align: middle;
}
h2 {
display: none;
}
#basic-info {
display: flex;
align-items: baseline;
}
#basic-info > * {
flex: auto;
}
#basic-info > *:first-child {
flex-grow: 99;
display: flex;
}
#basic-info > *:not(:last-child) {
margin-right: 0.8rem;
}
#basic-info #name {
width: auto;
flex-grow: 99;
}
#actions {
margin-top: 1rem;
}
#actions > * {
display: inline-block;
}
#options {
-webkit-column-count: 2;
}
#options .aligned > *:not(svg) {
margin: 1px 0 0 0; /* workaround the flowing-padding column bug in webkit */
padding-right: 0.4rem;
vertical-align: baseline;
min-height: 1.4rem;
}
.option {
-webkit-column-break-inside: avoid;
}
.option label {
line-height: 1.25rem;
margin: 0;
}
#options [type="number"] {
text-align: left; /* workaround the column flow bug in webkit */
padding-left: 0.2rem;
}
#options #tabSize-label {
position: relative;
top: 0.2rem;
}
#lint h2 {
display: block;
cursor: default;
margin-bottom: 0;
}
#lint > div {
max-height: 0;
}
#lint.collapsed > div {
display: none;
}
#lint:hover > div {
margin-top: 1em;
max-height: 30vh;
}
#sections {
padding-left: 0;
}
#sections > div {
padding: 0;
}
#sections > *:not(h2) {
padding-left: 0.4rem;
}
.applies-type {
width: 30%;
}
}
@media(max-width:500px) {
#options {
-webkit-column-count: 1;
}
#options #tabSize-label {
position: static;
}
}
</style>
<link id="cm-theme" rel="stylesheet">
<template data-id="appliesTo">
<li>
<select name="applies-type" class="applies-type style-contributor">
<option value="url" i18n-text="appliesUrlOption"></option>
<option value="url-prefix" i18n-text="appliesUrlPrefixOption"></option>
<option value="domain" i18n-text="appliesDomainOption"></option>
<option value="regexp" i18n-text="appliesRegexpOption"></option>
</select>
<input name="applies-value" class="applies-value style-contributor">
<button class="remove-applies-to" i18n-text="appliesRemove"></button>
<button class="add-applies-to" i18n-text="appliesAdd"></button>
</li>
</template>
<template data-id="appliesToEverything">
<li class="applies-to-everything" i18n-html="appliesToEverything">
<button class="add-applies-to" i18n-text="appliesSpecify"></button>
</li>
</template>
<template data-id="section">
<div>
<label i18n-text="sectionCode"></label>
<textarea class="code"></textarea>
<br>
<div class="applies-to">
<label i18n-text="appliesLabel">
<svg class="svg-icon info applies-to-help"><use xlink:href="#svg-icon-help"/></svg>
</label>
<ul class="applies-to-list"></ul>
</div>
<button class="remove-section" i18n-text="sectionRemove"></button>
<button class="add-section" i18n-text="sectionAdd"></button>
<button class="beautify-section" i18n-text="styleBeautify"></button>
<button class="test-regexp" i18n-text="styleRegexpTestButton"></button>
</div>
</template>
<template data-id="find">
<span i18n-text="search">: <input type="text" class="CodeMirror-search-field" spellcheck="false">
<span class="CodeMirror-search-hint">(<span i18n-text="searchRegexp"></span>)</span>
</span>
</template>
<template data-id="replace">
<span i18n-text="replace">: <input type="text" class="CodeMirror-search-field" spellcheck="false">
<span class="CodeMirror-search-hint">(<span i18n-text="searchRegexp"></span>)</span>
</span>
</template>
<template data-id="replaceAll">
<span i18n-text="replaceAll">: <input type="text" class="CodeMirror-search-field" spellcheck="false">
<span class="CodeMirror-search-hint">(<span i18n-text="searchRegexp"></span>)</span>
</span>
</template>
<template data-id="replaceWith">
<span i18n-text="replaceWith">: <input type="text" class="CodeMirror-search-field" spellcheck="false">
</span>
</template>
<template data-id="replaceConfirm">
<span i18n-text="replace">?
<button i18n-text="confirmYes"></button>
<button i18n-text="confirmNo"></button>
<button i18n-text="confirmStop"></button>
</span>
</template>
<template data-id="jumpToLine">
<span i18n-text="editGotoLine">: <input class="CodeMirror-jump-field" type="text"></span>
</template>
<template data-id="regexpTestPartial">
<a target="_blank" href="https://github.com/stylish-userstyles/stylish/wiki/Applying-styles-to-specific-sites#advanced-matching-with-regular-expressions"><svg class="svg-icon info"><use xlink:href="#svg-icon-help"/></svg></a>
</template>
<template data-id="resizeGrip">
<div class="resize-grip" i18n-title="cm_resizeGripHint"></div>
</template>
</head>
<body id="stylus-edit">
<div id="header">
<h1 id="heading">&nbsp;</h1> <!-- nbsp allocates the actual height which prevents page shift -->
<section id="basic-info">
<div id="basic-info-name">
<input id="name" class="style-contributor" i18n-placeholder="styleMissingName" spellcheck="false">
<a id="url" target="_blank"><svg class="svg-icon"><use xlink:href="#svg-icon-external-link"/></svg></a>
</div>
<div id="basic-info-enabled">
<input type="checkbox" id="enabled" class="style-contributor">
<label for="enabled" id="enabled-label" i18n-text="styleEnabledLabel"></label><!--
--><svg id="toggle-style-help" class="svg-icon info">
<use xlink:href="#svg-icon-help"/>
</svg>
</div>
</section>
<section id="actions">
<div>
<button id="save-button" title="Ctrl-S" i18n-text="styleSaveLabel"></button>
<button id="beautify" i18n-text="styleBeautify"></button>
<a href="manage.html"><button id="cancel-button" i18n-text="styleCancelEditLabel"></button></a>
</div>
<div>
<h2 id="mozilla-format-heading" i18n-text="styleMozillaFormatHeading"><svg id="to-mozilla-help" class="svg-icon info"><use xlink:href="#svg-icon-help"/></svg></h2>
<button id="from-mozilla" i18n-text="importLabel"></button>
<button id="to-mozilla" i18n-text="exportLabel"></button>
</div>
</section>
<section id="options">
<h2 id="options-heading" i18n-text="optionsHeading"></h2>
<div class="option">
<input id="editor.lineWrapping" type="checkbox">
<label id="lineWrapping-label" for="editor.lineWrapping" i18n-text="cm_lineWrapping"></label>
</div>
<div class="option">
<input id="editor.smartIndent" type="checkbox">
<label id="smartIndent-label" for="editor.smartIndent" i18n-text="cm_smartIndent"></label>
</div>
<div class="option">
<input id="editor.indentWithTabs" type="checkbox">
<label id="indentWithTabs-label" for="editor.indentWithTabs" i18n-text="cm_indentWithTabs"></label>
</div>
<div class="option">
<input id="editor.autocompleteOnTyping" type="checkbox">
<label for="editor.autocompleteOnTyping" i18n-text="cm_autocompleteOnTyping"></label>
</div>
<div class="option aligned">
<label id="tabSize-label" for="editor.tabSize" i18n-text="cm_tabSize"></label>
<input id="editor.tabSize" type="number" min="0">
</div>
<div class="option aligned">
<label id="keyMap-label" for="editor.keyMap" i18n-text="cm_keyMap"></label>
<select id="editor.keyMap"></select>
<svg id="keyMap-help" class="svg-icon info"><use xlink:href="#svg-icon-help"/></svg>
</div>
<div class="option aligned">
<label id="theme-label" for="editor.theme" i18n-text="cm_theme"></label>
<select id="editor.theme"></select>
</div>
<div class="option aligned">
<label id="highlight-label" for="editor.matchHighlight" i18n-text="cm_matchHighlight"></label>
<select id="editor.matchHighlight">
<option i18n-text="cm_matchHighlightToken" value="token">
<option i18n-text="cm_matchHighlightSelection" value="selection">
<option i18n-text="genericDisabledLabel" value="">
</select>
</div>
</section>
<section id="lint"><h2 i18n-text="issues">: <span id="issue-count"></span><svg id="lint-help" class="svg-icon info"><use xlink:href="#svg-icon-help"/></svg></h2><div></div></section>
</div>
<section id="sections">
<h2><span id="sections-heading" i18n-text="styleSectionsTitle"></span><svg id="sections-help" class="svg-icon info"><use xlink:href="#svg-icon-help"/></svg></h2>
</section>
<div id="help-popup">
<div class="title"></div><svg id="sections-help" class="svg-icon dismiss"><use xlink:href="#svg-icon-close"/></svg></svg>
<div class="contents"></div>
</div>
<svg xmlns="http://www.w3.org/2000/svg" style="display: none">
<symbol id="svg-icon-external-link" height="16" width="16" viewBox="0 0 8 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>
</symbol>
<symbol id="svg-icon-help" height="16" width="14" viewBox="0 0 14 16" i18n-alt="helpAlt">
<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>
</symbol>
<symbol id="svg-icon-close" height="16" width="12" viewBox="0 0 12 16">
<path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"></path>
</symbol>
</svg>
</body>
</html> </html>

576
edit/edit.css Normal file
View File

@ -0,0 +1,576 @@
body {
margin: 0;
font: 12px arial,sans-serif;
}
/************ header ************/
#header {
width: 280px;
height: 100vh;
overflow: auto;
position: fixed;
top: 0;
padding: 15px;
border-right: 1px dashed #AAA;
-webkit-box-shadow: 0 0 3rem -1.2rem black;
box-sizing: border-box;
}
#header h1 {
margin-top: 0;
}
#sections {
padding-left: 280px;
}
#sections h2 {
margin-top: 1rem;
margin-left: 1.7rem;
}
.aligned {
display: table-row;
}
.aligned > *:not(svg) {
display: table-cell;
margin-top: 0.1rem;
min-height: 1.4rem;
}
input[type="checkbox"] {
margin-left: 0.1rem;
}
/* basic info */
#basic-info {
margin-bottom: 1rem;
}
#name {
width: 100%;
}
#basic-info-name {
display: flex;
align-items: center;
}
#url {
margin-left: 0.25rem;
}
#url:not([href^="http"]) {
display: none;
}
#save-button {
opacity: .5;
pointer-events: none;
}
.dirty #save-button {
opacity: 1;
pointer-events: all;
}
.svg-icon {
cursor: pointer;
vertical-align: middle;
transition: fill .5s;
width: 16px;
height: 16px;
}
.svg-icon:not(.dismiss) {
margin-left: 0.2rem;
}
h2 .svg-icon, label .svg-icon {
margin-top: -1px;
}
.svg-icon.info {
width: 14px;
height: 16px;
}
.svg-icon:hover,
.svg-icon.info {
fill: #666;
}
.svg-icon,
.svg-icon.info:hover {
fill: #000;
}
#enabled {
margin-left: 0;
vertical-align: middle;
}
#enabled-label {
vertical-align: middle;
}
/* actions */
#actions > * {
margin-right: 0.5rem;
margin-bottom: 0.5rem;
}
/* options */
#options [type="number"] {
max-width: 2.5rem;
text-align: right;
}
#options .option > * {
padding-right: 0.25rem;
}
/************ content ***********/
#sections > div {
margin: 0.7rem;
padding: 1rem;
}
#sections > div:not(:first-of-type) {
border-top: 2px solid black;
}
#sections > div:only-of-type .remove-section {
display: none;
}
#sections > div > button:not(:first-of-type) {
margin-left: 0.2rem;
}
.dirty > label::before {
content: "*";
font-weight: bold;
}
#sections {
counter-reset: codebox;
}
#sections > div > label::after {
counter-increment: codebox;
content: counter(codebox);
margin-left: 0.25rem;
}
/* code */
.CodeMirror-hint:hover {
color: white;
background: #08f;
}
.code {
height: 10rem;
width: 40rem;
}
.CodeMirror {
border: solid #CCC 1px;
}
.CodeMirror-scroll {
height: auto;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 6px; /* resize-grip height */
}
.CodeMirror-lint-mark-warning {
background: none;
}
.CodeMirror-vscrollbar {
margin-bottom: 7px; /* make space for resize-grip */
}
.CodeMirror-hscrollbar {
bottom: 7px; /* make space for resize-grip */
}
.CodeMirror-scrollbar-filler {
bottom: 7px; /* make space for resize-grip */
}
.CodeMirror-dialog {
-webkit-animation: highlight 3s ease-out;
}
.CodeMirror-focused {
outline: -webkit-focus-ring-color auto 5px;
outline-offset: -2px;
}
.CodeMirror-search-field {
width: 10em;
}
.CodeMirror-jump-field {
width: 5em;
}
.CodeMirror-search-hint {
color: #888;
}
body[data-match-highlight="token"] .cm-matchhighlight-approved .cm-matchhighlight,
body[data-match-highlight="token"] .CodeMirror-selection-highlight-scrollbar {
animation: fadein-match-highlighter 1s cubic-bezier(.97,.01,.42,.98);
animation-fill-mode: both;
}
body[data-match-highlight="selection"] .cm-matchhighlight-approved .cm-matchhighlight,
body[data-match-highlight="selection"] .CodeMirror-selection-highlight-scrollbar {
background-color: rgba(1, 151, 193, 0.1);
}
@-webkit-keyframes highlight {
from {
background-color: #ff9;
}
to {
background-color: none;
}
}
@keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fadein-match-highlighter {
from { background-color: transparent; }
to { background-color: rgba(1, 151, 193, 0.1); }
}
.resize-grip {
position: absolute;
display: block;
height: 6px;
content: "";
left: 0;
right: 0;
bottom: 0;
z-index: 9;
cursor: n-resize;
background-color: inherit;
border-top-width: 1px;
border-top-style: solid;
border-top-color: inherit;
}
.resize-grip:after {
content: "";
bottom: 2px;
left: 0;
right: 0;
margin: 0 8px;
display: block;
position: absolute;
border-top-width: 2px;
border-top-style: dotted;
border-top-color: inherit;
}
/* applies-to */
.applies-to {
display: flex;
}
.applies-to label {
flex: auto;
margin-top: 0.2rem;
}
.applies-to ul {
flex: auto;
flex-grow: 99;
margin: 0;
padding: 0;
}
.applies-to li {
display: flex;
list-style-type: none;
align-items: center;
margin-bottom: 0.35rem;
}
.applies-to li > *:not(button) {
flex: auto;
min-height: 1.4rem;
margin-left: 0.35rem;
}
.applies-to li .add-applies-to {
visibility: hidden;
text-align: left;
}
.applies-to li:last-child .add-applies-to {
visibility: visible
}
.applies-to li .add-applies-to:first-child {
margin-left: 1rem;
}
.applies-to li .applies-value {
flex-grow: 99;
padding-left: 0.2rem;
}
.applies-to img {
vertical-align: bottom;
}
.test-regexp {
display: none;
}
.has-regexp .test-regexp {
display: inline-block;
}
.regexp-report summary, .regexp-report div {
cursor: pointer;
outline: none;
}
.regexp-report mark {
background-color: rgba(255, 255, 0, .5);
}
.regexp-report details {
margin-left: 1rem;
}
.regexp-report details:not(:last-child) {
margin-bottom: 1rem;
}
.regexp-report summary {
font-weight: bold;
margin-left: -1rem;
margin-bottom: .5rem;
outline: none;
cursor: default;
}
.regexp-report details[data-type="full"] {
color: darkgreen;
}
.regexp-report details[data-type="partial"] {
color: darkgray;
}
.regexp-report details[data-type="invalid"] {
color: maroon;
}
.regexp-report details details {
margin-left: 2rem;
margin-top: .5rem;
}
.regexp-report .svg-icon {
position: absolute;
margin-top: -1px;
}
.regexp-report details div:hover {
text-decoration: underline;
text-decoration-skip: ink;
}
.regexp-report details div img {
width: 16px;
max-height: 16px;
position: absolute;
margin-left: -20px;
margin-top: -1px;
animation: fadein 1s cubic-bezier(.03, .67, .08, .94);
animation-fill-mode: both;
}
/************ help popup ************/
#help-popup {
top: 3rem;
right: 3rem;
max-width: 50vw;
position: fixed;
display: none;
background-color: white;
box-shadow: 3px 3px 30px rgba(0, 0, 0, 0.5);
padding: 0.5rem;
z-index: 99;
}
#help-popup.big {
max-width: 100%;
left: 3rem;
}
#help-popup.big .CodeMirror {
min-height: 2rem;
height: 70vh;
}
#help-popup .title {
font-weight: bold;
background-color: rgba(0,0,0,0.05);
margin: -0.5rem -0.5rem 0.5rem;
padding: .5rem 32px .5rem .5rem;
}
#help-popup .contents {
max-height: calc(100vh - 8rem);
overflow-y: auto;
}
#help-popup .dismiss {
position: absolute;
right: 4px;
top: .5em;
}
.keymap-list {
font-size: 85%;
line-height: 1.0;
border-spacing: 0;
word-break: break-all;
}
.keymap-list input {
width: 100%;
}
.keymap-list tr:nth-child(odd) {
background-color: rgba(0, 0, 0, 0.07);
}
.keymap-list td:first-child {
white-space: nowrap;
font-family: monospace;
padding-right: 0.5rem;
}
#help-popup button[name^="import"] {
line-height: 1.5rem;
padding: 0 0.5rem;
margin: 0.5rem 0 0 0.5rem;
pointer-events: none;
opacity: 0.5;
float: right;
}
#help-popup.ready button[name^="import"] {
pointer-events: all;
opacity: 1.0;
}
/************ lint ************/
#lint {
display: none;
}
#lint > div {
overflow-y: auto;
}
#lint table {
font-size: 100%;
border-spacing: 0;
margin-bottom: 1rem;
line-height: 1.0;
}
#lint table:last-child {
margin-bottom: 0;
}
#lint caption {
text-align: left;
font-weight: bold;
}
#lint tbody {
font-size: 85%;
cursor: pointer;
}
#lint tr:hover {
background-color: rgba(0, 0, 0, 0.1);
}
#lint td[role="severity"] {
font-size: 0;
width: 16px;
padding-right: 0.25rem;
}
#lint td[role="line"], #lint td[role="sep"] {
text-align: right;
padding-right: 0;
}
#lint td[role="col"] {
text-align: left;
padding-right: 0.25rem;
}
#lint td[role="message"] {
text-align: left;
}
/************ CSS beautifier ************/
.beautify-options {
white-space: nowrap;
font-family: monospace;
}
.beautify-options div {
float: left;
}
.beautify-options div[newline="true"] + div {
clear: left;
}
.beautify-options div[newline="true"] + div span[indent] {
padding-left: 2rem;
}
.beautify-options:after {
clear: both;
display: block;
content: " ";
height: 1rem;
}
.beautify-options span {
font-weight: bold;
}
.beautify-options select {
border: none;
background-color: rgba(0, 0, 0, 0.05);
}
/************ reponsive layouts ************/
@media(max-width:737px) {
#header {
width: auto;
height: auto;
position: inherit;
border-right: none;
border-bottom: 1px dashed #AAA;
}
#header section:not(:last-child) {
margin-bottom: 0.4rem;
}
#header input[type="checkbox"] {
vertical-align: middle;
}
h2 {
display: none;
}
#basic-info {
display: flex;
align-items: baseline;
}
#basic-info > * {
flex: auto;
}
#basic-info > *:first-child {
flex-grow: 99;
display: flex;
}
#basic-info > *:not(:last-child) {
margin-right: 0.8rem;
}
#basic-info #name {
width: auto;
flex-grow: 99;
}
#actions {
margin-top: 1rem;
}
#actions > * {
display: inline-block;
}
#options {
-webkit-column-count: 2;
}
#options .aligned > *:not(svg) {
margin: 1px 0 0 0; /* workaround the flowing-padding column bug in webkit */
padding-right: 0.4rem;
vertical-align: baseline;
min-height: 1.4rem;
}
.option {
-webkit-column-break-inside: avoid;
}
.option label {
line-height: 1.25rem;
margin: 0;
}
#options [type="number"] {
text-align: left; /* workaround the column flow bug in webkit */
padding-left: 0.2rem;
}
#options #tabSize-label {
position: relative;
top: 0.2rem;
}
#lint h2 {
display: block;
cursor: default;
margin-bottom: 0;
}
#lint > div {
max-height: 0;
}
#lint.collapsed > div {
display: none;
}
#lint:hover > div {
margin-top: 1em;
max-height: 30vh;
}
#sections {
padding-left: 0;
}
#sections > div {
padding: 0;
}
#sections > *:not(h2) {
padding-left: 0.4rem;
}
.applies-type {
width: 30%;
}
}
@media(max-width:500px) {
#options {
-webkit-column-count: 1;
}
#options #tabSize-label {
position: static;
}
}

View File

@ -42,7 +42,7 @@ new MutationObserver((mutations, observer) => {
const themeElement = document.getElementById("cm-theme"); const themeElement = document.getElementById("cm-theme");
if (themeElement) { if (themeElement) {
themeElement.href = prefs.get("editor.theme") == "default" ? "" themeElement.href = prefs.get("editor.theme") == "default" ? ""
: "codemirror/theme/" + prefs.get("editor.theme") + ".css"; : "vendor/codemirror/theme/" + prefs.get("editor.theme") + ".css";
observer.disconnect(); observer.disconnect();
} }
}).observe(document, {subtree: true, childList: true}); }).observe(document, {subtree: true, childList: true});
@ -305,7 +305,7 @@ function acmeEventListener(event) {
el.selectedIndex = 0; el.selectedIndex = 0;
break; break;
} }
var url = chrome.runtime.getURL("codemirror/theme/" + value + ".css"); var url = chrome.runtime.getURL("vendor/codemirror/theme/" + value + ".css");
if (themeLink.href == url) { // preloaded in initCodeMirror() if (themeLink.href == url) { // preloaded in initCodeMirror()
break; break;
} }
@ -1116,7 +1116,7 @@ function beautify(event) {
doBeautify(); doBeautify();
} else { } else {
var script = document.head.appendChild(document.createElement("script")); var script = document.head.appendChild(document.createElement("script"));
script.src = "beautify/beautify-css-mod.js"; script.src = "vendor-overwrites/beautify/beautify-css-mod.js";
script.onload = doBeautify; script.onload = doBeautify;
} }
function doBeautify() { function doBeautify() {
@ -2019,7 +2019,7 @@ function getCodeMirrorThemes() {
} }
return new Promise(resolve => { return new Promise(resolve => {
chrome.runtime.getPackageDirectoryEntry(rootDir => { chrome.runtime.getPackageDirectoryEntry(rootDir => {
rootDir.getDirectory('codemirror/theme', {create: false}, themeDir => { rootDir.getDirectory('vendor/codemirror/theme', {create: false}, themeDir => {
themeDir.createReader().readEntries(entries => { themeDir.createReader().readEntries(entries => {
const themes = [ const themes = [
chrome.i18n.getMessage('defaultTheme') chrome.i18n.getMessage('defaultTheme')

View File

@ -2,12 +2,12 @@
<html id="stylus"> <html id="stylus">
<head> <head>
<title i18n-text-append="optionsHeading">Stylus </title> <title i18n-text-append="optionsHeading">Stylus </title>
<link rel="stylesheet" href="index.css"> <link rel="stylesheet" href="options/index.css">
<script src="/dom.js"></script> <script src="js/dom.js"></script>
<script src="/messaging.js"></script> <script src="background/messaging.js"></script>
<script src="/localization.js"></script> <script src="js/localization.js"></script>
<script src="/prefs.js"></script> <script src="js/prefs.js"></script>
<script src="/apply.js"></script> <script src="content/apply.js"></script>
</head> </head>
<body> <body>
@ -128,6 +128,6 @@
</ol> </ol>
</div> </div>
<script src="index.js"></script> <script src="options/index.js"></script>
</body> </body>
</html> </html>

View File

@ -3,7 +3,7 @@
<head> <head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title i18n-text="manageTitle"></title> <title i18n-text="manageTitle"></title>
<link rel="stylesheet" href="manage.css"> <link rel="stylesheet" href="manage/manage.css">
<link rel="stylesheet" href="msgbox/msgbox.css"> <link rel="stylesheet" href="msgbox/msgbox.css">
<style id="style-overrides"></style> <style id="style-overrides"></style>
@ -121,12 +121,12 @@
</details> </details>
</template> </template>
<script src="dom.js"></script> <script src="js/dom.js"></script>
<script src="messaging.js"></script> <script src="background/messaging.js"></script>
<script src="prefs.js"></script> <script src="js/prefs.js"></script>
<script src="apply.js"></script> <script src="content/apply.js"></script>
<script src="localization.js"></script> <script src="js/localization.js"></script>
<script src="manage.js"></script> <script src="manage/manage.js"></script>
</head> </head>
<body id="stylus-manage" i18n-dragndrop-hint="dragDropMessage"> <body id="stylus-manage" i18n-dragndrop-hint="dragDropMessage">
@ -216,7 +216,7 @@
</div> </div>
<div id="installed"></div> <div id="installed"></div>
<script src="backup/fileSaveLoad.js"></script> <script src="manage/fileSaveLoad.js"></script>
<script src="msgbox/msgbox.js"></script> <script src="msgbox/msgbox.js"></script>
</body> </body>

View File

@ -19,7 +19,13 @@
"<all_urls>" "<all_urls>"
], ],
"background": { "background": {
"scripts": ["messaging.js", "storage.js", "prefs.js", "background.js", "update.js"] "scripts": [
"background/messaging.js",
"background/storage.js",
"js/prefs.js",
"background/background.js",
"background/update.js"
]
}, },
"commands": { "commands": {
"openManage": { "openManage": {
@ -35,13 +41,13 @@
"run_at": "document_start", "run_at": "document_start",
"all_frames": true, "all_frames": true,
"match_about_blank": true, "match_about_blank": true,
"js": ["apply.js"] "js": ["content/apply.js"]
}, },
{ {
"matches": ["http://userstyles.org/*", "https://userstyles.org/*"], "matches": ["http://userstyles.org/*", "https://userstyles.org/*"],
"run_at": "document_start", "run_at": "document_start",
"all_frames": false, "all_frames": false,
"js": ["install.js"] "js": ["content/install.js"]
} }
], ],
"browser_action": { "browser_action": {
@ -56,7 +62,7 @@
}, },
"default_locale": "en", "default_locale": "en",
"options_ui": { "options_ui": {
"page": "options/index.html", "page": "index.html",
"chrome_style": true "chrome_style": true
} }
} }

View File

@ -15,7 +15,7 @@ document.onclick = e => {
switch (target.dataset.cmd) { switch (target.dataset.cmd) {
case 'open-manage': case 'open-manage':
openURL({url: '/manage.html'}); openURL({url: 'manage.html'});
break; break;
case 'check-updates': case 'check-updates':

View File

@ -2,7 +2,7 @@
<head> <head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<link rel="stylesheet" href="popup.css"> <link rel="stylesheet" href="popup/popup.css">
<!-- Notes: <!-- Notes:
* Chrome doesn't garbage-collect (or even leaks) SVG <symbol> referenced via <use> so we'll embed the code directly * Chrome doesn't garbage-collect (or even leaks) SVG <symbol> referenced via <use> so we'll embed the code directly
@ -55,12 +55,12 @@
</div> </div>
</template> </template>
<script src="dom.js"></script> <script src="js/dom.js"></script>
<script src="messaging.js"></script> <script src="background/messaging.js"></script>
<script src="localization.js"></script> <script src="js/localization.js"></script>
<script src="prefs.js"></script> <script src="js/prefs.js"></script>
<script src="apply.js"></script> <script src="content/apply.js"></script>
<script src="popup.js"></script> <script src="popup/popup.js"></script>
</head> </head>
<body id="stylus-popup"> <body id="stylus-popup">

View File

@ -2,7 +2,7 @@
import io, os, json, re import io, os, json, re
from collections import OrderedDict from collections import OrderedDict
with io.open('_locales/en/messages.json', 'r', encoding='utf-8') as f: with io.open('/_locales/en/messages.json', 'r', encoding='utf-8') as f:
items = json.load(f).items() items = json.load(f).items()
english = [(k, v['message']) for k, v in items if 'message' in v] english = [(k, v['message']) for k, v in items if 'message' in v]
english_placeholders = [(k, v['placeholders']) for k,v in items english_placeholders = [(k, v['placeholders']) for k,v in items
@ -14,7 +14,7 @@ for locale_name in os.listdir('_locales'):
if not re.match(r'^\w{2}(_\w{2,3})?$', locale_name): if not re.match(r'^\w{2}(_\w{2,3})?$', locale_name):
print('Skipped %s: not a locale dir' % locale_name) print('Skipped %s: not a locale dir' % locale_name)
continue continue
loc_path = '_locales/' + locale_name + '/messages.json' loc_path = '/_locales/' + locale_name + '/messages.json'
with io.open(loc_path, 'r+', encoding='utf-8') as f: with io.open(loc_path, 'r+', encoding='utf-8') as f:
loc = json.load(f, object_pairs_hook=OrderedDict) loc = json.load(f, object_pairs_hook=OrderedDict)