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