FlashPlus: Technical details of a Chrome extension converted to a Bookmarklet

The previous post showed a video of how FlashPlus, a  Google chrome extension works for Firefox and Internet Explorer as a bookmarklet. This effectively merged the source code of the original bookmarklet called FlashResizer and the chrome extension. This post is about the differences between the two and how the chrome extension was converted into a bookmarklet.
The key to converting it to a bookmarklet was to move all the chrome extensions specific functions to a separate file. In this case, the chrome.* API calls were moved to PageActions.js. The real logic lies in FlashPlus and Commands. FlashPlus enumerates all the flash content on the page while Commands is responsible for defining actions that can be taken over individual flash elements.
Hence, the difference between the bookmarklet and the extension is the entry point. The Chrome extension uses PageActions.js to insert the script within the page. This is supported by the background page and the popup icon in the URL bar. On the other hand, Bookmarklet.js is a simpler entry point that simply enables the functionality for all available media content.
This leads to slightly different capabilities between the two.
  • The bookmarklet cannot work on Media content inside iFrames as the script is inserted only for the current frame.
  • Pop out functionality does not currently work as it requires additional javascript to be executed once the new window is created. 
  • Media content may restart after starting the bookmarklet as the wmode parameters have to be re-written. 
The most interesting part for this change was to make FlashPlus and Commands, cross browser compatible; something that you do not worry about, while writing the extension.
The bookmarklet now lives in a different branch and the releases are tagged as bookmarklet. Regular development would continue on the extension and changes to FlashPlus and Commands would be merged back to the bookmarklet branch.
You can watch out this and this space for updates on the bookmarklet and the extension respectively.

FlashPlus Bookmarklet - Internet Explorer and Silverlight

The code for FlashPlus for Chrome and the FlashResizer bookmarklet have been merged and the bookmarklet has almost all the functionality as the Google Chrome extension.
Here is a video demonstrating it.