summaryrefslogtreecommitdiff
path: root/recipes
diff options
context:
space:
mode:
authorKoen Kooi <koen@openembedded.org>2009-10-01 12:16:12 +0200
committerKoen Kooi <koen@openembedded.org>2009-10-01 13:12:00 +0200
commit5a301f4df7463cef7fe3797f807d1da1914fb4de (patch)
tree04f1805297073363357d0b8e07c790c20ea24fec /recipes
parent1fb6ea09d2c75b67627835aa3d055df5e168ca29 (diff)
gecko-mplayer: import from AlwaysInnovating overlay and clean it up a bit
Diffstat (limited to 'recipes')
-rw-r--r--recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/chrome.manifest3
-rw-r--r--recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/chrome/content/ai-flash.js360
-rw-r--r--recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/chrome/content/ai-flash.xul10
-rw-r--r--recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/install.rdf27
-rw-r--r--recipes/gnome-mplayer/gecko-mediaplayer_0.9.8.bb33
5 files changed, 433 insertions, 0 deletions
diff --git a/recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/chrome.manifest b/recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/chrome.manifest
new file mode 100644
index 0000000000..a137546bf7
--- /dev/null
+++ b/recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/chrome.manifest
@@ -0,0 +1,3 @@
+content ai-flash chrome/content/ xpcnativewrappers=yes
+
+overlay chrome://browser/content/browser.xul chrome://ai-flash/content/ai-flash.xul
diff --git a/recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/chrome/content/ai-flash.js b/recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/chrome/content/ai-flash.js
new file mode 100644
index 0000000000..c21ad58847
--- /dev/null
+++ b/recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/chrome/content/ai-flash.js
@@ -0,0 +1,360 @@
+
+window.addEventListener("load", function() { myExtension.init(); }, false);
+
+var myExtension = {
+ init: function() {
+ var appcontent = document.getElementById("appcontent"); // browser
+ if(appcontent)
+ appcontent.addEventListener("DOMContentLoaded", myExtension.onPageLoad, true);
+ var messagepane = document.getElementById("messagepane"); // mail
+ if(messagepane)
+ messagepane.addEventListener("load", function () { myExtension.onPageLoad(); }, true);
+ },
+
+ onPageLoad: function(aEvent) {
+ checkPageOnLoad(aEvent);
+ }
+}
+
+
+ var idInterval=-1;
+var stUrl = "";
+var timeout=2000;
+
+var width = 0;
+var height = 0;
+
+function rev(str) {
+ if(!str)
+ return'';
+ var revstr='';
+ for(i=str.length-1;i>=0;i--) {
+ revstr+=str.charAt(i);
+ }
+ return revstr;
+}
+
+function getDocuments(aFrame,aArray) {
+ const frames = aFrame.frames;
+ aArray.push(aFrame.document);
+ for(var i = 0; i < frames.length; i++)
+ this.getDocuments(frames[i],aArray);
+ return aArray;
+}
+
+function getBrowserForDocument(aDocument) {
+ // This function can return the browser for not only top level documents
+ // but also documents contained in subframes
+
+ // If the document is top level then return its browser here
+ var browsers = gBrowser.browsers;
+ for(var i = 0; i < browsers.length; i++) {
+ if(aDocument == browsers[i].contentDocument) return browsers[i];
+ }
+
+ // Else it must be in a subframe, so check all frames in each browser
+ // to find the parent browser
+ var documents;
+ for(var j = 0; j < browsers.length; j++) {
+ documents = this.getDocuments(browsers[j].contentWindow,new Array());
+ for(var k = 0; k < documents.length; k++) {
+ if(aDocument == documents[k]) return browsers[j];
+ }
+ }
+
+ // Else the browser could not be determined
+ return null;
+}
+
+function checkPageOnLoad(aEvent) {
+
+ var doc=aEvent.originalTarget;
+ var loc=doc.location.href;
+ var host=doc.location.hostname;
+ idInterval=-1;
+
+ if (host.match(/video.google\./i)!=null) {
+ // Get the browser for the document (if required)
+
+ var browser = this.getBrowserForDocument(doc);
+ if(!browser){
+ return;
+ }
+
+ embmedia=doc.getElementById("embed_player_1");
+ if ((embmedia!=null)&&(idInterval==-1)) {
+
+ // Extract video URL (look at clive code in parse.py for probably stabler code)
+ source=unescape(embmedia.getAttribute('src'));
+ stUrl=source.substr(source.indexOf('videoUrl=')+9);
+ stUrl=stUrl.split("&thumbnailUrl=")[0];
+ idInterval = setInterval(replaceTag, timeout, doc, "embed_player_1", new Array(embmedia));
+
+ return;
+ }
+
+ setTimeout(checkPageOnLoad, timeout,aEvent);
+ }
+
+ if (host.match(/youtube\./i)!=null) {
+ embmedia=doc.embeds;
+ if ((embmedia!=null)&&(idInterval==-1)) {
+ embid=embmedia[0].getAttribute('id');
+ flashvars=unescape(embmedia[0].getAttribute('flashvars'));
+ if ((embid==null)||(flashvars==null)){
+ setTimeout(checkPageOnLoad,timeout,aEvent);
+ return;
+ }
+
+ if ((embid=='movie_player')||(flashvars.match(/video_id=/i)!=null)) {
+ id = flashvars.split("video_id=")[1].split("&")[0];
+ valid = flashvars.split("&t=")[1].split("&")[0];
+ stUrl = "http://www.youtube.com/get_video?video_id="+id+"&t="+valid;//&"&fmt=18"; for quality control
+ idInterval = setInterval(replaceTag, timeout, doc, "movie_player", embmedia);
+ }
+
+ }
+ setTimeout(checkPageOnLoad,timeout,aEvent);
+ }
+
+ if (host.match(/myspace\./i)!=null) {
+
+ embmedia=doc.embeds;
+ if ((embmedia!=null)&&(idInterval==-1)) {
+
+ // Myspace loves embedded flash ads, so we have to find the good one for the video...
+ for(i=0;i<embmedia.length;i++){
+ source=unescape(embmedia[i].getAttribute('src'));
+ if (source==null){
+ return;
+ }else{
+ id=-1;
+ if(source.match(/videoid=/i)!=null){
+ // regular video
+ id = (source.split("videoid=")[1]).split("&")[0];
+ }else if (source.match(/m=/i)!=null){
+ // video channels myspace or hot stuff
+ id = (source.split("m=")[1]).split("&")[0].split(",")[0];
+ }
+
+ if(id!=-1){
+ stUrl=getMySpaceURL(doc, id);
+ idInterval = setInterval(replaceTag, timeout, doc, " ", new Array(embmedia[i]));
+ return;
+ }
+ }
+ }
+ }
+
+ }
+
+ if (host.match(/video.yahoo\./i)!=null) {
+ embmedia=doc.embeds;
+ if ((embmedia!=null)&&(idInterval==-1)) {
+ for(i=0;i<embmedia.length;i++){
+ embid = embmedia[i].getAttribute('id');
+ if(embid=="video1"){
+ stUrl = getURLfromKeepVid(loc);
+ if (stUrl != null){
+ this.replaceTag(doc, embid, new Array(embmedia[i]));
+ return;
+ }
+ }
+ }
+ }
+ setTimeout(checkPageOnLoad,timeout,aEvent);
+ return;
+ }
+
+ if (host.match(/video.yahoo\./i)!=null) {
+ embmedia=doc.embeds;
+ if ((embmedia!=null)&&(idInterval==-1)) {
+ for(i=0;i<embmedia.length;i++){
+ embid = embmedia[i].getAttribute('id');
+ if(embid=="video1"){
+ stUrl = getURLfromKeepVid(loc);
+ if (stUrl != null){
+ this.replaceTag(doc, embid, new Array(embmedia[i]));
+ return;
+ }
+ }
+ }
+ }
+ setTimeout(checkPageOnLoad,timeout,aEvent);
+ return;
+ }
+
+
+
+ //if (loc.match(/my\.yahoo\..*\/\?rd\=nux/i)!=null) {
+ // atag=doc.getElementsByTagName('a');
+ // for (i=0;i<atag.length;++i) {
+ // if (atag[i].text.match(/Continue to My Yahoo! Beta/i)) {
+ // url = atag[i].href;
+ // doc.location.href = url;
+ // }
+ // }
+ //}
+
+ if (host.match(/dailymotion\./i)!=null) {
+
+ embmedia=doc.embeds;
+ if ((embmedia!=null)&&(idInterval==-1)) {
+ embid=embmedia[0].getAttribute('id');
+
+ // regular video
+ if (embid=='videoplayer') {
+ // current player
+ source='&'+unescape(embmedia[0].getAttribute('flashvars'));
+ stUrl=source.substr(source.indexOf("http://www.dailymotion.com/cdn/H264-512x384"));
+ stUrl=stUrl.split("@@")[0];
+ idInterval = setInterval(replaceTag, timeout, doc, "videoplayer", embmedia);
+ }
+ }
+ setTimeout(checkPageOnLoad,timeout,aEvent);
+ }
+}
+
+
+
+function replaceTagFrame(doc, frame, stTag) {
+ replaceTag(doc, stTag, frame.document.embeds);
+}
+
+
+function replaceTag(doc, stTag, embeds) {
+ for (i=0; i < embeds.length; i++) {
+ if ((stTag == " ")||(embeds[i].id == stTag)) {
+ var obj = embeds[i];
+ if (obj.id != "pconrails") {
+ var rails = doc.createElement("embed");
+ rails.setAttribute("type", "video/x-flv");
+ rails.setAttribute("id", "pconrails");
+ rails.setAttribute("width", obj.clientWidth);
+ rails.setAttribute("height", obj.clientHeight);
+ rails.setAttribute("src", stUrl);
+ rails.setAttribute("autostart", "true");
+ doc.body.appendChild(rails);
+ obj.parentNode.replaceChild(rails, obj);
+ clearInterval(idInterval);
+ }
+ }
+ }
+}
+
+
+function getURLfromKeepVid(loc){
+ if(loc.match(/watch\//i)!=null){
+ url = escape(loc);
+ while (url.match("/")){
+ url = url.replace("/","%2F");
+ }
+ url = "http://keepvid.com/?url="+url;
+
+ var req = new XMLHttpRequest();
+ req.open('GET', url, false);
+ req.send(null);
+
+ var res = req.responseText;
+
+ /* should better parse DOM tree, but first have to build it, and this code does not work...
+ var dom = document.createElement('div');
+ dom.innerHTML = res.replace(/<script(.|\s)*?\/script>/g, '');
+ alert(dom+" "+dom.innerHTML);
+ atag = dom.getElementsByTagName("h2");
+ alert("atag.length="+atag.length+" atag="+atag);
+ for (i=0;i<atag.length;i++) {
+ alert("atag["+i+"]= "+atag[i]);
+ if (atag[i].text.match(">> Download <<")) {
+
+ return atag[i].href;
+ }
+ }
+ */
+ // ... so we parse the HTML instead
+ matchString = "&rsaquo;&rsaquo; Download &lsaquo;&lsaquo;";
+ if (res.match(matchString)){
+ indexEnd = res.indexOf(matchString)-1;
+ indexStart = 0;
+ tag = "<a href=\"";
+ var url = res;
+ while(url.match(tag)){
+ indexStart = url.indexOf(tag)+tag.length;
+ url = url.substring(indexStart,indexEnd);
+ indexEnd -= indexStart;
+ }
+ url = url.split("\"")[0];
+ while(url.match("&amp;")){
+ url = url.replace("&amp;","&");
+ }
+ return url;
+ }
+
+ }
+ return null;
+}
+
+function getMySpaceURL(doc, id) {
+ url = 'http://mediaservices.myspace.com/services/rss.ashx?type=video&videoID=' + id;
+
+ var req = new XMLHttpRequest();
+ req.open('GET', url, false);
+ req.send(null);
+
+ var xml = req.responseText;
+ return xml.split('media:content url="')[1].split('"')[0];
+}
+
+function getFeaturedYouTubeURL(doc, id) {
+ var url = "http://www.youtube.com/watch?v=" + id;
+
+ var req = new XMLHttpRequest();
+ req.open('GET', url, false);
+ req.send(null);
+
+ var html = req.responseText;
+
+ source=html.match(/video_id=\S+&.+&t=.+&f/i);
+ return String(source).replace(/(video_id=\S+)&.+(&t=.+)&f/i,'http:\/\/www.youtube.com\/get_video?$1$2');
+}
+
+function replaceInnerHTML_Yahoo(doc) {
+ var obj = doc.getElementById("y_embed");
+
+ if (obj == null)
+ return;
+
+ var src = obj.innerHTML;
+
+ if (src.indexOf("makeplaylist.dll") != -1) {
+ var indexStart = obj.innerHTML.indexOf("pList=")+6;
+ var indexEnd = obj.innerHTML.indexOf("&", indexStart);
+
+ var newSrc = unescape(obj.innerHTML.substring(indexStart, indexEnd));
+
+ var req = new XMLHttpRequest();
+ req.open('GET', newSrc, false);
+ req.send(null);
+
+ var newEmbed = req.responseText;
+
+ newEmbed = newEmbed.replace(/application\/x\-shockwave\-flash/, "video/x-flv");
+
+ indexStart = newEmbed.indexOf("<EMBED");
+ indexEnd = newEmbed.indexOf("</EMBED>")+8;
+
+ newHTML = newEmbed.substring(indexStart, indexEnd);
+
+ if (width != 0) {
+ newHTML = newHTML.replace(/width=(\S+)\s/i, "width=" + width + " ");
+ }
+ if (height != 0) {
+ newHTML = newHTML.replace(/height=(\S+)\s/i, "height=" + height + " ");
+ }
+
+ obj.innerHTML = newHTML;
+ clearInterval(idInterval);
+ }
+}
+
+
diff --git a/recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/chrome/content/ai-flash.xul b/recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/chrome/content/ai-flash.xul
new file mode 100644
index 0000000000..82ba0d6d5a
--- /dev/null
+++ b/recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/chrome/content/ai-flash.xul
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+
+<overlay id="hijackpluginOverlay"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<window id="main-window">
+ <script type="text/javascript" src="./ai-flash.js"/>
+</window>
+
+</overlay>
diff --git a/recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/install.rdf b/recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/install.rdf
new file mode 100644
index 0000000000..dc99151636
--- /dev/null
+++ b/recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/install.rdf
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+ <Description about="urn:mozilla:install-manifest">
+ <em:id>flash@alwaysinnovating.com</em:id>
+ <em:version>1.1</em:version>
+ <em:type>2</em:type>
+
+ <!-- Firefox -->
+ <em:targetApplication>
+ <Description>
+ <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>0.9</em:minVersion>
+ <em:maxVersion>3.9</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+
+ <em:name>Always Innovating Fix for Flash</em:name>
+ <em:description>Don't uninstall this add-on.</em:description>
+ <em:creator>Always Innovating</em:creator>
+ <em:contributor>Gregoire Gentil</em:contributor>
+ <em:homepageURL>http://www.alwaysinnovating.com</em:homepageURL>
+ <em:iconURL></em:iconURL>
+ <em:optionsURL></em:optionsURL>
+ </Description>
+</RDF>
diff --git a/recipes/gnome-mplayer/gecko-mediaplayer_0.9.8.bb b/recipes/gnome-mplayer/gecko-mediaplayer_0.9.8.bb
new file mode 100644
index 0000000000..7035f41483
--- /dev/null
+++ b/recipes/gnome-mplayer/gecko-mediaplayer_0.9.8.bb
@@ -0,0 +1,33 @@
+DESCRIPTION = "Gecko plugin for gnome-mplayer"
+HOMEPAGE = "http://dekorte.homeip.net/download/gecko-mediaplayer/"
+LICENSE = "GPL"
+DEPENDS = "firefox gtk+ gconf dbus-glib"
+RDEPENDS = "firefox gnome-mplayer"
+
+inherit autotools
+
+SRC_URI = "http://gecko-mediaplayer.googlecode.com/files/${P}.tar.gz \
+ file://extensions \
+"
+
+# Yes, this needs to match the firefox version you are building *exactly*
+MOZILLA_HOME = firefox-3.5.2
+
+do_install_append() {
+ install -d ${D}${libdir}/${MOZILLA_HOME}
+ mv ${D}${libdir}/mozilla/plugins ${D}${libdir}/${MOZILLA_HOME}
+ cp -dpR ${WORKDIR}/extens* ${D}${libdir}/${MOZILLA_HOME}/
+}
+
+
+#EXTRA_OEMAKE = "-I${STAGING_INCDIR}/${MOZILLA_HOME} -I${STAGING_INCDIR}/linux"
+
+PACKAGES =+ "${PN}-firefox-hack"
+RDEPENDS_${PN}-firefox-hack = "${PN}"
+FILES_${PN}-firefox-hack = "${D}${libdir}/${MOZILLA_HOME}/extensions"
+
+FILES_${PN} += "${sysconfdir}/* \
+ ${libdir}/${MOZILLA_HOME}/*"
+FILES_${PN}-dbg += "${libdir}/${MOZILLA_HOME}/plugins/.debug/*"
+
+