Merge pull request #83 from tophf/narrow-editor

Editor: webkit bug workaround; better alignment
This commit is contained in:
Jason Barnabe 2015-03-24 23:07:00 -05:00
commit 0b2a86337d
19 changed files with 108 additions and 165 deletions

View File

@ -178,10 +178,6 @@
"message":"أدخل اسمًا.", "message":"أدخل اسمًا.",
"description":"Error displayed when user saves without providing a name" "description":"Error displayed when user saves without providing a name"
}, },
"styleNameLabel":{
"message":"الاسم",
"description":"Label for the name of styles"
},
"styleSaveLabel":{ "styleSaveLabel":{
"message":"حفظ", "message":"حفظ",
"description":"Label for save button for style editing" "description":"Label for save button for style editing"

View File

@ -186,10 +186,6 @@
"message":"Zadejte název.", "message":"Zadejte název.",
"description":"Error displayed when user saves without providing a name" "description":"Error displayed when user saves without providing a name"
}, },
"styleNameLabel":{
"message":"Název",
"description":"Label for the name of styles"
},
"styleSaveLabel":{ "styleSaveLabel":{
"message":"Uložit", "message":"Uložit",
"description":"Label for save button for style editing" "description":"Label for save button for style editing"

View File

@ -112,10 +112,6 @@
"message":"Εισάγετε ένα όνομα.", "message":"Εισάγετε ένα όνομα.",
"description":"Error displayed when user saves without providing a name" "description":"Error displayed when user saves without providing a name"
}, },
"styleNameLabel":{
"message":"Όνομα",
"description":"Label for the name of styles"
},
"styleSaveLabel":{ "styleSaveLabel":{
"message":"Αποθήκευση", "message":"Αποθήκευση",
"description":"Label for save button for style editing" "description":"Label for save button for style editing"

View File

@ -242,10 +242,6 @@
"message": "Enter a name.", "message": "Enter a name.",
"description": "Error displayed when user saves without providing a name" "description": "Error displayed when user saves without providing a name"
}, },
"styleNameLabel": {
"message": "Name",
"description": "Label for the name of styles"
},
"styleSaveLabel": { "styleSaveLabel": {
"message": "Save", "message": "Save",
"description": "Label for save button for style editing" "description": "Label for save button for style editing"

View File

@ -174,10 +174,6 @@
"message":"Introduce un nombre.", "message":"Introduce un nombre.",
"description":"Error displayed when user saves without providing a name" "description":"Error displayed when user saves without providing a name"
}, },
"styleNameLabel":{
"message":"Nombre",
"description":"Label for the name of styles"
},
"styleSaveLabel":{ "styleSaveLabel":{
"message":"Guardar", "message":"Guardar",
"description":"Label for save button for style editing" "description":"Label for save button for style editing"

View File

@ -186,10 +186,6 @@
"message":"Syötä nimi.", "message":"Syötä nimi.",
"description":"Error displayed when user saves without providing a name" "description":"Error displayed when user saves without providing a name"
}, },
"styleNameLabel":{
"message":"Nimi",
"description":"Label for the name of styles"
},
"styleSaveLabel":{ "styleSaveLabel":{
"message":"Tallenna", "message":"Tallenna",
"description":"Label for save button for style editing" "description":"Label for save button for style editing"

View File

@ -170,10 +170,6 @@
"message":"Veuillez saisir un nom.", "message":"Veuillez saisir un nom.",
"description":"Error displayed when user saves without providing a name" "description":"Error displayed when user saves without providing a name"
}, },
"styleNameLabel":{
"message":"Nom",
"description":"Label for the name of styles"
},
"styleSaveLabel":{ "styleSaveLabel":{
"message":"Enregistrer", "message":"Enregistrer",
"description":"Label for save button for style editing" "description":"Label for save button for style editing"

View File

@ -174,10 +174,6 @@
"message":"Inserisci un nome.", "message":"Inserisci un nome.",
"description":"Error displayed when user saves without providing a name" "description":"Error displayed when user saves without providing a name"
}, },
"styleNameLabel":{
"message":"Nome",
"description":"Label for the name of styles"
},
"styleSaveLabel":{ "styleSaveLabel":{
"message":"Salva", "message":"Salva",
"description":"Label for save button for style editing" "description":"Label for save button for style editing"

View File

@ -186,10 +186,6 @@
"message":"名前を入力してください。", "message":"名前を入力してください。",
"description":"Error displayed when user saves without providing a name" "description":"Error displayed when user saves without providing a name"
}, },
"styleNameLabel":{
"message":"名前",
"description":"Label for the name of styles"
},
"styleSaveLabel":{ "styleSaveLabel":{
"message":"保存", "message":"保存",
"description":"Label for save button for style editing" "description":"Label for save button for style editing"

View File

@ -174,10 +174,6 @@
"message":"Insira um nome.", "message":"Insira um nome.",
"description":"Error displayed when user saves without providing a name" "description":"Error displayed when user saves without providing a name"
}, },
"styleNameLabel":{
"message":"Nome",
"description":"Label for the name of styles"
},
"styleSaveLabel":{ "styleSaveLabel":{
"message":"Salvar", "message":"Salvar",
"description":"Label for save button for style editing" "description":"Label for save button for style editing"

View File

@ -174,10 +174,6 @@
"message":"Введите название.", "message":"Введите название.",
"description":"Error displayed when user saves without providing a name" "description":"Error displayed when user saves without providing a name"
}, },
"styleNameLabel":{
"message":"Название",
"description":"Label for the name of styles"
},
"styleSaveLabel":{ "styleSaveLabel":{
"message":"Сохранить", "message":"Сохранить",
"description":"Label for save button for style editing" "description":"Label for save button for style editing"

View File

@ -186,10 +186,6 @@
"message":"Ange namn.", "message":"Ange namn.",
"description":"Error displayed when user saves without providing a name" "description":"Error displayed when user saves without providing a name"
}, },
"styleNameLabel":{
"message":"Namn",
"description":"Label for the name of styles"
},
"styleSaveLabel":{ "styleSaveLabel":{
"message":"Spara", "message":"Spara",
"description":"Label for save button for style editing" "description":"Label for save button for style editing"

View File

@ -60,10 +60,6 @@
"message":"స్టైలిష్", "message":"స్టైలిష్",
"description":"Title for the manage page" "description":"Title for the manage page"
}, },
"styleNameLabel":{
"message":"పేరు",
"description":"Label for the name of styles"
},
"styleSaveLabel":{ "styleSaveLabel":{
"message":"భద్రపరచు", "message":"భద్రపరచు",
"description":"Label for save button for style editing" "description":"Label for save button for style editing"

View File

@ -174,10 +174,6 @@
"message":"Bir ad girin.", "message":"Bir ad girin.",
"description":"Error displayed when user saves without providing a name" "description":"Error displayed when user saves without providing a name"
}, },
"styleNameLabel":{
"message":"Ad",
"description":"Label for the name of styles"
},
"styleSaveLabel":{ "styleSaveLabel":{
"message":"Kaydet", "message":"Kaydet",
"description":"Label for save button for style editing" "description":"Label for save button for style editing"

View File

@ -140,9 +140,6 @@
"styleMissingName": { "styleMissingName": {
"message": "请输入名称." "message": "请输入名称."
}, },
"styleNameLabel": {
"message": "名称"
},
"styleSaveLabel": { "styleSaveLabel": {
"message": "保存" "message": "保存"
}, },

View File

@ -227,10 +227,6 @@
"message": "修改", "message": "修改",
"description": "Label for the button to go to the edit style page" "description": "Label for the button to go to the edit style page"
}, },
"styleNameLabel": {
"message": "名称",
"description": "Label for the name of styles"
},
"description": { "description": {
"message": "Stylish 是一款用户样式管理器,可让您调整网页的样式。它可让您轻松地为 Google、Facebook、YouTube、Orkut 和其他许多网站安装主题背景和皮肤。", "message": "Stylish 是一款用户样式管理器,可让您调整网页的样式。它可让您轻松地为 Google、Facebook、YouTube、Orkut 和其他许多网站安装主题背景和皮肤。",
"description": "Extension description" "description": "Extension description"

View File

@ -178,10 +178,6 @@
"message":"请输入名称.", "message":"请输入名称.",
"description":"Error displayed when user saves without providing a name" "description":"Error displayed when user saves without providing a name"
}, },
"styleNameLabel":{
"message":"名称",
"description":"Label for the name of styles"
},
"styleSaveLabel":{ "styleSaveLabel":{
"message":"保存", "message":"保存",
"description":"Label for save button for style editing" "description":"Label for save button for style editing"

204
edit.html
View File

@ -35,57 +35,93 @@
body { body {
margin: 0; margin: 0;
font: 12px arial,sans-serif; font: 9pt arial,sans-serif;
} }
/************ header ************/
#header { #header {
height: 100%; height: 100%;
width: 250px; width: 15rem;
position: fixed; position: fixed;
top: 0; top: 0;
padding: 15px; padding: 0.95rem;
border-right: 1px dashed #AAA; border-right: 1px dashed #AAA;
-webkit-box-shadow: 0 0 50px -18px black; -webkit-box-shadow: 0 0 3rem -1.2rem black;
} }
#header h1 { #header h1 {
margin-top: 0; margin-top: 0;
} }
#sections { #sections {
padding-left: 290px; padding-left: 18rem;
} }
#sections h2 { #sections h2 {
margin-top: 8px; margin-top: 0.5rem;
} }
.aligned {
display: table-row;
}
.aligned > * {
display: table-cell;
margin-top: 0.1rem;
min-height: 1.4rem;
}
input[type="checkbox"] {
margin-left: 0.1rem;
}
/* basic info */
#basic-info { #basic-info {
margin-bottom: 12px; margin-bottom: 1rem;
} }
#name { #name {
width: 185px; width: 100%;
} }
#enabled {
margin-left: 0;
vertical-align: middle;
}
#enabled-label {
vertical-align: middle;
}
/* actions */
#actions > * {
margin-right: 0.5rem;
margin-bottom: 0.5rem;
display: block;
}
#actions img {
margin-left: 0.2rem;
position: relative;
top: 0.2rem;
}
/* options */
#options [type="number"] {
max-width: 2.5rem;
text-align: right;
}
#options .option > * {
padding-right: 0.25rem;
}
/************ content ***********/
#sections > div { #sections > div {
margin: 10px; margin: 0.7rem;
padding: 0 15px; padding: 1rem;
} }
#sections > div:not(:first-of-type) { #sections > div:not(:first-of-type) {
border-top: 2px solid black; border-top: 2px solid black;
} }
#sections > div:only-of-type .remove-section {
display: none;
}
#sections > div .add-section {
margin-left: 0.4rem;
}
.dirty > label::before { .dirty > label::before {
content: "*"; content: "*";
font-weight: bold; font-weight: bold;
} }
#basic-info label { /* code */
display: inline-block;
width: 10em;
vertical-align: top;
}
#header label {
width: 60px;
}
#options .aligned {
display: table-row;
}
.code { .code {
height: 10em; height: 10rem;
width: 40em; width: 40rem;
} }
.CodeMirror { .CodeMirror {
border: solid #CCC 1px; border: solid #CCC 1px;
@ -93,12 +129,16 @@
.CodeMirror-focused { .CodeMirror-focused {
border-color: black; border-color: black;
} }
.CodeMirror-lint-mark-warning {
background: none;
}
/* applies-to */
.applies-to { .applies-to {
display: flex; display: flex;
} }
.applies-to label { .applies-to label {
flex: auto; flex: auto;
margin-top: 0.25em; margin-top: 0.2rem;
} }
.applies-to ul { .applies-to ul {
flex: auto; flex: auto;
@ -110,12 +150,12 @@
display: flex; display: flex;
list-style-type: none; list-style-type: none;
align-items: center; align-items: center;
margin-bottom: 0.4em; margin-bottom: 0.35rem;
} }
.applies-to li > *:not(button) { .applies-to li > *:not(button) {
flex: auto; flex: auto;
min-height: 1.7em; min-height: 1.4rem;
margin-left: 0.4em; margin-left: 0.35rem;
} }
.applies-to li .add-applies-to { .applies-to li .add-applies-to {
visibility: hidden; visibility: hidden;
@ -125,53 +165,27 @@
visibility: visible visibility: visible
} }
.applies-to li .add-applies-to:first-child { .applies-to li .add-applies-to:first-child {
margin-left: 1em; margin-left: 1rem;
} }
.applies-to li .applies-value { .applies-to li .applies-value {
flex-grow: 99; flex-grow: 99;
padding-left: 0.5ex; padding-left: 0.2rem;
}
body > section > *:not(h2) {
padding-left: 15px;
}
#sections > div {
padding-top: 1em;
padding-bottom: 1em;
}
#sections > div:only-of-type .remove-section {
display: none;
}
#sections > div .add-section {
margin-left: 0.4em;
} }
.applies-to img { .applies-to img {
vertical-align: bottom; vertical-align: bottom;
} }
.CodeMirror-lint-mark-warning {
background: none;
}
@media(min-width: 738px) {
#options .aligned > * {
display: table-cell;
margin: 0.5ex 0 0 0;
}
}
/************ reponsive layouts ************/
@media(max-width:737px) { @media(max-width:737px) {
#header { #header {
width: auto;
height: auto; height: auto;
position: inherit; position: inherit;
width: auto;
border-right: none; border-right: none;
border-bottom: 1px dashed #AAA;
} }
#header section { #header section:not(:last-child) {
margin-bottom: 0.5em; margin-bottom: 0.4rem;
}
#header label {
width: auto;
vertical-align: baseline;
margin-right: .5em;
} }
#header input[type="checkbox"] { #header input[type="checkbox"] {
vertical-align: middle; vertical-align: middle;
@ -181,9 +195,7 @@
} }
#basic-info { #basic-info {
display: flex; display: flex;
} align-items: baseline;
#basic-info > div:not(:last-child) {
margin-right: 1em;
} }
#basic-info > * { #basic-info > * {
flex: auto; flex: auto;
@ -192,60 +204,53 @@
flex-grow: 99; flex-grow: 99;
display: flex; display: flex;
} }
#basic-info > *:not(:last-child) {
margin-right: 0.8rem;
}
#basic-info #name { #basic-info #name {
width: auto; width: auto;
flex-grow: 99; flex-grow: 99;
} }
#basic-info #name-label {
line-height: 20px;
}
#actions { #actions {
padding: 1em 0; margin-top: 1rem;
} }
#actions br { #actions > * {
display: none; display: inline-block;
}
#actions img {
position: relative;
top: .2em;
margin-left: .2em;
}
#actions > * + button, #actions a {
margin-left: 1em;
} }
#options { #options {
-webkit-column-count: 2; -webkit-column-count: 2;
} }
#options .aligned > * {
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 { .option {
-webkit-column-break-inside: avoid; -webkit-column-break-inside: avoid;
} }
.option label { .option label {
line-height: 20px; line-height: 1.25rem;
margin: 0; 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;
}
#sections { #sections {
padding-left: 0; padding-left: 0;
} }
#sections > div { #sections > div {
padding: 0; padding: 0;
} }
#sections-heading { #sections > *:not(h2) {
padding-left: 8px; padding-left: 0.4rem;
}
body > section > *:not(h2) {
padding-left: 8px;
} }
} }
/* editor options */
[type="number"] {
max-width: 2.8em;
text-align: right;
}
table, input, select {
font-size: inherit;
}
table td:first-child {min-width: 60px}
</style> </style>
<script src="storage.js"></script> <script src="storage.js"></script>
<script src="messaging.js"></script> <script src="messaging.js"></script>
@ -256,13 +261,18 @@
<div id="header"> <div id="header">
<h1 id="heading"></h1> <h1 id="heading"></h1>
<section id="basic-info"> <section id="basic-info">
<div><label for="name" id="name-label"></label><input id="name" class="style-contributor"></div> <div id="basic-info-name">
<div><label for="enabled" id="enabled-label"></label><input type="checkbox" id="enabled" class="style-contributor"></div> <input id="name" class="style-contributor">
</div>
<div id="basic-info-enabled">
<input type="checkbox" id="enabled" class="style-contributor">
<label for="enabled" id="enabled-label"></label>
</div>
</section> </section>
<section id="actions"> <section id="actions">
<button id="to-mozilla"></button><img id="to-mozilla-help" src="help.png"><br><br> <div><button id="to-mozilla"></button><img id="to-mozilla-help" src="help.png"></div>
<button id="save-button" title="Ctrl-S"></button>
<a href="manage.html"><button id="cancel-button"></button></a> <a href="manage.html"><button id="cancel-button"></button></a>
<button id="save-button" title="Ctrl-S"></button>
</section> </section>
<section id="options"> <section id="options">
<h2 id="options-heading"></h2> <h2 id="options-heading"></h2>

View File

@ -671,7 +671,7 @@ chrome.extension.onMessage.addListener(function(request, sender, sendResponse) {
} }
}); });
tE("name-label", "styleNameLabel"); tE("name", "styleMissingName", "placeholder");
tE("enabled-label", "styleEnabledLabel"); tE("enabled-label", "styleEnabledLabel");
tE("to-mozilla", "styleToMozillaFormat"); tE("to-mozilla", "styleToMozillaFormat");
tE("save-button", "styleSaveLabel"); tE("save-button", "styleSaveLabel");