From 5a301f4df7463cef7fe3797f807d1da1914fb4de Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Thu, 1 Oct 2009 12:16:12 +0200 Subject: [PATCH] gecko-mplayer: import from AlwaysInnovating overlay and clean it up a bit --- conf/checksums.ini | 12 +- .../chrome.manifest | 3 + .../chrome/content/ai-flash.js | 360 ++++++++++++++++++ .../chrome/content/ai-flash.xul | 10 + .../flash@alwaysinnovating.com/install.rdf | 27 ++ .../gnome-mplayer/gecko-mediaplayer_0.9.8.bb | 33 ++ 6 files changed, 441 insertions(+), 4 deletions(-) create mode 100644 recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/chrome.manifest create mode 100644 recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/chrome/content/ai-flash.js create mode 100644 recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/chrome/content/ai-flash.xul create mode 100644 recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash@alwaysinnovating.com/install.rdf create mode 100644 recipes/gnome-mplayer/gecko-mediaplayer_0.9.8.bb diff --git a/conf/checksums.ini b/conf/checksums.ini index 2539828c60..3d20396e26 100644 --- a/conf/checksums.ini +++ b/conf/checksums.ini @@ -6462,14 +6462,14 @@ sha256=c0810fb3ddb6cb73c9ff045965e542af6e3eaa7f2995b3037181766d26d5e6e7 md5=9e3503116f4269a1be70220ee2234b0e sha256=6f5644d56cc603138533158076a6cb41cd33c33d27e5310cb76cb6576151ca67 -[http://ftp.gnome.org/pub/gnome/sources/file-roller/2.6/file-roller-2.6.1.tar.gz] -md5=68a1b645b2e44227f7aca604fd42f8d1 -sha256=21e68eeb291ab5a9f4d618f2985c16c26cdfeb0f0f37d3b88550446678dab30a - [http://ftp.gnome.org/pub/GNOME/sources/file-roller/2.28/file-roller-2.28.0.tar.bz2] md5=dcb0c887d5d287a28ebb5c0ea69bedfa sha256=499fe835b297720f4e4054b4ab34a3fb619c3460c5da82b1519d9b86aa2f3ac2 +[http://ftp.gnome.org/pub/gnome/sources/file-roller/2.6/file-roller-2.6.1.tar.gz] +md5=68a1b645b2e44227f7aca604fd42f8d1 +sha256=21e68eeb291ab5a9f4d618f2985c16c26cdfeb0f0f37d3b88550446678dab30a + [ftp://ftp.gnu.org/gnu/findutils/findutils-4.2.29.tar.gz] md5=24e76434ca74ba3c2c6ad621eb64e1ff sha256=1a9ed8db0711f8419156e786b6aecd42dd05df29e53e380d8924e696f7071ae0 @@ -7790,6 +7790,10 @@ sha256=619d59b339e1be7687058460c105b8f2d4f00e6409e4450dee385e3086fdf6d7 md5=c6c22c7f9feff81a15f5c8ece03b87c1 sha256=619d59b339e1be7687058460c105b8f2d4f00e6409e4450dee385e3086fdf6d7 +[http://gecko-mediaplayer.googlecode.com/files/gecko-mediaplayer-0.9.8.tar.gz] +md5=4df009d21b1a95c35c9adfdb6fbc96fe +sha256=a51ebf00021b1d5d43837edebd0fb28d8f6d2626111c4c391e8b0f6515004aa1 + [http://www.geda.seul.org/devel/20050820/geda-20050820.tar.gz] md5=e8d903d84515cc518e545b6f2e3d7a9d sha256=8e46a48d581f8b835f305bb17ffbb7776d53b9214113524819e96be842f9db98 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/g, ''); + alert(dom+" "+dom.innerHTML); + atag = dom.getElementsByTagName("h2"); + alert("atag.length="+atag.length+" atag="+atag); + for (i=0;i> Download <<")) { + + return atag[i].href; + } + } + */ + // ... so we parse the HTML instead + matchString = "›› Download ‹‹"; + if (res.match(matchString)){ + indexEnd = res.indexOf(matchString)-1; + indexStart = 0; + tag = "")+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 @@ + + + + + +