[Pkg-mozext-commits] [video-without-flash] 01/01: Imported Upstream version 3.1.1
Dmitry Smirnov
onlyjob at moszumanska.debian.org
Wed Apr 15 09:02:00 UTC 2015
This is an automated email from the git hooks/post-receive script.
onlyjob pushed a commit to branch upstream
in repository video-without-flash.
commit eaf1cd5 (upstream)
Author: Dmitry Smirnov <onlyjob at member.fsf.org>
Date: Wed Apr 15 09:01:43 2015
Imported Upstream version 3.1.1
---
Makefile | 21 ++++
README.md | 171 ++++++++++++++++----------------
bootstrap.js | 87 ++++++++++-------
build/vwof.xpi | Bin 0 -> 31663 bytes
chrome.manifest | 2 +
chrome/#blip.js# | 85 ----------------
chrome/#list_modules.js# | 31 ------
chrome/#vwof.js# | 93 ------------------
chrome/blip.js | 85 ----------------
chrome/list_modules.js | 56 -----------
chrome/listener.js | 156 -----------------------------
chrome/modules/FC2.jsm | 70 -------------
chrome/modules/HTML5.jsm | 36 -------
chrome/modules/Makefile.in | 2 -
chrome/modules/SWM.jsm | 105 --------------------
chrome/modules/ScreenWaveMedia.jsm | 57 -----------
chrome/modules/blip.jsm | 118 ----------------------
chrome/modules/dailymotion.jsm | 62 ------------
chrome/modules/dew.jsm | 20 ----
chrome/modules/niconico.jsm | 53 ----------
chrome/modules/springboard.jsm | 25 -----
chrome/modules/twitch.jsm | 39 --------
chrome/modules/ustream.jsm | 48 ---------
chrome/modules/youtube.jsm | 112 ---------------------
chrome/player.js | 194 -------------------------------------
chrome/prefs.js | 47 ---------
chrome/prefs.xul | 79 ---------------
chrome/utils.js | 55 -----------
chrome/vwof.js | 89 -----------------
chrome/youtube_utils.js | 40 --------
configure | 154 +++++++++++++++++++++++++++++
content/list_modules.js | 4 -
content/listener.js | 88 ++++++++---------
content/options.xul | 59 +++++++++++
content/player.js | 20 ++--
content/prefs.xul | 79 ---------------
content/prefs_modules_list.xul | 16 +++
content/vwof.js | 4 +-
content/youtube_utils.js | 40 --------
defaults/preferences/vwof.js | 3 -
install.rdf | 30 ++++--
locale/en-US/listener.properties | 1 +
locale/en-US/options.dtd | 15 +++
locale/en-US/player.properties | 1 +
locale/en-US/strings.dtd | 1 -
locale/en-US/strings.properties | 3 -
locale/fr-FR/listener.properties | 1 +
locale/fr-FR/options.dtd | 15 +++
locale/fr-FR/player.properties | 1 +
locale/jp-JP/listener.properties | 1 +
locale/jp-JP/player.properties | 1 +
skin/player.css | 2 +-
52 files changed, 504 insertions(+), 2073 deletions(-)
diff --git a/Makefile b/Makefile
new file mode 100755
index 0000000..c56f357
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,21 @@
+PROJECT="vwof"
+PWD=`pwd`
+BUILD="build"
+NAME="${PROJECT}.xpi"
+XPI="${PWD}/${BUILD}/${NAME}"
+
+.PHONY: latest xpi clean
+
+latest:
+ @echo "Building latest '${XPI}'..."
+ @mkdir -p ${BUILD}
+ @zip -r ${XPI} * -x "${BUILD}/*" -x "configure" -x "Makefile" -x ".git/*"
+
+xpi:
+ @echo "Building '${XPI}'..."
+ @mkdir -p ${BUILD}
+ @git archive --format=zip -o ${XPI} HEAD
+
+clean:
+ @echo "Removing '${PWD}/${BUILD}'..."
+ @rm -rf ${BUILD}
diff --git a/README.md b/README.md
index 8e2f2dc..8fff11c 100755
--- a/README.md
+++ b/README.md
@@ -4,64 +4,72 @@ video-without-flash
Firefox extension for watching videos without the flash plugin
-<i>Fetch video source of flash based media and play the video directly with Firefox, without the use of the flash plug-in. </i>
+Fetch video source of flash based media and play the video directly with
+Firefox, without the use of the flash plug-in.
-<b> Supported sites/embed video player </b>
-<ul>
-<li>Youtube</li>
-<li>Blip</li>
-<li>ScreenWaveMedia</li>
-<li>Dew</li>
-<li>HTML5</li>
-<li>Springboard</li>
-<li>Dailymotion</li>
-<li>UStream </li>
-</ul>
+**Supported sites/embed video player**
+* Youtube (partial support)
+* Blip
+* ScreenWaveMedia
+* HTML5
+* Dailymotion
+* FC2
+* niconico
-Due to some minor variations of providing the video by a same media provider (different version of there player, use of the embed tag) a few videos may not be detected.
+Due to some minor variations of providing the video by a same media provider
+(different version of there player, use of the embed tag) a few videos may
+not be detected.
-<b> Usage </b>
-By default the video are detected when a page load, you can disable this behavior in the preference pane and manually try to detect video by pressing
- ALT-W or Right Click and "Watch video without flash".
+** Usage **
+By default the video are detected when a page load, you can disable this
+behavior in the preference pane and manually try to detect video by pressing
+ALT-w.
-<b>Why you may want to use this extension</b>
-<ul>
-<li>You experienced some lag or bad CPU performance using flash </li>
-<li>You only use flash to watch videos, and do not want to install a non-free packages on your linux station (this extension is released under the GPL)</li>
-</ul>
+**Why you may want to use this extension**
+* You experienced some lag or bad CPU performance using flash
+* You only use flash to watch videos, and do not want to install a non-free
+packages on your linux station (this extension is released under the GPL)
-<b> Pro tips </b>
-*To read MP4 videos you must install a media plugin like vlc-web-plugin or gecko-mplayer. Under Windows the vlc web plugin can be install when running the vlc install exe.
+**Pro tips**
+*To read MP4 videos you must install a media plugin
+like vlc-web-plugin or gecko-mplayer.
+Under Windows the vlc web plugin can be install when running the vlc
+install exe.
-* The video can be save with a "right click / save as" on the "open in a new tab" link.
+* The video can be save with a "right click / save as" on the
+"open in a new tab" link.
-* Numerous options in the preference pane : select preferred format / quality when available, disable modules.
+* Numerous options in the preference pane : select preferred
+format / quality when available, disable modules.
-<b> Known bugs </b>
-(unfortunately these are upstream bugs, nothing I can do about it)
+**Known bugs**
-* YouTube : The video area is not reloading when clicking on a suggested video link. After clicking on such a link, please use the ALT-w command to refresh the player area
+* YouTube : The video area is not reloading when clicking on a suggested video
+ link. After clicking on such a link, and no ALT-w command.
-* VLC plugin : The video crashes when a video is paused when played with the vlc web plugin.
+**How does it works**
+VWOF Fetchs the direct link to videos using regular expression, XPath, and DOM.
-<b> How does it works </b>
-This extension fetch the direct link to videos using regular expression, XPath, and DOM. When available, a picture and a select control are displayed to read the video with firefox, using the firefox internal HTML5 compliant media player or a plugin like vlc or mplayer if the user had installed it.
+A picture and a select control are displayed (the "video selector).
+Clicking the video selector will open the video link into a video tag.
-Each media provider is handled by a "parser". Javascript modules (.jsm) that are loaded at startup. The extension can fairly easy be extended due to it modular approache, as new media provider can be added by implementing a new jsm file.
-
-<b>Why a HTML5 parser ? </b>
-For licensing reasons firefox do not support at the moment the H264 codec, although it may change in the future. If a site uses HTML5 to display a video, but the video itself is encoded with H264 or a variant you normally wont be able to play it. By using the HTML5 parser, you can read the video if a media player plugin is installed as stated previously.
+Each media provider is handled by a "parser". Javascript modules (.jsm) that
+are loaded at startup.
+The extension can fairly easy be extended due to it modular approache, as new
+media provider can be added by implementing a new jsm file.
+**Why a HTML5 parser ?**
+For licensing reasons firefox did not support the H264 codec.
+By using the HTML5 parser, you can read the video if a media player plugin is
+installed as stated previously.
= Technical documentation for developers =
== How to write a new parser ==
-<i>Do not esitate to fork and add your own parser</i>
-
-* Step 1 : Add the name of your parser without the .jsm extension in the browser variable "extensions.vwof.modules" you can do it with about:config for test purposes or do it permanently in src/defaults/preferenes/vwof.js
-The boolean value (parsername:1) is eather if your parser is activated or not.
+Do not esitate to fork and add your own parser
+* Step 1 : Add the name of your parser without the .jsm ext in vwof.parser_name
* Step 2 : Create a jsm file in the modules directory
@@ -69,25 +77,33 @@ The parser must respect the following API :
```javascript
var parser = {
- BASE_URI: '',
- parse_embed: function(cw) {
- var video_info = [];
- return video_info;
- },
+ BASE_URI: 'example.com',
+ //called when the current page url domain name is this.BASE_URI
parse_site: function(cw) {
var video_info = [];
- var player = cw.document.getElementById('');
- if(!player)return;
+
+ ...
+
+ return video_info;
+ },
+
+ //called if other parser did not return video link with parse_site
+ //as it does not make sens to search embed video in a video site
+ parse_embed: function(cw) {
+ var video_info = [];
+
+ ...
return video_info;
}
+
};
```
=== video_info variable ===
-video player is an array of an hash
+video player is an array of hash
each video is an entry in the array and the hash contains video information
@@ -97,43 +113,26 @@ will be added in the player displaying the format and quality
```javascript
video_info =
[
-{
-'player':, //DOM where the video player will be embed, replacing all child nodes, if undefined, the video open in a new tab
-
-'video_img':, //string link to the picture displayed as a preview, if undefined the background is black
-
-'videos': [] //array of video informations, see below
-}
-];
-
-videos =
-[
-{
-'quality':, //quality of the video (low, medium, hd720, hd1080)
-
-'format':, //format of the video (webm, mp4, flv, ...)
-
-'url': //direct link to the video, this is the only mandatory variable
-}
+ {
+ //DOM where the video selector / video tag will be embed
+ 'player':,
+
+ //string link to the preview picture (or black background)
+ 'video_img':,
+
+ videos =
+ [
+ {
+ //quality of the video (low, medium, hd720, hd1080)
+ 'quality':,
+
+ //format of the video (webm, mp4, flv, ...)
+ 'format':,
+
+ //direct link to the video
+ 'url':
+ }
+ ];
+ }
];
-
-
-== How to build ==
-
-This plugin comes with a home made makefile based on mozilla school xul example.
-
-Targets are :
-
-* make
- Create an .xpi in the ../bin directory (manually create ../bin if necessary)
-
-* make install
- install the plugin in the profil directory. By default the profil name is "devel"
- you can change this behaviour by passing the profile_dir variable (example : make install profile_dir default)
-
-* you need to restart firefox to apply the changes, it can be done with the make target
- make rerun
-
- which will run the following command : killall firefox ; firefox -purgecaches -P &
-
-
+```
diff --git a/bootstrap.js b/bootstrap.js
index ce07dc4..5df7624 100755
--- a/bootstrap.js
+++ b/bootstrap.js
@@ -1,73 +1,92 @@
-const {interfaces: Ci, utils: Cu} = Components;
+const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
+
Cu.import('resource://gre/modules/Services.jsm');
Cu.import('resource://gre/modules/NetUtil.jsm');
const PREF_BRANCH = "extensions.vwof.";
-function listenPageLoad(event) {
- var cw = event.originalTarget.defaultView;
- if (cw.frameElement && windowListener.ignoreFrames) {
- return; //dont want to watch frames
- }
-
+function isAndroid() {
+ return Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime)
+ .widgetToolkit.toLowerCase() == "android";
+}
+
+function onPageLoad(event) {
+ var cw = event.originalTarget.defaultView;
var prefManager = Components.classes["@mozilla.org/preferences-service;1"].
- getService(Components.interfaces.nsIPrefBranch);
+ getService(Components.interfaces.nsIPrefBranch);
var activate_onload = prefManager.getBoolPref(PREF_BRANCH+"activate_onload");
if(activate_onload){vwof.detectVideo(cw);}
}
-function oncommand_detect_video(window){
- //window is browser.xul. Pass the contentWindow of the document
- vwof.detectVideo(window.gBrowser.contentDocument.defaultView);
-}
-
-function init(window){
+function init_keyboard_shortcut(window){
let doc = window.document;
keyset = doc.getElementById('mainKeyset');
//keyboard shortcut
let key = doc.createElement('key');
- key.setAttribute('id', 'vwof-key');
- key.addEventListener("command", function (){oncommand_detect_video(window);});
key.setAttribute("oncommand", "//");
key.setAttribute('key', 'w');
key.setAttribute('modifiers', 'alt');
+ key.setAttribute('id', 'vwof-key');
+ key.addEventListener("command", function (){
+ vwof.detectVideo(window.gBrowser.contentDocument.defaultView);
+ });
keyset.appendChild(key);
keyset.parentElement.appendChild(keyset);
}
-function startup(aData, aReason) {
+//////////////////
+
+function startup(data,reason) {
Services.scriptloader.loadSubScript("chrome://vwof/content/prefs.js")
Services.scriptloader.loadSubScript('chrome://vwof/content/vwof.js');
Services.scriptloader.loadSubScript('chrome://vwof/content/player.js');
Services.scriptloader.loadSubScript('chrome://vwof/content/utils.js');
- Services.scriptloader.loadSubScript('chrome://vwof/content/youtube_utils.js');
Services.scriptloader.loadSubScript('chrome://vwof/content/listener.js');
- windowListener.register();
- PrefObserver.register();
- setDefaultPref(PREF_BRANCH, "modules", '{"HTML5":1, "blip":1, "youtube":1, "dailymotion":1, "niconico":1, "FC2":1, "ScreenWaveMedia":1}');
+ //prefs
+ PrefObserver.register();
+ setDefaultPref(PREF_BRANCH, "modules",
+ '{"HTML5":0, "blip":1, "dailymotion":1, "niconico":1, "FC2":1, "ScreenWaveMedia":1}');
setDefaultPref(PREF_BRANCH, "prefered_quality", 'medium');
setDefaultPref(PREF_BRANCH, "prefered_format", 'webm');
setDefaultPref(PREF_BRANCH, "activate_onload", true);
- // Load into any existing windows
- let wm = Services.wm,
- enumerator = wm.getEnumerator('navigator:browser');
- while (enumerator.hasMoreElements()) {
- init(enumerator.getNext().QueryInterface(Ci.nsIDOMWindow));
- }
-
vwof.load_modules();
vwof.set_parsers_activation();
+
+ if(!isAndroid()){
+ windowListener.register();
+ Services.wm.addListener(windowListener);
+ }
+ else{
+ let windows = Services.wm.getEnumerator("navigator:browser");
+ while (windows.hasMoreElements()) {
+ let domWindow = windows.getNext().QueryInterface(Ci.nsIDOMWindow);
+ loadIntoWindow(domWindow);
+ }
+ Services.wm.addListener(windowListenerNative);
+ }
}
-function shutdown(aData, aReason) {
- if (aReason == APP_SHUTDOWN) return;
- windowListener.unregister();
- PrefObserver.unregister();
+function shutdown(data,reason) {
+ if (reason == APP_SHUTDOWN)
+ return;
+
+ if(!isAndroid()){
+ // Stop listening to newly opened windows
+ Services.wm.removeListener(windowListener);
+ }
+ else{
+ // Unload from any existing windows
+ let windows = Services.wm.getEnumerator("navigator:browser");
+ while (windows.hasMoreElements()) {
+ let domWindow = windows.getNext().QueryInterface(Ci.nsIDOMWindow);
+ unloadFromWindow(domWindow);
+ }
+ }
}
-function install() {}
+function install(data,reason) { }
-function uninstall() {}
+function uninstall(data,reason) { }
diff --git a/build/vwof.xpi b/build/vwof.xpi
new file mode 100644
index 0000000..2d1ee91
Binary files /dev/null and b/build/vwof.xpi differ
diff --git a/chrome.manifest b/chrome.manifest
index 9032b42..92ca300 100755
--- a/chrome.manifest
+++ b/chrome.manifest
@@ -1,3 +1,5 @@
content vwof content/ contentaccessible=yes
locale vwof en-US locale/en-US/
+locale vwof fr-FR locale/fr-FR/
+locale vwof jp-JP locale/jp-JP/
skin vwof classic/1.0 skin/
diff --git a/chrome/#blip.js# b/chrome/#blip.js#
deleted file mode 100644
index b556232..0000000
--- a/chrome/#blip.js#
+++ /dev/null
@@ -1,85 +0,0 @@
-var parser = {
- BASE_URI: 'blip.tv',
- URL_PARAM_JSON: '?skin=json&no_wrap=1',
- parse_embed: function(cw) {
- const XPATH_PLAYER = "//iframe[starts-with(@src, 'http://blip.tv/play')]";
- var video_info = [];
- var player;
- var video_img;
-
- var xp_res_player = cw.document.evaluate(XPATH_PLAYER, cw.document, null, cw.XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null );
- while (player = xp_res_player.iterateNext()) {
- var videos = [];
- var player_doc = player.contentDocument;
- var episode_info = player_doc.getElementById('EpisodeInfo');
- if(episode_info){
- //megaplaya method
- var data_episode_page = episode_info.getAttribute('data-episode-page');
- var json_string = utils.get(data_episode_page+this.URL_PARAM_JSON);
- var parse_data = this.parse_json_data(json_string);
- video_img = parse_data[0];
- videos = parse_data[1];
- }
- else{
- //embed method
- var encoded_file = player_doc.body.textContent.match(/"file":"(.+?)",/)[1];
- var file = decodeURIComponent(encoded_file);
- file = file.replace('rss/flash', 'posts/view');
- var json_string = utils.get(file+this.URL_PARAM_JSON);
- var parse_data = this.parse_json_data(json_string);
- video_img = parse_data[0];
- videos = parse_data[1];
- cw.oalert(videos[0].url);
- }
- cw.alert(player);
- video_info.push({
- 'player': player,
- 'video_img':video_img,
- 'videos': videos
- });
- }
-
- return video_info;
- },
-
- parse_site: function(cw) {
- var video_info = [];
- var player = cw.document.getElementById('PlayeriFrame');
- if(!player)return;
-
- var json_string = utils.get(cw.document.URL+this.URL_PARAM_JSON);
- var parse_data = this.parse_json_data(json_string);
- var video_img = parse_data[0];
- var videos = parse_data[1];
-
- video_info.push({
- 'player': player,
- 'video_img': video_img,
- 'videos': videos
- });
-
- return video_info;
- },
-
- parse_json_data: function(json_string){
- var post = JSON.parse(json_string).Post;
-
- var videos = [];
- for(var i=0;i<post.additionalMedia.length;i++){
- var format = post.additionalMedia[i].primary_mime_type;
- if(format == 'text/plain')continue;
-
- //remove video part of the mime type for a prettier display
- format=format.replace('video/', '');
-
- videos.push({'format': format,
- 'quality': post.additionalMedia[i].media_width + '/' + post.additionalMedia[i].media_height,
- 'url':post.additionalMedia[i].url}
- );
- }
-
- var video_img = post.thumbnailUrl;
-
- return [video_img, videos];
- }
-};
diff --git a/chrome/#list_modules.js# b/chrome/#list_modules.js#
deleted file mode 100644
index 3948543..0000000
--- a/chrome/#list_modules.js#
+++ /dev/null
@@ -1,31 +0,0 @@
-var checkbox_wide = document.getElementById("vwof_yt_wide");
-var wide = youtubeUtils.yt_is_wide();
-checkbox_wide.setAttribute("checked", wide);
-
-var prefPane = document.getElementById('vwof_pref_modules');
-var s_modules = document.getElementById('extensions.vwof.modules').value;
-modules = JSON.parse(s_modules);
-
-var element_label = document.createElement('label');
-element_label.setAttribute('value', ' -- Enable/disable modules -- ');
-dprefPane.appendChild(element_label);
-
-for(var key_module in modules){
- var element_checkbox = document.createElement('checkbox');
- element_checkbox.setAttribute('label', key_module);
- element_checkbox.setAttribute('checked', modules[key_module]?'true':'false');
- element_checkbox.setAttribute('oncommand', "update_module(event)");
- prefPane.appendChild(element_checkbox);
-}
-
-function update_module(event){
- var l = event.target.getAttribute('label');
- var c = event.target.hasAttribute('checked')?1:0;
-
- modules[l] = c;
- var s_modules = JSON.stringify(modules);
-
- var prefManager = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
- prefManager.setCharPref("extensions.vwof.modules", s_modules);
-}
-
diff --git a/chrome/#vwof.js# b/chrome/#vwof.js#
deleted file mode 100644
index ae9e0f4..0000000
--- a/chrome/#vwof.js#
+++ /dev/null
@@ -1,93 +0,0 @@
-var vwof= {
- parsers:{}, //hash of the parsers (loaded from jsm modules)
- parser_name:["blip", "dailymotion", "FC2", "HTML5", "niconico", "youtube", "ScreenWaveMedia"],
-
- /**
- Load modules listed in the extensions.vwof.modules pref variable to this.parsers hash
- */
- load_modules:function(){
- //check in the preferences : activated a parser on page load or not
- Components.utils.import("resource://gre/modules/Services.jsm");
- var prefManager = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
-
- var modules_list = prefManager.getCharPref("extensions.vwof.modules");
- var modules = JSON.parse(modules_list); //parser / value from the preferences
-
- for(var i=0;i<this.parser_name.length;i++){
- let key_parser = this.parser_name[i];
- if(modules[key_parser]){
-
- let context = {};
- let res = 'chrome://vwof/content/modules/'+key_parser+'.jsm';
- Services.scriptloader.loadSubScript(res, context, "UTF-8");
- this.parsers[key_parser] = context;
- }
- }
- },
- reload_modules:function(){
- try{
- // clear the previously loaded parsers
- delete this.parsers;
- this.parsers = {};
-
- //finally load the modules
- this.load_modules();
- }
- catch(err){
- Components.utils.reportError("vwof exception: "+err);
- };
- },
- getVideoInfo:function (cw) {
- var video_info = []; // array of video_data
- var has_parsed_site = false;
-
- for(var key_parser in this.parsers){
- try{
- var parser = this.parsers[key_parser].parser;
- var video_data = []; //array of video links with quality
-
- //if the parser has a URI and it's the current location
- if(parser.BASE_URI && cw.location.hostname == parser.BASE_URI){
- video_data = parser.parse_site(cw);
- has_parsed_site = true;
- }
- else if(parser.parse_embed){
- video_data = parser.parse_embed(cw);
- }
-
- //if there is at least a video url retreived from the parser
- if(video_data.length >= 1){
- //set the source (name of the parser)
- for(var i=0;i < video_data.length;i++){
- video_data[i]['source'] = this.parsers[key_parser].name;
- }
-
- //concat the chunks of video(s) from this parser
- video_info = video_info.concat(video_data);
- }
- }
- catch(err){
- Components.utils.reportError("vwof plugin, exception in "+key_parser+": "+err);
- };
-
- //official web sites do not embed several videos, so don't use other parsers
- if(has_parsed_site){break;}
- }
-
- return video_info;
- },
-
- detectVideo:function(cw) {
- var video_info = this.getVideoInfo(cw);
-
- for (var i = 0; i < video_info.length; i++) {
- if(video_info[i]['player']){
- var replace_location = video_info[i]['player'];
- var player = vwofPlayer.create_video_selector(video_info[i], cw);
- var replace_parent = replace_location.parentNode;
- replace_parent.replaceChild(player, replace_location);
- }
- }
- }
-};
diff --git a/chrome/blip.js b/chrome/blip.js
deleted file mode 100644
index 03dbc11..0000000
--- a/chrome/blip.js
+++ /dev/null
@@ -1,85 +0,0 @@
-var parser = {
- BASE_URI: 'blip.tv',
- URL_PARAM_JSON: '?skin=json&no_wrap=1',
- parse_embed: function(cw) {
- const XPATH_PLAYER = "//iframe[starts-with(@src, 'http://blip.tv/play')]";
- var video_info = [];
- var player;
- var video_img;
-
- var xp_res_player = cw.document.evaluate(XPATH_PLAYER, cw.document, null, cw.XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null );
- while (player = xp_res_player.iterateNext()) {
- var videos = [];
- var player_doc = player.contentDocument;
- var episode_info = player_doc.getElementById('EpisodeInfo');
- if(episode_info){
- //megaplaya method
- var data_episode_page = episode_info.getAttribute('data-episode-page');
- var json_string = utils.get(data_episode_page+this.URL_PARAM_JSON);
- var parse_data = this.parse_json_data(json_string);
- video_img = parse_data[0];
- videos = parse_data[1];
- }
- else{
- //embed method
- var encoded_file = player_doc.body.textContent.match(/"file":"(.+?)",/)[1];
- var file = decodeURIComponent(encoded_file);
- file = file.replace('rss/flash', 'posts/view');
- var json_string = utils.get(file+this.URL_PARAM_JSON);
- var parse_data = this.parse_json_data(json_string);
- video_img = parse_data[0];
- videos = parse_data[1];
- cw.alert(videos[0].url);
- }
- cw.alert(player);
- video_info.push({
- 'player': player,
- 'video_img':video_img,
- 'videos': videos
- });
- }
-
- return video_info;
- },
-
- parse_site: function(cw) {
- var video_info = [];
- var player = cw.document.getElementById('PlayeriFrame');
- if(!player)return;
-
- var json_string = utils.get(cw.document.URL+this.URL_PARAM_JSON);
- var parse_data = this.parse_json_data(json_string);
- var video_img = parse_data[0];
- var videos = parse_data[1];
-
- video_info.push({
- 'player': player,
- 'video_img': video_img,
- 'videos': videos
- });
-
- return video_info;
- },
-
- parse_json_data: function(json_string){
- var post = JSON.parse(json_string).Post;
-
- var videos = [];
- for(var i=0;i<post.additionalMedia.length;i++){
- var format = post.additionalMedia[i].primary_mime_type;
- if(format == 'text/plain')continue;
-
- //remove video part of the mime type for a prettier display
- format=format.replace('video/', '');
-
- videos.push({'format': format,
- 'quality': post.additionalMedia[i].media_width + '/' + post.additionalMedia[i].media_height,
- 'url':post.additionalMedia[i].url}
- );
- }
-
- var video_img = post.thumbnailUrl;
-
- return [video_img, videos];
- }
-};
diff --git a/chrome/list_modules.js b/chrome/list_modules.js
deleted file mode 100644
index 9bda604..0000000
--- a/chrome/list_modules.js
+++ /dev/null
@@ -1,56 +0,0 @@
-var checkbox_wide = document.getElementById("vwof_yt_wide");
-var wide = youtubeUtils.yt_is_wide();
-checkbox_wide.setAttribute("checked", wide);
-
-var prefPane = document.getElementById('vwof_pref_modules');
-var s_modules = document.getElementById('extensions.vwof.modules').value;
-modules = JSON.parse(s_modules);
-
-var element_label = document.createElement('label');
-element_label.setAttribute('value', 'Module activation');
-prefPane.appendChild(element_label);
-
-let element_grid = document.createElement('grid');
-var element_columns = document.createElement('columns');
-var element_column_site = document.createElement('column');
-var element_column_embed = document.createElement('column');
-var element_rows = document.createElement('rows');
-
-element_columns.appendChild(element_column_site);
-element_columns.appendChild(element_column_embed);
-element_grid.appendChild(element_columns);
-element_grid.appendChild(element_rows);
-
-for(var i=0;i<vwof.parser_name.length;i++){
- var element_row = document.createElement('row');
-
- let key_module = vwof.parser_name[i];
-
- var element_label_key = document.createElement('label');
- element_label_key.setAttribute('value', key_module);
- element_row.appendChild(element_label_key);
-
- var element_checkbox_site = document.createElement('checkbox');
- element_checkbox_site.setAttribute('checked', modules[key_module]?'true':'false');
- element_checkbox_site.setAttribute('class', key_module);
- element_checkbox_site.addEventListener('command', update_module);
- element_row.appendChild(element_checkbox_site);
-
- element_rows.appendChild(element_row);
-}
-
-prefPane.appendChild(element_grid);
-
-function update_module(event){
- var l = event.target.getAttribute('class');
- var c = event.target.hasAttribute('checked')?1:0;
-
- modules[l] = c;
- var s_modules = JSON.stringify(modules);
-
- var prefManager = Components.classes["@mozilla.org/preferences-service;1"].
- getService(Components.interfaces.nsIPrefBranch);
-
- prefManager.setCharPref("extensions.vwof.modules", s_modules);
-}
-
diff --git a/chrome/listener.js b/chrome/listener.js
deleted file mode 100644
index fbb98d5..0000000
--- a/chrome/listener.js
+++ /dev/null
@@ -1,156 +0,0 @@
-var windowListener = {
- ignoreFrames:true,
- onOpenWindow: function (aXULWindow) {
- let aDOMWindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow);
- aDOMWindow.addEventListener("load", function () {
- aDOMWindow.removeEventListener("load", arguments.callee, false);
- windowListener.loadIntoWindow(aDOMWindow, aXULWindow);
- }, false);
- },
- register: function () {
- let XULWindows = Services.wm.getXULWindowEnumerator(null);
- while (XULWindows.hasMoreElements()) {
- let aXULWindow = XULWindows.getNext();
- let aDOMWindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow);
- windowListener.loadIntoWindow(aDOMWindow, aXULWindow);
- }
- // Listen to new windows
- Services.wm.addListener(windowListener);
- },
- unregister: function () {
- // Unload from any existing windows
- let XULWindows = Services.wm.getXULWindowEnumerator(null);
- while (XULWindows.hasMoreElements()) {
- let aXULWindow = XULWindows.getNext();
- let aDOMWindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow);
- windowListener.unloadFromWindow(aDOMWindow, aXULWindow);
- }
- //Stop listening so future added windows dont get this attached
- Services.wm.removeListener(windowListener);
- },
- loadIntoWindow: function (aDOMWindow, aXULWindow) {
- if (!aDOMWindow) {
- return;
- }
- if (aDOMWindow.gBrowser) {
- aDOMWindow.gBrowser.addEventListener('DOMContentLoaded', listenPageLoad, false);
- if (aDOMWindow.gBrowser.tabContainer) {
- //start - go through all tabs in this window we just added to
- var tabs = aDOMWindow.gBrowser.tabContainer.childNodes;
- for (var i = 0; i < tabs.length; i++) {
- var tabBrowser = tabs[i].linkedBrowser;
- var win = tabBrowser.contentWindow;
- loadIntoContentWindowAndItsFrames(win);
- }
- //end - go through all tabs in this window we just added to
- } else {
- //does not have tabContainer
- var win = aDOMWindow.gBrowser.contentWindow;
- loadIntoContentWindowAndItsFrames(win);
- }
- }
- },
- unloadFromWindow: function (aDOMWindow, aXULWindow) {
- if (!aDOMWindow) {
- return;
- }
- if (aDOMWindow.gBrowser) {
- aDOMWindow.gBrowser.removeEventListener('DOMContentLoaded', listenPageLoad, false);
- if (aDOMWindow.gBrowser.tabContainer) {
- //has tabContainer
- //start - go through all tabs in this window we just added to
- var tabs = aDOMWindow.gBrowser.tabContainer.childNodes;
- for (var i = 0; i < tabs.length; i++) {
- Cu.reportError('DOING tab: ' + i);
- var tabBrowser = tabs[i].linkedBrowser;
- var win = tabBrowser.contentWindow;
- unloadFromContentWindowAndItsFrames(win);
- }
- //end - go through all tabs in this window we just added to
- } else {
- //does not have tabContainer
- var win = aDOMWindow.gBrowser.contentWindow;
- unloadFromContentWindowAndItsFrames(win);
- }
- } else {
- //window does not have gBrowser
- }
- }
-};
-/*end - windowlistener*/
-
-function loadIntoContentWindowAndItsFrames(theWin) {
- var frames = theWin.frames;
- var winArr = [theWin];
- for (var j = 0; j < frames.length; j++) {
- winArr.push(frames[j].window);
- }
- Cu.reportError('# of frames in tab: ' + frames.length);
- for (var j = 0; j < winArr.length; j++) {
- if (j == 0) {
- Cu.reportError('**checking win: ' + j + ' location = ' + winArr[j].document.location);
- } else {
- Cu.reportError('**checking frame win: ' + j + ' location = ' + winArr[j].document.location);
- }
- var doc = winArr[j].document;
- //START - edit below here
-
- if (this.ignoreFrames) {
- break;
- }
- //END - edit above here
- }
-}
-
-function unloadFromContentWindowAndItsFrames(theWin) {
- var frames = theWin.frames;
- var winArr = [theWin];
- for (var j = 0; j < frames.length; j++) {
- winArr.push(frames[j].window);
- }
- Cu.reportError('# of frames in tab: ' + frames.length);
- for (var j = 0; j < winArr.length; j++) {
- if (j == 0) {
- Cu.reportError('**checking win: ' + j + ' location = ' + winArr[j].document.location);
- } else {
- Cu.reportError('**checking frame win: ' + j + ' location = ' + winArr[j].document.location);
- }
- var doc = winArr[j].document;
- //START - edit below here
- if (this.ignoreFrames) {
- break;
- }
- //END - edit above here
- }
-}
-
-/**
- Listener that observe the prefs variables
-
- If the module list changes (new module, module deactivated/activated), the parser list is reloaded
-*/
-var PrefObserver = {
- register: function() {
- // First we'll need the preference services to look for preferences.
- var prefService = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefService);
-
- // For this.branch we ask for the preferences
- this.branch = prefService.getBranch("extensions.vwof.");
-
- // Finally add the observer.
- this.branch.addObserver("", this, false);
- },
-
- unregister: function() {
- this.branch.removeObserver("", this);
- },
-
- observe: function(aSubject, aTopic, aData) {
- switch (aData) {
- case "modules":
- vwof.set_parsers_activation();
- break;
- }
- }
-}
diff --git a/chrome/modules/FC2.jsm b/chrome/modules/FC2.jsm
deleted file mode 100644
index cc218b5..0000000
--- a/chrome/modules/FC2.jsm
+++ /dev/null
@@ -1,70 +0,0 @@
-var parser = {
- BASE_URI : 'video.fc2.com',
- API_GET_VIDEO:'http://video.fc2.com/ginfo.php?upid=UPID&mimi=MIMI&gk=GK',
- SALT:'_gGddgPfeaf_gzyr',
-
- parse_site:function(cw) {
- const REGEX_VIDEO_ID_SITE = /content\/(\w+)/;
- const XPATH_VIDEO_IMG = '/html/head/meta[@property="og:image"]/@content';
- const doc = cw.document;
- var video_info = [];
- var id;
-
- //get the video id
- if(url_match = doc.URL.match(REGEX_VIDEO_ID_SITE)){
- id = url_match[1];
- }
- else{
- throw('cannot retreive ID of a '+this.BASE_URI+' video on '+doc.URL);
- }
-
- //get MD5 from video id and salt
- var id_salt = id+this.SALT;
- var md5sum = utils.md5(id_salt);
-
- //get gk (signature generated by JS)
- var gk = [];
- var res;
- var re_fun = /function cass\(\)\{([\s\S]+?)\}/;
- var re_arr = /Array\(([0-9]),'(\w)'\)/g;
- var source = doc.documentElement.innerHTML;
- var function_content = source.match(re_fun)[1];
- while(res = re_arr.exec(function_content)){
- gk[res[1]] = res[2];
- }
-
- //construct the url
- var api_video_uri = this.API_GET_VIDEO.replace('UPID', id);
- api_video_uri = api_video_uri.replace('MIMI', md5sum);
- api_video_uri = api_video_uri.replace('GK', gk.join(''));
-
- var data = utils.get(api_video_uri);
- //extract the video url (filepath) from the data
- var assoc_data = utils.url_vars_to_array(data);
- var filepath = assoc_data['filepath'];
- if(!filepath)return;
-
- var mid = assoc_data['mid'];
- var url = filepath+'?mid='+mid;
-
- //get player
- var player = doc.getElementById('videoplayer');
- if(!player){
- player = doc.getElementsByClassName('req_regist_wrap01 box_inset01')[0];
- var bnr_wifi = doc.getElementsByClassName('bnr_wifi')[0];
- if(bnr_wifi)bnr_wifi.style.display = 'none';
- }
-
- //get thumbnail
- var video_img = doc.evaluate(XPATH_VIDEO_IMG, doc, null,
- cw.XPathResult.STRING_TYPE, null).stringValue;
-
- video_info.push({
- 'player':player,
- 'video_img': video_img,
- 'videos': [ {'quality': 'medium', 'format':'flv', 'url':url} ]
- });
-
- return video_info;
- }
-};
diff --git a/chrome/modules/HTML5.jsm b/chrome/modules/HTML5.jsm
deleted file mode 100644
index 9543b83..0000000
--- a/chrome/modules/HTML5.jsm
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- HTML5 parser
- used to play videos which use codec unsupported by default in firefox
- but can be readed with the help of a media plugin (vlc-web-plugin, mplayer)
-*/
-
-var parser = {
- parse_embed: function(cw) {
- const doc = cw.document;
- const XPATH_PLAYER = "//video";
- const XPATH_VIDEO_URI = 'source';
- var video_info = [];
- var xp_res_player = doc.evaluate(XPATH_PLAYER, doc, null,
- cw.XPathResult.ORDERED_NODE_ITERATOR_TYPE,
- null);
-
- while (player = xp_res_player.iterateNext()) {
- var videos = [];
- var xp_res_video = doc.evaluate(XPATH_VIDEO_URI, player, null,
- cw.XPathResult.ORDERED_NODE_ITERATOR_TYPE,
- null);
-
- while (node_video = xp_res_video.iterateNext()) {
- videos.push({'format': node_video.type, 'url': node_video.src});
- }
-
- video_info.push({
- 'player':player,
- 'video_img':player.poster,
- 'videos': videos
- });
- }
-
- return video_info;
- }
-};
diff --git a/chrome/modules/Makefile.in b/chrome/modules/Makefile.in
deleted file mode 100644
index 23f8111..0000000
--- a/chrome/modules/Makefile.in
+++ /dev/null
@@ -1,2 +0,0 @@
-# The sources for the module files.
-modules_sources := $(wildcard $(modules_dir)/*.jsm)
diff --git a/chrome/modules/SWM.jsm b/chrome/modules/SWM.jsm
deleted file mode 100644
index 9b23f80..0000000
--- a/chrome/modules/SWM.jsm
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
-ScreenWaveMedia module
-
-The only site where I go that uses this media provider is cinemassacre.com
-
-The video are all in RMTP format and there is only one format for each video
-
-Since it is all RMTP, the link is open in a vlc instance outside of firefox, but it's no big deal as long
-as the video can be played.
-
-There are two html layout, the "old" layout (http://cinemassacre.com/2013/07/01/avgn-bill-teds-excellent-adventure/)
-
-<div id="SWMPlayer_25823" class="SWMPlayer" style="width:640px;height:320px;">Loading Video...</div>
-<script type="text/javascript" src="http://player.screenwavemedia.com/play/jwplayer/jwplayer.js"></script>
-<script type="text/javascript" src="http://player.screenwavemedia.com/play/embed.php?id=25823"></script> <-- video data are here
-
-and the "new" layout since september 2013 (http://cinemassacre.com/2013/09/06/avgn-tiger-electronic/)
-
-<iframe src="http://player.screenwavemedia.com/play/player.php?id=Cinemassacre-52273484b87b2" frameborder="0" height="540" width="960">
-<html> ...
-
- <div id="SWMPlayer" class="SWMPlayer">Loading Video...</div>
- <script>
- ...
- jwplayer('SWMPlayer').setup({
- 'id': 'videoPlayer',
- 'width': '100%', 'height': '100%',
- 'provider': 'rtmp',
- 'streamer': 'rtmp://174.127.86.16/Cinemassacre',
- 'flashplayer': 'http://player.screenwavemedia.com/play/jwplayer/player.swf',
- 'file': 'Cinemassacre-52273484b87b2_high.mp4',
- 'image': 'http://image.screenwavemedia.com/Cinemassacre-52273484b87b2_thumb_640x360.jpg', 'stretching': 'uniform',
- </script>
-</body></html>
-</iframe>
-
-
-For both layout, the video data are in the same format, only the way to get the script content differ
-*/
-
-var parser = {
- parse_embed: function(cw) {
- const REGEX_IMG = /'image': '(.*\.jpg)'/;
- var video_info = []; //player DOM element, preview image and array of videos
-
- //for the "old" layout, outside of a frame, script tag with src
- const XPATH_PLAYER = "//div[starts-with(@id, 'SWMPlayer')]";
- const XPATH_SCRIPT = "//script[starts-with(@src, 'http://player.screenwavemedia.com/play/embed.php')]";
-
- var xp_res_player = cw.document.evaluate(XPATH_PLAYER, cw.document, null, cw.XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
- var xp_res_script = cw.document.evaluate(XPATH_SCRIPT, cw.document, null, cw.XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
-
- while (player = xp_res_player.iterateNext()) {
- var script = xp_res_script.iterateNext();
- var script_content = utils.get(script.src);
-
- var video_img = script_content.match(REGEX_IMG)[1];
- var videos = this.parse_data(script_content); //get format, type and uri of videos
-
- video_info.push({
- 'player':player,
- 'video_img':video_img,
- 'videos': videos
- });
- }
-
- //for the "new" layout, inside a frame, simple script markup
- const XPATH_PLAYER_FRAME = "//iframe[starts-with(@src, 'http://player.screenwavemedia.com/play/player.php')]";
- var xp_res_player_frame = cw.document.evaluate(XPATH_PLAYER_FRAME, cw.document, null, cw.XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
-
- while (player = xp_res_player_frame.iterateNext()) {
- var script_content = player.contentDocument.body.innerHTML;
-
- var video_img_match = script_content.match(REGEX_IMG);
- if(video_img_match)video_img = video_img_match[1];
- else video_img = undefined;
-
- var videos = this.parse_data(script_content); //get format, type and uri of videos
-
- video_info.push({
- 'player':player,
- 'video_img':video_img,
- 'videos': videos
- });
- }
-
- return video_info;
- },
-
- /**
- the video data are written in a script markup
- */
- parse_data: function(data){
- const REGEX_STREAMER = /'streamer': '(.*)'/;
- const REGEX_FILE = /'file': '(.*)'/;
-
- var streamer = data.match(REGEX_STREAMER)[1];
- var file = data.match(REGEX_FILE)[1];
- var video_uri = streamer + '/' + file;
-
- //only one element in the array for this module
- var videos = [ {'quality':'medium', 'format':'rtmp', 'url':video_uri} ];
- return videos;
- }
-};
diff --git a/chrome/modules/ScreenWaveMedia.jsm b/chrome/modules/ScreenWaveMedia.jsm
deleted file mode 100644
index 71d935a..0000000
--- a/chrome/modules/ScreenWaveMedia.jsm
+++ /dev/null
@@ -1,57 +0,0 @@
-var parser = {
- parse_embed: function(cw) {
- var player;
- var videos = [];
- var video_info = [];
- const doc = cw.document;
- const REGEX_ID = /id=(.+)/;
- const URL_VIDEO = 'http://video2.screenwavemedia.com/vod/VIDEO_ID_QUALITY.mp4';
- const URL_IMAGE = 'http://image.screenwavemedia.com/VIDEO_ID_thumb_640x360.jpg';
- const video_quality = ['audio', 'low', 'med', 'high', 'hd1'];
- const URL_PLAYER_FRAME = 'http://player.screenwavemedia.com/play/player.php';
- const XPATH_PLAYER_FRAME = "//iframe[starts-with(@src, '"+URL_PLAYER_FRAME+"')]"
- const URL_PLAYER_SCRIPT = 'http://player.screenwavemedia.com/play/play.php';
- const XPATH_PLAYER_SCRIPT = "//script[starts-with(@src, '"+URL_PLAYER_SCRIPT+"')]";
-
- var xp_res_player_frame = doc.evaluate(XPATH_PLAYER_FRAME, doc, null,
- cw.XPathResult.FIRST_ORDERED_NODE_TYPE,
- null);
-
- var node = xp_res_player_frame.singleNodeValue;
-
- if(node){
- player = node;
- }
- else{
- var xp_res_player_script = doc.evaluate(XPATH_PLAYER_SCRIPT, doc, null,
- cw.XPathResult.FIRST_ORDERED_NODE_TYPE,
- null);
-
- node = xp_res_player_script.singleNodeValue;
- if(!node)return;
-
- player = doc.getElementById('videoarea');
- player.id = "swmvwof_player";
- }
-
- if(!node)return;
-
- var video_id = node.src.match(REGEX_ID)[1];
-
- for (var i=0;i<video_quality.length;i++) {
- var url = URL_VIDEO.replace('VIDEO_ID', video_id);
- url = url.replace("QUALITY", video_quality[i]);
- videos.push( {'quality': video_quality[i], 'format':'mp4', 'url':url} );
- }
-
- var video_img = URL_IMAGE.replace('VIDEO_ID', video_id);
-
- video_info.push({
- 'player': player,
- 'video_img':video_img,
- 'videos': videos
- });
-
- return video_info;
- }
-};
diff --git a/chrome/modules/blip.jsm b/chrome/modules/blip.jsm
deleted file mode 100644
index b776df9..0000000
--- a/chrome/modules/blip.jsm
+++ /dev/null
@@ -1,118 +0,0 @@
-var parser = {
- BASE_URI: 'blip.tv',
- URL_PARAM_JSON: '?skin=json&no_wrap=1',
-
- parse_embed: function(cw) {
- const doc = cw.document;
- const XPATH_PLAYER = "//iframe[starts-with(@src, 'http://blip.tv/play')]";
- var video_info = [];
- var player;
- var video_img;
-
- var xp_res_player = doc.evaluate(XPATH_PLAYER, doc,
- null, cw.XPathResult.ORDERED_NODE_ITERATOR_TYPE,
- null );
-
- try{
- while (player = xp_res_player.iterateNext()) {
- var videos = [];
- var encoded_file;
- var player_doc = utils.get(player.src);
-
- if((encoded_file = player_doc.match(/"file":"(.+?)",/)) !== null){
- var file = decodeURIComponent(encoded_file[1]);
- file = file.replace('rss/flash', 'posts/view');
- var json_string = utils.get(file+this.URL_PARAM_JSON);
- var parse_data = this.parse_json_data(json_string);
- video_img = parse_data[0];
- videos = parse_data[1];
- }
- else{
- const URL_BASE = 'http://blip.tv/file/get/';
-
- const REGEX_VIDEO_URI_HD = 'bliphd720 : "(.*)"';
- const REGEX_VIDEO_URI_SD = 'blipsd : "(.*)"';
- const REGEX_VIDEO_URI_LD = 'blipld : "(.*)"';
- const REGEX_VIDEO_IMG = 'config\.video\.thumbnail = "(.*)"';
-
- var video_uri_hd = player_doc.match(REGEX_VIDEO_URI_HD);
- var video_uri_sd = player_doc.match(REGEX_VIDEO_URI_SD);
- var video_uri_ld = player_doc.match(REGEX_VIDEO_URI_LD);
- var video_uri_img = player_doc.match(REGEX_VIDEO_IMG);
-
- if(video_uri_hd[1] != ""){
- videos.push({'quality':'hd720' , 'url':URL_BASE+video_uri_hd[1]});
- }
- if(video_uri_sd[1] != ""){
- videos.push({'quality':'medium', 'url':URL_BASE+video_uri_sd[1]});
- }
- if(video_uri_ld[1] != ""){
- videos.push({'quality':'low' , 'url':URL_BASE+video_uri_ld[1]});
- }
-
- if(video_uri_img){
- video_img = 'http:'+video_uri_img[1];
- video_img = video_img.replace('THUMB_WIDTH', player.width);
- video_img = video_img.replace('THUMB_HEIGHT', player.height);
- }
- }
-
- video_info.push({
- 'player': player,
- 'video_img':video_img,
- 'videos': videos
- });
- }
- }
- finally{
- //in case iterateNext() throw invalidStateException
- //because of a DOM alteration, return what was fetched
- return video_info;
- }
-
- return video_info;
- },
-
- parse_site: function(cw) {
- var doc = cw.document;
- var video_info = [];
- var player = doc.getElementById('PlayeriFrame');
- if(!player)return;
-
- var json_string = utils.get(doc.URL+this.URL_PARAM_JSON);
- var parse_data = this.parse_json_data(json_string);
- var video_img = parse_data[0];
- var videos = parse_data[1];
-
- video_info.push({
- 'player': player,
- 'video_img': video_img,
- 'videos': videos
- });
-
- return video_info;
- },
-
- parse_json_data: function(json_string){
- var post = JSON.parse(json_string).Post;
-
- var videos = [];
- for(var i=0;i<post.additionalMedia.length;i++){
- var format = post.additionalMedia[i].primary_mime_type;
- if(format == 'text/plain')continue;
-
- //remove video part of the mime type for a prettier display
- format=format.replace('video/', '');
-
- videos.push({'format': format,
- 'quality': post.additionalMedia[i].media_width + '/' +
- post.additionalMedia[i].media_height,
- 'url':post.additionalMedia[i].url}
- );
- }
-
- var video_img = post.thumbnailUrl;
-
- return [video_img, videos];
- }
-};
diff --git a/chrome/modules/dailymotion.jsm b/chrome/modules/dailymotion.jsm
deleted file mode 100644
index 4718a27..0000000
--- a/chrome/modules/dailymotion.jsm
+++ /dev/null
@@ -1,62 +0,0 @@
-var parser = {
- BASE_URI : 'www.dailymotion.com',
- parse_site:function(cw) {
- var video_info = [];
-
- var player = cw.document.getElementById('container_player_main');
- var video_data = this.get_video_data(player.contentDocument);
- video_data['player'] = player;
-
- video_info.push(video_data);
- return video_info;
- },
-
- parse_embed: function(cw) {
- const XPATH_PLAYER = "//iframe[contains(@src, '"+this.BASE_URI +"/embed')]";
-
- var video_info = [];
- var xp_res_player = cw.document.evaluate(XPATH_PLAYER, cw.document, null,
- cw.XPathResult.UNORDERED_NODE_ITERATOR_TYPE,
- null );
- var player;
-
- while (player = xp_res_player.iterateNext()) {
-
- var video_data = this.get_video_data(player.contentDocument);
-
- video_data['player'] = player;
- video_info.push(video_data);
- }
- return video_info;
- },
-
- get_video_data: function(contentDocument){
- var info = contentDocument.body.innerHTML.match(/var info = ({.*})/);
- var json_info = JSON.parse(info[1]);
- var videos = [];
-
- for(info_key in json_info){
- if( (video_data = info_key.match(/stream_(.*)_(.*)_url/) ) && json_info[info_key] != undefined){
- var format = video_data[1];
- var quality = video_data[2];
-
- switch(quality){
- case 'ld':quality = 'low';break;
- case 'hq':quality = 'high';break;
- case 'hd':quality = 'hd';break;
- }
-
- videos.push( {'format':format, 'quality':quality, 'url':json_info[info_key]} );
- }
- }
-
- var video_info = {
- 'video_img': json_info.thumbnail_url,
- 'videos': videos
- };
-
- return video_info;
-
- },
-
-};
diff --git a/chrome/modules/dew.jsm b/chrome/modules/dew.jsm
deleted file mode 100644
index b09ea55..0000000
--- a/chrome/modules/dew.jsm
+++ /dev/null
@@ -1,20 +0,0 @@
-var parser = {
- parse_embed: function(cw) {
- const XPATH_PLAYER = "//embed[contains(@src, 'dewplayer')]";
- const REGEX_SOURCE = /[&\?]?son=([^&?]+)/;
- var video_info = [];
- var xp_res_player = cw.document.evaluate(XPATH_PLAYER, cw.document, null, cw.XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
-
- while (player = xp_res_player.iterateNext()) {
- var video_uri = player.src.match(REGEX_SOURCE)[1];
-
- if(!video_uri)continue;
- video_info.push({
- 'player':player,
- 'videos': [ {'quality':'medium', 'url':video_uri} ]
- });
- }
-
- return video_info;
- }
-};
diff --git a/chrome/modules/niconico.jsm b/chrome/modules/niconico.jsm
deleted file mode 100644
index 5e3eb8b..0000000
--- a/chrome/modules/niconico.jsm
+++ /dev/null
@@ -1,53 +0,0 @@
-var parser = {
- BASE_URI: 'www.nicovideo.jp',
-
- parse_site: function(cw) {
- const doc = cw.document;
- var video_info = [];
- var player = doc.getElementById('nicoplayerContainer');
-
- //remove the 'limited functionality' alert warning
- const XPATH_CHECK_FLASH = '/html/body/script[67]';
- var node_script_check_flash = doc.evaluate(XPATH_CHECK_FLASH,
- doc, null,
- cw.XPathResult.FIRST_ORDERED_NODE_TYPE,
- null).singleNodeValue;
- if(node_script_check_flash)node_script_check_flash.textContent = '';
-
- //auto redirect to the 'skip flash install' page
- if(new RegExp(/\/watch\/sm\d+$/).test(cw.location.href)){
- cw.location.assign(cw.location.href+'?ver=q9');
- }
-
- ////get some video information (thumbnail, video id, etc)
- //the script content contains a json string with informations
- const XPATH_SCRIPT = '/html/body/script';
- var script_content = doc.evaluate(XPATH_SCRIPT, doc,
- null, cw.XPathResult.STRING_TYPE,
- null).stringValue;
-
- //extract the json formated part of the script content
- var string_data = script_content.match(/window.watchAPIData = (.*);/)[1];
- var json_data = JSON.parse(string_data);
-
- ////get the video link from the flapi
- const video_id = json_data.flashvars.videoId;
- const flapi_url = 'http://flapi.nicovideo.jp/api/getflv?v='+video_id;
- const data = utils.get(flapi_url);
- const assoc_data = utils.url_vars_to_array(data);
- const url = decodeURIComponent(assoc_data['url']);
-
- var videos = [ {
- 'quality':'medium',
- 'url': url
- } ];
-
- video_info.push({
- 'player': player,
- 'video_img': json_data.videoDetail.thumbnail,
- 'videos': videos
- });
-
- return video_info;
- }
-};
diff --git a/chrome/modules/springboard.jsm b/chrome/modules/springboard.jsm
deleted file mode 100644
index f881418..0000000
--- a/chrome/modules/springboard.jsm
+++ /dev/null
@@ -1,25 +0,0 @@
-var parser = {
- parse_embed: function(cw) {
- const XPATH_PLAYER = "//iframe[starts-with(@src, 'http://cms.springboardplatform.com/embed_iframe')]";
- const XPATH_VIDEO_URI = '/html/head/meta[@property="og:video"]/@content';
- const XPATH_VIDEO_IMG = '/html/head/meta[@property="og:image"]/@content';
- var video_info = [];
- var xp_res_player = cw.document.evaluate(XPATH_PLAYER, cw.document, null, cw.XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null);
-
- while (player = xp_res_player.iterateNext()) {
- var player_doc = player.contentDocument;
-
- var video_uri = player_doc.evaluate(XPATH_VIDEO_URI, player_doc, null, cw.XPathResult.STRING_TYPE, null).stringValue;
- var video_img = player_doc.evaluate(XPATH_VIDEO_IMG, player_doc, null, cw.XPathResult.STRING_TYPE, null).stringValue;
-
- if(!video_uri)continue;
-
- video_info.push({
- 'player':player,
- 'video_img':video_img,
- 'videos': [ {'quality':'medium', 'url':video_uri} ]
- });
- }
- return video_info;
- }
-};
diff --git a/chrome/modules/twitch.jsm b/chrome/modules/twitch.jsm
deleted file mode 100644
index b0277d6..0000000
--- a/chrome/modules/twitch.jsm
+++ /dev/null
@@ -1,39 +0,0 @@
-var parser = {
- BASE_URI : 'www.twitch.tv',
- API_GET_VIDEO:'http://usher.twitch.tv/select/CHANNEL.json?allow_source=true&nauthsig=SIG&nauth=TOKEN&type=any',
- API_GET_TOKEN:'http://api.twitch.tv/api/channels/CHANNEL/access_token',
-
- parse_site:function(cw) {
- const REGEX_CHANNEL = /twitch.tv\/(\w+)/;
- var doc = cw.document;
- var video_info = [];
- var channel;
-
- //get the channel name
- if(url_match = doc.URL.match(REGEX_CHANNEL)){
- channel = url_match[1];
- }
- else{
- throw('cannot retreive channel name of a '+this.BASE_URI+' video on '+doc.URL);
- }
-
- //get sig and token
- var api_token_uri = this.API_GET_TOKEN.replace('CHANNEL', channel);
- var str_token = vwofChrome.utils.get(api_token_uri);
- var json_token = JSON.parse(str_token);
-
- var sig = json_token['sig'];
- var token = json_token['token'];
- //token = token.replace(/"/g, '\\"');
- token = encodeURIComponent(token);
-
- //get video info with sig and token values
- var api_video_uri = this.API_GET_VIDEO.replace('CHANNEL', channel);
- api_video_uri = api_video_uri.replace('SIG', sig);
- api_video_uri = api_video_uri.replace('TOKEN', token);
-
- var str_video = vwofChrome.utils.get(api_video_uri);
- alert(str_video);
- return video_info;
- }
-};
diff --git a/chrome/modules/ustream.jsm b/chrome/modules/ustream.jsm
deleted file mode 100644
index a43b93c..0000000
--- a/chrome/modules/ustream.jsm
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- ustream parser
- inspired from https://github.com/piscui/ustream-to-ffmpeg
-*/
-
-var parser = {
- BASE_URI:'www.ustream.tv',
-
- parse_site : function(cw){
- const XPATH_CHANNEL_ID = '/html/head/meta[@name="ustream:channel_id"]/@content';
- const XPATH_VIDEO_IMG = '/html/head/meta[@property="og:image"]/@content';
- const URL_AMF = 'http://cgw.ustream.tv/Viewer/getStream/1/CHANNEL_ID.amf';
-
- var video_info = [];
-
- var channel_id = cw.document.evaluate(XPATH_CHANNEL_ID, cw.document, null, cw.XPathResult.STRING_TYPE, null).stringValue;
- var video_img = cw.document.evaluate(XPATH_VIDEO_IMG, cw.document, null, cw.XPathResult.STRING_TYPE, null).stringValue;
- var video_uri = URL_AMF.replace('CHANNEL_ID', channel_id);
-
- var data = utils.get(video_uri);
- var videos = this.parse_data(data);
-
- var player = cw.document.getElementsByClassName("player")[0];
-
- video_info.push({
- 'player':player,
- 'video_img':video_img,
- 'videos': videos
- });
-
-
- return video_info;
- },
-
- parse_data : function(data){
- //const REGEX_CDNURL = /cdnUrl\W\W\S(.+?)\x00/;
- const REGEX_LIVEHTTP = /liveHttpUrl\W\W\S(.+?)\x00/;
-
- //var url_rtmp = data.match(REGEX_CDNURL)[1];
- var url_http = data.match(REGEX_LIVEHTTP)[1];
-
- var videos = [];
- //videos.push({'format': 'rtmp', 'url': url_rtmp });
- videos.push({'format': 'm3u8', 'url': url_http });
-
- return videos;
- }
-};
diff --git a/chrome/modules/youtube.jsm b/chrome/modules/youtube.jsm
deleted file mode 100644
index c521f21..0000000
--- a/chrome/modules/youtube.jsm
+++ /dev/null
@@ -1,112 +0,0 @@
-var parser = {
- BASE_URI : 'www.youtube.com',
- API_GET_VIDEO:'http://youtube.com/get_video_info?video_id=VIDEO_ID',
-
- /**
- parse a video on the web site
- */
- parse_site:function(cw) {
- const REGEX_VIDEO_ID_SITE = /watch\?v=([\w\-]{11})/;
- var doc = cw.document;
- var video_info = [];
- var id;
-
- //get the video id from the current url
- if(url_match = doc.URL.match(REGEX_VIDEO_ID_SITE)){
- id = url_match[1];
- }
- else{
- throw('cannot retreive ID of a '+this.BASE_URI+' video on '+doc.URL);
- }
-
- var player_api = doc.getElementById('player-api');
- if(player_api){
- player_api.setAttribute('id', 'vwof_player-api'); //prevent the player-api div to be erased by the missing plugin tv-static message
- if(youtubeUtils.yt_is_wide()){
- player_api.setAttribute("style", "margin:auto;"); //center the player
- }
- }
- else {
- player_api = doc.getElementById('vwof_player-api'); //the page has previously been proceeded
- }
-
- //remove all child from the player api, in case we need to load a new video
- while (player_api.firstChild) {
- player_api.removeChild(player_api.firstChild);
- }
-
- var player = doc.createElement('div');
- player_api.appendChild(player);
-
- var api_video_uri = this.API_GET_VIDEO.replace('VIDEO_ID', id);
- var data = utils.get(api_video_uri);
- var video_data = this.parse_data(data);
- video_data['player'] = player;
-
- //this div overlap with the player when the screen resolution is low
- var guide = doc.getElementById('guide');
- if(guide)guide.style.display = 'none';
-
- video_info.push(video_data);
-
- return video_info;
- },
-
- /**
- parse iframe embed in sites, potentialy several videos
- */
- parse_embed: function(cw) {
- var video_info = [];
- var player;
- const REGEX_VIDEO_ID_IFRAME = /embed\/([\w\-]{11})/;
- const XPATH_PLAYER_IFRAME = "//iframe[contains(@src, '"+this.BASE_URI+"/embed')]";
-
- var xp_res_player = cw.document.evaluate(XPATH_PLAYER_IFRAME, cw.document, null, cw.XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null );
-
- while (player = xp_res_player.iterateNext()) {
-
- var id = player.src.match(REGEX_VIDEO_ID_IFRAME)[1];
- var api_video_uri = this.API_GET_VIDEO.replace('VIDEO_ID', id);
- var data = utils.get(api_video_uri);
-
- var parsed_array = this.parse_data(data);
- parsed_array['player'] = player;
- video_info.push(parsed_array);
- }
-
- return video_info;
- },
-
-
- /**
- this is where the video data are retreived from the enormous json
- returned by the youtube's get_video_info page
- */
- parse_data: function(data){
- var videos = [];
- var assoc_data = utils.url_vars_to_array(data);
-
- var url_encoded_fmt_stream_map = assoc_data['url_encoded_fmt_stream_map'];
- var url_decoded_fmt_stream_map = decodeURIComponent(url_encoded_fmt_stream_map);
- var arr_url_decoded_fmt_stream_map = url_decoded_fmt_stream_map.split(',');
- var i;
-
- for(i=0;i<arr_url_decoded_fmt_stream_map.length;i++){
- var assoc_url_decoded_fmt_stream = utils.url_vars_to_array(arr_url_decoded_fmt_stream_map[i]);
- var encoded_uri = assoc_url_decoded_fmt_stream['url'];
- var decoded_uri = decodeURIComponent(encoded_uri);
- decoded_uri += '&signature='+assoc_url_decoded_fmt_stream['sig']; //add the signature to the decoded url
- var type = decodeURIComponent(assoc_url_decoded_fmt_stream['type']);
- var quality = decodeURIComponent(assoc_url_decoded_fmt_stream['quality']);
-
- videos.push( {'quality': quality, 'format':type, 'url':decoded_uri} );
- }
-
- var video_info = {
- 'video_img': decodeURIComponent(assoc_data['iurl']),
- 'videos': videos
- };
-
- return video_info;
- }
-};
diff --git a/chrome/player.js b/chrome/player.js
deleted file mode 100644
index 809768b..0000000
--- a/chrome/player.js
+++ /dev/null
@@ -1,194 +0,0 @@
-vwofPlayer = {
- /**
- add the player stylecheet link to the head of the document
- */
- add_style:function(doc, style_id){
- var style = doc.createElement('link');
- style.setAttribute('type', 'text/css');
- style.setAttribute('rel', 'stylesheet');
- style.setAttribute('href', 'chrome://vwof/skin/player.css');
- style.setAttribute('id', style_id);
- doc.head.appendChild(style);
- },
- /**
- callback function called when the video selector is clicked
- replace the video selector with a video
- */
- video_selector_click:function(event){
- const doc = event.originalTarget.ownerDocument;
-
- //get the currently selected video link in the video selector
- var l=doc.getElementById('vwof_link_new_tab_'+this.id);
- var url = l.href;
-
- //create the video element
- node_playback = doc.createElement('video');
- node_playback.setAttribute('height', '100%');
- node_playback.setAttribute('width', '100%');
- node_playback.setAttribute('controls', 'controls');
-
- var node_source = doc.createElement('source');
- node_source.setAttribute('src', url);
- node_playback.appendChild(node_source);
-
- //replace the video selector with the playback node
- var video_selector_parent = this.parentNode;
- video_selector_parent.replaceChild(node_playback, this);
- },
- /**
- Create the html code to embed the video selector in the document
- */
- create_video_selector:function(video_info, cw){
- //set the player size depending on the location where embed it
- var cstyle = cw.getComputedStyle(video_info['player']);
- var doc = cw.document;
-
- var h = cstyle.getPropertyValue("height");
- var w = cstyle.getPropertyValue("width");
- if(w == "0px")w="90vw";
- if(h == "0px")h="90vh";
-
- var player_style_size = 'min-width:'+w+';min-height:'+h+';';
- var player_style_image = '';
- video_selector_id = 'vwof_' + Math.floor((Math.random() * 99));
-
- //add the player css if necessary
- const style_id = 'vowf_player_style';
- if(!doc.getElementById(style_id)){
- this.add_style(doc, style_id);
- }
-
- //Create the 'video selector' (a div with detected videos links)
- var video_selector = doc.createElement('div');
- video_selector.setAttribute('class', 'vwof_player');
-
- //identify this video selector if the original element did not have an id
- if(!video_selector.id)video_selector.setAttribute('id', video_selector_id);
-
- //thumbnail
- if(img = video_info['video_img']){
- player_style_image = 'background-image:url('+img+');';
- }
-
- //vwof icon
- var node_image = doc.createElement('img');
- node_image.setAttribute('src', 'chrome://vwof/skin/video-icon.png');
- video_selector.appendChild(node_image);
-
- //select video format and quality
- var prefered_index = 0;
-
- //if only one video format/quality for this video is detected, do not
- //display the selectbox but text with the format/quality
- if(video_info.videos.length == 1){
- var node_span = doc.createElement('span');
- node_span.setAttribute('class', 'vwof_video_info');
- var format = video_info.videos[0].format ? video_info.videos[0].format : '';
- var quality = video_info.videos[0].quality ? video_info.videos[0].quality : '';
- var node_info = doc.createTextNode(format + ' ' + quality);
-
- node_span.appendChild(node_info);
- video_selector.appendChild(node_span);
- }
- else{
- //several format/quality detected for this video
- prefered_index = this.find_prefered_video(video_info.videos);
-
- //creates a select node to display and select all available quality
- var node_select = doc.createElement('select');
- node_select.setAttribute('id', 'vwof_select_video_'+ video_selector_id);
- node_select.setAttribute('class', 'vwof_video_info');
- node_select.addEventListener('click', function(event){
- event.stopPropagation();
- });
-
- //add the options to the selectbox
- for(var i=0;i<video_info.videos.length;i++){
- var node_option = doc.createElement('option');
- node_option.setAttribute('value', video_info.videos[i].url);
-
- var format = video_info.videos[i].format ? video_info.videos[i].format : '';
- var quality = video_info.videos[i].quality ? video_info.videos[i].quality : '';
- var node_option_content = doc.createTextNode(format + ' ' + quality);
-
- if(i == prefered_index){
- node_option.setAttribute('selected', 'true');
- }
-
- node_option.appendChild(node_option_content);
- node_select.appendChild(node_option);
- }
-
- //add the select to the video selector
- video_selector.appendChild(node_select);
-
- //update the open in a new tab link when the selectbox index changes
- node_select.addEventListener('change', function(event){
- var doc = this.ownerDocument;
- var link = doc.getElementById('vwof_link_new_tab_'+video_selector_id);
- link.setAttribute('href', this.options[this.selectedIndex].value);
- });
-
- }
-
- //callback function when the video selector is clicked
- //replace the video selector by the actual video to be played
- video_selector.addEventListener('click', this.video_selector_click);
-
- //open in a new tab link
- var node_link_new_tab = doc.createElement('a');
- node_link_new_tab.setAttribute('id', 'vwof_link_new_tab_'+video_selector_id);
- node_link_new_tab.addEventListener('click', function(event){
- event.stopPropagation();
- });
- node_link_new_tab.setAttribute('href', video_info.videos[prefered_index].url);
- node_link_new_tab.setAttribute('target', '_blank');
- var a_content_new_tab = doc.createTextNode('Open in a new tab');
- node_link_new_tab.appendChild(a_content_new_tab);
- video_selector.appendChild(node_link_new_tab);
-
- //display media source
- if(video_info['source']){
- var node_span = doc.createElement('span');
- var node_source = doc.createTextNode('Powered by ' + video_info['source']);
- node_span.setAttribute('style', 'bottom:1px;left:1px;');
- node_span.appendChild(node_source);
- video_selector.appendChild(node_span);
- }
-
- //apply style to the player
- video_selector.setAttribute('style', player_style_image + player_style_size);
-
- return video_selector;
- },
-
- /**
- returns the index of the video which the format and quality matches most the preference settings
- */
- find_prefered_video: function(videos){
- var candidate = [];
- var prefManager = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
- var prefered_format = prefManager.getCharPref("extensions.vwof.prefered_format");
- var prefered_quality = prefManager.getCharPref("extensions.vwof.prefered_quality");
- var i;
-
- //match quality
- for(i=0;i<videos.length;i++){
- if(videos[i].quality && videos[i].quality == prefered_quality){
- candidate.push(i);
- }
- }
-
- //match format over quality selected cantidates
- for(i=0;i<candidate.length;i++){
- if(videos[candidate[i]].format && videos[candidate[i]].format.match(prefered_format)){
- return candidate[i];
- }
- }
-
- //return the first candidat if only one video is detected
- //if no valide candidate, return the video in the middle of the list
- var index = candidate.length > 0 ? candidate[0] : Math.floor(videos.length / 2);
- return index;
- }
-};
diff --git a/chrome/prefs.js b/chrome/prefs.js
deleted file mode 100644
index 2764774..0000000
--- a/chrome/prefs.js
+++ /dev/null
@@ -1,47 +0,0 @@
-function getGenericPref(branch,prefName)
-{
- switch (branch.getPrefType(prefName))
- {
- default:
- case 0: return undefined; // PREF_INVALID
- case 32: return getUCharPref(prefName,branch); // PREF_STRING
- case 64: return branch.getIntPref(prefName); // PREF_INT
- case 128: return branch.getBoolPref(prefName); // PREF_BOOL
- }
-}
-
-function setGenericPref(branch,prefName,prefValue)
-{
- switch (typeof prefValue)
- {
- case "string":
- setUCharPref(prefName,prefValue,branch);
- return;
- case "number":
- branch.setIntPref(prefName,prefValue);
- return;
- case "boolean":
- branch.setBoolPref(prefName,prefValue);
- return;
- }
-}
-
-function setDefaultPref(prefBranch, prefName, prefValue)
-{
- var defaultBranch = Services.prefs.getDefaultBranch(prefBranch);
- setGenericPref(defaultBranch,prefName,prefValue);
-}
-
-function getUCharPref(prefName,branch) // Unicode getCharPref
-{
- branch = branch ? branch : Services.prefs;
- return branch.getComplexValue(prefName, Components.interfaces.nsISupportsString).data;
-}
-function setUCharPref(prefName,text,branch) // Unicode setCharPref
-{
- var string = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(Components.interfaces.nsISupportsString);
- string.data = text;
- branch = branch ? branch : Services.prefs;
- branch.setComplexValue(prefName, Components.interfaces.nsISupportsString, string);
-}
diff --git a/chrome/prefs.xul b/chrome/prefs.xul
deleted file mode 100644
index fcef025..0000000
--- a/chrome/prefs.xul
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-<prefwindow id="vwofPrefWindow"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <prefpane id="vwof_pref_general" label="General">
-
- <preferences>
- <preference id="extensions.vwof.activate_onload"
- name="extensions.vwof.activate_onload"
- type="bool"/>
- <preference id="plugins.notifyMissingFlash"
- name="plugins.notifyMissingFlash"
- type="bool"/>
- <preference id="full-screen-api.approval-required"
- name="full-screen-api.approval-required"
- type="bool"/>
- </preferences>
-
- <checkbox label="Detect videos on page load"
- preference="extensions.vwof.activate_onload"/>
- <checkbox label="Enable missing flash plugin warnings"
- preference="plugins.notifyMissingFlash"/>
- <checkbox label="Enable approval message when fullscreen"
- preference="full-screen-api.approval-required"/>
-
- </prefpane>
-
- <prefpane id="vwof_pref_prefered_format" label="Prefered format">
- <preferences>
- <preference id="extensions.vwof.prefered_quality"
- name="extensions.vwof.prefered_quality"
- type="string" />
- <preference id="extensions.vwof.prefered_format"
- name="extensions.vwof.prefered_format"
- type="string" />
- </preferences>
-
- <label value="Prefered format" control="prefered_format" />
- <menulist id="prefered_format" preference="extensions.vwof.prefered_format"
- preference-editable="true">
- <menupopup>
- <menuitem label="webm" value="webm"/>
- <menuitem label="mp4" value="mp4"/>
- <menuitem label="avi" value="avi"/>
- <menuitem label="flv" value="flv"/>
- </menupopup>
- </menulist>
-
- <label value="Prefered quality" control="prefered_quality" />
- <menulist id="prefered_quality" preference="extensions.vwof.prefered_quality"
- preference-editable="true">
- <menupopup>
- <menuitem label="hd1080" value="hd1080"/>
- <menuitem label="hd720" value="hd720"/>
- <menuitem label="medium" value="medium"/>
- <menuitem label="low" value="low"/>
- </menupopup>
- </menulist>
-
- </prefpane>
-
- <prefpane id="vwof_pref_modules" label="modules">
- <script type="application/x-javascript" src="chrome://vwof/content/browserOverlay.js" />
- <script type="application/x-javascript" src="chrome://vwof/content/youtube_utils.js" />
-
- <preferences>
- <preference id="extensions.vwof.modules" name="extensions.vwof.modules" type="string"/>
- </preferences>
-
- <checkbox id="vwof_yt_wide" label="YouTube theater mode"
- oncommand="vwofChrome.youtubeUtils.toggle_yt_wide(event)"/>
- </prefpane>
-
- <script src="youtube_utils.js"/>
- <script src="vwof.js"/>
- <script src="list_modules.js"/>
-
-</prefwindow>
-
diff --git a/chrome/utils.js b/chrome/utils.js
deleted file mode 100644
index cdc8dc6..0000000
--- a/chrome/utils.js
+++ /dev/null
@@ -1,55 +0,0 @@
-var utils = {
-
- get:function(uri){
- const XMLHttpRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1",
- "nsIXMLHttpRequest",
- "open");
-
- let xmlhttp = XMLHttpRequest("GET", uri, false);
- xmlhttp.send();
- return xmlhttp.responseText;
- },
-
- url_vars_to_array: function(url){
- var arr_variable = url.split('&');
- var arr_assoc = {};
- var i;
-
- for(i=0;i<arr_variable.length;i++){
- var arr_tmp = arr_variable[i].split('=');
- arr_assoc[arr_tmp[0]] = arr_tmp[1];
- }
- return arr_assoc;
- },
-
- // return the two-digit hexadecimal code for a byte
- toHexString:function(charCode)
- {
- return ("0" + charCode.toString(16)).slice(-2);
- },
-
- // do a md5 sum
- md5:function(str){
- var converter =
- Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].
- createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
-
- // we use UTF-8 here, you can choose other encodings.
- converter.charset = "UTF-8";
- // result is an out parameter,
- // result.value will contain the array length
- var result = {};
- // data is an array of bytes
- var data = converter.convertToByteArray(str, result);
- var ch = Components.classes["@mozilla.org/security/hash;1"]
- .createInstance(Components.interfaces.nsICryptoHash);
- ch.init(ch.MD5);
- ch.update(data, data.length);
- var hash = ch.finish(false);
-
- // convert the binary hash data to a hex string.
- var s = [this.toHexString(hash.charCodeAt(i)) for (i in hash)].join("");
-
- return s;
- }
-};
diff --git a/chrome/vwof.js b/chrome/vwof.js
deleted file mode 100644
index e251ec4..0000000
--- a/chrome/vwof.js
+++ /dev/null
@@ -1,89 +0,0 @@
-var vwof= {
- parsers:{}, //hash of the parsers (loaded from jsm modules)
- parser_name:["blip", "dailymotion", "FC2", "HTML5", "niconico", "youtube", "ScreenWaveMedia"],
-
- /**
- Load modules listed in the extensions.vwof.modules pref variable to this.parsers hash
- */
- load_modules:function(){
- for(var i=0;i<this.parser_name.length;i++){
- let key_parser = this.parser_name[i];
- let context = {};
- let res = 'chrome://vwof/content/modules/'+key_parser+'.jsm';
- Services.scriptloader.loadSubScript(res, context, "UTF-8");
- this.parsers[key_parser] = context;
- }
- },
- set_parsers_activation:function(){
- //check in the preferences : activated a parser on page load or not
- Components.utils.import("resource://gre/modules/Services.jsm");
- var prefManager = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
-
- var modules_list = prefManager.getCharPref("extensions.vwof.modules");
- var modules = JSON.parse(modules_list); //parser / value from the preferences
-
- for(var key_parser in this.parsers){
- var parser = this.parsers[key_parser].parser;
-
- //if a pref is defined for this parser
- if(modules[key_parser])
- parser['activated'] = modules[key_parser]?true:false;
- else
- parser['activated'] = false;
- }
- },
- getVideoInfo:function (cw) {
- var video_info = []; // array of video_data
- var has_parsed_site = false;
-
- for(var key_parser in this.parsers){
- try{
- var parser = this.parsers[key_parser].parser;
- if(parser['activated'] != true)continue;
- var video_data = []; //array of video links with quality
-
- //if the parser has a URI and it's the current location
- if(parser.BASE_URI && cw.location.hostname == parser.BASE_URI){
- video_data = parser.parse_site(cw);
- has_parsed_site = true;
- }
- else if(parser.parse_embed){
- video_data = parser.parse_embed(cw);
- }
-
- //if there is at least a video url retreived from the parser
- if(video_data.length >= 1){
- //set the source (name of the parser)
- for(var i=0;i < video_data.length;i++){
- video_data[i]['source'] = this.parsers[key_parser].name;
- }
-
- //concat the chunks of video(s) from this parser
- video_info = video_info.concat(video_data);
- }
- }
- catch(err){
- Components.utils.reportError("vwof plugin, exception in "+key_parser+": "+err);
- };
-
- //official web sites do not embed several videos, so don't use other parsers
- if(has_parsed_site){break;}
- }
-
- return video_info;
- },
-
- detectVideo:function(cw) {
- var video_info = this.getVideoInfo(cw);
-
- for (var i = 0; i < video_info.length; i++) {
- if(video_info[i]['player']){
- var replace_location = video_info[i]['player'];
- var player = vwofPlayer.create_video_selector(video_info[i], cw);
- var replace_parent = replace_location.parentNode;
- replace_parent.replaceChild(player, replace_location);
- }
- }
- }
-};
diff --git a/chrome/youtube_utils.js b/chrome/youtube_utils.js
deleted file mode 100644
index c0e1f0c..0000000
--- a/chrome/youtube_utils.js
+++ /dev/null
@@ -1,40 +0,0 @@
-var youtubeUtils = {
- toggle_yt_wide:function (event){
- var c = event.target.hasAttribute('checked')?1:0;
- var wide;
- if(c == 1){
- wide = "wide=1;";
- }
- else{
- wide = "wide=0;";
- }
-
- var url = "http://youtube.com";
- var cookieString = wide+"domain=youtube.com;expires=Fri, 31 Dec 9999 23:59:59 GMT";
-
- var cookieUri = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService).newURI(url, null, null);
- Components.classes["@mozilla.org/cookieService;1"].getService(Components.interfaces.nsICookieService).setCookieString(cookieUri, null, cookieString, null);
- },
-
- yt_is_wide:function(){
- var wide = false;
- try
- {
- var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
- var uri = ios.newURI("http://www.youtube.com/", null, null);
-
- var cookieSvc = Components.classes["@mozilla.org/cookieService;1"].getService(Components.interfaces.nsICookieService);
- var cookie = cookieSvc.getCookieString(uri, null);
-
- if(cookie.indexOf("wide=1") != -1){
- wide=true;
- }
- }
- catch (errorInfo)
- {
- Components.utils.reportError(errorInfo);
- }
- return wide;
- }
-};
diff --git a/configure b/configure
new file mode 100755
index 0000000..5c3dd8b
--- /dev/null
+++ b/configure
@@ -0,0 +1,154 @@
+#!/bin/bash
+
+files='find . -type f -not \( -path "*$0*" -o -path "*git*" -o -path "*skin*" -o -path "*.md*" -o -ipath "*make*" \)'
+
+function replace {
+ fieldName=$1
+ oldValue=$2
+ newValue=$3
+ verbose=$4
+ forced=$5
+
+ if [[ $forced -ne 1 ]]; then
+ if [[ $oldValue == $newValue ]]; then
+ echo "The add-on already uses this $fieldName."
+ exit 1
+ fi
+ if [ -z "`eval $files | xargs egrep $oldValue -l`" ]; then
+ echo "ERROR: The addon's $fieldName was already customized."
+ echo "Please clone the repository again to create a new add-on."
+ exit 1
+ fi
+ fi
+
+ if [[ $verbose -ne 1 ]]; then
+ read -p "This add-on's $fieldName will be changed. Continue? (y/n)? "
+ else
+ read -p "This add-on's $fieldName will be changed from '$oldValue' to '$newValue'. Continue? (y/n)? "
+ fi
+
+ if [[ $REPLY == "y" ]]; then
+ if [[ "`uname`" == "Linux" ]]; then
+ eval $files -print0 | xargs -0 sed -i 's/'"$oldValue"'/'"$newValue"'/g'
+ elif [[ "`uname`" == "Darwin" ]]; then
+ eval $files -print0 | xargs -0 sed -i '' 's/'"$oldValue"'/'"$newValue"'/g'
+ else
+ echo "ERROR: Your operating system is not supported yet."
+ exit 1
+ fi
+ printf "Done."
+
+ if [ $verbose == "1" ]; then
+ echo " Modified files:"
+ eval $files | xargs egrep $newValue -l
+ printf "\n"
+ else
+ printf "\n\n"
+ fi
+ else
+ echo "WARNING: No changes were made to the addon's $fieldName."
+ exit 1
+ fi
+}
+
+function proxy {
+ profileName=$1
+ addonDir=$2
+ addonId=`sed -n 's/<em:id>\(.*\)@mozilla.com<\/em:id>/\1/p' install.rdf | head -n 1 | tr -d ' '`
+ forced=$3
+
+ if [[ "`uname`" == "Linux" ]]; then
+ profile="~/.mozilla/firefox/*$profileName"
+ elif [[ "`uname`" == "Darwin" ]]; then
+ profile="~/Library/Application\ Support/Firefox/Profiles/*$profileName"
+ else
+ echo "ERROR: Your operating system is not supported yet."
+ echo "Please refer to the readme for manually creating an extension proxy file."
+ exit 1
+ fi
+
+ if [[ $forced -ne 1 ]]; then
+ read -p "This '$addonId' extension will be linked with the '$profileName' profile. Continue? (y/n)? "
+ if [[ $REPLY != "y" ]]; then
+ exit 1
+ fi
+ fi
+
+ if [[ -n "`eval cd $profile 2>&1`" ]]; then
+ echo "ERROR: The specified profile does not seem to exist at $profile"
+ echo "Please refer to the readme for manually creating an extension proxy file."
+ exit 1
+ fi
+
+ eval cd $profile
+ mkdir extensions &> /dev/null
+ touch extensions/$addonId at mozilla.com
+ echo $addonDir > extensions/$addonId at mozilla.com
+ echo "Done."
+
+ printf "\n"
+ echo "This add-on will be installed in the '$profileName' profile next time you open Firefox."
+ echo "Tip: whenever you change something, go to about:addons in Firefox and re-enable the add-on to quickly update it."
+}
+
+if [[ $# -eq 0 ]]; then
+ echo "Customize this add-on template:"
+ echo " -i <identifier> Specify the id, used to identify resources and files in this bundle"
+ echo " -n <project name> Specify the name, displayed in the Toolbox and various Firefox menus"
+ echo " -v <version> Specify the version, useful for tracking bugs"
+ echo " -d <description> Specify the description, shown on addons.mozilla.org"
+ echo " -a <autor name> Specify the author, shown on addons.mozilla.org"
+ echo " -h <url> Specify the add-on's support homepage url"
+ echo " -P <profile> Create an extension proxy file for this add-on, for the specified profile"
+ exit 1
+fi
+
+while getopts "i:n:v:d:a:h:P:" opt; do
+ case $opt in
+ i)
+ replace "id" "my-addon" $OPTARG 1
+ ;;
+ n)
+ replace "name" "MyAddon" $OPTARG 1
+ ;;
+ v)
+ regex="\(<em:version>\).*\(<\/em:version>\)"
+ replace "version" $regex '\1'"$OPTARG"'\2' 0 1
+ ;;
+ d)
+ regex="\(<em:description>\).*\(<\/em:description>\)"
+ replace "description" $regex '\1'"$OPTARG"'\2' 0 1
+ ;;
+ a)
+ regex="\(<em:creator>\).*\(<\/em:creator>\)"
+ replace "author" $regex '\1'"$OPTARG"'\2' 0 1
+ ;;
+ h)
+ regex="\(<em:homepageURL>\).*\(<\/em:homepageURL>\)"
+ replace "homepage" $regex '\1'"$OPTARG"'\2' 0 1
+ ;;
+ P)
+ INSTALL_PROFILE=$OPTARG
+ ;;
+ \?)
+ echo "Invalid option: -$OPTARG" >&2
+ exit 1
+ ;;
+ :)
+ echo "Option -$OPTARG requires an argument." >&2
+ exit 1
+ ;;
+ esac
+done
+
+if [[ $INSTALL_PROFILE ]]; then
+ proxy $INSTALL_PROFILE `pwd`
+else
+ read -p "WARNING: No user profile specified. Do you want this add-on to be installed next time you open Firefox? (y/n) "
+ if [[ $REPLY == "y" ]]; then
+ proxy "default" `pwd` 1
+ else
+ echo "WARNING: This add-on won't be automatically installed next time you open Firefox."
+ echo "For a faster development process, please refer to the readme for creating an extension proxy file."
+ fi
+fi
diff --git a/content/list_modules.js b/content/list_modules.js
index 9bda604..b9ff001 100644
--- a/content/list_modules.js
+++ b/content/list_modules.js
@@ -1,7 +1,3 @@
-var checkbox_wide = document.getElementById("vwof_yt_wide");
-var wide = youtubeUtils.yt_is_wide();
-checkbox_wide.setAttribute("checked", wide);
-
var prefPane = document.getElementById('vwof_pref_modules');
var s_modules = document.getElementById('extensions.vwof.modules').value;
modules = JSON.parse(s_modules);
diff --git a/content/listener.js b/content/listener.js
index 4c54182..46bf7e7 100644
--- a/content/listener.js
+++ b/content/listener.js
@@ -1,5 +1,38 @@
+//Window listener for native UI (android)
+var menuId;
+var windowListenerNative = {
+ onOpenWindow: function(aWindow) {
+ // Wait for the window to finish loading
+ let domWindow = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow);
+ domWindow.addEventListener("UIReady", function onLoad() {
+ domWindow.removeEventListener("UIReady", onLoad, false);
+ loadIntoWindow(domWindow);
+ }, false);
+ },
+
+ onCloseWindow: function(aWindow) {},
+ onWindowTitleChange: function(aWindow, aTitle) {}
+};
+
+function loadIntoWindow(window) {
+ var stringBundle = Services.strings.createBundle('chrome://vwof/locale/listener.properties?' + Math.random());
+ var detectvideo_label = stringBundle.GetStringFromName('detectvideo');
+ menuId = window.NativeWindow.menu.add(detectvideo_label, null, function() {
+ vwof.detectVideo(window.content);
+ });
+ window.BrowserApp.deck.addEventListener("DOMContentLoaded", onPageLoad, false);
+}
+
+function unloadFromWindow(window) {
+ if (!window || menuId == undefined)
+ return;
+
+ window.NativeWindow.menu.remove(menuId);
+ window.BrowserApp.deck.removeEventListener("DOMContentLoaded", arguments.callee, false);
+}
+
+// Window listener for Desktop
var windowListener = {
- ignoreFrames:true,
onOpenWindow: function (aXULWindow) {
let aDOMWindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow);
aDOMWindow.addEventListener("load", function () {
@@ -12,7 +45,7 @@ var windowListener = {
while (XULWindows.hasMoreElements()) {
let aXULWindow = XULWindows.getNext();
let aDOMWindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow);
- windowListener.loadIntoWindow(aDOMWindow, aXULWindow);
+ this.loadIntoWindow(aDOMWindow, aXULWindow);
}
// Listen to new windows
Services.wm.addListener(windowListener);
@@ -32,21 +65,22 @@ var windowListener = {
if (!aDOMWindow) {
return;
}
+
+ init_keyboard_shortcut(aDOMWindow);
+
if (aDOMWindow.gBrowser) {
- aDOMWindow.gBrowser.addEventListener('DOMContentLoaded', listenPageLoad, false);
+ aDOMWindow.gBrowser.addEventListener('DOMContentLoaded', onPageLoad, false);
if (aDOMWindow.gBrowser.tabContainer) {
//start - go through all tabs in this window we just added to
var tabs = aDOMWindow.gBrowser.tabContainer.childNodes;
for (var i = 0; i < tabs.length; i++) {
var tabBrowser = tabs[i].linkedBrowser;
var win = tabBrowser.contentWindow;
- loadIntoContentWindowAndItsFrames(win);
}
//end - go through all tabs in this window we just added to
} else {
//does not have tabContainer
var win = aDOMWindow.gBrowser.contentWindow;
- loadIntoContentWindowAndItsFrames(win);
}
}
},
@@ -55,7 +89,7 @@ var windowListener = {
return;
}
if (aDOMWindow.gBrowser) {
- aDOMWindow.gBrowser.removeEventListener('DOMContentLoaded', listenPageLoad, false);
+ aDOMWindow.gBrowser.removeEventListener('DOMContentLoaded', onPageLoad, false);
if (aDOMWindow.gBrowser.tabContainer) {
//has tabContainer
//start - go through all tabs in this window we just added to
@@ -63,54 +97,17 @@ var windowListener = {
for (var i = 0; i < tabs.length; i++) {
var tabBrowser = tabs[i].linkedBrowser;
var win = tabBrowser.contentWindow;
- unloadFromContentWindowAndItsFrames(win);
}
//end - go through all tabs in this window we just added to
} else {
//does not have tabContainer
var win = aDOMWindow.gBrowser.contentWindow;
- unloadFromContentWindowAndItsFrames(win);
}
} else {
//window does not have gBrowser
}
}
};
-/*end - windowlistener*/
-
-function loadIntoContentWindowAndItsFrames(theWin) {
- var frames = theWin.frames;
- var winArr = [theWin];
- for (var j = 0; j < frames.length; j++) {
- winArr.push(frames[j].window);
- }
- for (var j = 0; j < winArr.length; j++) {
- var doc = winArr[j].document;
- //START - edit below here
-
- if (this.ignoreFrames) {
- break;
- }
- //END - edit above here
- }
-}
-
-function unloadFromContentWindowAndItsFrames(theWin) {
- var frames = theWin.frames;
- var winArr = [theWin];
- for (var j = 0; j < frames.length; j++) {
- winArr.push(frames[j].window);
- }
-
- for (var j = 0; j < winArr.length; j++) {
- var doc = winArr[j].document;
- //START - edit below here
- if (this.ignoreFrames) {
- break;
- }
- //END - edit above here
- }
-}
/**
Listener that observe the prefs variables
@@ -119,14 +116,9 @@ function unloadFromContentWindowAndItsFrames(theWin) {
*/
var PrefObserver = {
register: function() {
- // First we'll need the preference services to look for preferences.
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
-
- // For this.branch we ask for the preferences
this.branch = prefService.getBranch("extensions.vwof.");
-
- // Finally add the observer.
this.branch.addObserver("", this, false);
},
diff --git a/content/options.xul b/content/options.xul
new file mode 100644
index 0000000..78c77b7
--- /dev/null
+++ b/content/options.xul
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE mydialog SYSTEM "chrome://vwof/locale/options.dtd">
+
+<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <setting type="control"
+ title="&list_of_modules_title;"
+ desc="&list_of_modules_desc;">
+ <button id="extensions-vwof-module-list"
+ label="&list_of_modules_button_label;"
+ oncommand="window.open('chrome://vwof/content/prefs_modules_list.xul');"/>
+ </setting>
+
+ <setting title="&detect_video_onload_title;"
+ desc="&detect_video_onload_desc;"
+ pref="extensions.vwof.activate_onload"
+ type="bool"/>
+ <setting title="&missing_flash_plugin_warning_title;"
+ desc="&missing_flash_plugin_warning_desc;"
+ pref="plugins.notifyMissingFlash"
+ type="bool"/>
+ <setting title="&approval_message_title;"
+ desc="&approval_message_desc;"
+ pref="full-screen-api.approval-required"
+ type="bool"/>
+
+ <setting
+ type="menulist"
+ desc="&prefered_format_desc;"
+ title="&prefered_format_title;"
+ id="prefered_format"
+ pref="extensions.vwof.prefered_format">
+ <menulist>
+ <menupopup>
+ <menuitem label="webm" value="webm"/>
+ <menuitem label="mp4" value="mp4"/>
+ <menuitem label="avi" value="avi"/>
+ <menuitem label="flv" value="flv"/>
+ </menupopup>
+ </menulist>
+ </setting>
+
+ <setting
+ type="menulist"
+ id="prefered_quality"
+ title="&prefered_quality_title;"
+ desc="&prefered_quality_desc;"
+ pref="extensions.vwof.prefered_quality">
+ <menulist>
+ <menupopup>
+ <menuitem label="hd1080" value="hd1080"/>
+ <menuitem label="hd720" value="hd720"/>
+ <menuitem label="&prefered_quality_medium;" value="medium"/>
+ <menuitem label="&prefered_quality_low;" value="low"/>
+ </menupopup>
+ </menulist>
+ </setting>
+
+</vbox>
diff --git a/content/player.js b/content/player.js
index 809768b..a65e1ec 100644
--- a/content/player.js
+++ b/content/player.js
@@ -17,12 +17,13 @@ vwofPlayer = {
video_selector_click:function(event){
const doc = event.originalTarget.ownerDocument;
- //get the currently selected video link in the video selector
+ //get the currently selected video link from the video selector
+ //the open in a new tab link is the direct link to the video
var l=doc.getElementById('vwof_link_new_tab_'+this.id);
var url = l.href;
//create the video element
- node_playback = doc.createElement('video');
+ var node_playback = doc.createElement('video');
node_playback.setAttribute('height', '100%');
node_playback.setAttribute('width', '100%');
node_playback.setAttribute('controls', 'controls');
@@ -36,7 +37,7 @@ vwofPlayer = {
video_selector_parent.replaceChild(node_playback, this);
},
/**
- Create the html code to embed the video selector in the document
+ Create the html code which embed the video selector in the document
*/
create_video_selector:function(video_info, cw){
//set the player size depending on the location where embed it
@@ -104,8 +105,10 @@ vwofPlayer = {
//add the options to the selectbox
for(var i=0;i<video_info.videos.length;i++){
+ var url = video_info.videos[i].url;
+
var node_option = doc.createElement('option');
- node_option.setAttribute('value', video_info.videos[i].url);
+ node_option.setAttribute('value', url);
var format = video_info.videos[i].format ? video_info.videos[i].format : '';
var quality = video_info.videos[i].quality ? video_info.videos[i].quality : '';
@@ -114,7 +117,7 @@ vwofPlayer = {
if(i == prefered_index){
node_option.setAttribute('selected', 'true');
}
-
+
node_option.appendChild(node_option_content);
node_select.appendChild(node_option);
}
@@ -141,9 +144,14 @@ vwofPlayer = {
node_link_new_tab.addEventListener('click', function(event){
event.stopPropagation();
});
+
+ //get the open in a new tab link localized text
+ var stringBundle = Services.strings.createBundle('chrome://vwof/locale/player.properties?' + Math.random());
+ var newtab_label = stringBundle.GetStringFromName('newtab');
+
node_link_new_tab.setAttribute('href', video_info.videos[prefered_index].url);
node_link_new_tab.setAttribute('target', '_blank');
- var a_content_new_tab = doc.createTextNode('Open in a new tab');
+ var a_content_new_tab = doc.createTextNode(newtab_label);
node_link_new_tab.appendChild(a_content_new_tab);
video_selector.appendChild(node_link_new_tab);
diff --git a/content/prefs.xul b/content/prefs.xul
deleted file mode 100644
index fcef025..0000000
--- a/content/prefs.xul
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-<prefwindow id="vwofPrefWindow"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <prefpane id="vwof_pref_general" label="General">
-
- <preferences>
- <preference id="extensions.vwof.activate_onload"
- name="extensions.vwof.activate_onload"
- type="bool"/>
- <preference id="plugins.notifyMissingFlash"
- name="plugins.notifyMissingFlash"
- type="bool"/>
- <preference id="full-screen-api.approval-required"
- name="full-screen-api.approval-required"
- type="bool"/>
- </preferences>
-
- <checkbox label="Detect videos on page load"
- preference="extensions.vwof.activate_onload"/>
- <checkbox label="Enable missing flash plugin warnings"
- preference="plugins.notifyMissingFlash"/>
- <checkbox label="Enable approval message when fullscreen"
- preference="full-screen-api.approval-required"/>
-
- </prefpane>
-
- <prefpane id="vwof_pref_prefered_format" label="Prefered format">
- <preferences>
- <preference id="extensions.vwof.prefered_quality"
- name="extensions.vwof.prefered_quality"
- type="string" />
- <preference id="extensions.vwof.prefered_format"
- name="extensions.vwof.prefered_format"
- type="string" />
- </preferences>
-
- <label value="Prefered format" control="prefered_format" />
- <menulist id="prefered_format" preference="extensions.vwof.prefered_format"
- preference-editable="true">
- <menupopup>
- <menuitem label="webm" value="webm"/>
- <menuitem label="mp4" value="mp4"/>
- <menuitem label="avi" value="avi"/>
- <menuitem label="flv" value="flv"/>
- </menupopup>
- </menulist>
-
- <label value="Prefered quality" control="prefered_quality" />
- <menulist id="prefered_quality" preference="extensions.vwof.prefered_quality"
- preference-editable="true">
- <menupopup>
- <menuitem label="hd1080" value="hd1080"/>
- <menuitem label="hd720" value="hd720"/>
- <menuitem label="medium" value="medium"/>
- <menuitem label="low" value="low"/>
- </menupopup>
- </menulist>
-
- </prefpane>
-
- <prefpane id="vwof_pref_modules" label="modules">
- <script type="application/x-javascript" src="chrome://vwof/content/browserOverlay.js" />
- <script type="application/x-javascript" src="chrome://vwof/content/youtube_utils.js" />
-
- <preferences>
- <preference id="extensions.vwof.modules" name="extensions.vwof.modules" type="string"/>
- </preferences>
-
- <checkbox id="vwof_yt_wide" label="YouTube theater mode"
- oncommand="vwofChrome.youtubeUtils.toggle_yt_wide(event)"/>
- </prefpane>
-
- <script src="youtube_utils.js"/>
- <script src="vwof.js"/>
- <script src="list_modules.js"/>
-
-</prefwindow>
-
diff --git a/content/prefs_modules_list.xul b/content/prefs_modules_list.xul
new file mode 100644
index 0000000..8a69cce
--- /dev/null
+++ b/content/prefs_modules_list.xul
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+
+<prefwindow id="vwofPrefWindow"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <prefpane id="vwof_pref_modules" label="modules">
+ <preferences>
+ <preference id="extensions.vwof.modules" name="extensions.vwof.modules" type="string"/>
+ </preferences>
+ </prefpane>
+
+ <script src="vwof.js"/>
+ <script src="list_modules.js"/>
+
+</prefwindow>
diff --git a/content/vwof.js b/content/vwof.js
index e251ec4..fbb34ed 100644
--- a/content/vwof.js
+++ b/content/vwof.js
@@ -1,6 +1,6 @@
var vwof= {
parsers:{}, //hash of the parsers (loaded from jsm modules)
- parser_name:["blip", "dailymotion", "FC2", "HTML5", "niconico", "youtube", "ScreenWaveMedia"],
+ parser_name:["blip", "dailymotion", "FC2", "HTML5", "niconico", "ScreenWaveMedia"],
/**
Load modules listed in the extensions.vwof.modules pref variable to this.parsers hash
@@ -56,7 +56,7 @@ var vwof= {
if(video_data.length >= 1){
//set the source (name of the parser)
for(var i=0;i < video_data.length;i++){
- video_data[i]['source'] = this.parsers[key_parser].name;
+ video_data[i]['source'] = key_parser
}
//concat the chunks of video(s) from this parser
diff --git a/content/youtube_utils.js b/content/youtube_utils.js
deleted file mode 100644
index c0e1f0c..0000000
--- a/content/youtube_utils.js
+++ /dev/null
@@ -1,40 +0,0 @@
-var youtubeUtils = {
- toggle_yt_wide:function (event){
- var c = event.target.hasAttribute('checked')?1:0;
- var wide;
- if(c == 1){
- wide = "wide=1;";
- }
- else{
- wide = "wide=0;";
- }
-
- var url = "http://youtube.com";
- var cookieString = wide+"domain=youtube.com;expires=Fri, 31 Dec 9999 23:59:59 GMT";
-
- var cookieUri = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService).newURI(url, null, null);
- Components.classes["@mozilla.org/cookieService;1"].getService(Components.interfaces.nsICookieService).setCookieString(cookieUri, null, cookieString, null);
- },
-
- yt_is_wide:function(){
- var wide = false;
- try
- {
- var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
- var uri = ios.newURI("http://www.youtube.com/", null, null);
-
- var cookieSvc = Components.classes["@mozilla.org/cookieService;1"].getService(Components.interfaces.nsICookieService);
- var cookie = cookieSvc.getCookieString(uri, null);
-
- if(cookie.indexOf("wide=1") != -1){
- wide=true;
- }
- }
- catch (errorInfo)
- {
- Components.utils.reportError(errorInfo);
- }
- return wide;
- }
-};
diff --git a/defaults/preferences/vwof.js b/defaults/preferences/vwof.js
deleted file mode 100644
index 4090ad2..0000000
--- a/defaults/preferences/vwof.js
+++ /dev/null
@@ -1,3 +0,0 @@
-pref("extensions.vwof.prefered_quality", 'medium');
-pref("extensions.vwof.prefered_format", 'webm');
-pref("extensions.vwof.modules", '{"HTML5":1, "springboard":1, "blip":1, "youtube":1, "dew":1, "SWM":1, "dailymotion":1, "ustream":1, "niconico":1, "FC2":1}');
diff --git a/install.rdf b/install.rdf
index 6de29d7..493e717 100755
--- a/install.rdf
+++ b/install.rdf
@@ -9,7 +9,7 @@
<em:id>vwof at drev.com</em:id>
<!-- A version string identifying the version of the add-on. -->
- <em:version>2.0.2</em:version>
+ <em:version>3.1.1</em:version>
<!-- The name of the add-on; intended for display in the UI. -->
<em:name>Video WithOut Flash</em:name>
@@ -21,7 +21,17 @@
<em:creator>DREVET Olivier</em:creator>
<!-- A link to the add-on home page to display in the user interface. -->
- <em:homepageURL>http://mozilla.org</em:homepageURL>
+ <em:homepageURL>http://olivier.drevet.free.fr</em:homepageURL>
+
+ <!-- Options. -->
+ <em:optionsType>2</em:optionsType>
+ <em:optionsURL>chrome://vwof/content/options.xul</em:optionsURL>
+
+ <!-- An integer value representing the type of add-on. -->
+ <em:type>2</em:type> <!-- Extensions -->
+
+ <!-- Tells the application whether the extension is boot-strappable. -->
+ <em:bootstrap>true</em:bootstrap>
<!-- Target Application this extension can install into,
with minimum and maximum supported versions. -->
@@ -30,16 +40,18 @@
<!-- Mozilla Firefox -->
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>27.0</em:minVersion>
- <em:maxVersion>34.0</em:maxVersion>
+ <em:maxVersion>37.*</em:maxVersion>
</Description>
</em:targetApplication>
- <!-- An integer value representing the type of add-on. -->
- <em:type>2</em:type> <!-- Extensions -->
-
- <!-- Tells the application whether the extension is boot-strappable. -->
- <em:bootstrap>true</em:bootstrap>
+ <em:targetApplication>
+ <Description>
+ <!-- Mozilla Firefox Mobile -->
+ <em:id>{aa3c5121-dab2-40e2-81ca-7ea25febc110}</em:id>
+ <em:minVersion>27.0</em:minVersion>
+ <em:maxVersion>37.*</em:maxVersion>
+ </Description>
+ </em:targetApplication>
- <em:optionsURL>chrome://vwof/content/prefs.xul</em:optionsURL>
</Description>
</RDF>
diff --git a/locale/en-US/listener.properties b/locale/en-US/listener.properties
new file mode 100644
index 0000000..16959b7
--- /dev/null
+++ b/locale/en-US/listener.properties
@@ -0,0 +1 @@
+detectvideo=Detect Videos
\ No newline at end of file
diff --git a/locale/en-US/options.dtd b/locale/en-US/options.dtd
new file mode 100644
index 0000000..f2b4eda
--- /dev/null
+++ b/locale/en-US/options.dtd
@@ -0,0 +1,15 @@
+<!ENTITY list_of_modules_title "List of modules">
+<!ENTITY list_of_modules_desc "Display the list of modules to enable/disable">
+<!ENTITY list_of_modules_button_label "Display Modules List">
+<!ENTITY detect_video_onload_title "Detect videos on page load">
+<!ENTITY detect_video_onload_desc "If checked, the playable video source will be detected when the page load">
+<!ENTITY missing_flash_plugin_warning_title "Enable missing flash plugin warning">
+<!ENTITY missing_flash_plugin_warning_desc "Will remove the 'missing flash plugin warning' if unchecked">
+<!ENTITY approval_message_title "Enable approval message when fullscreen">
+<!ENTITY approval_message_desc "Will remove the 'video is now fullscreen, press ESC to quit' if unchecked (Desktop only)">
+<!ENTITY prefered_format_title "Prefered Format">
+<!ENTITY prefered_format_desc "if available, pre-select this video Format in the video selector">
+<!ENTITY prefered_quality_title "Prefered Quality">
+<!ENTITY prefered_quality_desc "if available, pre-select this video Quality in the video selector">
+<!ENTITY prefered_quality_medium "medium">
+<!ENTITY prefered_quality_low "low">
diff --git a/locale/en-US/player.properties b/locale/en-US/player.properties
new file mode 100644
index 0000000..f707470
--- /dev/null
+++ b/locale/en-US/player.properties
@@ -0,0 +1 @@
+newtab=Open the link in a new tab
\ No newline at end of file
diff --git a/locale/en-US/strings.dtd b/locale/en-US/strings.dtd
deleted file mode 100644
index 83ebffb..0000000
--- a/locale/en-US/strings.dtd
+++ /dev/null
@@ -1 +0,0 @@
-<!ENTITY VideoUI.label "Open in a new tab">
diff --git a/locale/en-US/strings.properties b/locale/en-US/strings.properties
deleted file mode 100644
index 139c356..0000000
--- a/locale/en-US/strings.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-Video.label=vwof
-Video.tooltip=Watch videos without flash
-Video.commandkey=W
diff --git a/locale/fr-FR/listener.properties b/locale/fr-FR/listener.properties
new file mode 100644
index 0000000..22671ce
--- /dev/null
+++ b/locale/fr-FR/listener.properties
@@ -0,0 +1 @@
+detectvideo=Détecter les vidéos
\ No newline at end of file
diff --git a/locale/fr-FR/options.dtd b/locale/fr-FR/options.dtd
new file mode 100644
index 0000000..b7eb692
--- /dev/null
+++ b/locale/fr-FR/options.dtd
@@ -0,0 +1,15 @@
+<!ENTITY list_of_modules_title "Liste des modules">
+<!ENTITY list_of_modules_desc "Affiche une liste des modules à activer/déactiver">
+<!ENTITY list_of_modules_button_label "Afficher la liste des modules">
+<!ENTITY detect_video_onload_title "Detecter les videos lors du chargement de la page">
+<!ENTITY detect_video_onload_desc "Si coché, les vidéos seront détéctées lors du chargement de pages">
+<!ENTITY missing_flash_plugin_warning_title "Activer les message d'avertissements si flash n'est pas installé">
+<!ENTITY missing_flash_plugin_warning_desc "Si décoché, les messages d'avertissement qu'un contenu flash est présent sur la page en cours ne seront plus affichés">
+<!ENTITY approval_message_title "Activer les messages de confirmation lors du passage en plein écran">
+<!ENTITY approval_message_desc "Si décoché, les messages d'avertissement lors de la lecture d'une vidéo en plein écran ne seront plus affiché">
+<!ENTITY prefered_format_title "Format favori">
+<!ENTITY prefered_format_desc "Si disponible, ce format vidéo sera pré-selectionné dans le selecteur de video">
+<!ENTITY prefered_quality_title "Qualitée favorite">
+<!ENTITY prefered_quality_desc "Si disponible, cette qualitée de vidéo sera pré-selectionné dans le selecteur de video">
+<!ENTITY prefered_quality_medium "Moyenne">
+<!ENTITY prefered_quality_low "Basse">
diff --git a/locale/fr-FR/player.properties b/locale/fr-FR/player.properties
new file mode 100644
index 0000000..e822fca
--- /dev/null
+++ b/locale/fr-FR/player.properties
@@ -0,0 +1 @@
+newtab=Ouvrir le lien dans un nouvel onglet
\ No newline at end of file
diff --git a/locale/jp-JP/listener.properties b/locale/jp-JP/listener.properties
new file mode 100644
index 0000000..5a2e61a
--- /dev/null
+++ b/locale/jp-JP/listener.properties
@@ -0,0 +1 @@
+detectvideo=ビデオ探す
diff --git a/locale/jp-JP/player.properties b/locale/jp-JP/player.properties
new file mode 100644
index 0000000..8b19e56
--- /dev/null
+++ b/locale/jp-JP/player.properties
@@ -0,0 +1 @@
+newtab=新しいタブで開く
diff --git a/skin/player.css b/skin/player.css
index 0135922..42fd504 100644
--- a/skin/player.css
+++ b/skin/player.css
@@ -31,7 +31,7 @@
.vwof_player span, .vwof_player a{
position:absolute;
font-family:white,bold;
- font:14px bold;
+ font:16px bold;
color:white;
font-weight: bold;
margin-top: 8px;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/video-without-flash.git
More information about the Pkg-mozext-commits
mailing list