From b97976a56038fd4deeb317d0856c7910e984fa7a Mon Sep 17 00:00:00 2001 From: railsjack Date: Fri, 9 Aug 2019 18:13:47 -0300 Subject: [PATCH] Added a feature to clear SELECT tag before add options --- player/custom.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/player/custom.js b/player/custom.js index 23c4af9..745b6c1 100644 --- a/player/custom.js +++ b/player/custom.js @@ -41,7 +41,7 @@ var TutorialList = function () { var _load = function () { var cached_data_dir = _get_dir(); - if(cached_data_dir) { + if (cached_data_dir) { _load_script(cached_data_dir + '/list_mp4.js'); _load_script(cached_data_dir + '/list_vtt.js'); setTimeout(_load_html, 500); @@ -56,7 +56,7 @@ var TutorialList = function () { var _set_dir = function () { const app = require('electron').remote.app - var basepath = app.getAppPath(); + var basepath = _get_dir() || app.getAppPath(); const dialog = require('electron').remote.dialog const data_dir = dialog.showOpenDialog(null, { properties: ['openDirectory'], @@ -73,9 +73,16 @@ var TutorialList = function () { return cached_data_dir; }; + var _clear_html = function () { + while (tutorialList.childNodes.length > 0) { + tutorialList.removeChild(); + } + }; var _load_html = function () { + _clear_html(); + var temp_vtt_file_dir = ''; var optionNode;