Dumby опять запнулся, вроде уже есть примеры, но до сих пор не могу понять для многопроцессорного режима, как объект вызывать.
Есть у меня такая кнопка (фрагмент):
var defaultURL = "data:text/html;base64," + window.btoa(unescape(encodeURIComponent( this.Help ))); // файл HTML this.onclick = e => { if (e.button == 0) { // запомнить текст из буфера обмена и скопировать текст на странице .... var clip = gClipboard.read(); goDoCommand("cmd_copy"); // открыть блокнот в новой вкладке gBrowser.selectedTab = gBrowser.addTrustedTab(defaultURL); gBrowser.addEventListener("pageshow", function(event) { this.removeEventListener("pageshow", arguments.callee, true); content.document.getElementById("req_message").value = gClipboard.read(); if (clip) gClipboard.write(clip); }, true); } if (e.button == 1) SidebarUI.toggle(id); }
var XML = window.XML || {}; var alertsService = Components.classes["@mozilla.org/alerts-service;1"].getService(Components.interfaces.nsIAlertsService); var buttImage = this.image; var menu = '<menupopup xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"\n\ xmlns:cb="http://xsms.nm.ru/custombuttons/">\n\ <menuitem\n\ class="menuitem-iconic"\n\ image="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGBgb/BgYG/wYGBv8GBgb/BgYG/wYGBv8GBgb/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgYG/wYGBv8AAAAAAAAAAAYGBv8GBgb/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAD//wAA//8AAP//AAAAAAAAAAAGBgb/BgYG/wYGBv8GBgb/BgYG/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAD//wAAAAAAAAAAAAAAAAAAAAAAAAAABgYG/wYGBv8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAAAAAAA//8AAAAAAAAAAAYGBv8GBgb/A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D/6xB5/+sQQ=="\n\ label="Все буквы прописные"\n\ onclick="' + e4xConv_encodeHTML("document.getElementById('" + this.id + "').allLowerCaseLetters(event)", true) + '"/> \n\ <menuitem\n\ class="menuitem-iconic"\n\ image="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/AAAA/wAAAP8AAAAAAAAA/wAAAP8AAAD/AAAA/wAAAAAGBgb/BgYG/wYGBv8GBgb/BgYG/wYGBv8GBgb/AAAAAAAAAP8AAAAAAAAAAAAAAAAAAAD/AAAA/wAAAAAAAAAABgYG/wYGBv8AAAAAAAAAAAYGBv8GBgb/AAAAAAAAAAAAAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAAAAAAAAAAAAAAGBgb/BgYG/wYGBv8GBgb/BgYG/wAAAAAAAAAAAAAAAAAAAP8AAAAAAAAA/wAAAP8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgYG/wYGBv8AAAAAAAAAAAAAAAAAAAD/AAAA/wAAAP8AAAD/AAAAAAAA//8AAP//AAAAAAYGBv8GBgb/AAAAAAYGBv8GBgb/AAAAAAAAAAAAAAAAAAAAAAAAAP8AAAD/AAAAAAAA//8AAP//AAD//wAA//8AAAAABgYG/wYGBv8GBgb/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8AAP//AAD//wAA//8AAP//AAD//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8AAP//AAAAAAAA//8AAP//AAAAAAAA//8AAP//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAD//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wAA//8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wAAAP8AAAD/AAAAAAAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAAAAAAA/wAAAP8AAAD/AAAA/wAAAAAAAAD/AAAAAAAAAAAAAAAAAAAA/wAAAP8AAAAAAAAAAAAAAP8AAAAAAAAAAAAAAAAAAAD/AAAA/wAAAAAAAAAAAAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAAAAAAAAAAAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAAAAAAAAAAAAAAAAAD/AAAAAAAAAP8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAP8AAAAAAAAA/wAAAP8AAAAAAAAAAAAAAAAAAAAAAAAA/wAAAP8AAAD/AAAA/wAAAAAAAAAAAAAAAAAAAAAAAAD/AAAA/wAAAP8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/AAAA/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8AAAD/AAAAAAAAAAAAAAAAEICsQbmZrEGBwaxB0/msQcJJrEHkI6xB+B+sQfJPrEH+f6xB/n+sQRAQrEG5uaxBgYGsQdPTrEHDw6xB5+esQQ=="\n\ label="Заглавная только первая буква"\n\ onclick="' + e4xConv_encodeHTML("document.getElementById('" + this.id + "').capitalizeFirstLetter(event)", true) + '"/> \n\ <menuitem\n\ class="menuitem-iconic"\n\ image="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8AAAD/AAAA/wAAAAAAAAD/AAAA/wAAAP8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wAAAAAAAAAAAAAAAAAAAP8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAD//wAA//8AAP//AAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYGBv8GBgb/BgYG/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/xCsQf+5rEHwgaxB/NOsQfrDrEH256xB7/+sQd//rEG//6xB//+sQQH/rEEz/6xBg/+sQfP/rEGT/6xBx/+sQQ=="\n\ label="Заглавные все буквы"\n\ onclick="' + e4xConv_encodeHTML("document.getElementById('" + this.id + "').capitalizeAllLetters(event)", true) + '"/> \n\ <menuitem\n\ class="menuitem-iconic"\n\ image="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////////////////////////////////////////////////////////////////////////////////wD/AP8AAAD//////wD/AP8AAAD/AAAAgAAAAP8AAACA/////wD/AP8AAAD/AAAApf////8A/wD///////////8A/wD///////////8A/wD///////////////////////////8A/wD/////////////////AP8A/////////////////////////////////////////////////////////////////////////////////////////////////wD/AP8AAAD/AAAApQAAAP//////AP8A/wAAAP//////AP8A/wAAAP8AAAC//////wD/AP8AAAD///////////8A/wD//////////////////////wD/AP///////////wD/AP////////////////8A/wD//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wAA//8AAP//AAD/////////////////////////////////////////////////////////////////////////////AAD//wAA////////////////////////////////////////////////////////////////////////AAD///////8AAP//////////////////////////////////////////////////////////////////AAD///////////////////////////////////////////////////////8AAAD/AAAA//////8AAAD/AAAApQAAAP8AAAClAAAA//////8AAAD/AAAA/wAAAKX/////AAAA//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8AAAD/AAAA9AAAAP4AAAD//////wAAAP8AAAD//////wAAAP8AAAD/AAAApf////8AAAD/AAAA////////////////////////////////////////////////////////////////////////////////////////////AACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQ=="\n\ label="Заглавные для выбранных слов"\n\ onclick="' + e4xConv_encodeHTML("document.getElementById('" + this.id + "').capitalizeSelectedWords(event)", true) + '"/> \n\ </menupopup>'; menu = menu.replace(/>\s+</g, "><"); var bool = XML.prettyPrinting; XML.prettyPrinting = false; var el = new DOMParser().parseFromString(menu, "application/xml").documentElement; XML.prettyPrinting = bool; this.appendChild(el); this.type = "menu"; this.orient = "horizontal"; this.menuClick = function(event) { event.preventDefault(); event.stopPropagation(); this.open = false; } /*------------------Регистр букв начало------------------*/ /*------------------Все буквы прописные------------------*/ this.allLowerCaseLetters = function(event) { if ( !this.intro.initMeth( this ) ) { return; } // End if ( !this.intro.initMeth( this ) ) var x = this.intro; with(x){ text += Highlight.toLowerCase(); nLen = text.length; text += eBlock; theBox.value = text; theBox.selectionStart = theBox.selectionEnd = nLen ; theBox.scrollTop = oPosition + nHeight; } }; //Заглавная только первая буква------------------ this.capitalizeFirstLetter = function(event) { if ( !this.intro.initMeth( this ) ) { return; } // End if ( !this.intro.initMeth( this ) ) var x = this.intro; with(x){ text += Highlight.substr( 0, 1 ).toUpperCase(); text += Highlight.substr( 1 ).toLowerCase(); nLen = text.length; text += eBlock; theBox.value = text; theBox.selectionStart = theBox.selectionEnd = nLen ; theBox.scrollTop = oPosition + nHeight; } }; //Заглавные все буквы------------------ this.capitalizeAllLetters = function(event) { if ( !this.intro.initMeth( this ) ) { return; } // End if ( !this.intro.initMeth( this ) ) var x = this.intro; with(x){ text += Highlight.toUpperCase(); nLen = text.length; text += eBlock; theBox.value = text; theBox.selectionStart = theBox.selectionEnd = nLen ; theBox.scrollTop = oPosition + nHeight; } }; //Заглавные для выбранных слов------------------ this.capitalizeSelectedWords = function(event) { if ( !this.intro.initMeth( this ) ) { return; } // End if ( !this.intro.initMeth( this ) ) var x = this.intro; with(x){ var tmp = ""; var tmpfront = ""; tmp += Highlight.substr( 0, 1 ).toUpperCase() + Highlight.substring(1, Highlight.length); // capitalise remaining words if(tmp.indexOf(" ") > 0) { while(tmp.indexOf(" ") > 0) //that's a SPACE not a null { var spaceswap = tmp.indexOf(" ") tmpfront += tmp.substr(0, spaceswap + 1); tmp = Highlight.substr(tmpfront.length, Highlight.length); tmp = tmp.substr(0, 1).toUpperCase() + tmp.substr(1, Highlight.length); } } text = tmpfront + tmp; gClipboard.write(text); goDoCommand("cmd_paste"); } }; // Button Code Block Start ------------------------ this.intro = { theBox: {}, startPos: 0, endPos: 0, oPosition: 0, oHeight: 0, text: '', nHeight: 0, Highlight: '', eBlock: '', cBoard: '', n: '', nLen: 0, arr: [], initMeth: function( oBtn ){ with( this ) { theBox = document.commandDispatcher.focusedElement; if ( theBox ) { startPos = theBox.selectionStart; endPos = theBox.selectionEnd; oPosition = theBox.scrollTop; oHeight = theBox.scrollHeight; text = theBox.value.substring(0,startPos); nHeight = theBox.scrollHeight - oHeight; Highlight = theBox.value.substring(startPos, endPos); eBlock = theBox.value.substring(endPos, theBox.value.length); n = ''; return true; } // End if ( this.theBox ) } // End with( this ) return false; } // End initMeth }; function e4xConv_encodeHTML(s, isAttr) { s = String(s) .replace(/&/g, "&") .replace(/</g, "<") .replace(/>/g, ">") .replace(/"/g, """); if(isAttr) { s = s .replace(/\t/g, "	") .replace(/\n/g, "
") .replace(/\r/g, "
"); } return s; }
Отсутствует
Есть стиль от Vitaliy V: прокрутка вкладок колёсиком мыши
Просьба к экспертам: переделать этот код, чтобы он работал не в userChrome.css, а в кнопке CustonButtons
<?xml version="1.0" encoding="UTF-8"?> <bindings xmlns="http://www.mozilla.org/xbl"> <binding id="wheeltabs"> <implementation> <field name="_eventListeners">[];</field> <field name="initialized">false;</field> <constructor><![CDATA[ if (!window.gBrowser) window.addEventListener("load", this, false); else this.init(); ]]></constructor> <destructor><![CDATA[ if (!this.initialized) return; this._eventListeners.forEach((args) => args[0].removeEventListener(args[1], args[2], args[3])); this.initialized = false; ]]></destructor> <method name="init"> <body><![CDATA[ if (this.initialized || !("tabContainer" in gBrowser)) return; this.initialized = true; var tabContain = gBrowser.tabContainer; this._addEventListener(tabContain, "wheel", function(event) { if (event.shiftKey || event.ctrlKey || event.altKey || event.metaKey) return; event.stopPropagation(); event.preventDefault(); this.advanceSelectedTab(event.deltaY < 0 ? 1 : -1, true); }, true); ]]></body> </method> <method name="handleEvent"> <parameter name="event"/> <body><![CDATA[ window.removeEventListener("load", this, false); this.init(); ]]></body> </method> <method name="_addEventListener"> <body><![CDATA[ arguments[0].addEventListener(arguments[1], arguments[2], arguments[3]); this._eventListeners.push(arguments); ]]></body> </method> </implementation> </binding> </bindings>
подключение кода в userChrome.css
@-moz-document url-prefix("chrome://browser/content/browser.x") { vbox#browser-border-end { -moz-binding: url("./bindings/wheeltabs.xml#wheeltabs") !important; display: -moz-box !important; } vbox#browser-border-end[hidden="true"] { visibility: collapse !important; width: 0 !important; padding: 0 !important; border: none !important; } }
Отсутствует
но до сих пор не могу понять для многопроцессорного режима, как объект вызывать
Совет: возьми бумажку, напиши на ней крупными буквами
«ЭТОГО ЗДЕСЬ НЕТ» и повесь куда-нибудь на видное место.
Когда захочется опять что-нибудь вызвать, сразу смотри на эту памятку.
Код кнопки исполняется в одном процессе, а то,
с чем ты хочешь оперировать, находится в другом процессе,
и к этому нельзя обратится напрямую.
Но можно посылать туда скрипты на исполнение.
И можно посылать туда сообщения и принимать сообщения оттуда.
Возвращаю твои коды, надеюсь не сильно испортил
var defaultURL = 'data:text/html;charset=utf-8,<textarea id="req_message" style="width: 400px; height: 300px;"/>'; var leftClick = () => { var msg = _id + ":NotepadPageShowAndPaste"; var url = "data:," + encodeURIComponent(`addEventListener("pageshow", () => { content.document.getElementById("req_message").focus(); docShell.doCommand("cmd_paste"); sendAsyncMessage("${msg}"); }, {once: true})`); var busy = 0, clip, listener = () => { if (clip) clip = gClipboard.write(clip); busy = 0; } messageManager.addMessageListener(msg, listener); addDestructor(() => messageManager.removeMessageListener(msg, listener)); var openTab = () => gBrowser.getBrowserForTab( gBrowser.selectedTab = gBrowser.addTrustedTab(defaultURL) ).messageManager.loadFrameScript(url, false); (leftClick = () => { if (busy && Date.now() - busy < 4e3) return; busy = Date.now(); // запомнить текст из буфера обмена и скопировать текст на странице .... clip = gClipboard.read(); goDoCommand("cmd_copy"); // открыть блокнот в новой вкладке setTimeout(openTab, 50); })(); } this.onclick = e => { if (!e.button) leftClick(); else if (e.button == 1) SidebarUI.toggle(id); }
(this.type != "menu" && (this.type = "menu") && !this.hasAttribute("is")) || (intro => { var popup = this.appendChild(document.createXULElement("menupopup")); this.onmousedown = e => { if (e.button) return; this.onmousedown = null; popup.setAttribute("context", ""); popup.setAttribute("oncommand", "handleCommand(event);"); popup.append(MozXULElement.parseXULToFragment(` <menuitem class="menuitem-iconic" image="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGBgb/BgYG/wYGBv8GBgb/BgYG/wYGBv8GBgb/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgYG/wYGBv8AAAAAAAAAAAYGBv8GBgb/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAD//wAA//8AAP//AAAAAAAAAAAGBgb/BgYG/wYGBv8GBgb/BgYG/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAD//wAAAAAAAAAAAAAAAAAAAAAAAAAABgYG/wYGBv8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAAAAAAA//8AAAAAAAAAAAYGBv8GBgb/AAAAAAYGBv8GBgb/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAAAAAAAAAAAAP//AAAAAAAAAAAAAAAABgYG/wYGBv8GBgb/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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D/AAAAAAAAAAAAAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAAAAAAAAAAAAAAAAAD/AAAAAAAAAP8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAP8AAAAAAAAA/wAAAP8AAAAAAAAAAAAAAAAAAAAAAAAA/wAAAP8AAAD/AAAA/wAAAAAAAAAAAAAAAAAAAAAAAAD/AAAA/wAAAP8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/AAAA/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8AAAD/AAAAAAAAAAAAAAAAEICsQbmZrEGBwaxB0/msQcJJrEHkI6xB+B+sQfJPrEH+f6xB/n+sQRAQrEG5uaxBgYGsQdPTrEHDw6xB5+esQQ==" label="Заглавная только первая буква" value="capitalizeFirstLetter"/> <menuitem class="menuitem-iconic" image="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8AAAD/AAAA/wAAAAAAAAD/AAAA/wAAAP8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wAAAAAAAAAAAAAAAAAAAP8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAD//wAA//8AAP//AAAAAAAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAD//wAAAAAAAAAAAAAA/wAAAAAAAAD/AAAA/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAAAAAAA//8AAAAAAAAAAAAAAP8AAAD/AAAA/wAAAP8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAAAAAAAAAAAAP//AAAAAAAAAAAAAAAAAAAA/wAAAP8AAAAAAA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ACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////////////////////////////////////////////////////////////////////////////////wD/AP8AAAD//////wD/AP8AAAD/AAAAgAAAAP8AAACA/////wD/AP8AAAD/AAAApf////8A/wD///////////8A/wD///////////8A/wD///////////////////////////8A/wD/////////////////AP8A/////////////////////////////////////////////////////////////////////////////////////////////////wD/AP8AAAD/AAAApQAAAP//////AP8A/wAAAP//////AP8A/wAAAP8AAAC//////wD/AP8AAAD///////////8A/wD//////////////////////wD/AP///////////wD/AP////////////////8A/wD//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wAA//8AAP//AAD/////////////////////////////////////////////////////////////////////////////AAD//wAA////////////////////////////////////////////////////////////////////////AAD///////8AAP//////////////////////////////////////////////////////////////////AAD///////////////////////////////////////////////////////8AAAD/AAAA//////8AAAD/AAAApQAAAP8AAAClAAAA//////8AAAD/AAAA/wAAAKX/////AAAA//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8AAAD/AAAA9AAAAP4AAAD//////wAAAP8AAAD//////wAAAP8AAAD/AAAApf////8AAAD/AAAA////////////////////////////////////////////////////////////////////////////////////////////AACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQ==" label="Заглавные для выбранных слов"\n\ value="capitalizeSelectedWords"/> `)); popup.handleCommand = e => { var br = document.activeElement; if (!br) return; var url = urls[e.target.value]; br.localName == "browser" && br.isRemoteBrowser ? br.messageManager.loadFrameScript(url, false) : Services.scriptloader.loadSubScript(url, window); } } var u = code => "data:," + encodeURIComponent( `(function(intro) {\n\tif (intro.initMeth()) with(intro) {${code}}\n})({${intro}})` ); var urls = { // Все буквы прописные -------------------------- get allLowerCaseLetters() { delete this.allLowerCaseLetters; return this.allLowerCaseLetters = u(` text += Highlight.toLowerCase(); nLen = text.length; text += eBlock; theBox.value = text; theBox.selectionStart = theBox.selectionEnd = nLen; theBox.scrollTop = oPosition + nHeight; `)}, // Заглавная только первая буква ---------------- get capitalizeFirstLetter() { delete this.capitalizeFirstLetter; return this.capitalizeFirstLetter = u(` text += Highlight.substr(0, 1).toUpperCase(); text += Highlight.substr(1).toLowerCase(); nLen = text.length; text += eBlock; theBox.value = text; theBox.selectionStart = theBox.selectionEnd = nLen ; theBox.scrollTop = oPosition + nHeight; `)}, // Заглавные все буквы -------------------------- get capitalizeAllLetters() { delete this.capitalizeAllLetters; return this.capitalizeAllLetters = u(` text += Highlight.toUpperCase(); nLen = text.length; text += eBlock; theBox.value = text; theBox.selectionStart = theBox.selectionEnd = nLen ; theBox.scrollTop = oPosition + nHeight; `)}, // Заглавные для выбранных слов ----------------- get capitalizeSelectedWords() { delete this.capitalizeSelectedWords; return this.capitalizeSelectedWords = u(` var tmp = "", tmpfront = ""; tmp += Highlight.substr(0, 1).toUpperCase() + Highlight.substring(1, Highlight.length); // capitalise remaining words if (tmp.indexOf(" ") > 0) while(tmp.indexOf(" ") > 0) { //that's a SPACE not a null var spaceswap = tmp.indexOf(" "); tmpfront += tmp.substr(0, spaceswap + 1); tmp = Highlight.substr(tmpfront.length, Highlight.length); tmp = tmp.substr(0, 1).toUpperCase() + tmp.substr(1, Highlight.length); } text = tmpfront + tmp; theBox.editor.QueryInterface(Ci.nsIPlaintextEditor).insertText(text); `)} }; })(` theBox: {}, arr: [], text: "", Highlight: "", eBlock: "", cBoard: "", n: "", startPos: 0, endPos: 0, oPosition: 0, oHeight: 0, nHeight: 0, nLen: 0, initMeth() { with(this) { theBox = Cc["@mozilla.org/focus-manager;1"] .getService(Ci.nsIFocusManager).focusedElement; if (!theBox) return false; startPos = theBox.selectionStart; endPos = theBox.selectionEnd; oPosition = theBox.scrollTop; oHeight = theBox.scrollHeight; text = theBox.value.substring(0, startPos); nHeight = theBox.scrollHeight - oHeight; Highlight = theBox.value.substring(startPos, endPos); eBlock = theBox.value.substring(endPos, theBox.value.length); n = ""; return true; } } `);
к экспертам
А что, простая копипаста не работает что ли?
(tc => addEventListener("wheel", event => { if (event.shiftKey || event.ctrlKey || event.altKey || event.metaKey) return; event.stopPropagation(); event.preventDefault(); tc.advanceSelectedTab(event.deltaY < 0 ? 1 : -1, true); }, true, tc || 1))(gBrowser.tabContainer);
Отсутствует
Dumby спасибо. Скажи так правильно будет
if (e.button == 0) { if (gMultiProcessBrowser){ leftClick(); } else { // запомнить текст из буфера обмена и скопировать текст на странице .... var clip = gClipboard.read(); goDoCommand("cmd_copy"); // открыть блокнот в новой вкладке gBrowser.selectedTab = gBrowser.addTrustedTab(defaultURL); gBrowser.addEventListener("pageshow", function(event) { this.removeEventListener("pageshow", arguments.callee, true); content.document.getElementById("req_message").value = gClipboard.read(); if (clip) gClipboard.write(clip); }, true); } ; }
Отредактировано Andrey_Krropotkin (20-07-2019 12:50:14)
Отсутствует
Andrey_Krropotkin
gMultiProcessBrowser это nsILoadContext.useRemoteTabs, а он getter-only,
значит менятся в этом окне уже не будет. Можно сделать типа
var leftClick = () => {
if (!gMultiProcessBrowser) return (leftClick = () => {
.......
})();
.......
}
Но и так вполне нормально.
Отсутствует
Dumby объясни еще раз пожалуйста как отправить в другой процесс скрипты или сообщения на исполнение
на примере вот этой функции
// Сохранить иконку текущего сайта с диалогом сохранения .............
function getSiteName() {
try { var domain = content.document.domain.split('.') } catch(e) { return "" };
domain = (domain.length == 2) ? domain[0] : domain[1]
return domain.charAt(0).toUpperCase() + domain.slice(1).split('.')[0] + " ";
};
function saveFavicon() { saveImageURL(gBrowser.selectedTab.image, getSiteName(), null, false, false, null, content.document) };
Некоторые простые функции я пустил через javascript и gBrowser. loadURI, но сложные не переводятся в бурмаклеты, вот например:
function SaveHTML(event) { var saveToFile = function (fileContent, fileName) { var uc = Components.classes['@mozilla.org/intl/scriptableunicodeconverter'].createInstance(Components.interfaces.nsIScriptableUnicodeConverter); uc.charset = 'utf-8'; fileContent = uc.ConvertFromUnicode(fileContent); var nsIFilePicker = Components.interfaces.nsIFilePicker; var fp = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker); fp.init(window, '', fp.modeSave); fp.defaultString = fileName; fp.appendFilters(fp.filterHTML); fp.appendFilters(fp.filterAll); fp.open(function (rv) { if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) { var stream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream); stream.init(fp.file, 0x02|0x20|0x08, 0666, 0); stream.write(fileContent, fileContent.length); stream.close(); } }); }; var resolveURL = function (url, base) { try { var ioService = Components.classes['@mozilla.org/network/io-service;1'].getService(Components.interfaces.nsIIOService); var baseURI = ioService.newURI(base, null, null); var absURI = ioService.newURI(url, null, baseURI); return absURI.spec; } catch (e) {} }; var getSelWin = function (w) { if (w.getSelection().toString()) return w; for (var i = 0, f, r; f = w.frames[i]; i++) { try { if (r = getSelWin(f)) return r; } catch(e) {} } }; var encodeImg = function (src, obj) { var canvas, img, ret = src; if (/^https?:\/\//.test(src)) { canvas = doc.createElement('canvas'); if (!obj || obj.nodeName.toLowerCase() != 'img') { img = doc.createElement('img'); img.src = src; } else { img = obj; }; if (img.complete) try{ canvas.width = img.width; canvas.height = img.height; canvas.getContext('2d').drawImage(img, 0, 0); ret = canvas.toDataURL((/\.jpe?g/i.test(src) ? 'image/jpeg' : 'image/png')); } catch (e) {}; if (img != obj) img.src = 'about:blank'; }; return ret; }; var toSrc = function (obj) { var strToSrc = function (str) { var chr, ret = '', i = 0, meta = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '\x22' : '\\\x22', '\\': '\\\\'}; while (chr = str.charAt(i++)) { ret += meta[chr] || chr; }; return '\x22' + ret + '\x22'; }, arrToSrc = function (arr) { var ret = []; for (var i = 0; i < arr.length; i++) { ret[i] = toSrc(arr[i]) || 'null'; }; return '[' + ret.join(',') + ']'; }, objToSrc = function (obj) { var val, ret = []; for (var prop in obj) { if (obj.hasOwnProperty(prop) && (val = toSrc(obj[prop]))) ret.push(strToSrc(prop) + ': ' + val); }; return '{' + ret.join(',') + '}'; }; switch (Object.prototype.toString.call(obj).slice(8, -1)) { case 'Array': return arrToSrc(obj); case 'Boolean': case 'Function': case 'RegExp': return obj.toString(); case 'Date': return 'new Date(' + obj.getTime() + ')'; case 'Math': return 'Math'; case 'Number': return isFinite(obj) ? String(obj) : 'null'; case 'Object': return objToSrc(obj); case 'String': return strToSrc(obj); default: return obj ? (obj.nodeType == 1 && obj.id ? 'document.getElementById(' + strToSrc(obj.id) + ')' : '{}') : 'null'; } }; var mainWin = document.commandDispatcher.focusedWindow.top == content ? document.commandDispatcher.focusedWindow : content var selWin = getSelWin(mainWin), win = selWin || mainWin, doc = win.document, loc = win.location; var ele, pEle, clone, reUrl = /(url\(\x22)(.+?)(\x22\))/g; if (selWin) { var rng = win.getSelection().getRangeAt(0); pEle = rng.commonAncestorContainer; ele = rng.cloneContents(); } else { pEle = doc.documentElement; ele = (doc.body || doc.getElementsByTagName('body')[0]).cloneNode(true); }; while (pEle) { if (pEle.nodeType == 1) { clone = pEle.cloneNode(false); clone.appendChild(ele); ele = clone; }; pEle = pEle.parentNode }; var sel = doc.createElement('div'); sel.appendChild(ele); for (var el, all = sel.getElementsByTagName('*'), i = all.length; i--;) { el = all[i]; if (el.style && el.style.backgroundImage) el.style.backgroundImage = el.style.backgroundImage.replace(reUrl, function (a, prev, url, next) { if (!/^[a-z]+:/.test(url)) url = resolveURL(url, loc.href); return prev + encodeImg(url) + next; }); switch (el.nodeName.toLowerCase()) { case 'link': case 'style': case 'script': el.parentNode.removeChild(el); break; case 'a': case 'area': if (el.hasAttribute('href') && el.getAttribute('href').charAt(0) != '#') el.href = el.href; break; case 'img': case 'input': if (el.hasAttribute('src')) el.src = encodeImg(el.src, el); break; case 'audio': case 'video': case 'embed': case 'frame': case 'iframe': if (el.hasAttribute('src')) el.src = el.src; break; case 'object': if (el.hasAttribute('data')) el.data = el.data; break; case 'form': if (el.hasAttribute('action')) el.action = el.action; break; } }; var head = ele.insertBefore(doc.createElement('head'), ele.firstChild); var meta = doc.createElement('meta'); meta.httpEquiv = 'content-type'; meta.content = 'text/html; charset=utf-8'; head.appendChild(meta); var title = doc.getElementsByTagName('title')[0]; if (title) head.appendChild(title.cloneNode(true)); head.copyScript = function (unsafeWin) { if ('$' in unsafeWin) return; var f = doc.createElement('iframe'); f.src = 'about:blank'; f.setAttribute('style', 'position:fixed;left:0;top:0;visibility:hidden;width:0;height:0;'); doc.documentElement.appendChild(f); var str, script = doc.createElement('script'); script.type = 'text/javascript'; for (var name in unsafeWin) { if (name in f.contentWindow || !/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name)) continue; try { str = toSrc(unsafeWin[name]); if (!/\{\s*\[native code\]\s*\}/.test(str)) { script.appendChild(doc.createTextNode('var ' + name + ' = ' + str.replace(/<\/(script>)/ig, '<\\/$1') + ';\n')); } } catch (e) {}; }; f.parentNode.removeChild(f); if (script.childNodes.length) this.nextSibling.appendChild(script); }; head.copyScript(win.wrappedJSObject || win); head.copyStyle = function (s) { if (!s) return; var style = doc.createElement('style'); style.type = 'text/css'; if (s.media && s.media.mediaText) style.media = s.media.mediaText; try { for (var i = 0, rule; rule = s.cssRules[i]; i++) { if (rule.type != 3) { if((!rule.selectorText || rule.selectorText.indexOf(':') != -1) || (!sel.querySelector || sel.querySelector(rule.selectorText))) { var css = !rule.cssText ? '' : rule.cssText.replace(reUrl, function (a, prev, url, next) { if (!/^[a-z]+:/.test(url)) url = resolveURL(url, s.href || loc.href); if(rule.type == 1 && rule.style && rule.style.backgroundImage) url = encodeImg(url); return prev + url + next; }); style.appendChild(doc.createTextNode(css + '\n')); } } else { this.copyStyle(rule.styleSheet); } } } catch(e) { if (s.ownerNode) style = s.ownerNode.cloneNode(false); }; this.appendChild(style); }; var sheets = doc.styleSheets; for (var j = 0; j < sheets.length; j++) head.copyStyle(sheets[j]); head.appendChild(doc.createTextNode('\n')); var doctype = '', dt = doc.doctype; if (dt && dt.name) { doctype += '<!DOCTYPE ' + dt.name; if (dt.publicId) doctype += ' PUBLIC \x22' + dt.publicId + '\x22'; if (dt.systemId) doctype += ' \x22' + dt.systemId + '\x22'; doctype += '>\n'; }; var fileName = selWin ? win.getSelection().toString() : (title && title.text ? title.text : loc.pathname.split('/').pop()); fileName = fileName.replace(/[:\\\/<>?*|"]+/g, '_').replace(/\s+/g, ' ').slice(0, 100).replace(/^\s+|\s+$/g, ''); fileName += (function () { var d = new Date(), z = function(n){return '_' + (n < 10 ? '0' : '') + n}; return z(d.getHours()) + z(d.getMinutes()) + z(d.getSeconds()); })(); if(!/\.html?$/.test(fileName))fileName += '.html'; saveToFile(doctype + sel.innerHTML + '\n<!-- This document saved from ' + (loc.protocol != 'data:' ? loc.href : 'data:uri') + ' -->', fileName); }
javascript:(function(){var getSelWin=function(w){if(w.getSelection().toString())return w;for(var i=0,f,r;f=w.frames[i];i++){try{if(r=getSelWin(f))return r}catch(e){}}};var selWin=getSelWin(window),win=selWin||window,doc=win.document,loc=win.location;var qualifyURL=function(url,base){if(!url||/^([a-z]+:|%23)/.test(url))return url;var a=doc.createElement('a');if(base){a.href=base;a.href=a.protocol+(url.charAt(0)=='/'%3F(url.charAt(1)=='/'%3F'':'//'+a.host):'//'+a.host+a.pathname.slice(0,(url.charAt(0)!='%3F'&&a.pathname.lastIndexOf('/')+1)||a.pathname.length))+url}else{a.href=url};return a.href};var encodeImg=function(src,obj){var canvas,img,ret=src;if(/^https%3F:%5C/%5C//.test(src)){canvas=doc.createElement('canvas');if(!obj||obj.nodeName.toLowerCase()!='img'){img=doc.createElement('img');img.src=src}else{img=obj};if(img.complete)try{canvas.width=img.width;canvas.height=img.height;canvas.getContext('2d').drawImage(img,0,0);ret=canvas.toDataURL((/%5C.jpe%3Fg/i.test(src)%3F'image/jpeg':'image/png'))}catch(e){};if(img!=obj)img.src='about:blank'};return ret};var toSrc=function(obj){var strToSrc=function(str){var chr,ret='',i=0,meta={'%5Cb':'%5C%5Cb','%5Ct':'%5C%5Ct','%5Cn':'%5C%5Cn','%5Cf':'%5C%5Cf','%5Cr':'%5C%5Cr','%5Cx22':'%5C%5C%5Cx22','%5C%5C':'%5C%5C%5C%5C'};while(chr=str.charAt(i++)){ret+=meta[chr]||chr};return'%5Cx22'+ret+'%5Cx22'},arrToSrc=function(arr){var ret=[];for(var i=0;i<arr.length;i++){ret[i]=toSrc(arr[i])||'null'};return'['+ret.join(',')+']'},objToSrc=function(obj){var val,ret=[];for(var prop in obj){if(Object.prototype.hasOwnProperty.call(obj,prop)&&(val=toSrc(obj[prop])))ret.push(strToSrc(prop)+': '+val)};return'{'+ret.join(',')+'}'};switch(Object.prototype.toString.call(obj).slice(8,-1)){case'Array':return arrToSrc(obj);case'Boolean':case'Function':case'RegExp':return obj.toString();case'Date':return'new Date('+obj.getTime()+')';case'Math':return'Math';case'Number':return isFinite(obj)%3FString(obj):'null';case'Object':return objToSrc(obj);case'String':return strToSrc(obj);default:return obj%3F(obj.nodeType==1&&obj.id%3F'document.getElementById('+strToSrc(obj.id)+')':'{}'):'null'}};var ele,pEle,clone,reUrl=/(url%5C(%5Cx22%3F)(.+%3F)(%5Cx22%3F%5C))/g;if(selWin){var rng=win.getSelection().getRangeAt(0);pEle=rng.commonAncestorContainer;ele=rng.cloneContents()}else{pEle=doc.documentElement;ele=(doc.body||doc.getElementsByTagName('body')[0]).cloneNode(true)};while(pEle){if(pEle.nodeType==1){clone=pEle.cloneNode(false);clone.appendChild(ele);ele=clone};pEle=pEle.parentNode};var sel=doc.createElement('div');sel.appendChild(ele);for(var el,all=sel.getElementsByTagName('*'),i=all.length;i--;){el=all[i];if(el.style&&el.style.backgroundImage)el.style.backgroundImage=el.style.backgroundImage.replace(reUrl,function(a,b,c,d){return b+encodeImg(qualifyURL(c))+d});switch(el.nodeName.toLowerCase()){case'link':case'style':case'script':el.parentNode.removeChild(el);break;case'a':case'area':if(el.hasAttribute('href')&&el.getAttribute('href').charAt(0)!='%23')el.href=el.href;break;case'img':case'input':if(el.hasAttribute('src'))el.src=encodeImg(el.src,el);break;case'audio':case'video':case'embed':case'frame':case'iframe':if(el.hasAttribute('src'))el.src=el.src;break;case'object':if(el.hasAttribute('data'))el.data=el.data;break;case'form':if(el.hasAttribute('action'))el.action=el.action;break}};var head=ele.insertBefore(doc.createElement('head'),ele.firstChild);var meta=doc.createElement('meta');meta.httpEquiv='content-type';meta.content='text/html; charset=utf-8';head.appendChild(meta);var title=doc.getElementsByTagName('title')[0];if(title)head.appendChild(title.cloneNode(true));head.copyScript=function(){if('$'in win)return;var f=doc.createElement('iframe');f.src='about:blank';f.setAttribute('style','position:fixed;left:0;top:0;visibility:hidden;width:0;height:0;');doc.documentElement.appendChild(f);var str,script=doc.createElement('script');script.type='text/javascript';for(var name in win){if(name in f.contentWindow||!/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name))continue;try{str=toSrc(win[name]);if(!/%5C{%5Cs*%5C[native code%5C]%5Cs*%5C}/.test(str)){script.appendChild(doc.createTextNode('var '+name+' = '+str.replace(/<%5C/(script>)/ig,'<%5C%5C/$1')+';%5Cn'))}}catch(e){}};f.parentNode.removeChild(f);if(script.childNodes.length)this.nextSibling.appendChild(script)};head.copyScript();head.copyStyle=function(s){if(!s)return;var style=doc.createElement('style');style.type='text/css';if(s.media&&s.media.mediaText)style.media=s.media.mediaText;try{for(var i=0,rule;rule=s.cssRules[i];i++){if(rule.type!=3){if((!rule.selectorText||rule.selectorText.indexOf(':')!=-1)||(!sel.querySelector||sel.querySelector(rule.selectorText))){style.appendChild(doc.createTextNode(rule.cssText.replace(reUrl,function(a,b,c,d){var url=qualifyURL(c,s.href);if(rule.type==1&&rule.style&&rule.style.backgroundImage)url=encodeImg(url);return b+url+d})+'%5Cn'))}}else{this.copyStyle(rule.styleSheet)}}}catch(e){if(s.ownerNode)style=s.ownerNode.cloneNode(false)};this.appendChild(style)};var sheets=doc.styleSheets;for(var j=0;j<sheets.length;j++)head.copyStyle(sheets[j]);head.appendChild(doc.createTextNode('%5Cn'));var doctype='',dt=doc.doctype;if(dt&&dt.name){doctype+='<!DOCTYPE '+dt.name;if(dt.publicId)doctype+=' PUBLIC %5Cx22'+dt.publicId+'%5Cx22';if(dt.systemId)doctype+=' %5Cx22'+dt.systemId+'%5Cx22';doctype+='>%5Cn'};loc.href='data:text/phf;charset=utf-8,'+encodeURIComponent(doctype+sel.innerHTML+'%5Cn<!-- This document saved from '+(loc.protocol!='data:'%3Floc.href:'data:uri')+' -->')})();
Отредактировано Andrey_Krropotkin (22-07-2019 23:53:03)
Отсутствует
объясни еще раз пожалуйста как отправить в другой процесс скрипты или сообщения на исполнение
на примере вот этой функции
Не, функция кривовата для примера, давай упростим,
раз уж затруднение вызывает сама концепция.
Задаём имя для сообщения, что-нибудь с претензией на уникальность,
чтобы не пересекалось с другими кодами.
Пишем код для исполнения там, в другом процессе, в ContentFrameMessageManager'е.
В этом окружении предопределён метод sendAsyncMessage() для отправки сообщений,
и есть content, который, так же как здесь в однопрцессье, ссылается на контентское окно.
Код состоит из одной строки и отправляет в сообщении наш domain.
Теперь собираем адрес frame script'а. Ставим в начало «data:,» и присоединяем код.
Текст скрипта не энкодим, здесь он простой, будет работать и так.
Затем определяем листенер. В первом агументе будет пришедшее сообщение.
Далее получаем ссылку на оконный message manager и просим его
зарегистрировать наш листенер. Ну и добавляем деструктор для удаления листенера.
Наконец, переопределяем что будет происходить по клику:
просим message manager <browser>'а активной вкладки загрузить туда скрипт с нашим адресом.
Ну и сразу вызываем, потому что уже кликнуто.
Скрипт отработает там, отправит сообщение сюда,
листенер подхватит сообщение и выведет алертом результат.
this._handleClick = () => { var messageName = "CB:Test:GetContentDocumentDomain"; var code = ` sendAsyncMessage("${messageName}", content.document.domain); `; var scriptURL = "data:," + /*encodeURIComponent*/(code); var listener = message => { Services.prompt.alert(window, message.name, message.data); } var wmm = window.messageManager; wmm.addMessageListener(messageName, listener); addDestructor(() => wmm.removeMessageListener(messageName, listener)); (this._handleClick = () => gBrowser.selectedBrowser .messageManager.loadFrameScript(scriptURL, false) )(); }
не переводятся в бурмаклеты, вот например
Ну ещё бы, где букмарклеты и где Components
Был бы признателен если бы Вы бурмаклет подправили
Странно меня про них спрашивать. Не знаю, может попробуй сменить концовку
/* loc.href = 'data:text/phf;charset=utf-8,' + encodeURIComponent(doctype + sel.innerHTML + '\n<!-- This document saved from ' + (loc.protocol != 'data:' ? loc.href : 'data:uri') + ' -->') */ var href = 'data:text/html;charset=utf-8,' + encodeURIComponent(doctype + sel.innerHTML + '\n<!-- This document saved from ' + (loc.protocol != 'data:' ? loc.href : 'data:uri') + ' -->'); var a = document.documentElement.appendChild(document.createElement("a")); a.setAttribute("href", href); var name = "Some Name"; a.setAttribute("download", name + ".html"); a.click(); a.remove(); })();
Отсутствует
Dumby Большое спасибо, буду разбираться.
Отсутствует
Dumby вроде несколько кнопок по Вашему уроку подправил для многопроцессорного. Сейчас запнулся вот на такой кнопке:
// Save, от 07.03.2017. ............. self.label = "Save"; self._handleClick =()=> menuPopup.openPopup(this, "after_start"); self.image = "data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAAAAADAgBEDRIXnwxQjKQNWp6pDFWXqAxXm6gMV5moDFeaqAxXmqgMV5qoDFebqAxVlqgNW5+pCkyIogwSFqgDAgBHDQoFhyszOv8hheP+IJH7/x+L8v8fjfb/H433/x+N9v8fjfb/H432/x+N9/8fi/L/IJH7/yGF5P0kLTTvDAcDgwgICIQ8Ojf/0czA+Oji1fzh18r85NzO/OTbz/zj287849vO/OPbzvzk3M/84dfK++ji1f3Sy8D5NDIvywYGB3kKCgqFQ0A8/+XXw/v979f/9uTO//rp0f/66NH/+ujR//rn0f/66NH/+ujR//bkzv/979f/5tfD/UZBPv8KCwqEDQwMhUVDQP/f08X7+OrZ/+zf0P/v5NP/8OPT/+/j0//v4tP/8OPT/+/j0//s39D/+OrZ/+DTxfxEQj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users\\vieva\\Desktop"; // папка для сохранения иконок для ярлыков и ярлыков сайтов var alertsService = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService); // Создать меню для кнопки ............. var array = [ { label: "Сохранить значок веб-сайта", func: "saveFavicon()", image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAACPVBMVEX09ff////C3L+Uq8+Vq8+Uqs+Zr9CZrtCZr9Gfu+ear8+mt9JRf8ORxl3t8vfF06+Twojs8/d9otl8o9s+aquZrs/X9KLp8Pft8fZhisf//+DBzN2hveihv+pii8hti9pgicl6oNlojs1zncNsi836/P2duebx8/eYyWqBp+Gn0IKBvlKHsm9qmaVuk8zt7/FEbauEv1Tp7/JdhL9oi9Pl8e2LwlmdsdD7/P76+/3H7ofo8+peh8eHwFaSteZ0pkp2gl7q8/Ohy5OApt2by2eZuOqbuOWaezWuvtd7nN2HvWxul9Ty9feQxV5ljcqBp+JEcLCVtOOo0nR7odx5n9suX6Z1mtBzmtSXyGPv9PewzfOzx+O6zu/s8fd9o95Xfrthi8lYhMN5oNnw9ffw9Pjw9Pf8/f6ewO/m8O9zmdE6aapsjdyUwouPxWPDzd6XteOSs9B5nNVpnpqHt7h/s6F6n9d7ntSTttGHwVh4qp+Ev1HH7ox6qk5wj+Hm8e3t9fOm0IKAtqOBpNrx+P9ljcyhs9FpkM2hv+/u8/fF0eOLu4N+vFKgzX3p9OSFqN13qExekIl4n9j7/P3x9PhxmNDm8e9Vg8Zfkozr8veq0YTX9qL//92AtamOwnHFz96Fot1diMh+pd13ntmatu+YyW/3+/+Tqs5UgcShzJNbhsdTf8GHs7bo8PaXtuqMr+Ty8/SZt+SUqs7r7Ox3ndb9/f7t8feZyXGYyWWCpNbz9PRuiteNtNDn7/V4ntjx8fGo3JqNAAAAv3RSTlP/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AEVuhDkAAAD+SURBVBhXY5jHzcUMAqxAICq9bx8D96adDFAgaGQOFOBaH7h7zoqZDTlFyptncAAFWBjyi52CXCI0unRLxcECPhsatbbzmlXMnS60hg0kkOxW0uNrq93tNaFpD1ggUm21QK532ZQdSm1hmXKdDCwdnOWVOi1RjNGMQCCrwMDMJ8NZ4LAynVGPkXFp8zpJBubYmn579wXtqhZb0iwn9a1iWLaViYmJ3891obOwYtLEvcYMGyWAAkwJdv6accEhi8LjGVr11SenpC5f61g3NcO0vjCAIc+DjZ2dnWexddWSbYa9nlkM+8BgWsxsK7FZ1VLzRaACNokmtdnyu1QMQgF7Rlh4zWWTAwAAAABJRU5ErkJggg=="}, { label: "Запомнить значок веб-сайта как base64", func: "copyFaviconData()", image: "data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAAAAAAAAAAAAAI2bv/9RVpf/AAAAAAAAAAAAAAAAAAAA/wbwAf8G8AH/BvAB/wbwAf8G8AH/BvAB/wbwAf8G8AH/AAAAAAAAAACIkvD/Jia6/ywpq/8AAAAAAAAAAAAAAAAAAAD/AAAA/wbwAf90qpv/Ymic/1RWqP9OUKr/W2Ch/2dumf9YYKT/Ly/B/xQP3/8MB9P/JCGb/wAAAAAAAAAAAAAAAAAAAP8G8AH/U5ea/ycr8f8VIP3/HiP4/ywo8v8sIvb/LCL2/ywi9v8KBOj/BQDe/wQAtv8tK4P/AAAAAAAAAAAAAAD/BvAB/3Sqm/9iaJz/Tim3/0UuuP9GPrT/R0ex/zk8uf8gIMz/FRDe/xEMzv8jIJz/AAAAAAAAAAAAAAAAAAAA/wbwAf8G8AH/BvAB/wAAAAAAAAAAAAAAAAAAAP8AAAD/SqOR/yImvP8sLKj/AAAAAAAAAAAAAAAAAAAAAAAAAP8G8AH/BvAB/wbwAf8AAAD/AAAA/wAAAP8AAAD/BvAB/3Sqm/9KW5r/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/BvAB/wbwAf8G8AH/BvAB/wbwAf8G8AH/BvAB/wbwAf8G8AH/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wbwAf8G8AH/BvAB/wbwAf8G8AH/BvAB/wbwAf8G8AH/BvAB/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8G8AH/BvAB/wbwAf8AAAAAAAAAAAAAAAAAAAAABvAB/wbwAf8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/BvAB/wbwAf8G8AH/AAAAAAAAAAAAAAAAAAAAAAAAAAAG8AH/AAAAAAAAAP8G8AH/AAAAAAAAAAAAAAAAAAAA/wbwAf8G8AH/BvAB/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8G8AH/BvAB/wAAAAAAAAAAAAAAAAAAAP8G8AH/BvAB/wbwAf8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/BvAB/wbwAf8AAAAAAAAA/wAAAP8G8AH/BvAB/wbwAf8G8AH/BvAB/wbwAf8G8AH/BvAB/wbwAf8G8AH/BvAB/wbwAf8G8AH/AAAAAAAAAAAG8AH/BvAB/wbwAf8G8AH/BvAB/wbwAf8G8AH/BvAB/wbwAf8G8AH/BvAB/wbwAf8G8AH/BvAB/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOesQQBjrEGAAaxBwACsQcABrEHDg6xBwAesQcAPrEHAD6xBw8+sQcPprEHD8axBwAGsQQABrEGAAaxB//+sQQ=="}, { separator: ''}, { label: "Сохранить ярлык страницы как…", func: "saveShortcuts()", image: "data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADzqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA/5XLDv/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA/5XLDv8E/yT/lcsO//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA/5XLDv8E/yT/BP8k/wT/JP+Vyw7/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA/5XLDv8E/yT/BP8k/wT/JP8E/yT/BP8k/5XLDv/zqgD/86oA//I1///yNf//86oA//OqAP/zqgD/86oA//OqAP+Vyw7/lcsO/wT/JP8E/yT/BP8k/5XLDv+Vyw7/86oA//OqAP/yNf//8jX///OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP+Vyw7/BP8k/5XLDv/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/lcsO/wT/JP+Vyw7/86oA//OqAP/zqgD/86oA//02AP/9NgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA/5XLDv8E/yT/lcsO//OqAP/zqgD/86oA//OqAP/9NgD//TYA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP+Vyw7/BP8k/5XLDv/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/lcsO/wT/JP+Vyw7/86oA//OqAP/zqgD/86oA/wA31v8AN9b/86oA//9If///SH//86oA//OqAP/zqgD/86oA/5XLDv8E/yT/lcsO//OqAP/zqgD/86oA//OqAP8AN9b/ADfW//OqAP//SH///0h///OqAP/zqgD/86oA//OqAP+Vyw7/BP8k/5XLDv/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/lcsO/5XLDv+Vyw7/86oA//OqAP/zqgD/86oA/0CA//9AgP//86oA/07+9f9O/vX/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP9AgP//QID///OqAP9O/vX/Tv71//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/AACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQ=="}, { separator: ''}, { label: "Сохранить всю страницу как PNG", func: "WebScreenShotoncaptureAll()", image: "data:image/x-icon;base64,AAABAAEAEREAAAEAIADwBAAAFgAAACgAAAARAAAAIgAAAAEAIAAAAAAAyAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAzAAAAiAcFBa4KCQmvCgkJrwoJCa8KCQmvCgkJrwoJCa8KCQmvCgkJrwoJCa8KCQmvCgkJrwsJCaECAQE/BQMDAAAAAJUgICD4V1ZW/2FhYf5hYWH/YmFh/2BgYP9fX1//X19f/19fX/9gYGD/YmFh/2FhYf9gYGD+ZmVl/1RSUuIVFBQtCgkJy1paWv+Li4v9h4eH/oiIiP6FhYX+i4uL/pKSkv6Sk5P+kpKS/ouLi/6FhYX+iIiI/oiIiP6Hh4f7lZaW/25tbYQNDQ3OcHBw/5KSkv6Li4v/i4uL/5mZmf+EhIT/ZGRk/1tbWv9kZGT/hISE/5mZmf+Li4v/jY2N/4yMjPyWl5f/iomJjQ4NDc13d3f/m5ub/pWVlf+goKD/XFxc/ygoKP8fHyD/GBsb/yAhIv8pKSn/W1tb/6CgoP+Wlpb/lpaW/J6env+Jh4eMDg4OzX1+fv+ioqL+qqqq/1hYWP8ZGRn/Ghwb/x4dHP8mIh//FhQR/xUWF/8aGhr/WFhY/6urq/+cnJz8pKSk/4qJiYwPDg7Ng4OD/7W1tf6MjIz/Ghoa/xYYGP8uKCb/ZEAo/5xyOP++saL/RD45/xISE/8bGxv/jY2N/6+vr/ypqan/ioiIjA8PD82IiIj/xMTE/l1cXP8LDAz/JiId/1o3LP9ADgD/mGog//Dt6P/VysX/Ih4Z/wsMDf9eXl7/v7+//K6urv+KiYmMEA8PzY+Pj//Kysr+SEhH/wEDBv9MPi7/hlES/3dCAP+VZAn/tJVO/7eVXf9OQTL/AAIE/0pJSf/FxcX8tLS0/4qJiYwQEBDNm5ub/9/e3/5SUlL/AAAA/0M7Mf/aya7/ybiO/5RmEf9aIAD/cjkX/z80KP8AAAD/U1JS/9nZ2fzAwMD/i4qKjBEREc2oqKn/8O/w/oeGhv8AAAD/DAsK/6qkof/17uj/nW8l/14eCf9hPTr/ExUU/wAAAP+Hh4f/6urq/MzMzf+Mi4uMERERzbCwsv/r6uz+3Nzd/yoqKv8AAAD/ExEP/2heU/9yWjv/UD0u/xcXFv8AAAD/Kioq/93d3v/l5eb81NTV/4yLi4wSERHNuLm5/+/v8P7z8/P/xsbG/yAgIP8AAAD/AQEB/wAAAP8BAQH/AAAA/yAgIP/Gxsb/9PT0/+np6vzb29v/jIuLjBIREc2+vb7/+Pj5/uvr7P/7+/v/4ODg/3Nyc/8uLi7/Hh4d/y0sLP9zc3P/4ODg//v7+//s7O3/8/P0/OHg4f+Mi4uLFBMTyMPDw//////7+Pj4/ff29v38/Pz9/////fr6+v3u7u79+vr6/f////38/Pz99/b2/fn5+f37+/v53t7e/5KSko4GBgZ7m5yc//j4+P/w8fH/8fLy//Dw8P/u7u7/8vLy//X19f/y8vL/7u7u//Dw8P/x8vL/8vLy/uXl5f/BwcH+k5GRUAAAAAQeHR1yb25uxn59fcZ9fHzGfXx8xn18fMZ9e3vGfHt7xn17e8Z9fHzGfXx8xn18fMZ9fHzGgH9/xYmIiGVaV1cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="}, { label: "Сохранить видимую часть страницы как PNG", func: "WebScreenShotoncapturePage()", image: false}, { label: "Сохранить выбранный элемент страницы как PNG", func: "WebScreenShotByClick.init()", image: "data:image/x-icon;base64,AAABAAEAIBkAAAEAIAAMDQAAFgAAACgAAAAgAAAAMgAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD29fT/2tra/8jIyP/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/FxcX/xcXF/8jIyP/a2tr/9vX0/+zs7P/ak0b/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/9qTRv/s7Oz/7Ozs/+J9Dv/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+/6SdmP/8+/r//Pv6//z7+v/8+/r//Pv6//z7+v/8+/r//Pv6//z7+v/8+/r/+vn4//z7+v/6+fj/4n0O/+zs7P/s7Oz/4n0O//z7+v/8+/r//Pv6//z7+v/8+/r//Pv6//z7+v/8+/r//Pv6//z7+v/8+/r//Pv6//z7+v/8+/r/aFtT//Lw7//y8O//8vDv//Lw7//y8O//8vDv//Lw7//y8O//8vDv//Lw7//y8O//8vDv//j39v/ifQ7/7Ozs/+zs7P/ifQ7/+vn4//r5+P/6+fj/+vn4//r5+P/6+fj/+vn4//r5+P/6+fj/+vn4//r5+P/6+fj/+vn4//r5+P9oW1P/7+zq/+/s6v/v7Or/8O3r//Dt6//w7ev/8O3r//Dt6//w7ev/8O3r/+/s6v/w7ev/9fTy/+J9Dv/s7Oz/7Ozs/+J9Dv/49/b/+Pf2//r5+P/6+fj/+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/s7Oz/9fTy/+J9Dv/8+/r/+vn4//r5+P/6+fj/+vn4//r5+P/6+fj/+vn4//r5+P/6+fj/+vn4//r5+P/6+fj/+vn4//r5+P/6+fj/+vn4//r5+P/6+fj/+vn4//r5+P/6+fj/+vn4//r5+P/6+fj/+vn4//r5+P/6+fj/4n0O//X08v/8+/r/6KFU/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ooVT//Pv6/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="}, { label: "Сохранить выбранную область страницы как PNG", func: "WebScreenShotByClipping.init()", image: "data:image/x-icon;base64,AAABAAEAEREAAAEAIADwBAAAFgAAACgAAAARAAAAIgAAAAEAIAAAAAAAyAQAAAAAAAAAAAAAAAAAAAAAAADDn2Hfz5pE/8eVQP7IlkH/yJZB/8iWQf/IlUH/yJVA/8iVQP/IlED/yJQ//8iUP//IlD//yJM+/8iTPv/Hkj3/nI1w//bDbP//8OH//+zW///s1///69b//+rV///p1P//59L//+XQ///izf//38n//9vG///ZxP//1b///dG////Prf/KlkX/88N4/v37///99Pj//fT6//vy9v/68fT/+u/y//rt8P/66u3/+ufq//rl6P/64eT/+93h//3a3//71d7//9LK/86XR//0xHb//vv////18///9fT///f5///4////9f7///P8///v+f//7Pb//+nz///m8f//4eb//9vZ//3Y2v//1Mb/zphH//TGd//+/////Pj1///7///Q58r/m9aV/6TZnv+i15r/otWY/6LTlv+j0pb/mc6M/9DXuf//3+P//Nnc///Wyf/OmUf/9MZ3//7////8+/j//////53WnP+Y5pn/rvGv/6PvpP+e7p//me6b/5nvm/95533/mM+L///j7f/629z//9jL/86ZR//0xnf//v////z9+v//////qtup/8Xzxf/a/tn/z/vO/8n7yf/D+sL/xPvD/6Hzo/+j05b//+Tu//re3///2cz/zplI//XGeP/+/////P36//////+n26f/uvC6/9T71P/K+Mr/xvjG/8D3wP+/+L//nfCf/6LTlf//5u//+t/g///cz//OmUj/9MZ3//7////8/fr//////6rcqv/G9MX/3//f/9n92f/V/NX/0PzQ/9H+0P+s9a7/pdSY///o8f/64OL//9zP/86aSP/0xnf//v////z9+f//////ndid/5TjlP+v7q//qeyp/6jsqf+k7KX/p+6n/4Tlh/+Z0Y7//+r0//rh4v//3tH/zppI//TGd//+/////v77///////Y8Nj/p9+n/6/jr/+t4a3/rd2p/67bpv+u2ab/p9Wc/9jgx///6Oz//OPl///e0f/Omkj/9MV1//7//////fr///78///+/f///////////////////P////j////0+///8fn//+vu///m4v/94+P//97P/86ZSP/zx3v//v/////+/f///////f////v////7////+/////v+///7+///+/f///vz/P/98Pr//+33//3p9///5OL/zppL//a1Sv/0xoL/9cR7//XEfP/1xHz/9cR8//XEfP/1xH3/9cR8//XCev/1wXr/9b94//W9d//1u3X/87l0//y6bP/Llj7/+pMA/vWBAP/1gwD/9YMA//WDAP/1gwD/9YMA//WDAP/1gwD/9YQA//WEAP/1hAD/9YQA//WEAP/zhAH//okA/8qLIv3xpzP/4ptV/+OdU//jnVP/451T/+OdU//jnVP/451T/+OdU//jnVL/451S/+OdUv/jnVL/451S/+GdVf/qnUf/2aRJ/9q0c9/8yn7/98V5/vjGev/4xnr/+MZ6//jGev/4xnr/+MZ6//jGev/4xnr/+MZ6//jGev/4xnr/+MZ6/vrIe/+jj2y4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="}, { separator: ''}, { label: "Кодировать изображение или текстовой файл в base64", func: "copyFaviconbase()", image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACLElEQVR42pXTXUtUURTG8f/aZ58zppqjY4YhRgQBWRABRRgoEERlKNJlQn2ICOquIooi6Bt0FRDkOGlAUUBRQoEFmEYEZhSRYG/zojpzzl55cA6lUNFv89zszX5YN0tyIyNUDYdR1KfOoYCwQgSE1RQQMXiel7NhGFLVN9Dfz//I5nJ9VlX53buZ94BgDNT6HvuvjhNYQVAUcA4Obs9w7WQXqg7LGoHvIxIXCCk/HlM4e2w3Ym0yPOduPiMmgBERksRqampWkkoRBAFTF7q5MvSCcgQ3ns9SUYM1kLDW97POuf7IOW5ls6gqAlgDdRZOPwk43ruXu2/zNKfX87VsEH6x8eeu7h4iP8B5HjhFnCNllH0Xxxg4uofpwiKZpjTjj8dI204QIWEVMHX1iDV4bWnM1k14rS2kmjK8qUuz46HQe6iHe7dHeXnpCJ2nRgkjJaZJge8J5XqBnR3Ilja0JUPYkMEEjbxaesC2OxHXu8qAMHn5MGi1QMEAWMC0N2I60pjNzcvZgPpFFj9PsDAxxuvzByhWABUqIZQjqgWKVQUfWGptwGxshCCPzk3hiku42XmiyU9YoBIpiCBGiE/CoooPmMZadP4Dsj7EtK9Dfxi0FCL1Pj4xJWathYQIJnnQLx9hbga0gKldAClAOY+WF4gJwlpGBJtcp58W+RvfegwND+OcI2aMoVQqPZLlhcg71Qan/JERKBQK908MDp5hte8C7AI8/u0bMM0aPwHiYdBiB+lf7gAAAABJRU5ErkJggg=="}, { label: "Сохранить выделенный текст как txt файл", func: "saveSelectionToTxt()", image: "data:image/x-icon;base64,AAABAAEAEREAAAEAIADwBAAAFgAAACgAAAARAAAAIgAAAAEAIAAAAAAAyAQAAAAAAAAAAAAAAAAAAAAAAAAAAQE6AAAAZAAAAGgAAAJmAAACZgAAAGYAAABmAAAAZgAAAGYAAABmAAAAZgAAAGYAAABlAAAAaQABAmYAAQEjAAAAADlVkOdVcKHxVXKi8kdklPJLZpfyU3Cg8lJv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/AAAAA3yVx//j8///3u/7/52gpf6pqKf+uLm5/rq7u/7Ly8v+ycnI/paWlf6LjY/+np2f/Xh+g/5gnL7/MX+y/xcgJ80BAgNNN1OUs6W84fDA1O73mJyj/ainpv+2trb/t7e4/8fHyP/Fxsb/kZGQ/4eGhP+vucT/j6G+/W53k/NlkbnwNoOv/AgiNb8CCBsQDRo/YwsaO3B0d33arKyp9q2trfWvr6/2u7u79ru7vPawr7H1sbCt9nJ2gOQIGD6bFCFEYB0qPE1Bf6SpEz9cggAAAAMCAQEBAQAAADIyMmlDQ0ONQUFBhUFBQYVCQkGFQkJBhUhISIRNTU2OKysrZAEAAAUBAQAAAgEAAAkEAAEDAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="}, { separator: ''}, { label: "Запомнить изображение как base64, в контекстном меню", value: "CB.Save.WebScreenShotOnImage"}, { label: "Сохранить выделенный текст в файл, в контекстном меню", value: "CB.Save.SelectionToFile" }, { label: "Открыть выделенный текст в внешнем редакторе, в контекстном меню", value: "CB.Save.TextToEditor"}, ]; var menuPopup = self.appendChild(document.createXULElement("menupopup")); array.forEach((m,i)=> { if ("separator" in m) { menuPopup.appendChild(document.createXULElement("menuseparator")); return }; var mItem = menuPopup.appendChild(document.createXULElement("menuitem")); mItem.setAttribute("label", m.label); mItem.setAttribute("class", "menuitem-iconic"); if ("image" in m) mItem.setAttribute("image", m.image || array[i-1].image); if ("value" in m) { mItem.setAttribute('type', 'checkbox'); mItem.setAttribute('checked', cbu.getPrefs(m.value) ); mItem.onclick =()=> cbu.setPrefs(m.value, !cbu.getPrefs(m.value)); } if ("func" in m) mItem.addEventListener("command", ()=> eval(m.func.toString())); }); menuPopup.setAttribute("onclick", "event.stopPropagation()"); function aDate() { var t=new Date(); var y=1900+t.getYear(); var min=t.getMinutes(); if (min<10){min="0"+min}; var h=t.getHours(); var m=t.getMonth();switch(m){case 0: m="января";break;case 1: m="февраля";break;case 2: m="марта";break;case 3: m="апреля";break;case 4: m="мая";break;case 5: m="июня";break;case 6: m="июля";break;case 7: m="августа";break;case 8: m="сентября";break;case 9: m="октября";break;case 10: m="ноября";break;default: m="декабря";} var d=t.getDate(); var curdate=d+" "+m+" "+y+" "+"г"; var myfilename=curdate; return myfilename; } // Сохранить как PNG страницу или части страницы ............. function WebScreenShotoncapture(win, x, y, width, height){ var canvas = document.createElementNS(xhtmlns, 'canvas'); canvas.width = width; canvas.height = height; var ctx = canvas.getContext("2d"); ((i = 17)=> { try { ctx.drawWindow(win, x, y, canvas.width, canvas.height, "white") } catch(e) { canvas.height = canvas.width*i; arguments.callee(--i) }; })(); var url = makeURI(canvas.toDataURL("image/png")); var fp = window.makeFilePicker(); fp.init(window, "Сохранить как…", fp.modeSave); fp.appendFilter("", "*.png"); fp.defaultString = getTabLabel() + ".png"; fp.open(res => { if (res == fp.returnCancel || !fp.file) return; makeWebBrowserPersist().saveURI( makeURI(canvas.toDataURL("image/png")), document.nodePrincipal, null, null, null, null, null, fp.file, null ); }); }; function WebScreenShotoncaptureAll(){ var win = content; WebScreenShotoncapture(win, 0, 0, win.innerWidth + win.scrollMaxX, win.innerHeight + win.scrollMaxY); }; function WebScreenShotoncapturePage(){ var win = content, doc = win.document, body = doc.body, html = doc.documentElement; var scrX = (body.scrollLeft || html.scrollLeft) - html.clientLeft; var scrY = (body.scrollTop || html.scrollTop) - html.clientTop; WebScreenShotoncapture(win, scrX, scrY, win.innerWidth, win.innerHeight); }; // Сохранить выбранную область страницы как PNG .... WebScreenShotByClipping = { capture: WebScreenShotoncapture, handleEvent: function(e) { if (e.button) return false; e.preventDefault(); e.stopPropagation(); switch(e.type){ case 'mousedown': this.downX = e.pageX; this.downY = e.pageY; this.bs.left = this.downX + 'px'; this.bs.top = this.downY + 'px'; this.body.appendChild(this.box); this.flag = true; break; case 'mousemove': if (!this.flag) return; this.moveX = e.pageX; this.moveY = e.pageY; if (this.downX > this.moveX) this.bs.left = this.moveX + 'px'; if (this.downY > this.moveY) this.bs.top = this.moveY + 'px'; this.bs.width = Math.abs(this.moveX - this.downX) + 'px'; this.bs.height = Math.abs(this.moveY - this.downY) + 'px'; break; case 'mouseup': this.uninit(); break; } }, init: function() { this.win = document.commandDispatcher.focusedWindow; if (this.win == window) this.win = content; this.doc = this.win.document; this.body = this.doc.body; if (!this.body instanceof HTMLBodyElement){ Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService).showAlertNotification(self.image, self.label, "Не удается захватить!"); return false; } this.flag = null; this.box = this.doc.createElement('div'); this.bs = this.box.style; this.bs.border = '#0f0 dashed 2px'; this.bs.position = 'absolute'; this.bs.zIndex = '2147483647'; this.defaultCursor = getComputedStyle(this.body, '').cursor; this.body.style.cursor = 'crosshair'; ["click", "mouseup", "mousemove", "mousedown"].forEach(type=> this.doc.addEventListener(type, this, true)); }, uninit: function() { var pos = [this.win, parseInt(this.bs.left), parseInt(this.bs.top), parseInt(this.bs.width), parseInt(this.bs.height)]; this.body.style.cursor = this.defaultCursor; this.body.removeChild(this.box); this.capture.apply(this, pos); ["click", "mouseup", "mousemove", "mousedown"].forEach(type=> this.doc.removeEventListener(type, this, true)); }, }; // Сохранить выбранный элемент на странице как PNG .... WebScreenShotByClick = { capture: WebScreenShotoncapture, getPosition: function() { var html = this.doc.documentElement; var body = this.doc.body; var rect = this.target.getBoundingClientRect(); return [ this.win ,Math.round(rect.left) + (body.scrollLeft || html.scrollLeft) - html.clientLeft ,Math.round(rect.top) + (body.scrollTop || html.scrollTop) - html.clientTop ,parseInt(rect.width) ,parseInt(rect.height) ]; }, highlight: function() { this.orgStyle = this.target.hasAttribute('style') ? this.target.style.cssText : false; this.target.style.cssText += 'outline: red 2px solid; outline-offset: 2px; -moz-outline-radius: 2px;'; }, lowlight: function(e) { if (this.orgStyle) this.target.style.cssText = this.orgStyle; else this.target.removeAttribute('style'); }, handleEvent: function(e) { switch(e.type){ case 'click': if (e.button) return; e.preventDefault(); e.stopPropagation(); this.lowlight(); this.capture.apply(this, this.getPosition()); this.uninit(); break; case 'mouseover': if (this.target) this.lowlight(); this.target = e.target; this.highlight(); break; } }, init: function() { this.win = content; this.doc = content.document; ["click", "mouseover"].forEach(type=> this.doc.addEventListener(type, this, true)); }, uninit: function() { this.target = false; ["click", "mouseover"].forEach(type=> this.doc.removeEventListener(type, this, true)); }, }; function WebScreenShotonImage(image) { var canvas = document.createElementNS(xhtmlns, 'canvas'); canvas.width = image.naturalWidth; canvas.height = image.naturalHeight; var ctx = canvas.getContext('2d'); ctx.drawImage(image, 0, 0); var base64 = canvas.toDataURL(); gClipboard.write(base64); // стиль для изображение в сплывающей подсказке .... var sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService); var uri = makeURI('data:text/css,'+ encodeURIComponent('#alertImage { height: 25px !important; width: 25px !important; }')); sss.loadAndRegisterSheet(uri, 0); // alertsService.showAlertNotification(base64, self.label, "Запомнил изображение как base64", false, "", (s, t)=> { Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService).showAlertNotification(base64, self.label, "Запомнил изображение как base64", false, "", (s, t)=> { if (t == 'alertfinished') sss.unregisterSheet(uri, 0); // удалить стиль когда подсказка закрывается }, ""); }; var saveToFile = function (fileContent, fileName) { var uc = Components.classes['@mozilla.org/intl/scriptableunicodeconverter'].createInstance(Components.interfaces.nsIScriptableUnicodeConverter); uc.charset = 'utf-8'; fileContent = uc.ConvertFromUnicode(fileContent); var nsIFilePicker = Components.interfaces.nsIFilePicker; var fp = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker); fp.init(window, '', fp.modeSave); fp.defaultString = fileName; fp.appendFilters(fp.filterHTML); fp.appendFilters(fp.filterAll); fp.open(function (rv) { if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) { var stream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream); stream.init(fp.file, 0x02|0x20|0x08, 0666, 0); stream.write(fileContent, fileContent.length); stream.close(); } }); }; // Сохранить ярлык страницы в указанную папку .............. function saveShortcuts() { var file = Components.classes["@mozilla.org/file/local;1"]. createInstance(Components.interfaces.nsIFile); file.initWithPath(folderpath); if( !file.exists() || !file.isDirectory() ) { file.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0x1B6);} var savetodir=folderpath+"\\"; var urllink=gBrowser.currentURI.spec; var out=getTabLabel(); var filename=savetodir+out+'.url'; var data="[InternetShortcut]\r\nURL="+urllink+"\r\n"; saveToFile(data, filename); // подсказка var notific = 'Сохранил в: ' + folderpath; var image = gBrowser.selectedBrowser.mIconURL; Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService).showAlertNotification(image, filename, notific); }; // Кодировать изображение или текстовой файл в base64 ............. function copyFaviconbase(){ var fp = window.makeFilePicker(); fp.init(window, "Открыть файл", fp.modeOpen); fp.appendFilter("Text and images", "*.txt; *.text; *.css; *.js; *.ini; *.rdf; *.xml; *.html; *.htm; *.shtml; *.xhtml; *.jpe; *.jpg; *.jpeg;\ *.gif; *.png; *.bmp; *.ico; *.svg; *.svgz; *.tif; *.tiff; *.ai; *.drw; *.pct; *.psp; *.xcf; *.psd; *.raw"); fp.open(re=> { if ( re != fp.returnOK ) return; var file = fp.file; var inputStream = Cc["@mozilla.org/network/file-input-stream;1"].createInstance(Ci.nsIFileInputStream); inputStream.init(file, 0x01, 0600, 0); var stream = Cc["@mozilla.org/binaryinputstream;1"].createInstance(Ci.nsIBinaryInputStream); stream.setInputStream(inputStream); var encoded = btoa(stream.readBytes(stream.available())); var contentType = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService).getTypeFromFile(file); var dataURI = "data:" + contentType + ";charset=utf-8;base64," + encoded; gClipboard.write(dataURI); //Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService).showAlertNotification(dataURI, self.label, "Скопировал файл как base64"); // стиль для изображение в сплывающей подсказке .... var sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService); var uri = makeURI('data:text/css,'+ encodeURIComponent('#alertImage { height: 25px !important; width: 25px !important; }')); sss.loadAndRegisterSheet(uri, 0); // alertsService.showAlertNotification(base64, self.label, "Запомнил изображение как base64", false, "", (s, t)=> { Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService).showAlertNotification(dataURI, self.label, "Запомнил изображение как base64", false, "", (s, t)=> { if (t == 'alertfinished') sss.unregisterSheet(uri, 0); // удалить стиль когда подсказка закрывается }, ""); }); }; // Сохранить иконку текущего сайта с диалогом сохранения ............. function saveFavicon() { let browserMM = gBrowser.selectedBrowser.messageManager; browserMM.addMessageListener('getSdomain', function listener(message) { function getSiteName() { try { var domain = message.data.split('.') } catch(e) { return "" }; domain = (domain.length == 2) ? domain[0] : domain[1] return domain.charAt(0).toUpperCase() + domain.slice(1).split('.')[0] + " "; }; saveImageURL(gBrowser.selectedTab.image, getSiteName(), null, false, false, null, window.document); browserMM.removeMessageListener('getSdomain', listener, true); }); browserMM.loadFrameScript('data:,sendAsyncMessage("getSdomain", content.document.domain)', false); }; // Скопировать иконку текущего сайта как base64 код ............. function copyFaviconData() { var img = new Image(); img.src = gBrowser.selectedTab.image; WebScreenShotonImage(img); }; // Сохранить выделенный текст или весь текст на странице как txt файл ............. function saveSelectionToTxt() { let browserMM = gBrowser.selectedBrowser.messageManager; browserMM.addMessageListener('getSelection', function listener(message) { var sel = message.data; !sel && document.getElementById("cmd_selectAll").doCommand(); // создать название файла из заголовка страницы и текущего времени и сохранить текст .... var fileTitle = getTabLabel() + ' ' + aDate().replace(/:/g, "."); saveURL("data:text/plain," + encodeURIComponent(gBrowser.currentURI.spec + ("\r\n\r\n" + sel)), fileTitle + ".txt", null, false, false, null, window.document); !sel && goDoCommand("cmd_selectNone"); browserMM.removeMessageListener('getSelection', listener, true); }); browserMM.loadFrameScript('data:,sendAsyncMessage("getSelection", content.document.getSelection().toString())', false); }; // Добавляем в контекстного меню страницы новые пункты ............. ((contextMenu, el)=> { // в контекстного меню изображений .... var baseItem = contextMenu.appendChild(document.createXULElement("menuitem")); baseItem.id = "content-baseItem"; baseItem.setAttribute("label", "Запомнить изображение как base64"); baseItem.setAttribute("class", "menuitem-iconic"); baseItem.setAttribute("image", "data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/AIAQ/wCAEf8AgA//AIAR/wCAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8AgBX/AIAVAAAAAAAAAAD/AIAo/wCA//8AgP//AID//wCA//8AgP//AIAoAAAAAAAAAAAAAAAAAAAAAP8AgBL/AID//wCA//8AgA3/AIAL/wCA//8AgP//AID//wCA//8AgP//AID//wCA//8AgBAAAAAAAAAAAAAAAAD/AIAR/wCA//8AgP//AIAK/wCACv8AgP//AID//wCAIf8AgAX/AIAh/wCA//8AgP//AIAQAAAAAAAAAAAAAAAA/wCACv8AgP//AID//wCAB/8AgAf/AID//wCA//8AgAUAAAAA/wCABf8AgP//AID//wCACgAAAAD/AIAQ/wCADP8AgCH/AID//wCA//8AgAf/AIAH/wCA//8AgP//AIAh/wCABf8AgCH/AID//wCA//8AgAv/AIAh/wCA//8AgP//AID//wCA//8AgP//AIAH/wCAB/8AgP//AID//wCA//8AgP//AID//wCA//8AgP//AIAg/wCA//8AgP//AID//wCA//8AgP//AID//wCAB/8AgAf/AID//wCA//8AgP//AID//wCA//8AgP//AIAh/wCAC/8AgP//AID//wCAHP8AgBz/AID//wCA//8AgAf/AIAH/wCA//8AgP//AIAh/wCACf8AgA7/AIAMAAAAAP8AgAj/AID//wCA//8AgAP/AIAD/wCA//8AgP//AIAH/wCAB/8AgP//AID//wCABQAAAAAAAAAA/wCADf8AgAr/AIAL/wCA//8AgP//AIAH/wCAB/8AgP//AID//wCAB/8AgAr/AID//wCA//8AgCH/AIAH/wCAJf8AgP//AID//wCAI/8AgP//AID//wCAB/8AgAf/AID//wCA//8AgAf/AIAL/wCA//8AgP//AID//wCA//8AgP//AID//wCA//8AgCT/AID//wCA//8AgAr/AIAK/wCA//8AgP//AIAKAAAAAP8AgCj/AID//wCA//8AgP//AID//wCA//8AgCP/AIAM/wCA//8AgP//AIAN/wCADf8AgP//AID//wCADQAAAAAAAAAA/wCAEP8AgBH/AIAP/wCAEf8AgBAAAAAAAAAAAP8AgBT/AIAVAAAAAAAAAAD/AIAV/wCAFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//+sQcH5rEGA8KxBAHCsQQBwrEEIQKxBAACsQQAArEEAAKxBAQCsQQwArEEAAKxBAACsQYAArEHBmaxB//+sQQ=="); baseItem.onclick =()=> WebScreenShotonImage(gContextMenu.target); // в контекстного меню выделенного текста .... var saveItem = contextMenu.insertBefore(document.createXULElement("menuitem"), el); saveItem.id = "content-saveItem"; saveItem.setAttribute("label", "Сохранить выделенный текст в файл"); saveItem.onclick =()=> saveSelectionToFile(); var editorItem = contextMenu.insertBefore(document.createXULElement("menuitem"), el); editorItem.id = "content-editorItem"; editorItem.setAttribute("label", "Открыть выделенный текст в внешнем редакторе"); editorItem.onclick =()=> textToEditor(); // устанавливаем где и при каких настройках показывать новые пункты .... addEventListener('popupshowing', e=> { if (e.target != e.currentTarget) return; var sel = gContextMenu.isTextSelected; saveItem.hidden = !sel || !cbu.getPrefs("CB.Save.SelectionToFile"); editorItem.hidden = !sel || !cbu.getPrefs("CB.Save.TextToEditor"); baseItem.hidden = !gContextMenu.onImage || !cbu.getPrefs("CB.Save.WebScreenShotOnImage"); }, false, contextMenu); // удалять новые пункти при изминениях .... addDestructor(()=> { baseItem.remove(); saveItem.remove(); editorItem.remove(); }); })(document.getElementById("contentAreaContextMenu"), document.getElementById("context-sep-open")); // Сохранить выделенный текст в файл на рабочем столе ............. function saveSelectionToFile() { // создать текст для записи var url = gBrowser.currentURI.spec; if (/\.рф/.test(url.host)) url = convertFromUnicode("UTF-8", url); var time = convertFromUnicode("UTF-8", aDate().replace(/:/g, ".")); var text = convertFromUnicode("UTF-8", gContextMenuContentData.selectionInfo.fullText); var title = convertFromUnicode("UTF-8", getTabLabel()); var text = "..............................................................\n" + title + " - " + time + "\n" + url + "\n\n" + text + "\n\n\n"; var text = text.replace(/\u000A/g, "\u000D\u000A").replace(/\u000D\u000D\u000A/g, "\u000D\u000A"); // путь к файлу и название файла var file = Services.dirsvc.get("Desk", Ci.nsIFile); file.append("Save - " + (aDate().replace(/:/g, ".")) + ".txt"); // создать файл с текстом или добавлять текст в файл var foStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream); file.exists() ? foStream.init(file, 0x02 | 0x10, 0664, 0) : foStream.init(file, 0x02|0x08|0x20, 0666, 0); foStream.write(text, text.length); foStream.close(); // всплывающая подсказка дает возможность открыть файл если кликнуть на подсказке var notificat = 'Сохранил выделенный текст в файл на рабочий стол'; var image = gBrowser.selectedTab.image || self.image; Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService) .showAlertNotification(image, notificat, "Кликни чтобы открыть файл", true, "", (s, t)=> { if (t == 'alertclickcallback') file.launch(); }, ""); }; // Создать текстовой файл с выделенным текстом в папке профиля и открыть в редакторе ............. function textToEditor() { var text = convertFromUnicode("UTF-8", gContextMenuContentData.selectionInfo.fullText); var file = Services.dirsvc.get('ProfD', Ci.nsIFile); file.append("TextToEditor.txt"); custombuttonsUtils.writeFile(file.path, text); file.launch(); }; // Конвертировать текст в юникод ............. function convertFromUnicode(charset, str) { var converter = Cc['@mozilla.org/intl/scriptableunicodeconverter'].createInstance(Components.interfaces.nsIScriptableUnicodeConverter); converter.charset = charset; str = converter.ConvertFromUnicode(str); return str + converter.Finish(); }; // Получить название вкладки без не сохраняемых символов и лишних пробелов .............. function getTabLabel() { var label = gBrowser.selectedTab.label; var label = label.replace(/[:+.\\\/<>?*|"]+/g, " ").replace(/\s\s+/g, " "); return label.substring(0, 50); };
Отредактировано Andrey_Krropotkin (25-07-2019 19:38:40)
Отсутствует
через сообщения и другие способы пробавал, все равно в function WebScreenShotonImage(image) - image = null
Не-не, нельзя отправить из процесса в процесс никакой живой реальный объект
типа элемента или XPCOM объекта, можно отправлять только данные.
Но в этом конкретном случае всё можно сделать прямо там, на месте.
(popup => addEventListener("popupshowing", { handleEvent(e) { if (this.shouldHide) return; var menuitem = document.createXULElement("menuitem"); menuitem.id = "content-baseItem"; menuitem.className = "menuitem-iconic"; menuitem.setAttribute("oncommand", "copyImageAsBase64()"); menuitem.setAttribute("label", "Запомнить изображение как base64"); menuitem.setAttribute("image", "data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/AIAQ/wCAEf8AgA//AIAR/wCAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8AgBX/AIAVAAAAAAAAAAD/AIAo/wCA//8AgP//AID//wCA//8AgP//AIAoAAAAAAAAAAAAAAAAAAAAAP8AgBL/AID//wCA//8AgA3/AIAL/wCA//8AgP//AID//wCA//8AgP//AID//wCA//8AgBAAAAAAAAAAAAAAAAD/AIAR/wCA//8AgP//AIAK/wCACv8AgP//AID//wCAIf8AgAX/AIAh/wCA//8AgP//AIAQAAAAAAAAAAAAAAAA/wCACv8AgP//AID//wCAB/8AgAf/AID//wCA//8AgAUAAAAA/wCABf8AgP//AID//wCACgAAAAD/AIAQ/wCADP8AgCH/AID//wCA//8AgAf/AIAH/wCA//8AgP//AIAh/wCABf8AgCH/AID//wCA//8AgAv/AIAh/wCA//8AgP//AID//wCA//8AgP//AIAH/wCAB/8AgP//AID//wCA//8AgP//AID//wCA//8AgP//AIAg/wCA//8AgP//AID//wCA//8AgP//AID//wCAB/8AgAf/AID//wCA//8AgP//AID//wCA//8AgP//AIAh/wCAC/8AgP//AID//wCAHP8AgBz/AID//wCA//8AgAf/AIAH/wCA//8AgP//AIAh/wCACf8AgA7/AIAMAAAAAP8AgAj/AID//wCA//8AgAP/AIAD/wCA//8AgP//AIAH/wCAB/8AgP//AID//wCABQAAAAAAAAAA/wCADf8AgAr/AIAL/wCA//8AgP//AIAH/wCAB/8AgP//AID//wCAB/8AgAr/AID//wCA//8AgCH/AIAH/wCAJf8AgP//AID//wCAI/8AgP//AID//wCAB/8AgAf/AID//wCA//8AgAf/AIAL/wCA//8AgP//AID//wCA//8AgP//AID//wCA//8AgCT/AID//wCA//8AgAr/AIAK/wCA//8AgP//AIAKAAAAAP8AgCj/AID//wCA//8AgP//AID//wCA//8AgCP/AIAM/wCA//8AgP//AIAN/wCADf8AgP//AID//wCADQAAAAAAAAAA/wCAEP8AgBH/AIAP/wCAEf8AgBAAAAAAAAAAAP8AgBT/AIAVAAAAAAAAAAD/AIAV/wCAFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//+sQcH5rEGA8KxBAHCsQQBwrEEIQKxBAACsQQAArEEAAKxBAQCsQQwArEEAAKxBAACsQYAArEHBmaxB//+sQQ=="); popup.append(menuitem); addDestructor(() => menuitem.remove()); menuitem.copyImageAsBase64 = () => gBrowser.selectedBrowser.messageManager .loadFrameScript("data:;charset=utf-8," + encodeURIComponent(this.code()), false); this.handleEvent = () => menuitem.hidden = this.shouldHide; }, get shouldHide() { return !gContextMenu.onImage; }, code: () => `(selectors => { var getImage = doc => { var elm = doc.querySelector(selectors.shift()); if (selectors.length) elm = getImage(elm.contentDocument); return elm; } var image = getImage(content.document); var canvas = image.ownerDocument.createElementNS("${xhtmlns}", "canvas"); canvas.width = image.naturalWidth; canvas.height = image.naturalHeight; var ctx = canvas.getContext("2d"); ctx.drawImage(image, 0, 0); var base64 = canvas.toDataURL(); Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper) .copyStringToClipboard(base64, Ci.nsIClipboard.kGlobalClipboard); Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService) .showAlertNotification(base64, "${self.label}", "Запомнил изображение как base64"); })(${ JSON.stringify(gContextMenu.targetSelectors) })` }, false, popup || 1))(document.getElementById("contentAreaContextMenu"));
И осталось здесь запустить функции
Ага, всего-то ничего .
Отсутствует
Ага, всего-то ничего .
и что все так плохо? И ничего придумать нельзя или полностью код менять? В принципе есть штатная сохранялка. И наверно последняя кнопка которую мне надо исправить - это переключатель раскладки. Тут много вариантов есть, У меня стоит вот такая кнопка
var keybUtils = { //== Options noSelBehavior: { // Shift+Home ctrlKey: false, altKey: false, shiftKey: true, metaKey: false, keyCode: KeyEvent.DOM_VK_HOME, charCode: 0 }, // 0 - do nothing // 1 - convert all text // Or use object like following to simulate "keypress" event: /* noSelBehavior: { // Ctrl+Shift+Left ctrlKey: true, altKey: false, shiftKey: true, metaKey: false, keyCode: KeyEvent.DOM_VK_LEFT, charCode: 0 } */ convTableForward: { // ru -> en "\"": "@", ":": "^", ";": "$", "?": "&", ",": "?", "/": "|", ".": "/", "э": "'", "б": ",", "ю": ".", "Ж": ":", "ж": ";", "Б": "<", "Ю": ">", "Э": "\"", "х": "[", "ъ": "]", "ё": "`", "Х": "{", "Ъ": "}", "Ё": "~", "№": "#", "Ф": "A", "ф": "a", "И": "B", "и": "b", "С": "C", "с": "c", "В": "D", "в": "d", "У": "E", "у": "e", "А": "F", "а": "f", "П": "G", "п": "g", "Р": "H", "р": "h", "Ш": "I", "ш": "i", "О": "J", "о": "j", "Л": "K", "л": "k", "Д": "L", "д": "l", "Ь": "M", "ь": "m", "Т": "N", "т": "n", "Щ": "O", "щ": "o", "З": "P", "з": "p", "Й": "Q", "й": "q", "К": "R", "к": "r", "Ы": "S", "ы": "s", "Е": "T", "е": "t", "Г": "U", "г": "u", "М": "V", "м": "v", "Ц": "W", "ц": "w", "Ч": "X", "ч": "x", "Н": "Y", "н": "y", "Я": "Z", "я": "z", __proto__: null }, //== End of options button: this, get convTableBackward() { var ctb = { __proto__: null }; var ctf = this.convTableForward; for(var c in ctf) ctb[ctf[c]] = c; delete this.convTableBackward; return this.convTableBackward = ctb; }, inPrimaryLayout: function(s) { for(var i = 0, l = s.length; i < l; ++i) { var c = s.charAt(i); if(c in this.convTableForward) return true; if(c in this.convTableBackward) return false; } return false; }, switchKeybLayout: function(s, convTable) { var res = ""; for(var i = 0, l = s.length; i < l; ++i) { var c = s.charAt(i); res += c in convTable ? convTable[c] : c; } return res; }, switchSelKeybLayout: function(_subCall, _focusFixed) { if( !_focusFixed && "closeMenus" in window && document.commandDispatcher.focusedElement == this.button ) { closeMenus(this.button); setTimeout(function(_this) { _this.switchSelKeybLayout(_subCall, true); }, 0, this); return; } var fe = document.commandDispatcher.focusedElement; if(!fe) return; if(fe instanceof HTMLInputElement || fe instanceof HTMLTextAreaElement) { var ta = fe; try { var val = ta.value; var sel = val.substring(ta.selectionStart, ta.selectionEnd); } catch(e) { // Non-text HTMLInputElement return; } if(!sel && val && this.noSelBehavior && !_subCall) { if(this.noSelBehavior == 1) { ta.selectionStart = 0; ta.selectionEnd = val.length; sel = val; } else { this.handleNoSel(ta); return; } } if(!sel) return; var res = this.switchKeybLayout( sel, this.inPrimaryLayout(sel) ? this.convTableForward : this.convTableBackward ); if(res != sel) this.insertText(ta, res); } else if(fe.contentEditable == "true") { var doc = fe.ownerDocument; var docURI = doc.documentURI; if( docURI.substr(0, 5) == "data:" && docURI.indexOf("chrome://browser/skin/devtools/") != -1 ) { //~ todo: seems like we only can use paste from clipboard here... return; } var sel = doc.defaultView.getSelection(); var rng = sel.rangeCount && sel.getRangeAt(0); var tmpNode; if(!rng || rng.collapsed) { if(!this.noSelBehavior || _subCall) return; if(this.noSelBehavior == 1) { var r = doc.createRange(); r.selectNodeContents(fe); sel.removeAllRanges(); sel.addRange(r); tmpNode = fe.cloneNode(true); } else { this.handleNoSel(fe); return; } } else { tmpNode = doc.createElementNS("http://www.w3.org/1999/xhtml", "div"); tmpNode.appendChild(rng.cloneContents()); } var orig = tmpNode.innerHTML; var convTable = this.inPrimaryLayout(tmpNode.textContent) ? this.convTableForward : this.convTableBackward; var _this = this; var parseChildNodes = function(node) { if(node instanceof Element) { var childNodes = node.childNodes; for(var i = childNodes.length - 1; i >= 0; --i) parseChildNodes(childNodes[i]); } else if(node.nodeType == node.TEXT_NODE) { var text = node.nodeValue; var newText = _this.switchKeybLayout(node.nodeValue, convTable); if(newText != text) node.parentNode.replaceChild(doc.createTextNode(newText), node); } } parseChildNodes(tmpNode); var res = tmpNode.innerHTML; if(res != orig) doc.execCommand("insertHTML", false, res); } }, handleNoSel: function(node) { this.select(node); this.switchSelKeybLayout(true); }, select: function(node) { var e = this.noSelBehavior; if(!e || typeof e != "object") return; var evt = document.createEvent("KeyboardEvent"); evt.initKeyEvent( "keypress", true /*bubbles*/, true /*cancelable*/, node.ownerDocument.defaultView, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.keyCode, e.charCode ); node.dispatchEvent(evt); }, insertText: function(ta, text) { //var editor = ta.QueryInterface(Components.interfaces.nsIDOMNSEditableElement).editor var editor = ta.editor .QueryInterface(Components.interfaces.nsIPlaintextEditor); if(editor.flags & editor.eEditorReadonlyMask) return; var sTop = ta.scrollTop; var sHeight = ta.scrollHeight; var sLeft = ta.scrollLeft; // var sWidth = ta.scrollWidth; if(text) editor.insertText(text); else editor.deleteSelection(0, 0); ta.scrollTop = sTop + (ta.scrollHeight - sHeight); ta.scrollLeft = sLeft; // + (ta.scrollWidth - sWidth); } }; var btn = this; if(btn instanceof XULElement && addEventListener.length > 3) { addEventListener("command", function(e) { if(e.target != btn) return; e.preventDefault(); e.stopPropagation(); keybUtils.switchSelKeybLayout(); }, true, this.parentNode); } keybUtils.switchSelKeybLayout();
function replaceSelectedText(obj,cbFunc) { obj.focus(); if (document.selection) { var s = document.selection.createRange(); if (s.text) { eval("s.text="+cbFunc+"(s.text);"); s.select(); return true; } } else if (typeof(obj.selectionStart)=="number") { if (obj.selectionStart!=obj.selectionEnd) { var start = obj.selectionStart; var end = obj.selectionEnd; eval("var rs = "+cbFunc+"(obj.value.substr(start,end-start));"); obj.value = obj.value.substr(0,start)+rs+obj.value.substr(end); obj.setSelectionRange(end,end); } return true; } return false; } function layoutRU(str) { replacer = { "q":"й", "w":"ц", "e":"у", "r":"к", "t":"е", "y":"н", "u":"г", "i":"ш", "o":"щ", "p":"з", "[":"х", "]":"ъ", "a":"ф", "s":"ы", "d":"в", "f":"а", "g":"п", "h":"р", "j":"о", "k":"л", "l":"д", ";":"ж", "'":"э", "z":"я", "x":"ч", "c":"с", "v":"м", "b":"и", "n":"т", "m":"ь", ",":"б", ".":"ю", "/":".", }; for(i=0; i < str.length; i++){ if( replacer[ str[i].toLowerCase() ] != undefined){ if(str[i] == str[i].toLowerCase()){ replace = replacer[ str[i].toLowerCase() ]; } else if(str[i] == str[i].toUpperCase()){ replace = replacer[ str[i].toLowerCase() ].toUpperCase(); } str = str.replace(str[i], replace); } } return str; } function layoutEN(str, reverse) { replacer = { "й":"q", "ц":"w", "у":"e", "к":"r", "е":"t", "н":"y", "г":"u", "ш":"i", "щ":"o", "з":"p", "х":"[", "ъ":"]", "ф":"a", "ы":"s", "в":"d", "а":"f", "п":"g", "р":"h", "о":"j", "л":"k", "д":"l", "ж":";", "э":"'", "я":"z", "ч":"x", "с":"c", "м":"v", "и":"b", "т":"n", "ь":"m", "б":",", "ю":".", ".":"/", }; for(i=0; i < str.length; i++){ if( replacer[ str[i].toLowerCase() ] != undefined){ if(str[i] == str[i].toLowerCase()){ replace = replacer[ str[i].toLowerCase() ]; } else if(str[i] == str[i].toUpperCase()){ replace = replacer[ str[i].toLowerCase() ].toUpperCase(); } str = str.replace(str[i], replace); } } return str; и кнопки HTML: <input type="button" value="RU" title="Меняет раскладку клавиатуры" onClick="replaceSelectedText(document.getElementById('req_message'),'layoutRU');"> <input type="button" value="EN" title="Меняет раскладку клавиатуры" onClick="replaceSelectedText(document.getElementById('req_message'),'layoutEN');"> где req_message - это textarea
Отредактировано Andrey_Krropotkin (27-07-2019 12:12:19)
Отсутствует
и что все так плохо? И ничего придумать нельзя
Ладно, уговорил, перерисую тяп-ляп отдельной кнопкой, дорабатывай.
((main, parts) => this._handleClick = () => { var df = MozXULElement.parseXULToFragment(` <menupopup> <menuitem class="menuitem-iconic" image="data:image/x-icon;base64,AAABAAEAEREAAAEAIADwBAAAFgAAACgAAAARAAAAIgAAAAEAIAAAAAAAyAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAzAAAAiAcFBa4KCQmvCgkJrwoJCa8KCQmvCgkJrwoJCa8KCQmvCgkJrwoJCa8KCQmvCgkJrwsJCaECAQE/BQMDAAAAAJUgICD4V1ZW/2FhYf5hYWH/YmFh/2BgYP9fX1//X19f/19fX/9gYGD/YmFh/2FhYf9gYGD+ZmVl/1RSUuIVFBQtCgkJy1paWv+Li4v9h4eH/oiIiP6FhYX+i4uL/pKSkv6Sk5P+kpKS/ouLi/6FhYX+iIiI/oiIiP6Hh4f7lZaW/25tbYQNDQ3OcHBw/5KSkv6Li4v/i4uL/5mZmf+EhIT/ZGRk/1tbWv9kZGT/hISE/5mZmf+Li4v/jY2N/4yMjPyWl5f/iomJjQ4NDc13d3f/m5ub/pWVlf+goKD/XFxc/ygoKP8fHyD/GBsb/yAhIv8pKSn/W1tb/6CgoP+Wlpb/lpaW/J6env+Jh4eMDg4OzX1+fv+ioqL+qqqq/1hYWP8ZGRn/Ghwb/x4dHP8mIh//FhQR/xUWF/8aGhr/WFhY/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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" label="Сохранить всю страницу как PNG" value="all"/> <menuitem class="menuitem-iconic" image="data:image/x-icon;base64,AAABAAEAEREAAAEAIADwBAAAFgAAACgAAAARAAAAIgAAAAEAIAAAAAAAyAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAzAAAAiAcFBa4KCQmvCgkJrwoJCa8KCQmvCgkJrwoJCa8KCQmvCgkJrwoJCa8KCQmvCgkJrwsJCaECAQE/BQMDAAAAAJUgICD4V1ZW/2FhYf5hYWH/YmFh/2BgYP9fX1//X19f/19fX/9gYGD/YmFh/2FhYf9gYGD+ZmVl/1RSUuIVFBQtCgkJy1paWv+Li4v9h4eH/oiIiP6FhYX+i4uL/pKSkv6Sk5P+kpKS/ouLi/6FhYX+iIiI/oiIiP6Hh4f7lZaW/25tbYQNDQ3OcHBw/5KSkv6Li4v/i4uL/5mZmf+EhIT/ZGRk/1tbWv9kZGT/hISE/5mZmf+Li4v/jY2N/4yMjPyWl5f/iomJjQ4NDc13d3f/m5ub/pWVlf+goKD/XFxc/ygoKP8fHyD/GBsb/yAhIv8pKSn/W1tb/6CgoP+Wlpb/lpaW/J6env+Jh4eMDg4OzX1+fv+ioqL+qqqq/1hYWP8ZGRn/Ghwb/x4dHP8mIh//FhQR/xUWF/8aGhr/WFhY/6urq/+cnJz8pKSk/4qJiYwPDg7Ng4OD/7W1tf6MjIz/Ghoa/xYYGP8uKCb/ZEAo/5xyOP++saL/RD45/xISE/8bGxv/jY2N/6+vr/ypqan/ioiIjA8PD82IiIj/xMTE/l1cXP8LDAz/JiId/1o3LP9ADgD/mGog//Dt6P/VysX/Ih4Z/wsMDf9eXl7/v7+//K6urv+KiYmMEA8PzY+Pj//Kysr+SEhH/wEDBv9MPi7/hlES/3dCAP+VZAn/tJVO/7eVXf9OQTL/AAIE/0pJSf/FxcX8tLS0/4qJiYwQEBDNm5ub/9/e3/5SUlL/AAAA/0M7Mf/aya7/ybiO/5RmEf9aIAD/cjkX/z80KP8AAAD/U1JS/9nZ2fzAwMD/i4qKjBEREc2oqKn/8O/w/oeGhv8AAAD/DAsK/6qkof/17uj/nW8l/14eCf9hPTr/ExUU/wAAAP+Hh4f/6urq/MzMzf+Mi4uMERERzbCwsv/r6uz+3Nzd/yoqKv8AAAD/ExEP/2heU/9yWjv/UD0u/xcXFv8AAAD/Kioq/93d3v/l5eb81NTV/4yLi4wSERHNuLm5/+/v8P7z8/P/xsbG/yAgIP8AAAD/AQEB/wAAAP8BAQH/AAAA/yAgIP/Gxsb/9PT0/+np6vzb29v/jIuLjBIREc2+vb7/+Pj5/uvr7P/7+/v/4ODg/3Nyc/8uLi7/Hh4d/y0sLP9zc3P/4ODg//v7+//s7O3/8/P0/OHg4f+Mi4uLFBMTyMPDw//////7+Pj4/ff29v38/Pz9/////fr6+v3u7u79+vr6/f////38/Pz99/b2/fn5+f37+/v53t7e/5KSko4GBgZ7m5yc//j4+P/w8fH/8fLy//Dw8P/u7u7/8vLy//X19f/y8vL/7u7u//Dw8P/x8vL/8vLy/uXl5f/BwcH+k5GRUAAAAAQeHR1yb25uxn59fcZ9fHzGfXx8xn18fMZ9e3vGfHt7xn17e8Z9fHzGfXx8xn18fMZ9fHzGgH9/xYmIiGVaV1cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" label="Сохранить видимую часть страницы как PNG" value="page"/> <menuitem class="menuitem-iconic" image="data:image/x-icon;base64,AAABAAEAIBkAAAEAIAAMDQAAFgAAACgAAAAgAAAAMgAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD29fT/2tra/8jIyP/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/Fxc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ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ooVT//Pv6/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" label="Сохранить выбранный элемент страницы как PNG" value="click"/> <menuitem class="menuitem-iconic" image="data:image/x-icon;base64,AAABAAEAEREAAAEAIADwBAAAFgAAACgAAAARAAAAIgAAAAEAIAAAAAAAyAQAAAAAAAAAAAAAAAAAAAAAAADDn2Hfz5pE/8eVQP7IlkH/yJZB/8iWQf/IlUH/yJVA/8iVQP/IlED/yJQ//8iUP//IlD//yJM+/8iTPv/Hkj3/nI1w//bDbP//8OH//+zW///s1///69b//+rV///p1P//59L//+XQ///izf//38n//9vG///ZxP//1b///dG////Prf/KlkX/88N4/v37///99Pj//fT6//vy9v/68fT/+u/y//rt8P/66u3/+ufq//rl6P/64eT/+93h//3a3//71d7//9LK/86XR//0xHb//vv////18///9fT///f5///4////9f7///P8///v+f//7Pb//+nz///m8f//4eb//9vZ//3Y2v//1Mb/zphH//TGd//+/////Pj1///7///Q58r/m9aV/6TZnv+i15r/otWY/6LTlv+j0pb/mc6M/9DXuf//3+P//Nnc///Wyf/OmUf/9MZ3//7////8+/j//////53WnP+Y5pn/rvGv/6PvpP+e7p//me6b/5nvm/95533/mM+L///j7f/629z//9jL/86ZR//0xnf//v////z9+v//////qtup/8Xzxf/a/tn/z/vO/8n7yf/D+sL/xPvD/6Hzo/+j05b//+Tu//re3///2cz/zplI//XGeP/+/////P36//////+n26f/uvC6/9T71P/K+Mr/xvjG/8D3wP+/+L//nfCf/6LTlf//5u//+t/g///cz//OmUj/9MZ3//7////8/fr//////6rcqv/G9MX/3//f/9n92f/V/NX/0PzQ/9H+0P+s9a7/pdSY///o8f/64OL//9zP/86aSP/0xnf//v////z9+f//////ndid/5TjlP+v7q//qeyp/6jsqf+k7KX/p+6n/4Tlh/+Z0Y7//+r0//rh4v//3tH/zppI//TGd//+/////v77///////Y8Nj/p9+n/6/jr/+t4a3/rd2p/67bpv+u2ab/p9Wc/9jgx///6Oz//OPl///e0f/Omkj/9MV1//7//////fr///78///+/f///////////////////P////j////0+///8fn//+vu///m4v/94+P//97P/86ZSP/zx3v//v/////+/f///////f////v////7////+/////v+///7+///+/f///vz/P/98Pr//+33//3p9///5OL/zppL//a1Sv/0xoL/9cR7//XEfP/1xHz/9cR8//XEfP/1xH3/9cR8//XCev/1wXr/9b94//W9d//1u3X/87l0//y6bP/Llj7/+pMA/vWBAP/1gwD/9YMA//WDAP/1gwD/9YMA//WDAP/1gwD/9YQA//WEAP/1hAD/9YQA//WEAP/zhAH//okA/8qLIv3xpzP/4ptV/+OdU//jnVP/451T/+OdU//jnVP/451T/+OdU//jnVL/451S/+OdUv/jnVL/451S/+GdVf/qnUf/2aRJ/9q0c9/8yn7/98V5/vjGev/4xnr/+MZ6//jGev/4xnr/+MZ6//jGev/4xnr/+MZ6//jGev/4xnr/+MZ6/vrIe/+jj2y4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" label="Сохранить выбранную область страницы как PNG" value="clipping"/> </menupopup> `); var popup = df.firstChild; popup.setAttribute("context", ""); popup.setAttribute("oncommand", "handleCommand(event);"); popup.handleCommand = e => { var name = _id + ":DataURLReady"; main = main.replace("%MESSAGE_NAME%", name); var urls = {}, configurable = true, enumerable = true; Object.entries(parts).forEach(([key, part]) => Object.defineProperty(urls, key, { configurable, enumerable, get() { var value = `data:;charset=utf-8,({${ encodeURIComponent(main + part) }%0A}).init("${key}")`; Object.defineProperty(urls, key, {configurable, enumerable, value}); return value; }})); var getTabLabel = () => { var label = gBrowser.selectedTab.label; var label = label.replace(/[:+.\\\/<>?*|"]+/g, " ").replace(/\s\s+/g, " "); return label.substring(0, 50); } var listener = msg => { var fp = makeFilePicker(); fp.init(window, "Сохранить как…", fp.modeSave); fp.appendFilter("", "*.png"); fp.defaultString = getTabLabel() + ".png"; fp.open(res => res == fp.returnCancel || !fp.file || makeWebBrowserPersist().saveURI( Services.io.newURI(msg.data), document.nodePrincipal, null, null, null, null, null, fp.file, null )); } messageManager.addMessageListener(name, listener); addDestructor(() => messageManager.removeMessageListener(name, listener)); (popup.handleCommand = e => gBrowser.selectedBrowser.messageManager .loadFrameScript(urls[e.target.value], false) )(e); } this.append(df); (this._handleClick = () => popup.openPopup(this, "after_start"))(); })(` init(cmd) { cmd.startsWith("c") ? this[cmd].init(this[cmd].parent = this) : this[cmd](); }, capture(win, x, y, width, height) { var canvas = win.document.createElementNS("${xhtmlns}", "canvas"); canvas.width = width; canvas.height = height; var ctx = canvas.getContext("2d"); var tryDraw = ind => { try {ctx.drawWindow(win, x, y, canvas.width, canvas.height, "white")} catch(ex) {canvas.height = ind * canvas.width; tryDraw(--ind);} } tryDraw(17); sendAsyncMessage("%MESSAGE_NAME%", canvas.toDataURL("image/png")); }, `, { all: `all() { var win = content; this.capture(win, 0, 0, win.innerWidth + win.scrollMaxX, win.innerHeight + win.scrollMaxY); }`, page: `page() { var win = content, doc = win.document, body = doc.body, html = doc.documentElement; var scrX = (body.scrollLeft || html.scrollLeft) - html.clientLeft; var scrY = (body.scrollTop || html.scrollTop) - html.clientTop; this.capture(win, scrX, scrY, win.innerWidth, win.innerHeight); }`, clipping: `clipping: { handleEvent(e) { if (e.button) return false; e.preventDefault(); e.stopPropagation(); switch(e.type) { case "mousedown": this.downX = e.pageX; this.downY = e.pageY; this.bs.left = this.downX + "px"; this.bs.top = this.downY + "px"; this.body.appendChild(this.box); this.flag = true; break; case "mousemove": if (!this.flag) return; this.moveX = e.pageX; this.moveY = e.pageY; if (this.downX > this.moveX) this.bs.left = this.moveX + "px"; if (this.downY > this.moveY) this.bs.top = this.moveY + "px"; this.bs.width = Math.abs(this.moveX - this.downX) + "px"; this.bs.height = Math.abs(this.moveY - this.downY) + "px"; break; case "mouseup": this.uninit(); break; } }, init() { var win = {}; Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager) .getFocusedElementForWindow(content, true, win); this.win = win.value; this.doc = this.win.document; this.body = this.doc.body; if (!HTMLBodyElement.isInstance(this.body)) { Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService) .showAlertNotification("${self.image}", ${JSON.stringify(self.label)}, "Не удается захватить!"); return false; } this.flag = null; this.box = this.doc.createElement("div"); this.bs = this.box.style; this.bs.border = "#0f0 dashed 2px"; this.bs.position = "absolute"; this.bs.zIndex = "2147483647"; this.defaultCursor = this.win.getComputedStyle(this.body, "").cursor; this.body.style.cursor = "crosshair"; ["click", "mouseup", "mousemove", "mousedown"].forEach(type=> this.doc.addEventListener(type, this, true)); }, uninit() { var pos = [this.win, parseInt(this.bs.left), parseInt(this.bs.top), parseInt(this.bs.width), parseInt(this.bs.height)]; this.body.style.cursor = this.defaultCursor; this.body.removeChild(this.box); this.parent.capture.apply(this, pos); ["click", "mouseup", "mousemove", "mousedown"].forEach(type=> this.doc.removeEventListener(type, this, true)); } }`, click: `click: { getPosition() { var html = this.doc.documentElement; var body = this.doc.body; var rect = this.target.getBoundingClientRect(); return [ this.win, Math.round(rect.left) + (body.scrollLeft || html.scrollLeft) - html.clientLeft, Math.round(rect.top) + (body.scrollTop || html.scrollTop) - html.clientTop, parseInt(rect.width), parseInt(rect.height) ]; }, highlight() { this.orgStyle = this.target.hasAttribute("style") ? this.target.style.cssText : false; this.target.style.cssText += "outline: red 2px solid; outline-offset: 2px; -moz-outline-radius: 2px;"; }, lowlight() { if (this.orgStyle) this.target.style.cssText = this.orgStyle; else this.target.removeAttribute("style"); }, handleEvent(e) { switch(e.type){ case "click": if (e.button) return; e.preventDefault(); e.stopPropagation(); this.lowlight(); this.parent.capture.apply(this, this.getPosition()); this.uninit(); break; case "mouseover": if (this.target) this.lowlight(); this.target = e.target; this.highlight(); break; } }, init() { this.win = content; this.doc = content.document; ["click", "mouseover"].forEach(type=> this.doc.addEventListener(type, this, true)); }, uninit() { this.target = false; ["click", "mouseover"].forEach(type=> this.doc.removeEventListener(type, this, true)); } }` });
У меня стоит вот такая кнопка
Тоже самое.
(keybUtils => { var btn = this; var listener = { handleEvent(e) { if(e.target != btn) return; e.preventDefault(); e.stopPropagation(); this.switch(); }, switch() { var br = document.activeElement; br && br.localName == "browser" && br.isRemoteBrowser ? br.messageManager.loadFrameScript(this.url, false) : this.keybUtils.switchSelKeybLayout(); }, get url() { delete this.url; return this.url = `data:;charset=utf-8,(${ encodeURIComponent(keybUtils) }).switchSelKeybLayout()`; }, get keybUtils() { delete this.keybUtils; var url = "data:;charset=utf-8,this.keybUtils = " + encodeURIComponent(keybUtils); Services.scriptloader.loadSubScript(url, this); this.keybUtils.button = btn; this.keybUtils.getFocusedElement = function(_subCall, _focusFixed) { if( !_focusFixed && "closeMenus" in window && document.commandDispatcher.focusedElement == this.button ) { closeMenus(this.button); setTimeout(function(_this) { _this.switchSelKeybLayout(_subCall, true); }, 0, this); return; } return document.commandDispatcher.focusedElement; } return this.keybUtils; } }; if(btn instanceof XULElement && addEventListener.length > 3) { addEventListener("command", listener, true, this.parentNode); } listener.switch(); })(`{ //== Options noSelBehavior: { // Shift+Home ctrlKey: false, altKey: false, shiftKey: true, metaKey: false, keyCode: KeyEvent.DOM_VK_HOME, charCode: 0 }, // 0 - do nothing // 1 - convert all text // Or use object like following to simulate "keypress" event: /* noSelBehavior: { // Ctrl+Shift+Left ctrlKey: true, altKey: false, shiftKey: true, metaKey: false, keyCode: KeyEvent.DOM_VK_LEFT, charCode: 0 } */ convTableForward: { // ru -> en "\\"": "@", ":": "^", ";": "$", "?": "&", ",": "?", "/": "|", ".": "/", "э": "'", "б": ",", "ю": ".", "Ж": ":", "ж": ";", "Б": "<", "Ю": ">", "Э": "\\"", "х": "[", "ъ": "]", "ё": "\`", "Х": "{", "Ъ": "}", "Ё": "~", "№": "#", "Ф": "A", "ф": "a", "И": "B", "и": "b", "С": "C", "с": "c", "В": "D", "в": "d", "У": "E", "у": "e", "А": "F", "а": "f", "П": "G", "п": "g", "Р": "H", "р": "h", "Ш": "I", "ш": "i", "О": "J", "о": "j", "Л": "K", "л": "k", "Д": "L", "д": "l", "Ь": "M", "ь": "m", "Т": "N", "т": "n", "Щ": "O", "щ": "o", "З": "P", "з": "p", "Й": "Q", "й": "q", "К": "R", "к": "r", "Ы": "S", "ы": "s", "Е": "T", "е": "t", "Г": "U", "г": "u", "М": "V", "м": "v", "Ц": "W", "ц": "w", "Ч": "X", "ч": "x", "Н": "Y", "н": "y", "Я": "Z", "я": "z", __proto__: null }, //== End of options get convTableBackward() { var ctb = { __proto__: null }; var ctf = this.convTableForward; for(var c in ctf) ctb[ctf[c]] = c; delete this.convTableBackward; return this.convTableBackward = ctb; }, inPrimaryLayout: function(s) { for(var i = 0, l = s.length; i < l; ++i) { var c = s.charAt(i); if(c in this.convTableForward) return true; if(c in this.convTableBackward) return false; } return false; }, switchKeybLayout: function(s, convTable) { var res = ""; for(var i = 0, l = s.length; i < l; ++i) { var c = s.charAt(i); res += c in convTable ? convTable[c] : c; } return res; }, getFocusedElement: function() { return Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager) .getFocusedElementForWindow(content, true, {}); }, switchSelKeybLayout: function(_subCall, _focusFixed) { var fe = this.getFocusedElement(_subCall, _focusFixed); if(!fe) return; if(fe instanceof HTMLInputElement || fe instanceof HTMLTextAreaElement) { var ta = fe; try { var val = ta.value; var sel = val.substring(ta.selectionStart, ta.selectionEnd); } catch(e) { // Non-text HTMLInputElement return; } if(!sel && val && this.noSelBehavior && !_subCall) { if(this.noSelBehavior == 1) { ta.selectionStart = 0; ta.selectionEnd = val.length; sel = val; } else { this.handleNoSel(ta); return; } } if(!sel) return; var res = this.switchKeybLayout( sel, this.inPrimaryLayout(sel) ? this.convTableForward : this.convTableBackward ); if(res != sel) this.insertText(ta, res); } else if(fe.contentEditable == "true") { var doc = fe.ownerDocument; var docURI = doc.documentURI; if( docURI.substr(0, 5) == "data:" && docURI.indexOf("chrome://browser/skin/devtools/") != -1 ) { //~ todo: seems like we only can use paste from clipboard here... return; } var sel = doc.defaultView.getSelection(); var rng = sel.rangeCount && sel.getRangeAt(0); var tmpNode; if(!rng || rng.collapsed) { if(!this.noSelBehavior || _subCall) return; if(this.noSelBehavior == 1) { var r = doc.createRange(); r.selectNodeContents(fe); sel.removeAllRanges(); sel.addRange(r); tmpNode = fe.cloneNode(true); } else { this.handleNoSel(fe); return; } } else { tmpNode = doc.createElementNS("http://www.w3.org/1999/xhtml", "div"); tmpNode.appendChild(rng.cloneContents()); } var orig = tmpNode.innerHTML; var convTable = this.inPrimaryLayout(tmpNode.textContent) ? this.convTableForward : this.convTableBackward; var _this = this; var parseChildNodes = function(node) { if(node instanceof Element) { var childNodes = node.childNodes; for(var i = childNodes.length - 1; i >= 0; --i) parseChildNodes(childNodes[i]); } else if(node.nodeType == node.TEXT_NODE) { var text = node.nodeValue; var newText = _this.switchKeybLayout(node.nodeValue, convTable); if(newText != text) node.parentNode.replaceChild(doc.createTextNode(newText), node); } } parseChildNodes(tmpNode); var res = tmpNode.innerHTML; if(res != orig) doc.execCommand("insertHTML", false, res); } }, handleNoSel: function(node) { this.select(node); this.switchSelKeybLayout(true); }, select: function(node) { var e = this.noSelBehavior; if(!e || typeof e != "object") return; var evt = node.ownerDocument.createEvent("KeyboardEvent"); evt.initKeyEvent( "keypress", true /*bubbles*/, true /*cancelable*/, node.ownerDocument.defaultView, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.keyCode, e.charCode ); node.dispatchEvent(evt); }, insertText: function(ta, text) { //var editor = ta.QueryInterface(Components.interfaces.nsIDOMNSEditableElement).editor var editor = ta.editor .QueryInterface(Components.interfaces.nsIPlaintextEditor); if(editor.flags & editor.eEditorReadonlyMask) return; var sTop = ta.scrollTop; var sHeight = ta.scrollHeight; var sLeft = ta.scrollLeft; // var sWidth = ta.scrollWidth; if(text) editor.insertText(text); else editor.deleteSelection(0, 0); ta.scrollTop = sTop + (ta.scrollHeight - sHeight); ta.scrollLeft = sLeft; // + (ta.scrollWidth - sWidth); } }`);
Отредактировано Dumby (27-07-2019 12:58:04)
Отсутствует
Dumby очень большое спасибо.
Отредактировано Andrey_Krropotkin (27-07-2019 14:48:32)
Отсутствует
Подскажите пожалуйста код кнопки, которая при нажатии просто вызывает диалоговое окно "Параметры соединения" ("Connection Settings"), где задаются параметры прокси. Версия Фокса старая v.50, если это имеет значение.
На форуме
пкм - параметры соединения
лкм - переключает системные настройки - свой урл прокси
// Настройка функций кликов мыши для кнопки ................................
this.onclick = function(e) {
if ( e.button == 0 ) {
cbu.setPrefs("network.proxy.type", (cbu.getPrefs("network.proxy.type") == 2 ) ? 5 : 2 );
}
if ( e.button == 1 ) menuPopup.showPopup( self, -1, -1, "popup", "bottomleft", "topleft");
if ( e.button == 2 && !e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey ) {
e.preventDefault();
cbu.getPrefs("Proxy.connectionsInTab") ? openConnectionsInTab(): openConnections();
}
};
// Проверить наличие строк в about:config и создать если не существует ................................
if ( !cbu.isPref("Proxy.reset") ) {
["Proxy.reset", "Proxy.connectionsInTab", "Proxy.inContextMenu"].forEach(function( pref ) { cbu.setPrefs( pref, false ) });
};
// Подсказка для кнопки ................................
this.onmouseover = function() {
var address = Application.prefs.getValue("network.proxy.http", 0);
var port = Application.prefs.getValue("network.proxy.http_port", 0);
this.tooltipText = "Proxy \nЛ: Переключить прокси \nС: Mеню кнопки"
+ "\nП: Открыть настройки прокси \n\nТекущие настройки прокси: "
+ "\nПорт: "+ port + "\nАдрес: " + address;
};
// Создать меню для кнопки ................................
var array = [
{ label: "Добавление прокси в контекстом меню", value: 'Proxy.inContextMenu' },
{ label: "Открывать настройки прокси как вкладку", value: 'Proxy.connectionsInTab' },
{ label: "Переключать на режим 'Без прокси' при закрытии браузера ", value: 'Proxy.reset' }
];
var menuPopup = self.appendChild( document.createElement("menupopup") );
array.forEach(function( m ) {
var mItem = document.createElement("menuitem");
mItem.setAttribute("label", m.label);
mItem.setAttribute('type', 'checkbox');
mItem.setAttribute('checked', cbu.getPrefs( m.value ) );
mItem.setAttribute('onclick', 'custombuttons.setPrefs("' + m.value + '", !custombuttons.getPrefs("' + m.value + '"))');
menuPopup.appendChild( mItem );
});
menuPopup.setAttribute("onclick", "event.stopPropagation()");
// добавить стандартное контекстное меню ....
menuPopup.appendChild( document.createElement("menuseparator") );
menuPopup.appendChild( document.createElement("menu") ).setAttribute("label", "Меню кнопки");
var clone = menuPopup.lastChild.appendChild( document.getElementById("custombuttons-contextpopup").cloneNode(true) );
clone.setAttribute("onpopupshowing", "document.popupNode = document.getElementById('" + _id + "')");
// Функция открывает настройки прокси в окне ................................
function openConnections() {
var windows = Cc['@mozilla.org/appshell/window-mediator;1'].getService(Ci.nsIWindowMediator).getEnumerator(null);
while( windows.hasMoreElements() ) {
var win = windows.getNext();
if ( win.name == 'Proxy') {
win.focus();
return;
}
};
var win = openDialog("chrome://browser/content/preferences/connection.xul", "Proxy", "centerscreen");
// добавить атрибут "prefwindow"
win.addEventListener("load", function f(e) {
this.removeEventListener("load", f, true);
e.target.documentElement.setAttribute("type", "prefwindow");
}, true);
// закрыть настройки прокси по клику на странице
gBrowser.addEventListener("click", function c() {
this.removeEventListener("click", c );
try { win.close() } catch(e) {};
});
};
// Функция открывает настройки прокси в вкладке ................................
function openConnectionsInTab() {
var connections = gBrowser.getBrowserForTab( gBrowser.selectedTab = gBrowser.addTab("chrome://browser/content/preferences/connection.xul") );
// oбработчик ждет пока откроется прокси, удаляет себя и добавляет атрибут
connections.addEventListener("pageshow", function c(e) {
this.removeEventListener( e.type, c );
e.originalTarget.documentElement.setAttribute("type", "prefwindow");
})
};
// Установливать нужную иконку кнопки при старте баузера или при изменениях в 'about:config' ................................
var s = "network.proxy.type";
function toggleImage() {
var icon = self.ownerDocument.getAnonymousElementByAttribute( self, "class", "toolbarbutton-icon");
icon.src = ( cbu.getPrefs(s) == 2 )
? self.image
: 'data:image/x-icon;base64,AAABAAEAEREAAAEAIADwBAAAFgAAACgAAAARAAAAIgAAAAEAIAAAAAAAyAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAQAAAAAIAA4GQAAnFmkAHQ5fAAQAKAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAEBAQECAgICAgICAgICAgMBAQEAAAQBJBFQOLQ+nX38ecev/mu6of8gfFvtAyUXewAAAAsAAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEBAAAAAAMLUza7PKd//3S7oP2849X9zuvh/mW4mf4XiV7/AB4QZwAAAAAAAAAAAQEBAQAAAAAZGhgTKSwnLyYqJDErKCUnID8vXgaAUP9BlnH8b7ea/ojHrv+q2sf/a7CT+zGWbf8PakXGAAIAAAEBAQMHBwcbAAAAD2BiXn76/ff/4ebg/Onm4f+DtZ7/A31L/j2Wb/+Fwaj/ls23/7rh0v9+vaT+M5du/xKGWO0DIxIdAAAAAAEBAQEAAAABBgYFEaSmorbP08z239vX/4OwnP4ail3/RJlz/5HHsP/T7+X/ms64/3K2mP40k2r/D3tM7AUiExwhIx8meXt1mXt+eKJ3eXSce353n6esouDMysf/o7eq/kOdeP92uZv/vuPT/9Hs4P/C4tT/eLWa+juWbv8bcEq7AAYBAF1gWn7//////f39/P//////////////////////////lcKx/3i9pf/K7OD/2O/l/7ndzf6Fw6n/VK+I/AsxHj8AAAAAXF5bf+Ln2P+AnU/4fZ1N+4WiV/yKp13+jKlh/5CsZf+GpFj/Zpxh/4C5nf+i0L7+k8ex/1udf+UTOCZFAAAAAAEBAQJfYF5/3uXR/16IIPxciiH/Z5Iv/26YOP9ymz3/cpw+/3OcPf9wlzb/YI80/1mKNPu707X/YmZjiAAAAAAEBAQGAAAAAF9gXoDg5tT/cJU6/HGaPf9/pE3/hqtX/4uvXf+NsF7/iKxZ/4KoU/9+o0r/cpY6+9zjyf9ubm2JAAAAAAMEAwQAAAAAX2BegODm1P94nEX8e6JJ/4quXP+Vt2n/nb1z/6LBef+jwXz/ob96/527d/+NrGP71+HG/2praogAAAAABAQDBAAAAABfYF2A4ObU/4WlVvyPsmP/osB7/7HMj/+81J3/wdik/8DXo/+60pz/tc6X/6G6ffvY4sf/amtqiAAAAAAEBAMEAAAAAF9gXn/e5dL/n7l7/LLMk//B16X/zuG2/9jpwv/b68b/2enE/9Pkvv/Q4bv/uMud+9jhyP9qa2mHAAAAAAQEAwQAAAAAX2Bef97k0v+gt335sceT/LrNnfzC1Kj8ydmx/MzatfzK2bP8xtav/MbVr/ywwpL41+HH/2tsaokAAAAABAQDBAAAAABZW1Z3+fz1/+Dm1Pzj6db/5u3b/+nv3v/r8eD/6vDe/+ft2//k69j/4efT/9ngzPv7//b/ZGdhfwAAAAADBAMEAAAAABcZFRpZW1Z6YGFfgWBiYIBhYmGAYmJhgGJjYoBiY2KAYmJhgGFiYYBgYWCAX2BegF1fWoAbHRkeAAAAAAEBAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=';
};
toggleImage();
gPrefService.addObserver( s, toggleImage, false );
addDestructor(function() { gPrefService.removeObserver( s, toggleImage, false ) });
// Переключать на режим 'Без прокси' при закрытии браузера если это разрешено в 'about:config' ................................
var switchOffProxy = {
observe: function(subject, topic, data) {
if ( data.toString() == "shutdown" && cbu.getPrefs("Proxy.reset") ) cbu.setPrefs("network.proxy.type", 0);
}
};
Services.obs.addObserver( switchOffProxy, "quit-application", false );
addDestructor(function() { Services.obs.addObserver( switchOffProxy, "quit-application", false ) });
// Создаем меню для добавление прокси в контекстном меню выделенного текста на странице ................................
(function func() {
var contextMenu = document.getElementById("contentAreaContextMenu");
// создать новый пункт меню
var menuitem = document.createElement("menuitem");
menuitem.setAttribute("label", "Добавить прокси");
menuitem.setAttribute("class", "menuitem-iconic");
menuitem.setAttribute("image", self.image );
addEventListener("command", function(e) { addNewProxy() }, false, menuitem );
// устанавливаем где показывать пункт меню
addEventListener("popupshowing", function() {
menuitem.hidden = !cbu.getPrefs("Proxy.inContextMenu") || !gContextMenu.isContentSelected;
}, false, contextMenu );
addDestructor(function() { contextMenu.removeChild( menuitem ) });
contextMenu.appendChild( menuitem ); // как последний пункт меню
// добавление прокси
function addNewProxy( sel, i ) {
var selection = document.commandDispatcher.focusedWindow.getSelection().toString();
var sel = ( sel == undefined ) ? selection : sel.toString();
sel = sel.replace(/^\s+|\s+$/g, ""); // удалить пробелы, слева и справа от строки
sel = sel.replace(/\s+/g,":"); // заменить пробелы внутри строки
// если порт ...
if ( sel.length < 5 && isFinite(sel) ) {
sel = sel.replace(/g, "");
sel = +sel; // порт как число
var lab = 'порт';
var pref = 'network.proxy.http_port';
}
// если адрес ...
if ( sel.length > 4 && !/.test(sel) && sel.split(".").length == 4 ) {
var lab = 'адрес';
var pref = 'network.proxy.http';
}
// если адрес и порт ...
if ( sel.length > 4 && /.test(sel) && sel.split(":").length == 2 && sel.split(".").length == 4 ) {
var lab = 'адрес и порт';
var array = sel.split(":");
array.forEach(function(sel, i) { addNewProxy( sel, i ) });
}
Application.prefs.setValue( pref, sel ); // переключить настройки прокси
if ( lab == undefined || i !== undefined || i == 0 ) return;
// всплывающая подсказка рядом с выделенным текстом ...
function showTooltip() {
var tooltip = gBrowser.appendChild( document.createElement("tooltip") );
tooltip.style.cssText = "color: red !important; font-weight: bold !important; font-size: 14px !important; -moz-box-orient: horizontal; text-align: center;";
var image = tooltip.appendChild( document.createElement("image") );
image.setAttribute("src", self.image );
var label = tooltip.appendChild( document.createElement("label") );
label.setAttribute("value", "Установлен " + lab + " прокси: " + sel );
var focused = document.commandDispatcher.focusedWindow;
var selection = focused.getSelection().getRangeAt(0).getBoundingClientRect();
var posX = focused.mozInnerScreenX + selection.left;
var posY = focused.mozInnerScreenY + selection.bottom - 5;
tooltip.showPopup( gBrowser, posX, posY );
setTimeout(function() { gBrowser.removeChild( tooltip ) }, 2000 );
};
showTooltip();
};
})();
Отсутствует
egorsemenov06 попробуй замени
// Настройка функций кликов мыши для кнопки .............. this._handleClick =()=> gBrowser.selectedTab = gBrowser.addTrustedTab('http://savefrom.net/?url=' + escape(gBrowser.currentURI.spec)); // Получаем из вкладки Справка массив с доменами закачку из которые подерживает savefrom .............. var hosts = self.Help.split('\n').filter((host)=> /\S/.test(host)).map((host)=> host.trim()); // Если домен сайта совпадает с массивом меняем иконку и подсказку .............. var [img] = document.getAnonymousNodes(self); addEventListener("TabAttrModified", (e, tab = e.target)=> { if ( !tab.selected ) return; let browserMM = gBrowser.selectedBrowser.messageManager; browserMM.addMessageListener('getSdomain', function listener(message) { if ( ~hosts.indexOf(message.data.replace("www.", "")) ) self.tooltipText = "Есть видео для загрузки", img.src = "data:image/x-icon;base64,AAABAAEAEBEAAAEAIACsBAAAFgAAACgAAAAQAAAAIgAAAAEAIAAAAAAAhAQAAAAAAAAAAAAAAAAAAAAAAAAFpUAABaVAAAWlQAAFpUAABaZBBQanQQAHoT4UAqtEtAGsRL0Foj0ZBqdBAAWmQQUFpUAABaVAAAWlQAAFpUAABaVAAAWlQAAFpUAABaVABQeoRQEFnzoQAqc+nS3olP8y7Jr/BapCqASeORQIqEUABaY/BQWlQAAFpUAABaVAAAWlQAAFpUAABaU/BAeoRAAGoDwQAKk/oTbllv+H/9z4jv/g+EToov8Eq0OrBKA6EweoRAAFpT8FBaVAAAWlQAAFpUAABaVAAwenQwAGoDwOAKk+oDzmmf+J/976fPrI/XX5wv6K/935Tuqo/wWrRKsEnzoTB6dEAAWlPwMFpUAABaVAAwanQwAHoT0PAKg9ojnlmf+J/9z4cvi8/Vz3qP9c9qj/YPWq/Xf/yPhE6aD/BKtEqwSgOxQHp0QABaVAAgWnQgAGoDwMAKg8o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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; else self.tooltipText = "Нет видео для загрузки", img.src = self.image; browserMM.removeMessageListener('getSdomain', listener, true); }); browserMM.loadFrameScript('data:,sendAsyncMessage("getSdomain", content.document.domain)', false); }, true, gBrowser.tabContainer );
Отсутствует
попробуй замени
Если уж пробовать, то может сначала так
/*Initialization Code*/ // Настройка функций кликов мыши для кнопки .............. this._handleClick = () => gBrowser.selectedTab = gBrowser.addTrustedTab( "http://savefrom.net/?url=" + escape(gBrowser.currentURI.spec) ); // Получаем из вкладки Справка массив с доменами закачку из которые подерживает savefrom .............. var hosts = this.Help.split("\n").filter(host => /\S/.test(host)).map(host => host.trim()); // Если хост сайта совпадает с массивом меняем иконку и подсказку .............. var img = this.icon || document.getAnonymousNodes(this)[0]; var listener = e => { if (!e.target.selected) return; var uri = gBrowser.currentURI; if ( uri.scheme.startsWith("http") && hosts.includes(uri.host.replace(/^www\./, "")) ) self.tooltipText = "Есть видео для загрузки", img.src = "data:image/x-icon;base64,AAABAAEAEBEAAAEAIACsBAAAFgAAACgAAAAQAAAAIgAAAAEAIAAAAAAAhAQAAAAAAAAAAAAAAAAAAAAAAAAFpUAABaVAAAWlQAAFpUAABaZBBQanQQAHoT4UAqtEtAGsRL0Foj0ZBqdBAAWmQQUFpUAABaVAAAWlQAAFpUAABaVAAAWlQAAFpUAABaVABQeoRQEFnzoQAqc+nS3olP8y7Jr/BapCqASeORQIqEUABaY/BQWlQAAFpUAABaVAAAWlQAAFpUAABaU/BAeoRAAGoDwQAKk/oTbllv+H/9z4jv/g+EToov8Eq0OrBKA6EweoRAAFpT8FBaVAAAWlQAAFpUAABaVAAwenQwAGoDwOAKk+oDzmmf+J/976fPrI/XX5wv6K/935Tuqo/wWrRKsEnzoTB6dEAAWlPwMFpUAABaVAAwanQwAHoT0PAKg9ojnlmf+J/9z4cvi8/Vz3qP9c9qj/YPWq/Xf/yPhE6aD/BKtEqwSgOxQH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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; else self.tooltipText = "Нет видео для загрузки", img.src = this.image; } addEventListener("TabAttrModified", listener, false, gBrowser.tabContainer); listener({target: gBrowser.selectedTab});
Отредактировано Dumby (27-07-2019 21:29:00)
Отсутствует
sonyas75 спасибо, работает
На форуме
Подскажите, нет ли такой кнопки, которая бы при просмотре любого видео на любой странице могла определить и показать (ну или скопировать в буфер) прямую ссылку на это видео? Например, на seasonvar.ru запускаешь в плейере видео, потом жмёшь кнопку и она показывает ссылку на текущее .mp4, такого вида "http://data11-cdn.datalock.ru/fi2lm/64ce511c626e9a1e7167ccfa5eecc00c/7f_Stranger.Things.S01E01.720p.WEB.rus.LostFilm.TV.a1.19.07.16.mp4". Эту ссыль можно увидеть в Инструментах разработчика > Сеть , но это не удобно каждый раз туда лазить. Нельзя ли это кнопкой реализовать?
На форуме
Dumby
Очистка адреса, это Ваше?
/*CODE*/ gURLBar.inputField.focus(); gURLBar.inputField.editor.selectAll(); goDoCommand("cmd_delete"); gURLBar.view.close();
/*Initialization Code*/ // Save, от 07.03.2017. ............. // Подсказка для кнопки .................. this.onmouseover =()=> { this.tooltipText = "// Ctrl + alt + s установить папку для сохранения текста \n// PauseBreak - добавить выделенный текст в файл"; }; var last_title = "jhftye"; (()=> { addEventListener('keydown', e=> { // LOG(e.keyCode); // Ctrl + s сохранить выделенный текст в файл if ( (!e.ctrlKey) && (!e.altKey) && (!e.shiftKey) && (e.keyCode == 19) ) { e.preventDefault(); saveSelectionToFile(); } // Ctrl + alt + s установить папку для сохранения текста if ( (e.ctrlKey) && (e.altKey) && (e.keyCode == 83) ) setPathToFile(); }); function saveSelectionToFile() { var s = "CB.saveSelectionToFile", pref = Services.prefs; try { var pathToFile = pref.getStringPref ? pref.getStringPref(s) : pref.getComplexValue(s, Ci.nsISupportsString).data; } catch(e) { setPathToFile() }; var title = convertFromUnicode("windows-1251", getTabLabel()); var selection = gBrowser.contentDocument.defaultView.getSelection().toString(); var text = "*****\r\n" + title + "\r\n" + convertFromUnicode("windows-1251", selection) + "\r\n"; if(title == last_title) text = "\r\n" + convertFromUnicode("windows-1251", selection) + "\r\n"; last_title = title; var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile); file.initWithPath(pathToFile); var foStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream); file.exists() ? foStream.init(file, 0x02 | 0x10, 0664, 0) : foStream.init(file, 0x02|0x08|0x20, 0666, 0); foStream.write(text, text.length); foStream.close(); document.activeElement.blur(); setTimeout(()=> window.content.focus(), 300); }; function setPathToFile() { var fp = window.makeFilePicker(); fp.init(window, "Создайте текстовой файл для сохранения текста!", fp.modeSave); fp.appendFilters(fp.filterText); fp.defaultString = getTabLabel(); fp.open(result => result == fp.returnOK && cbu.setPrefs("CB.saveSelectionToFile", convertFromUnicode("windows-1251", fp.file.path) + ".txt")); }; function convertFromUnicode(charset, str) { var converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Ci.nsIScriptableUnicodeConverter); converter.charset = charset; str = converter.ConvertFromUnicode(str); return str + converter.Finish(); }; function getTabLabel() { var label = gBrowser.selectedTab.label; var label = label.replace(/[:+.\\\/<>?*|"]+/g, " ").replace(/\s\s+/g, " "); return label; }; })(); self.label = "Save"; self._handleClick =()=> menuPopup.showPopup(this, -1, -1, "popup", "bottomleft", "topleft"); self.image = "data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAAAAADAgBEDRIXnwxQjKQNWp6pDFWXqAxXm6gMV5moDFeaqAxXmqgMV5qoDFebqAxVlqgNW5+pCkyIogwSFqgDAgBHDQoFhyszOv8hheP+IJH7/x+L8v8fjfb/H433/x+N9v8fjfb/H432/x+N9/8fi/L/IJH7/yGF5P0kLTTvDAcDgwgICIQ8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VT8aWVj/ycmJoIaGRlYSEVE1DYzM8NKSUfP0dHG9/X16P/n59v+7e3g/+jo3f/X2M3+6uve/9bWzPdOTUvNOjg3y0RBQLwPDw8lAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="; var pref = "CB.Shortcuts.pathToSaveShortcuts"; var faviconFolder = "C:\\Documents and Settings\\Favicon\\"; // папка для сохранения иконок для ярлыков и ярлыков сайтов var alertsService = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService); // Создать меню для кнопки ............. var array = [ { label: "Сохранить значок веб-сайта", func: "saveFavicon()", image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAACPVBMVEX09ff////C3L+Uq8+Vq8+Uqs+Zr9CZrtCZr9Gfu+ear8+mt9JRf8ORxl3t8vfF06+Twojs8/d9otl8o9s+aquZrs/X9KLp8Pft8fZhisf//+DBzN2hveihv+pii8hti9pgicl6oNlojs1zncNsi836/P2duebx8/eYyWqBp+Gn0IKBvlKHsm9qmaVuk8zt7/FEbauEv1Tp7/JdhL9oi9Pl8e2LwlmdsdD7/P76+/3H7ofo8+peh8eHwFaSteZ0pkp2gl7q8/Ohy5OApt2by2eZuOqbuOWaezWuvtd7nN2HvWxul9Ty9feQxV5ljcqBp+JEcLCVtOOo0nR7odx5n9suX6Z1mtBzmtSXyGPv9PewzfOzx+O6zu/s8fd9o95Xfrthi8lYhMN5oNnw9ffw9Pjw9Pf8/f6ewO/m8O9zmdE6aapsjdyUwouPxWPDzd6XteOSs9B5nNVpnpqHt7h/s6F6n9d7ntSTttGHwVh4qp+Ev1HH7ox6qk5wj+Hm8e3t9fOm0IKAtqOBpNrx+P9ljcyhs9FpkM2hv+/u8/fF0eOLu4N+vFKgzX3p9OSFqN13qExekIl4n9j7/P3x9PhxmNDm8e9Vg8Zfkozr8veq0YTX9qL//92AtamOwnHFz96Fot1diMh+pd13ntmatu+YyW/3+/+Tqs5UgcShzJNbhsdTf8GHs7bo8PaXtuqMr+Ty8/SZt+SUqs7r7Ox3ndb9/f7t8feZyXGYyWWCpNbz9PRuiteNtNDn7/V4ntjx8fGo3JqNAAAAv3RSTlP/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AEVuhDkAAAD+SURBVBhXY5jHzcUMAqxAICq9bx8D96adDFAgaGQOFOBaH7h7zoqZDTlFyptncAAFWBjyi52CXCI0unRLxcECPhsatbbzmlXMnS60hg0kkOxW0uNrq93tNaFpD1ggUm21QK532ZQdSm1hmXKdDCwdnOWVOi1RjNGMQCCrwMDMJ8NZ4LAynVGPkXFp8zpJBubYmn579wXtqhZb0iwn9a1iWLaViYmJ3891obOwYtLEvcYMGyWAAkwJdv6accEhi8LjGVr11SenpC5f61g3NcO0vjCAIc+DjZ2dnWexddWSbYa9nlkM+8BgWsxsK7FZ1VLzRaACNokmtdnyu1QMQgF7Rlh4zWWTAwAAAABJRU5ErkJggg=="}, { label: "Запомнить значок веб-сайта как base64", func: "copyFaviconData()", image: "data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAAAAAAAAAAAAAI2bv/9RVpf/AAAAAAAAAAAAAAAAAAAA/wbwAf8G8AH/BvAB/wbwAf8G8AH/BvAB/wbwAf8G8AH/AAAAAAAAAACIkvD/Jia6/ywpq/8AAAAAAAAAAAAAAAAAAAD/AAAA/wbwAf90qpv/Ymic/1RWqP9OUKr/W2Ch/2dumf9YYKT/Ly/B/xQP3/8MB9P/JCGb/wAAAAAAAAAAAAAAAAAAAP8G8AH/U5ea/ycr8f8VIP3/HiP4/ywo8v8sIvb/LCL2/ywi9v8KBOj/BQDe/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AAAAAAAAAAAAOesQQBjrEGAAaxBwACsQcABrEHDg6xBwAesQcAPrEHAD6xBw8+sQcPprEHD8axBwAGsQQABrEGAAaxB//+sQQ=="}, { separator: ''}, { label: "Сохранить ярлык страницы как…", func: "saveShortcuts('true')", image: "data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADzqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA/5XLDv/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA/5XLDv8E/yT/lcsO//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA/5XLDv8E/yT/BP8k/wT/JP+Vyw7/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA/5XLDv8E/yT/BP8k/wT/JP8E/yT/BP8k/5XLDv/zqgD/86oA//I1///yNf//86oA//OqAP/zqgD/86oA//OqAP+Vyw7/lcsO/wT/JP8E/yT/BP8k/5XLDv+Vyw7/86oA//OqAP/yNf//8jX///OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP+Vyw7/BP8k/5XLDv/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/lcsO/wT/JP+Vyw7/86oA//OqAP/zqgD/86oA//02AP/9NgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA/5XLDv8E/yT/lcsO//OqAP/zqgD/86oA//OqAP/9NgD//TYA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP+Vyw7/BP8k/5XLDv/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/lcsO/wT/JP+Vyw7/86oA//OqAP/zqgD/86oA/wA31v8AN9b/86oA//9If///SH//86oA//OqAP/zqgD/86oA/5XLDv8E/yT/lcsO//OqAP/zqgD/86oA//OqAP8AN9b/ADfW//OqAP//SH///0h///OqAP/zqgD/86oA//OqAP+Vyw7/BP8k/5XLDv/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/lcsO/5XLDv+Vyw7/86oA//OqAP/zqgD/86oA/0CA//9AgP//86oA/07+9f9O/vX/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP9AgP//QID///OqAP9O/vX/Tv71//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/86oA//OqAP/zqgD/AACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQAArEEAAKxBAACsQQ=="}, { label: "Сохранить ярлык страницы без запроса на сохранение", func: "saveShortcuts()", image: false}, { separator: ''}, { label: "Сохранить всю страницу как PNG", func: "WebScreenShot.captureAll()", image: "data:image/x-icon;base64,AAABAAEAEREAAAEAIADwBAAAFgAAACgAAAARAAAAIgAAAAEAIAAAAAAAyAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAzAAAAiAcFBa4KCQmvCgkJrwoJCa8KCQmvCgkJrwoJCa8KCQmvCgkJrwoJCa8KCQmvCgkJrwsJCaECAQE/BQMDAAAAAJUgICD4V1ZW/2FhYf5hYWH/YmFh/2BgYP9fX1//X19f/19fX/9gYGD/YmFh/2FhYf9gYGD+ZmVl/1RSUuIVFBQtCgkJy1paWv+Li4v9h4eH/oiIiP6FhYX+i4uL/pKSkv6Sk5P+kpKS/ouLi/6FhYX+iIiI/oiIiP6Hh4f7lZaW/25tbYQNDQ3OcHBw/5KSkv6Li4v/i4uL/5mZmf+EhIT/ZGRk/1tbWv9kZGT/hISE/5mZmf+Li4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7/8vLy//X19f/y8vL/7u7u//Dw8P/x8vL/8vLy/uXl5f/BwcH+k5GRUAAAAAQeHR1yb25uxn59fcZ9fHzGfXx8xn18fMZ9e3vGfHt7xn17e8Z9fHzGfXx8xn18fMZ9fHzGgH9/xYmIiGVaV1cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="}, { label: "Сохранить видимую часть страницы как PNG", func: "WebScreenShot.capturePage()", image: false}, { label: "Сохранить выбранный элемент страницы как PNG", func: "WebScreenShotByClick.init()", image: "data:image/x-icon;base64,AAABAAEAIBkAAAEAIAAMDQAAFgAAACgAAAAgAAAAMgAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD29fT/2tra/8jIyP/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/FxcX/xcXF/8XFxf/FxcX/xcXF/8jIyP/a2tr/9vX0/+zs7P/ak0b/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/9qTRv/s7Oz/7Ozs/+J9Dv/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+/6SdmP/8+/r//Pv6//z7+v/8+/r//Pv6//z7+v/8+/r//Pv6//z7+v/8+/r/+vn4//z7+v/6+fj/4n0O/+zs7P/s7Oz/4n0O//z7+v/8+/r//Pv6//z7+v/8+/r//Pv6//z7+v/8+/r//Pv6//z7+v/8+/r//Pv6//z7+v/8+/r/aFtT//L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4dvY/+Hb2P/h29j/4dvY/+Hb2P/h29j/4dvY/+Hb2P/h29j/4dvY/+Hb2P/h29j/4dvY/+Hb2P/h29j/4dvY/+Hb2P/ifQ7/7Ozs/+zs7P/ifQ7/4NnW/+DZ1v/g2db/4NnW/+DZ1v/g2db/4NnW/+DZ1v/g2db/4NnW/+DZ1v/g2db/4NnW/+DZ1v/g2db/4NnW/+DZ1v/g2db/4NnW/+DZ1v/g2db/4NnW/+DZ1v/g2db/4NnW/+DZ1v/g2db/4NnW/+J9Dv/s7Oz/9fTy/+J9Dv/8+/r/+vn4//r5+P/6+fj/+vn4//r5+P/6+fj/+vn4//r5+P/6+fj/+vn4//r5+P/6+fj/+vn4//r5+P/6+fj/+vn4//r5+P/6+fj/+vn4//r5+P/6+fj/+vn4//r5+P/6+fj/+vn4//r5+P/6+fj/4n0O//X08v/8+/r/6KFU/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ifQ7/4n0O/+J9Dv/ooVT//Pv6/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="}, { label: "Сохранить выбранную область страницы как PNG", func: "WebScreenShotByClipping.init()", image: "data:image/x-icon;base64,AAABAAEAEREAAAEAIADwBAAAFgAAACgAAAARAAAAIgAAAAEAIAAAAAAAyAQAAAAAAAAAAAAAAAAAAAAAAADDn2Hfz5pE/8eVQP7IlkH/yJZB/8iWQf/IlUH/yJVA/8iVQP/IlED/yJQ//8iUP//IlD//yJM+/8iTPv/Hkj3/nI1w//bDbP//8OH//+zW///s1///69b//+rV///p1P//59L//+XQ///izf//38n//9vG///ZxP//1b///dG////Prf/KlkX/88N4/v37///99Pj//fT6//vy9v/68fT/+u/y//rt8P/66u3/+ufq//rl6P/64eT/+93h//3a3//71d7//9LK/86XR//0xHb//vv////18///9fT///f5///4////9f7///P8///v+f//7Pb//+nz///m8f//4eb//9vZ//3Y2v//1Mb/zphH//TGd//+/////Pj1///7///Q58r/m9aV/6TZnv+i15r/otWY/6LTlv+j0pb/mc6M/9DXuf//3+P//Nnc///Wyf/OmUf/9MZ3//7////8+/j//////53WnP+Y5pn/rvGv/6PvpP+e7p//me6b/5nvm/95533/mM+L///j7f/629z//9jL/86ZR//0xnf//v////z9+v//////qtup/8Xzxf/a/tn/z/vO/8n7yf/D+sL/xPvD/6Hzo/+j05b//+Tu//re3///2cz/zplI//XGeP/+/////P36//////+n26f/uvC6/9T71P/K+Mr/xvjG/8D3wP+/+L//nfCf/6LTlf//5u//+t/g///cz//OmUj/9MZ3//7////8/fr//////6rcqv/G9MX/3//f/9n92f/V/NX/0PzQ/9H+0P+s9a7/pdSY///o8f/64OL//9zP/86aSP/0xnf//v////z9+f//////ndid/5TjlP+v7q//qeyp/6jsqf+k7KX/p+6n/4Tlh/+Z0Y7//+r0//rh4v//3tH/zppI//TGd//+/////v77///////Y8Nj/p9+n/6/jr/+t4a3/rd2p/67bpv+u2ab/p9Wc/9jgx///6Oz//OPl///e0f/Omkj/9MV1//7//////fr///78///+/f///////////////////P////j////0+///8fn//+vu///m4v/94+P//97P/86ZSP/zx3v//v/////+/f///////f////v////7////+/////v+///7+///+/f///vz/P/98Pr//+33//3p9///5OL/zppL//a1Sv/0xoL/9cR7//XEfP/1xHz/9cR8//XEfP/1xH3/9cR8//XCev/1wXr/9b94//W9d//1u3X/87l0//y6bP/Llj7/+pMA/vWBAP/1gwD/9YMA//WDAP/1gwD/9YMA//WDAP/1gwD/9YQA//WEAP/1hAD/9YQA//WEAP/zhAH//okA/8qLIv3xpzP/4ptV/+OdU//jnVP/451T/+OdU//jnVP/451T/+OdU//jnVL/451S/+OdUv/jnVL/451S/+GdVf/qnUf/2aRJ/9q0c9/8yn7/98V5/vjGev/4xnr/+MZ6//jGev/4xnr/+MZ6//jGev/4xnr/+MZ6//jGev/4xnr/+MZ6/vrIe/+jj2y4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="}, { separator: ''}, { label: "Сохранить всю страницу как PDF", func: "savePageToPDF()", image: "data:image/x-icon;base64,AAABAAEAEREAAAEAIADwBAAAFgAAACgAAAARAAAAIgAAAAEAIAAAAAAAyAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYUw4pJt3V/+Rb1D8lnFP/55zTf+VcVH/lXJS/5VyUv+VclL/lXJS/5VyUv+VclL/k3BR/J56Wv9cRzSkAAAAAJNvUKTto2L/4ppe/uehZf/Pmmr/noZv/9Scav/Wl17/1plh/9eZYf/XmWH/15lh/9eZYf/WmGD/2Jlg/suRXP9mRiuk8rWA/397dP1akKn/rqqi/3LF3f8Mntj/4dLJ///+9f/48u3/9e7n//bt5v/47+f/+O/n//jv5//rvZP/1ZJX/a9/VP9+lrD8AIvz/xOt+f8Douv/ALb6/wC28/9tmar/z8jJ//Lq5/////7//v////n9///6/P3//////+Ta0P/PjVP/pnpT/IWds/+aiXj/5efl/8Px//951/3/LMz//wCx8/8GltL/NIu3/4ycqf/l29L////+//n6+//8/v//3tXM/8+OVP+oe1P/6K57/86QWP/r6Ob////////++v/r9/z/oOb9/zDL//8Arf//AI/r/ydysv+hpqr//PTr///////d1Mz/0I5U/6h7U//osH//wo5g/+fm5P/7/f//9vf5//z7+////vv/9/r8/5Dc/P8Oqv7/AJf//wF02v9ffZ7/8Ojh/+Ha1P/NjFL/qHtT/+ewf//Ej1//7O3r///////+/v7//v7+//f5+v/6+vv////8/8Tq/f8hp/7/AJH//wB18/8/bqj/1MGu/9mXXv+leVH/569+/8iSYv+/tKn/wLew/8O5sf/P0M////////7+/v/3+fv////7/9Hv/v8hoP3/AIn//wB4/v84ZqL/w4NH/619VP/nsYD/x45c/9W5of/bv6j/0Jxt/6J/YP+spqD/2N3i//7////6+/3///76/8vr/v8Slv7/AIb+/wBz//83VH7/nW1B/+ewfv/Fjl7/7Ozr///////9+/r/9d7K/9Ghdv+jd1D/pJ6Y/+jt8f/9///////7/6fb/v8Ahv7/AYD//wRp6f95YlT/57B//8SOXv/n5uT//v7///r7/P/8/v////////XRsv/DhEv/loBu/9DX3P/9/v/////7/2O6/f8Afv//FnTU/5JtTf/nsH//xY9e/+jn5f/+/f//+fj5//n4+P/5+Pn/+/////Xbxf/Wj1D/nX1h/+Ll6P////7/3+/3/w+V//8tcbP/qHJB/+WuffzCjV7/5efn///////+/v7//////////////v7///////XRsP/TnW3/8fT3//////////z/ddD//0Nxl/+zdkH88LmH/9CRWP2+qJT/0M7N/8/Jxv/Pysf/z8rH/8/Kxv/Py8n/zsO6/7+pmP/PzMv/zsnG/9bNyP+nsK7/h4R3/b2BT/+Sb1Ck7qxw/9GSW/69hlb/wYhX/8CIV//AiFf/wIhX/8CIVv/BiVj/xI1d/8CIVv/BiFf/vYZW/9STW/7ppmv/bE80pAAAAACUd16k+sui/+7AmPzwwpr/8MKa//DCmv/wwpr/8MKa//DCmf/vwZj/8MKa//DCmv/uwJj8+cui/5N3XaQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="}, { label: "Добавить url и сохранить страницу", func: "savePage()", image: "data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgICAyMjIzwyMjFeLi0tVS8vLlcuLy9XLS4uVywsLFUuLi5aKSkpUggICBMAAAAAAgICAQAAAAAAAAAAAAAAABQTEyOgoJ/yysvL/s3Pz/7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Dy/OXm5vnf39//ZWVlrgAAAAAGBQQQdFdHy8Wfhv/d18797e7w/+3t7P/y8u7/7N/G/7unff+/uqT/4+Tl/97d3v/c3Nz/sLCw+h8fH0IBAQABAAEBABEVFx8vJB1cWy8ciZNrU8itknHrkWdIxUsqFnEnJSBRMjQ3WS8uL1csLCtVMjIyXiIiIj4BAQECAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="}, { label: "Сохранить выделенный текст как txt файл", func: "saveSelectionToTxt()", image: "data:image/x-icon;base64,AAABAAEAEREAAAEAIADwBAAAFgAAACgAAAARAAAAIgAAAAEAIAAAAAAAyAQAAAAAAAAAAAAAAAAAAAAAAAAAAQE6AAAAZAAAAGgAAAJmAAACZgAAAGYAAABmAAAAZgAAAGYAAABmAAAAZgAAAGYAAABlAAAAaQABAmYAAQEjAAAAADlVkOdVcKHxVXKi8kdklPJLZpfyU3Cg8lJvn/JRbZ7yUW+g8lFun/JRbp/yUG6e8lVyofFVdKjzLkV45wAAAFABAQEAaIzF/3y34v9wsuL/cJe0/0lpgv9bjLP/dLLh/2+v3v9sq9v/cK3d/3Gv3v9sqtv/b7Df/4G77P9VcqT2AAAAVAMDAQBnir/+ZqfU/pDB4/7a3uD+j46N/kxYXv6To6/+1er4/tXp+P7J3/D+1ej4/svg8v6Gut/9aqzd/lhxnvAAAABSAwIBAGaIvv9pptX/ocfj//f4/P/P0tX/g4CA/1xZWf+Woqr/2uz8/9Hl+f/W5fT/2Of3/5fC4v5tq93/Vm+e8QAAAFIDAgEAaYm+/3mw2/+iyeX/9Pn8/+z0+//IzNL/d3h5/0tMTv+Mkpn/xdvs/9Hp/f/O4PL/msXk/nmz4/9XcJ/xAAAAUgMDAQBti7//k7/h/6fL5v/v9fn/4u73/9Dk9P+8wMT/YGpx/zJJWv94iJf/ztzo/9Pp/P+ZwuD+gLfk/1dwnvEAAABSAwMBAHOPwf+myub/sNHp//j7/P/6/P3/8fr///r39P+sxdP/IXWq/xJJcv+NjZD/0+Lu/6TN7f6Ft+L/WXGf8QAAAFIDAwEAd5LD/7PR6/+ZxOP/0ePx/97r9f/Y5/L/3e32/8Tc7f9gseT/CHK3/zBYdv+HiY7/lL/f/pLE7/9bcJ3xAAAAUgMDAQB4k8P/xNvx/5/F5f+kyOX/qMrn/6TH5f+kyOX/sM/q/5e51P9Mm83/GHm3/xxIav9fdYf+pMvs/1x1pfIAAABTAwMBAHmSxf/O4/T/y9/y/8Hb9P/C3PX/wNv0/7vW7/+93ff/utDm/42fsf9Gjbn/EXS2/ytSbv6Fj5r/WnGc8gAAAFICAwEBepPE/tHk9f/S5PX/vMjV/7fCzP+3w8//uMPP/7XBzP+6ytf/qa+4/3h/hv9Ghaz/JoO+/jNXdP82PVnyAAAAVgACAgCBmcb/2+r3/dHh8fyPkpX/kI6N/5yam/+dnJ3/paWk/6enpf+sr6//mpSR/3Bubf9SjbD8H4C+/QsrSvcCAAB/AAAAA3yVx//j8///3u/7/52gpf6pqKf+uLm5/rq7u/7Ly8v+ycnI/paWlf6LjY/+np2f/Xh+g/5gnL7/MX+y/xcgJ80BAgNNN1OUs6W84fDA1O73mJyj/ainpv+2trb/t7e4/8fHyP/Fxsb/kZGQ/4eGhP+vucT/j6G+/W53k/NlkbnwNoOv/AgiNb8CCBsQDRo/YwsaO3B0d33arKyp9q2trfWvr6/2u7u79ru7vPawr7H1sbCt9nJ2gOQIGD6bFCFEYB0qPE1Bf6SpEz9cggAAAAMCAQEBAQAAADIyMmlDQ0ONQUFBhUFBQYVCQkGFQkJBhUhISIRNTU2OKysrZAEAAAUBAQAAAgEAAAkEAAEDAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="}, { separator: ''}, { label: "Запомнить изображение как base64, в контекстном меню", value: "CB.Save.WebScreenShotOnImage"}, { label: "Сохранить выделенный текст в файл, в контекстном меню", value: "CB.Save.SelectionToFile" }, { label: "Открыть выделенный текст в внешнем редакторе, в контекстном меню", value: "CB.Save.TextToEditor"}, ]; var menuPopup = self.appendChild(document.createElement("menupopup")); array.forEach((m,i)=> { if ("separator" in m) { menuPopup.appendChild(document.createElement("menuseparator")); return }; var mItem = menuPopup.appendChild(document.createElement("menuitem")); mItem.setAttribute("label", m.label); mItem.setAttribute("class", "menuitem-iconic"); if ("image" in m) mItem.setAttribute("image", m.image || array[i-1].image); if ("value" in m) { mItem.setAttribute('type', 'checkbox'); mItem.setAttribute('checked', cbu.getPrefs(m.value) ); mItem.onclick =()=> cbu.setPrefs(m.value, !cbu.getPrefs(m.value)); } if ("func" in m) mItem.addEventListener("command", ()=> eval(m.func.toString())); }); menuPopup.setAttribute("onclick", "event.stopPropagation()"); // Сохранить как PNG страницу или части страницы ............. WebScreenShot = { capture: function(win, x, y, width, height) { var canvas = document.createElementNS(xhtmlns, 'canvas'); canvas.width = width; canvas.height = height; var ctx = canvas.getContext("2d"); ((i = 17)=> { try { ctx.drawWindow(win, x, y, canvas.width, canvas.height, "white") } catch(e) { canvas.height = canvas.width*i; arguments.callee(--i) }; })(); var url = makeURI(canvas.toDataURL("image/png")); var fp = window.makeFilePicker(); fp.init(window, "Сохранить как…", fp.modeSave); fp.appendFilter("", "*.png"); fp.defaultString = getTabLabel() + " " + (new Date().toLocaleFormat("%d.%m.%Y. %H:%M:%S")) + ".png"; if (fp.show() == fp.returnCancel || !fp.file) return; var wbp = window.makeWebBrowserPersist(); parseInt(Services.appinfo.version) < 36 ? wbp.saveURI(url, null, null, null, null, fp.file, null) : wbp.saveURI(url, null, null, null, null, null, fp.file, null); // если FF36+ }, captureAll: function() { var win = content; WebScreenShot.capture(win, 0, 0, win.innerWidth + win.scrollMaxX, win.innerHeight + win.scrollMaxY); }, capturePage: function() { var win = content, doc = win.document, body = doc.body, html = doc.documentElement; var scrX = (body.scrollLeft || html.scrollLeft) - html.clientLeft; var scrY = (body.scrollTop || html.scrollTop) - html.clientTop; WebScreenShot.capture(win, scrX, scrY, win.innerWidth, win.innerHeight); }, onImage: function(image) { var canvas = document.createElementNS(xhtmlns, 'canvas'); canvas.width = image.naturalWidth; canvas.height = image.naturalHeight; var ctx = canvas.getContext('2d'); ctx.drawImage(image, 0, 0); var base64 = canvas.toDataURL(); gClipboard.write(base64); // стиль для изображение в сплывающей подсказке .... var sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService); var uri = makeURI('data:text/css,'+ encodeURIComponent('#alertImage { height: 25px !important; width: 25px !important; }')); sss.loadAndRegisterSheet(uri, 0); alertsService.showAlertNotification(base64, self.label, "Запомнил изображение как base64", false, "", (s, t)=> { if (t == 'alertfinished') sss.unregisterSheet(uri, 0); // удалить стиль когда подсказка закрывается }, ""); } }; // Сохранить выбранную область страницы как PNG .... WebScreenShotByClipping = { capture: WebScreenShot.capture, handleEvent: function(e) { if (e.button) return false; e.preventDefault(); e.stopPropagation(); switch(e.type){ case 'mousedown': this.downX = e.pageX; this.downY = e.pageY; this.bs.left = this.downX + 'px'; this.bs.top = this.downY + 'px'; this.body.appendChild(this.box); this.flag = true; break; case 'mousemove': if (!this.flag) return; this.moveX = e.pageX; this.moveY = e.pageY; if (this.downX > this.moveX) this.bs.left = this.moveX + 'px'; if (this.downY > this.moveY) this.bs.top = this.moveY + 'px'; this.bs.width = Math.abs(this.moveX - this.downX) + 'px'; this.bs.height = Math.abs(this.moveY - this.downY) + 'px'; break; case 'mouseup': this.uninit(); break; } }, init: function() { this.win = document.commandDispatcher.focusedWindow; if (this.win == window) this.win = content; this.doc = this.win.document; this.body = this.doc.body; if (!this.body instanceof HTMLBodyElement){ alertsService.showAlertNotification(self.image, self.label, "Не удается захватить!"); return false; } this.flag = null; this.box = this.doc.createElement('div'); this.bs = this.box.style; this.bs.border = '#0f0 dashed 2px'; this.bs.position = 'absolute'; this.bs.zIndex = '2147483647'; this.defaultCursor = getComputedStyle(this.body, '').cursor; this.body.style.cursor = 'crosshair'; ["click", "mouseup", "mousemove", "mousedown"].forEach(type=> this.doc.addEventListener(type, this, true)); }, uninit: function() { var pos = [this.win, parseInt(this.bs.left), parseInt(this.bs.top), parseInt(this.bs.width), parseInt(this.bs.height)]; this.body.style.cursor = this.defaultCursor; this.body.removeChild(this.box); this.capture.apply(this, pos); ["click", "mouseup", "mousemove", "mousedown"].forEach(type=> this.doc.removeEventListener(type, this, true)); }, }; // Сохранить выбранный элемент на странице как PNG .... WebScreenShotByClick = { capture: WebScreenShot.capture, getPosition: function() { var html = this.doc.documentElement; var body = this.doc.body; var rect = this.target.getBoundingClientRect(); return [ this.win ,Math.round(rect.left) + (body.scrollLeft || html.scrollLeft) - html.clientLeft ,Math.round(rect.top) + (body.scrollTop || html.scrollTop) - html.clientTop ,parseInt(rect.width) ,parseInt(rect.height) ]; }, highlight: function() { this.orgStyle = this.target.hasAttribute('style') ? this.target.style.cssText : false; this.target.style.cssText += 'outline: red 2px solid; outline-offset: 2px; -moz-outline-radius: 2px;'; }, lowlight: function(e) { if (this.orgStyle) this.target.style.cssText = this.orgStyle; else this.target.removeAttribute('style'); }, handleEvent: function(e) { switch(e.type){ case 'click': if (e.button) return; e.preventDefault(); e.stopPropagation(); this.lowlight(); this.capture.apply(this, this.getPosition()); this.uninit(); break; case 'mouseover': if (this.target) this.lowlight(); this.target = e.target; this.highlight(); break; } }, init: function() { this.win = content; this.doc = content.document; ["click", "mouseover"].forEach(type=> this.doc.addEventListener(type, this, true)); }, uninit: function() { this.target = false; ["click", "mouseover"].forEach(type=> this.doc.removeEventListener(type, this, true)); }, }; // Сохранить страницу как PDF файл через сервис 'pdfmyurl.com' ............. function savePageToPDF(loc = content.location) { loc.href.startsWith("http") && loadURI("http://pdfmyurl.com?url=" + loc); }; // Сохранить ярлык страницы в указанную папку или в последнюю папку сохранения .............. function saveShortcuts(saveAs, shortcutName) { var url = content.document.location; cbu.isPref(pref, "C:\\"); // блокируем создание ярлыков для внутренних страниц FF if ( ["about:", "chrome:", "jar:", "data:"].indexOf(url.protocol) !== -1 ) { alertsService.showAlertNotification("chrome://global/skin/icons/error-16.png", self.label, "Не поддерживается"); return; } // получить название ярлыка if ( saveAs ) shortcutName = setPathToShortcut(shortcutName) else shortcutName = shortcutName ? shortcutName : getSiteName() + getTabLabel() + " " + Date.now(); if ( saveAs && shortcutName == false ) return; // сохранить иконку таба в установленную папку var faviconName = "favicon" + Date.now(); var favicon = saveFaviconToFolder(faviconName); // получить путь для сохранения ярлыка из 'about:config' var pathToFolder = gPrefService.getComplexValue(pref, Ci.nsISupportsString).data; var pathToShortcut = pathToFolder + shortcutName + ".url"; // адрес страницы в UTF-8 если это протокол 'file' или в 'Punycode' если это .рф домен if ( url.protocol == 'file:' ) url = convertFromUnicode("UTF-8", url); if ( url.host.slice(-3) == '.рф') url = Services.io.newURI(url, null, null).asciiSpec; // текст ярлыка из адреса страницы и пути к иконке таба var text = "[InternetShortcut]" + "\r\n" + "URL=" + url; var pathToFavicon = "IconFile=" + faviconFolder + faviconName + ".ico" + "\r\n"; if ( favicon == false ) var pathToFavicon = ""; var data = text + "\r\n" + pathToFavicon + "IconIndex=0"; // записать текст в ярлык var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile); var foStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream); file.initWithPath(pathToShortcut); foStream.init(file, 0x02|0x08|0x20, 0666, 0); foStream.write(data, data.length); foStream.close(); // подсказка var notification = 'Сохранил в: ' + pathToFolder; var image = (favicon == false) ? self.image : gBrowser.selectedBrowser.mIconURL; alertsService.showAlertNotification(image, shortcutName, notification); }; // Установка пути и названия для сохранения ярлыка через диалог сохранения, отмена отдаст 'false' .............. function setPathToShortcut(shortcutName) { var pathToFile = gPrefService.getComplexValue(pref, Ci.nsISupportsString).data; var shortcutName = shortcutName ? shortcutName : getSiteName() + getTabLabel() + " " + Date.now(); // диалог создания и установки пути var fp = window.makeFilePicker(); fp.init(window, "Укажите где сохранить ярлык страницы!", fp.modeSave); fp.appendFilters(fp.filterAll); fp.defaultString = shortcutName; if ( fp.show() == fp.returnCancel ) return false; // убрать название файла из пути к файлу и записать путь в 'about:config' var filePath = fp.file.path.toString(); var fileName = fp.file.leafName.toString(); cbu.setPrefs(pref, convertFromUnicode("UTF-8", filePath.replace(fileName, "")) ); return fileName; }; // Сохранить в указанную папку иконку таба как .ico и без диалога сохранения .............. function saveFaviconToFolder(faviconName) { var url = gBrowser.selectedTab.image.replace("#-moz-resolution=16,16",""); if ( !url || content.document.mozSyntheticDocument ) return false; if ( url.startsWith("http") ) url = "moz-anno:favicon:" + url; var img = new Image(); img.onload = function() { var tools = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools); var stream = Cc["@mozilla.org/scriptableinputstream;1"].createInstance(Ci.nsIScriptableInputStream); var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile); var request = img.QueryInterface(Ci.nsIImageLoadingContent).getRequest(img.CURRENT_REQUEST); var istrm = tools.encodeImage(request.image, "image/vnd.microsoft.icon", "format=bmp;bpp=32"); stream.init(istrm); var data = stream.readBytes(stream.available()); istrm.close(); stream.close(); var path = faviconFolder + faviconName + ".ico"; file.initWithPath(path); file.exists() && file.remove(false); try { file.create(file.NORMAL_FILE_TYPE, 448) } catch(e) { setTimeout(()=> { alertsService.showAlertNotification("chrome://global/skin/icons/error-16.png", self.label, "Не могу сохранить иконку вкладки в " + faviconFolder + "\n" + "Укажите в начале кода кнопки другой диск!"); }, 2500); }; cbu.writeFile(path, data); } img.setAttribute("src", url); }; // Добавить адрес наверху страницы и открыть диалог сохранения страницы ............. function savePage() { var sURL = gURLBar.value; content.document.body.innerHTML = "<table width=100%><tr><td align=left><small><a target=_blank href=" + sURL + ">"+ sURL + "</a></small>\n</td></tr></table>" + content.document.body.innerHTML; saveDocument(window.content.document); }; // Сохранить иконку текущего сайта с диалогом сохранения ............. function saveFavicon() { saveImageURL(gBrowser.selectedTab.image, "save", null, false, false, null, content.document) }; // Скопировать иконку текущего сайта как base64 код ............. function copyFaviconData() { var img = new Image(); img.src = gBrowser.selectedTab.image; WebScreenShot.onImage(img); }; // Сохранить выделенный текст или весь текст на странице как txt файл ............. function saveSelectionToTxt() { var sel = getSelect(); !sel && document.getElementById("cmd_selectAll").doCommand(); // создать название файла из заголовка страницы и текущего времени и сохранить текст .... var fileTitle = getTabLabel() + ' ' + (new Date()).toLocaleFormat("%H·%M·%S"); saveURL("data:text/plain," + encodeURIComponent(content.location + ("\r\n\r\n" + sel)), fileTitle + ".txt", null, false, false, null, content.document); !sel && goDoCommand("cmd_selectNone"); }; // Добавляем в контекстного меню страницы новые пункты ............. ((contextMenu, el)=> { // в контекстного меню изображений .... var baseItem = contextMenu.appendChild(document.createElement("menuitem")); baseItem.id = "content-baseItem"; baseItem.setAttribute("label", "Запомнить изображение как base64"); baseItem.onclick =()=> WebScreenShot.onImage(gContextMenu.target); // в контекстного меню выделенного текста .... var saveItem = contextMenu.insertBefore(document.createElement("menuitem"), el); saveItem.id = "content-saveItem"; saveItem.setAttribute("label", "Сохранить выделенный текст в файл"); saveItem.setAttribute("class", "menu-iconic"); saveItem.setAttribute("image", "data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAAAAADAgBEDRIXnwxQjKQNWp6pDFWXqAxXm6gMV5moDFeaqAxXmqgMV5qoDFebqAxVlqgNW5+pCkyIogwSFqgDAgBHDQoFhyszOv8hheP+IJH7/x+L8v8fjfb/H433/x+N9v8fjfb/H432/x+N9/8fi/L/IJH7/yGF5P0kLTTvDAcDgwgICIQ8Ojf/0czA+Oji1fzh18r85NzO/OTbz/zj287849vO/OPbzvzk3M/84dfK++ji1f3Sy8D5NDIvywYGB3kKCgqFQ0A8/+XXw/v979f/9uTO//rp0f/66NH/+ujR//rn0f/66NH/+ujR//bkzv/979f/5tfD/UZ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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="); saveItem.onclick =()=> saveSelectionToFile(); var editorItem = contextMenu.insertBefore(document.createElement("menuitem"), el); editorItem.id = "content-editorItem"; editorItem.setAttribute("label", "Открыть выделенный текст в внешнем редакторе"); editorItem.setAttribute("class", "menu-iconic"); editorItem.setAttribute("image", "data:image/x-icon;base64,AAABAAEAEBAAAAEACABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAQAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAA////AIiafwC85K4AS1ZGANLsyABKU0UAy+m+AL/lsQC14aQAn9WMAJ/QjQCsrKwAqNyXAOPz3ADe8dcA2e/QANPtyQDM68EAxei4AL7lrwC14aUArt6dAJfOhACdz4sAgICAALThpQDg8doA3vHVANjuzgDR7MYAyum+AMLmtQC7460AsuCjAK3dmgCUy4AArdedANDsxQDL6sAAz+PIAMviwwDH4L4Awd62ALvbrwC02KcArdafAKbTlgCEu3EAtNWoANPqywDa8NIA1u7NANHtxwDK6cAAw+e3ALzkrwC14aYAr9+dAKXbkQCJwnMA1+3QAKncmADd8dQAyuLBAMbgvAC6264AttmoAK/XoACn1JYAotKPAJbNgwB9tWgA4+zfANju0ADT7coAz+vFAMPntgC95K8Art6eAKndlQCa1IYAi8R3AP3+/QDD37kAvt2yALjarACz2KYArdaeAKHRjwCXzoUAj8V6AI6/ewDu8e4Awea2AMrqwQDG6LoAweazALnjqwCz4KQAr9+cAKbbkwCd2IkAlc1/AKbTlQC73K8At9qqALDXowCp1ZsApdOVAKDRjQCYzoUAksx7AIi+cwCu0aEAp9yUAMXougDC5rYAveSuALfipwCw4J8AqdyXAKLajwCd2IcAlNR9AI3FdwDU6ssAqdWZAKPSkgCe0YsAmc6GAJDLfQB/tmoA3enZAJfWhACc2IkApNuRAKTbkACj2pAAodqOAKHZjgCl25IAotmOAIzHdgAPAAAA2JIKAAAA9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOzARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACcrkUA9CUMAAAAAAAAAAAAAAAAAAAAAAAAAA8AAQAAAAEAAAAAAAAAVCIMAAAAAAABAAAAuwP/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAACZDSMAAQAAAAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAABAEAABHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZGRkZGRkZGRkZAAAAAAAZAQEBAQEBAQEBARkAAIeHiImKi4yNjY5+AQEZAD4mJlZXRH+AgYKDhIVdGQBzJnR1dnd4eXp7fH1+ARkAGiYnaWprbG1ub3Bxcl0ZACdeJl9gYWJjZGVmZ2gBGQAAAyZUVVZXWEVZWltcXRkAAA1KS0wfTU45T1BRUlMZAAA+P0BBK0JDREVGR0hJGQAAAzIzNDU2Nzg5Ojs8PRkAACYnKCkqKywtLi8YMDEZAAAAGhscHR4fICEiIyQlGQAAAA0ODxAREhMUFRYXGBkAAAADBAUGBwYIBgkGChkAAAAAAAACAAIAAgACAAIAAPgBAADwAAAAwAAAAIAAAACAAAAAgAAAAIAAAADAAAAAwAAAAMAAAADAAAAAwAAAAOAAAADgAAAA4AEAAPqrAAA="); editorItem.onclick =()=> textToEditor(); // устанавливаем где и при каких настройках показывать новые пункты .... addEventListener('popupshowing', e=> { if (e.target != e.currentTarget) return; var sel = gContextMenu.isTextSelected; saveItem.hidden = !sel || !cbu.getPrefs("CB.Save.SelectionToFile"); editorItem.hidden = !sel || !cbu.getPrefs("CB.Save.TextToEditor"); baseItem.hidden = !gContextMenu.onImage || !cbu.getPrefs("CB.Save.WebScreenShotOnImage"); }, false, contextMenu); // удалять новые пункти при изминениях .... addDestructor(()=> { baseItem.remove(); saveItem.remove(); editorItem.remove(); }); })(document.getElementById("contentAreaContextMenu"), document.getElementById("context-sep-open")); // Сохранить выделенный текст в файл на рабочем столе ............. function saveSelectionToFile() { // создать текст для записи var url = content.document.location; if (/\.рф/.test(url.host)) url = convertFromUnicode("UTF-8", url); var time = new Date().toLocaleFormat("%H:%M:%S"); var text = convertFromUnicode("UTF-8", getSelect()); var title = convertFromUnicode("UTF-8", getTabLabel()); var text = "..............................................................\n" + title + " - " + time + "\n" + url + "\n\n" + text + "\n\n\n"; var text = text.replace(/\u000A/g, "\u000D\u000A").replace(/\u000D\u000D\u000A/g, "\u000D\u000A"); // путь к файлу и название файла var file = Services.dirsvc.get("Desk", Ci.nsIFile); file.append("Save - " + (new Date()).toLocaleFormat("%d.%m.%Y") + ".txt"); // создать файл с текстом или добавлять текст в файл var foStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream); file.exists() ? foStream.init(file, 0x02 | 0x10, 0664, 0) : foStream.init(file, 0x02|0x08|0x20, 0666, 0); foStream.write(text, text.length); foStream.close(); // всплывающая подсказка дает возможность открыть файл если кликнуть на подсказке var notification = 'Сохранил выделенный текст в файл на рабочий стол'; var image = gBrowser.selectedTab.image || self.image; alertsService.showAlertNotification(image, notification, "Кликни чтобы открыть файл", true, "", (s, t)=> { if (t == 'alertclickcallback') file.launch(); }, ""); }; // Создать текстовой файл с выделенным текстом в папке профиля и открыть в редакторе ............. function textToEditor() { var text = convertFromUnicode("utf-8", getSelect()); var file = Services.dirsvc.get('ProfD', Ci.nsIFile); file.append("TextToEditor.txt"); custombuttonsUtils.writeFile(file.path, text); file.launch(); }; // Конвертировать текст в юникод ............. function convertFromUnicode(charset, str) { var converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Ci.nsIScriptableUnicodeConverter); converter.charset = charset; str = converter.ConvertFromUnicode(str); return str + converter.Finish(); }; // Получить название домена с заглавным первым символом и без приставок( типа .ru и .com ) .............. function getSiteName() { try { var domain = content.document.domain.split('.') } catch(e) { return "" }; domain = (domain.length == 2) ? domain[0] : domain[1] return domain[0].toUpperCase() + domain.slice(1).split('.')[0] + " "; }; // Получить название вкладки без не сохраняемых символов и лишних пробелов .............. function getTabLabel() { var label = gBrowser.selectedTab.label; var label = label.replace(/[:+.\\\/<>?*|"]+/g, " ").replace(/\s\s+/g, " "); return label; }; // Получить выделенный текст из страницы или 'false' .............. function getSelect() { var el = document.commandDispatcher.focusedElement; try { return el.value.substring(el.selectionStart, el.selectionEnd) } catch(e) {}; var sel = document.commandDispatcher.focusedWindow.getSelection(); return (sel == '') ? false : sel.toString().replace(/^\s+|\s+$/g,"").replace(/\u000A/g, "\u000D\u000A").replace(/\u000D\u000D\u000A/g, "\u000D\u000A"); };
Отредактировано solombala (29-07-2019 12:14:40)
Отсутствует
solombala Нет, не для скачивания. Это надо для передачи ссылки в PotPlayer для просмотра. Просто конкретно seasonvar заблочен роскомнадзором и не показывает видосы ни через VPN, ни через прокси, вообще никак. Но по прямым ссылкам на видео PotPlayer спокойно всё воспроизводит. В принципе, я вчера нарыл расширение Bulk Media Downloader, которое как раз делает то, что мне нужно, но если это можно сделать и через Custom Buttons, то я бы предпочёл этот вариант.
На форуме
psihkakihmalo
В Pot так в Pot , см. внимательно это поменять на свое в двух местах или на другой плеер - из clipboard , например...'C:\\PotPlayer\\PotPlayer.exe'
URL кнопки
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%3E%u0412%u0438%u0434%u0435%u043E%20%u0432%20PotPlayer%3C/name%3E%0A%20%20%3Cimage%3E%3C%21%5BCDATA%5Bmoz-icon%3A//file%3A//C%3A%5CPotPlayer%5CPotPlayer.exe%5D%5D%3E%3C/image%3E%0A%20%20%3Cmode%3E0%3C/mode%3E%0A%20%20%3Cinitcode%3E%3C%21%5BCDATA%5B/*Initialization%20Code*/%0A/*CODE*/%0A/*Initialization%20Code*/%0A%0Avar%20path%20%3D%20%27C%3A%5C%5CPotPlayer%5C%5CPotPlayer.exe%27%0A%0Avar%20sysPlayerName%20%3D%20%22POTlayer%22%3B%0A%0Avar%20openIn%20%3D%20%22%u041E%u0442%u043A%u044B%u0442%u044C%20%u0432%20%22+sysPlayerName%3B%0Avar%20videoMoved%20%3D%20%22%u0412%u0438%u0434%u0435%u043E%20%u043F%u0435%u0440%u0435%u043D%u0435%u0441%u0435%u043D%u043E%20%u0432%20%22+sysPlayerName%3B%0Avar%20noFound%20%3D%20%22%u041D%u0435%20%u043D%u0430%u0439%u0434%u0435%u043D%u043E%20%u0432%u0438%u0434%u0435%u043E%20%u043D%u0430%20%u0441%u0442%u0440%u0430%u043D%u0438%u0446%u0435%2C%20%u0434%u043E%u0441%u0442%u0443%u043F%u043D%u043E%u0435%20%u0434%u043B%u044F%20%u043F%u0435%u0440%u0435%u043D%u043E%u0441%u0430%20%u0432%20%22+sysPlayerName%3B%0A%0Avar%20YoutubeID%20%3D%20/%28%3F%3Ayoutube%28%3F%3A-nocookie%29%3F%5C.com%5C/%28%3F%3A%5B%5E%5C/%5Cn%5Cs%5D+%5C/%5CS+%5C/%7C%28%3F%3Av%7Ce%28%3F%3Ambed%29%3F%29%5C/%7C%5CS*%3F%5B%3F%26%5Dv%3D%29%7Cyoutu%5C.be%5C/%29%28%5Ba-zA-Z0-9_-%5D%7B11%7D%29%28%3F%3A%5CW%7C%24%29/%3B%0A%0A%0A%0Aif%28%21%28cbu.getPrefs%28%22CB.video%22%29%29%20%7C%7C%20cbu.getPrefs%28%22CB.video%22%29.length%20%3C%209%29%20cbu.setPrefs%28%22CB.video%22%2C%20%22videotoplayer%22%29%3B%0Avar%20tmp%20%3D%20%27%27%2C%0Atmpp%20%3D%20%27%27%2C%0AinnerA%20%3D%20%27%3Cdiv%20style%3D%22display%3Ablock%21important%3Bcolor%3A%2300ff00%21important%3Bwidth%3A250px%21important%3Bfont%3Abold%2016px%20serif%21important%3Bz-index%3A999%21important%3Bopacity%3A1%21important%3Bvisibility%3A%20visible%21important%3B%27%2C%0AinnerB%20%3D%20%27left%3A5px%21important%3Bposition%3Aabsolute%21important%3Bheight%3Aauto%21important%3Bbox-sizing%3Aborder-box%21important%3Bpadding%3A5px%21important%3Bmargin%3A5px%21important%3B%27%2C%0AstopPl%20%3D%20%22javascript%3A%28function%28%29%7Bv%3Ddocument.getElementById%28%27movie_player%27%29%3Bif%28v%29%7Bv.stopVideo%28%29%7Delse%7Bv%3Ddocument.getElementsByTagName%28%27video%27%29%3Bif%28v%29%7Bv%5B0%5D.src%3D%27%27%3Btry%7Bv%5B0%5D.load%28%29%7Dcatch%28e%29%7B%7D%7D%3B%7D%7D%29%28%29%3B%22%2C%0AytIMGouter%20%3D%20function%28ytID%29%20%7Breturn%20%27%3Cdiv%20width%3D%22100%25%22%3E%3Cbr%20/%3E%3Ca%20target%3D%22_blank%22%20href%3D%22https%3A//www.youtube.com/watch%3Fv%3D%27%20+%20ytID%20+%20%27%22%3E%3Cimg%20src%3D%22https%3A//i.ytimg.com/vi/%27%20+%20ytID%20+%20%27/hqdefault.jpg%22%3E%3C/a%3E%3Cbr%20/%3E%27%20+%20innerA%20+%20%27background-color%3Ablack%21important%3Bposition%3Arelative%21important%3Bbottom%3A20px%21important%3B%22%3E%26nbsp%3B%26nbsp%3B%27%20+%20videoMoved%20+%20%27%3C/div%3E%3Cbr%20/%3E%3C/div%3E%3Cbr%20/%3E%27%7D%2C%0AhandlWin%20%3D%20function%28currentWin%29%20%7B%0Atmp%20%3D%20%27%27%3B%0Avar%20elem%20%3D%20currentWin.document.getElementsByTagName%28%27video%27%29%2C%20currLoc%20%3D%20currentWin.location%3B%0Aif%28elem.length%20%3E%200%29%20%7B%0Aif%28currLoc.hostname.indexOf%28%27youtu%27%29%20%21%3D%20-1%20%26%26%20%28tmp%20%3D%20currLoc.toString%28%29.match%28YoutubeID%29%29%20%26%26%20tmp%5B1%5D.length%20%3D%3D%2011%29%20%7B%0Aplay%28cbu.getPrefs%28%22CB.video%22%29%20%3D%3D%20%22videotoplaylist%22%20%3F%20%27https%3A//www.youtube.com/embed/%27%20+%20tmp%5B1%5D%20%3A%20%27https%3A//www.youtube.com/watch%3Fv%3D%27%20+%20tmp%5B1%5D%29%3B%0AvideoMovedbox%20%3D%20currentWin.document.createElement%28%27videoMoved%27%29%3B%0AvideoMovedbox.innerHTML%20%3D%20innerA%20+%20innerB%20+%20%27top%3A-15px%21important%3B%22%3E%3Cb%3E%27%20+%20videoMoved%20+%20%27%3C/b%3E%3C/div%3E%27%3B%0AloadURI%28stopPl%29%3B%0AcurrentWin.document.getElementById%28%27eow-title%27%29.appendChild%28videoMovedbox%29%3B%0Areturn%20true%3B%0A%7D%3B%0Afor%28i%20%3D%200%3B%20i%20%3C%20elem.length%3B%20i++%29%20%7B%0Aif%28%28%28tmp%20%3D%20getSrc%28elem%5Bi%5D.parentNode%2C%20currLoc%29%29%20%26%26%20tmp.length%20%3E%202%29%20%7C%7C%20%28i%20%3D%3D%200%20%26%26%20currentWin.document.body.innerHTML.substring%280%2C%207%29%20%3D%3D%20%27%3Cvideo%20%27%20%26%26%20%28tmp%20%3D%20currLoc.toString%28%29%29%29%29%20%7B%0AvideoMovedbox%20%3D%20currentWin.document.createElement%28%27videoMoved%27%29%3B%0AvideoMovedbox.innerHTML%20%3D%20innerA%20+%20innerB%20+%20%27top%3A20px%21important%3Bbackground-color%3Ablack%21important%3B%22%3E%27%20+%20videoMoved%20+%20%27%3C/div%3E%27%3B%0Aplay%28tmp%29%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0Aif%28currLoc.hostname%20%3D%3D%20%27www.youtube.com%27%29%20%7B%0Aelem%5Bi%5D.parentNode.parentNode.appendChild%28videoMovedbox%29%3B%0A%7D%20else%20%7B%0Aelem%5Bi%5D.parentNode.appendChild%28videoMovedbox%29%3B%0A%7D%3B%0Aelem%5Bi%5D.src%20%3D%20%27%27%3B%0Atry%20%7B%0Aelem%5Bi%5D.load%28%29%0A%7D%20catch%28e%29%20%7B%7D%3B%0Areturn%20true%3B%0A%7D%0A%7D%0A%7D%3B%0A%0AcurrentWin._elems%20%3D%20currentWin.document.getElementsByTagName%28%27iframe%27%29%3B%0Aif%28currentWin._elems.length%20%3E%200%29%20%7B%0Afor%28currentWin._iCounter%20%3D%200%3B%20currentWin._iCounter%20%3C%20currentWin._elems.length%3B%20currentWin._iCounter++%29%20%7B%0Aif%28%28currentWin._elems%5BcurrentWin._iCounter%5D.src.indexOf%28%27youtube.com%27%29%20%3E%20-1%29%20%26%26%20%28tmp%20%3D%20currentWin._elems%5BcurrentWin._iCounter%5D.src.match%28YoutubeID%29%29%20%26%26%20%28tmp%5B1%5D.length%20%3D%3D%2011%29%29%20%7B%0Aplay%28cbu.getPrefs%28%22CB.video%22%29%20%3D%3D%20%22videotoplaylist%22%20%3F%20%27https%3A//www.youtube.com/embed/%27%20+%20tmp%5B1%5D%20%3A%20%27https%3A//www.youtube.com/watch%3Fv%3D%27%20+%20tmp%5B1%5D%29%3B%0AcurrentWin._elems%5BcurrentWin._iCounter%5D.outerHTML%20%3D%20ytIMGouter%28tmp%5B1%5D%29%3B%0Areturn%20true%3B%0A%7D%3B%0Aif%28currentWin._elems%5BcurrentWin._iCounter%5D.clientWidth%20%3E%2080%20%26%26%20currentWin._elems%5BcurrentWin._iCounter%5D.clientHeight%20%3E%2040%20%26%26%20handlWin%28currentWin._elems%5BcurrentWin._iCounter%5D.contentWindow%29%29return%20true%3B%0A%7D%0A%7D%3B%0A%0Aelem%20%3D%20currentWin.document.getElementsByTagName%28%27object%27%29%3B%0AcurrLoc%20%3D%20currentWin.location%3B%0Aif%28elem.length%20%3D%3D%200%29%20%7B%0Aelem%20%3D%20currentWin.document.getElementsByTagName%28%27embed%27%29%0A%7D%3B%0Aif%28elem.length%20%3E%200%29%20%7B%0Afor%28i%20%3D%200%3B%20i%20%3C%20elem.length%3B%20i++%29%20%7B%0Aif%28elem%5Bi%5D.innerHTML.indexOf%28%27youtu%27%29%20%21%3D%20-1%20%26%26%20%28tmp%20%3D%20elem%5Bi%5D.innerHTML.match%28YoutubeID%29%29%20%26%26%20tmp%5B1%5D.length%20%3D%3D%2011%29%20%7B%0Aplay%28cbu.getPrefs%28%22CB.video%22%29%20%3D%3D%20%22videotoplaylist%22%20%3F%20%27https%3A//www.youtube.com/embed/%27%20+%20tmp%5B1%5D%20%3A%20%27https%3A//www.youtube.com/watch%3Fv%3D%27%20+%20tmp%5B1%5D%29%3B%0Aelem%5Bi%5D.outerHTML%20%3D%20ytIMGouter%28tmp%5B1%5D%29%3B%0Areturn%20true%3B%0A%7D%20else%20%7B%0Aif%28elem%5Bi%5D.clientWidth%20%3E%2080%20%26%26%20elem%5Bi%5D.clientHeight%20%3E%2040%29%20%7B%0Aif%28%28%28tmp%20%3D%20getSrc%28elem%5Bi%5D.parentNode%2C%20currLoc%29%29%20%7C%7C%20%28tmp%20%3D%20getLink%28elem%5Bi%5D%2C%20currLoc%29%29%29%20%26%26%20tmp.length%20%3E%202%29%20%7B%0Aplay%28tmp%29%3B%0Aelem%5Bi%5D.outerHTML%20%3D%20innerA%20+%20%27background-color%3Ablack%21important%3Bbottom%3A20px%21important%3B%22%3E%26nbsp%3B%26nbsp%3B%27%20+%20videoMoved%20+%20%27%3C/div%3E%27%3B%0Areturn%20true%3B%0A%7D%3B%0A%7D%3B%0A%7D%0A%7D%3B%0A%7D%3B%0Areturn%20false%3B%0A%7D%3B%0A%0Athis.onclick%20%3D%20this.oncontextmenu%20%3D%20e%20%3D%3E%20%7B%0Aif%20%28e.target%20%21%3D%20this%29%20return%3B%0Aif%28e.button%20%3D%3D%200%29%20%7B%0Aif%28cbu.getPrefs%28%22CB.video%22%29.substring%280%2C6%29%20%3D%3D%20%22videom%22%29%7B%0Aelem%20%3D%20content.document.getElementsByTagName%28%27object%27%29%3B%0Aif%28elem.length%20%3D%3D%200%29%20%7B%0Aelem%20%3D%20content.document.getElementsByTagName%28%27embed%27%29%0A%7D%3B%0A%0AresizeObjs%28elem%29%3B%0AresizeObjs%28content.document.getElementsByTagName%28%27iframe%27%29%29%3B%0AresizeObjs%28content.document.getElementsByTagName%28%27video%27%29%29%3B%0A%7D%20else%20%7B%0Aif%28%21handlWin%28content%29%29custombuttons.alertSlide1%28noFound%29%3B%0A%7D%0A%7D%3B%0A%0Aif%20%28%20e.button%20%3D%3D%202%20%26%26%20%21e.ctrlKey%20%26%26%20%21e.shiftKey%20%26%26%20%21e.altKey%20%26%26%20%21e.metaKey%20%29%20%7B%20//%20%u041F%u041A%u041C%0Ae.preventDefault%28%29%3B%0Avar%20file%20%3D%20Cc%5B%27@mozilla.org/file/local%3B1%27%5D.createInstance%28Ci.nsIFile%29%3B%0Afile.initWithPath%28%27C%3A%5C%5CPotPlayer%5C%5CPotPlayer.exe%27%29%3B%0Avar%20process%20%3D%20Cc%5B%22@mozilla.org/process/util%3B1%22%5D.createInstance%28Ci.nsIProcess%29%3B%0Avar%20link%20%3D%20gClipboard.read%28%29%3B%0Avar%20args%20%3D%20%5Blink%2C%22/play%22%5D%3B%0Aprocess.init%28%20file%20%29%3B%0Aprocess.run%28%20false%2C%20args%2C%20args.length%20%29%3B%0A%7D%0A%7D%3B%0Athis.oncontextmenu%20%3D%20e%20%3D%3E%20e.target%20%21%3D%20this%20%3F%20menu.hasAttribute%28%22context%22%29%0A%20%20%20%20%3A%20e.ctrlKey%20%7C%7C%20e.shiftKey%20%7C%7C%20e.altKey%20%7C%7C%20e.metaKey%20%7C%7C%20%28%0A%20%20%20%20%20%20%20%20e.detail%20%21%3D%201%20%3F%20menu.hidePopup%28%29%20%3A%20%21%21menu.openPopup%28this%2C%20%22after_start%22%29%0A%20%20%20%20%29%3B%0Acustombuttons.alertSlide1%20%3D%20function%28sTitle%29%20%7B%0Avar%20as%20%3D%20Components.classes%5B%22@mozilla.org/alerts-service%3B1%22%5D.getService%28Components.interfaces.nsIAlertsService%29%3B%0Aas.showAlertNotification%28%27chrome%3A//global/skin/icons/information-16.png%27%2C%20%22%22%2C%20sTitle%2C%20false%2C%20%22%22%2C%20null%29%3B%0AsetTimeout%28%28%29%20%3D%3E%20as.closeAlert%28%29%2C%20999%29%3B%0A%7D%3B%0Athis.tooltipText%3D%22%u041B%3A%20%u0412%u0438%u0434%u0435%u043E%20%u0432%20%u043F%u043B%u0435%u0435%u0440%5Cn%u041F%3A%20%u0412%u0438%u0434%u0435%u043E%20%u0438%u0437%20Clipboard%22%3B%0Afunction%20resizeObjs%28objs%29%20%7B%0Aif%28%21objs%29%20return%3B%0ALEVELS%20%3D%203%3B%0Adir%20%3D%20%28cbu.getPrefs%28%22CB.video%22%29%20%3D%3D%20%22videomaximize%22%29%20%3F%201%20%3A%20-1%3B%0Afor%28i%20%3D%200%3B%20i%20%3C%20objs.length%3B%20i++%29%20%7B%0Avar%20Width%20%3D%20new%20Array%28LEVELS%29%0Avar%20Height%20%3D%20new%20Array%28LEVELS%29%0AWidth%5B0%5D%20%3D%20objs%5Bi%5D.clientWidth%3B%0AHeight%5B0%5D%20%3D%20objs%5Bi%5D.clientHeight%3B%0Aif%28%28Width%5B0%5D%20%3E%20%28-20%20*%20dir%20+%20100%29%29%20%26%26%20%28Height%5B0%5D%20%3E%20%28-20%20*%20dir%20+%2060%29%29%29%20%7B%0Aobj%20%3D%20objs%5Bi%5D%3B%0Afor%28var%20k%20%3D%201%3B%0A%28%28k%20%3C%20LEVELS%29%20%26%26%20%28obj.parentNode%29%29%3B%20k++%29%20%7B%0Aobj%20%3D%20obj.parentNode%0AWidth%5Bk%5D%20%3D%20obj.clientWidth%3B%0AHeight%5Bk%5D%20%3D%20obj.clientHeight%3B%0A%7D%3B%0AWidth%5B0%5D%20%3D%20Width%5B0%5D%20+%20dir%20*%20%28Width%5B0%5D%20/%205%20%7C%200%29%3B%0AHeight%5B0%5D%20%3D%20Height%5B0%5D%20+%20dir%20*%20%28Height%5B0%5D%20/%205%20%7C%200%29%3B%0Aobjs%5Bi%5D.style.width%20%3D%20Width%5B0%5D%20+%20%22px%22%3B%0Aobjs%5Bi%5D.width%20%3D%20Width%5B0%5D%3B%0Aobjs%5Bi%5D.style.height%20%3D%20Height%5B0%5D%20+%20%22px%22%3B%0Aobjs%5Bi%5D.height%20%3D%20Height%5B0%5D%3B%0Aobj%20%3D%20objs%5Bi%5D%3B%0Afor%28var%20k%20%3D%201%3B%0A%28%28k%20%3C%20LEVELS%29%20%26%26%20%21%28objs%5Bi%5D.tagName%20%3D%3D%20%27IFRAME%27%29%20%26%26%20%28obj.parentNode%29%20%26%26%20%28Width%5Bk%5D%29%20%26%26%20%28Height%5Bk%5D%29%20%26%26%20%28Width%5Bk%5D%20%3E%20%28-20%20*%20dir%20+%20100%29%29%20%26%26%20%28Height%5Bk%5D%20%3E%20%28-20%20*%20dir%20+%2060%29%29%29%3B%20k++%29%20%7B%0Aobj%20%3D%20obj.parentNode%0AWidth%5Bk%5D%20%3D%20Width%5Bk%5D%20+%20dir%20*%20%28Width%5Bk%5D%20/%205%20%7C%200%29%3B%0AHeight%5Bk%5D%20%3D%20Height%5Bk%5D%20+%20dir%20*%20%28Height%5Bk%5D%20/%205%20%7C%200%29%3B%0Aobj.style.width%20%3D%20Width%5Bk%5D%20+%20%22px%22%3B%0Aobj.width%20%3D%20Width%5Bk%5D%3B%0Aobj.style.height%20%3D%20Height%5Bk%5D%20+%20%22px%22%3B%0Aobj.height%20%3D%20Height%5Bk%5D%3B%0A%7D%0A%7D%0A%7D%3B%0A%7D%3B%0A%0Afunction%20restProtHost%28lnkR%2C%20curLoc%29%20%7B%0Aif%28lnkR.length%3D%3D0%29return%20%27%27%3B%0Alet%20tr%20%3D%20lnkR.replace%28/%5E%3A%5C/%5C//%2C%20curLoc.protocol%20+%20%22//%22%29%3B%0Aif%28%21tr.match%28/%5Ehttps%3F%3A%5C/%5C//i%29%29%7B%0AlnkR%20%3D%20tr.replace%28/%5E%5C/+/%2C%20%27%27%29%3B%0Aif%28lnkR.split%28%27/%27%29%5B0%5D.split%28%27%3F%27%29%5B0%5D.split%28%27%23%27%29%5B0%5D.toLowerCase%28%29.match%28/%5E%28%3F%3A%5B-a-z%5Cd%5D+%5C.%29+%5Ba-z%5Cd%5D%7B2%2C6%7D%24/%29%29%7B%0Atr%20%3D%20curLoc.protocol%20+%20%27//%27%20+%20lnkR%3B%0A%7Delse%7B%0Atr%20%3D%20curLoc.protocol%20+%20%27//%27%20+%20curLoc.host%20+%20%22/%22%20+%20lnkR%3B%0A%7D%0A%7D%3B%0Areturn%20tr%3B%0A%7D%3B%0A%0Afunction%20getSrc%28vobj%2C%20currentLoc%29%20%7B%0Avar%20t%20%3D%20%27%27%2C%0Att%20%3D%20%27%27%3B%0Aif%28%28%28%28t%20%3D%20vobj.innerHTML.match%28/%3Cvideo.*%3F%5Cssrc%3D%28%3F%3A%28%3F%3A%27%28%5B%5E%27%5D*%29%27%29%7C%28%3F%3A%22%28%5B%5E%22%5D*%29%22%29%7C%28%5B%5E%5Cs%5D*%29%29/i%29%29%20%26%26%20%28t%29%20%26%26%20%28tt%20%3D%20t%5B1%5D%20%7C%7C%20t%5B2%5D%20%7C%7C%20t%5B3%5D%29%20%26%26%20tt.indexOf%28%27blob%3A%27%29%20%3D%3D%20-1%20%29%20%7C%7C%20%28%28t%20%3D%20vobj.innerHTML.match%28/%3Csource.*%3F%5Cssrc%3D%28%3F%3A%28%3F%3A%27%28%5B%5E%27%5D*%29%27%29%7C%28%3F%3A%22%28%5B%5E%22%5D*%29%22%29%7C%28%5B%5E%5Cs%5D*%29%29.*%3F%5Cstype%3D%5B%27%22%5D%3Fvideo%5C//i%29%29%20%26%26%20%28t%29%20%26%26%20%28tt%20%3D%20t%5B1%5D%20%7C%7C%20t%5B2%5D%20%7C%7C%20t%5B3%5D%29%29%29%20%26%26%20tt.length%20%3E%202%20%26%26%20tt.indexOf%28%27blob%3A%27%29%20%3D%3D%20-1%20%29%20%7B%0Aif%28tt.indexOf%28%22.mp4/%3F%22%29%20%3D%3D%20-1%29%20%7B%0Att%20%3D%20tt.replace%28/%26amp%3B/g%2C%20%22%26%22%29%0A%7D%3B%0At%20%3D%20restProtHost%28tt%2C%20currentLoc%29%3B%0Areturn%20t%3B%0A%7D%3B%0Areturn%20%27%27%3B%0A%7D%3B%0A%0Afunction%20getLink%28obj%2C%20curLocation%29%20%7B%0A%0A%0Aif%28%21obj%20%7C%7C%20%21obj.tagName%29%20return%20%27%27%3B%0Avar%20flashvars%20%3D%20%27%27%2C%0A//%20%20%20%20%20%20%20%20src%20%3D%20%27%27%2C%0Aq%20%3D%20obj.tagName.toLowerCase%28%29%3B%0A%0Avar%20getParam%20%3D%20function%28e%2C%20n%29%20%7B%0Avar%20v%20%3D%20%27%27%2C%0Ar%20%3D%20new%20RegExp%28%27%5E%28%27%20+%20n%20+%20%27%29%24%27%2C%20%27i%27%29%2C%0Aparam%20%3D%20e.getElementsByTagName%28%27param%27%29%3B%0Afor%28var%20igp%20%3D%200%2C%20p%3B%20p%20%3D%20param%5Bigp%5D%3B%20igp++%29%20%7B%0Aif%28p.hasAttribute%28%27name%27%29%20%26%26%20p.getAttribute%28%27name%27%29.match%28r%29%29%20%7B%0Av%20%3D%20p.getAttribute%28%27value%27%29%3B%0Abreak%0A%7D%3B%0A%7D%3B%0Areturn%20v%3B%0A%7D%3B%0A%0A%0Aif%28q%20%3D%3D%20%27object%27%29%20%7B%0A//%20%20%20%20%20%20%20%20src%20%3D%20obj.getAttribute%28%27data%27%29%20%7C%7C%20obj.getAttribute%28%27src%27%29%20%7C%7C%20getParam%28obj%2C%20%27movie%7Cdata%7Csrc%7Ccode%7Cfilename%7Curl%27%29%20%7C%7C%20%28obj.getElementsByTagName%28%27embed%27%29.length%20%3E%200%20%3F%20obj.getElementsByTagName%28%27embed%27%29%5B0%5D.getAttribute%28%27src%27%29%20%3A%20%27%27%29%3B%0Aflashvars%20%3D%20getParam%28obj%2C%20%27flashvars%27%29%3B%0A%7D%20else%20if%28q%20%3D%3D%20%27embed%27%29%20%7B%0A//%20%20%20%20%20%20%20%20src%20%3D%20obj.getAttribute%28%27src%27%29%3B%0Aflashvars%20%3D%20obj.getAttribute%28%27flashvars%27%29%3B%0A%7D%20else%20return%20%27%27%3B%0A%0A%0Aif%28%21flashvars%29%20return%20%27%27%3B%0A//%20%20%20src%20%3D%20restProtHost%28src%2C%20curLocation%29%3B%0A%0Avar%20restPath%20%3D%20function%28f%2C%20s%29%20%7B%0Areturn%28f.substring%280%2C%204%29%20%3D%3D%20%27http%27%29%20%3F%20f%20%3A%20s.replace%28/%5B%23%3F%5D.*%24/%2C%20%27%27%29.replace%28/%5B%5E%5C/%5D*%24/%2C%20f%29%0A%7D%3B%0A%0Afunction%20videoLinkExtract%28fl%29%20%7B%0A//alert%28fl%29%3B%0Avar%20linkArr%20%3D%20%5B%5D%2C%0AoutLinks%20%3D%20%5B%5D%2C%0Ajj%20%3D%200%2C%0Alba%20%3D%20%27%27%2C%0Albb%20%3D%20%27%27%2C%0AdecodeURL%20%3D%20function%28s%29%20%7B%0Atry%20%7B%0Areturn%20decodeURIComponent%28s%29%0A%7D%20catch%28e%29%20%7B%0Areturn%20unescape%28s%29%0A%7D%0A%7D%3B%0A%0Afor%28var%20ij%20%3D%200%3B%20ij%20%3C%203%3B%20ij++%29%20%7B%0Alba%20%3D%20lba%20+%20String.fromCharCode%28parseInt%28%28Math.random%28%29%20*%2015%20+%201%29%20+%20%27%27%2C%2010%29%29%3B%0Albb%20%3D%20lbb%20+%20String.fromCharCode%28parseInt%28%28Math.random%28%29%20*%2015%20+%2016%29%20+%20%27%27%2C%2010%29%29%3B%0A%7D%3B%0A%0Afunction%20pushWithMerit%28lnk%29%20%7B%0A%0Avar%20merit%20%3D%20-11%3B%0Aif%28lnk.match%28/%5Ehttps%3F%3A%5C/%5C//i%29%29%20merit%20%3D%20merit%20+%2040%3B%0Aif%28outLinks.length%20%3D%3D%200%29%20merit%20%3D%20merit%20+%201%3B%0Aif%28lnk.match%28/%5E%5C//%29%29%20merit%20%3D%20merit%20+%207%3B%0Aif%28lnk.match%28/%5E%5C/%5C//%29%29%20merit%20%3D%20merit%20+%2030%3B%0Aif%28lnk.match%28/240p%28%5B%5Ea-z%5D%7C%24%29/i%29%29%20merit%20%3D%20merit%20+%201%3B%0Aif%28lnk.match%28/%5B%5Ea-z%5D240%28%5B%5Ea-z0-9%5D%7C%24%29/i%29%29%20merit%20%3D%20merit%20+%201%3B%0Aif%28lnk.match%28/360p%28%5B%5Ea-z%5D%7C%24%29/i%29%29%20merit%20%3D%20merit%20+%203%3B%0Aif%28lnk.match%28/%5B%5Ea-z%5D360%28%5B%5Ea-z0-9%5D%7C%24%29/i%29%29%20merit%20%3D%20merit%20+%203%3B%0Aif%28lnk.match%28/480p%28%5B%5Ea-z%5D%7C%24%29/i%29%29%20merit%20%3D%20merit%20+%205%3B%0Aif%28lnk.match%28/%5B%5Ea-z%5D480%28%5B%5Ea-z0-9%5D%7C%24%29/i%29%29%20merit%20%3D%20merit%20+%205%3B%0Aif%28lnk.match%28/720p%28%5B%5Ea-z%5D%7C%24%29/i%29%29%20merit%20%3D%20merit%20+%207%3B%0Aif%28lnk.match%28/%5B%5Ea-z%5D720%28%5B%5Ea-z0-9%5D%7C%24%29/i%29%29%20merit%20%3D%20merit%20+%207%3B%0Aif%28lnk.match%28/%5C.mp4%28%5B%5Ea-z%5D%7C%24%29/i%29%29%20merit%20%3D%20merit%20+%208%3B%0Aif%28lnk.match%28/_hd%28%5B%5Ea-z%5D%7C%24%29/i%29%29%20merit%20%3D%20merit%20+%206%3B%0Aif%28lnk.match%28/%5C.%28jpg%7Cxml%29%28%5B%5Ea-z%5D%7C%24%29/i%29%29%20merit%20%3D%20merit%20-%2040%3B%0Aif%28merit%20%3E%200%29%20outLinks.push%28merit%20+%20lba%20+%20lnk%29%3B%0AServices.console.logStringMessage%28%27merit%3A%27+merit+%27%20lnk-%3E%27+lnk%29%3B%0A%7D%3B%0A%0AlinkArr.push%28fl%29%3B%0Awhile%28linkArr.length%20%3E%20jj%20%26%26%20jj%20%3C%2030%29%20%7B%0A%0Avar%20testPaths%20%3D%20%5B%5D%3B%0AtestPaths%20%3D%20linkArr%5Bjj%5D.split%28/%28%5C.%28%3F%3Aflv%7Cmp4%7Cm3u8%29%29/i%29%3B%0Aif%28testPaths%5BtestPaths.length%20-%201%5D%20%3D%3D%20%27%27%29%20testPaths.pop%28%29%3B%0A%0Afor%28k%20%3D%201%3B%20k%20%3C%20testPaths.length%3B%20k%20%3D%20k%20+%202%29%20%7B%0A%0Aif%28testPaths%5Bk%20-%201%5D.indexOf%28lba%29%20%3E%20-1%29%20%7B%0Apref%20%3D%20testPaths%5Bk%20-%201%5D%3B%0A%7D%20else%20%7B%0Avar%20testAboutDom%20%3D%20testPaths%5Bk%20-%201%5D.toLowerCase%28%29.split%28/%28https%3F%3A%5C/%5C/%29/%29%3B%20%0Aif%28testAboutDom%5BtestAboutDom.length%20-%201%5D%3D%3D%27%27%29%20testAboutDom.pop%28%29%3B%0Avar%20pTest%20%3D%20testAboutDom%5BtestAboutDom.length%20-%201%5D.split%28/%28%5C%3F%5B%5E%5C%3F%5D*%3F%26%29/%29%3B%0Aif%28pTest.length%3E2%29%7B%0ApTest.pop%28%29%3B%0ApTest.pop%28%29%3B%0A%7D%3B%0AtestAboutDom%5BtestAboutDom.length%20-%201%5D%20%3D%20pTest.join%28%27%27%29%3B%0Apref%20%3D%20testPaths%5Bk%20-%201%5D.substring%28testAboutDom.join%28%27%27%29.lastIndexOf%28%22%26%22%29%20+%201%29%3B%0A%7D%3B%0A%0At2%20%3D%20pref.lastIndexOf%28lbb%29%3B%0Aif%28t2%20%3E%20-1%29%20%7B%0Apref%20%3D%20pref.substring%28t2%20+%203%29%3B%0A%7D%20else%20%7B%0A%0At2%20%3D%20pref.lastIndexOf%28%27%7B%22%27%29%3B%0Aif%28t2%20%3E%20-1%29%20pref%20%3D%20pref.substring%28t2%20+%202%29%3B%0At2%20%3D%20pref.lastIndexOf%28%27%5B%22%27%29%3B%0Aif%28t2%20%3E%20-1%29%20pref%20%3D%20pref.substring%28t2%20+%202%29%3B%0At2%20%3D%20pref.lastIndexOf%28%27%2C%22%27%29%3B%0Aif%28t2%20%3E%20-1%29%20pref%20%3D%20pref.substring%28t2%20+%202%29%3B%0At2%20%3D%20pref.toLowerCase%28%29.lastIndexOf%28%27%22http%3A//%27%29%3B%0Aif%28t2%20%3E%20-1%29%20pref%20%3D%20pref.substring%28t2%20+%201%29%3B%0At2%20%3D%20pref.toLowerCase%28%29.lastIndexOf%28%27%22https%3A//%27%29%3B%0Aif%28t2%20%3E%20-1%29%20pref%20%3D%20pref.substring%28t2%20+%201%29%3B%0At2%20%3D%20pref.toLowerCase%28%29.lastIndexOf%28%27%2Chttp%3A//%27%29%3B%0Aif%28t2%20%3E%20-1%29%20pref%20%3D%20pref.substring%28t2%20+%201%29%3B%0At2%20%3D%20pref.toLowerCase%28%29.lastIndexOf%28%27%2Chttps%3A//%27%29%3B%0Aif%28t2%20%3E%20-1%29%20pref%20%3D%20pref.substring%28t2%20+%201%29%3B%0At2%20%3D%20pref.toLowerCase%28%29.lastIndexOf%28%27%3Bhttp%27%29%3B%0Aif%28t2%20%3E%20-1%29%20pref%20%3D%20pref.substring%28t2%20+%201%29%3B%0At2%20%3D%20pref.toLowerCase%28%29.lastIndexOf%28%27*https%3A//%27%29%3B%0Aif%28t2%20%3E%20-1%29%20pref%20%3D%20pref.substring%28t2%20+%201%29%3B%0At2%20%3D%20pref.toLowerCase%28%29.lastIndexOf%28%27%20or%20%27%29%3B%0Aif%28t2%20%3E%20-1%29%20pref%20%3D%20pref.substring%28t2%20+%204%29%3B%0A%0Apref%20%3D%20pref.substring%28pref.split%28%27/%27%29%5B0%5D.toLowerCase%28%29.split%28%27%252f%27%29%5B0%5D.lastIndexOf%28%27%3D%27%29%20+%201%29%3B%0A%0A%7D%0A%0Aif%28pref.length%20%3E%200%29%20%7B%0A%0Aif%28pref.split%28%27%3F%27%29%5B0%5D.toLowerCase%28%29.match%28/%25%5B2-3%5D%5B0-9a-f%5D/%29%29%20%7B%0A%0At2%20%3D%20pref.indexOf%28%27%22%27%29%0Aif%28t2%20%3E%20-1%29%20pref%20%3D%20pref.substring%28t2%20+%201%29%3B%0Asuff%20%3D%20testPaths%5Bk%20+%201%5D%20%3F%20testPaths%5Bk%20+%201%5D.split%28%27%26%27%29%5B0%5D.split%28%27%22%27%29%5B0%5D.split%28%27%3B%27%29%5B0%5D.split%28/%2Chttp/i%29%5B0%5D%20%3A%20%27%27%3B%0Aif%28%28suff%20%21%3D%20testPaths%5Bk%20+%201%5D%29%20%7C%7C%20%28testPaths.length%20%3C%20k%20+%203%29%29%20%7B%0Aif%28testPaths.length%20%3E%20k%20+%201%29%20%7B%0AtestPaths%5Bk%20+%201%5D%20%3D%20%28%28pref%20%3D%3D%20testPaths%5Bk%20-%201%5D%29%20%3F%20%27%27%20%3A%20%27%26%27%29%20+%20testPaths%5Bk%20+%201%5D.substr%28suff.length%29%0A%7D%3B%0At2%20%3D%20pref.lastIndexOf%28lba%29%3B%0Aif%28t2%20%3E%20-1%29%20pref%20%3D%20pref.substring%28t2%20+%203%29%0AlinkArr.push%28decodeURL%28pref%20+%20testPaths%5Bk%5D%20+%20suff%29%29%3B%0A%0A%7D%20else%20%7B%0AtestPaths%5Bk%20+%201%5D%20%3D%20%28pref%20%3D%3D%20testPaths%5Bk%20-%201%5D%20%3F%20%27%27%20%3A%20lbb%29%20+%20pref%20+%20testPaths%5Bk%5D%20+%20suff%0A%7D%0A%7D%20else%20%7B%0Asuff%20%3D%20testPaths%5Bk%20+%201%5D%20%3F%20testPaths%5Bk%20+%201%5D.split%28%27%3B%27%29%5B0%5D.split%28%27%22%5D%27%29%5B0%5D.split%28%27%22%7D%27%29%5B0%5D.split%28%27%22%2C%27%29%5B0%5D.split%28/%2Chttps%3F%3A%5C/%5C//i%29%5B0%5D.split%28%27*https%3A//%27%29%5B0%5D.split%28%27%20or%20%27%29%5B0%5D%20%3A%20%27%27%3B%0At2%20%3D%20suff.indexOf%28%27%26%27%29%3B%0Aif%28%28t2%20%3E%20-1%29%20%26%26%20%28pref%20%21%3D%20testPaths%5Bk%20-%201%5D%29%29%20%7B%0Aif%28t2%20%3D%3D%200%29%20suff%20%3D%20%27%27%3B%0Aif%28suff.charAt%280%29%20%21%3D%20%27%3F%27%29%20suff%20%3D%20suff.split%28/%28%26%5B%5E%26%5D+%3Dhttps%3F%3A%5C/%5C/%29/i%29%5B0%5D%3B%0A%7D%3B%0Aif%28%28suff%20%21%3D%20testPaths%5Bk%20+%201%5D%29%20%7C%7C%20%28testPaths.length%20%3C%20k%20+%203%29%29%20%7B%0Aif%28testPaths.length%20%3E%20k%20+%201%29%20%7B%0AtestPaths%5Bk%20+%201%5D%20%3D%20%28%28pref%20%3D%3D%20testPaths%5Bk%20-%201%5D%29%20%3F%20%27%27%20%3A%20%27%26%27%29%20+%20testPaths%5Bk%20+%201%5D.substr%28suff.length%29%0A%7D%3B%0At2%20%3D%20pref.lastIndexOf%28lba%29%3B%0Aif%28t2%20%3E%20-1%29%20pref%20%3D%20pref.substring%28t2%20+%203%29%3B%0ApushWithMerit%28pref%20+%20testPaths%5Bk%5D%20+%20suff%29%3B%0A%0A%7D%20else%20%7B%0AtestPaths%5Bk%20+%201%5D%20%3D%20lba%20+%20%28pref%20%3D%3D%20testPaths%5Bk%20-%201%5D%20%3F%20%27%27%20%3A%20lbb%29%20+%20pref%20+%20testPaths%5Bk%5D%20+%20suff%0A%7D%0A%7D%0A%7D%0A%7D%3B%0Ajj%20%3D%20jj%20+%201%3B%0A%7D%3B%0A%0Aif%28outLinks.length%20%3D%3D%200%29%20return%20%27%27%3B%0Afunction%20srt%28a%2C%20b%29%20%7B%0Aa%20%3D%20parseInt%28a.substr%280%2C%20a.indexOf%28lba%29%29%2C%2010%29%3B%0Ab%20%3D%20parseInt%28b.substr%280%2C%20b.indexOf%28lba%29%29%2C%2010%29%3B%0Aif%28a%20%3C%20b%29%20return%201%3B%0Aif%28a%20%3E%20b%29%20return%20-1%3B%0Areturn%200%0A%7D%3B%0AoutLinks.sort%28srt%29%3B%0AoutLinks%5B0%5D%20%3D%20outLinks%5B0%5D.substr%28outLinks%5B0%5D.indexOf%28lba%29%20+%203%29%0Aif%28outLinks%5B0%5D.indexOf%28%27_hq.mp4/%3Ftime%3D%27%29%20%3E%200%29%20outLinks%5B0%5D%20%3D%20outLinks%5B0%5D.replace%28/%26/g%2C%20%27%26amp%3B%27%29%3B%0Areturn%20outLinks%5B0%5D%3B%0A%7D%3B%0Aol%20%3D%20videoLinkExtract%28flashvars%29%3B%0Aif%28%21ol%29%20return%20%27%27%3B%0A//%20%20%20%20ol%20%3D%20ol.replace%28/%5E%3A%3F%5C/%5C//%2C%20curLocation.protocol%20+%20%22//%22%29%3B%0A//%20%20%20%20return%20restPath%28ol%2C%20src%29%3B%0Areturn%20restProtHost%28ol%2C%20curLocation%29%3B%0A%7D%3B%0A%0A%0Avar%20menu%20%3D%20self.appendChild%28document.createElement%28%22menupopup%22%29%29%3B%0Aself.image%20%3D%20%22moz-icon%3A//file%3A//%22%20+%20path%3B%0Avar%20playerName%20%3D%20path.split%28%22%5C%5C%22%29.pop%28%29.replace%28%22.exe%22%2C%22%22%29%3B%0Aself.label%20%3D%20%22%u041E%u0442%u043A%u0440%u044B%u0442%u044C%20%u0432%u0438%u0434%u0435%u043E%20%u0432%20%22%20+sysPlayerName%3B%0AsetTimeout%28%28%29%20%3D%3E%20%7B%0AMenu_n_TooltipTxts.forEach%28%28m%29%20%3D%3E%20%7B%0Aif%28%22separator%22%20in%20m%29%20%7B%0Amenu.appendChild%28document.createElement%28%22menuseparator%22%29%29%3B%0Areturn%0A%7D%3B%0Avar%20mItem%20%3D%20document.createElement%28%22menuitem%22%29%3B%0AmItem.setAttribute%28%22label%22%2C%20m.label%29%3B%0A%0Aif%28%22radio%22%20in%20m%29%20%7B%0AmItem.setAttribute%28%22type%22%2C%20%22radio%22%29%3B%0AmItem.setAttribute%28%27checked%27%2C%20cbu.getPrefs%28%22CB.video%22%29%20%3D%3D%20m.value%29%3B%0Aif%28cbu.getPrefs%28%22CB.video%22%29%20%3D%3D%20m.value%29%20%7B%0Aself.tooltipText%20%3D%20m.tooltipTxt%3B%0A%7D%0AmItem.onclick%20%3D%20%28%29%20%3D%3E%20%7B%0Acbu.setPrefs%28%22CB.video%22%2C%20m.value%29%3B%0Atmp%20%3D%20%28self.image%20%3D%3D%20imgFlashToPlayer%20%7C%7C%20self.image%20%3D%3D%20imgFlashMinimize%20%7C%7C%20%20self.image%20%3D%3D%20imgFlashMaximize%29%3B%0Aif%28m.value.substring%280%2C9%29%3D%3D%27videotopl%27%29%7B%0Aself.image%20%3D%20tmp%20%3F%20imgFlashToPlayer%20%3A%20imgHTML5ToPlayer%3B%0A%7D%20else%20if%28m.value%3D%3D%27videominimize%27%29%20%7B%0Aself.image%20%3D%20tmp%20%3F%20imgFlashMinimize%20%3A%20imgHTML5Minimize%3B%0A%7D%20else%20self.image%20%3D%20tmp%20%3F%20imgFlashMaximize%20%3A%20imgHTML5Maximize%3B%0Aself.tooltipText%20%3D%20m.tooltipTxt%3B%0A%7D%3B%0A%7D%0Aif%28%22checkbox%22%20in%20m%29%20%7B%0AmItem.setAttribute%28%27type%27%2C%20%27checkbox%27%29%3B%0AmItem.setAttribute%28%27checked%27%2C%20%28self.image%20%3D%3D%20imgFlashToPlayer%20%7C%7C%20self.image%20%3D%3D%20imgFlashMinimize%20%7C%7C%20%20self.image%20%3D%3D%20imgFlashMaximize%20%29%29%3B%0AmItem.onclick%20%3D%20function%28e%29%20%7B%0Ae.stopPropagation%28%29%3B%0Ae.preventDefault%28%29%3B%0Aif%28e.button%20%3D%3D%200%29%20toggleFlash%28%29%3B%0A%7D%0A%7D%0Amenu.appendChild%28mItem%29%3B%0A%7D%29%3B%0Amenu.onclick%20%3D%20function%28e%29%20%7B%0Ae.stopPropagation%28%29%3B%0Aif%28e.button%20%3E%200%29%20e.preventDefault%28%29%3B%0A%7D%3B%0A%7D%2C%20100%29%3B%0A%0Avar%20contextMenu%20%3D%20document.getElementById%28%22contentAreaContextMenu%22%29%3B%20%0Avar%20menuitem%20%3D%20contextMenu.insertBefore%28document.createElement%28%22menuitem%22%29%2C%20document.getElementById%28%22context-savelink%22%29%29%3B%0Amenuitem.setAttribute%28%22label%22%2C%20%22%u041E%u0442%u043A%u0440%u044B%u0442%u044C%20%u0432%20%22%20+sysPlayerName%29%3B%20%20%20%20%20%20%0Amenuitem.setAttribute%28%22class%22%2C%20%22menuitem-iconic%22%29%3B%0Amenuitem.setAttribute%28%22image%22%2C%20%22moz-icon%3A//file%3A//%22%20+%20path%29%3B%20%0Amenuitem.onclick%20%3D%20%28%29%20%3D%3E%20play%28gContextMenu.linkURL%29%3B%0AaddEventListener%28%22popupshowing%22%2C%20%28%29%3D%3E%20menuitem.hidden%20%3D%20%21gContextMenu.onLink%20%26%26%20%21gContextMenu.onPlainTextLink%2C%20false%2C%20contextMenu%29%3B%0AaddDestructor%28%28%29%3D%3E%20menuitem.remove%28%29%20%29%3B%0Avar%20contextMenu%20%3D%20document.getElementById%28%22contentAreaContextMenu%22%29%3B%0Avar%20mItem%20%3D%20contextMenu.insertBefore%28document.createElement%28%22menuitem%22%29%2C%20document.getElementById%28%22context-copyvideourl%22%29%29%3B%0AmItem.setAttribute%28%22label%22%2C%20openIn%29%3B%0AmItem.onclick%20%3D%20%28%29%20%3D%3E%20%7B%0Avar%20vurl%20%3D%20gContextMenu.mediaURL%2C%20videoelem%20%3D%20gContextMenu.target%3B%0Aif%28videoelem%20%26%26%20videoelem.nodeName.toLowerCase%28%29%20%3D%3D%20%27video%27%29%20%7B%0Aif%28content.location.hostname.indexOf%28%27youtu%27%29%20%21%3D%20-1%20%26%26%20%28tmp%20%3D%20content.location.toString%28%29.match%28YoutubeID%29%29%20%26%26%20tmp%5B1%5D.length%20%3D%3D%2011%29%20%7B%0Aplay%28vurl%29%3B%0AvideoMovedbox%20%3D%20content.document.createElement%28%27videoMoved%27%29%3B%0AvideoMovedbox.innerHTML%20%3D%20innerA%20+%20innerB%20+%20%27top%3A-15px%21important%3B%22%3E%3Cb%3E%27%20+%20videoMoved%20+%20%27%3C/b%3E%3C/div%3E%27%3B%0AloadURI%28stopPl%29%3B%0Acontent.document.getElementById%28%27eow-title%27%29.appendChild%28videoMovedbox%29%3B%0Areturn%3B%0A%7D%3B%0A%0Aif%28content.location.hostname%20%3D%3D%20%27www.youtube.com%27%29%20%7B%0Avideoelem.parentNode.parentNode.appendChild%28videoMovedbox%29%3B%0A%7D%20else%20%7B%0Avar%20inFrameHref%20%3D%20inFrameWin.location.href%2C%20found%20%3D%20false%3B%0Aif%28inFrameWin.location.hostname%20%3D%3D%20%27www.youtube.com%27%20%26%26%20%28tmp%20%3D%20inFrameHref.match%28YoutubeID%29%29%20%26%26%20tmp%5B1%5D.length%20%3D%3D%2011%29%7B//%u0438%20%u0437%u043D%u0430%u0447%u0438%u0442%20%u0432%u043E%20%u0444%u0440%u0435%u0439%u043C%u0435%0Aelem%20%3D%20inFrameWin.parent.document.getElementsByTagName%28%27iframe%27%29%3B%0Aif%28elem.length%20%3E%200%29%20%7B%0Afor%28i%20%3D%200%3B%20i%20%3C%20elem.length%3B%20i++%29%20%7B%0Aif%28elem%5Bi%5D.contentWindow%20%3D%3D%20inFrameWin%29%20%7B%0Aelem%5Bi%5D.outerHTML%20%3D%20ytIMGouter%28tmp%5B1%5D%29%3B%0Afound%20%3D%20true%3B%0Abreak%3B%0A%7D%3B%0A%7D%3B%0A%7D%3B%0Aif%28%21found%29inFrameWin.document.body.innerHTML%20%3D%20ytIMGouter%28tmp%5B1%5D%29%3B%0Areturn%3B%0A%7D%3B%0Avideoelem.parentNode.appendChild%28videoMovedbox%29%3B%0A%7D%3B%0Avideoelem.src%20%3D%20%27%27%3B%0Atry%20%7B%0Avideoelem.load%28%29%0A%7D%20catch%28e%29%20%7B%7D%3B%0A%7D%20else%20play%28vurl%29%3B%0A%7D%3B%0A%0A%0AaddEventListener%28%22popupshowing%22%2C%20%28%29%20%3D%3E%20%7B%0AmItem.hidden%20%3D%20%21gContextMenu.onVideo%20%7C%7C%20%21gContextMenu.mediaURL%3B%0AmItem2.hidden%20%3D%20%21gContextMenu.linkURL%3B%0AmItem3.hidden%20%3D%20framItem.hidden%20%7C%7C%20gContextMenu.target.ownerDocument.location.hostname.indexOf%28%27youtube.com%27%29%20%3D%3D%20-1%3B%0A%7D%2C%20false%2C%20contextMenu%29%3B%0AaddDestructor%28%28%29%20%3D%3E%20%7BmItem.remove%28%29%3BmItem2.remove%28%29%3BmItem3.remove%28%29%7D%29%3B%0A%0A%0Afunction%20play%28link%29%20%7B%0Avar%20file%20%3D%20Services.dirsvc.get%28%27CurProcD%27%2C%20Ci.nsIFile%29%3B%0Avar%20MozExeDir%20%3D%20file.path.split%28%27%5C%5C%27%29.slice%280%2C-1%29.join%28%27%5C%5C%27%29%3B%0Afile.initWithPath%28path%29%3B%0Aif%28%21file.exists%28%29%29%20%7B%0Acustombuttons.alertBox%28%22File%20not%20found%21%22%2C%20MozExeDir%20+%20Path%29%3B%0Areturn%3B%0A%7D%3B%0Avar%20process%20%3D%20Cc%5B%22@mozilla.org/process/util%3B1%22%5D.createInstance%28Ci.nsIProcess%29%3B%0Aprocess.init%28file%29%3B%0Aprocess.run%28false%2C%20%5Blink%2C%20cbu.getPrefs%28%22CB.video%22%29%20%3D%3D%20%22videotoplaylist%22%20%3F%20addToPlaylistKey%20%3A%20%22%22%5D%2C%202%29%3B%0A%7D%3B%0A%5D%5D%3E%3C/initcode%3E%0A%20%20%3Ccode%3E%3C%21%5BCDATA%5B%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
И этого мало HLS поток надо скрипт Inject2Download или из IDM и из буфера в плеер
Отсутствует
solombala
Спасибо, кнопка работает как надо.
А не подскажете, что изменить, чтобы при нажатии правой кнопкой было не "Видео из Clipboard" а "Скопировать ссылку на видео в Clipboard"?
..а HLS потоки я смотрю через проги livestreamer и streamlink с пристёгнутым плейером MPC-HC, они под это заточены
На форуме