[xiph-commits] r3996 - itext
silvia at svn.annodex.net
silvia at svn.annodex.net
Tue Sep 1 06:40:09 PDT 2009
Author: silvia
Date: 2009-09-01 06:40:08 -0700 (Tue, 01 Sep 2009)
New Revision: 3996
Modified:
itext/
itext/mediafrag.html
Log:
Fixed up the input elements to call javascript also on "enter".
Created new functions to avoid copying code.
Replaced the "timeupdate" event for url update with a "pause" event, since that causes less disruption.
Added a "hashchange" event which will work in fireofx 3.6 and react to the change of the url hash part without need to reload.
Property changes on: itext
___________________________________________________________________
Modified: bzr:revision-info
- timestamp: 2009-09-01 15:17:57.290999889 +1000
committer: Silvia Pfeiffer <silvia.pfeiffer at vquence.com>
properties:
branch-nick: silvia
+ timestamp: 2009-09-01 23:29:58.984999895 +1000
committer: Silvia Pfeiffer <silvia.pfeiffer at vquence.com>
properties:
branch-nick: silvia
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
21 silvia.pfeiffer at vquence.com-20090721121059-uthu2kmvu74zjv06
22 silvia.pfeiffer at vquence.com-20090721125735-lwwo9ivbdhj0jdhp
23 silvia.pfeiffer at vquence.com-20090721130655-sdqdgbs0lexyrwh5
24 silvia.pfeiffer at vquence.com-20090721143346-065b9v0rr1tcmyg0
25 silvia.pfeiffer at vquence.com-20090722010421-9sx8ynfzcoxh1eai
26 silvia.pfeiffer at vquence.com-20090722014433-yrqaapi0kmfec1oh
27 silvia.pfeiffer at vquence.com-20090722062945-586zxe3smxv1gdcw
28 silvia.pfeiffer at vquence.com-20090727123838-lcxe2fb7n2111ipd
29 silvia.pfeiffer at vquence.com-20090728151700-ai24t8itvj8hxs0c
30 silvia.pfeiffer at vquence.com-20090728210031-2n53wzpuledyqg9w
31 silvia.pfeiffer at vquence.com-20090730034353-pcrnaae01i2q5430
32 silvia.pfeiffer at vquence.com-20090731122706-nrrle33ore1cjl87
33 silvia.pfeiffer at vquence.com-20090801092101-zyu1s0ntmio5bihb
34 silvia.pfeiffer at vquence.com-20090801092534-5pvl2ehkqi87p9le
35 silvia.pfeiffer at vquence.com-20090801233833-xa51k548ng1tqxso
36 silvia.pfeiffer at vquence.com-20090802130400-k998eftqulgcrp04
37 silvia.pfeiffer at vquence.com-20090802143005-c1sm52ru0kfed912
38 silvia.pfeiffer at vquence.com-20090827061919-ejpm51zs89ekbd56
39 silvia.pfeiffer at vquence.com-20090827061950-6fu26p80jdvdh50c
40 silvia.pfeiffer at vquence.com-20090901040002-3qs6tqiqcod3cda2
41 silvia.pfeiffer at vquence.com-20090901040227-o491w2qkp79a2a3r
42 silvia.pfeiffer at vquence.com-20090901040449-3xtimieabhw7fu7o
43 silvia.pfeiffer at vquence.com-20090901051757-h9l9753jy47x87zy
+ 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
22 silvia.pfeiffer at vquence.com-20090721125735-lwwo9ivbdhj0jdhp
23 silvia.pfeiffer at vquence.com-20090721130655-sdqdgbs0lexyrwh5
24 silvia.pfeiffer at vquence.com-20090721143346-065b9v0rr1tcmyg0
25 silvia.pfeiffer at vquence.com-20090722010421-9sx8ynfzcoxh1eai
26 silvia.pfeiffer at vquence.com-20090722014433-yrqaapi0kmfec1oh
27 silvia.pfeiffer at vquence.com-20090722062945-586zxe3smxv1gdcw
28 silvia.pfeiffer at vquence.com-20090727123838-lcxe2fb7n2111ipd
29 silvia.pfeiffer at vquence.com-20090728151700-ai24t8itvj8hxs0c
30 silvia.pfeiffer at vquence.com-20090728210031-2n53wzpuledyqg9w
31 silvia.pfeiffer at vquence.com-20090730034353-pcrnaae01i2q5430
32 silvia.pfeiffer at vquence.com-20090731122706-nrrle33ore1cjl87
33 silvia.pfeiffer at vquence.com-20090801092101-zyu1s0ntmio5bihb
34 silvia.pfeiffer at vquence.com-20090801092534-5pvl2ehkqi87p9le
35 silvia.pfeiffer at vquence.com-20090801233833-xa51k548ng1tqxso
36 silvia.pfeiffer at vquence.com-20090802130400-k998eftqulgcrp04
37 silvia.pfeiffer at vquence.com-20090802143005-c1sm52ru0kfed912
38 silvia.pfeiffer at vquence.com-20090827061919-ejpm51zs89ekbd56
39 silvia.pfeiffer at vquence.com-20090827061950-6fu26p80jdvdh50c
40 silvia.pfeiffer at vquence.com-20090901040002-3qs6tqiqcod3cda2
41 silvia.pfeiffer at vquence.com-20090901040227-o491w2qkp79a2a3r
42 silvia.pfeiffer at vquence.com-20090901040449-3xtimieabhw7fu7o
43 silvia.pfeiffer at vquence.com-20090901051757-h9l9753jy47x87zy
44 silvia.pfeiffer at vquence.com-20090901132958-3i65nroyeciazei3
Modified: itext/mediafrag.html
===================================================================
--- itext/mediafrag.html 2009-09-01 05:18:41 UTC (rev 3995)
+++ itext/mediafrag.html 2009-09-01 13:40:08 UTC (rev 3996)
@@ -17,16 +17,16 @@
<form name="displayurl" action="">
<label for="offseturl">Link to this video:</label>
- <input name="offseturl" type="text" readonly="" onclick="document.displayurl.offseturl.focus();document.displayurl.offseturl.select();" value=""/>
+ <input name="offseturl" type="text" readonly="" value="" onclick="document.displayurl.offseturl.focus();document.displayurl.offseturl.select();"/>
</form>
- <form name="jumptime" action="" method="GET">
+ <form name="jumptime" action="javascript:jumpToTimeoffset(document.jumptime);" method="">
<label for="jumptime">Jump to time offset:</label>
<input name="time" type="number"/>
<input name="button" type="button" value="Jump" onclick="jumpToTimeoffset(this.form)"/>
</form>
- <form name="videourl" action="" method="GET">
+ <form name="videourl" action="javascript:changeVideoUrl(document.videourl);" method="">
<label for="videourl">Change video element url:</label>
<input name="url" type="text" value="elephants_dream/elephant.ogv#t=20"/>
<input name="button" type="button" value="Change" onclick="changeVideoUrl(this.form)"/>
@@ -59,20 +59,13 @@
<p>Thanks to the Orange Open Movie Team for the <a href="http://creativecommons.org/licenses/by/2.5/">Creative Commons licensed</a> "Elephants Dream" movie that was used as an example here, (c) copyright 2006, Blender Foundation / Netherlands Media Art Institute / www.elephantsdream.org.</p>
<script type="text/javascript">
- // get video element and url
+ // get video element
var video = document.getElementsByTagName("video")[0];
- // get page URL without fragment
+ // get page URL without fragment & time offset
var currenturl = location.href;
var pageurl = location.href.split("#")[0];
- var pageoffset = 0;
- var offsettime = 0;
- if (location.href.split("#")[1] != null) {
- pageoffset = location.href.split("#")[1];
- if (pageoffset.substring(2) != null) {
- offsettime = pageoffset.substring(2);
- }
- }
+ var offsettime = retrieveTimeFragment(currenturl);
// set cut-paste-entry to currenturl as default
document.displayurl.offseturl.value = currenturl;
@@ -83,51 +76,70 @@
// jump to offset given in video url
// START: THIS SHOULD BE NATIVE IN BROWSER
var videourl = video.currentSrc;
- var videooffset = videourl.split("#")[1];
- var videooffsettime = 0;
- if (videooffset.substring(2) != null) {
- videooffsettime = videooffset.substring(2);
- video.currentTime = videooffsettime;
+ var videooffset = retrieveTimeFragment(videourl);
+ if (videooffset != 0) {
+ video.currentTime = videooffset;
}
// END: THIS SHOULD BE NATIVE IN BROWSER
- // first time only
- // jump to offset given in page url
+ // first time only: jump to offset given in page url
if (offsettime != 0) {
video.currentTime = offsettime;
offsettime = 0;
}
}, false);
- // set callback for video to update page URL with time offset
- video.addEventListener("timeupdate", function() {
- if (video.ended) {
- return;
- }
- videotime = video.currentTime;
- location.href = pageurl + "#t=" + videotime;
- document.displayurl.offseturl.value = location.href;
+ // set callback for video to update page URL with time offset when paused
+ video.addEventListener("pause", function() {
+ videotime = video.currentTime;
+ changePageUrlOffset(videotime);
}, false);
- video.addEventListener("loadend", function() {
- // jump to offset given in page url
- if (offsettime != 0) {
- video.currentTime = offsettime;
- }
- }, false);
+ // when the hash on the window changes, also do an offset
+ window.addEventListener("hashchange", function() {
+ var url = location.href;
+ var time = retrieveTimeFragment(url);
+ video.currentTime = time;
+ // update cut-and-paste url
+ document.displayurl.offseturl.value = location.href;
+ }, false);
// jump to time offset action
function jumpToTimeoffset(form) {
var time = form.time.value;
video.currentTime = time;
+ changePageUrlOffset(time);
}
// change the video's url
function changeVideoUrl(form) {
var newurl = form.url.value;
+ var newurloffset = retrieveTimeFragment(newurl);
video.src = newurl;
- video.load();
+ video.load();
+ changePageUrlOffset(newurloffset);
}
+
+ // parse the time hash out of the given url
+ function retrieveTimeFragment(url) {
+ var pageoffset = 0;
+ var offsettime = 0;
+ if (url.split("#")[1] != null) {
+ pageoffset = url.split("#")[1];
+ if (pageoffset.substring(2) != null) {
+ offsettime = pageoffset.substring(2);
+ }
+ }
+ return offsettime;
+ }
+
+ // change urls
+ function changePageUrlOffset(time) {
+ // update page url
+ location.hash = "#t=" + time;
+ // update cut-and-paste url
+ document.displayurl.offseturl.value = location.href;
+ }
</script>
More information about the commits
mailing list