>Форум Mozilla Россия http://forum.mozilla-russia.org/index.php >Сustom Buttons http://forum.mozilla-russia.org/viewforum.php?id=34 >[CB]Custom Buttons Editor: Toggle on Top http://forum.mozilla-russia.org/viewtopic.php?id=56040 |
Infocatcher > 17-08-2012 23:45:23 |
Custom Buttons Editor: Toggle on Top 0.1.11 (2015-06-04)
Установить: Выделить код Код:custombutton://%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0D%0A%3Ccustombutton%20xmlns%3Acb%3D%22http%3A//xsms.nm.ru/custombuttons/%22%3E%0A%20%20%3Cname%3ECustom%20Buttons%20Editor%3A%20Toggle%20on%20Top%3C/name%3E%0A%20%20%3Cimage%3E%3C%21%5BCDATA%5Bdata%3Aimage/png%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAMAAAAMCGV4AAABm1BMVEXlAQEAAACVAAABAQGWAADlAQG9AABfAACbAADlAQGZAAAmAAC/AAAAAADgAQGVAAC8AAC5AQEAAACcAAAAAAAAAACWAAAAAACpAADeAQHjAQHfAQHiAQG/AAD6e3vrSkqaAAC4AQGcAADbAQH/jIy9AAC7AAClAACZAADkAQG4AAC2AADlAQGuBgaXAABcAABaAACvAADAJCSdAADRAQHbDQ3lAQHiAQEAAADQAQHbQ0OXAADHAQEBAQEBAQEDAwNUAgKiAADrUlKVAADjAQECAgICAgKnp6cEBAQEBARUAgKgAACdAACVAAADAwNMTEwEBAQCAgIoAAB0AACYAABwAACpAAAEBAQCAgIAAAAAAAAAAAAAAAAAAADX19cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADsXV3/nJzVQ0PkWlrrVFT/oaH8c3PpbW3PNjbaSEjZT0/cQkL5gID0bm7jTEzROTn8k5Pxd3f7kZHoWVnvVlb/qanhT0/cVFTuVVX/jY27u7v/qKjZTU0f8fwIAAAAbHRSTlMAAAAAAKsAAAA8AAAAGQBIAAANAA8ezAXEr61dPczu00dCybD8SMzGywBIzKTHSABgzN9rALaBAGc/9Ka4A1V7acz9xI0AQctmEQBIzMwtnkwDAEjMmcyJTzEuKiYi9xUQDAgaFxYUEgsJBwNZ8TUYAAAA20lEQVR4XkXHZXMCMRgA4TfJKXBA6eHuFKm7u7u7ew+n7t6f3cAw7c7shwdKVdFF1tFYUVl2CwD77W/7sxbA9vnQ6f23aL15e7d4KJrZ+KBdZJNK6u7FBBqN8zXgcjcllXTYZ9IBxwVD2dzto5KO6FQYU+ujsafny6tEtaponudrauvyhfv6BkFgMBBCDK1fyz/X7R0Mw6ipu7q3e3r7Mv0DGKsRkKHhkdGx8YnJjylKBGh6ZnYOofmFxSVKBMaV1bX1jc0to7Szu7dvBlk6kA6Pjk9kw+nZufniF9r0KCW1uStmAAAAAElFTkSuQmCC%5D%5D%3E%3C/image%3E%0A%20%20%3Cmode%3E0%3C/mode%3E%0A%20%20%3Cinitcode%3E%3C%21%5BCDATA%5B//%20https%3A//forum.mozilla-russia.org/viewtopic.php%3Fid%3D56040%0A//%20http%3A//infocatcher.ucoz.net/js/cb/cbEditorToggleOnTop.js%0A//%20https%3A//github.com/Infocatcher/Custom_Buttons/tree/master/CB_Editor_Toggle_on_Top%0A%0A//%20Custom%20Buttons%20Editor%3A%20Toggle%20on%20Top%20button%20for%20Custom%20Buttons%0A//%20%28code%20for%20%22initialization%22%20section%29%0A%0A//%20%28c%29%20Infocatcher%202012-2015%0A//%20version%200.1.11%20-%202015-06-04%0A%0A//%20Hotkey%3A%20Ctrl+T%0A%0Aconst%20watcherId%20%3D%20%22customButtonsToggleOnTop_%22%20+%20this.id%3B%0Avar%20%7BComponents%7D%20%3D%20window%3B%20//%20Prevent%20garbage%20collection%20in%20Firefox%203.6%20and%20older%0Avar%20storage%20%3D%20%28function%28%29%20%7B%0A%09if%28%21%28%22Services%22%20in%20window%29%29%20//%20Firefox%203.6%20and%20older%0A%09%09return%20Application.storage%3B%0A%09//%20Simple%20replacement%20for%20Application.storage%0A%09//%20See%20https%3A//bugzilla.mozilla.org/show_bug.cgi%3Fid%3D1090880%0A%09//var%20global%20%3D%20Components.utils.getGlobalForObject%28Services%29%3B%0A%09//%20Ensure%2C%20that%20we%20have%20global%20object%20%28because%20window.Services%20may%20be%20overwriten%29%0A%09var%20global%20%3D%20Components.utils.import%28%22resource%3A//gre/modules/Services.jsm%22%2C%20%7B%7D%29%3B%0A%09var%20ns%20%3D%20%22_cbEditorToggleOnTopStorage%22%3B%0A%09var%20storage%20%3D%20global%5Bns%5D%20%7C%7C%20%28global%5Bns%5D%20%3D%20global.Object.create%28null%29%29%3B%0A%09return%20%7B%0A%09%09get%3A%20function%28key%2C%20defaultVal%29%20%7B%0A%09%09%09if%28key%20in%20storage%29%0A%09%09%09%09return%20storage%5Bkey%5D%3B%0A%09%09%09return%20defaultVal%3B%0A%09%09%7D%2C%0A%09%09set%3A%20function%28key%2C%20val%29%20%7B%0A%09%09%09if%28key%20%3D%3D%3D%20null%29%0A%09%09%09%09delete%20storage%5Bkey%5D%3B%0A%09%09%09else%0A%09%09%09%09storage%5Bkey%5D%20%3D%20val%3B%0A%09%09%7D%0A%09%7D%3B%0A%7D%29%28%29%3B%0Avar%20watcher%20%3D%20storage.get%28watcherId%2C%20null%29%3B%0Aif%28%21watcher%29%20%7B%0A%09watcher%20%3D%20%7B%0A%09%09btnPos%3A%200%2C%20//%200%20-%20at%20top%20right%20window%20corner%2C%201%20-%20at%20end%20of%20tabs%2C%202%20-%20before%20dialog%20buttons%20spacer%0A%09%09btnStyle%3A%20%22button%22%2C%20//%20%22button%22%20or%20%22toolbarbutton%22%0A%09%09btnChecked%3A%20true%2C%20//%20use%20%22checked%22%20style%3A%20true%20or%20false%0A%0A%09%09//%20Fogue%20icons%2C%20http%3A//p.yusukekamiyamane.com/%0A%09%09//%20http%3A//www.iconfinder.com/icondetails/12276/16/gps_location_pin_icon%0A%09%09icon%3A%20%22data%3Aimage/png%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3AgNBjAx4SevkwAAAjxJREFUKM+FUk1oE0EU/mZnRU0U6cFLIT1KKkkNpIcSWwUvVty2l142hZpDoQcPgYQKQkUEz6V6sHgR/KGQQwleQg/xEKRRsIEmga4NoZa2oRGKpJaWmp2Z52UX12Dxg4838+D73ps3jzUYQycIgDc7l0oNAkgqpZ4n5uc/NgHsEEHDKZB/X5OJRGJcSplemJ6+6SZPFStvJ0Ta4eEhTNMcE0I8fDsxcQsAdPwHc6nUoBRCOz4+Rr1eR39//+18Pn/h/cjIGea+eS6VegLgKoBfRPRdKbXGOf8GIBmPx8cty0Kz2YTf74ff70cmkynpNSIAwP7+/t2ZmZnowcGBPDo6+rm1tdWo1Wo7pmnesSwLtm2jWCx+EkJwKSUnoln2wWnv9eTkMBE9TafT0b29PbTbbXDO0Wq1YNs2lpaWVpVSj8ZyuWXhaPg953CtXK6v9fVtr6ys9A4NDXU3Gg24JoVC4fPJycnjsVxu2TtMzgCUAVQAUKVSrwDtzc3NQCQS6d7d3XU7EK1W62twY+ML84i1N4zB5TvgYrVaPTs1NRXNZDKlrq4u+Hw+BAKBy1LK6zYA2xE+6/gqzhgbXl9fnw+FQrPBYPCHlBKjo6NRIjpPRD3kEdbcJWGMgTF2Y3Fx8UE4HE4yxl70WtYCEc1ms9kS51wDcM4r/FOS87BhGK90XTc0TeNuPgggFosNG4axOjAw8PJKxwIxAD26rt9XShWVUtvOWosO2h1RAJAMwCUAPseInGG6UTlm6l/8DZ+nFuAjSdH0AAAAAElFTkSuQmCC%22%2C%0A%09%09iconPinned%3A%20%22data%3Aimage/png%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3AgNBjIpwH1VRwAAAgdJREFUKM+FkkFoU0EQhr/dtxFSquLBS8CAICISQci1oBWLKaaINL300psXDxH0ItSD4L21UKgUxV4aWnKyiIGaQwio2IQ0PQQpBaEhoaEk0dSQNsnb9WAepg+LPwz/7DD/7O7MiJIQuGEAV3QIiNowV4f0HlA0BskJsI8fo75YLHIEjw3ccIInivVxX1IqcXFu7l4Lnhq4BaD4P4Y6INsHB+zlcpwfH7+zG48PavCIvj8/B64CRxoqXdg8Bd+BqG9xMVJNpaiUy5zxehkcGCC2uppV28Y44rs3V1aCFIt2p15v/MzlSj/S6eKlmZnRairFoW2zmUx+boHVBsvAtEj+fV5Iw4vbS0tBe2uLw04H2+ulUy5zaNu8X17OdOGZgkTX3TADCRumP0xNZY3fz6/9fSr5PNVGg6/x+BfdE/Y3wxJAHtj6wzt5aHsSiQv+4WFfbWcHu9VCeDzdRq32DdgQfZMQom9JjDGngcn19fWF2shI9vrYWNBqNjFCND8mk+8MTDq5s65RWUKIUKFQmA0EAtP3pawdra0xGokE0dqrwe8kvgS2e1cjpURKORyLxTaUUg+UUuciUvIWQq8hU5uYMPOQmQcuu7fAsqxr4XD4jVIqLKW0nPgV4AmEFiDzCF65hQLwK6Ueaq0/aa13e2vddVnHxV3AFsBZYKBXyPSa6bDuFdP/st/BfOD54p3eIQAAAABJRU5ErkJggg%3D%3D%22%2C%0A%0A%09%09boxId%3A%20%22cbToggleOnTopBox%22%2C%0A%09%09btnId%3A%20%22cbToggleOnTopButton%22%2C%0A%09%09onTopAttr%3A%20%22cbOnTop%22%2C%0A%09%09naAttr%3A%20%22cbOnTopNA%22%2C%0A%09%09styleId%3A%20%22cbToggleOnTopStyle%22%2C%0A%09%09get%20btnTip%28%29%20%7B%0A%09%09%09var%20locale%20%3D%20%28function%28%29%20%7B%0A%09%09%09%09var%20prefs%20%3D%20%22Services%22%20in%20window%20%26%26%20Services.prefs%0A%09%09%09%09%09%7C%7C%20Components.classes%5B%22@mozilla.org/preferences-service%3B1%22%5D%0A%09%09%09%09%09%09.getService%28Components.interfaces.nsIPrefBranch%29%3B%0A%09%09%09%09if%28%21prefs.getBoolPref%28%22intl.locale.matchOS%22%29%29%20%7B%0A%09%09%09%09%09var%20locale%20%3D%20prefs.getCharPref%28%22general.useragent.locale%22%29%3B%0A%09%09%09%09%09if%28locale.substr%280%2C%209%29%20%21%3D%20%22chrome%3A//%22%29%0A%09%09%09%09%09%09return%20locale%3B%0A%09%09%09%09%7D%0A%09%09%09%09return%20Components.classes%5B%22@mozilla.org/chrome/chrome-registry%3B1%22%5D%0A%09%09%09%09%09.getService%28Components.interfaces.nsIXULChromeRegistry%29%0A%09%09%09%09%09.getSelectedLocale%28%22global%22%29%3B%0A%09%09%09%7D%29%28%29.match%28/%5E%5Ba-z%5D*/%29%5B0%5D%3B%0A%09%09%09if%28locale%20%3D%3D%20%22ru%22%29%0A%09%09%09%09return%20%22%u041F%u043E%u0432%u0435%u0440%u0445%20%u0432%u0441%u0435%u0445%20%u043E%u043A%u043E%u043D%20%28Ctrl+T%29%22%3B%0A%09%09%09return%20%22Always%20on%20top%20%28Ctrl+T%29%22%3B%0A%09%09%7D%2C%0A%0A%09%09REASON_STARTUP%3A%201%2C%0A%09%09REASON_SHUTDOWN%3A%202%2C%0A%09%09REASON_WINDOW_LOADED%3A%203%2C%0A%09%09REASON_WINDOW_CLOSED%3A%204%2C%0A%0A%09%09get%20obs%28%29%20%7B%0A%09%09%09delete%20this.obs%3B%0A%09%09%09return%20this.obs%20%3D%20Components.classes%5B%22@mozilla.org/observer-service%3B1%22%5D%0A%09%09%09%09.getService%28Components.interfaces.nsIObserverService%29%3B%0A%09%09%7D%2C%0A%09%09get%20ww%28%29%20%7B%0A%09%09%09delete%20this.ww%3B%0A%09%09%09return%20this.ww%20%3D%20Components.classes%5B%22@mozilla.org/embedcomp/window-watcher%3B1%22%5D%0A%09%09%09%09.getService%28Components.interfaces.nsIWindowWatcher%29%3B%0A%09%09%7D%2C%0A%09%09get%20wm%28%29%20%7B%0A%09%09%09delete%20this.wm%3B%0A%09%09%09return%20this.wm%20%3D%20Components.classes%5B%22@mozilla.org/appshell/window-mediator%3B1%22%5D%0A%09%09%09%09.getService%28Components.interfaces.nsIWindowMediator%29%3B%0A%09%09%7D%2C%0A%09%09init%3A%20function%28reason%29%20%7B%0A%09%09%09this.obs.addObserver%28this%2C%20%22quit-application-granted%22%2C%20false%29%3B%0A%09%09%09var%20ws%20%3D%20this.wm.getEnumerator%28null%29%3B%0A%09%09%09while%28ws.hasMoreElements%28%29%29%0A%09%09%09%09this.initWindow%28ws.getNext%28%29%2C%20reason%29%3B%0A%09%09%09this.ww.registerNotification%28this%29%3B%0A%09%09%7D%2C%0A%09%09destroy%3A%20function%28reason%29%20%7B%0A%09%09%09this.obs.removeObserver%28this%2C%20%22quit-application-granted%22%29%3B%0A%09%09%09var%20ws%20%3D%20this.wm.getEnumerator%28null%29%3B%0A%09%09%09while%28ws.hasMoreElements%28%29%29%0A%09%09%09%09this.destroyWindow%28ws.getNext%28%29%2C%20reason%29%3B%0A%09%09%09this.ww.unregisterNotification%28this%29%3B%0A%09%09%7D%2C%0A%09%09initWindow%3A%20function%28window%2C%20reason%29%20%7B%0A%09%09%09if%28%21this.isTargetWindow%28window%29%29%0A%09%09%09%09return%3B%0A%09%09%09window.addEventListener%28%22keypress%22%2C%20this%2C%20true%29%3B%0A%09%09%09if%28this.hasSizeModeChangeEvent%29%0A%09%09%09%09window.addEventListener%28%22sizemodechange%22%2C%20this%2C%20false%29%3B%0A%09%09%09else%20%7B%0A%09%09%09%09window.addEventListener%28%22resize%22%2C%20this%2C%20false%29%3B%20//%20Can%20detect%20only%20maximize/restore%0A%09%09%09%09this.legacySizeModeChange%28window%29%3B%0A%09%09%09%7D%0A%0A%09%09%09var%20document%20%3D%20window.document%3B%0A%09%09%09this.removeStyle%28document%29%3B%0A%09%09%09this.addStyle%28document%29%3B%0A%09%09%09var%20box%20%3D%20document.getElementById%28this.boxId%29%3B%0A%09%09%09box%20%26%26%20box.parentNode.removeChild%28box%29%3B%0A%09%09%09box%20%3D%20document.createElement%28%22hbox%22%29%3B%0A%09%09%09box.id%20%3D%20this.boxId%3B%0A%09%09%09var%20btn%20%3D%20document.createElement%28this.btnStyle%29%3B%0A%09%09%09btn.id%20%3D%20this.btnId%3B%0A%09%09%09if%28this.btnChecked%29%20%7B%0A%09%09%09%09btn.setAttribute%28%22type%22%2C%20%22checkbox%22%29%3B%0A%09%09%09%09btn.setAttribute%28%22autoCheck%22%2C%20%22false%22%29%3B%0A%09%09%09%7D%0A%09%09%09btn.tooltipText%20%3D%20this.btnTip%3B%0A%09%09%09btn.addEventListener%28%22command%22%2C%20this%2C%20false%29%3B%0A%09%09%09box.appendChild%28btn%29%3B%0A%09%09%09switch%28this.btnPos%29%20%7B%0A%09%09%09%09default%3A%0A%09%09%09%09%09box.setAttribute%28%22cbOnTopFloat%22%2C%20%22true%22%29%3B%0A%09%09%09%09%09document.documentElement.appendChild%28box%29%3B%0A%09%09%09%09break%3B%0A%09%09%09%09case%201%3A%0A%09%09%09%09%09box.setAttribute%28%22align%22%2C%20%22right%22%29%3B%0A%09%09%09%09%09let%20tabbox%20%3D%20document.getElementById%28%22custombuttons-editbutton-tabbox%22%29%3B%0A%09%09%09%09%09let%20tabs%20%3D%20tabbox.getElementsByTagName%28%22tabs%22%29%5B0%5D%3B%0A%09%09%09%09%09tabs.parentNode.insertBefore%28box%2C%20tabs%29%3B%0A%09%09%09%09%09box.style.marginBottom%20%3D%20-btn.boxObject.height%20+%20%22px%22%3B%0A%09%09%09%09break%3B%0A%09%09%09%09case%202%3A%0A%09%09%09%09%09box.setAttribute%28%22align%22%2C%20%22center%22%29%3B%0A%09%09%09%09%09let%20btnBox%20%3D%20document.documentElement.getButton%28%22accept%22%29.parentNode%3B%0A%09%09%09%09%09let%20insPos%20%3D%20btnBox.firstChild%3B%0A%09%09%09%09%09for%28let%20node%20%3D%20insPos%3B%20node%3B%20node%20%3D%20node.nextSibling%29%20%7B%0A%09%09%09%09%09%09if%28node.localName%20%3D%3D%20%22spacer%22%29%20%7B%0A%09%09%09%09%09%09%09insPos%20%3D%20node%3B%0A%09%09%09%09%09%09%09break%3B%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%7D%0A%09%09%09%09%09btnBox.insertBefore%28box%2C%20insPos%29%3B%0A%09%09%09%7D%0A%09%09%09this.checkWindowStatus%28window%2C%20box%29%3B%0A%09%09%09//this.setOnTop%28btn%29%3B%0A%09%09%7D%2C%0A%09%09destroyWindow%3A%20function%28window%2C%20reason%29%20%7B%0A%09%09%09if%28reason%20%3D%3D%20this.REASON_WINDOW_CLOSED%29%0A%09%09%09%09window.removeEventListener%28%22DOMContentLoaded%22%2C%20this%2C%20false%29%3B%20//%20Window%20can%20be%20closed%20before%20DOMContentLoaded%0A%09%09%09if%28%21this.isTargetWindow%28window%29%29%0A%09%09%09%09return%3B%0A%09%09%09window.removeEventListener%28%22keypress%22%2C%20this%2C%20true%29%3B%0A%09%09%09if%28this.hasSizeModeChangeEvent%29%0A%09%09%09%09window.removeEventListener%28%22sizemodechange%22%2C%20this%2C%20false%29%3B%0A%09%09%09else%0A%09%09%09%09window.removeEventListener%28%22resize%22%2C%20this%2C%20false%29%3B%0A%09%09%09var%20document%20%3D%20window.document%3B%0A%09%09%09var%20btn%20%3D%20document.getElementById%28this.btnId%29%3B%0A%09%09%09btn.removeEventListener%28%22command%22%2C%20this%2C%20false%29%3B%0A%09%09%09if%28reason%20%3D%3D%20this.REASON_SHUTDOWN%29%20%7B%0A%09%09%09%09let%20box%20%3D%20btn.parentNode%3B%0A%09%09%09%09box.parentNode.removeChild%28box%29%3B%0A%09%09%09%09this.removeStyle%28document%29%3B%0A%09%09%09%7D%0A%09%09%7D%2C%0A%09%09isTargetWindow%3A%20function%28window%29%20%7B%0A%09%09%09return%20window.location.href.substr%280%2C%2041%29%20%3D%3D%20%22chrome%3A//custombuttons/content/editor.xul%22%3B%0A%09%09%7D%2C%0A%09%09observe%3A%20function%28subject%2C%20topic%2C%20data%29%20%7B%0A%09%09%09if%28topic%20%3D%3D%20%22quit-application-granted%22%29%0A%09%09%09%09this.destroy%28%29%3B%0A%09%09%09else%20if%28topic%20%3D%3D%20%22domwindowopened%22%29%0A%09%09%09%09subject.addEventListener%28%22DOMContentLoaded%22%2C%20this%2C%20false%29%3B%0A%09%09%09else%20if%28topic%20%3D%3D%20%22domwindowclosed%22%29%0A%09%09%09%09this.destroyWindow%28subject%2C%20this.REASON_WINDOW_CLOSED%29%3B%0A%09%09%7D%2C%0A%09%09handleEvent%3A%20function%28e%29%20%7B%0A%09%09%09var%20trg%20%3D%20e.originalTarget%20%7C%7C%20e.target%3B%0A%09%09%09var%20window%3B%0A%09%09%09switch%28e.type%29%20%7B%0A%09%09%09%09case%20%22DOMContentLoaded%22%3A%0A%09%09%09%09%09window%20%3D%20trg.defaultView%3B%0A%09%09%09%09%09window.removeEventListener%28%22DOMContentLoaded%22%2C%20this%2C%20false%29%3B%0A%09%09%09%09%09this.initWindow%28window%2C%20this.REASON_WINDOW_LOADED%29%3B%0A%09%09%09%09break%3B%0A%09%09%09%09case%20%22keypress%22%3A%0A%09%09%09%09%09if%28%0A%09%09%09%09%09%09%21%28%0A%09%09%09%09%09%09%09%28e.ctrlKey%20%7C%7C%20e.metaKey%29%20%26%26%20%21e.altKey%20%26%26%20%21e.shiftKey%0A%09%09%09%09%09%09%09%26%26%20String.fromCharCode%28e.charCode%29.toLowerCase%28%29%20%3D%3D%20%22t%22%0A%09%09%09%09%09%09%29%0A%09%09%09%09%09%29%0A%09%09%09%09%09%09break%3B%0A%09%09%09%09%09e.preventDefault%28%29%3B%0A%09%09%09%09%09e.stopPropagation%28%29%3B%0A%09%09%09%09case%20%22command%22%3A%0A%09%09%09%09%09window%20%3D%20trg.ownerDocument.defaultView.top%3B%0A%09%09%09%09%09this.toggleOnTop%28window%29%3B%0A%09%09%09%09break%3B%0A%09%09%09%09case%20%22sizemodechange%22%3A%0A%09%09%09%09case%20%22resize%22%3A%0A%09%09%09%09%09window%20%3D%20trg%3B%0A%09%09%09%09%09this.checkWindowStatus%28window%29%3B%0A%09%09%09%7D%0A%09%09%7D%2C%0A%09%09get%20hasSizeModeChangeEvent%28%29%20%7B%0A%09%09%09delete%20this.hasSizeModeChangeEvent%3B%0A%09%09%09return%20this.hasSizeModeChangeEvent%20%3D%20parseFloat%28%0A%09%09%09%09Components.classes%5B%22@mozilla.org/xre/app-info%3B1%22%5D%0A%09%09%09%09%09.getService%28Components.interfaces.nsIXULAppInfo%29%0A%09%09%09%09%09.platformVersion%0A%09%09%09%29%20%3E%3D%208%3B%0A%09%09%7D%2C%0A%09%09legacySizeModeChange%3A%20function%28window%29%20%7B%0A%09%09%09var%20lastState%20%3D%20window.windowState%3B%0A%09%09%09window.setInterval%28function%28window%2C%20_this%29%20%7B%0A%09%09%09%09var%20state%20%3D%20window.windowState%3B%0A%09%09%09%09if%28state%20%21%3D%20lastState%29%0A%09%09%09%09%09_this.checkWindowStatus%28window%29%3B%0A%09%09%09%09lastState%20%3D%20state%3B%0A%09%09%09%7D%2C%20150%2C%20window%2C%20this%29%3B%0A%09%09%7D%2C%0A%09%09checkWindowStatus%3A%20function%28window%2C%20box%29%20%7B%0A%09%09%09if%28%21box%29%0A%09%09%09%09box%20%3D%20window.document.getElementById%28this.boxId%29%3B%0A%09%09%09var%20na%20%3D%20String%28window.windowState%20%21%3D%20window.STATE_NORMAL%29%3B%0A%09%09%09if%28box.getAttribute%28this.naAttr%29%20%3D%3D%20na%29%0A%09%09%09%09return%3B%0A%09%09%09box.setAttribute%28this.naAttr%2C%20na%29%3B%0A%09%09%09//LOG%28%22Set%20n/a%3A%20%22%20+%20na%29%3B%0A%09%09%09this.setOnTop%28box.firstChild%29%3B%0A%09%09%7D%2C%0A%09%09addStyle%3A%20function%28document%29%20%7B%0A%09%09%09var%20style%20%3D%20%27%5C%0A%09%09%09%09%25box%25%5BcbOnTopFloat%5D%20%7B%5Cn%5C%0A%09%09%09%09%09position%3A%20fixed%20%21important%3B%5Cn%5C%0A%09%09%09%09%09top%3A%200%20%21important%3B%5Cn%5C%0A%09%09%09%09%09right%3A%200%20%21important%3B%5Cn%5C%0A%09%09%09%09%7D%5Cn%5C%0A%09%09%09%09%25btn%25%2C%20%25btn%25%20*%20%7B%5Cn%5C%0A%09%09%09%09%09margin%3A%200%20%21important%3B%5Cn%5C%0A%09%09%09%09%09padding%3A%200%20%21important%3B%5Cn%5C%0A%09%09%09%09%7D%5Cn%5C%0A%09%09%09%09%25btn%25%20%3E%20.button-box%20%3E%20.button-icon%20%7B%5Cn%5C%0A%09%09%09%09%09margin%3A%20-3px%20-1px%20%21important%3B%5Cn%5C%0A%09%09%09%09%7D%5Cn%5C%0A%09%09%09%09toolbarbutton%25btn%25%20%7B%5Cn%5C%0A%09%09%09%09%09padding%3A%200%202px%20%21important%3B%5Cn%5C%0A%09%09%09%09%7D%5Cn%5C%0A%09%09%09%09%25btn%25%20%7B%5Cn%5C%0A%09%09%09%09%09position%3A%20relative%20%21important%3B%5Cn%5C%0A%09%09%09%09%09z-index%3A%202147483647%20%21important%3B%5Cn%5C%0A%09%09%09%09%09list-style-image%3A%20url%28%22%25icon%25%22%29%20%21important%3B%5Cn%5C%0A%09%09%09%09%09-moz-user-focus%3A%20ignore%20%21important%3B%5Cn%5C%0A%09%09%09%09%09min-height%3A%200%20%21important%3B%5Cn%5C%0A%09%09%09%09%09min-width%3A%200%20%21important%3B%5Cn%5C%0A%09%09%09%09%7D%5Cn%5C%0A%09%09%09%09%25btn%25%5B%25onTopAttr%25%3D%22true%22%5D%20%7B%5Cn%5C%0A%09%09%09%09%09list-style-image%3A%20url%28%22%25iconPinned%25%22%29%20%21important%3B%5Cn%5C%0A%09%09%09%09%7D%5Cn%5C%0A%09%09%09%09%25box%25%5B%25naAttr%25%3D%22true%22%5D%20image%20%7B%5Cn%5C%0A%09%09%09%09%09opacity%3A%200.75%20%21important%3B%5Cn%5C%0A%09%09%09%09%7D%27%0A%09%09%09%09.replace%28/%25box%25/g%2C%20%22%23%22%20+%20this.boxId%29%0A%09%09%09%09.replace%28/%25btn%25/g%2C%20%22%23%22%20+%20this.btnId%29%0A%09%09%09%09.replace%28/%25onTopAttr%25/g%2C%20this.onTopAttr%29%0A%09%09%09%09.replace%28/%25icon%25/g%2C%20this.icon%29%0A%09%09%09%09.replace%28/%25iconPinned%25/g%2C%20this.iconPinned%29%0A%09%09%09%09.replace%28/%25naAttr%25/g%2C%20this.naAttr%29%3B%0A%0A%09%09%09document.insertBefore%28%0A%09%09%09%09document.createProcessingInstruction%28%0A%09%09%09%09%09%22xml-stylesheet%22%2C%0A%09%09%09%09%09%27id%3D%22%27%20+%20this.styleId%20+%20%27%22%20href%3D%22%27%20+%20%22data%3Atext/css%2C%22%0A%09%09%09%09%09%09+%20encodeURIComponent%28style%29%20+%20%27%22%20type%3D%22text/css%22%27%0A%09%09%09%09%29%2C%0A%09%09%09%09document.firstChild%0A%09%09%09%29%3B%0A%09%09%7D%2C%0A%09%09removeStyle%3A%20function%28document%29%20%7B%0A%09%09%09for%28var%20child%20%3D%20document.firstChild%3B%20child%3B%20child%20%3D%20child.nextSibling%29%20%7B%0A%09%09%09%09if%28%0A%09%09%09%09%09child.nodeType%20%3D%3D%20child.PROCESSING_INSTRUCTION_NODE%0A%09%09%09%09%09%26%26%20child.data.indexOf%28this.styleId%29%20%21%3D%20-1%0A%09%09%09%09%29%20%7B%0A%09%09%09%09%09document.removeChild%28child%29%3B%0A%09%09%09%09%09break%3B%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%2C%0A%09%09getXulWin%3A%20function%28window%29%20%7B%0A%09%09%09return%20window.QueryInterface%28Components.interfaces.nsIInterfaceRequestor%29%0A%09%09%09%09.getInterface%28Components.interfaces.nsIWebNavigation%29%0A%09%09%09%09.QueryInterface%28Components.interfaces.nsIDocShellTreeItem%29%0A%09%09%09%09.treeOwner%0A%09%09%09%09.QueryInterface%28Components.interfaces.nsIInterfaceRequestor%29%0A%09%09%09%09.getInterface%28Components.interfaces.nsIXULWindow%29%3B%0A%09%09%7D%2C%0A%09%09setOnTop%3A%20function%28btn%2C%20toggle%29%20%7B%0A%09%09%09var%20document%20%3D%20btn.ownerDocument%3B%0A%09%09%09var%20root%20%3D%20document.documentElement%3B%0A%09%09%09var%20onTop%20%3D%20root.getAttribute%28this.onTopAttr%29%20%3D%3D%20%22true%22%3B%0A%09%09%09if%28toggle%29%20%7B%0A%09%09%09%09onTop%20%3D%20%21onTop%3B%0A%09%09%09%09root.setAttribute%28this.onTopAttr%2C%20onTop%29%3B%0A%09%09%09%09root.id%20%26%26%20document.persist%28root.id%2C%20this.onTopAttr%29%3B%0A%09%09%09%7D%0A%09%09%09else%20if%28%21onTop%29%20//%20Just%20opened%20or%20restored%20window%20always%20have%20zLevel%20%3D%3D%20normalZ%0A%09%09%09%09return%3B%0A%09%09%09var%20window%20%3D%20document.defaultView%3B%0A%09%09%09var%20state%20%3D%20window.windowState%3B%0A%09%09%09//%20Strange%20glitches%20with%20minimized%20%22raisedZ%22%20window...%0A%09%09%09var%20restore%20%3D%20onTop%20%26%26%20state%20%3D%3D%20window.STATE_MINIMIZED%3B%0A%09%09%09if%28restore%20%7C%7C%20state%20%3D%3D%20window.STATE_NORMAL%29%20%7B%0A%09%09%09%09if%28restore%29%0A%09%09%09%09%09onTop%20%3D%20false%3B%0A%09%09%09%09let%20xulWin%20%3D%20this.getXulWin%28window%29%3B%0A%09%09%09%09xulWin.zLevel%20%3D%20onTop%20%3F%20xulWin.raisedZ%20%3A%20xulWin.normalZ%3B%0A%09%09%09%09//LOG%28%22Set%20on%20top%3A%20%22%20+%20onTop%29%3B%0A%09%09%09%7D%0A%09%09%09this.checkButton%28btn%2C%20onTop%29%3B%0A%09%09%7D%2C%0A%09%09toggleOnTop%3A%20function%28window%29%20%7B%0A%09%09%09this.setOnTop%28window.document.getElementById%28this.btnId%29%2C%20true%29%3B%0A%09%09%7D%2C%0A%09%09checkButton%3A%20function%28btn%2C%20onTop%29%20%7B%0A%09%09%09btn.setAttribute%28this.onTopAttr%2C%20onTop%29%3B%0A%09%09%09this.btnChecked%20%26%26%20btn.setAttribute%28%22checked%22%2C%20onTop%29%3B%0A%09%09%7D%0A%09%7D%3B%0A%09storage.set%28watcherId%2C%20watcher%29%3B%0A%09watcher.init%28watcher.REASON_STARTUP%29%3B%0A%7D%0Afunction%20destructor%28reason%29%20%7B%0A%09if%28reason%20%3D%3D%20%22update%22%20%7C%7C%20reason%20%3D%3D%20%22delete%22%29%20%7B%0A%09%09watcher.destroy%28watcher.REASON_SHUTDOWN%29%3B%0A%09%09storage.set%28watcherId%2C%20null%29%3B%0A%09%7D%0A%7D%0Aif%28%0A%09typeof%20addDestructor%20%3D%3D%20%22function%22%20//%20Custom%20Buttons%200.0.5.6pre4+%0A%09%26%26%20addDestructor%20%21%3D%20%28%22addDestructor%22%20in%20window%20%26%26%20window.addDestructor%29%0A%29%0A%09addDestructor%28destructor%2C%20this%29%3B%0Aelse%0A%09this.onDestroy%20%3D%20destructor%3B%5D%5D%3E%3C/initcode%3E%0A%20%20%3Ccode%3E%3C%21%5BCDATA%5B/*CODE*/%5D%5D%3E%3C/code%3E%0A%20%20%3Caccelkey%3E%3C%21%5BCDATA%5B%5D%5D%3E%3C/accelkey%3E%0A%20%20%3Chelp%3E%3C%21%5BCDATA%5B%5D%5D%3E%3C/help%3E%0A%20%20%3Cattributes/%3E%0A%3C/custombutton%3E
Исходный код, инициализация: cbEditorToggleOnTop.js |
Infocatcher > 17-08-2012 23:47:43 |
Тестовая версия, будьте осторожны! |
Infocatcher > 18-08-2012 18:20:21 |
Custom Buttons Editor: Toggle on Top 0.1.7 (2012-08-18) |
Infocatcher > 18-08-2012 22:19:54 |
Custom Buttons Editor: Toggle on Top 0.1.8 (2012-08-18) |
Infocatcher > 08-09-2012 00:21:54 |
Custom Buttons Editor: Toggle on Top 0.1.9 (2012-09-08) |
Infocatcher > 09-02-2013 23:08:49 |
Custom Buttons Editor: Toggle on Top 0.1.10 (2013-02-09) |
Garider > 02-07-2014 17:08:14 |
А можно такую кнопку для окна , или может есть такая? |
Infocatcher > 02-07-2014 21:40:59 |
Garider пишет
Это гораздо легче. Вот простейший вариант (для секции «код»), только он без обработки сворачивания окна: Выделить код Код:var xulWin = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIWebNavigation) .QueryInterface(Components.interfaces.nsIDocShellTreeItem) .treeOwner .QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIXULWindow); var onTop = xulWin.zLevel == xulWin.normalZ; xulWin.zLevel = onTop ? xulWin.raisedZ : xulWin.normalZ; this.checked = onTop; |
Garider > 03-07-2014 16:16:25 |
Infocatcher |
Garider > 03-07-2014 17:18:57 |
Сейчас проверил на чистом профиле Pale Moon и ту, и другую кнопку - не работают. |
voqabuhe > 03-07-2014 17:50:27 |
Garider пишет
Ну ты нафантазировал. Читай шапку внимательно, кнопка только для редактора Custom Buttons. |
Garider > 03-07-2014 18:06:19 |
voqabuhe пишет
. |
Infocatcher > 03-07-2014 18:06:47 |
Garider пишет
Я не проверял. Используется особый «on top» браузера, окно будет выводиться только поверх других окон браузера. Garider пишет
Можно скопировать оттуда нужный код: Выделить код Код:var onTop = this.checked = !this.checked; alwaysontop_coremakeAlwaysOnTop(window, onTop); // chrome/content/alwaysontop_core.js from https://addons.mozilla.org/addon/always-on-top/ function alwaysontop_logxxx(msg) { var consoleService = Components.classes["@mozilla.org/consoleservice;1"] .getService(Components.interfaces.nsIConsoleService); consoleService.logStringMessage(msg); } function alwaysontop_coremakeAlwaysOnTop(window, onTop) { try { Components.utils.import("resource://gre/modules/ctypes.jsm"); var lib = ctypes.open("user32.dll"); var funcActiveWindow = 0; try { funcActiveWindow = lib.declare("GetActiveWindow", ctypes.winapi_abi, ctypes.int32_t); } catch (ex) { funcActiveWindow = lib.declare("GetActiveWindow", ctypes.stdcall_abi, ctypes.int32_t); } if (funcActiveWindow != 0) { var activeWindow = funcActiveWindow(); var funcSetWindowPos = 0; try { funcSetWindowPos = lib.declare("SetWindowPos", ctypes.winapi_abi, ctypes.bool, ctypes.int32_t, ctypes.int32_t, ctypes.int32_t, ctypes.int32_t, ctypes.int32_t, ctypes.int32_t, ctypes.uint32_t); } catch(ex) { funcSetWindowPos = lib.declare("SetWindowPos", ctypes.stdcall_abi, ctypes.bool, ctypes.int32_t, ctypes.int32_t, ctypes.int32_t, ctypes.int32_t, ctypes.int32_t, ctypes.int32_t, ctypes.uint32_t); } var hwndAfter = -2; if (onTop) hwndAfter = -1; funcSetWindowPos(activeWindow, hwndAfter, 0, 0, 0, 0, 19); } lib.close(); } catch (ex) { alwaysontop_log(ex); } } |
Garider > 03-07-2014 18:46:26 |
Infocatcher
Или здесь как-то по другому надо? |
Infocatcher > 03-07-2014 19:59:22 |
Garider пишет
Если не мешает индикация «нажатости» кнопки, можно добавить этот код после Если надо без индикации, можно вот так: Garider пишет
Как минимум, надо заменить Выделить код Код:let xulWin = this.getXulWin(window); xulWin.zLevel = onTop ? xulWin.raisedZ : xulWin.normalZ; на (и добавить в конец код из alwaysontop_core.js расширения Always on Top) Garider пишет
Вряд ли в этом случае будет сколько-нибудь заметная разница. |
Garider > 03-07-2014 20:28:08 |
Понятно.Сейчас попробую. |
Garider > 03-07-2014 21:47:06 |
Может кому пригодится. Выделить код Код:var onTop = this.cbOnTop = !this.cbOnTop; this.image = onTop ? "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAWdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjA76PVpAAACS0lEQVQ4T7XTXUiTURzH8QeLIiuydDkpispeCLqKIAPpwmBLjbnGk0osfClr6VUWYS42mChb1qoth9bEuTa3ORtlatrMar1IVBdJQdSFUrLMaro3n+1Jf21xbjeb0AceOIfzvTn/w0P9dx71UEqorlsRPGPRBcr1Co9ImwPatogc/zumaVAautKPmYsOBKpuw3fsJrzillGPUFMKSpZEsvmFtM561jyMkKoXwRo7/KcM8JXo4ZMYMCm4ahvaL1tM0vhYvesA2/MOYcNzMPX3ETxrhb+8FV76Bjz5akzsk0tIOj9GPfDUL2nHd7EO46U6/KjQY0rcjMm8RnzNlheSLL4JWruC0T3y+U4b8TlLisEt5TBzCmDZcMTbta7wPMlic7f3L2cNz3KDNZ2acMcreCNDfrGzEoY1+TClCuS9FH8pSWObuWDnsY63P38//gim+QmYS31w85S4s74IxnRhwLFKkELS2MYrmpODintTs29GwQ68h1/Vg+mTbRjZfQ5tqYdg2Vz8zZjMyyB5bHNlt1aGTC8DbOdrMBonokMey6nDgx3HoePkQp1xEK2rc7tJHh/r/CAMtbrC0af2FungzlZgODKfDq4ILWvz0Lnt6KyNQ3NJHl9Q1ZcVqDKNTAuuY2yPFK7ME7CkFcAYGfbd7SWwpx3eStL51VZXb2oUVXo+7a21P8ws+2VOF8LEFc7ZNxb3yxL5PYwGo1xSWdUUXcsoKula5Mmj39/DRFgs1i8NDZd3ke3CWK3WZUqlSkO2C0fT9BI+P9FrUNQf3t4uEkpfyLgAAAAASUVORK5CYII=" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAWdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjA76PVpAAACFklEQVQ4T52SX2hSYRjGpV11U5fddtFNjK4b5WorFrViDXUXw6ALK+imWuj+UGBjti0Mc2meVZDukOQkgi1Xc67ZzBqEYHNFMNv6Y+q0HZnNtDznfE8n+K5GivN39/D+eOD93k/2P2xJ/pA5ybM34nzEEOejxgQfNcWL84YvBUfHYv4g1crzkCN77KsEd3+IsKRE3EwKGEjwkAqhjxWhXS6IFxd+7qZ6acwrZMfjjPjbs0bAcgRMWoR5RcDg9yK6PmRwduZrVv1scRvVy+PkhLbxNbHApAT0LuegmV1Ckz2A+ttTv5rvzymoVhnWNN9sl9a7+jmPdu9H1Num0TQcPELHldMX4xsmpPWuSyspx95Bbn6Ok+zCPjqunI1FjRYvlJstcgM11pSg21h02OrvkOn1W6hWHncG22fWSWA6S+DiBBhif6SiMOSmccj7XTgwNOmrG32zleqleZDmbZE8MLtOMCxdrftTDqdfRnGUDWDvrQkoHK9xbCRspHpppJMvvcoBoxkCk/QZr3wr4szbBI67Q6gbmkQj44fSGQlRvTTOjKD2ZUmc5UQYadG58CpansxDfseHBosvpmBDrVQvz7/HdnCk1pwQTnWP+T2aEc+j9qfv1fvvvaiVtblrqLY5tFpt/4mWVh2N1eNyuQYvXLrcS2P1eL1TA7qunms0Vk8wOHe+s7NHQ2P1MAyzU6VS7aKxBDLZX2cYVSnmZO7XAAAAAElFTkSuQmCC"; alwaysontop_coremakeAlwaysOnTop(window, onTop); // chrome/content/alwaysontop_core.js from https://addons.mozilla.org/addon/always-on-top/ function alwaysontop_logxxx(msg) { var consoleService = Components.classes["@mozilla.org/consoleservice;1"] .getService(Components.interfaces.nsIConsoleService); consoleService.logStringMessage(msg); } function alwaysontop_coremakeAlwaysOnTop(window, onTop) { try { Components.utils.import("resource://gre/modules/ctypes.jsm"); var lib = ctypes.open("user32.dll"); var funcActiveWindow = 0; try { funcActiveWindow = lib.declare("GetActiveWindow", ctypes.winapi_abi, ctypes.int32_t); } catch (ex) { funcActiveWindow = lib.declare("GetActiveWindow", ctypes.stdcall_abi, ctypes.int32_t); } if (funcActiveWindow != 0) { var activeWindow = funcActiveWindow(); var funcSetWindowPos = 0; try { funcSetWindowPos = lib.declare("SetWindowPos", ctypes.winapi_abi, ctypes.bool, ctypes.int32_t, ctypes.int32_t, ctypes.int32_t, ctypes.int32_t, ctypes.int32_t, ctypes.int32_t, ctypes.uint32_t); } catch(ex) { funcSetWindowPos = lib.declare("SetWindowPos", ctypes.stdcall_abi, ctypes.bool, ctypes.int32_t, ctypes.int32_t, ctypes.int32_t, ctypes.int32_t, ctypes.int32_t, ctypes.int32_t, ctypes.uint32_t); } var hwndAfter = -2; if (onTop) hwndAfter = -1; funcSetWindowPos(activeWindow, hwndAfter, 0, 0, 0, 0, 19); } lib.close(); } catch (ex) { alwaysontop_log(ex); } } |
Dumby > 16-09-2017 22:20:59 |
Infocatcher Cu.import() вместо BackstagePass возвращает NonSyntacticVariablesObject Не знаю почему используется Object.create() и не знаю как правильно. скрытый текст Выделить код Код://var storage = global[ns] || (global[ns] = global.Object.create(null)); var storage = global[ns]; if (!storage) try { storage = global[ns] = global.Object.create(null); } catch(ex) { storage = global[ns] = Components.utils.getGlobalForObject(global).Object.create(null); } All Код для конфигурационного файла теперь уже только для 57b надеюсь попробовать рассмотреть, а пока используйте настройки. |
Infocatcher > 18-09-2017 21:41:08 |
Dumby Object.create() – это хотелось, чтобы быстрее работало, проверки на property in object должны работать быстрее, если не лезет в прототип (которого нет). И in быстрее, чем .hasOwnProperty(). Подкрутил, спасибо! |
Dumby > 19-09-2017 00:38:19 |
Infocatcher пишет
Бррр, не каркай. Это было бы нехорошо для меня. Ну, то есть, во второй аргумент EXPORTED_SYMBOLS, а вернёт глобальный объект. Я же полностью зависим от возможности что-то изменять кодом в .jsm'ках.
О, спасибо за консультацию!
Значит storage будет в едином глобальном объекте, а не в NSVO от Services |
Infocatcher > 19-09-2017 11:52:53 |
Dumby пишет
А, ну и еще если просто сделать storage = global[ns] = {} – начинает течь память, сборщику мусора не нравится, если подсовывать чужеродные объекты. Тут, наверное, по-простому не проверить, а вот с отключаемыми расширениями это видно, оседает в about:memory (если, конечно, внезапно вдруг не починили). Dumby пишет
Аaa, я что-то подумал, что вываливает некую обертку... а оказалось нечто уникальное для каждого jsm. Выделить код Код:var global = Components.utils.import("resource://gre/modules/Services.jsm", {}); global = Components.utils.getGlobalForObject(global); global.Services; // undefined Раз так, пусть в старых версиях будет лишний вызов getGlobalForObject(): |
Infocatcher > 23-10-2017 11:36:58 |
А ведь еще и финт от неотключаемых расширений поломался из-за этого NonSyntacticVariablesObject: Выделить код Код:if(addon.hidden) { _log("Let's try set addon.userDisabled using raw hack"); let g = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm", {}); // See "set userDisabled(val)" let addonFor = g.eval("addonFor"); let rawAddon = addonFor(addon); //rawAddon.userDisabled = newDis; g.XPIProvider.updateAddonDisabledState(rawAddon, newDis); } Любители скрытничать... Выделить код Код:// Maps instances of AddonInternal to AddonWrapper const wrapperMap = new WeakMap(); let addonFor = wrapper => wrapperMap.get(wrapper); |
Dumby > 23-10-2017 14:54:48 |
Infocatcher пишет
Набрал из-под Firefox 58.0a1 (2017-10-21). Жму в menupopup кнопки на «Firefox Screenshots». Жму в адесной строке на ●●● (#pageActionButton). Нездоровый оптимизм. скрытый текст Выделить код Код:function updateAddonDisabledState(addon, newDis) { var nsvo = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm", {}); var ssl = Components.classes["@mozilla.org/moz/jssubscript-loader;1"] .getService(Components.interfaces.mozIJSSubScriptLoader); var url = URL.createObjectURL(new Blob([ "XPIProvider.updateAddonDisabledState(addonFor(this.blabla[0]), this.blabla[1]); delete this.blabla;" ])); addDestructor(function() { URL.revokeObjectURL(url); }); (updateAddonDisabledState = function(addon, newDis) { nsvo.blabla = [addon, newDis]; ssl.loadSubScript(url, nsvo); })(addon, newDis); } function setNewDisabled(addon) { var newDis = getNewDisabled(addon); var oldDis = addon.userDisabled; try { addon.userDisabled = newDis; } catch(e) { // Error: Cannot disable hidden add-on firefox@getpocket.com _log("Can't set addon.userDisabled to " + newDis + ", error:\n" + e); if(addon.hidden) { _log("Let's try set addon.userDisabled using raw hack"); let g = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm", {}); // See "set userDisabled(val)" /* let addonFor = g.eval("addonFor"); let rawAddon = addonFor(addon); //rawAddon.userDisabled = newDis; g.XPIProvider.updateAddonDisabledState(rawAddon, newDis); */ try { let addonFor = g.eval("addonFor"); let rawAddon = addonFor(addon); //rawAddon.userDisabled = newDis; g.XPIProvider.updateAddonDisabledState(rawAddon, newDis); } catch(ex) { updateAddonDisabledState(addon, newDis); } } } var realDis = addon.userDisabled; alert(addon.id + "\nuserDisabled: " + realDis); |
Infocatcher > 23-10-2017 22:32:22 |
Dumby |
Dumby > 07-12-2017 00:50:53 |
Infocatcher Выделить код Код://if(!prefs.getBoolPref("intl.locale.matchOS")) { if(!prefs.getBoolPref("intl.locale.matchOS", false)) { |
Infocatcher > 07-12-2017 17:44:40 |
Dumby пишет
Для пущего развлечения им следует переименовать вообще все настройки, ящитаю. |
okkamas_knife > 07-12-2017 19:09:46 |
не они всё грамотно делают если светить лазерной указкой на стену слишком высоко то котик посмотрит-посмотрит и уйдёт спать а если водить пониже то он будет смищно прыгать пытаясь поймать пятнышко. |
Dumby > 05-09-2018 06:08:01 |
Infocatcher скрытый текст Выделить код Код://root.id && document.persist(root.id, this.onTopAttr); if(root.id) { if("persist" in XULDocument.prototype) document.persist(root.id, this.onTopAttr); else Services.xulStore.persist(root, this.onTopAttr); } |
Infocatcher > 05-09-2018 14:09:58 |
Dumby пишет
Спасибо! |
Dumby > 17-04-2020 08:08:21 |
Infocatcher Выделить код Код:shadow: function(document, style) { ... // Firefox 69+ https://bugzil.la/1544916 if(style === undefined) return sr; style && Promise.resolve(this.boxId).then(function(id) { sr.getElementById(id) .appendChild(document.createElementNS(xhtmlns, "style")) .append(style); }); return true; }, |
Dumby > 18-04-2020 08:11:52 |
Dumby пишет
Увы, работает только до тех пор, пока не закроешь |