Editor: remember size/pos only for detached windows
This commit is contained in:
parent
0e391f928f
commit
374244fceb
7
edit.js
7
edit.js
|
@ -3,6 +3,7 @@
|
||||||
var styleId = null;
|
var styleId = null;
|
||||||
var dirty = false;
|
var dirty = false;
|
||||||
var lockScroll; // ensure the section doesn't jump when clicking selected text
|
var lockScroll; // ensure the section doesn't jump when clicking selected text
|
||||||
|
var isSeparateWindow;
|
||||||
|
|
||||||
var appliesToTemplate = document.createElement("li");
|
var appliesToTemplate = document.createElement("li");
|
||||||
appliesToTemplate.innerHTML = '<select name="applies-type" class="applies-type"><option value="url">' + t("appliesUrlOption") + '</option><option value="url-prefix">' + t("appliesUrlPrefixOption") + '</option><option value="domain">' + t("appliesDomainOption") + '</option><option value="regexp">' + t("appliesRegexpOption") + '</option></select><input name="applies-value" class="applies-value"><button class="remove-applies-to">' + t("appliesRemove") + '</button><button class="add-applies-to">' + t("appliesAdd") + '</button>';
|
appliesToTemplate.innerHTML = '<select name="applies-type" class="applies-type"><option value="url">' + t("appliesUrlOption") + '</option><option value="url-prefix">' + t("appliesUrlPrefixOption") + '</option><option value="domain">' + t("appliesDomainOption") + '</option><option value="regexp">' + t("appliesRegexpOption") + '</option></select><input name="applies-value" class="applies-value"><button class="remove-applies-to">' + t("appliesRemove") + '</button><button class="add-applies-to">' + t("appliesAdd") + '</button>';
|
||||||
|
@ -218,13 +219,19 @@ document.addEventListener("keydown", function(e) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
chrome.tabs.query({currentWindow: true}, function(tabs) {
|
||||||
|
isSeparateWindow = tabs.length == 1;
|
||||||
|
});
|
||||||
|
|
||||||
window.onbeforeunload = function() {
|
window.onbeforeunload = function() {
|
||||||
|
if (isSeparateWindow) {
|
||||||
prefs.setPref('windowPosition', {
|
prefs.setPref('windowPosition', {
|
||||||
left: screenLeft,
|
left: screenLeft,
|
||||||
top: screenTop,
|
top: screenTop,
|
||||||
width: outerWidth,
|
width: outerWidth,
|
||||||
height: outerHeight
|
height: outerHeight
|
||||||
});
|
});
|
||||||
|
}
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
return !isCleanGlobal() ? t('styleChangesNotSaved') : null;
|
return !isCleanGlobal() ? t('styleChangesNotSaved') : null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user