Merge branch 'issues/43#issuecomment-286142529'
This commit is contained in:
commit
eec08b04c3
|
@ -227,6 +227,7 @@ body>div:not(#installed) {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
#confirm {
|
#confirm {
|
||||||
|
z-index: 2147483647;
|
||||||
display: none; /* flex */
|
display: none; /* flex */
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
|
23
popup.html
23
popup.html
|
@ -37,6 +37,18 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body id="stylus-popup">
|
<body id="stylus-popup">
|
||||||
|
<!-- confirm -->
|
||||||
|
<div id="confirm">
|
||||||
|
<div>
|
||||||
|
<b>Style's Name</b>
|
||||||
|
<span i18n-text="deleteStyleConfirm"></span>
|
||||||
|
<div>
|
||||||
|
<input type="button" i18n-value="confirmCancel" data-cmd="cancel">
|
||||||
|
<input type="button" i18n-value="confirmOK" data-cmd="ok">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="unavailable">
|
<div id="unavailable">
|
||||||
<div class="main-controls"><span id="unavailable-message" i18n-text="stylishUnavailableForURL"></span>
|
<div class="main-controls"><span id="unavailable-message" i18n-text="stylishUnavailableForURL"></span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -67,17 +79,6 @@
|
||||||
<button id="popup-shortcuts-button" i18n-text="openShortcutsPopup"></button>
|
<button id="popup-shortcuts-button" i18n-text="openShortcutsPopup"></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- confirm -->
|
|
||||||
<div id="confirm">
|
|
||||||
<div>
|
|
||||||
<b>Style's Name</b>
|
|
||||||
<span i18n-text="deleteStyleConfirm"></span>
|
|
||||||
<div>
|
|
||||||
<input type="button" i18n-value="confirmCancel" data-cmd="cancel">
|
|
||||||
<input type="button" i18n-value="confirmOK" data-cmd="ok">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script src="popup.js"></script>
|
<script src="popup.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
11
popup.js
11
popup.js
|
@ -82,6 +82,9 @@ function showStyles(styles) {
|
||||||
styles.map(createStyleElement).forEach(function(e) {
|
styles.map(createStyleElement).forEach(function(e) {
|
||||||
installed.appendChild(e);
|
installed.appendChild(e);
|
||||||
});
|
});
|
||||||
|
// force Chrome to resize the popup
|
||||||
|
document.body.style.height = '10px';
|
||||||
|
document.documentElement.style.height = '10px';
|
||||||
}
|
}
|
||||||
|
|
||||||
function createStyleElement(style) {
|
function createStyleElement(style) {
|
||||||
|
@ -126,8 +129,12 @@ function doDelete() {
|
||||||
document.getElementById('confirm').addEventListener('click', e => {
|
document.getElementById('confirm').addEventListener('click', e => {
|
||||||
let cmd = e.target.dataset.cmd;
|
let cmd = e.target.dataset.cmd;
|
||||||
if (cmd === 'ok') {
|
if (cmd === 'ok') {
|
||||||
deleteStyle(document.getElementById('confirm').dataset.id);
|
deleteStyle(document.getElementById('confirm').dataset.id, () => {
|
||||||
window.close();
|
// update view with 'No styles installed for this site' message
|
||||||
|
if (document.getElementById('installed').children.length === 0) {
|
||||||
|
showStyles([]);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
|
|
|
@ -164,7 +164,7 @@ function enableStyle(id, enabled) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteStyle(id) {
|
function deleteStyle(id, callback = function (){}) {
|
||||||
getDatabase(function(db) {
|
getDatabase(function(db) {
|
||||||
var tx = db.transaction(["styles"], "readwrite");
|
var tx = db.transaction(["styles"], "readwrite");
|
||||||
var os = tx.objectStore("styles");
|
var os = tx.objectStore("styles");
|
||||||
|
@ -173,6 +173,7 @@ function deleteStyle(id) {
|
||||||
handleDelete(id);
|
handleDelete(id);
|
||||||
invalidateCache(true);
|
invalidateCache(true);
|
||||||
notifyAllTabs({method: "styleDeleted", id: id});
|
notifyAllTabs({method: "styleDeleted", id: id});
|
||||||
|
callback();
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user