vov-mobile

Check-in [8bbdac7c0a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Integrate Ajax Now Playing. Try to keep touch events from bleeding through.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:8bbdac7c0aa075617f9f7cd953ce69f98f05a91ecc3739e004345d689d17e37a
User & Date: ajv-899-334-8894@vsta.org 2016-07-29 19:18:07
Context
2016-07-29
19:19
Merge branch 'master' of https://github.com/vandys/vov-mobile Conflicts: index.html check-in: cc55f8d3e5 user: ajv-899-334-8894@vsta.org tags: master, trunk
19:18
Integrate Ajax Now Playing. Try to keep touch events from bleeding through. check-in: 8bbdac7c0a user: ajv-899-334-8894@vsta.org tags: master, trunk
2016-07-26
05:09
Move radio JS to its own source file. Put calendar into optional second half of window when there's room. check-in: 57b6e0deee user: ajv-899-334-8894@vsta.org tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to imgs.js.

10
11
12
13
14
15
16

17
18
19
20
21
22
23
..
24
25
26
27
28
29
30

31
32
33
34
35
36
37
function bandown(evt) {
    if (pressX == null) {
	touch_handle = "mousemove";
	touch_handler = banmove;
	slider.addEventListener("mousemove", banmove);
	pressX = evt.pageX;
    }

}
// Touch down
function bantdown(evts) {
    if (evts.targetTouches.length != 1) {
	return;
    }
    if (pressX == null) {
................................................................................
	var evt = evts.targetTouches[0];

	touch_handle = "touchmove";
	touch_handler = bantmove;
	slider.addEventListener("touchmove", bantmove);
	pressX = evt.pageX;
    }

}

// Mouse up or off screen
function bandone() {
    if (pressX != null) {
	slider.removeEventListener(touch_handle, touch_handler);
	pressX = touch_handle = touch_handler = null;







>







 







>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function bandown(evt) {
    if (pressX == null) {
	touch_handle = "mousemove";
	touch_handler = banmove;
	slider.addEventListener("mousemove", banmove);
	pressX = evt.pageX;
    }
    evt.stopPropagation();
}
// Touch down
function bantdown(evts) {
    if (evts.targetTouches.length != 1) {
	return;
    }
    if (pressX == null) {
................................................................................
	var evt = evts.targetTouches[0];

	touch_handle = "touchmove";
	touch_handler = bantmove;
	slider.addEventListener("touchmove", bantmove);
	pressX = evt.pageX;
    }
    evts.stopPropagation();
}

// Mouse up or off screen
function bandone() {
    if (pressX != null) {
	slider.removeEventListener(touch_handle, touch_handler);
	pressX = touch_handle = touch_handler = null;

Changes to index.html.

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
...
102
103
104
105
106
107
108

109
110
111
  </td>
  <td width="30%"></td>
</tr>
<tr>
  <td width="30%"><img
    style="display: block; margin: 0 auto"
    src="http://amrivalencia.com/icon/star.svg"></td>
  <td width="40%" style="color: black; text-align: center; font-size: large">
   KVSH-LP - Voice of Vashon
  </td>
  <td width="30%"><img
    style="display: block; margin: 0 auto"
    src="http://amrivalencia.com/icon/share.svg"></td>
</tr>
</table>
................................................................................
</iframe>

</td>
</tr>
</table>

<script src="imgs.js"></script>


</body>
</html>







|







 







>



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
...
102
103
104
105
106
107
108
109
110
111
112
  </td>
  <td width="30%"></td>
</tr>
<tr>
  <td width="30%"><img
    style="display: block; margin: 0 auto"
    src="http://amrivalencia.com/icon/star.svg"></td>
  <td id="nptext" width="40%" style="color: black; text-align: center; font-size: large">
   KVSH-LP - Voice of Vashon
  </td>
  <td width="30%"><img
    style="display: block; margin: 0 auto"
    src="http://amrivalencia.com/icon/share.svg"></td>
</tr>
</table>
................................................................................
</iframe>

</td>
</tr>
</table>

<script src="imgs.js"></script>
<script src="nowplaying.js"></script>

</body>
</html>

Added nowplaying.js.



































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// nowplaying.js
//	Keep the "nptext" area updated with tracks from KVSH
//

function ajax_http_get(url, callback) {
    var req = null;
    try {
        req = new XMLHttpRequest();
    }
    catch (e) {
	alert("Your browser does not support AJAX!");
	return false;
    }
    req.open("GET", url, true);
    req.onreadystatechange = function() {
        if (req.readyState == 4) {
            callback(req);
        }
    }
    req.send(null);
}

function fetch_next(ver) {
    ajax_http_get("http://voiceofvashon.org:8888/nowplaying?ver="+ver, test_handle);
}

function test_handle(req) {
    // Response is <new-ver#>\n<history-body>
    var t = req.responseText
    var idx = t.indexOf("\n")
    if (idx == -1) {
	// alert("Malformed response");
	// Incomplete read; probably page reloading
	return false;
    }

    // Write current playing text into "nptext" area
    var elem = document.getElementById('nptext')
    elem.textContent = t.substr(idx+1)


    // <new-ver#> is used to wait for future change
    var ver = t.substr(0,idx)
    fetch_next(ver)
}

// Kick off initial content fetch
fetch_next("0");