[oe-commits] Alexandre Tisserant : gecko-mediaplayer: make ai-flash. js work with midori as well

git version control git at git.openembedded.org
Mon Nov 9 22:16:03 UTC 2009


Module: openembedded.git
Branch: shr/merge
Commit: c78f8925f4beebce208898d2dfe4088118e6cb87
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=c78f8925f4beebce208898d2dfe4088118e6cb87

Author: Alexandre Tisserant <alexandre at alwaysinnovating.com>
Date:   Sun Nov  8 21:06:45 2009 +0100

gecko-mediaplayer: make ai-flash.js work with midori as well

* midori only supports scripts in ~/.local/share/midori/scripts so users will have to do

mkdir -p ~/.local/share/midori/scripts  ; cp /usr/lib/mozilla/extensions/flash at alwaysinnovating.com/chrome/content/ai-flash.js ~/.local/share/midori/scripts/

---

 .../chrome/content/ai-flash.js                     |   51 +++++++++----------
 recipes/gnome-mplayer/gecko-mediaplayer_0.9.8.bb   |    2 +-
 2 files changed, 25 insertions(+), 28 deletions(-)

diff --git a/recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash at alwaysinnovating.com/chrome/content/ai-flash.js b/recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash at alwaysinnovating.com/chrome/content/ai-flash.js
index c21ad58..e1486ab 100644
--- a/recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash at alwaysinnovating.com/chrome/content/ai-flash.js
+++ b/recipes/gnome-mplayer/gecko-mediaplayer/extensions/flash at alwaysinnovating.com/chrome/content/ai-flash.js
@@ -1,6 +1,18 @@
+// ==UserScript==
+// @name Flash AI
+// @description Flash AI add-on
+// @include *
+// ==/UserScript==
 
-window.addEventListener("load", function() { myExtension.init(); }, false);
 
+var firefox = true;
+if (navigator.userAgent.match("midori")) firefox = false;
+
+if (!firefox){
+	window.addEventListener("load", function() { myExtension.onPageLoad(); }, true);
+}else{
+	window.addEventListener("load", function() { myExtension.init(); }, false);
+}
 var myExtension = {
 	init: function() {
 		var appcontent = document.getElementById("appcontent");   // browser
@@ -17,7 +29,7 @@ var myExtension = {
 }
 
 
-	var idInterval=-1;
+var idInterval=-1;
 var stUrl = "";
 var timeout=2000;
 
@@ -67,8 +79,12 @@ function getBrowserForDocument(aDocument) {
 }
 
 function checkPageOnLoad(aEvent) {
-
-        var doc=aEvent.originalTarget;
+	var doc;	
+	if(firefox){
+		doc=aEvent.originalTarget;
+	}else{
+		doc=document;
+	}
 	var loc=doc.location.href;
 	var host=doc.location.hostname;
 	idInterval=-1;
@@ -97,7 +113,7 @@ function checkPageOnLoad(aEvent) {
 	}
 
 	if (host.match(/youtube\./i)!=null) {
-		embmedia=doc.embeds;
+		embmedia=doc.embeds;		
 		if ((embmedia!=null)&&(idInterval==-1)) {
 			embid=embmedia[0].getAttribute('id');
 			flashvars=unescape(embmedia[0].getAttribute('flashvars'));
@@ -121,7 +137,7 @@ function checkPageOnLoad(aEvent) {
 
 	        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'));
@@ -132,11 +148,11 @@ function checkPageOnLoad(aEvent) {
 					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]));
@@ -150,24 +166,7 @@ function checkPageOnLoad(aEvent) {
 	
 	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');
@@ -183,8 +182,7 @@ function checkPageOnLoad(aEvent) {
 		setTimeout(checkPageOnLoad,timeout,aEvent);			    
 		return;
 	}
-	
-	
+
 
 	//if (loc.match(/my\.yahoo\..*\/\?rd\=nux/i)!=null) {
 	//       atag=doc.getElementsByTagName('a');
@@ -197,7 +195,6 @@ function checkPageOnLoad(aEvent) {
 	//}
 
 	if (host.match(/dailymotion\./i)!=null) {
-	 
 	        embmedia=doc.embeds;
 		if ((embmedia!=null)&&(idInterval==-1)) {
 			embid=embmedia[0].getAttribute('id');
diff --git a/recipes/gnome-mplayer/gecko-mediaplayer_0.9.8.bb b/recipes/gnome-mplayer/gecko-mediaplayer_0.9.8.bb
index a8ee6ff..a926083 100644
--- a/recipes/gnome-mplayer/gecko-mediaplayer_0.9.8.bb
+++ b/recipes/gnome-mplayer/gecko-mediaplayer_0.9.8.bb
@@ -4,7 +4,7 @@ LICENSE = "GPL"
 DEPENDS = "firefox gtk+ gconf dbus-glib"
 RDEPENDS = "firefox gnome-mplayer"
 
-PR = "r6"
+PR = "r7"
 
 inherit autotools
 





More information about the Openembedded-commits mailing list