Страницы: 1
Click to Play per-element 2014-01-15
Совместимость: Firefox 24+
Автор: 2k1dmg
Описание: Восстанавливает возможность воспроизводить плагины поэлементно.
Если нужно активировать плагин на этой странице, а не на домене (как в Firefox 23 кнопка "Включить")
то в about:config "plugin.sessionPermissionNow.intervalInMinutes" установить равным 0
и кликать по кнопке "Временно разрешить"
Инициализация:
// CTPpe 2014-01-15 'use strict'; let _prefs = { 'styles.enabled': true, 'styles.useOldCSS': false, 'styles.useOldCSSoutlineColorOnHover': '', 'styles.useOldCSSoutlineWidth': 1, 'styles.customHoverBackgroundColor': '', 'styles.customHoverTextColor': '', 'styles.hidePluginNotifications': false, 'showPluginUIEvenIfItsTooBig': false, // default 'defaultBackgroundColor': 'rgb(142,142,142)', // rgb(142,142,142) 'defaultTextColor': 'rgb(0,0,0)', // rgb(0,0,0) }; let CTPpe = { init: function() { gBrowser.addEventListener('PluginBindingAttached', this, true, true); window.addEventListener('unload', this, false); if (_prefs['styles.enabled']) this.loadStyles(); }, uninit: function(reason) { gBrowser.removeEventListener('PluginBindingAttached', this, true, true); window.removeEventListener('unload', this, false); if (reason == 'destructor' || reason == 'unload') return; this.unloadStyles(); }, handleEvent: function(event) { switch (event.type) { case 'PluginBindingAttached': this.pluginBindingAttached(event); break; case 'unload': this.uninit('unload'); break; } }, _stylesLoaded: false, loadStyles: function() { if (this._stylesLoaded) return; this._stylesLoaded = true; let sss = this.sss; let cssURI = this.cssURI = this.makeCSSURI(); if (!sss.sheetRegistered(cssURI, sss.USER_SHEET)) sss.loadAndRegisterSheet(cssURI, sss.USER_SHEET); }, unloadStyles: function() { if (!this._stylesLoaded) return; this._stylesLoaded = false; let sss = this.sss; if (sss.sheetRegistered(this.cssURI, sss.USER_SHEET)) sss.unregisterSheet(this.cssURI, sss.USER_SHEET); }, reloadStyles: function() { this.unloadStyles(); this.loadStyles(); }, get sss() { delete this.sss; return this.sss = Components.classes['@mozilla.org/content/style-sheet-service;1'] .getService(Components.interfaces.nsIStyleSheetService); },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wYWNpdHk6LjUiIG9mZnNldD0iMSIgLz4KICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICA8bGluZWFyR3JhZGllbnQKICAgICAgIHgxPSIzMiIKICAgICAgIHkxPSIxNiIKICAgICAgIHgyPSIzMiIKICAgICAgIHkyPSI0OCIKICAgICAgIGlkPSJhcnJvd0dyYWRpZW50IgogICAgICAgeGxpbms6aHJlZj0iI2Fycm93R3JhZGllbnRTdG9wcyIKICAgICAgIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiAvPgogICAgPGZpbHRlcgogICAgICAgeD0iLTAuMTUiCiAgICAgICB5PSItMC4xNSIKICAgICAgIHdpZHRoPSIxLjI1IgogICAgICAgaGVpZ2h0PSIxLjI1IgogICAgICAgY29sb3ItaW50ZXJwb2xhdGlvbi1maWx0ZXJzPSJzUkdCIgogICAgICAgaWQ9ImRyb3BTaGFkb3ciPgogICAgICA8ZmVHYXVzc2lhbkJsdXIKICAgICAgICAgcmVzdWx0PSJibHVyIgogICAgICAgICBzdGREZXZpYXRpb249IjIiCiAgICAgICAgIGluPSJTb3VyY2VBbHBoYSIKICAgICAgICAgaWQ9ImRyb3BTaGFkb3dCbHVyIiAvPgogICAgICA8ZmVDb2xvck1hdHJpeAogICAgICAgICB2YWx1ZXM9IjEgMCAwIDAgIDAKICAgICAgICAgICAgICAgICAwIDEgMCAwICAwCiAgICAgICAgICAgICAgICAgMCAwIDEgMCAgMAogICAgICAgICAgICAgICAgIDAgMCAwIC41IDAiCiAgICAgICAgIHR5cGU9Im1hdHJpeCIKICAgICAgICAgcmVzdWx0PSJibHVyYWxwaGEiCiAgICAgICAgIGlkPSJkcm9wU2hhZG93Q29sb3IiIC8+CiAgICAgIDxmZU9mZnNldAogICAgICAgICByZXN1bHQ9Im9mZnNldEJsdXIiCiAgICAgICAgIGR5PSIxIgogICAgICAgICBkeD0iMCIKICAgICAgICAgaW49ImJsdXJhbHBoYSIKICAgICAgICAgaWQ9ImRyb3BTaGF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LDMxLjU0Niw0OC4yMzgsMzIuNDU4LDQ3LjI4NSwzMy4wMTR6IgogICAgIGlkPSJwbGF5QnV0dG9uRWRnZUhpZ2hsaWdodHMiCiAgICAgc3R5bGU9ImZpbGw6d2hpdGU7ZmlsbC1vcGFjaXR5Oi4zO3N0cm9rZTpub25lIiAvPgogIDxwYXRoCiAgICAgZD0iTTMyLDRDMTYuNTM2LDQsNCwxNi41MzYsNCwzMmMwLDAuMTY3LDAuMDEsMC4zMzMsMC4wMTMsMC41IEM0LjI4LDE3LjI2OCwxNi43MDQsNSwzMiw1YzE1LjI5NiwwLDI3LjcyLDEyLjI2OCwyNy45ODcsMjcuNUM1OS45OSwzMi4zMzMsNjAsMzIuMTY3LDYwLDMyQzYwLDE2LjUzNiw0Ny40NjQsNCwzMiw0eiBNNDcuMjg1LDMzLjAxNEwyMy43NSw0Ni43NjJDMjIuNzk3LDQ3LjMxOSwyMiw0Ni44NjMsMjIsNDUuNzUxdjFjMCwxLjExMiwwLjc5NywxLjU2OCwxLjc1LDEuMDExbDIzLjUzNS0xMy43NDggYzAuNjk3LTAuNDA2LDAuODc5LTEuMDAzLDAuNTU2LTEuNTEyQzQ3LjcyMywzMi42ODgsNDcuNTQxLDMyLjg2NCw0Ny4yODUsMzMuMDE0eiIKICAgICBpZD0icGxheUJ1dHRvblRvcEVkZ2VIaWdobGlnaHRzIgogICAgIHN0eWxlPSJmaWxsOndoaXRlO2ZpbGwtb3BhY2l0eTouODtzdHJva2U6bm9uZSIgLz4KPC9zdmc+Cg=='; let outlineColorOnHover = _prefs['styles.useOldCSSoutlineColorOnHover']; if (outlineColorOnHover === '') { outlineColorOnHover = 'hsla(0,0%,50%,0.5)'; } let outlineWidth = _prefs['styles.useOldCSSoutlineWidth']; if (typeof outlineWidth != 'number' || outlineWidth <= 1 || outlineWidth > 4 ) { outlineWidth = 1; } cssStr = '@namespace url(http://www.w3.org/1999/xhtml);\n' + '@namespace xul url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);\n' + ':-moz-handler-clicktoplay .icon {\n' + ' opacity: 0.7;\n' + ' background-image: url(' + clicktoplay_bgtexturePNG + '),\n' + ' url(' + videoClickToPlayButtonSVG + ') !important;\n' + '}\n' + ':-moz-handler-clicktoplay .hoverBox:hover .icon {\n' + ' opacity: 1 !important;\n' + '}\n' + ':-moz-handler-clicktoplay .mainBox {\n' + ' background-color: hsla(0,0%,100%,.2) !important;\n' + ' color: hsl(0,0%,35%) !important;\n' + ' outline: ' + outlineWidth + 'px dashed hsla(0,0%,50%,0.5) !important;\n' + ' outline-offset: -' + outlineWidth + 'px !important;\n' + '}\n' + ':-moz-handler-clicktoplay .mainBox:hover {\n' + ' background-color: hsla(0,0%,90%,.7) !important;\n' + ' outline-color: ' + outlineColorOnHover + ' !important;\n' + '}\n' + ':-moz-handler-clicktoplay .hoverBox:hover {\n' + ' color: hsl(0,0%,20%) !important;\n' + '}\n'; } else { let setBgColor = _prefs['styles.customHoverBackgroundColor']; let setTColor= _prefs['styles.customHoverTextColor']; if (!setBgColor || setBgColor == '') setBgColor = _prefs['defaultBackgroundColor']; if (!setTColor || setTColor == '') setTColor = _prefs['defaultTextColor']; cssStr = '\@namespace url(http://www.w3.org/1999/xhtml);\n' + '@namespace xul url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);\n' + ':-moz-handler-clicktoplay .mainBox:hover {\n' + ' background-color: ' + setBgColor + ' !important;\n' + '}\n' + ':-moz-handler-clicktoplay .hoverBox:hover {\n' + ' color: ' + setTColor + ' !important;\n' + '}\n'; } let hidePluginNotifications = _prefs['styles.hidePluginNotifications']; if (hidePluginNotifications) { cssStr += '\n' + 'xul|notification[value="plugin-hidden"] {\n'+ ' display: none !important;\n' + '}\n'; } return Services.io.newURI('data:text/css,' + encodeURIComponent(cssStr), null, null); }, // fallback getPluginUI: function(plugin, doc) { return doc.getAnonymousElementByAttribute(plugin, 'class', 'mainBox') || doc.getAnonymousElementByAttribute(plugin, 'anonid', 'main'); }, pluginBindingAttached: function(event) { window.setTimeout(function() { this.pluginAttached(event); }.bind(this), 50); }, pluginAttached: function(event) { let eventType = event.type; if (eventType == 'PluginRemoved') { return; } let plugin = event.target; let doc = plugin.ownerDocument; if (!(plugin instanceof Ci.nsIObjectLoadingContent)) return; if (eventType == 'PluginBindingAttached') { // The plugin binding fires this event when it is created. // As an untrusted event, ensure that this object actually has a binding // and make sure we don't handle it twice let overlay = gPluginHandler.getPluginUI(plugin, 'main') || this.getPluginUI(plugin, doc); if (!overlay) { return; } // Lookup the handler for this binding eventType = gPluginHandler._getBindingType(plugin); if (!eventType) { // Not all bindings have handlers return; } } if (eventType == 'PluginClickToPlay') this._handleClickToPlayEvent(plugin); }, _handleClickToPlayEvent: function PH_handleClickToPlayEvent(aPlugin) { let doc = aPlugin.ownerDocument; let browser = gBrowser.getBrowserForDocument(doc.defaultView.top.document); let objLoadingContent = aPlugin.QueryInterface(Ci.nsIObjectLoadingContent); // guard against giving pluginHost.getPermissionStringForType a type // not associated with any known plugin if (!gPluginHandler.isKnownPlugin(objLoadingContent)) return; let overlay = gPluginHandler.getPluginUI(aPlugin, 'main') || this.getPluginUI(aPlugin, doc); if (overlay) { overlay.addEventListener('click', CTPpe._overlayClickListener, true); overlay.removeEventListener('click', gPluginHandler._overlayClickListener, true); if (_prefs['showPluginUIEvenIfItsTooBig']) { window.setTimeout(function() { try { if (gPluginHandler.isTooSmall && overlay && gPluginHandler.isTooSmall(aPlugin, overlay)) overlay.style.visibility = 'visible'; } catch (ex) { console.error('CTPpe' + ex); } }.bind(this), 100); } } }, _overlayClickListener: { handleEvent: function PH_handleOverlayClick(aEvent) { let plugin = document.getBindingParent(aEvent.target); let contentWindow = plugin.ownerDocument.defaultView.top; // gBrowser.getBrowserForDocument does not exist in the case where we // drag-and-dropped a tab from a window containing only that tab. In // that case, the window gets destroyed. let browser = gBrowser.getBrowserForDocument ? gBrowser.getBrowserForDocument(contentWindow.document) : null; // If browser is null here, we've been drag-and-dropped from another // window, and this is the wrong click handler. if (!browser) { aEvent.target.removeEventListener('click', CTPpe._overlayClickListener, true); return; } let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent); // Have to check that the target is not the link to update the plugin if (!(aEvent.originalTarget instanceof HTMLAnchorElement) && (aEvent.originalTarget.getAttribute('anonid') != 'closeIcon') && aEvent.button == 0 && aEvent.isTrusted) { if (gPluginHandler.canActivatePlugin(objLoadingContent) && objLoadingContent.pluginFallbackType != Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE && objLoadingContent.pluginFallbackType != Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE) { objLoadingContent.playPlugin(); } else { gPluginHandler._showClickToPlayNotification(browser, plugin); } aEvent.stopPropagation(); aEvent.preventDefault(); } } } }; this.onDestroy = function(reason) { CTPpe.uninit(reason); }; CTPpe.init();
Отредактировано 2k1dmg (15-01-2014 10:23:13)
Отсутствует
Тестовая версия
// Click to Play per-element 0.0.3b1.20131003 let LOG_PREFIX = "cbjs_c2ppe"; let console = (Cu.import("resource://gre/modules/devtools/Console.jsm", {})).console; let _prefs = { "styles.enabled": true, // true // добавить стиль CSS "styles.customHoverBackgroundColor": "", // "" // цвет фона оболочки плагина при наведении курсора "styles.customHoverTextColor": "", // "" // цвет текста оболочки плагина при наведении курсора "showPluginUIEvenIfItsTooBig": false, // false // показывать оболочку плагина даже если она слишком большая "defaultBackgroundColor": "rgb(142,142,142)", // rgb(142,142,142)" "defaultTextColor": "rgb(0,0,0)", // "rgb(0,0,0)" // цвета по умолчанию если не заданы выше "timeout.add_to_handleClickToPlayEvent": true, // true "timeout.add_to_showPluginUIEvenIfItsTooBig": true, // true "timeout.handleClickToPlayEvent": 100, // 100 "timeout.showPluginUIEvenIfItsTooBig": 100, // 100 // таймауты "play.PLUGIN_VULNERABLE_UPDATABLE": false, // false "play.PLUGIN_VULNERABLE_NO_UPDATE": false // false // включать уязвимые плагины }; let cbjs_c2ppe = { init: function() { this.toggleEventListener("add"); if (_prefs["styles.enabled"]) this.loadStyles(); }, uninit: function() { this.toggleEventListener("remove"); this.unloadStyles(); }, toggleEventListener: function(tReason) { let tListener = (tReason == "add") ? "addEventListener" : "removeEventListener"; window[tListener]("unload", this, false); gBrowser[tListener]("PluginBindingAttached", this, true, true); }, handleEvent: function(e) { switch(e.type) { case "PluginBindingAttached": this.pluginBindingAttached(e); break; case "unload": this.uninit(); break; } }, _stylesLoaded: false, loadStyles: function() { if(this._stylesLoaded) return; this._stylesLoaded = true; let sss = this.sss; var cssURI = this.cssURI = this.makeCSSURI(); if(!sss.sheetRegistered(cssURI, sss.USER_SHEET)) sss.loadAndRegisterSheet(cssURI, sss.USER_SHEET); }, unloadStyles: function() { if(!this._stylesLoaded) return; this._stylesLoaded = false; let sss = this.sss; if(sss.sheetRegistered(this.cssURI, sss.USER_SHEET)) sss.unregisterSheet(this.cssURI, sss.USER_SHEET); }, reloadStyles: function() { this.unloadStyles(); this.loadStyles(); }, get sss() { delete this.sss; return this.sss = Components.classes["@mozilla.org/content/style-sheet-service;1"] .getService(Components.interfaces.nsIStyleSheetService); }, makeCSSURI: function() { let setBgColor = _prefs["styles.customHoverBackgroundColor"]; let setTColor= _prefs["styles.customHoverTextColor"]; if (!setBgColor || setBgColor == "") setBgColor = _prefs["defaultBackgroundColor"]; if (!setTColor || setTColor == "") setTColor = _prefs["defaultTextColor"]; let vulUpd = _prefs["play.PLUGIN_VULNERABLE_UPDATABLE"]; let vulNoUpd = _prefs["play.PLUGIN_VULNERABLE_NO_UPDATE"]; let cssStr ='\ @namespace url(http://www.w3.org/1999/xhtml);\n\ :-moz-handler-clicktoplay .mainBox:hover'; if (vulUpd) cssStr += ',\n\ :-moz-handler-vulnerable-updatable .mainBox:hover'; if (vulNoUpd) cssStr += ',\n\ :-moz-handler-vulnerable-no-update .mainBox:hover'; cssStr += ' {\n\ background-color: ' + setBgColor + ' !important;\n\ }\n\ :-moz-handler-clicktoplay .hoverBox:hover'; if (vulUpd) cssStr += ',\n\ :-moz-handler-vulnerable-updatable .hoverBox:hover'; if (vulNoUpd) cssStr += ',\n\ :-moz-handler-vulnerable-no-update .hoverBox:hover'; cssStr += ' {\n\ color: ' + setTColor + ' !important;\n\ }\n\ '; return Services.io.newURI("data:text/css," + encodeURIComponent(cssStr), null, null); }, pluginBindingAttached: function(event) { let plugin; let doc; try { plugin = event.target; doc = plugin.ownerDocument; let _this = this; if (_prefs["timeout.add_to_handleClickToPlayEvent"]) { let timeout = _prefs["timeout.handleClickToPlayEvent"] || 100; window.setTimeout(function() { _this._handleClickToPlayEvent.call(_this, plugin, doc); }, timeout); } else this._handleClickToPlayEvent(plugin, doc); } catch (ex) { console.error(LOG_PREFIX + ex); } }, _handleClickToPlayEvent: function PH_handleClickToPlayEvent(plugin, doc) { let overlay; let eventType; try { overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main") || doc.getAnonymousElementByAttribute(plugin, "class", "mainBox"); if (!overlay && !(plugin instanceof Ci.nsIObjectLoadingContent)) { console.error(LOG_PREFIX + "_handleClickToPlayEvent(): overlay", overlay); return; } eventType = gPluginHandler._getBindingType(plugin); } catch (ex) { console.error(LOG_PREFIX + ex); return; } switch (eventType) { case "PluginVulnerableUpdatable": case "PluginVulnerableNoUpdate": case "PluginClickToPlay": plugin.addEventListener("click", cbjs_c2ppe._overlayClickListener, true); if (_prefs["showPluginUIEvenIfItsTooBig"]) { this.showPluginUIEvenIfItsTooBig(plugin, overlay); } break; } }, showPluginUIEvenIfItsTooBig: function(plugin, overlay) { if (_prefs["timeout.add_to_showPluginUIEvenIfItsTooBig"]) { let timeout = _prefs["timeout.showPluginUIEvenIfItsTooBig"] || 100; window.setTimeout(function() { try { if (gPluginHandler.isTooSmall && overlay && gPluginHandler.isTooSmall(plugin, overlay)) overlay.style.visibility = "visible"; } catch (ex) { console.error(LOG_PREFIX + ex); } }, timeout); } else { try { if (gPluginHandler.isTooSmall && overlay && gPluginHandler.isTooSmall(plugin, overlay)) overlay.style.visibility = "visible"; } catch (ex) { console.error(LOG_PREFIX + ex); } } }, _overlayClickListener: { handleEvent: function PH_handleOverlayClick(aEvent) { aEvent.target.removeEventListener("click", cbjs_c2ppe._overlayClickListener, true); let plugin = document.getBindingParent(aEvent.originalTarget); let contentWindow = plugin.ownerDocument.defaultView.top; // gBrowser.getBrowserForDocument does not exist in the case where we // drag-and-dropped a tab from a window containing only that tab. In // that case, the window gets destroyed. let browser = gBrowser.getBrowserForDocument ? gBrowser.getBrowserForDocument(contentWindow.document) : null; // If browser is null here, we've been drag-and-dropped from another // window, and this is the wrong click handler. if (!browser) { return; } let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent); // Have to check that the target is not the link to update the plugin if (!(aEvent.originalTarget instanceof HTMLAnchorElement) && (aEvent.originalTarget.getAttribute('anonid') != 'closeIcon') && aEvent.button == 0 && aEvent.isTrusted) { // If this isn't a vulnerable plugin, try to activate // just this element without changing any other state. if (!gPluginHandler.canActivatePlugin(objLoadingContent)) return; if (objLoadingContent.pluginFallbackType == Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE && !_prefs["play.PLUGIN_VULNERABLE_UPDATABLE"] || objLoadingContent.pluginFallbackType == Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE && !_prefs["play.PLUGIN_VULNERABLE_NO_UPDATE"]) return; objLoadingContent.playPlugin(); aEvent.stopPropagation(); aEvent.preventDefault(); } } } }; if (gPluginHandler && gPluginHandler._overlayClickListener && gPluginHandler._overlayClickListener.handleEvent && gPluginHandler.canActivatePlugin && gPluginHandler._getBindingType && !gPluginHandler.activateSinglePlugin && !gPluginHandler._pluginNeedsActivationExceptThese) { cbjs_c2ppe.init(); } this.onDestroy = function(reason) { if(reason != "destructor") { let sss = this.sss; let cssURI = this.cssURI; if(sss.sheetRegistered(cssURI, sss.USER_SHEET)) sss.unregisterSheet(cssURI, sss.USER_SHEET); } cbjs_c2ppe.uninit(); };
// CTPpe 2013-12-29 "use strict"; let _prefs = { "styles.enabled": true, "styles.useOldCSS": false, "styles.customHoverBackgroundColor": "", "styles.customHoverTextColor": "", "hidePluginNotifications": true, "timeout.add_to_handleClickToPlayEvent": false, "timeout.handleClickToPlayEvent": 100, // default "defaultBackgroundColor": "rgb(142,142,142)", // rgb(142,142,142) "defaultTextColor": "rgb(0,0,0)", // rgb(0,0,0) }; let CTPpe = { _stylesLoaded: false, loadStyles: function() { if (this._stylesLoaded) return; this._stylesLoaded = true; let sss = this.sss; let cssURI = this.cssURI = this.makeCSSURI(); if (!sss.sheetRegistered(cssURI, sss.USER_SHEET)) sss.loadAndRegisterSheet(cssURI, sss.USER_SHEET); }, unloadStyles: function() { if (!this._stylesLoaded) return; this._stylesLoaded = false; let sss = this.sss; if (sss.sheetRegistered(this.cssURI, sss.USER_SHEET)) sss.unregisterSheet(this.cssURI, sss.USER_SHEET); }, reloadStyles: function() { this.unloadStyles(); this.loadStyles(); }, get sss() { delete this.sss; return this.sss = Components.classes["@mozilla.org/content/style-sheet-service;1"] .getService(Components.interfaces.nsIStyleSheetService); }, makeCSSURI: function() { let cssStr; if (_prefs["styles.useOldCSS"]) { let clicktoplay_bgtexturePNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtb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44NjMsMjIsNDUuNzUxdjFjMCwxLjExMiwwLjc5NywxLjU2OCwxLjc1LDEuMDExbDIzLjUzNS0xMy43NDggYzAuNjk3LTAuNDA2LDAuODc5LTEuMDAzLDAuNTU2LTEuNTEyQzQ3LjcyMywzMi42ODgsNDcuNTQxLDMyLjg2NCw0Ny4yODUsMzMuMDE0eiIKICAgICBpZD0icGxheUJ1dHRvblRvcEVkZ2VIaWdobGlnaHRzIgogICAgIHN0eWxlPSJmaWxsOndoaXRlO2ZpbGwtb3BhY2l0eTouODtzdHJva2U6bm9uZSIgLz4KPC9zdmc+Cg=="; cssStr = '\ @namespace url(http://www.w3.org/1999/xhtml);\n\ @namespace xul url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);\n\ :-moz-handler-clicktoplay .icon {\n\ opacity: 0.7;\n\ background-image: url(' + clicktoplay_bgtexturePNG + '),\n\ url(' + videoClickToPlayButtonSVG + ') !important;\n\ }\n\ :-moz-handler-clicktoplay .hoverBox:hover .icon {\n\ opacity: 1 !important;\n\ }\n\ :-moz-handler-clicktoplay .mainBox {\n\ background-color: hsla(0,0%,100%,.2) !important;\n\ color: hsl(0,0%,35%) !important;\n\ outline: 1px dashed hsla(0,0%,50%,0.5) !important;\n\ outline-offset: -1px !important;\n\ }\n\ :-moz-handler-clicktoplay .mainBox:hover {\n\ background-color: hsla(0,0%,90%,.7) !important;\n\ }\n\ :-moz-handler-clicktoplay .hoverBox:hover {\n\ color: hsl(0,0%,20%) !important;\n\ }\n\ '; } else { let setBgColor = _prefs["styles.customHoverBackgroundColor"]; let setTColor= _prefs["styles.customHoverTextColor"]; if (!setBgColor || setBgColor == "") setBgColor = _prefs["defaultBackgroundColor"]; if (!setTColor || setTColor == "") setTColor = _prefs["defaultTextColor"]; cssStr = '\ @namespace url(http://www.w3.org/1999/xhtml);\n\ @namespace xul url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);\n\ :-moz-handler-clicktoplay .mainBox:hover'; cssStr += '\ {\n\ background-color: ' + setBgColor + ' !important;\n\ }\n\ :-moz-handler-clicktoplay .hoverBox:hover'; cssStr += '\ {\n\ color: ' + setTColor + ' !important;\n\ }\n\ '; } let hidePluginNotifications = _prefs["hidePluginNotifications"]; if (hidePluginNotifications) { let pluginHidden = '\ \n\ xul|notification[value="plugin-hidden"] {\n\ display: none !important;\n\ }\n\ '; cssStr += pluginHidden; } return Services.io.newURI("data:text/css," + encodeURIComponent(cssStr), null, null); }, handleEvent: function(event) { switch (event.type) { case "PluginBindingAttached": this.pluginBindingAttached(event); break; } }, // fallback getPluginUI: function(plugin, doc) { return doc.getAnonymousElementByAttribute(plugin, "class", "mainBox") || doc.getAnonymousElementByAttribute(plugin, "anonid", "main"); }, pluginBindingAttached: function(event) { let eventType = event.type; if (eventType == "PluginRemoved") { return; } let plugin = event.target; let doc = plugin.ownerDocument; if (!(plugin instanceof Ci.nsIObjectLoadingContent)) return; if (eventType == "PluginBindingAttached") { // The plugin binding fires this event when it is created. // As an untrusted event, ensure that this object actually has a binding // and make sure we don't handle it twice let overlay = gPluginHandler.getPluginUI(plugin, "main") || this.getPluginUI(plugin, doc); if (!overlay) { return; } // Lookup the handler for this binding eventType = gPluginHandler._getBindingType(plugin); if (!eventType) { // Not all bindings have handlers return; } } if (eventType == "PluginClickToPlay") this._handleClickToPlayEvent(plugin); }, _handleClickToPlayEvent: function PH_handleClickToPlayEvent(aPlugin) { let doc = aPlugin.ownerDocument; let browser = gBrowser.getBrowserForDocument(doc.defaultView.top.document); let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost); let objLoadingContent = aPlugin.QueryInterface(Ci.nsIObjectLoadingContent); // guard against giving pluginHost.getPermissionStringForType a type // not associated with any known plugin if (!gPluginHandler.isKnownPlugin(objLoadingContent)) return; /*let permissionString = pluginHost.getPermissionStringForType(objLoadingContent.actualType); let principal = doc.defaultView.top.document.nodePrincipal; let pluginPermission = Services.perms.testPermissionFromPrincipal(principal, permissionString); */ let overlay = gPluginHandler.getPluginUI(aPlugin, "main") || this.getPluginUI(plugin, doc); /* if (pluginPermission == Ci.nsIPermissionManager.DENY_ACTION) { if (overlay) { overlay.classList.remove("visible"); } return; }*/ if (overlay) { overlay.addEventListener("click", CTPpe._overlayClickListener, true); } }, _overlayClickListener: { handleEvent: function PH_handleOverlayClick(aEvent) { let plugin = document.getBindingParent(aEvent.target); let contentWindow = plugin.ownerDocument.defaultView.top; // gBrowser.getBrowserForDocument does not exist in the case where we // drag-and-dropped a tab from a window containing only that tab. In // that case, the window gets destroyed. let browser = gBrowser.getBrowserForDocument ? gBrowser.getBrowserForDocument(contentWindow.document) : null; // If browser is null here, we've been drag-and-dropped from another // window, and this is the wrong click handler. if (!browser) { aEvent.target.removeEventListener("click", CTPpe._overlayClickListener, true); return; } let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent); // Have to check that the target is not the link to update the plugin if (!(aEvent.originalTarget instanceof HTMLAnchorElement) && (aEvent.originalTarget.getAttribute('anonid') != 'closeIcon') && aEvent.button == 0 && aEvent.isTrusted) { if (!window.gPluginHandler.canActivatePlugin(objLoadingContent)) return; if (objLoadingContent.pluginFallbackType == Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE || objLoadingContent.pluginFallbackType == Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE) return; objLoadingContent.playPlugin(); aEvent.stopPropagation(); aEvent.preventDefault(); let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIDOMWindowUtils); let browser = gBrowser.getBrowserForDocument(contentWindow.document); let notification = PopupNotifications.getNotification("click-to-play-plugins", browser); if (notification) { notification.remove(); } } } } }; if (_prefs["styles.enabled"]) CTPpe.loadStyles(); gBrowser.addEventListener("PluginBindingAttached", CTPpe, true, true); addDestructor(function (reason) { gBrowser.removeEventListener("PluginBindingAttached", CTPpe, true, true); CTPpe.unloadStyles(); }, this);
Отредактировано 2k1dmg (29-12-2013 15:11:03)
Отсутствует
2k1dmg
Например здесь, первое видео не отображает значок и надпись Activate Adobe Flash. После обновления минуя кэш, появляется все.
Я конечно понимаю что это скорее всего из-за рутуба, но все же, можно что-то сделать?
я ставлю что в 25 её уже поломают .на крайняк в 26.
Проиграл, все три кода на этой странице которые, работают.
Отсутствует
не отображает значок и надпись Activate Adobe Flash
я уже давно пробовал исправить, но не смог.
это скорее всего из-за рутуба
и ещё из-за того, что так сделали разработчики gecko-dev / browser / base / content / browser-plugins.js
Отсутствует
Страницы: 1