|
|
@@ -111,4 +111,56 @@
|
|
|
}).error(function (error) {
|
|
|
console.log(error);
|
|
|
});
|
|
|
+ }
|
|
|
+
|
|
|
+ function search_video(search_word) {
|
|
|
+ $.ajax({
|
|
|
+ url: "./script/php/video/get_video_search.php",
|
|
|
+ type: "POST",
|
|
|
+ data: {
|
|
|
+ search: search_word,
|
|
|
+ },
|
|
|
+ dataType: "json"
|
|
|
+ }).done(function (result) {
|
|
|
+ file_tables = result["file_tables"];
|
|
|
+
|
|
|
+ if(!file_tables.length) {
|
|
|
+ $("#video-list").append('<h2 align="center">無符合選項</h2>')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ 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"] + ",\"" + file_tables[j]["file_path"].split("/")[file_tables[j]["file_path"].split("/").length - 2] + "\")'>" +
|
|
|
+ '<img style="aspect-ratio: 4/3;" class="video-static" src="' + file_tables[j]["file_path"].replace("m3u8", "jpg") + '">' +
|
|
|
+ '<img style="aspect-ratio: 4/3;" class="video-active" src="' + file_tables[j]["file_path"].replace("m3u8", "gif") +
|
|
|
+ '">' +
|
|
|
+ '</a>' +
|
|
|
+ '<div class="panel-body" id="">' +
|
|
|
+ '<div class="video-text">' +
|
|
|
+ "<p style='font-size: 20px;'><i class='fa fa-video-camera'></i><a class='video-font' href='#' onclick='getVideo(" + file_tables[j]["id"] + ",\"" + file_tables[j]["file_path"].split("/")[file_tables[j]["file_path"].split("/").length - 2] + "\")'>" + file_tables[j]["title"] + "</a></p>" +
|
|
|
+ '</div>' +
|
|
|
+ '</div>' +
|
|
|
+ '</section>' +
|
|
|
+ '</div>');
|
|
|
+ } else if (file_tables[j]["file_path"].includes(".pdf")) {
|
|
|
+ $("#video-list").append('<div class="col-md-3">' +
|
|
|
+ '<section class="panel">' +
|
|
|
+ "<a target='_blank' href='" + file_tables[j]["file_path"] + "'>" +
|
|
|
+ '<img style="aspect-ratio: 4/3;" class="video-active" src="' + file_tables[j]["file_path"].replace("pdf", "jpg") + '">' +
|
|
|
+ '</a>' +
|
|
|
+ '<div class="panel-body" id="">' +
|
|
|
+ '<div class="video-text">' +
|
|
|
+ "<p style='font-size: 20px;'><i class='fa fa-file-pdf-o'></i><a class='video-font' target='_blank' href='" + file_tables[j]["file_path"] + "'>" + file_tables[j]["title"] + "</a></p>" +
|
|
|
+ '</div>' +
|
|
|
+ '</div>' +
|
|
|
+ '</section>' +
|
|
|
+ '</div>');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).error(function (error) {
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
}
|