[xiph-commits] r3972 - in itext: . javascript styles

silvia at svn.annodex.net silvia at svn.annodex.net
Tue Jul 21 05:22:24 PDT 2009


Author: silvia
Date: 2009-07-21 05:22:24 -0700 (Tue, 21 Jul 2009)
New Revision: 3972

Modified:
   itext/
   itext/javascript/subtitles.js
   itext/styles/subtitles.css
Log:
Simplified the display and only update text when text changes.
This should make the TTS work.



Property changes on: itext
___________________________________________________________________
Modified: bzr:revision-info
   - timestamp: 2009-07-21 16:59:11.150000095 +1000
committer: Silvia Pfeiffer <silvia.pfeiffer at vquence.com>
properties: 
	branch-nick: silvia

   + timestamp: 2009-07-21 22:10:59.572000027 +1000
committer: Silvia Pfeiffer <silvia.pfeiffer at vquence.com>
properties: 
	branch-nick: silvia

Modified: bzr:file-ids
   - 
   + javascript/subtitles.js	subtitles.js-20090718094218-d45036mvytq5pecp-10
styles/subtitles.css	subtitles.css-20090718094218-d45036mvytq5pecp-13

Modified: bzr:revision-id:v4
   - 1 silvia.pfeiffer at vquence.com-20090713110521-cz7evclxohf4rbs2
2 silvia.pfeiffer at vquence.com-20090714003359-apmpuor2ttarph5n
3 silvia.pfeiffer at vquence.com-20090714143931-q6j8ritt91jn5rhu
4 silvia.pfeiffer at vquence.com-20090718094222-58zgcmsg9gggbnt1
5 silvia.pfeiffer at vquence.com-20090718094708-wb83p9u6jr1xlhm6
6 silvia.pfeiffer at vquence.com-20090718095409-p6en5qufj62m8w3h
7 silvia.pfeiffer at vquence.com-20090718113424-9s8cmt1guxj6qoky
8 silvia.pfeiffer at vquence.com-20090718113445-n0q9c14w4i11pe36
9 silvia.pfeiffer at vquence.com-20090718123622-xdp52y76dvpem2ya
10 silvia.pfeiffer at vquence.com-20090718131644-69y0zml0ccbwc5er
11 silvia.pfeiffer at vquence.com-20090719002119-ekzto9pc7jqs3gw9
12 silvia.pfeiffer at vquence.com-20090719120832-srm8qemvr5jjy67w
13 silvia.pfeiffer at vquence.com-20090719130420-s7xjh35zrfj8117x
14 silvia.pfeiffer at vquence.com-20090720065454-m2g8tcjgpgw8aetr
15 silvia.pfeiffer at vquence.com-20090720131039-ivpstebztd7u3vwx
16 silvia.pfeiffer at vquence.com-20090720190949-r4ahzq2regl7opf1
17 silvia.pfeiffer at vquence.com-20090720210510-i54efp8a9sem4g6g
18 silvia.pfeiffer at vquence.com-20090721063829-4pvft92pnt7k966p
19 silvia.pfeiffer at vquence.com-20090721065410-0miir37pbb73k35r
20 silvia.pfeiffer at vquence.com-20090721065911-9ngk00aeujudpw8p

   + 1 silvia.pfeiffer at vquence.com-20090713110521-cz7evclxohf4rbs2
2 silvia.pfeiffer at vquence.com-20090714003359-apmpuor2ttarph5n
3 silvia.pfeiffer at vquence.com-20090714143931-q6j8ritt91jn5rhu
4 silvia.pfeiffer at vquence.com-20090718094222-58zgcmsg9gggbnt1
5 silvia.pfeiffer at vquence.com-20090718094708-wb83p9u6jr1xlhm6
6 silvia.pfeiffer at vquence.com-20090718095409-p6en5qufj62m8w3h
7 silvia.pfeiffer at vquence.com-20090718113424-9s8cmt1guxj6qoky
8 silvia.pfeiffer at vquence.com-20090718113445-n0q9c14w4i11pe36
9 silvia.pfeiffer at vquence.com-20090718123622-xdp52y76dvpem2ya
10 silvia.pfeiffer at vquence.com-20090718131644-69y0zml0ccbwc5er
11 silvia.pfeiffer at vquence.com-20090719002119-ekzto9pc7jqs3gw9
12 silvia.pfeiffer at vquence.com-20090719120832-srm8qemvr5jjy67w
13 silvia.pfeiffer at vquence.com-20090719130420-s7xjh35zrfj8117x
14 silvia.pfeiffer at vquence.com-20090720065454-m2g8tcjgpgw8aetr
15 silvia.pfeiffer at vquence.com-20090720131039-ivpstebztd7u3vwx
16 silvia.pfeiffer at vquence.com-20090720190949-r4ahzq2regl7opf1
17 silvia.pfeiffer at vquence.com-20090720210510-i54efp8a9sem4g6g
18 silvia.pfeiffer at vquence.com-20090721063829-4pvft92pnt7k966p
19 silvia.pfeiffer at vquence.com-20090721065410-0miir37pbb73k35r
20 silvia.pfeiffer at vquence.com-20090721065911-9ngk00aeujudpw8p
21 silvia.pfeiffer at vquence.com-20090721121059-uthu2kmvu74zjv06

Modified: bzr:text-parents
   - 
   + javascript/subtitles.js	silvia.pfeiffer at vquence.com-20090721065410-0miir37pbb73k35r
styles/subtitles.css	silvia.pfeiffer at vquence.com-20090721063829-4pvft92pnt7k966p


Modified: itext/javascript/subtitles.js
===================================================================
--- itext/javascript/subtitles.js	2009-07-21 07:08:26 UTC (rev 3971)
+++ itext/javascript/subtitles.js	2009-07-21 12:22:24 UTC (rev 3972)
@@ -532,34 +532,10 @@
 	  this.video = vid;
 	  this.load();
 	  // set up display divs for each category
-	  // these go in the same container:
-	  //		"CC":  "Captions",
-	  //        "SUB": "Subtitles",
-	  //        "KTV": "Karaoke",
-	  //        "TRX": "Transcript",
-	  //        "LRC": "Lyrics",
-	  //        "LIN": "Linguistic Markup",
-	  // these each have their own different container:
-	  //        "TAD": "Audio Description",
-	  //        "TIK": "Ticker Text",
-	  //        "AR":  "Active Regions",
-	  //        "NB":  "Annotation",
-	  //        "META": "Timed Metadata",
-	  //        "CUE": "Cue Points"
 	  var create_cc = 0;
 	  for (i in this.tracks) {
-		if (i == "CC" ||
-		    i == "SUB" ||
-		    i == "KTV" ||
-		    i == "TRX" ||
-		    i == "LRC" ||
-		    i == "LIN") {
-		  create_cc = 1;	
-		} else {
 			$(".itextcontainer").append("<div class='itext_"+i+"></div>");			
-		}
 	  }
-	  if (create_cc) $(".itextcontainer").append("<div class='itext_CC'></div>");
 	},
 	load: function() {
 	  // parse the itext elements and remember which tracks to fetch
@@ -618,56 +594,39 @@
 	show: function(currentTime) {
 		// get content per category
 		var content = [];
-		content["CC"] = "";
 		for (i in this.tracks) {
-			if (i != "CC") content[i] = "";
+			content[i] = null;
 			for (j in this.tracks[i]) {
 				if (this.tracks[i][j].enabled) {
-					if (text = this.tracks[i][j].currentText(currentTime)) {
-						if (i == "CC" ||
-					      i == "SUB" ||
-					      i == "KTV" ||
-					      i == "TRX" ||
-					      i == "LRC" ||
-					      i == "LIN") {
-						  content["CC"] += text;
-						} else {
-						  content[i] += text;	
-						} 
-					}
+						  content[i] = this.tracks[i][j].currentText(currentTime);
 				}
 			}
 		}
 		
 	    // add to correct content container
 	    for (i in content) {
-	  	  if (i == "CC" ||
-		      i == "SUB" ||
-		      i == "KTV" ||
-		      i == "TRX" ||
-		      i == "LRC" ||
-		      i == "LIN") {
-			if (content["CC"]) {
-				// replace content of caption div
-				$(".itext_CC").html(content["CC"]);
-				$(".itext_CC").css("visibility", "visible");
-				// anyone with a better idea for how to place the captions bottom center, please speak up
-				mc_width = $('.mc').css("width").substr(0,$('.mc').css("width").length-2)
-				$(".itext_CC").css("max-width", (mc_width-14)+"px");
-				$(".itext_CC").css("left", (mc_width/2+7)+"px");
-				text_half_length = $(".itext_CC > .text").css("width").substr(0,$('.text').css("width").length-2)/2*(-1)+"px";
-				$(".itext_CC").css("margin-left", text_half_length);
-			} else {
-				$(".itext_CC").css("visibility", "hidden");			
-			}
-		  } else {
-			if (content[i]) {
+		  if (content[i]) {
+			// replace content of itext div
+			if ($(".itext_"+i).html() != content[i]) {
 				$(".itext_"+i).html(content[i]);
 				$(".itext_"+i).css("visibility", "visible");
-				if (i == "TAD")	$(".itext_TAD").attr("aria-live", "assertive");
-			} else {
-				$(".itext_"+i).css("visibility", "hidden");
+	  			if (i == "CC" ||
+		      		i == "SUB" ||
+		      		i == "KTV" ||
+		      		i == "TRX" ||
+		      		i == "LRC" ||
+		      		i == "LIN") {
+					// anyone with a better idea for how to place the captions bottom center, please speak up
+					mc_width = $('.mc').css("width").substr(0,$('.mc').css("width").length-2)
+					$(".itext_"+i).css("max-width", (mc_width-14)+"px");
+					$(".itext_"+i).css("left", (mc_width/2+7)+"px");
+					text_half_length = $(".itext_"+i+" > .text").css("width").substr(0,$(".itext_"+i+" > .text").css("width").length-2)/2*(-1)+"px";
+					$(".itext_"+i).css("margin-left", text_half_length);
+				}
 			}
+			if (i == "TAD")	$(".itext_TAD").attr("aria-live", "assertive");
+		  } else {
+			$(".itext_"+i).css("visibility", "hidden");
 		  }				
 		}
 	}

Modified: itext/styles/subtitles.css
===================================================================
--- itext/styles/subtitles.css	2009-07-21 07:08:26 UTC (rev 3971)
+++ itext/styles/subtitles.css	2009-07-21 12:22:24 UTC (rev 3972)
@@ -78,7 +78,7 @@
 	display: block;
 }
 
-div.itext_CC {
+div.itext_CC, div.itext_SUB, div.itext_KTV, div.itext_TRX, div.itext_LRC, div.itext_LIN {
 	background-color: #333333;
     opacity:0.8;
 	padding: 7px 7px 4px 7px;
@@ -88,7 +88,12 @@
 	z-index: 100;
 }
 
-div.itext_CC > div.text {
+div.itext_CC > div.text,
+div.itext_SUB > div.text,
+div.itext_KTV > div.text,
+div.itext_TRX > div.text,
+div.itext_LRC > div.text,
+div.itext_LIN > div.text{
 	color: white;
 	opacity: 100%;
 	text-align: center;



More information about the commits mailing list