| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- $(document).ready(function () {
- initList(".");
- });
- function initList(dir) {
- $.ajax({
- url: "./script/php/video/getDir.php",
- type: "POST",
- data: {
- dir: dir,
- },
- dataType: "json"
- }).done(function (result) {
- $("#video-list").empty();
- dir_names = result["dir_names"];
- file_tables = result["file_tables"];
- if (result["parent"] != undefined)
- parent = result["parent"];
- //directory
- for (i = 0; i < dir_names.length; i++) {
- $("#video-list").append('<div class="col-md-3">' +
- '<section class="panel">' +
- "<a href='#' onclick='initList(\"" + dir_names[i]["dir_name"] + "\")'>" +
- '<img class="active" src="./assets/images/folder-icon.png">' +
- '</a>' +
- '<div class="panel-body" id="">' +
- "<p><i class='fa fa-folder'></i><a href='#' onclick='initList(\"" + dir_names[i]["dir_name"] + "\")'>" + dir_names[i]["dir_name"] + "</a></p>" +
- '</div>' +
- '</section>' +
- '</div>');
- }
- //video
- for (j = 0; j < file_tables.length; j++) {
- if (file_tables[j]["file_path"].includes(".m3u8")) {
- $("#video-list").append('<div class="col-md-3">' +
- '<section class="panel">' +
- "<a href='#' onclick='getVideo(" + file_tables[j]["id"] + ")'>" +
- '<img class="static" src="' + file_tables[j]["file_path"].replace("m3u8", "jpg") + '">' +
- '<img class="active" src="' + file_tables[j]["file_path"].replace("m3u8", "gif") +
- '">' +
- '</a>' +
- '<div class="panel-body" id="">' +
- "<p><i class='fa fa-video-camera'></i><a href='#' onclick='getVideo(" + file_tables[j]["title"].split("-")[0] + ")'>" + file_tables[j]["title"] + "</a></p>" +
- '</div>' +
- '</section>' +
- '</div>');
- }
- }
- }).error(function (error) {
- console.log(error);
- });
- }
- function getVideo(id) {
- $.redirect('./video-play.php', {
- 'id': id
- });
- }
|