Garalf
Надо бы эту фишку к плееру пристегнуть, только ярлык это что-то не работает...с этим
$uUrl = Get-Clipboard $YtDl = "<путь-до-youtube-dl>\youtube-dl.exe" &$YtDl -F $uUrl if (-Not $?) { exit } $Choice = Read-Host -Prompt "Choose quality" if ($Choice -eq "") { $Choice = "best" } $uUrl = &$YtDl -g -f $Choice $uUrl if (-Not $?) { exit } &"<путь-до-potplayer>\PotPlayerMini64.exe" $uUrl
Отсутствует
Надо бы эту фишку к плееру пристегнуть, только ярлык это что-то не работает...с этим
Ну так сделать как в первоисточнике - через powershell. Забить аргументы в ярлык и запустить его на выполнение, предварительно скопировав в буфер ссылку на видео.
Я пробовал - все работает.
Отредактировано Garalf (14-06-2019 22:39:48)
Отсутствует
копирование в clipboard, и запуск файла ярлыка
Ничего необычного
gClipboard.write(gContextMenu.linkURL); FileUtils.File("C:\\Folder\\Sub\\ярлык.lnk").launch();
Во, кстати, можно проверить, будет ли работать без .ps1 и без ярлыка.
Просто запуск PowerShell, а скрипт как аргумент.
Вначале нужно прописать актуальные пути до приложений.
(popup => addEventListener("popupshowing", { oncommand() { var ps = "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"; var pot = "C:\\PotPlayer\\PotPlayerMini.exe"; var ytdl = "C:\\YouTube\\youtube-dl.exe"; var script = ` $uUrl = "${gContextMenu.linkURL}" $YtDl = "${ytdl}" &$YtDl -F $uUrl if (-Not $?) { exit } $Choice = Read-Host -Prompt "Choose quality" if ($Choice -eq "") { $Choice = "best" } $uUrl = &$YtDl -g -f $Choice $uUrl if (-Not $?) { exit } &"${pot}" $uUrl `; var command = ""; for(var ind = 0, len = script.length; ind < len; ind++) { var num = script.charCodeAt(ind); command += String.fromCharCode(num & 0xff, num >>> 8); } var args = ["-NoLogo", "-encodedCommand", btoa(command)]; var process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess); process.init(FileUtils.File(ps)); process.runwAsync(args, args.length); }, handleEvent(e) { if (e.target != popup || this.shouldHide) return; var menuitem = document.createXULElement("menuitem"); for(var args of Object.entries({ class: "menuitem-iconic", label: "Безымянный menuitem", oncommand: "linkedObject.oncommand();", image: "data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqnslYKp7JcmqeyX/qnsl/6p7Jf+qeyX/qnsl/6p7Jf+qeyX/qnsl/6p7Jf+qeyX/qnslyap7JWAAAAAAAAAAAKp7JcnQvJb/wql6/7+hb//Co2//xKNw/8mkb//MpW//0KRv/9Kkb//Uo2//1aZ1/9u7kf+rfCf/qnslAwAAAACqeyW9wad5/6Z/Of+idyj/pncr/6p6Kv+teCn/un0r/8GDM//FgzX/xHkw/8FwLf/SmWX/tYo9/6p7JSoAAAAAqnsljcOmcP+0kEf/uZVE/+HQp//Io1L/v480/8yeT//u3sD/8uLJ/+7XuP/u17j/y4pS/8ObV/+qeyVaAAAAAKp7JV2+mlr/vJlS/76WO//x6ND//Pjy/97Dgf/XrVf/7diw/+7atv/t0q7/7dKu/8aBRv/NqG7/qnsligAAAACqeyUttIo+/8GeWP+4iCr/yJ46/+jVo//+/fr/7dyw/9ilRf/SlDX/zIMu/8Z4Kf/Edjb/0qhy/6p7JboAAAAAqnslA6t8J//KrGv/u4kr/8KOKP/OnDT/4b9t//r05f/58d//3bBd/86KLP/IeCT/xHIs/9Wkb/+qeyXqAAAAAAAAAACqeyXM0LR6/8WcR//Glzf/zZk0/9OkOv/gvFr/+/Xo//z68//WmDX/zIIk/8d5J//TmmP/sYQz/6p7JRgAAAAAqnslnNCzef/Oq2D/zaNM/9SrUv/duGL/8uO9///////w3ar/26M+/9WUM//Pii//1Z5a/7+WTv+qeyVLAAAAAKp7JW/Kqmv/2r19/9ayZf/cvHP/7+C5///////16cn/5cFr/+G3Yv/hs1//3q9f/+G2ef/NrXH/rH0megAAAACqeyU8vZZN/+LLmP/dv37/69mw/////v/479n/58eA/+XCdf/lwXP/5b9z/+W9c//mwIL/27+N/65+J64AAAAAqnslD6+CL//r2bH/5MmO/+3bsf/16s7/6c6R/+fJh//oyYT/6MmG/+nHhf/oyYT/6cqL/+fQpf+ugCbaAAAAAAAAAACqeyWW172O/+7cuv/t2rT/7tu1/+3ZtP/v2rP/79uy/+/bsv/v27L/79uy/+/btP/o1LH/qnslzwAAAAAAAAAAqnslLap7JZaqeyX/qnsl/6p7Jf+qeyX/qnsl/6p7Jf+qeyX/qnsl/6p7Jf+qeyX/qnslz6p7JWYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//+sQQADrEEAAaxBAAGsQQABrEEAAaxBAAGsQQABrEGAAKxBgACsQYAArEGAAKxBgACsQcAArEHAAKxB//+sQQ==" })) menuitem.setAttribute(...args); menuitem.linkedObject = this; popup.querySelector("#context-sep-open").before(menuitem); addDestructor(() => menuitem.remove()); this.handleEvent = e => { if (e.target == popup) menuitem.hidden = this.shouldHide; } }, get shouldHide() { return !(gContextMenu.onLink || gContextMenu.onPlainTextLink) || !/^https?:\/\//.test(gContextMenu.linkURL); } }, false, popup || 1))(document.getElementById("contentAreaContextMenu"));
Отсутствует
Dumby
Хорошо, но большого смысла не вижу . Если бы просто ссылку передавало в плеер и без выпадания консольки этой , и не только из контекста...
Короче, закачивает почти все
, а мечта это "изменить действие кнопки" - "закачка" и "передача ссылки в плеер".
Это можно итак ,но желательно чтобы сам youtube.dl и передавал...Вместо /add - К, примеру, - просто "закачка" , ну , или наоборот...
/*Initialization Code*/ var path = 'D:\\tube\\youtube-dl.exe.lnk' var addToPlaylistKey = "/add"; var sysPlayerName = "youtube-dl.exe"; var openIn = "Cкачать в "+sysPlayerName; var videoMoved = "Видео перенесено в "+sysPlayerName; var noFound = "Не найдено видео на странице, доступное для переноса в "+sysPlayerName; var Menu_n_TooltipTxts = [{ label: "Действие кнопки: Запустить видео сразу в плеер ", radio: '', value: 'videotoplayer', tooltipTxt: 'Запустить видео сразу в ' }, { label: "Действие кнопки: Загрузить видео с Youtube.dl ", radio: '', value: 'videotoplaylist', tooltipTxt: 'Перенести видео в плейлист ' }, ]; var YoutubeID = /(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})(?:\W|$)/; if(!(cbu.getPrefs("CB.video")) || cbu.getPrefs("CB.video").length < 9) cbu.setPrefs("CB.video", "videotoplayer"); var tmp = '', tmpp = '', innerA = '<div style="display:block!important;color:#00ff00!important;width:250px!important;font:bold 16px serif!important;z-index:999!important;opacity:1!important;visibility: visible!important;', innerB = 'left:5px!important;position:absolute!important;height:auto!important;box-sizing:border-box!important;padding:5px!important;margin:5px!important;', stopPl = "javascript:(function(){v=document.getElementById('movie_player');if(v){v.stopVideo()}else{v=document.getElementsByTagName('video');if(v){v[0].src='';try{v[0].load()}catch(e){}};}})();", ytIMGouter = function(ytID) {return '<div width="100%"><br /><a target="_blank" href="https://www.youtube.com/watch?v=' + ytID + '"><img src="https://i.ytimg.com/vi/' + ytID + '/hqdefault.jpg"></a><br />' + innerA + 'background-color:black!important;position:relative!important;bottom:20px!important;"> ' + videoMoved + '</div><br /></div><br />'}, handlWin = function(currentWin) { tmp = ''; var elem = currentWin.document.getElementsByTagName('video'), currLoc = currentWin.location; if(elem.length > 0) { if(currLoc.hostname.indexOf('youtu') != -1 && (tmp = currLoc.toString().match(YoutubeID)) && tmp[1].length == 11) { play(cbu.getPrefs("CB.video") == "videotoplaylist" ? 'https://www.youtube.com/embed/' + tmp[1] : 'https://www.youtube.com/watch?v=' + tmp[1]); videoMovedbox = currentWin.document.createElement('videoMoved'); videoMovedbox.innerHTML = innerA + innerB + 'top:-15px!important;"><b>' + videoMoved + '</b></div>'; loadURI(stopPl); currentWin.document.getElementById('eow-title').appendChild(videoMovedbox); return true; }; for(i = 0; i < elem.length; i++) { if(((tmp = getSrc(elem[i].parentNode, currLoc)) && tmp.length > 2) || (i == 0 && currentWin.document.body.innerHTML.substring(0, 7) == '<video ' && (tmp = currLoc.toString()))) { videoMovedbox = currentWin.document.createElement('videoMoved'); videoMovedbox.innerHTML = innerA + innerB + 'top:20px!important;background-color:black!important;">' + videoMoved + '</div>'; play(tmp); if(currLoc.hostname == 'www.youtube.com') { elem[i].parentNode.parentNode.appendChild(videoMovedbox); } else { elem[i].parentNode.appendChild(videoMovedbox); }; elem[i].src = ''; try { elem[i].load() } catch(e) {}; return true; } } }; currentWin._elems = currentWin.document.getElementsByTagName('iframe'); if(currentWin._elems.length > 0) { for(currentWin._iCounter = 0; currentWin._iCounter < currentWin._elems.length; currentWin._iCounter++) { if((currentWin._elems[currentWin._iCounter].src.indexOf('youtube.com') > -1) && (tmp = currentWin._elems[currentWin._iCounter].src.match(YoutubeID)) && (tmp[1].length == 11)) { play(cbu.getPrefs("CB.video") == "videotoplaylist" ? 'https://www.youtube.com/embed/' + tmp[1] : 'https://www.youtube.com/watch?v=' + tmp[1]); currentWin._elems[currentWin._iCounter].outerHTML = ytIMGouter(tmp[1]); return true; }; if(currentWin._elems[currentWin._iCounter].clientWidth > 80 && currentWin._elems[currentWin._iCounter].clientHeight > 40 && handlWin(currentWin._elems[currentWin._iCounter].contentWindow))return true; } }; elem = currentWin.document.getElementsByTagName('object'); currLoc = currentWin.location; if(elem.length == 0) { elem = currentWin.document.getElementsByTagName('embed') }; if(elem.length > 0) { for(i = 0; i < elem.length; i++) { if(elem[i].innerHTML.indexOf('youtu') != -1 && (tmp = elem[i].innerHTML.match(YoutubeID)) && tmp[1].length == 11) { play(cbu.getPrefs("CB.video") == "videotoplaylist" ? 'https://www.youtube.com/embed/' + tmp[1] : 'https://www.youtube.com/watch?v=' + tmp[1]); elem[i].outerHTML = ytIMGouter(tmp[1]); return true; } else { if(elem[i].clientWidth > 80 && elem[i].clientHeight > 40) { if(((tmp = getSrc(elem[i].parentNode, currLoc)) || (tmp = getLink(elem[i], currLoc))) && tmp.length > 2) { play(tmp); elem[i].outerHTML = innerA + 'background-color:black!important;bottom:20px!important;"> ' + videoMoved + '</div>'; return true; }; }; } }; }; return false; }; this.onclick = this.oncontextmenu = e => { if (e.target != this) return; if(e.button == 0) { if(cbu.getPrefs("CB.video").substring(0,6) == "videom"){ elem = content.document.getElementsByTagName('object'); if(elem.length == 0) { elem = content.document.getElementsByTagName('embed') }; resizeObjs(elem); resizeObjs(content.document.getElementsByTagName('iframe')); resizeObjs(content.document.getElementsByTagName('video')); } else { if(!handlWin(content))custombuttons.alertSlide1(noFound); } }; if(e.button == 1) gShowPopup(self); }; this.oncontextmenu = e => e.target != this ? menu.hasAttribute("context") : e.ctrlKey || e.shiftKey || e.altKey || e.metaKey || ( e.detail != 1 ? menu.hidePopup() : !!menu.openPopup(this, "after_start") ); custombuttons.alertSlide1 = function(sTitle) { var as = Components.classes["@mozilla.org/alerts-service;1"].getService(Components.interfaces.nsIAlertsService); as.showAlertNotification('chrome://global/skin/icons/information-16.png', "", sTitle, false, "", null); setTimeout(() => as.closeAlert(), 999); }; function resizeObjs(objs) { if(!objs) return; LEVELS = 3; dir = (cbu.getPrefs("CB.video") == "videomaximize") ? 1 : -1; for(i = 0; i < objs.length; i++) { var Width = new Array(LEVELS) var Height = new Array(LEVELS) Width[0] = objs[i].clientWidth; Height[0] = objs[i].clientHeight; if((Width[0] > (-20 * dir + 100)) && (Height[0] > (-20 * dir + 60))) { obj = objs[i]; for(var k = 1; ((k < LEVELS) && (obj.parentNode)); k++) { obj = obj.parentNode Width[k] = obj.clientWidth; Height[k] = obj.clientHeight; }; Width[0] = Width[0] + dir * (Width[0] / 5 | 0); Height[0] = Height[0] + dir * (Height[0] / 5 | 0); objs[i].style.width = Width[0] + "px"; objs[i].width = Width[0]; objs[i].style.height = Height[0] + "px"; objs[i].height = Height[0]; obj = objs[i]; for(var k = 1; ((k < LEVELS) && !(objs[i].tagName == 'IFRAME') && (obj.parentNode) && (Width[k]) && (Height[k]) && (Width[k] > (-20 * dir + 100)) && (Height[k] > (-20 * dir + 60))); k++) { obj = obj.parentNode Width[k] = Width[k] + dir * (Width[k] / 5 | 0); Height[k] = Height[k] + dir * (Height[k] / 5 | 0); obj.style.width = Width[k] + "px"; obj.width = Width[k]; obj.style.height = Height[k] + "px"; obj.height = Height[k]; } } }; }; function restProtHost(lnkR, curLoc) { if(lnkR.length==0)return ''; let tr = lnkR.replace(/^:\/\//, curLoc.protocol + "//"); if(!tr.match(/^https?:\/\//i)){ lnkR = tr.replace(/^\/+/, ''); if(lnkR.split('/')[0].split('?')[0].split('#')[0].toLowerCase().match(/^(?:[-a-z\d]+\.)+[a-z\d]{2,6}$/)){ tr = curLoc.protocol + '//' + lnkR; }else{ tr = curLoc.protocol + '//' + curLoc.host + "/" + lnkR; } }; return tr; }; function getSrc(vobj, currentLoc) { var t = '', tt = ''; if((((t = vobj.innerHTML.match(/<video.*?\ssrc=(?:(?:'([^']*)')|(?:"([^"]*)")|([^\s]*))/i)) && (t) && (tt = t[1] || t[2] || t[3]) && tt.indexOf('blob:') == -1 ) || ((t = vobj.innerHTML.match(/<source.*?\ssrc=(?:(?:'([^']*)')|(?:"([^"]*)")|([^\s]*)).*?\stype=['"]?video\//i)) && (t) && (tt = t[1] || t[2] || t[3]))) && tt.length > 2 && tt.indexOf('blob:') == -1 ) { if(tt.indexOf(".mp4/?") == -1) { tt = tt.replace(/&/g, "&") }; t = restProtHost(tt, currentLoc); return t; }; return ''; }; function getLink(obj, curLocation) { if(!obj || !obj.tagName) return ''; var flashvars = '', // src = '', q = obj.tagName.toLowerCase(); var getParam = function(e, n) { var v = '', r = new RegExp('^(' + n + ')$', 'i'), param = e.getElementsByTagName('param'); for(var igp = 0, p; p = param[igp]; igp++) { if(p.hasAttribute('name') && p.getAttribute('name').match(r)) { v = p.getAttribute('value'); break }; }; return v; }; if(q == 'object') { // src = obj.getAttribute('data') || obj.getAttribute('src') || getParam(obj, 'movie|data|src|code|filename|url') || (obj.getElementsByTagName('embed').length > 0 ? obj.getElementsByTagName('embed')[0].getAttribute('src') : ''); flashvars = getParam(obj, 'flashvars'); } else if(q == 'embed') { // src = obj.getAttribute('src'); flashvars = obj.getAttribute('flashvars'); } else return ''; if(!flashvars) return ''; // src = restProtHost(src, curLocation); var restPath = function(f, s) { return(f.substring(0, 4) == 'http') ? f : s.replace(/[#?].*$/, '').replace(/[^\/]*$/, f) }; function videoLinkExtract(fl) { //alert(fl); var linkArr = [], outLinks = [], jj = 0, lba = '', lbb = '', decodeURL = function(s) { try { return decodeURIComponent(s) } catch(e) { return unescape(s) } }; for(var ij = 0; ij < 3; ij++) { lba = lba + String.fromCharCode(parseInt((Math.random() * 15 + 1) + '', 10)); lbb = lbb + String.fromCharCode(parseInt((Math.random() * 15 + 16) + '', 10)); }; function pushWithMerit(lnk) { var merit = -11; if(lnk.match(/^https?:\/\//i)) merit = merit + 40; if(outLinks.length == 0) merit = merit + 1; if(lnk.match(/^\//)) merit = merit + 7; if(lnk.match(/^\/\//)) merit = merit + 30; if(lnk.match(/240p([^a-z]|$)/i)) merit = merit + 1; if(lnk.match(/[^a-z]240([^a-z0-9]|$)/i)) merit = merit + 1; if(lnk.match(/360p([^a-z]|$)/i)) merit = merit + 3; if(lnk.match(/[^a-z]360([^a-z0-9]|$)/i)) merit = merit + 3; if(lnk.match(/480p([^a-z]|$)/i)) merit = merit + 5; if(lnk.match(/[^a-z]480([^a-z0-9]|$)/i)) merit = merit + 5; if(lnk.match(/720p([^a-z]|$)/i)) merit = merit + 7; if(lnk.match(/[^a-z]720([^a-z0-9]|$)/i)) merit = merit + 7; if(lnk.match(/\.mp4([^a-z]|$)/i)) merit = merit + 8; if(lnk.match(/_hd([^a-z]|$)/i)) merit = merit + 6; if(lnk.match(/\.(jpg|xml)([^a-z]|$)/i)) merit = merit - 40; if(merit > 0) outLinks.push(merit + lba + lnk); Services.console.logStringMessage('merit:'+merit+' lnk->'+lnk); }; linkArr.push(fl); while(linkArr.length > jj && jj < 30) { var testPaths = []; testPaths = linkArr[jj].split(/(\.(?:flv|mp4|m3u8))/i); if(testPaths[testPaths.length - 1] == '') testPaths.pop(); for(k = 1; k < testPaths.length; k = k + 2) { if(testPaths[k - 1].indexOf(lba) > -1) { pref = testPaths[k - 1]; } else { var testAboutDom = testPaths[k - 1].toLowerCase().split(/(https?:\/\/)/); if(testAboutDom[testAboutDom.length - 1]=='') testAboutDom.pop(); var pTest = testAboutDom[testAboutDom.length - 1].split(/(\?[^\?]*?&)/); if(pTest.length>2){ pTest.pop(); pTest.pop(); }; testAboutDom[testAboutDom.length - 1] = pTest.join(''); pref = testPaths[k - 1].substring(testAboutDom.join('').lastIndexOf("&") + 1); }; t2 = pref.lastIndexOf(lbb); if(t2 > -1) { pref = pref.substring(t2 + 3); } else { t2 = pref.lastIndexOf('{"'); if(t2 > -1) pref = pref.substring(t2 + 2); t2 = pref.lastIndexOf('["'); if(t2 > -1) pref = pref.substring(t2 + 2); t2 = pref.lastIndexOf(',"'); if(t2 > -1) pref = pref.substring(t2 + 2); t2 = pref.toLowerCase().lastIndexOf('"http://'); if(t2 > -1) pref = pref.substring(t2 + 1); t2 = pref.toLowerCase().lastIndexOf('"https://'); if(t2 > -1) pref = pref.substring(t2 + 1); t2 = pref.toLowerCase().lastIndexOf(',http://'); if(t2 > -1) pref = pref.substring(t2 + 1); t2 = pref.toLowerCase().lastIndexOf(',https://'); if(t2 > -1) pref = pref.substring(t2 + 1); t2 = pref.toLowerCase().lastIndexOf(';http'); if(t2 > -1) pref = pref.substring(t2 + 1); t2 = pref.toLowerCase().lastIndexOf('*https://'); if(t2 > -1) pref = pref.substring(t2 + 1); t2 = pref.toLowerCase().lastIndexOf(' or '); if(t2 > -1) pref = pref.substring(t2 + 4); pref = pref.substring(pref.split('/')[0].toLowerCase().split('%2f')[0].lastIndexOf('=') + 1); } if(pref.length > 0) { if(pref.split('?')[0].toLowerCase().match(/%[2-3][0-9a-f]/)) { t2 = pref.indexOf('"') if(t2 > -1) pref = pref.substring(t2 + 1); suff = testPaths[k + 1] ? testPaths[k + 1].split('&')[0].split('"')[0].split(';')[0].split(/,http/i)[0] : ''; if((suff != testPaths[k + 1]) || (testPaths.length < k + 3)) { if(testPaths.length > k + 1) { testPaths[k + 1] = ((pref == testPaths[k - 1]) ? '' : '&') + testPaths[k + 1].substr(suff.length) }; t2 = pref.lastIndexOf(lba); if(t2 > -1) pref = pref.substring(t2 + 3) linkArr.push(decodeURL(pref + testPaths[k] + suff)); } else { testPaths[k + 1] = (pref == testPaths[k - 1] ? '' : lbb) + pref + testPaths[k] + suff } } else { suff = testPaths[k + 1] ? testPaths[k + 1].split(';')[0].split('"]')[0].split('"}')[0].split('",')[0].split(/,https?:\/\//i)[0].split('*https://')[0].split(' or ')[0] : ''; t2 = suff.indexOf('&'); if((t2 > -1) && (pref != testPaths[k - 1])) { if(t2 == 0) suff = ''; if(suff.charAt(0) != '?') suff = suff.split(/(&[^&]+=https?:\/\/)/i)[0]; }; if((suff != testPaths[k + 1]) || (testPaths.length < k + 3)) { if(testPaths.length > k + 1) { testPaths[k + 1] = ((pref == testPaths[k - 1]) ? '' : '&') + testPaths[k + 1].substr(suff.length) }; t2 = pref.lastIndexOf(lba); if(t2 > -1) pref = pref.substring(t2 + 3); pushWithMerit(pref + testPaths[k] + suff); } else { testPaths[k + 1] = lba + (pref == testPaths[k - 1] ? '' : lbb) + pref + testPaths[k] + suff } } } }; jj = jj + 1; }; if(outLinks.length == 0) return ''; function srt(a, b) { a = parseInt(a.substr(0, a.indexOf(lba)), 10); b = parseInt(b.substr(0, b.indexOf(lba)), 10); if(a < b) return 1; if(a > b) return -1; return 0 }; outLinks.sort(srt); outLinks[0] = outLinks[0].substr(outLinks[0].indexOf(lba) + 3) if(outLinks[0].indexOf('_hq.mp4/?time=') > 0) outLinks[0] = outLinks[0].replace(/&/g, '&'); return outLinks[0]; }; ol = videoLinkExtract(flashvars); if(!ol) return ''; // ol = ol.replace(/^:?\/\//, curLocation.protocol + "//"); // return restPath(ol, src); return restProtHost(ol, curLocation); }; var menu = self.appendChild(document.createElement("menupopup")); self.image = "moz-icon://file://" + path; var playerName = path.split("\\").pop().replace(".exe",""); self.label = "Открыть видео в " +sysPlayerName; setTimeout(() => { Menu_n_TooltipTxts.forEach((m) => { if("separator" in m) { menu.appendChild(document.createElement("menuseparator")); return }; var mItem = document.createElement("menuitem"); mItem.setAttribute("label", m.label); if("radio" in m) { mItem.setAttribute("type", "radio"); mItem.setAttribute('checked', cbu.getPrefs("CB.video") == m.value); if(cbu.getPrefs("CB.video") == m.value) { self.tooltipText = m.tooltipTxt; } mItem.onclick = () => { cbu.setPrefs("CB.video", m.value); tmp = (self.image == imgFlashToPlayer || self.image == imgFlashMinimize || self.image == imgFlashMaximize); if(m.value.substring(0,9)=='videotopl'){ self.image = tmp ? imgFlashToPlayer : imgHTML5ToPlayer; } else if(m.value=='videominimize') { self.image = tmp ? imgFlashMinimize : imgHTML5Minimize; } else self.image = tmp ? imgFlashMaximize : imgHTML5Maximize; self.tooltipText = m.tooltipTxt; }; } if("checkbox" in m) { mItem.setAttribute('type', 'checkbox'); mItem.setAttribute('checked', (self.image == imgFlashToPlayer || self.image == imgFlashMinimize || self.image == imgFlashMaximize )); mItem.onclick = function(e) { e.stopPropagation(); e.preventDefault(); if(e.button == 0) toggleFlash(); } } menu.appendChild(mItem); }); menu.onclick = function(e) { e.stopPropagation(); if(e.button > 0) e.preventDefault(); }; }, 100); var contextMenu = document.getElementById("contentAreaContextMenu"); var menuitem = contextMenu.insertBefore(document.createElement("menuitem"), document.getElementById("context-sep-open")); menuitem.setAttribute("label", "Открыть в " +sysPlayerName); menuitem.setAttribute("class", "menuitem-iconic"); menuitem.setAttribute("image", "moz-icon://file://" + path); menuitem.onclick = () => play(gContextMenu.linkURL); addEventListener("popupshowing", ()=> menuitem.hidden = !gContextMenu.onLink, false, contextMenu); addDestructor(()=> menuitem.remove() ); var contextMenu = document.getElementById("contentAreaContextMenu"); var mItem = contextMenu.insertBefore(document.createElement("menuitem"), document.getElementById("context-copyvideourl")); mItem.setAttribute("label", openIn); mItem.onclick = () => { var vurl = gContextMenu.mediaURL, videoelem = gContextMenu.target; if(videoelem && videoelem.nodeName.toLowerCase() == 'video') { if(content.location.hostname.indexOf('youtu') != -1 && (tmp = content.location.toString().match(YoutubeID)) && tmp[1].length == 11) { play(vurl); videoMovedbox = content.document.createElement('videoMoved'); videoMovedbox.innerHTML = innerA + innerB + 'top:-15px!important;"><b>' + videoMoved + '</b></div>'; loadURI(stopPl); content.document.getElementById('eow-title').appendChild(videoMovedbox); return; }; if(content.location.hostname == 'www.youtube.com') { videoelem.parentNode.parentNode.appendChild(videoMovedbox); } else { var inFrameHref = inFrameWin.location.href, found = false; if(inFrameWin.location.hostname == 'www.youtube.com' && (tmp = inFrameHref.match(YoutubeID)) && tmp[1].length == 11){//и значит во фрейме elem = inFrameWin.parent.document.getElementsByTagName('iframe'); if(elem.length > 0) { for(i = 0; i < elem.length; i++) { if(elem[i].contentWindow == inFrameWin) { elem[i].outerHTML = ytIMGouter(tmp[1]); found = true; break; }; }; }; if(!found)inFrameWin.document.body.innerHTML = ytIMGouter(tmp[1]); return; }; videoelem.parentNode.appendChild(videoMovedbox); }; videoelem.src = ''; try { videoelem.load() } catch(e) {}; } else play(vurl); }; addEventListener("popupshowing", () => { mItem.hidden = !gContextMenu.onVideo || !gContextMenu.mediaURL; mItem2.hidden = !gContextMenu.linkURL; mItem3.hidden = framItem.hidden || gContextMenu.target.ownerDocument.location.hostname.indexOf('youtube.com') == -1; }, false, contextMenu); addDestructor(() => {mItem.remove();mItem2.remove();mItem3.remove()}); function play(link) { var file = Services.dirsvc.get('CurProcD', Ci.nsIFile); var MozExeDir = file.path.split('\\').slice(0,-1).join('\\'); file.initWithPath(path); if(!file.exists()) { custombuttons.alertBox("File not found!", MozExeDir + Path); return; }; var process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess); process.init(FileUtils.File(String.raw`D:\Tube\youtube-dl.exe.lnk`)); process.run(false, [link, cbu.getPrefs("CB.video") == "videotoplaylist" ? addToPlaylistKey : ""], 2); };
Отредактировано anywho (15-06-2019 11:09:57)
Отсутствует
Вот, кстати, вариант с символами в несколько колонок.
На v.67.0.2 стало всё в одну. Возможно подкорректировать?
Пост
this.type != "menu" ? this.type = "menu" : (popup => { var columns = [ "¤ ¦ § © « » ¬ ® ° ± µ ¶ — ‘ ’ “ ” • ‰ ‹ › ™", "… ≈ ≠ × ✓ ✗ ⊞ ⊞ ⊞ ⊞ ⊞ ⊞ ⊞ ⊞ ⊞ ⊞ ⊞", "\uD83E\uDD8A \uD83D\uDE0E ⊞ ⊞ ⊞ ⊞ ⊞ ⊞ ⊞" ]; var css = //0&& ` #${_id} menuitem > .menu-text { font-size: 22px; font-family: Consolas, Rockwell, Verdana; text-align: center; -moz-appearance: none; margin: 0; padding: 0 14px; } #${_id} menuitem > :not(.menu-text) { display: none; } #${_id} > menupopup > arrowscrollbox { background-color: menu; } `.replace(/;/g, " !important;"); var inserter = { get docShell() { delete this.docShell; return this.docShell = "docShell" in document && document.docShell instanceof Ci.nsIDocShell ? document.docShell : window.docShell; }, get insertText() { delete this.insertText; return this.insertText = text => { if (!this.docShell.isCommandEnabled("cmd_insertText")) return; var params = "createCommandParams" in Components.utils ? Cu.createCommandParams() : Components.classes["@mozilla.org/embedcomp/command-params;1"] .createInstance(Components.interfaces.nsICommandParams); params.setStringValue("state_data", text); this.docShell.doCommandWithParams("cmd_insertText", params); } }, insert(text) { var br = document.activeElement; !br || br.localName != "browser" || !br.isRemoteBrowser ? this.insertText(text) : br.messageManager.loadFrameScript( `data:,(${this.insertText})${encodeURIComponent(text.toSource())}` , false, true); } }; this.onmousedown = e => { if (e.button) return; popup.addEventListener("popupshowing", e => popup.firstChild .boxObject.parentBox.setAttribute("orient", "horizontal") , {once: true}); popup.setAttribute("context", ""); popup.setAttribute("oncommand", "inserter.insert(event.target.label);"); popup.onauxclick = e => { var sym = e.target.label; sym && inserter.insert(sym); } popup.inserter = inserter; var df = document.createDocumentFragment(); for(var symbols of columns) { var menugroup = popup.appendChild(document.createElement("menugroup")); menugroup.setAttribute("orient", "vertical"); for(var sym of symbols.split(" ")) menugroup.appendChild( document.createElement("menuitem") ).setAttribute("label", sym); } popup.append(df); this.onmousedown = null; if (!css) return; var dwu = "windowUtils" in window && windowUtils instanceof Ci.nsIDOMWindowUtils ? windowUtils : window.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIDOMWindowUtils); var type = dwu.AGENT_SHEET; var url = "data:text/css," + encodeURIComponent(css); dwu.loadSheetUsingURIString(url, type); addDestructor(() => dwu.removeSheetUsingURIString(url, type)); } })(this.appendChild(document.createElement("menupopup")));
Отсутствует
Возможно подкорректировать?
Вроде получалось
if (this.type != "menu") { this.type = "menu"; if (!this.hasAttribute("is")) return; } (popup => { var columns = [ "¤ ¦ § © « » ¬ ® ° ± µ ¶ — ‘ ’ “ ” • ‰ ‹ › ™", "… ≈ ≠ × ✓ ✗ ⊞ ⊞ ⊞ ⊞ ⊞ ⊞ ⊞ ⊞ ⊞ ⊞ ⊞", "\uD83E\uDD8A \uD83D\uDE0E ⊞ ⊞ ⊞ ⊞ ⊞ ⊞ ⊞" ]; var css = //0&& ` #${_id} menuitem > .menu-text { font-size: 22px; font-family: Consolas, Rockwell, Verdana; text-align: center; -moz-appearance: none; margin: 0; padding: 0 14px; } #${_id} menuitem > :not(.menu-text) { display: none; } #${_id} > menupopup > arrowscrollbox { background-color: menu; } `.replace(/;/g, " !important;"); var inserter = { get docShell() { delete this.docShell; return this.docShell = "docShell" in document && document.docShell instanceof Ci.nsIDocShell ? document.docShell : window.docShell; }, get insertText() { delete this.insertText; return this.insertText = text => { if (!this.docShell.isCommandEnabled("cmd_insertText")) return; var params = "createCommandParams" in Components.utils ? Cu.createCommandParams() : Components.classes["@mozilla.org/embedcomp/command-params;1"] .createInstance(Components.interfaces.nsICommandParams); params.setStringValue("state_data", text); this.docShell.doCommandWithParams("cmd_insertText", params); } }, insert(text) { var br = document.activeElement; !br || br.localName != "browser" || !br.isRemoteBrowser ? this.insertText(text) : br.messageManager.loadFrameScript( `data:,(${this.insertText})${encodeURIComponent(text.toSource())}` , false, true); } }; this.onmousedown = e => { if (e.button) return; popup.addEventListener("popupshowing", e => { var menugroup = popup.firstChild; var parent = "boxObject" in menugroup ? menugroup.boxObject.parentBox : menugroup.flattenedTreeParentNode; parent.setAttribute("orient", "horizontal"); if (parent.localName == "scrollbox") parent.style.setProperty("-moz-box-orient", "horizontal", "important"); }, {once: true}); popup.setAttribute("context", ""); popup.setAttribute("oncommand", "inserter.insert(event.target.label);"); popup.onauxclick = e => { var sym = e.target.label; sym && inserter.insert(sym); } popup.inserter = inserter; var df = document.createDocumentFragment(); for(var symbols of columns) { var menugroup = popup.appendChild(document.createElementNS(xulns, "menugroup")); menugroup.setAttribute("orient", "vertical"); for(var sym of symbols.split(" ")) menugroup.appendChild( document.createElementNS(xulns, "menuitem") ).setAttribute("label", sym); } popup.append(df); this.onmousedown = null; if (!css) return; var dwu = "windowUtils" in window && windowUtils instanceof Ci.nsIDOMWindowUtils ? windowUtils : window.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIDOMWindowUtils); var type = dwu.AGENT_SHEET; var url = "data:text/css," + encodeURIComponent(css); dwu.loadSheetUsingURIString(url, type); addDestructor(() => dwu.removeSheetUsingURIString(url, type)); } this.prepend(popup); })(document.createElementNS(xulns, "menupopup"));
Отсутствует
Отсутствует
Давно не работает хорошая кнопка, можно поправить?
Удалить куки текущего сайта
Отсутствует
Давно не работает хорошая кнопка, можно поправить?
Удалить куки текущего сайта
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%u0423%u0434%u0430%u043B%u0438%u0442%u044C%20%u043A%u0443%u043A%u0438%20%u0442%u0435%u043A%u0443%u0449%u0435%u0433%u043E%20%u0441%u0430%u0439%u0442%u0430%3C/name%3E%0A%20%20%3Cimage%3E%3C%21%5BCDATA%5Bdata%3Aimage/png%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAACaklEQVR42rVVu2piURTd6jW+FSMWRkW76WRsRBCbNFY2ATHFlCGdTaZXmU/wB/IHYjGdON2ANlapxELxRQpJjPH9yNy14dzx5prGmRwQb+4+Z2Wttdc+SvQJS/pU0EQi8f3t7S2t0+lOBtvtdr/q9foPBVSSpG+BQOCrXDiNnSRRp9P5Ij/+BXU6nROv10vb7fbDg0KFrEhTOzs7o6enp2eVfIfDQRcXF7Rer1WbAWCz2ZjJZrPhd0ajkVarFS0WC9Lr9fzObDbTaDRSeyozJVk+LZdLFROXy0WtVouq1SrkcQ0A6XSaotEoA0OB1WqldrutBQ0GgzSbzRSGbrebarUaFQoFZpRKpVhRs9mk6XRK4XCYJpMJg9rtdiagke/3++nl5YX/NplMfKBUKvHz/f09JZNJVgIb5vM57wNDoUgDiv/k8/lYGpbH42Ggx8dHur29pUwmw56hIdgDZfv9XrHp/PycialALRYLb0ZRdHM4HPIzGIqDHy2oQUNVoCIuh+EXDUO33+8T9WPDooDCI8REzpoiH3ZgNRoNymazSg1A+BzKR1OFzwooug7P0FUwQMMQGeHt5eUlxWIxbhSmDvVDdcg3zqpA8WIwGKgiBQ9zuRwVi0W6vr6mq6srZiTPN4VCIbq7u1PSgvNIiwoUxX6/z2EWC8wjkQjl83kql8tUqVR4shCdeDxO3W5X2Y9oaUDxotfracYUCQDjm5sbVoEhQJdhASZIWIDkaEBfX1+ZmZjvY5eJwWBgW47dZIigsOLQU8d4PKZ/ufpkYo73kfr58PDgOvWSls/pZPm/VaByFgvyV+F//Jz8AYsmOCaaWhXDAAAAAElFTkSuQmCC%5D%5D%3E%3C/image%3E%0A%20%20%3Cmode%3E0%3C/mode%3E%0A%20%20%3Cinitcode%3E%3C%21%5BCDATA%5B//%20%u041D%u0430%u0441%u0442%u0440%u043E%u0439%u043A%u0430%20%u0444%u0443%u043D%u043A%u0446%u0438%u0439%20%u043A%u043B%u0438%u043A%u043E%u0432%20%u043C%u044B%u0448%u0438%20%u0434%u043B%u044F%20%u043A%u043D%u043E%u043F%u043A%u0438%20.............%0Athis.onclick%20%3De%3D%3E%20%7B%0A%20%20%20%0A%20%20%20if%20%28%20e.button%20%3D%3D%200%20%29%20%7B%0A%20%20%20%20%20%20%20%20deleteCookiesFromHost%28%29%3B%0A%20%20%20%20%20%20%20%20//BrowserReload%28%29%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%0A%20%20%20if%20%28%20e.button%20%3D%3D%201%20%29%20%7B%0A%20%20%20%20%20%20%20%20deleteCookiesFromHost%28%29%3B%0A%20%20%20%20%20%20%20%20reloadAllTabsFromHost%28%29%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%0A%20%20%20if%20%28%20e.button%20%3D%3D%202%20%26%26%20%21e.ctrlKey%20%29%20%7B%0A%20%20%20%20%20%20%20%20openCookiesPreferneces%28%29%3B%0A%20%20%20%20%20%20%20%20%7D%20%20%20%20%20%20%20%20%0A%7D%3B%0Athis.oncontextmenu%20%3De%3D%3E%20%7B%20%21e.ctrlKey%20%26%26%20e.preventDefault%28%29%20%7D%3B%0A%20%0A%0A//%20%u0423%u0434%u0430%u043B%u0438%u0442%u044C%20%u043A%u0443%u043A%u0438%20%u0431%u0430%u0437%u043E%u0432%u043E%u0433%u043E%20%u0434%u043E%u043C%u0435%u043D%u0430%20.............%0Afunction%20deleteCookiesFromHost%28%29%20%7B%0A%20%20%20var%20host%20%3D%20Services.eTLD.getBaseDomain%28gBrowser.currentURI%29%3B%0A%0A%20%20%20//%20%u0443%u0434%u0430%u043B%u0438%u0442%u044C%20%u043E%u0431%u044B%u0447%u043D%u044B%u0435%20%u043A%u0443%u043A%u0438%20%u0434%u043E%u043C%u0435%u043D%u0430%0A%20%20%20for%20%28%20var%20en%20%3D%20Services.cookies.enumerator%3B%20en.hasMoreElements%28%29%3B%20%29%20%7B%0A%20%20%20%20%20%20%20%20%20var%20cookie%20%3D%20en.getNext%28%29.QueryInterface%28Ci.nsICookie%29%3B%0A%20%20%20%20%20%20%20%20%20%7Ecookie.host.indexOf%28host.trim%28%29%29%20%26%26%20Services.cookies.remove%28cookie.host%2C%20cookie.name%2C%20cookie.path%2C%20false%2C%20cookie.originAttributes%20%7C%7C%20undefined%29%3B%20%0A%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%0A%20%20%20//%20%u0443%u0434%u0430%u043B%u0438%u0442%u044C%20%u043A%u0443%u043A%u0438%20%u0434%u043E%u043C%u0435%u043D%u0430%20%u0438%u0437%20%u0438%u0441%u0442%u043E%u0440%u0438%u0438%20%20%20%20%20%0A%20%20%20var%20reversedDomain%20%3D%20host.split%28%22%22%29.reverse%28%29.join%28%22%22%29%20+%20%22.%22%3B%0A%20%20%20Cu.import%28%22resource%3A//gre/modules/FileUtils.jsm%22%29%3B%0A%20%20%20var%20file%20%3D%20FileUtils.getFile%28%22ProfD%22%2C%20%5B%22webappsstore.sqlite%22%5D%29%3B%0A%20%20%20var%20dbConn%20%3D%20Services.storage.openDatabase%28file%29%3B%0A%20%20%20dbConn.executeSimpleSQL%28%22DELETE%20FROM%20webappsstore2%20WHERE%20scope%20LIKE%20%5C%22%25%22%20+%20reversedDomain%20+%22%25%5C%22%22%29%3B%0A%20%20%20dbConn.close%28%29%3B%0A%20%20%20%0A%20%20%20//%20%u0443%u0434%u0430%u043B%u0438%u0442%u044C%20%u0432%u0441%u0435%20Flash%20%u043A%u0443%u043A%u0438%0A%20%20%20var%20dir%20%3D%20Services.dirsvc.get%28%27Home%27%2C%20Ci.nsIFile%29%3B%0A%20%20%20dir.append%28%22Application%20Data%22%29%3B%0A%20%20%20dir.append%28%22Macromedia%22%29%3B%0A%20%20%20dir.remove%28true%29%3B%0A%20%20%20dir.create%28Ci.nsIFile.DIRECTORY_TYPE%2C%200777%29%3B%0A%7D%3B%0A%0A%0A//%20%u041E%u0442%u043A%u0440%u044B%u0442%u044C%20%u043C%u0435%u043D%u0435%u0434%u0436%u0435%u0440%20%u043A%u0443%u043A%u0438%u0441%u043E%u0432%20.............%0Afunction%20openCookiesPreferneces%28%29%20%7B%0A%20%20%20try%20%7B%20Services.wm.getMostRecentWindow%28%22Browser%3ASiteDataSettings%22%29.close%28%29%20%7D%20catch%28e%29%20%7B%7D%3B%0A%20%20%20var%20win%20%3D%20openDialog%28%22chrome%3A//browser/content/preferences/siteDataSettings.xul%22%2C%20%22_blank%22%2C%20%22resizable%2Cdialog%3Dyes%2Ccenterscreen%22%2C%20null%29%3B%0A%20%20%20%0A%20%20%20addEventListener%28%22load%22%2C%20%28%29%3D%3E%20%7B%0A%20%20%20%20%20%20var%20filter%20%3D%20win.document.getElementById%28%22searchBox%22%29%3B%0A%20%20%20%20%20%20filter.value%20%3D%20Services.eTLD.getBaseDomain%28gBrowser.currentURI%29%3B%20%0A%20%20%20%20%20%20setTimeout%28%28%29%3D%3E%20filter.doCommand%28%29%2C%200%29%3B%0A%20%20%20%7D%2C%20false%2C%20win%29%3B%0A%7D%3B%0A%0A%0A//%20%u041F%u0435%u0440%u0435%u0437%u0430%u0433%u0440%u0443%u0437%u0438%u0442%u044C%20%u0432%u0441%u0435%20%u0432%u043A%u043B%u0430%u0434%u043A%u0438%20%u0442%u0435%u043A%u0443%u0449%u0435%u0433%u043E%20%u0441%u0430%u0439%u0442%u0430%20.............%0Afunction%20reloadAllTabsFromHost%28%29%20%7B%0A%20%20%20var%20host%20%3D%20Services.eTLD.getBaseDomain%28gBrowser.currentURI%29%3B%0A%0A%20%20%20for%28%20var%20tab%20of%20gBrowser.tabs%20%29%20%7B%20%20%0A%20%20%20%20%20%20%20%20try%20%7B%20var%20tabHost%20%3D%20Services.eTLD.getBaseDomain%28tab.linkedBrowser.currentURI%29%20%7D%20%0A%20%20%20%20%20%20%20%20catch%28e%29%20%7B%20var%20tabHost%20%3D%20null%20%7D%3B%0A%0A%20%20%20%20%20%20%20%20host%20%3D%3D%20tabHost%20%26%26%20gBrowser.reloadTab%28tab%29%3B%0A%20%20%20%20%20%20%20%20%7D%0A%7D%3B%0A%0A%0Athis.tooltipText%20%3D%20%22%u041B%3A%20%u0423%u0434%u0430%u043B%u0438%u0442%u044C%20%u043A%u0443%u043A%u0438%20%u0442%u0435%u043A%u0443%u0449%u0435%u0433%u043E%20%u0441%u0430%u0439%u0442%u0430%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5Cn%u0421%3A%20%u0423%u0434%u0430%u043B%u0438%u0442%u044C%20%u043A%u0443%u043A%u0438%20%u0442%u0435%u043A%u0443%u0449%u0435%u0433%u043E%20%u0441%u0430%u0439%u0442%u0430%20+%20%u043E%u0431%u043D%u043E%u0432%u0438%u0442%u044C%20%u0432%u0441%u0435%20%u0432%u043A%u043B%u0430%u0434%u043A%u0438%20%u0442%u0435%u043A%u0443%u0449%u0435%u0433%u043E%20%u0441%u0430%u0439%u0442%u0430%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5Cn%u041F%3A%20%u0423%u043F%u0440%u0430%u0432%u043B%u0435%u043D%u0438%u0435%20%u043A%u0443%u043A%u0430%u043C%u0438%20%u0434%u043B%u044F%20%u0442%u0435%u043A%u0443%u0449%u0435%u0433%u043E%20%u0441%u0430%u0439%u0442%u0430%5C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5CnCtrl+%u041F%3A%20CB%20%u041C%u0435%u043D%u044E%22%3B%5D%5D%3E%3C/initcode%3E%0A%20%20%3Ccode%3E%3C%21%5BCDATA%5B/*CODE*/%5D%5D%3E%3C/code%3E%0A%20%20%3Caccelkey%3E%3C%21%5BCDATA%5B%5D%5D%3E%3C/accelkey%3E%0A%20%20%3Chelp%3E%3C%21%5BCDATA%5B%5D%5D%3E%3C/help%3E%0A%20%20%3Cattributes/%3E%0A%3C/custombutton%3E
Отсутствует
Подскажите, пожалуйста, код для кнопки "Закрыть вкладки справа".
Отсутствует
Подскажите, пожалуйста, код для кнопки "Закрыть вкладки справа".
Отсутствует
bunda1, большое спасибо!
Отсутствует
bunda1
Если не ошибаюсь, это ваша кн.? В 67 не определяет ID места , только вручную ...А, жаль..
/*Initialization Code*/ ((popup, {lastChild} = popup, pref = "CB.bookmark") => addDestructor(reason => reason == "delete" && Services.prefs.clearUserPref(pref)) + addEventListener("popupshowing", { index: 0, // 0 - первой, PlacesUtils.bookmarks.DEFAULT_INDEX - последней width: 500, height: 640, nodePosition: .35, handleEvent(e) { if (e.target != popup || this.souldHide()) return; var menuitem = document.createElement("menuitem"); menuitem.id = "context-addBookmark"; menuitem.className = "menuitem-iconic"; menuitem.setAttribute("image", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAB0UlEQVR42p2SS0gbURiFz73TcSUUXYi4EGLATRDSLnzgpqC4rLgXcVFo6TJY0AayURCtLtqK2G5sEd2LguIDF4W0mzaIbTVCxQcJihPzUJJ53/4ZJThNrOI/c5j7z9zz3TNzh9X7Wp/29L6YR4mafD/cET/8vYr/FBt6MyOCfd1FDzRDYOztbEnT+Eh/Q1KJ/XQBjmIKJM7BJU5XBkmSUFlRXhLQPzhzMBJ61gToJwVAQklAzpsLYhCQ0BSI3xh/d+F5pwvQHkoVTfoYqAWTZJxdCKfnjCGdUW0lJVJTi/HKAuDRyz/4/NqDrCZgWoBFornYPOTYjgloJvWCo+wBsBM9NTa+qd/9Pr3ZBfgU9GD1l42sCuQ05ig/zq/NBHMkcyC6c2qshXMRv99odAE+vPJgectGjkyqzmknAIOSgIwcFIdSyNRGtxVj7Us24m/5BzARqMPCDwuqxqGS2bwyOweZQfdkirO7dwNgfdSL47SgyOwytxMdl+O8bDotG+l0TuzHRWZs6eShCxCZ9OL2MiAsE8kLCW0DR3ABvr7zIpmhv5A+uW6QdJN2g95DCCeBZYur3kbivAwDcwmwquq6lpqulfAdli6qzeknj9l9jNfrL3fWCMvzB8ayAAAAAElFTkSuQmCC"); menuitem.setAttribute("oncommand", "linkedObject.oncommand(event);"); menuitem.linkedObject = this; menuitem.onauxclick = e => { if (e.button == 1) return; e.preventDefault(); popup.hidePopup(); this.pick(); } popup.insertBefore(menuitem, lastChild.nextSibling); addDestructor(() => menuitem.remove()); (this.handleEvent = e => e.target == popup && !(menuitem.hidden = this.souldHide()) && this.update(menuitem) )(e); }, ons: ["isContentSelected", "onTextInput", "onImage", "onVideo", "onCanvas", "onAudio"], souldHide() { if (gContextMenu.onLink) return false; return this.ons.some(on => gContextMenu[on]); }, oncommand(e) { this[e.ctrlKey || e.shiftKey ? "pick" : "bookmark"](e.target); }, get guid() { return Services.prefs.getStringPref(pref, PlacesUtils.bookmarks.toolbarGuid); }, async update(menuitem) { var info = await PlacesUtils.bookmarks.fetch(this.guid); var title = PlacesUtils.bookmarks.getLocalizedTitle(info); menuitem.label = "Добавить закладку в: " + ( menuitem.folderName = title || "[без заголовка]" ); }, pick() { var features = "chrome,all,resizable,centerscreen,modal"; window.openDialog(this.url, "_blank", features, this.guid); }, bookmark({folderName}) { if (gContextMenu.onLink) { var url = gContextMenu.linkURL; var title = gContextMenu.linkText(); } else { var url = gBrowser.currentURI.spec; var title = gBrowser.contentTitle || gBrowser.selectedTab.label; } var info = {url, title, parentGuid: this.guid, index: this.index}; PlacesUtils.bookmarks.insert(info).then( () => this.notify(title, "Добавил закладку в папку: " + folderName), err => this.notify("Ошибка", err) ); }, get as() { delete this.as; return this.as = Cc["@mozilla.org/alerts-service;1"] .getService(Ci.nsIAlertsService); }, notify(title, msg) { this.as.showAlertNotification("chrome://global/skin/icons/cpd_OK.png", title, msg); setTimeout(this.as.closeAlert, 1800); }, get url() { var xul = ` <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="chrome://browser/content/places/places.css"?> <?xml-stylesheet href="chrome://browser/skin/places/places.css"?> <dialog xmlns="${xulns}" id="bookmark-folder-saver-dialog" windowtype="bookmark-folder-saver:dialog" title="Выберите папку" buttons="accept,cancel" onload="init();" ondialogaccept="dialogCallback();" width="${this.width}" height="${this.height}"> <script type="application/javascript" src="chrome://global/content/globalOverlay.js"/> <script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/> <script type="application/javascript"><![CDATA[ ChromeUtils.defineModuleGetter(window, "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm"); ChromeUtils.defineModuleGetter(window, "PlacesUIUtils", "resource:///modules/PlacesUIUtils.jsm"); ChromeUtils.defineModuleGetter(window, "PlacesTransactions", "resource://gre/modules/PlacesTransactions.jsm"); ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); XPCOMUtils.defineLazyScriptGetter(window, "PlacesTreeView", "chrome://browser/content/places/treeView.js"); XPCOMUtils.defineLazyScriptGetter( window, ["PlacesInsertionPoint", "PlacesController", "PlacesControllerDragHelper"],\n\ "chrome://browser/content/places/controller.js"\n\ ); ]]></script> <keyset> <key id="key-accept" keycode="VK_RETURN" modifiers="control" oncommand="document.documentElement.acceptDialog();" /> </keyset> <tree id="tree" type="places" place="place:type=${ Ci.nsINavHistoryQueryOptions.RESULTS_AS_ROOTS_QUERY }&excludeItems=1&excludeQueries=1" hidecolumnpicker="true" seltype="single" flex="1"> <treecols> <treecol id="title" flex="1" primary="true" hideheader="true" /> </treecols> <treechildren /> </tree> <script type="application/javascript"><![CDATA[ var tree = document.getElementById("tree"); function init() { tree.selectItems([window.arguments[0]]); var ind = tree.view.selection.currentIndex; ind != -1 && setTimeout(() => { var tbo = tree.treeBoxObject; var first = tbo.getFirstVisibleRow(); var visibleRows = tbo.height/tbo.rowHeight; var newFirst = ind - ${this.nodePosition}*visibleRows + 1; tbo.scrollByLines(Math.round(newFirst - first)); tbo.ensureRowIsVisible(ind); }, 0); } function dialogCallback() { var ind = tree.view.selection.currentIndex; if (ind == -1) return; var item = tree.view.nodeForTreeIndex(ind); item && Services.prefs.setStringPref( "${pref}", PlacesUtils.getConcreteItemGuid(item) ); } ]]></script> </dialog>`; var url = URL.createObjectURL(new Blob( [xul.trimLeft()], {type: "application/vnd.mozilla.xul+xml"} )); addDestructor(() => URL.revokeObjectURL(url)); delete this.url; return this.url = url; } }, false, popup || 1))(document.getElementById("contentAreaContextMenu"));
Отсутствует
Помогите пожалуйста починить кнопку:
Кнопка открывает сайты в боковой панели
ПКМ - открыть сайт в боковой панели
ЛКМ - открыть список сайтов
СКМ - добавить сайт в список
Так вот в мультипроцессном режиме ПКМ не отрывает сайт, хотя если открывать сайт ЛКМ из списка то он открывается.
var menuPopup = self.appendChild(document.createElement("menupopup")), help = self.Help; menuPopup.setAttribute('context', ''); for (var item of help.split('\n\n')) { var mItem = document.createElement("menuitem"), params = item.split('\n'), title = params[0], url = params[1], icon = !params[2] ? '' : params[2]; mItem.setAttribute('label', title); mItem.setAttribute('tooltiptext', url); mItem.setAttribute('class', 'menuitem-iconic'); mItem.setAttribute('image', icon || "chrome://mozapps/skin/places/defaultFavicon.png"); mItem.setAttribute('oncommand', 'openWebPanel("' + title + '", "' + url + '")'); mItem.setAttribute('oncontextmenu', 'this.parentNode.parentNode.removePage("' + encodeURIComponent(title) + '", "' + encodeURIComponent(url) + '", "' + encodeURIComponent(icon) + '");'); menuPopup.appendChild(mItem); } [ {sep: ''}, {lbl: 'Редактировать кнопку', cmd: 'custombuttons.editButton(this.parentNode.parentNode);'}, {lbl: 'Открыть адрес из буфера обмена', cmd: 'openWebPanel(gClipboard.read(), gClipboard.read());'}, {lbl: 'Добавить текущий сайт', cmd: 'this.parentNode.parentNode.addPage();'} ].forEach(m=> { if ('sep' in m) menuPopup.appendChild(document.createElement("menuseparator")); else { var extraItems = menuPopup.appendChild(document.createElement("menuitem")); extraItems.setAttribute('label', m.lbl); extraItems.setAttribute('oncommand', m.cmd); } }); this.addPage =()=> { var iconLink = gBrowser.mCurrentTab.image, icon = !iconLink ? '' : (!iconLink.startsWith('chrome:') ? '\nmoz-anno:favicon:' + iconLink : '\n' + iconLink), newItem = [,,window.content.document.title, window.content.document.location + icon].join('\n'), link = custombuttons.makeButtonLink("edit", _id), param = custombuttons.cbService.getButtonParameters(link); param = param.wrappedJSObject || param; param.help = param.help + newItem; custombuttons.cbService.installButton(param); }; this.removePage =(aTitle, aURL, aIcon)=> { var itemsToRemove = [], link = custombuttons.makeButtonLink("edit", _id), param = custombuttons.cbService.getButtonParameters(link); aIcon = !aIcon ? '' : '\n' + aIcon; param = param.wrappedJSObject || param; itemsToRemove.push([,,aTitle, aURL + aIcon].join('\n'), [aTitle, aURL + aIcon,,,].join('\n')); for (var item of itemsToRemove) param.help = param.help.replace(decodeURIComponent(item), ''); custombuttons.cbService.installButton(param); }; this.onclick =e=> { if (e.target !== this) return; if (e.button == 0) menuPopup.openPopup(this, 'after_start') if (e.button == 1) this.addPage(); if (e.button == 2 && !e.shiftKey && !e.ctrlKey && !e.altKey) e.preventDefault(), e.stopPropagation(), openWebPanel(window.content.document.title, window.content.document.location);; }; this.tooltipText = 'ЛКМ: Открыть меню со списком заданных адресов\nСКМ: Добавить текущий сайт в спискок заданных адресов\nПКМ: Открыть адрес активной вкладки'; (contextMenu => { var menuitem = document.createElement("menuitem"); menuitem.id = "open-in-sidebar"; menuitem.setAttribute("label", "Open in Sidebar"); menuitem.setAttribute("oncommand", "openWebPanel(gContextMenu.getLinkURL(), gContextMenu.getLinkURL())"); contextMenu.insertBefore(menuitem, document.getElementById("context-sep-open")); addEventListener("popupshowing", ()=> menuitem.hidden = !gContextMenu.onLink, false, contextMenu); addDestructor(()=> contextMenu.removeChild(menuitem)); })(document.getElementById("contentAreaContextMenu")); ((browser, listener, br) => { if (browser) { addEventListener("DOMFrameContentLoaded", listener, true, browser); var getBr = () => browser.contentDocument.querySelector(listener.selector); if ((br = getBr())) br.window = {parent: listener.parent}; addDestructor(() => { if ((br = getBr())) delete br.window; }); }})(SidebarUI.browser, { selector: "browser#web-panels-browser", handleEvent(e) { if (e.target.matches(this.selector)) { var wp = e.target; if (!wp.hasAttribute("disableglobalhistory")) wp.setAttribute("disableglobalhistory", "false"); if (wp.hasAttribute("contextfixed")) return; [ ["#context-back", "wp.goBack();"], ["#context-forward", "wp.goForward();"], ["#context-reload", "wp.reload();"], ["#context-stop", "wp.stop();"] ].forEach(m=> { var mItem = SidebarUI.browser.contentDocument.querySelector(m[0]); mItem.onclick =()=> eval(m[1]); SidebarUI.browser.contentDocument.querySelector("#context-reload") .style.setProperty('display', '-moz-box', 'important'); }); wp.setAttribute('contextfixed', 'true'); } if (e.target.matches(this.selector) && !("window" in e.target)) e.target.window = {parent: this.parent}; }, get parent() { delete this.parent; var parent = {}; parent.contentAreaClick = eval(`(${ contentAreaClick.toString().replace( 'linkNode.getAttribute("onclick")', "!target && this.shouldLoadInPanelBrowser(linkNode) || $&" ) })`); parent.shouldLoadInPanelBrowser = link => { if (!(link.ownerDocument.location.protocol == "file:" && link.className == 'file')) return true; } return this.parent = parent; } });
Отредактировано Stkvsky (20-06-2019 18:16:49)
Отсутствует
В 67 не определяет ID места
А так?
((popup, {lastChild} = popup, pref = "CB.bookmark") => addDestructor(reason => reason == "delete" && Services.prefs.clearUserPref(pref)) + addEventListener("popupshowing", { index: 0, // 0 - первой, PlacesUtils.bookmarks.DEFAULT_INDEX - последней width: 500, height: 640, nodePosition: .35, handleEvent(e) { if (e.target != popup || this.shouldHide()) return; var menuitem = document.createElementNS(xulns, "menuitem"); menuitem.id = "context-addBookmark"; menuitem.className = "menuitem-iconic"; menuitem.setAttribute("image", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAB0UlEQVR42p2SS0gbURiFz73TcSUUXYi4EGLATRDSLnzgpqC4rLgXcVFo6TJY0AayURCtLtqK2G5sEd2LguIDF4W0mzaIbTVCxQcJihPzUJJ53/4ZJThNrOI/c5j7z9zz3TNzh9X7Wp/29L6YR4mafD/cET/8vYr/FBt6MyOCfd1FDzRDYOztbEnT+Eh/Q1KJ/XQBjmIKJM7BJU5XBkmSUFlRXhLQPzhzMBJ61gToJwVAQklAzpsLYhCQ0BSI3xh/d+F5pwvQHkoVTfoYqAWTZJxdCKfnjCGdUW0lJVJTi/HKAuDRyz/4/NqDrCZgWoBFornYPOTYjgloJvWCo+wBsBM9NTa+qd/9Pr3ZBfgU9GD1l42sCuQ05ig/zq/NBHMkcyC6c2qshXMRv99odAE+vPJgectGjkyqzmknAIOSgIwcFIdSyNRGtxVj7Us24m/5BzARqMPCDwuqxqGS2bwyOweZQfdkirO7dwNgfdSL47SgyOwytxMdl+O8bDotG+l0TuzHRWZs6eShCxCZ9OL2MiAsE8kLCW0DR3ABvr7zIpmhv5A+uW6QdJN2g95DCCeBZYur3kbivAwDcwmwquq6lpqulfAdli6qzeknj9l9jNfrL3fWCMvzB8ayAAAAAElFTkSuQmCC"); menuitem.setAttribute("oncommand", "linkedObject.oncommand(event);"); menuitem.linkedObject = this; menuitem.onauxclick = e => { if (e.button == 1) return; e.preventDefault(); popup.hidePopup(); this.pick(); } lastChild.after(menuitem); addDestructor(() => menuitem.remove()); (this.handleEvent = e => e.target == popup && !(menuitem.hidden = this.shouldHide()) && this.update(menuitem) )(e); }, ons: ["isContentSelected", "onTextInput", "onImage", "onVideo", "onCanvas", "onAudio"], shouldHide() { if (gContextMenu.onLink) return false; return this.ons.some(on => gContextMenu[on]); }, oncommand(e) { this[e.ctrlKey || e.shiftKey ? "pick" : "bookmark"](e.target); }, get guid() { return Services.prefs.getStringPref(pref, PlacesUtils.bookmarks.toolbarGuid); }, async update(menuitem) { var info = await PlacesUtils.bookmarks.fetch(this.guid); var title = PlacesUtils.bookmarks.getLocalizedTitle(info); menuitem.label = "Добавить закладку в: " + ( menuitem.folderName = title || "[без заголовка]" ); }, pick() { var features = "chrome,all,resizable,centerscreen,modal"; window.openDialog(this.url, "_blank", features, this.guid); }, bookmark({folderName}) { if (gContextMenu.onLink) { var url = gContextMenu.linkURL; var title = gContextMenu.linkText(); } else { var url = gBrowser.currentURI.spec; var title = gBrowser.contentTitle || gBrowser.selectedTab.label; } var info = {url, title, parentGuid: this.guid, index: this.index}; PlacesUtils.bookmarks.insert(info).then( () => this.notify(title, "Добавил закладку в папку: " + folderName), err => this.notify("Ошибка", err) ); }, get as() { delete this.as; return this.as = Cc["@mozilla.org/alerts-service;1"] .getService(Ci.nsIAlertsService); }, notify(title, msg) { this.as.showAlertNotification("chrome://global/skin/icons/cpd_OK.png", title, msg); setTimeout(this.as.closeAlert, 1800); }, get url() { var xul = `<?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="chrome://browser/content/places/places.css"?> <?xml-stylesheet href="chrome://browser/skin/places/places.css"?> <?xml-stylesheet href="chrome://browser/skin/places/tree-icons.css"?> <dialog xmlns="${xulns}" id="bookmark-folder-saver-dialog" windowtype="bookmark-folder-saver:dialog" title="Выберите папку" buttons="accept,cancel" onload="init();" width="${this.width}" height="${this.height}"> <script type="application/javascript" src="chrome://global/content/globalOverlay.js"/> <script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/> <script type="application/javascript"><![CDATA[ ChromeUtils.defineModuleGetter(window, "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm"); ChromeUtils.defineModuleGetter(window, "PlacesUIUtils", "resource:///modules/PlacesUIUtils.jsm"); ChromeUtils.defineModuleGetter(window, "PlacesTransactions", "resource://gre/modules/PlacesTransactions.jsm"); ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); XPCOMUtils.defineLazyScriptGetter(window, "PlacesTreeView", "chrome://browser/content/places/treeView.js"); XPCOMUtils.defineLazyScriptGetter( window, ["PlacesInsertionPoint", "PlacesController", "PlacesControllerDragHelper"],\n\ "chrome://browser/content/places/controller.js"\n\ ); ]]></script> <script type="application/javascript" src="chrome://browser/content/places/places-tree.js"/> <tree id="tree" type="places" is="places-tree" place="place:type=${ Ci.nsINavHistoryQueryOptions.RESULTS_AS_ROOTS_QUERY }&excludeItems=1&excludeQueries=1" hidecolumnpicker="true" seltype="single" flex="1"> <treecols> <treecol id="title" flex="1" primary="true" hideheader="true" /> </treecols> <treechildren /> </tree> <script type="application/javascript"><![CDATA[ var tree = document.getElementById("tree"); function init() { tree.selectItems([window.arguments[0]]); var ind = tree.view.selection.currentIndex; ind != -1 && setTimeout(() => { if ("nsITreeBoxObject" in Ci) { var tbo = tree.treeBoxObject; var visibleRows = tbo.height/tbo.rowHeight; } else { var tbo = tree; var visibleRows = tbo.getPageLength(); } var cur = tbo.view.selection.currentIndex; var first = tbo.getFirstVisibleRow(); var newFirst = cur - ${this.nodePosition}*visibleRows + 1; tbo.scrollByLines(Math.round(newFirst - first)); }, 0); var onKeydown = e => e.ctrlKey && e.key == "Enter" && !e.shiftKey && document.documentElement.acceptDialog(e.stopPropagation()); addEventListener("keydown", onKeydown, true); addEventListener("dialogaccept", dialogCallback); window.onunload = () => { removeEventListener("keydown", onKeydown, true); removeEventListener("dialogaccept", dialogCallback); } } function dialogCallback() { var ind = tree.view.selection.currentIndex; if (ind == -1) return; var item = tree.view.nodeForTreeIndex(ind); item && Services.prefs.setStringPref( "${pref}", PlacesUtils.getConcreteItemGuid(item) ); } ]]></script> </dialog>`; var url = URL.createObjectURL(new Blob( [xul], {type: "application/vnd.mozilla.xul+xml"} )); addDestructor(() => URL.revokeObjectURL(url)); delete this.url; return this.url = url; } }, false, popup || 1))(document.getElementById("contentAreaContextMenu"));
Отсутствует