From 13e60e121c60538861f6c9d0d0d701058b8e848b Mon Sep 17 00:00:00 2001 From: jacky Date: Wed, 11 Aug 2021 11:05:35 +0800 Subject: [PATCH] add list view for playlist --- js/moovie.js | 1319 ++++++++++++++++--------------- js/plugins/playlist/README.md | 4 + js/plugins/playlist/playlist.js | 193 ++++- 3 files changed, 858 insertions(+), 658 deletions(-) diff --git a/js/moovie.js b/js/moovie.js index 2d41ffc..0c53498 100644 --- a/js/moovie.js +++ b/js/moovie.js @@ -1,4 +1,3 @@ - /*------------------------- moovie.js - HTML5 Media player made for movies Made by: Bruno Vieira @@ -8,34 +7,34 @@ class Moovie { constructor(options) { const defaults = { - selector : 'defaultId', - dimensions : { - width: "100%" + selector: 'defaultId', + dimensions: { + width: "100%" }, - config : { - storage : { + config: { + storage: { captionOffset: false, playrateSpeed: false, captionSize: false }, - controls : { - playtime : true, - mute : true, - volume : true, - subtitles : true, - config : true, - fullscreen : true, - submenuCaptions : true, - submenuOffset : true, - submenuSpeed : true, - allowLocalSubtitles : true + controls: { + playtime: true, + mute: true, + volume: true, + subtitles: true, + config: true, + fullscreen: true, + submenuCaptions: true, + submenuOffset: true, + submenuSpeed: true, + allowLocalSubtitles: true }, - i18n : { - play : "(Play:Pause)", - mute : "(Mute:Unmute)", - subtitles : "(Enable:Disable) Subtitles", - config : "Settings", - fullscreen : "(Enter:Exit) Fullscreen", + i18n: { + play: "(Play:Pause)", + mute: "(Mute:Unmute)", + subtitles: "(Enable:Disable) Subtitles", + config: "Settings", + fullscreen: "(Enter:Exit) Fullscreen", main_topic: "settings:", main_caption: "Captions", main_offset: "Caption Offset", @@ -49,40 +48,35 @@ class Moovie { speed_topic: "Speed Adjust" } }, - icons : { + icons: { path: "./icons/" }, - customEvents: [ - { - type: "", - to: "", - starttime: "", - endtime: "", - content: "", - position: "", - class: "" - } - ] - }; + customEvents: [{ + type: "", + to: "", + starttime: "", + endtime: "", + content: "", + position: "", + class: "" + }] + }; // Player Random ID var randomID = Math.floor(Math.random() * (9999 - 0 + 1)) + 0; - + // Get Defaults Controls options.config == undefined ? options.config = defaults.config : options.config; options.config.controls == undefined ? options.config.controls = defaults.config.controls : options.config.controls - for(var key in defaults.config.controls) - { options.config.controls[key] == undefined ? options.config.controls[key] = defaults.config.controls[key] : options.config.controls[key] = options.config.controls[key]; } + for (var key in defaults.config.controls) { options.config.controls[key] == undefined ? options.config.controls[key] = defaults.config.controls[key] : options.config.controls[key] = options.config.controls[key]; } // Get default storage options.config.storage == undefined ? options.config.storage = defaults.config.storage : options.config.storage - for(var key in defaults.config.storage) - { options.config.storage[key] == undefined ? options.config.storage[key] = defaults.config.storage[key] : options.config.storage[key] = options.config.storage[key];} + for (var key in defaults.config.storage) { options.config.storage[key] == undefined ? options.config.storage[key] = defaults.config.storage[key] : options.config.storage[key] = options.config.storage[key]; } // Get default i18n options.config.i18n == undefined ? options.config.i18n = defaults.config.i18n : options.config.i18n - for(var key in defaults.config.i18n) - { options.config.i18n[key] == undefined ? options.config.i18n[key] = defaults.config.i18n[key] : options.config.i18n[key] = options.config.i18n[key];} + for (var key in defaults.config.i18n) { options.config.i18n[key] == undefined ? options.config.i18n[key] = defaults.config.i18n[key] : options.config.i18n[key] = options.config.i18n[key]; } this.selector = options.selector.substring(1) || defaults.selector.substring(1); this.dimensions = options.dimensions || defaults.dimensions; @@ -97,7 +91,7 @@ class Moovie { captions: { name: false, subtitles: false - }, + }, offset: { value: false } @@ -105,7 +99,15 @@ class Moovie { // Global var _this = this; - var parts, video, subtitles = 0, fullyloaded = 0, cuevalue = 0, speed = 1, moovie_el_play, moovie_el_buffered, moovie_el_mute, moovie_el_subtitles, moovie_el_fullscreen, moovie_el_locally, moovie_ul_soundv, moovie_el_sinput, moovie_el_rinput, hassubtitles = 0, moovie_el_range, moovie_el_localsub, moovie_el_speed, moovie_ishiden = 0, moovie_el_cuetimer, moovie_el_player, moovie_elprogress, moovie_el_toggle, ranges, fullscreen, offsettime=0, isopen = 0, moovie_el_volume, moovie_el_video, moovie_el_poster, moovie_el_submenu, moovie_el_controls, moovie_el_progress, moovie_el_captions, moovie_el_submain; + var parts, video, subtitles = 0, + fullyloaded = 0, + cuevalue = 0, + speed = 1, + moovie_el_play, moovie_el_buffered, moovie_el_mute, moovie_el_subtitles, moovie_el_fullscreen, moovie_el_locally, moovie_ul_soundv, moovie_el_sinput, moovie_el_rinput, hassubtitles = 0, + moovie_el_range, moovie_el_localsub, moovie_el_speed, moovie_ishiden = 0, + moovie_el_cuetimer, moovie_el_player, moovie_elprogress, moovie_el_toggle, ranges, fullscreen, offsettime = 0, + isopen = 0, + moovie_el_volume, moovie_el_video, moovie_el_poster, moovie_el_submenu, moovie_el_controls, moovie_el_progress, moovie_el_captions, moovie_el_submain; var selectedCaption = []; var icons = this.icons; var config = this.config; @@ -114,58 +116,57 @@ class Moovie { var customEvents = this.customEvents; // Main menu object - var mainmenu = this.mainmenu = [ - { + var mainmenu = this.mainmenu = [{ name: "play_button", - element: "", + element: "", opcional: false, tooltip: this.i18n.play }, { name: "progress_bar", - element: "
loading...
", + element: "
loading...
", opcional: false, - tooltip: false + tooltip: false }, { name: "playtime", - element: "
00:00 /
", + element: "
00:00 /
", opcional: true, - tooltip: false + tooltip: false }, { name: "mute", - element: "", + element: "", opcional: true, tooltip: this.i18n.mute }, { name: "volume", - element: "", + element: "", opcional: true, tooltip: false }, { name: "subtitles", - element: "", + element: "", opcional: true, - tooltip: this.i18n.subtitles + tooltip: this.i18n.subtitles }, { name: "config", - element: "", + element: "", opcional: true, tooltip: this.i18n.config }, { name: "fullscreen", - element: "", + element: "", opcional: true, tooltip: this.i18n.fullscreen }, { name: "Main Submenu", - element: "", + element: "", opcional: false, tooltip: false } @@ -173,57 +174,54 @@ class Moovie { // Main submenu object var submenu = this.submenu = { - mainSubmenu : { - mainElement : "", - parentID : "moovie_submenu_main_", - elements : [ - { + mainSubmenu: { + mainElement: "", + parentID: "moovie_submenu_main_", + elements: [{ name: "topic", - element: "
  • "+this.i18n.main_topic+"
  • ", - opcional: false + element: "
  • " + this.i18n.main_topic + "
  • ", + opcional: false }, { name: "submenuCaptions", - element: "
  • "+this.i18n.main_caption+""+this.i18n.main_disabled+"
  • ", + element: "
  • " + this.i18n.main_caption + "" + this.i18n.main_disabled + "
  • ", opcional: true - }, + }, { name: "submenuOffset", - element: "
  • "+this.i18n.main_offset+"0s
  • ", + element: "
  • " + this.i18n.main_offset + "0s
  • ", opcional: true - }, + }, { name: "submenuSpeed", - element: "
  • "+this.i18n.main_speed+""+this.i18n.main_default+"
  • ", + element: "
  • " + this.i18n.main_speed + "" + this.i18n.main_default + "
  • ", opcional: true - } + } ] }, - captionSubmenu : { - mainElement : "", - parentID : "moovie_submenu_captions_", - elements: [ - { - name: "allowLocalSubtitles", - element: "
  • "+this.i18n.caption_load+"
  • ", - opcional: true - } - ] + captionSubmenu: { + mainElement: "", + parentID: "moovie_submenu_captions_", + elements: [{ + name: "allowLocalSubtitles", + element: "
  • " + this.i18n.caption_load + "
  • ", + opcional: true + }] + }, + rangeSubmenu: { + mainElement: "