diff --git a/README.md b/README.md index e965881..a8ae7fa 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,32 @@ NoPlugin is the missing compatibility layer for modern web browers, allowing you NoPlugin searches webpages for embedded plugin objects and converts them into native player elements, wherever possible. If the content can't be played in-browser (e.g. most Flash embeds), NoPlugin will help you download the file and play it in a separate application. -[![Download for Chrome](https://corbin.io/img/chrome-button.png)](https://chrome.google.com/webstore/detail/noplugin-previously-quick/llpahfhchhlfdigfpeimeagojnkgeice) [![Download for Firefox](https://corbin.io/img/firefox-button.png)](https://addons.mozilla.org/en-US/firefox/addon/noplugin/) \ No newline at end of file +[![Download for Chrome](https://corbin.io/img/chrome-button.png)](https://chrome.google.com/webstore/detail/noplugin-previously-quick/llpahfhchhlfdigfpeimeagojnkgeice) [![Download for Firefox](https://corbin.io/img/firefox-button.png)](https://addons.mozilla.org/en-US/firefox/addon/noplugin/) + +## Fully supported players + +These embedded players are converted into HTML5 automatically by NoPlugin. + +- [YouTube](https://youtube.com) Flash embeds +- [Twitch](https://twitch.tv) Flash embeds +- [Vimeo](https://vimeo.com) Flash embeds +- [Zanorg Player](https://radio.zanorg.com/zplayer_eng.htm) embeds +- [Viddler](viddler.com) Flash embeds + +## Partially supported players + +These embedded players sometimes contain files that can't play inside the browser. In cases where the file isn't supported by the browser, NoPlugin displays steps for opening the file in a separate application (like Windows Media Player, VLC, or Adobe Flash Projector). + +- QuickTime Player embeds +- Windows Media Player embeds +- RealPlayer embeds +- VLC Plugin embeds +- Media streams (`mms://`, `rtsp://`, `.ram`) +- Miscellaneous Flash embeds + +## Compatibility Mode + +NoPlugin has an optional Compatibility Mode, accessible by right-clicking on a page and clicking 'Toggle NoPlugin Compatibility Mode' (or by adding `?noplugin_compat=true` to a tab's URL). This changes some behaviors, listed below. + +- Modifies values for `navigator.plugins` and `navigator.mimeTypes` to trick some pages into thinking Flash player is availalable, to bypass some "Flash is not installed" errors +- Creates a shim API for [flashembed.js](https://github.com/jquerytools/jquerytools/blob/master/src/toolbox/toolbox.flashembed.js) \ No newline at end of file diff --git a/js/blocklist.js b/js/blocklist.js index d7343fc..316b382 100644 --- a/js/blocklist.js +++ b/js/blocklist.js @@ -11,7 +11,9 @@ var siteBlocks = [ // Examples: Tracking scripts, fallbacks for HTML5 players, etc. var embedBlocks = [ 'fp.swf', // Tracking (#66) + 'swfupload.swf', // Upload button that won't work outside the browser 'visitCounter105.swf', // Used for tracking + 'soundmanager2.swf', // Fallback for HTML5 player: http://www.schillmania.com/projects/soundmanager2/ 'VPAIDFlash.swf', // Broken DRM: https://docs.viblast.com/player/videojs-vast 'pmfso.swf', // Security risk: https://github.com/offensive-security/exploitdb/blob/master/exploits/java/webapps/44634.txt#L63 'ZeroClipboard.swf', // Security risk: https://www.acunetix.com/vulnerabilities/web/cross-site-scripting-vulnerability-in-zeroclipboard-swf/ diff --git a/js/noplugin-compat.js b/js/noplugin-compat.js index 25416aa..2a4c9b4 100644 --- a/js/noplugin-compat.js +++ b/js/noplugin-compat.js @@ -1,4 +1,4 @@ -alert('NoPlugin Compatibility Mode is now enabled for this page. Compatibility Mode tricks sites into thinking you have Adobe Flash Player and other plugins installed, allowing you to potentially view legacy plugin content. The mode may not work for all pages.\n\nCompatibility Mode will automatically turn off when you leave this page.') +alert('NoPlugin Compatibility Mode is enabled for this page. Compatibility Mode tricks sites into thinking you have Adobe Flash Player and other plugins installed, allowing you to potentially view legacy plugin content. The mode may not work for all pages.\n\nCompatibility Mode will automatically turn off when you leave this page.') if (!navigator.plugins.namedItem('Shockwave Flash')) { @@ -488,6 +488,57 @@ if (!navigator.plugins.namedItem('Shockwave Flash')) { } }) + // Wrapper for FlashEmbed library + // Original code: https://github.com/jquerytools/jquerytools/blob/master/src/toolbox/toolbox.flashembed.js + // Documentation: http://jquerytools.github.io/documentation/toolbox/flashembed.html + // Test page: http://jquerytools.org/demos/toolbox/flashembed/index.html?noplugin_compat=true + + Object.defineProperty(window, 'flashembed', { + // TODO: Implement asString(Object), getHTML(options, config), getVersion(), and isSupported(version) + value: function (container, embedOptions, flashConfiguration) { + console.log('Detected flashembed() call:', { container, embedOptions, flashConfiguration }) + // The "container" param represents the ID of an element in the page + container.replace('#', '') + if (document.getElementById(container)) { + container = document.getElementById(container) + // Create Flash object + var el = document.createElement('object') + el.setAttribute('type', 'application/x-shockwave-flash') + // Set embed options + if (typeof embedOptions === 'string') { + // embedOptions parameter is just a string of the media URL + el.setAttribute('data', embedOptions) + } else if (typeof embedOptions === 'object') { + // embedOptions parameter is an object + el.setAttribute('data', embedOptions.src) + el.setAttribute('id', embedOptions.id) + el.setAttribute('width', embedOptions.width) + el.setAttribute('height', embedOptions.height) + el.style.backgroundColor = embedOptions.bgcolor + } else { + console.error('Could not parse embedOptions') + } + // Set Flash configuration + // This doesn't work for configurations with nested JSON + if (typeof flashConfiguration === 'object') { + var data = '' + for (var key in flashConfiguration) { + data += encodeURIComponent(key) + '=' + encodeURIComponent(flashConfiguration[key]) + '&' + } + data = data.slice(0, -1) + el.setAttribute('flashvars', data) + } + // Inject object + container.appendChild(el) + } else { + console.error('Could not find element with ID ' + container) + } + }, + configurable: false, + enumerable: true, + writable: false + }) + } + ')()' var s = document.createElement('script')