Commits

Guido Draheim committed 61afe1e

adapt to latest web updates

Comments (0)

Files changed (1)

src/dvbcronrecording/htdocs/js/dvbcronrecording_tvspielfilm.user.js

 // @description   Save entries on the program guide to the recording list
 // @namespace     http://bitbucket.org/2011/dvbcronrecording
 // @source        http://SERVER/recording/programguide
-// @version       0.1.1.0
+// @version       0.1.2.0
 // @creator       Guido Draheim <guidod-2011-@gmx.de>
 // @license       http://creativecommons.org/licenses/by-nc-sa/2.0/de/
 // @include       http://www.tvspielfilm.de/sendung/*
 
 function clicked_save(event) {
 	var target = event.target;
-	var film_info = parentsUntil(target, ".film-info");
-	var film_items = $("li", film_info);
-	var date = $(film_items.get(0)).text();
-	var time = $(film_items.get(1)).text();
-	var channel = $(film_items.get(2)).text();
-	var title = $($("h1").get(0)).text();
-	var text = film_info.text();
+	var A1 = parentsUntil(target, ".social-box");
+	var A2 = parentsUntil(target, ".film-heading"); 
+	var title = $(".film-title", A1).text();
+	if (! title) title = $("h1", A1).text();
+	if (! title) title = $(".film-title", A2).text();
+	if (! title) title = $("h1", A2).text();
+	var channel = $(".channel", A1).text();
+	if (! channel) channel = $(".channel", A2).text();
+	var time = $(".time", A1).text();
+	if (! time) time = $(".time", A2).text();
+	var date = $(".text-1", A1).text(); // "heute", "Di 05.02."
+	if (! date) date = $(".text-1", A2).text();
+	var text = $(A1).text();
+	if (! text) text = $(A2).text();
 	var found = text.match(/Staffel \w+/);
 	if (found) {
 		for (var i=0; i<found.length; i++)
 		for (var i=0; i<found.length; i++)
 			title += " " + found[i];
 	}
+	// GM_log("channel "+channel+" full text: " + $(A1).text() + "AND \n" + $(A2).text());
 	// alert("DATE:"+date+" TIME:"+time+" CHANNEL:"+channel+" TITLE:"+title);
 	save_send(date, time, channel, title);
 }
 function register()
 {
 	GM_log("register dvbcronrecording")
-	film_info = $(".film-info");
-	if (film_info.length == 1) {
-		var mark = $("ul", film_info);
-		if (mark.length != 1) {
-			alert("mark = " + mark.length);
+	var A1 = $(".social-box").first();
+	var A2 = $(".film-heading").first();
+	var A = A1;
+	var R = "1";
+	var channel = $(".channel", A1).text();
+	if (! channel) 
+	{
+	    A = A2; R = "2";
+	    channel = $(".channel", A2).text();
+	}
+	if (! channel) 
+	{
+		GM_log("no channel in .film-heading / social-box");
+	}
+	else
+	{
+		GM_log("OK - found .film-heading / social-box");
+		$("h1", A).css("font-decoration", "line-through");
+		var div = null;
+		var mark = $("ul", A).first();
+		var row1 = $(".row", A).first();
+		if (mark.length == 1) {
+		    // alert("found channel "+channel+" in "+R+" with ul");
+		   div = $(document.createElement("li"));
+		} else if (row1.length == 1) {
+		    // alert("found channel "+channel+" in "+R+" with row");
+		   div = $(document.createElement("div"));
+		   mark = row1;
+		} else {
+		   alert("neither 'ul' nor '.row' for channel "+channel+" found in" + A.text());
 		}
-		var div = $(document.createElement("li")).attr("id","dvbcronrecording").css("color", "red").css("font-weight", "bold");
+		div.attr("id","dvbcronrecording").css("color", "red").css("font-weight", "bold");
 		div.text("SAVE");
 		div.click(clicked_save);
 		div.appendTo(mark);
 	}
 }
 
-$(window).load(register);
+$(window).ready(register);
 GM_log("ready dvbcronrecording");
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.