kokoss попробуй спросить тута, там Dumby чаще появляется https://forum.mozilla-russia.org/viewto … 10#p768810
Отредактировано func4ptch4 (09-08-2019 03:41:20)
Отсутствует
Приветствую,
Пользуюсь этой кнопкой, все отлично работает, но хотелось бы улучшить.
// Настройка функций кликов мыши для кнопки ............. this.onclick =e=> { if ( e.button == 0 ) { // ЛКМ deleteCookiesFromHost(); reloadAllTabsFromHost(); } if ( e.button == 1 ) { // СКМ deleteCookiesFromHost(); //BrowserReload(); } if ( e.button == 2 && !e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey ) { // ПКМ e.preventDefault(); try { Services.wm.getMostRecentWindow("Browser:Cookies").close() } catch(e) {}; var win = openDialog ("chrome://browser/content/preferences/cookies.xul", "_blank", "resizable,dialog=yes,centerscreen", null); addEventListener("load", ()=> { var host = content.location.host, arr = host.split('.'); if ( arr.length > 2 ) host = arr[1] + "." + arr[2]; var filter = win.document.getElementById("filter"); filter.value = host; setTimeout(()=> filter.doCommand(), 0); }, false, win); } }; // Удалить куки базового домена ............. function deleteCookiesFromHost() { var host = Services.eTLD.getBaseDomain(gBrowser.currentURI); // удалить обычные куки домена for ( var en = Services.cookies.enumerator; en.hasMoreElements(); ) { var cookie = en.getNext().QueryInterface(Ci.nsICookie); ~cookie.host.indexOf(host.trim()) && Services.cookies.remove(cookie.host, cookie.name, cookie.path, false); } // удалить куки домена из истории var reversedDomain = host.split("").reverse().join("") + "."; Cu.import("resource://gre/modules/FileUtils.jsm"); var file = FileUtils.getFile("ProfD", ["webappsstore.sqlite"]); var dbConn = Services.storage.openDatabase(file); dbConn.executeSimpleSQL("DELETE FROM webappsstore2 WHERE scope LIKE \"%" + reversedDomain +"%\""); dbConn.close(); // удалить все Flash куки var dir = Services.dirsvc.get('Home', Ci.nsIFile); dir.append("Application Data"); dir.append("Macromedia"); dir.remove(true); dir.create(Ci.nsIFile.DIRECTORY_TYPE, 0777); }; // Перезагрузить все вкладки текущего сайта ............. function reloadAllTabsFromHost() { var host = content.document.domain; for( var tab of gBrowser.tabs ) { var tabHost = tab.linkedBrowser.contentDocument.location.host; if ( host == tabHost ) gBrowser.reloadTab(tab); } }; this.tooltipText = "Л: Удалить куки текущего сайта\ \nС: Удалить куки текущего сайта + обновить все вкладки текущего сайта\ \nП: Управление куками для текущего сайта\ \nCtrl+П: CB Меню";
есть папки https+++domen.ru
можно сделать, чтобы и папка домена удалялась при нажатии на кнопку.
Спасибо!
Отредактировано firepox (07-05-2019 22:52:48)
Отсутствует
Попробуйте этот код. Раньше вроде работало
А потом вы пересели на супер-пупер браузер без белых вспышек?
Добавлено 22-01-2022 16:22:57
можно сделать, чтобы и папка домена удалялась при нажатии на кнопку.
Спасибо!
Это утверждение?
Отредактировано ascerdfg (22-01-2022 16:22:57)
Отсутствует
Добрый день . Исправите пожалуйста кнопку Autocopy+31 для FF105
/*Initialization Code*/ /*Initialization Code*/ this.closest("toolbarpaletteitem") || (script => { var id = `CB${_id.slice(20)}:Autocopy`, pid = id + "Parent"; var nsvoStr = `Components.utils.import("resource://gre/modules/Services.jsm", {})`; var nsvo = eval(nsvoStr), {Services} = nsvo, parent = nsvo[pid]; if (!parent) { var cid = id + "Child", u = code => "data:," + encodeURIComponent(code); var pref = "CB.Autocopy.settings", topic = "quit-application-granted"; var PREF_ENABLED = 1, PREF_BLINK = 2, PREF_RESET = 4; (parent = nsvo[pid] = { init() { this.readSettings(); if (!this[PREF_ENABLED]) return; this.initChild(); if (this[PREF_RESET]) this.setObserver(true); }, destroy(reason) { var ud = reason[5] == "e"; if (ud || !this.obsAdded) this.saveSettings(); delete nsvo[pid]; if (reason == "delete") Services.prefs.clearUserPref(pref); if (!this[PREF_ENABLED]) return; this.destroyChild(); if (ud && this[PREF_RESET]) this.setObserver(false); }, get processURL() { delete this.processURL; this.frameURL = u(`${nsvoStr}["${cid}"].init(this);`); return this.processURL = u(script.replace(/%ID%/g, cid) .replace("%NSVO%", nsvoStr) .replace("%PREF%", pref) .replace("%PREF_BLINK%", PREF_BLINK) ); }, get frameURLDestroy() { delete this.frameURLDestroy; this.processURLDestroy = u(`${nsvoStr}["${cid}"].forget();`); return this.frameURLDestroy = u(`${nsvoStr}["${cid}"].destroy(this);`); }, initChild() { Services.ppmm.loadProcessScript(this.processURL, true); Services.mm.loadFrameScript(this.frameURL, true); }, destroyChild() { Services.mm.removeDelayedFrameScript(this.frameURL); Services.mm.loadFrameScript(this.frameURLDestroy, false); Services.ppmm.removeDelayedProcessScript(this.processURL); Services.ppmm.loadProcessScript(this.processURLDestroy, false); }, readSettings() { var val = Services.prefs.getIntPref(pref, 3); for(var setting of [PREF_ENABLED, PREF_BLINK, PREF_RESET]) this[setting] = Boolean(val & setting); }, saveSettings() { var settings = 0; for(var setting of [PREF_ENABLED, PREF_BLINK, PREF_RESET]) if (this[setting]) settings += setting; Services.prefs.setIntPref(pref, settings); }, btns: new Set(), register(btn) { this.btns.add(btn); btn._handleClick = this.click; btn.oncontextmenu = this.context; this.setImg(btn, this[PREF_ENABLED]); }, unregister(btn, reason) { this.btns.delete(btn); if (!this.btns.size) this.destroy(reason); }, setImg(btn, state) { (btn.icon || btn.ownerDocument.getAnonymousElementByAttribute( btn, "class", "toolbarbutton-icon" )).src = state ? "data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABmJLR0QA/wD/AP+gvaeTAAAAB3RJTUUH1gUCFysoMPbyDwAABE5JREFUOI2NlV1sFFUUx39z73S/6C67s6UsQisWAgZBKRTUhBhDJAhEoyQ2QqMlhjcSP158MMYHoo+YGF5MjNCHqkmJKJpgaYAEFYhalWio2EWXpZgIS3G3uzu783Hn+tAPW2zRk5zcySTnd//nf+fMNfr6+qK1Wq1Fa50BWoCMlLJNSrkUWBIEwUKlVFJKWRZCDPu+3+O67sd79+69xR3C6Onp0alUyrYsSyeTSdHY2BiKxWIyEokQCoVoaGhgdHSUQqGAEALXdf1sNuvX6/WD4XB4f2dnZ2VWcG9vb6mrqyvheR5aa4IgmFonn33fx/O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W9CFoYg8pqwYJSlK0zMyIvY6qD4IbXNmiELMIb34vYh1fqwBc2O/YFZV5q9+/+vYXReEwKZX6+rORUMFS12/3kCCxA/ViWywVnI/P7LePDIZMDbv32psbFTsApPGd6lWPBuaEK6pCJ3SQyFnoTqeSdAG0nQL8B4ASlciAL3XrzuampoEd/3RYAuBnxQGq1QaBejmtAHJFETl0XTEzL/8H5RXg5OUwDI6iWc+fxBpHSAUGiGlAuHBW6ysrNQIqRYqk47eWhy9PAIEV+A1fwbJ0i1wbDEsI5Pgz16GL/MsnjtzJhwc/xjsCwfbq6qqVAKQXgp4XTbwU99CU/0huLV78DgdiLuvx+zIT9g4fglM9jmx0glZdDIvLwSW048nwgvhBaFbx9MLwlF5jJXNG2W5519gYlWHwG/awTsWYO18G668S8DBQvEVEaodvTZi3o+Pj//Q0tLyFrG2H3dOBJOlTEdHx0H6zqUNOQV/ftyG+psZx1KdWP7xGv6ZnYIlo9rLZhX6NRpNjFqtliZRvgu1xWq1Ynh4WN/a2vol7ReEt4fJEy4V2J9fY7wbkM2tONz60TkYTZuZtvLy8ie0Wq2GPNIS8DCV2FyGYbJIukNms/mL9vb2Ntq7FS7Fv/ChKzVwIHr3AAAAAElFTkSuQmCC"; }, click() { var newState = parent[PREF_ENABLED] = !parent[PREF_ENABLED]; for(var btn of parent.btns) parent.setImg(btn, newState); newState ? parent.initChild() : parent.destroyChild(); if (parent[PREF_RESET]) parent.setObserver(newState); }, context(e) { if (e.ctrlKey || e.shiftKey) return; var btn = e.target; if (btn.btnPopup && e.detail > 1) return btn.btnPopup.hidePopup(); e.preventDefault(); (btn.btnPopup || parent.getPopup(btn)).openPopup(btn, "after_start"); }, getPopup(btn) { var win = btn.ownerGlobal, doc = win.document; var popup = doc.createElementNS(xulns, "menupopup"); popup.setAttribute("onclick", "event.stopPropagation();"); popup.setAttribute("oncommand", "handleCommand(event.target);"); popup.setAttribute("onpopupshowing", "handlePopupshowing();"); popup.menuitems = []; for(var [lab, pref] of win.Object.entries({ "Выделенный текст мигает при автокопировании": PREF_BLINK, "Выключать автокопирование при выходе из браузера": PREF_RESET })) { var menuitem = popup.appendChild(doc.createElementNS(xulns, "menuitem")); menuitem.setAttribute("label", lab); menuitem.setAttribute("type", "checkbox"); menuitem.pref = pref; popup.menuitems.push(menuitem); } popup.handleCommand = menuitem => { var newState = this[menuitem.pref] = menuitem.hasAttribute("checked"); if (!this[PREF_ENABLED]) return; if (menuitem.pref == PREF_BLINK) this.saveSettings(), Services.ppmm.broadcastAsyncMessage(cid + ":FromParent", {blink: newState}); else if (menuitem.pref == PREF_RESET) this.setObserver(newState); } popup.handlePopupshowing = () => { for(var menuitem of popup.menuitems) this[menuitem.pref] ? menuitem.setAttribute("checked", true) : menuitem.removeAttribute("checked"); } return btn.appendChild(btn.btnPopup = popup); }, obsAdded: false, setObserver(set) {this.obsAdded = set ? Services.obs.addObserver(this, topic, false) : Services.obs.removeObserver(this, topic); }, observe() { Services.obs.removeObserver(this, topic); this[PREF_ENABLED] = false; this.saveSettings(); } }).init(); } parent.register(this); addDestructor(reason => parent.unregister(this, reason), parent); })(`(nsvo => (nsvo["%ID%"] = { x: -1, y: -1, down: false, handleEvent(e) {e.button || this[e.type](e);}, mousedown(e) {this.x = e.screenX; this.y = e.screenY, this.down = true;}, mouseup(e) { var {down} = this; this.down = false; if (!down) return; if (e.screenX == this.x && e.screenY == this.y && (e.detail == 1 || e.target.matches( "textarea[disabled],input[disabled],button,select,summary" ))) return; var name = e.originalTarget.nodeName; if (/^(?:(?:xul:)?(?:slider|scrollbarbutton)|resizer)$/.test(name)) return; this.x = this.y = -1; var win = this.getFocusedWin(e.target.ownerGlobal); var sel = win.getSelection(); if (sel.toString()) { (win.docShell || win.document.docShell).doCommand("cmd_copy", null, win); this.blinkEnabled && this.blink(win, e.detail > 1); } }, blinkEnabled: Boolean( Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefService) .getIntPref("%PREF%", 3) & %PREF_BLINK% ), blink(win, pause) { if (pause) return win.setTimeout(() => this.blink(win), 100); var sc = (win.docShell || win.document.docShell) .QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsISelectionDisplay) .QueryInterface(Components.interfaces.nsISelectionController); sc.setDisplaySelection(sc.SELECTION_OFF); sc.repaintSelection(sc.SELECTION_NORMAL); win.setTimeout(() => { sc.setDisplaySelection(sc.SELECTION_ON); sc.repaintSelection(sc.SELECTION_NORMAL); }, 150); }, getFocusedWin(win) { var focusedWin = {}; var elm = this.fm.getFocusedElementForWindow(win.top, true, focusedWin); return focusedWin.value; }, get fm() { delete this.fm; return this.fm = Components.classes["@mozilla.org/focus-manager;1"] .getService(Components.interfaces.nsIFocusManager); }, count: 0, init(cfmm) { this.count += 1; cfmm.addEventListener("mousedown", this); cfmm.addEventListener("mouseup", this); cfmm.addEventListener("unload", this); if (this.count == 1) this.cpmm.addMessageListener("%ID%:FromParent", this); }, destroy(cfmm) { this.count -= 1; cfmm.removeEventListener("mousedown", this); cfmm.removeEventListener("mouseup", this); cfmm.removeEventListener("unload", this); if (!this.count) this.cpmm.removeMessageListener("%ID%:FromParent", this); }, receiveMessage(msg) { if ("blink" in msg.data) this.blinkEnabled = msg.data.blink; }, unload(e) {this.destroy(e.target);}, forget: () => delete nsvo["%ID%"] }).cpmm = this)(%NSVO%);`);
Отсутствует
Просьба к умельцам. Поправьте пожалуйста кнопку Autocopy для последней версии 126.0.1 Очень полезная кнопочка
this.closest("toolbarpaletteitem") || (script => { var id = `CB${_id.slice(20)}:Autocopy`, pid = id + "Parent"; var nsvoStr = `Components.utils.import("resource://gre/modules/Services.jsm", {})`; var nsvo = eval(nsvoStr), {Services} = nsvo, parent = nsvo[pid]; if (!parent) { var cid = id + "Child", u = code => "data:," + encodeURIComponent(code); var pref = "CB.Autocopy.settings", topic = "quit-application-granted"; var PREF_ENABLED = 1, PREF_BLINK = 2, PREF_RESET = 4; (parent = nsvo[pid] = { init() { this.readSettings(); if (!this[PREF_ENABLED]) return; this.initChild(); if (this[PREF_RESET]) this.setObserver(true); }, destroy(reason) { var ud = reason[5] == "e"; if (ud || !this.obsAdded) this.saveSettings(); delete nsvo[pid]; if (reason == "delete") Services.prefs.clearUserPref(pref); if (!this[PREF_ENABLED]) return; this.destroyChild(); if (ud && this[PREF_RESET]) this.setObserver(false); }, get processURL() { delete this.processURL; this.frameURL = u(`${nsvoStr}["${cid}"].init(this);`); return this.processURL = u(script.replace(/%ID%/g, cid) .replace("%NSVO%", nsvoStr) .replace("%PREF%", pref) .replace("%PREF_BLINK%", PREF_BLINK) ); }, get frameURLDestroy() { delete this.frameURLDestroy; this.processURLDestroy = u(`${nsvoStr}["${cid}"].forget();`); return this.frameURLDestroy = u(`${nsvoStr}["${cid}"].destroy(this);`); }, initChild() { Services.ppmm.loadProcessScript(this.processURL, true); Services.mm.loadFrameScript(this.frameURL, true); }, destroyChild() { Services.mm.removeDelayedFrameScript(this.frameURL); Services.mm.loadFrameScript(this.frameURLDestroy, false); Services.ppmm.removeDelayedProcessScript(this.processURL); Services.ppmm.loadProcessScript(this.processURLDestroy, false); }, readSettings() { var val = Services.prefs.getIntPref(pref, 3); for(var setting of [PREF_ENABLED, PREF_BLINK, PREF_RESET]) this[setting] = Boolean(val & setting); }, saveSettings() { var settings = 0; for(var setting of [PREF_ENABLED, PREF_BLINK, PREF_RESET]) if (this[setting]) settings += setting; Services.prefs.setIntPref(pref, settings); }, btns: new Set(), register(btn) { this.btns.add(btn); btn._handleClick = this.click; btn.oncontextmenu = this.context; this.setImg(btn, this[PREF_ENABLED]); }, unregister(btn, reason) { this.btns.delete(btn); if (!this.btns.size) this.destroy(reason); }, setImg(btn, state) { (btn.icon || btn.ownerDocument.getAnonymousElementByAttribute( btn, "class", "toolbarbutton-icon" )).src = state ? "data:image/x-icon;base64,AAABAAEAEREAAAEAIADwBAAAFgAAACgAAAARAAAAIgAAAAEAIAAAAAAAyAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB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/+P/7//f/+f70///////T8qz/i9go+8P9ef9dqwCzAAACAAUJAAhquwHd7f7a//////z+//39/////f////3////9/////f////39/vz9/////dzzvv5v0AD1VqECqRUnAB8AAAAAAQACAGK0AL/J/Yf/8v7k/O3/1//u/9n/7v/Z/+7/2f/u/9n/7v/Z/+3/1//x/eP8vfxu/1WgAKYAAAUAAQIABAABAAAAAAAAHjcALmGzAMVquwLgarkC3Wq6At5qugLearoC3mq6At5qugLearkC3Wu8AeBbqgC3FScAHwAAAAACAwADAAAAAAAAAAAAAAAAAwQCAQQIAAgEBwAIBAcACAQHAAgEBwAIBAcACAQHAAgEBwAIBAgABwMDAgAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" : "data:image/x-icon;base64,AAABAAEAEREAAAEAIADwBAAAFgAAACgAAAARAAAAIgAAAAEAIAAAAAAAyAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAgEDAAQACAcEAAcIBAAHCAQABwgEAAcIBAAHCAQABwgEAAcIBAAHCAMBBAEAAAAAAAAAAAAAAAACAAMDAAAAABUAJx9cAKq3awG84GoBud1qAbreagG63moBut5qAbreagG63mgAuN1qAbrgYgCzxR4ANy8AAAAAAAABAAEAAgQABAAAVwCgprNW/f/Wqf7805///9Si///Uov//1KL//9Si///Uov//16f//9Wl/vy3Yv3/YwC0vwEBAAAAAAAAFQAoH1cAoalyAM/1hh/Y/Ywn3P2KI9v9iyTb/Ysl2/2LJdv9iybb/Yki2v2bQ+L927X9/Neq/v9qAbvdBQAJCAABAABeAKuzr1H7/8WP9Pu+f/H/vn/y/76A8v++gPL/voDy/75/8v+9fvL/wof0/4wq3P+eS+L93rT//2gAud0DAAcIBQAJCGsBvNzVp/3/4sH//d+7///hv///4b///+G////hv///4b///9+7/v/nyf//w4rx/4wr2v3guv//agK63gMABwgEAAcIagK53dWl///gwP793rv+/9++/v/gv/7/4L/+/+C//v/fvv7/3br+/+TG///BhvH/jy3b/eTD//9qA7reAwAHCAQABwhqArre2rD//+jP//3lyv//583//+fO///nzv//587//+fN///lyP7/7Nb//8WP8v+QL9v96c3//2oDut4DAAcIBAAHCGoCut7fuf//7tz//evW///t2f//7dr//+3a///t2v//7dn//+rV/v/y4///yJby/5Ax2/3s1f//agS63gMABwgEAAcIagK63uPB///z6P/98OH///Lk///z5f//8+X///Pl///y5P//8OD+//ju///LnfL/kTLb/fDc//9rBLreAwAHCAQABwhqArre5sn///jy//316v//9u3///fu///37///9+7///bt///06f7//fj//86j8v+RMtv98d///2oFud0DAAcIBAAHCGoCut7pz////Pr//fjx///69P//+vX///r1///69f//+vT///fw/v//////0ajx/5M12/305///awS83AQACQgEAAcIaQK53erR///+/v/9+vT///v3///8+P///Pj///z4///79///+fT+///////TrPL/iyjY+8N5/f9dAKuzAAIAAAUACQhqAbvd7dr+//////z+/f/9/////f////3////9/////f////39/P79/////dy+8/5vAND1VgKhqRUAJx8AAAAAAQIAAGIAtL/Jh/3/8uT+/O3X///u2f//7tn//+7Z///u2f//7tn//+3X///x4/38vW78/1UAoKYABQAAAQACBAAAAQAAAAAAHgA3LmEAs8VqArvgagK53WoCut5qArreagK63moCut5qArreagK53WsBvOBbAKq3FQAnHwAAAAACAAMDAAAAAAAAAAAAAAAAAwIEAQQACAgEAAcIBAAHCAQABwgEAAcIBAAHCAQABwgEAAcIBAAIBwMCAwAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; }, click() { var newState = parent[PREF_ENABLED] = !parent[PREF_ENABLED]; for(var btn of parent.btns) parent.setImg(btn, newState); newState ? parent.initChild() : parent.destroyChild(); if (parent[PREF_RESET]) parent.setObserver(newState); }, context(e) { if (e.ctrlKey || e.shiftKey) return; var btn = e.target; if (btn.btnPopup && e.detail > 1) return btn.btnPopup.hidePopup(); e.preventDefault(); (btn.btnPopup || parent.getPopup(btn)).openPopup(btn, "after_start"); }, getPopup(btn) { var win = btn.ownerGlobal, doc = win.document; var popup = doc.createElementNS(xulns, "menupopup"); popup.setAttribute("onclick", "event.stopPropagation();"); popup.setAttribute("oncommand", "handleCommand(event.target);"); popup.setAttribute("onpopupshowing", "handlePopupshowing();"); popup.menuitems = []; for(var [lab, pref] of win.Object.entries({ "Выделенный текст мигает при автокопировании": PREF_BLINK, "Выключать автокопирование при выходе из браузера": PREF_RESET })) { var menuitem = popup.appendChild(doc.createElementNS(xulns, "menuitem")); menuitem.setAttribute("label", lab); menuitem.setAttribute("type", "checkbox"); menuitem.pref = pref; popup.menuitems.push(menuitem); } popup.handleCommand = menuitem => { var newState = this[menuitem.pref] = menuitem.hasAttribute("checked"); if (!this[PREF_ENABLED]) return; if (menuitem.pref == PREF_BLINK) this.saveSettings(), Services.ppmm.broadcastAsyncMessage(cid + ":FromParent", {blink: newState}); else if (menuitem.pref == PREF_RESET) this.setObserver(newState); } popup.handlePopupshowing = () => { for(var menuitem of popup.menuitems) this[menuitem.pref] ? menuitem.setAttribute("checked", true) : menuitem.removeAttribute("checked"); } return btn.appendChild(btn.btnPopup = popup); }, obsAdded: false, setObserver(set) {this.obsAdded = set ? Services.obs.addObserver(this, topic, false) : Services.obs.removeObserver(this, topic); }, observe() { Services.obs.removeObserver(this, topic); this[PREF_ENABLED] = false; this.saveSettings(); } }).init(); } parent.register(this); addDestructor(reason => parent.unregister(this, reason), parent); })(`(nsvo => (nsvo["%ID%"] = { x: -1, y: -1, down: false, handleEvent(e) {e.button || this[e.type](e);}, mousedown(e) {this.x = e.screenX; this.y = e.screenY, this.down = true;}, mouseup(e) { var {down} = this; this.down = false; if (!down) return; if (e.screenX == this.x && e.screenY == this.y && (e.detail == 1 || e.target.matches( "textarea[disabled],input[disabled],button,select,summary" ))) return; var name = e.originalTarget.nodeName; if (/^(?:(?:xul:)?(?:slider|scrollbarbutton)|resizer)$/.test(name)) return; this.x = this.y = -1; var win = this.getFocusedWin(e.target.ownerGlobal); var sel = win.getSelection(); if (sel.toString()) { (win.docShell || win.document.docShell).doCommand("cmd_copy", null, win); this.blinkEnabled && this.blink(win, e.detail > 1); } }, blinkEnabled: Boolean( Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefService) .getIntPref("%PREF%", 3) & %PREF_BLINK% ), blink(win, pause) { if (pause) return win.setTimeout(() => this.blink(win), 100); var sc = (win.docShell || win.document.docShell) .QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsISelectionDisplay) .QueryInterface(Components.interfaces.nsISelectionController); sc.setDisplaySelection(sc.SELECTION_OFF); sc.repaintSelection(sc.SELECTION_NORMAL); win.setTimeout(() => { sc.setDisplaySelection(sc.SELECTION_ON); sc.repaintSelection(sc.SELECTION_NORMAL); }, 150); }, getFocusedWin(win) { var focusedWin = {}; var elm = this.fm.getFocusedElementForWindow(win.top, true, focusedWin); return focusedWin.value; }, get fm() { delete this.fm; return this.fm = Components.classes["@mozilla.org/focus-manager;1"] .getService(Components.interfaces.nsIFocusManager); }, count: 0, init(cfmm) { this.count += 1; cfmm.addEventListener("mousedown", this); cfmm.addEventListener("mouseup", this); cfmm.addEventListener("unload", this); if (this.count == 1) this.cpmm.addMessageListener("%ID%:FromParent", this); }, destroy(cfmm) { this.count -= 1; cfmm.removeEventListener("mousedown", this); cfmm.removeEventListener("mouseup", this); cfmm.removeEventListener("unload", this); if (!this.count) this.cpmm.removeMessageListener("%ID%:FromParent", this); }, receiveMessage(msg) { if ("blink" in msg.data) this.blinkEnabled = msg.data.blink; }, unload(e) {this.destroy(e.target);}, forget: () => delete nsvo["%ID%"] }).cpmm = this)(%NSVO%);`); (()=> { var code = ` function handleEvent(e) { if (e.button != 1) return; e.preventDefault(); e.stopPropagation(); sendSyncMessage("response",{},{}); } addEventListener('click', handleEvent, false); function removeListener() { removeMessageListener("destroy", removeListener); removeEventListener("click", handleEvent, false); } addMessageListener("destroy", removeListener); `; var url = "data:," + encodeURIComponent(code); var mm = window.getGroupMessageManager("browsers"); mm.loadFrameScript(url, true); function run(message) { insertText(gClipboard.read()); Services.console.logStringMessage(message.name); } mm.addMessageListener("response", run); addDestructor(() => { mm.removeDelayedFrameScript(url); mm.broadcastAsyncMessage("destroy"); mm.removeMessageListener("response", run); }); })(); // Ставить текст в текстовое поле ............. function insertText(text) { var docShell = "docShell" in document && document.docShell instanceof Ci.nsIDocShell ? document.docShell : window.docShell; function insert(text) { var params = "createCommandParams" in Components.utils ? Cu.createCommandParams() : Components.classes["@mozilla.org/embedcomp/command-params;1"].createInstance(Components.interfaces.nsICommandParams); params.setStringValue("state_data", text); docShell.doCommandWithParams("cmd_insertText", params); }; var br = document.activeElement; !br || br.localName != "browser" || !br.isRemoteBrowser ? insert(text) : br.messageManager.loadFrameScript(`data:,(${insert})(`+encodeURIComponent(text.toSource())+`)`, false, true); };
Отсутствует
Очень полезная кнопочка
Да брось ты. Лучше поищи для этого
какой-нибудь WebExtensions или обезьяний скрипт.
Но если прям хочется чего-то странного,
то можно попробовать подрядить SystemGlobal
/* var nsvoStr = `Components.utils.import("resource://gre/modules/Services.jsm", {})`; */ var nsvoStr = "Cu.getGlobalForObject(Cu)";
На форуме
Dumby
Извините Уважаемый, я поэтому и обращаюсь к умельцам, что сам абсолютный профан. Мне это ничего не говорит.
Не смогли бы вы, готовый код выложить, что бы я вставил и пользовался. Заранее благодарю.
Отсутствует