代码拉取完成,页面将自动刷新
// ==UserScript==
// @name patchForBug1565751.uc.js
// @namespace http://space.geocities.yahoo.co.jp/gl/alice0775
// @description Workaround for Selection of Address Bar is collapsed randomly when switching tab
// @include main
// @compatibility Firefox 68+
// @author Alice0775
// @version 2019/07/31 15:00
// ==/UserScript==
var patchForBug1565751 = {
init: function() {
gBrowser.tabContainer.addEventListener("TabSelect", this, false);
},
handleEvent(event) {
switch(event.type) {
case "TabSelect":
setTimeout(() => {this.workaround();}, 0);
break;
}
},
workaround(event) {
if (!gURLBar.focused)
return;
if (!gURLBar.editor.selection.isCollapsed)
return;
if (gURLBar.selectionStart == 0 && (gURLBar.selectionStart == gURLBar.selectionEnd)) {
gURLBar.editor.selectAll();
}
}
}
// We should only start the redirection if the browser window has finished
// starting up. Otherwise, we should wait until the startup is done.
if (gBrowserInit.delayedStartupFinished) {
patchForBug1565751.init();
} else {
let delayedStartupFinished = (subject, topic) => {
if (topic == "browser-delayed-startup-finished" &&
subject == window) {
Services.obs.removeObserver(delayedStartupFinished, topic);
patchForBug1565751.init();
}
};
Services.obs.addObserver(delayedStartupFinished,
"browser-delayed-startup-finished");
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。