#1 follow up
This commit is contained in:
parent
12859b96be
commit
5623bca182
30
manage.html
30
manage.html
|
@ -135,6 +135,20 @@
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#import ul {
|
||||||
|
margin-left: 0;
|
||||||
|
padding-left: 0;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
#import li {
|
||||||
|
margin-bottom: .5em;
|
||||||
|
}
|
||||||
|
#import pre {
|
||||||
|
background:#eee;
|
||||||
|
overflow: auto;
|
||||||
|
margin: 0 0 .5em 0;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<template data-id="style">
|
<template data-id="style">
|
||||||
|
@ -186,11 +200,11 @@
|
||||||
<div><input id="show-badge" type="checkbox"><label id="show-badge-label" for="show-badge" i18n-text="prefShowBadge"></label></div>
|
<div><input id="show-badge" type="checkbox"><label id="show-badge-label" for="show-badge" i18n-text="prefShowBadge"></label></div>
|
||||||
<div><input id="popup.stylesFirst" type="checkbox"><label id="stylesFirst-label" for="popup.stylesFirst" i18n-text="popupStylesFirst"></label></div>
|
<div><input id="popup.stylesFirst" type="checkbox"><label id="stylesFirst-label" for="popup.stylesFirst" i18n-text="popupStylesFirst"></label></div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div id="import">
|
||||||
<h2>Export Styles from Stylish extension</h2>
|
<h2>Stylish Migration</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Copy this script to the clipboard</li>
|
<li>1. Copy this script to the clipboard</li>
|
||||||
<pre style='color:#000000;background:#eee; overflow: auto;'>chrome.extension.getBackgroundPage().getStyles({}, e => {
|
<pre contenteditable="true">chrome.extension.getBackgroundPage().getStyles({}, e => {
|
||||||
<span style='color:#7f0055; font-weight:bold; '>let</span> styles = JSON.stringify(e);
|
<span style='color:#7f0055; font-weight:bold; '>let</span> styles = JSON.stringify(e);
|
||||||
<span style='color:#7f0055; font-weight:bold; '>let</span> <span style='color:#7f0055; font-weight:bold; '>link</span> = document.createElement(<span style='color:#2a00ff; '>'</span><span style='color:#2a00ff; '>a</span><span style='color:#2a00ff; '>'</span>);
|
<span style='color:#7f0055; font-weight:bold; '>let</span> <span style='color:#7f0055; font-weight:bold; '>link</span> = document.createElement(<span style='color:#2a00ff; '>'</span><span style='color:#2a00ff; '>a</span><span style='color:#2a00ff; '>'</span>);
|
||||||
<span style='color:#7f0055; font-weight:bold; '>let</span> data = <span style='color:#7f0055; font-weight:bold; '>new</span> Blob([styles], {type: <span style='color:#2a00ff; '>'</span><span style='color:#2a00ff; '>text/plain;charset=utf-8;</span><span style='color:#2a00ff; '>'</span>});
|
<span style='color:#7f0055; font-weight:bold; '>let</span> data = <span style='color:#7f0055; font-weight:bold; '>new</span> Blob([styles], {type: <span style='color:#2a00ff; '>'</span><span style='color:#2a00ff; '>text/plain;charset=utf-8;</span><span style='color:#2a00ff; '>'</span>});
|
||||||
|
@ -201,14 +215,14 @@
|
||||||
document.body.removeChild(<span style='color:#7f0055; font-weight:bold; '>link</span>);
|
document.body.removeChild(<span style='color:#7f0055; font-weight:bold; '>link</span>);
|
||||||
});
|
});
|
||||||
</pre>
|
</pre>
|
||||||
<li>Right-Click the Stylish toolbar button and select "Inspect Popup"</li>
|
<li>2. Right-Click the Stylish toolbar button and select "Inspect Popup"</li>
|
||||||
<li>Paste the script in the console tab and press Enter key</li>
|
<li>3. Paste the script in the console tab and press Enter key</li>
|
||||||
<li>Use the import button to import "styles.json" file</li>
|
<li>4. Use the import button to import "styles.json" file</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h2>Import Styles</h2>
|
<h2>Import Styles</h2>
|
||||||
<input id="import" type="file">
|
<input type="file">
|
||||||
</div>
|
</div>
|
||||||
<p id="manage-text" i18n-html="manageText"></p>
|
<p id="manage-text" i18n-html="manageText"></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -492,6 +492,10 @@ function importStyles (e) {
|
||||||
reader.readAsText(file)
|
reader.readAsText(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function selectAll () {
|
||||||
|
document.execCommand('selectAll');
|
||||||
|
}
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
installed = document.getElementById("installed");
|
installed = document.getElementById("installed");
|
||||||
if (document.stylishStyles) {
|
if (document.stylishStyles) {
|
||||||
|
@ -504,7 +508,8 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||||
document.getElementById("search").addEventListener("input", searchStyles);
|
document.getElementById("search").addEventListener("input", searchStyles);
|
||||||
searchStyles(true); // re-apply filtering on history Back
|
searchStyles(true); // re-apply filtering on history Back
|
||||||
|
|
||||||
document.getElementById('import').addEventListener('change', importStyles);
|
document.querySelector('input[type=file]').addEventListener('change', importStyles);
|
||||||
|
document.querySelector('#import pre').addEventListener('click', selectAll);
|
||||||
|
|
||||||
setupLivePrefs([
|
setupLivePrefs([
|
||||||
"manage.onlyEnabled",
|
"manage.onlyEnabled",
|
||||||
|
|
|
@ -4,11 +4,6 @@
|
||||||
"description": "__MSG_description__",
|
"description": "__MSG_description__",
|
||||||
"homepage_url": "https://userstyles.org",
|
"homepage_url": "https://userstyles.org",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"applications": {
|
|
||||||
"gecko": {
|
|
||||||
"id": "{46551EC9-40F0-4e47-8E18-8E5CF550CFB8}"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"icons": {
|
"icons": {
|
||||||
"16": "16.png",
|
"16": "16.png",
|
||||||
"48": "48.png",
|
"48": "48.png",
|
||||||
|
|
|
@ -97,7 +97,6 @@ function saveStyle(o, callback) {
|
||||||
var os = tx.objectStore("styles");
|
var os = tx.objectStore("styles");
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
console.error(o)
|
|
||||||
if (o.id) {
|
if (o.id) {
|
||||||
var request = os.get(Number(o.id));
|
var request = os.get(Number(o.id));
|
||||||
request.onsuccess = function(event) {
|
request.onsuccess = function(event) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user