wplayer

Check-in [ad7942058e]
Login

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

Overview
Comment:Support ES5 for now, Tint browser on tablet
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:ad7942058ecff2e34160c1556616e6344b2fd91ac3638f0a0122f8e2b35299ad
User & Date: ajv-899-334-8894@vsta.org 2017-04-22 03:41:13
Context
2017-04-22
03:41
Dynamic reload of index contents. check-in: 14a0ab9378 user: ajv-899-334-8894@vsta.org tags: master, trunk
03:41
Support ES5 for now, Tint browser on tablet check-in: ad7942058e user: ajv-899-334-8894@vsta.org tags: master, trunk
2017-03-13
13:27
Note on search check-in: 8d3bd7470b user: ajv-899-334-8894@vsta.org tags: master, trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to js/player.js.

1
2
3
4





5
6
7
8
9
10
11
..
61
62
63
64
65
66
67

68
69
70
71
72
73
74
75
76
77
78

79
80
81
82
83
84
85
86
...
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
...
236
237
238
239
240
241
242

243
244
245
246
247
248
249
250
...
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
//
// player.js
//	One-page-app to play music from a web server
//







// The HTML5 player
var player = document.getElementById("player");

// File/dir browsing
var browser = document.getElementById("browser");
................................................................................
    }
    indexed = pcontents.index;
    searchbar.style.display = indexed ? '' : 'none';

    // Directories (if any)
    if (pcontents.dirs.length > 0) {
	res += '<b>Directories</b>:<br>';

	for (var didx = 0; didx < pcontents.dirs.length; didx++) {
	    d = pcontents.dirs[didx];
	    res += '<button onclick="return go_dir(' + didx.toString() + ');">'
	    res += ' <img src="/imgs/player_play.png" alt="enter" />\n'
	    res += '</button>' + unescape(d) + '<br>\n'
	}
    }

    // Files (if any)
    if (pcontents.files.length > 0) {
	res += '<b>Files</b>:<br>';

	for (var fidx = 0; fidx < pcontents.files.length; fidx++) {
	    f = pcontents.files[fidx];
	    res += '<button onclick="return go_file(' + fidx.toString() + ');">'
	    res += ' <img src="/imgs/player_play.png" alt="play" />\n'
	    res += '</button>' + unescape(f) + '<br>\n'
	}
    }

................................................................................
	res += elem;
    }
    return res;
}

// Update playlist queue pane
function paintQueue() {
    var f, res = '';
    for (var fidx = 0; fidx < playlist.length; fidx++) {
	f = do_trim(unescape(playlist[fidx]));
	res += f + '\n';
    }
    pqueue.textContent = res;
}

// Get a dir/file listing from the URL
................................................................................
    paintQueue();
}

// Add all files in current folder to playlist
// (i.e., "play album")
function addAll() {
    if (pcontents.files.length > 0) {

	for (var fidx = 0; fidx < pcontents.files.length; fidx++) {
	    go_file(fidx);
	}
    }
}

// Clear the decks!
function dropAll() {
................................................................................
function srch() {
    // Action pending
    if (pcontents == null) {
        return;
    }

    // Probably backspace to clear out search field
    let s = searchval.value;
    if (s.length == 0) {
        curdir();
        return;
    }

    // Get a set of options based on the current path
    //  and search value
    const url = "/search" + path + "?q=" + escape(s);
    pdepth += 1;
    getDir(url);
}

// Set up the player
player.addEventListener("ended", playNext);

// Initial browser window update
curdir();




>
>
>
>
>







 







>
|










>
|







 







|
|







 







>
|







 







|







|









1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
..
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
...
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
...
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
...
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
//
// player.js
//	One-page-app to play music from a web server
//
// This source file is written for pre-ES5, because:
//  The Tint browser does mp3/ogg/flac, but not ES5/ES6
//  Chrome does mp3/ogg/flac and ES6, but crashes on my tablet
//  Firefox does mp3/ogg and ES6, but not flac (on Android, thanks)
//


// The HTML5 player
var player = document.getElementById("player");

// File/dir browsing
var browser = document.getElementById("browser");
................................................................................
    }
    indexed = pcontents.index;
    searchbar.style.display = indexed ? '' : 'none';

    // Directories (if any)
    if (pcontents.dirs.length > 0) {
	res += '<b>Directories</b>:<br>';
        var didx;
	for (didx = 0; didx < pcontents.dirs.length; didx++) {
	    d = pcontents.dirs[didx];
	    res += '<button onclick="return go_dir(' + didx.toString() + ');">'
	    res += ' <img src="/imgs/player_play.png" alt="enter" />\n'
	    res += '</button>' + unescape(d) + '<br>\n'
	}
    }

    // Files (if any)
    if (pcontents.files.length > 0) {
	res += '<b>Files</b>:<br>';
        var fidx;
	for (fidx = 0; fidx < pcontents.files.length; fidx++) {
	    f = pcontents.files[fidx];
	    res += '<button onclick="return go_file(' + fidx.toString() + ');">'
	    res += ' <img src="/imgs/player_play.png" alt="play" />\n'
	    res += '</button>' + unescape(f) + '<br>\n'
	}
    }

................................................................................
	res += elem;
    }
    return res;
}

// Update playlist queue pane
function paintQueue() {
    var fidx, f, res = '';
    for (fidx = 0; fidx < playlist.length; fidx++) {
	f = do_trim(unescape(playlist[fidx]));
	res += f + '\n';
    }
    pqueue.textContent = res;
}

// Get a dir/file listing from the URL
................................................................................
    paintQueue();
}

// Add all files in current folder to playlist
// (i.e., "play album")
function addAll() {
    if (pcontents.files.length > 0) {
        var fidx;
	for (fidx = 0; fidx < pcontents.files.length; fidx++) {
	    go_file(fidx);
	}
    }
}

// Clear the decks!
function dropAll() {
................................................................................
function srch() {
    // Action pending
    if (pcontents == null) {
        return;
    }

    // Probably backspace to clear out search field
    var s = searchval.value;
    if (s.length == 0) {
        curdir();
        return;
    }

    // Get a set of options based on the current path
    //  and search value
    var url = "/search" + path + "?q=" + escape(s);
    pdepth += 1;
    getDir(url);
}

// Set up the player
player.addEventListener("ended", playNext);

// Initial browser window update
curdir();