diff --git a/http/changelog.txt b/http/changelog.txt
index 952e570..5228753 100644
--- a/http/changelog.txt
+++ b/http/changelog.txt
@@ -35,6 +35,9 @@ FRONTEND:
#### Subtitlemgmt: Now uses the new Language Module
#93 WT: Now has support for custom themes! First out is a draft of trumpy81 that needs to be finetuned by trumpy81
#160 WT: Implemented Factory Reset functionality. Available through the Options menu.
+ #149 Subtitlemgmt: Implemented letters instead of straight up numbers for paging.
+ #### WT: Removed LogFiles from top menu, redirecting users to LogViewer instead.
+ #### WT: Themes are now applied on loginscreen aswell.
####
diff --git a/http/css/default.css b/http/css/default.css
index 84b0ea8..c5f32c1 100644
--- a/http/css/default.css
+++ b/http/css/default.css
@@ -27,6 +27,7 @@
th {background-color: #FE9B00; color: #242424;}
.subtitle {padding: 0px;}
+/*.subtitletable {display: none;}*/
.btn-default:hover {background-color: #FE9B00; color: #242424;}
.btn-default:focus {background-color: #FE9B00; color: #242424;}
@@ -58,11 +59,21 @@ body {background-color: #242424; padding-top:70px; padding-bottom:70px;}
.navbar-thin {min-height: 40px; padding-top: 5px; border-top: 1px solid #242424;}
.changeDisplay {display: table-cell;}
+
+ .page-selector-dropdown {display: inline;}
+ .page-selector-list {display: none;}
+
@media screen and (max-width:678px) {
.changeDisplay {display: block;}
.div-medium {width: auto;}
+
}
-
+/*
+@media screen and (max-width:1346px) {
+ .page-selector-dropdown {display: inline;}
+ .page-selector-list {display: none;}
+}
+*/
select {
background-color: #FFFFFF;
color: #000000;
diff --git a/http/index.html b/http/index.html
index 0b304da..b5063bb 100755
--- a/http/index.html
+++ b/http/index.html
@@ -45,11 +45,6 @@
Options
-
-
- Logfiles
-
Logout
diff --git a/http/jscript/functions.js b/http/jscript/functions.js
index 1f260d7..617a567 100644
--- a/http/jscript/functions.js
+++ b/http/jscript/functions.js
@@ -9,6 +9,7 @@ var webtools = {
['subtitlemgmt', 'Subtitle Management'],
['logviewer', 'LogViewer/Downloader Tool'],
['install', 'Unsupported AppStore']
+ //['findunmatched','FindUnmatched']
],
stylesheets: [],
active_stylesheet: '',
@@ -150,7 +151,8 @@ webtools.list_modules.inline([
});
},
function(callback, activatemodulename) {
- webtools.listlogfiles(callback, activatemodulename);
+ callback('LogfileNamesFetch:Ignored', activatemodulename);
+ //webtools.listlogfiles(callback, activatemodulename);
},
function(callback, activatemodulename) {
$.ajax({
@@ -292,7 +294,7 @@ webtools.save_options = function() {
};
webtools.listlogfiles = function(callback, activatemodulename) {
-
+ // Currently unused
webtools.loading();
//Name:LogfileNamesFetch
$("#LogfilesMenu").html('');
diff --git a/http/login.html b/http/login.html
index d73eb28..306ff78 100644
--- a/http/login.html
+++ b/http/login.html
@@ -48,6 +48,24 @@
$('#LoginMessage').hide();
}
});
+
+ $.ajax({
+ ///webtools2?module=settings&function=getSettings
+ url: '/webtools2?module=settings&function=getSetting&name=wt_csstheme',
+ cache: false,
+ dataType: 'JSON',
+ success: function(data) {
+ webtools.active_stylesheet = data;
+ if (data !== 'default.css') {
+ webtools.log('Found custom CSSTheme file setting (custom_themes/' + data + '). Loading it.','Core');
+ $('head').append(' ');
+ }
+ },
+ error: function(data) {
+ webtools.active_stylesheet = 'default.css';
+ webtools.log('No custom CSSTheme setting found.','Core');
+ }
+ });
});
function login() {
diff --git a/http/modules/subtitlemgmt/jscript/functions_video.js b/http/modules/subtitlemgmt/jscript/functions_video.js
index 0312a71..4bd3050 100644
--- a/http/modules/subtitlemgmt/jscript/functions_video.js
+++ b/http/modules/subtitlemgmt/jscript/functions_video.js
@@ -1,4 +1,28 @@
+
+/*
+
+PAGING:
+LetterNumber
+
+A - Size 4
+B - Size 20 [SPLIT!]
+B1 - Size 5, Start 0
+B2 - Size 5, start B1.size + B1.Start
+B3 - Size 5, start B2.size + B2.Start
+B4 - Size 5. start B3.size + B3.Start
+*/
subtitlemgmt.fetch_section_type_movies = function(section_key, pageToShow) {
+
+ subtitlemgmt.subtitle_ajax_calls.forEach(function(ajaxcall) {
+ //console.log(ajaxcall);
+ if(ajaxcall && ajaxcall.readyState != 4){
+ if (typeof ajaxcall.abort === "function") {
+ ajaxcall.abort();
+ }
+ }
+ })
+
+
$('#navfoot').html('');
$('#ContentFoot').html('');
subtitlemgmt.selected_section.currentpage = Number(pageToShow);
@@ -18,20 +42,51 @@ subtitlemgmt.fetch_section_type_movies = function(section_key, pageToShow) {
subtitlemgmt.selected_section.contents = [];
subtitlemgmt.selected_section.parents_key = [];
subtitlemgmt.selected_section.parents_title = [];
+ subtitlemgmt.selected_section.contentstype = 'video';
}
});
callback('Success');
},
function(callback) {
- // First, lets check how big the section is that the user requested to see.
$.ajax({
- url: '/webtools2?module=pms&function=getSectionSize&key=' + subtitlemgmt.selected_section.key,
+ url: '/webtools2?module=pms&function=getSectionLetterList&key=' + subtitlemgmt.selected_section.key,
+ type: 'get',
cache: false,
- dataType: 'text',
+ dataType: 'JSON',
success: function(data) {
- webtools.loading('Library Size: ' + data.replace(/"/g, ''));
- subtitlemgmt.selected_section.totalsize = data.replace(/"/g, '');
+ //console.log(data);
+ subtitlemgmt.pagelist = [];
+ for (var key in data) {
+ var start = 0;
+ //console.log(key);
+ //console.log(data[key].size + ' > ' + subtitlemgmt.options.items_per_page)
+ if (data[key].size > subtitlemgmt.options.items_per_page) {
+ var pages = Math.round(data[key].size / subtitlemgmt.options.items_per_page);
+
+ console.log('Key/Pages: ' + key + '/' + pages)
+
+ for (var i =0 ; i <= pages; i++) {
+ var size = data[key].size;
+ start = (subtitlemgmt.options.items_per_page * i);
+
+ console.log('Start: ' + start);
+ console.log('i:' + i);
+ if (data[key].size > subtitlemgmt.options.items_per_page) {
+ size = subtitlemgmt.options.items_per_page
+ data[key].size = data[key].size - subtitlemgmt.options.items_per_page;
+ }
+
+ subtitlemgmt.pagelist.push({'key':data[key].key,'size': size, 'displaykey':key + (i+1), 'start':start});
+ }
+ } else {
+ subtitlemgmt.pagelist.push({'key':data[key].key,'size':data[key].size, 'displaykey':key, 'start':start});
+ }
+ }
+ console.log(subtitlemgmt.pagelist);
+ subtitlemgmt.calculate_pages();
+ //webtools.loading('Library Size: ' + data.replace(/"/g, ''));
+ //subtitlemgmt.selected_section.totalsize = data.replace(/"/g, '');
callback('Success');
},
error: function(data) {
@@ -42,15 +97,17 @@ subtitlemgmt.fetch_section_type_movies = function(section_key, pageToShow) {
});
},
function(callback) {
-
- var start = (Number(subtitlemgmt.selected_section.currentpage) * Number(subtitlemgmt.options.items_per_page));
- webtools.loading('Library Size: ' + subtitlemgmt.selected_section.totalsize + ' Currently fetching: ' + start + '->' + (start + subtitlemgmt.options.items_per_page));
+ //console.log(subtitlemgmt.pagelist[subtitlemgmt.selected_section.currentpage].key);
+ //var start = (Number(subtitlemgmt.selected_section.currentpage) * Number(subtitlemgmt.options.items_per_page));
+ webtools.loading('Currently fetching information and subtitles for letter ' + subtitlemgmt.pagelist[subtitlemgmt.selected_section.currentpage].displaykey + " and items: " + subtitlemgmt.pagelist[subtitlemgmt.selected_section.currentpage].start + '->' + subtitlemgmt.pagelist[subtitlemgmt.selected_section.currentpage].size);
$.ajax({
- url: '/webtools2?module=pms&function=getSection&key=' + subtitlemgmt.selected_section.key + '&start=' + start + '&size=' + subtitlemgmt.options.items_per_page + '&getSubs=true',
+ //
+ url: '/webtools2?module=pms&function=getSectionByLetter&key=' + subtitlemgmt.selected_section.key + '&start=' + subtitlemgmt.pagelist[subtitlemgmt.selected_section.currentpage].start + '&size=' + subtitlemgmt.pagelist[subtitlemgmt.selected_section.currentpage].size + '&letterKey=' + encodeURI(subtitlemgmt.pagelist[subtitlemgmt.selected_section.currentpage].key) + '&getSubs=true',
cache: false,
dataType: 'JSON',
success: function(data) {
+ //console.log(data);
//console.log('Data:' + (fetchinfo.currentfetch-1) + ' :: ' + JSON.stringify(data));
data.forEach(function(video) {
video.subtitles.showsubs = true;
@@ -68,8 +125,9 @@ subtitlemgmt.fetch_section_type_movies = function(section_key, pageToShow) {
});
}
], function() {
- subtitlemgmt.display_episodes();
+ subtitlemgmt.display_episodes();
});
+
get_section_video.start(section_key);
}
@@ -101,12 +159,14 @@ subtitlemgmt.display_episodes = function() {
$('#ContentHeader').html(subtitlemgmt.selected_section.title);
}
- subtitlemgmt.calculate_pages();
+ //subtitlemgmt.calculate_pages();
$('#ContentBody').html('');
for (var i = start; i < end; i++) {
var discoveredlanguages = [];
+
+ // DISABLE HERE IF NOT TO USE FETCH ALL AT ONCE
subtitlemgmt.selected_section.contents[i].subtitles.forEach(function(subtitle) {
if (discoveredlanguages.length == 0) {
discoveredlanguages.push([subtitle.languageCode, 1]);
@@ -124,17 +184,20 @@ subtitlemgmt.display_episodes = function() {
}
}
});
+ // DISABLE HERE IF NOT TO USE FETCH ALL AT ONCE
// End of Options Time!
var AppendToTitle = '';
if (subtitlemgmt.selected_section.contentstype == 'episodes') {
AppendToTitle = '#' + subtitlemgmt.selected_section.contents[i].episode + ". ";
}
- var newEntry = [''];
+ var newEntry = ['
'];
newEntry.push('
' + AppendToTitle + subtitlemgmt.selected_section.contents[i].title + ' ');
- newEntry.push('
');
+ //Add this to below if needed Show Fetched Subtitles
+ newEntry.push('');
newEntry.push('Lang. Location Codec ');
var anysubtitleadded = false;
+ // DISABLE HERE IF NOT TO USE FETCH ALL AT ONCE
subtitlemgmt.selected_section.contents[i].subtitles.forEach(function(subtitle) {
var display_subtitle = true;
var language = 'None';
@@ -186,9 +249,12 @@ subtitlemgmt.display_episodes = function() {
newEntry.push('' + checkbox + ' ' + language + ' ' + subtitle.location + ' ' + subtitle.codec + ' ' + view + ' ');
}
});
+
+ // DISABLE HERE IF NOT TO USE FETCH ALL AT ONCE
- if (anysubtitleadded == false) {
+ if (anysubtitleadded === false) {
newEntry.pop();
+ // DISABLE HERE IF NOT TO USE FETCH ALL AT ONCE
newEntry.push('No subtitles that matched your filter. Video has a total of ' + subtitlemgmt.selected_section.contents[i].subtitles.length + ' subtitles. ');
}
newEntry.push('
');
@@ -198,8 +264,136 @@ subtitlemgmt.display_episodes = function() {
}
$('.modal').modal('hide');
+ //subtitlemgmt.check_visibility();
+}
+
+$(window).scroll(function() {
+
+ //subtitlemgmt.check_visibility();
+
+});
+
+subtitlemgmt.check_visibility = function () {
+ // Currently unused
+ $('.fetchsubtitles').each(function () {
+
+
+ var top_of_element = $(this).offset().top;
+ var bottom_of_element = $(this).offset().top + $(this).outerHeight();
+ var bottom_of_screen = screen.availHeight + $(window).scrollTop();
+ //console.log('top_of_element: ' + top_of_element);
+ //console.log('bottom_of_element: ' + bottom_of_element);
+ //console.log('bottom_of_screen: ' + bottom_of_screen);
+ if((bottom_of_screen > top_of_element) && (bottom_of_screen > bottom_of_element)){
+ // The element is visible, do something
+ //console.log($('.subtitletable',this).html());
+ $('#showsubtitle_' + $('.mediakey',this).val() ).html('Fetching Subtitledata');
+ $('.subtitletable',this).html('Fetching Subtitledata.... ');
+ //
+ //$(this).html($(this).html() + "VISIBLE");
+ $(this).removeClass('fetchsubtitles');
+
+ // Call this here and update accordingly: /webtools2?module=pms&function=getSubtitles&key=
+ // Store active Ajax calls in an array, abort them when reloading page or changing page.
+ subtitlemgmt.subtitle_ajax_calls.push(subtitlemgmt.fetchSubtitle($('.mediakey',this).val()), this);
+ //subtitlemgmt.subtitle_ajax_calls[index];
+ }
+ else {
+ console.log('NotVisble');
+ //$(this).html($(this).html() + "NOTVISIBLE");
+ // The element is not visible, do something else
+ }
+
+
+ })
}
+
+subtitlemgmt.fetchSubtitle = function (mediakey, context) {
+ // Currently unused
+ return $.ajax({
+ url: '/webtools2?module=pms&function=getSubtitles&key=' + mediakey,
+ type: 'GET',
+ dataType: 'JSON',
+ success: function(data) {
+ var counter = 0;
+ var subtitlecontent = ['Lang. Location Codec '];
+ data.forEach(function(subtitle) {
+
+ var display_subtitle = true;
+ var language = 'None';
+ var selectedsubtitle = '';
+
+ if (subtitle.languageCode != null) {
+ if (typeof(webtools.languagecodes[subtitle.languageCode.toLowerCase()]) != 'undefined') {
+ //language = ' ';
+ var languagetext = webtools.languagecodes[subtitle.languageCode.toLowerCase()];
+ if (webtools.languagecodes[subtitle.languageCode.toLowerCase()].length > 8) {
+ languagetext = webtools.languagecodes[subtitle.languageCode.toLowerCase()].substr(0, 6) + '...';
+ }
+ language = '' + languagetext + ' ';
+ } else {
+ language = subtitle.languageCode.toLowerCase();
+ }
+ }
+
+ if (subtitle.selected != null) {
+ selectedsubtitle = ' class="bg-success"';
+ }
+
+ // Options filtering
+ //if (subtitlemgmt.options.options_only_multiple) {
+ // display_subtitle = false;
+ // discoveredlanguages.forEach(function(language) {
+ // if ((language[0] == subtitle.languageCode) && (language[1] > 1)) {
+ // display_subtitle = true;
+ // }
+ // });
+ //}
+
+ if ((subtitlemgmt.options.options_hide_integrated) && (subtitle.location == 'Embedded')) {
+ display_subtitle = false;
+ }
+
+ if ((subtitlemgmt.options.options_hide_local) && (subtitle.location == 'Sidecar')) {
+ display_subtitle = false;
+ }
+ // End of options filtering
+ if (display_subtitle) {
+ //anysubtitleadded = true;
+ var view = '';
+ var checkbox = '';
+ if ( (subtitle.location == 'Sidecar') || (subtitle.location == 'Agent') ) {
+ checkbox = ' ';
+ view = 'View ';
+ }
+ counter++;
+ subtitlecontent.push('' + checkbox + ' ' + language + ' ' + subtitle.location + ' ' + subtitle.codec + ' ' + view + ' ');
+ }
+
+ });
+
+ $('.subtitletable',context).html(subtitlecontent.join('\n'));
+ $('#showsubtitle_' + mediakey ).html('Found ' + counter + ' subtitles, click here to view the list.');
+ },
+ error: function(data) {
+ $('.subtitletable',context).html('Unable to fetch subtitledata ');
+ }
+ })
+}
+
+subtitlemgmt.showsubtitletable = function (context) {
+ // Currently unused
+ //console.log($(context).parent().html());
+ //console.log($(context).parent().html());
+ if ( $('.subtitletable',$(context).parent()).is( ":hidden" ) ) {
+ $('.subtitletable',$(context).parent()).slideDown(1000);
+ } else {
+ $('.subtitletable',$(context).parent()).hide();
+ }
+}
+
+
subtitlemgmt.view_subtitle = function(mediaKey, subtitleKey) {
webtools.loading();
$.ajax({
@@ -208,10 +402,10 @@ subtitlemgmt.view_subtitle = function(mediaKey, subtitleKey) {
type: 'GET',
dataType: 'JSON',
success: function(data) {
- var subtitle = '';
+ var subtitle = '';
subtitle += 'Row# Line ';
for (i = 0; i < data.length; i++) {
- subtitle += '#' + (i + 1) + ' ' + data[i] + ' ';
+ subtitle += '#' + (i + 1) + ' ' + data[i] + ' ';
}
subtitle += '
';
diff --git a/http/modules/subtitlemgmt/jscript/subtitlemgmt.js b/http/modules/subtitlemgmt/jscript/subtitlemgmt.js
index 307239f..e5fdcb4 100644
--- a/http/modules/subtitlemgmt/jscript/subtitlemgmt.js
+++ b/http/modules/subtitlemgmt/jscript/subtitlemgmt.js
@@ -38,6 +38,7 @@ webtools.functions.subtitlemgmt = {
contentstype: ''
},
calculate_pages: function() {},
+ pagelist: [],
set_pageToShow: function() {},
fetch_section_type_show: function() {},
fetch_show_seasons: function() {},
@@ -50,7 +51,10 @@ webtools.functions.subtitlemgmt = {
subtitle_select_all: function() {},
subtitle_delete_confirm: function() {},
subtitle_delete: function() {},
- upload_dialog: function() {}
+ upload_dialog: function() {},
+ check_visibility: function() {},
+ subtitle_ajax_calls: [],
+ fetchSubtitle: function() {}
};
// Alias:
var subtitlemgmt = webtools.functions.subtitlemgmt;
@@ -259,59 +263,60 @@ subtitlemgmt.save_options = function() {
}
subtitlemgmt.calculate_pages = function() {
- //$('#ContentFoot').html('');
- var NumberOfPages = Math.ceil(subtitlemgmt.selected_section.totalsize / subtitlemgmt.options.items_per_page);
- var pages = '';
- var functiontocall = '';
- if (subtitlemgmt.selected_section.contentstype == 'video') {
- functiontocall = 'subtitlemgmt.fetch_section_type_movies';
- } else if (subtitlemgmt.selected_section.contentstype == 'shows') {
- functiontocall = 'subtitlemgmt.fetch_section_type_show';
- } else if (subtitlemgmt.selected_section.contentstype == 'seasons') {
- //functiontocall = 'fetch_show_seasons';
- functiontocall = 'subtitlemgmt.display_season';
- NumberOfPages = Math.ceil(subtitlemgmt.selected_section.contents.length / subtitlemgmt.options.items_per_page);
- } else if (subtitlemgmt.selected_section.contentstype == 'episodes') {
- functiontocall = 'subtitlemgmt.display_episodes';
- NumberOfPages = Math.ceil(subtitlemgmt.selected_section.contents.length / subtitlemgmt.options.items_per_page);
- }
-
- if (NumberOfPages > 10) {
- pages = pages + "\t";
+ // LIST END
- if ((subtitlemgmt.selected_section.currentpage + 1) < NumberOfPages) {
- pages = pages + 'Next ';
+ // DROPDOWN BEGIN
+ pages = pages + "";
- } else if (NumberOfPages > 1) {
- pages = pages + "\t";
- }
- $("#navfoot").html(pages);
+ pages = pages + ' ';
+ if ((subtitlemgmt.selected_section.currentpage + 1) < subtitlemgmt.pagelist.length) {
+ pages = pages + 'Next ';
+ }
+ pages = pages + "";
+ // DROPDOWN END
+ $("#navfoot").html(pages);
+ /* END OF PAGING THAT MIGHT BE ABLE TO BE MOVED TO SEPERATE FUNCTION */
}
subtitlemgmt.show_options = function() {