(()=> { var menuitem = document.createElement("menuitem"); var contextMenu = document.getElementById("contentAreaContextMenu"); menuitem.id = "open-in-pot"; menuitem.setAttribute("label", "Отправить в PotPlayer"); menuitem.setAttribute("class", "menuitem-iconic"); menuitem.setAttribute("image", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDoAABSCAABFVgAADqXAAAXb9daH5AAAAE1SURBVHjalNG9S5tRGIbxX8TJVYP/REEdndzsWHB9JwXBvUOXKg4iOEhBKIhYUETXii7V1SEqCh6ymCUQP1DERRFFJT0d8jbE0jeJ93aeB67r5jm5GCPoWzeGT9jESkjUFi2SawBcozed72A8JM7fA4g55Lu4eQT3+Iwfzdq8AXzoZu0jGyUWTniutm7zBjCQZ2W4tqjcM1kg3DZvkwmA35G1U76HepvdtM1ZW4C/Kd8xtU+xoU1ILLcNgGpkqchiEUQMhcRe2wDYLvO1UH+OhMTPtgB3L8we8qtSOw3m8SUkYkvA3iXTB9w+gRJGQ6LQ8ogPr8wdsVWuW79hMiSeMr+xP8/qMIUrpve5fvy/NRPQ2UF/D8c3RKqpdepfaxbgBH3p/BRjWdYswCAmcIGZZtbG/BkAHtLE4ZXQlc8AAAAASUVORK5CYII="); document.getElementById("context-sep-open").parentNode.insertBefore( menuitem, document.getElementById("context-sep-open") ); //Когда отображать пункт в контекстном меню (на ссылках, на html5 видео/аудио) ---> addEventListener("popupshowing", ()=> menuitem.hidden = !(gContextMenu.onLink || gContextMenu.onVideo || gContextMenu.onAudio ), false, contextMenu ); addDestructor( ()=> contextMenu.removeChild(menuitem) ); addEventListener("command", function(e) { if ( e.button ) return; var link = gContextMenu.mediaURL || gContextMenu.getLinkURL(); var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile); var process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess); file.initWithPath("C:\\Program Files (x86)\\PotPlayer\\PotPlayerMini.exe"); //путь на свой правьте process.init(file); process.run(false, [link], 1); }, false, menuitem ); })(); |