merged from develop
This commit is contained in:
1306
mediaserver/platformcode/template/css/alfa.css
Normal file
1306
mediaserver/platformcode/template/css/alfa.css
Normal file
File diff suppressed because one or more lines are too long
BIN
mediaserver/platformcode/template/favicon.ico
Normal file
BIN
mediaserver/platformcode/template/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
7
mediaserver/platformcode/template/html/config_bool.html
Normal file
7
mediaserver/platformcode/template/html/config_bool.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<li onmousemove="focus_element(this.getElementsByTagName('input')[0])">
|
||||
<div class="control">
|
||||
<span class="name" style='color:%item_color'>%item_label</span>
|
||||
<input class="checkbox" onchange="evaluate_controls(this)" onfocus="this.parentNode.className='control control_focused'" onblur="this.parentNode.className='control'" type="checkbox" id="%item_id" %item_value>
|
||||
<label class="checkbox"><i></i></label>
|
||||
</div>
|
||||
</li>
|
||||
@@ -0,0 +1 @@
|
||||
<a class="control_button" href="javascript:void(0)"onmouseover="focus_element(this)" onclick="change_category('%item_category')">%item_label</a>
|
||||
@@ -0,0 +1 @@
|
||||
<ul class="settings_list" style="display:none" id="%item_id">%item_value</ul>
|
||||
5
mediaserver/platformcode/template/html/config_label.html
Normal file
5
mediaserver/platformcode/template/html/config_label.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<li>
|
||||
<div>
|
||||
<span class="name" style='color:%item_color'>%item_label</span>
|
||||
</div>
|
||||
</li>
|
||||
7
mediaserver/platformcode/template/html/config_list.html
Normal file
7
mediaserver/platformcode/template/html/config_list.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<li onmousemove="focus_element(this.getElementsByTagName('select')[0])">
|
||||
<div class="control">
|
||||
<span class="name" style='color:%item_color'>%item_label</span>
|
||||
<select class="list" onchange="evaluate_controls(this)" name="%item_type" onfocus="this.parentNode.className='control control_focused'" onblur="this.parentNode.className='control'" id="%item_id">%item_values</select>
|
||||
<label class="list"><i></i></label>
|
||||
</div>
|
||||
</li>
|
||||
4
mediaserver/platformcode/template/html/config_sep.html
Normal file
4
mediaserver/platformcode/template/html/config_sep.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<li>
|
||||
<div class="separator">
|
||||
</div>
|
||||
</li>
|
||||
7
mediaserver/platformcode/template/html/config_text.html
Normal file
7
mediaserver/platformcode/template/html/config_text.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<li onmousemove="focus_element(this.getElementsByTagName('input')[0])">
|
||||
<div class="control">
|
||||
<span class="name" style='color:%item_color'>%item_label</span>
|
||||
<input class="text" onchange="evaluate_controls(this)" onkeyup="evaluate_controls(this)" onfocus="this.parentNode.className='control control_focused'" onblur="this.parentNode.className='control'" onkeypress="%keypress" type="%item_type" id="%item_id" value="%item_value">
|
||||
<label class="text"><i></i></label>
|
||||
</div>
|
||||
</li>
|
||||
10
mediaserver/platformcode/template/html/itemlist_banner.html
Normal file
10
mediaserver/platformcode/template/html/itemlist_banner.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<li class="item_banner">
|
||||
<a class="item %item_class" onblur="unload_info(this)" oncontextmenu="dialog.menu('Menu','%menu_items');return false" onfocus="focused_item=this;load_info(this, 'banner')" onmouseover="focus_element(this)" href="javascript:void(0)" onclick="send_request('%item_url')">
|
||||
<img class="thumbnail" onerror="this.style.visibility='hidden'">
|
||||
<h3 class="label">%item_title</h3>
|
||||
<label class="thumbnail">%item_thumbnail</label>
|
||||
<label class="plot">%item_plot</label>
|
||||
<label class="fanart">%item_fanart</label>
|
||||
</a>
|
||||
%item_menu
|
||||
</li>
|
||||
10
mediaserver/platformcode/template/html/itemlist_channel.html
Normal file
10
mediaserver/platformcode/template/html/itemlist_channel.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<li class="item_channel">
|
||||
<a class="item %item_class" onblur="unload_info(this)" oncontextmenu="dialog.menu('Menu','%menu_items');return false" onfocus="focused_item=this;load_info(this, 'channel')" onmouseover="focus_element(this)" href="javascript:void(0)" onclick="send_request('%item_url')">
|
||||
<h3 class="label">%item_title</h3>
|
||||
<img class="thumbnail" onerror="this.style.visibility='hidden'" onload="this.parentNode.children[0].style.visibility='hidden'">
|
||||
<label class="thumbnail">%item_thumbnail</label>
|
||||
<label class="plot">%item_plot</label>
|
||||
<label class="fanart">%item_fanart</label>
|
||||
</a>
|
||||
%item_menu
|
||||
</li>
|
||||
10
mediaserver/platformcode/template/html/itemlist_list.html
Normal file
10
mediaserver/platformcode/template/html/itemlist_list.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<li class="item_list">
|
||||
<a class="item %item_class" onblur="unload_info(this)" oncontextmenu="dialog.menu('Menu','%menu_items');return false" onfocus="focused_item=this;load_info(this, 'list')" onmouseover="focus_element(this)" href="javascript:void(0)" onclick="send_request('%item_url')">
|
||||
<h3 class="label">%item_title</h3>
|
||||
<img class="thumbnail" onerror="image_error(this)">
|
||||
<label class="thumbnail">%item_thumbnail</label>
|
||||
<label class="plot">%item_plot</label>
|
||||
<label class="fanart">%item_fanart</label>
|
||||
</a>
|
||||
%item_menu
|
||||
</li>
|
||||
@@ -0,0 +1 @@
|
||||
<a class="item_menu" href="javascript:void(0)" onmouseover="focus_element(this)" onclick="focused_item=this;dialog.menu('Menu','%menu_items')"></a>
|
||||
10
mediaserver/platformcode/template/html/itemlist_movie.html
Normal file
10
mediaserver/platformcode/template/html/itemlist_movie.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<li class="item_movie">
|
||||
<a class="item %item_class" onblur="unload_info(this)" oncontextmenu="dialog.menu('Menu','%menu_items');return false" onfocus="focused_item=this;load_info(this, 'movie')" onmouseover="focus_element(this)" href="javascript:void(0)" onclick="send_request('%item_url')">
|
||||
<h3 class="label">%item_title</h3>
|
||||
<img class="thumbnail" onerror="image_error(this)">
|
||||
<label class="thumbnail">%item_thumbnail</label>
|
||||
<label class="plot">%item_plot</label>
|
||||
<label class="fanart">%item_fanart</label>
|
||||
</a>
|
||||
%item_menu
|
||||
</li>
|
||||
6
mediaserver/platformcode/template/html/player_flash.html
Normal file
6
mediaserver/platformcode/template/html/player_flash.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<object class="media_player" data="http://releases.flowplayer.org/swf/flowplayer-3.2.18.swf" type="application/x-shockwave-flash">
|
||||
<param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.18.swf" />
|
||||
<param name="allowfullscreen" value="true" />
|
||||
<param name="allowscriptaccess" value="always" />
|
||||
<param name="flashvars" value='config={"clip":{"url":"%video_url"},"playlist":[{"url":"%video_url"}]}' />
|
||||
</object>
|
||||
1
mediaserver/platformcode/template/html/player_html.html
Normal file
1
mediaserver/platformcode/template/html/player_html.html
Normal file
@@ -0,0 +1 @@
|
||||
<video class="media_player" id="media_player" type="application/x-mplayer2" autoplay="true" controls="true" src="%video_url"/>
|
||||
7
mediaserver/platformcode/template/html/player_vlc.html
Normal file
7
mediaserver/platformcode/template/html/player_vlc.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<object class="media_player" classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab" id="vlc" events="False">
|
||||
<param name="Src" value="%video_url"></param>
|
||||
<param name="ShowDisplay" value="True"></param>
|
||||
<param name="AutoLoop" value="no"></param>
|
||||
<param name="AutoPlay" value="yes"></param>
|
||||
<embed type="application/x-google-vlc-plugin" name="vlcfirefox" autoplay="yes" loop="no" width="100%" height="100%" target="%video_url"></embed>
|
||||
</object>
|
||||
5
mediaserver/platformcode/template/html/select_item.html
Normal file
5
mediaserver/platformcode/template/html/select_item.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<li class="item">
|
||||
<a href="javascript:void(0)" onmouseover="focus_element(this)" onclick="dialog.closeall(); %item_action">
|
||||
<h3>%item_title</h3>
|
||||
</a>
|
||||
</li>
|
||||
BIN
mediaserver/platformcode/template/icon-512.png
Normal file
BIN
mediaserver/platformcode/template/icon-512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 85 KiB |
503
mediaserver/platformcode/template/js/dialogs.js
Normal file
503
mediaserver/platformcode/template/js/dialogs.js
Normal file
@@ -0,0 +1,503 @@
|
||||
loading.close = function () {
|
||||
var el = document.getElementById("window_loading");
|
||||
if (el.style.display == "block") {
|
||||
el.style.display = "none";
|
||||
document.getElementById("window_overlay").style.display = "none";
|
||||
if (focused_item) {
|
||||
focused_item.focus();
|
||||
}
|
||||
else if (document.getElementById("itemlist").children.length) {
|
||||
document.getElementById("itemlist").children[0].children[0].focus();
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
loading.show = function (message) {
|
||||
if (!message) {
|
||||
message = "Cargando...";
|
||||
};
|
||||
var el = document.getElementById("window_loading");
|
||||
el.getElementById("loading_message").innerHTML = message;
|
||||
document.getElementById("window_overlay").style.display = "block";
|
||||
el.style.display = "block";
|
||||
el.getElementById("loading_message").focus();
|
||||
center_window(el);
|
||||
};
|
||||
|
||||
dialog.closeall = function () {
|
||||
document.getElementById('window_overlay').style.display = 'none';
|
||||
document.getElementById("window_loading").style.display = "none";
|
||||
document.getElementById("window_select").style.display = "none";
|
||||
document.getElementById("window_settings").style.display = "none";
|
||||
document.getElementById("window_settings").style.display = "none";
|
||||
document.getElementById("window_player").style.display = "none";
|
||||
document.getElementById("window_player").getElementById("media_content").innerHTML = '';
|
||||
document.getElementById("window_ok").style.display = "none";
|
||||
document.getElementById("window_yesno").style.display = "none";
|
||||
document.getElementById("window_input").style.display = "none";
|
||||
document.getElementById("window_recaptcha").style.display = "none";
|
||||
document.getElementById("window_progress").style.display = "none";
|
||||
document.getElementById("window_info").style.display = "none";
|
||||
if (focused_item) {
|
||||
focused_item.focus();
|
||||
}
|
||||
else if (document.getElementById("itemlist").children.length) {
|
||||
document.getElementById("itemlist").children[0].children[0].focus();
|
||||
};
|
||||
};
|
||||
|
||||
dialog.menu = function (title, list) {
|
||||
dialog.closeall();
|
||||
if (list) {
|
||||
var el = document.getElementById("window_select")
|
||||
el.getElementById("window_heading").innerHTML = title;
|
||||
el.getElementById("control_list").innerHTML = atob(list);
|
||||
el.style.display = "block";
|
||||
document.getElementById("window_overlay").style.display = "block";
|
||||
el.getElementById("control_list").children[0].children[0].focus();
|
||||
center_window(el);
|
||||
};
|
||||
};
|
||||
|
||||
dialog.select = function (id, data) {
|
||||
dialog.closeall();
|
||||
var el = document.getElementById("window_select");
|
||||
|
||||
el.getElementById("window_heading").innerHTML = data.title;
|
||||
el.RequestID = id;
|
||||
var lista = [];
|
||||
for (var x in data.list) {
|
||||
lista.push(replace_list(html.dialog.select.item, {
|
||||
"item_title": data.list[x],
|
||||
"item_action": "send_data({'id':'" + id + "', 'result':" + x + "})"
|
||||
}));
|
||||
};
|
||||
el.getElementById("control_list").innerHTML = lista.join("");
|
||||
el.style.display = "block";
|
||||
document.getElementById("window_overlay").style.display = "block";
|
||||
|
||||
el.getElementById("control_list").children[0].children[0].focus();
|
||||
center_window(el);
|
||||
};
|
||||
|
||||
dialog.player = function (title, player) {
|
||||
dialog.closeall();
|
||||
var el = document.getElementById("window_player");
|
||||
el.getElementById("window_heading").innerHTML = title;
|
||||
el.getElementById("media_content").innerHTML = player;
|
||||
el.style.display = "block";
|
||||
document.getElementById("window_overlay").style.display = "block";
|
||||
el.children[0].focus();
|
||||
center_window(el);
|
||||
};
|
||||
|
||||
dialog.ok = function (id, data) {
|
||||
dialog.closeall();
|
||||
var el = document.getElementById("window_ok");
|
||||
document.getElementById("window_overlay").style.display = "block";
|
||||
el.style.display = "block";
|
||||
el.RequestID = id;
|
||||
el.getElementById("window_message").innerHTML = data.text.replace(new RegExp("\n", 'g'), "<br/>");
|
||||
el.getElementById("window_heading").innerHTML = data.title;
|
||||
el.getElementById("window_footer").children[0].focus();
|
||||
center_window(el);
|
||||
};
|
||||
|
||||
dialog.yesno = function (id, data) {
|
||||
dialog.closeall();
|
||||
var el = document.getElementById("window_yesno");
|
||||
document.getElementById("window_overlay").style.display = "block";
|
||||
el.style.display = "block";
|
||||
el.RequestID = id;
|
||||
el.getElementById("window_message").innerHTML = data.text.replace(new RegExp("\n", 'g'), "<br/>");
|
||||
el.getElementById("window_heading").innerHTML = data.title;
|
||||
el.getElementById("window_footer").children[0].focus();
|
||||
center_window(el);
|
||||
};
|
||||
|
||||
dialog.notification = function (id, data) {
|
||||
var el = document.getElementById("window_notification");
|
||||
el.style.display = "block";
|
||||
if (!data.icon){data.icon = 0}
|
||||
el.getElementById("window_heading").innerHTML = data.title;
|
||||
el.getElementById("window_message").innerHTML = data.text;
|
||||
el.getElementById("window_icon").className = "window_icon" + data.icon;
|
||||
|
||||
|
||||
|
||||
auto_scroll(el.getElementById("window_message"))
|
||||
setTimeout(function(){ el.style.display = "none"; }, data.time);
|
||||
};
|
||||
|
||||
dialog.keyboard = function (id, data) {
|
||||
dialog.closeall();
|
||||
var el = document.getElementById("window_input");
|
||||
|
||||
if (data.title === "") {
|
||||
data.title = "Teclado";
|
||||
};
|
||||
if (data.password == true) {
|
||||
el.getElementById("window_value").type = "password";
|
||||
}
|
||||
else {
|
||||
el.getElementById("window_value").type = "text";
|
||||
};
|
||||
|
||||
el.RequestID = id;
|
||||
document.getElementById("window_overlay").style.display = "block";
|
||||
el.style.display = "block";
|
||||
el.getElementById("window_value").value = data.text;
|
||||
el.getElementById("window_heading").innerHTML = data.title;
|
||||
el.getElementById("window_value").focus();
|
||||
center_window(el);
|
||||
};
|
||||
|
||||
dialog.recaptcha = function (id, data) {
|
||||
dialog.closeall();
|
||||
var el = document.getElementById("window_recaptcha");
|
||||
|
||||
if (data.title === "") {
|
||||
data.title = "Introduce el texto de la imagen";
|
||||
};
|
||||
|
||||
el.RequestID = id;
|
||||
document.getElementById("window_overlay").style.display = "block";
|
||||
el.style.display = "block";
|
||||
el.getElementById("window_image").style.backgroundImage = "url(" + data.image + ")";
|
||||
el.getElementById("window_heading").innerHTML = data.title;
|
||||
el.getElementById("window_message").innerHTML = data.message;
|
||||
|
||||
for (var x in [0,1,2,3,4,5,6,7,8]) {
|
||||
el.getElementById("window_image").children[x].className = "";
|
||||
}
|
||||
el.getElementById("window_footer").children[0].focus();
|
||||
center_window(el);
|
||||
};
|
||||
|
||||
dialog.recaptcha_select = function (id, data) {
|
||||
var el = document.getElementById("window_recaptcha");
|
||||
console.log(data.selected)
|
||||
console.log(data.unselected)
|
||||
for (var x in data.selected) {
|
||||
el.getElementById("window_image").children[data.selected[x]].className = "selected";
|
||||
}
|
||||
for (var x in data.unselected) {
|
||||
el.getElementById("window_image").children[data.unselected[x]].className = "";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
dialog.progress_bg = function (id, data) {
|
||||
var el = document.getElementById("window_background_progress");
|
||||
el.style.display = "block";
|
||||
el.RequestID = id;
|
||||
el.getElementById("window_message").innerHTML = data.text.replace(new RegExp("\n", 'g'), "<br/>");
|
||||
el.getElementById("window_heading").innerHTML = data.title;
|
||||
el.getElementById("progressbar").style.width = data.percent + "%";
|
||||
};
|
||||
|
||||
dialog.progress_bg_close = function () {
|
||||
document.getElementById("window_background_progress").style.display = "none";
|
||||
};
|
||||
|
||||
dialog.progress = function (id, data) {
|
||||
var el = document.getElementById("window_progress");
|
||||
if (id != el.RequestID) {
|
||||
dialog.closeall();
|
||||
};
|
||||
el.RequestID = id;
|
||||
document.getElementById("window_overlay").style.display = "block";
|
||||
el.style.display = "block";
|
||||
el.getElementById("window_message").innerHTML = data.text.replace(new RegExp("\n", 'g'), "<br/>");
|
||||
el.getElementById("window_heading").innerHTML = data.title;
|
||||
el.getElementById("canceled").checked = "";
|
||||
el.getElementById("progress").style.width = data.percent + "%";
|
||||
el.getElementById("window_footer").children[0].focus;
|
||||
center_window(el);
|
||||
};
|
||||
|
||||
dialog.progress_update = function (id, data) {
|
||||
var el = document.getElementById("window_progress");
|
||||
el.getElementById("window_message").innerHTML = data.text.replace(new RegExp("\n", 'g'), "<br/>");
|
||||
if (el.getElementById("canceled").checked != "") {
|
||||
el.getElementById("window_heading").innerHTML = data.title + " " + data.percent + "% - Cancelando...";
|
||||
}
|
||||
else {
|
||||
el.getElementById("window_heading").innerHTML = data.title + " " + data.percent + "%";
|
||||
};
|
||||
el.getElementById("progress").style.width = data.percent + "%";
|
||||
};
|
||||
|
||||
dialog.progress_close = function () {
|
||||
dialog.closeall();
|
||||
};
|
||||
|
||||
dialog.custom_button = function(id, data) {
|
||||
var el = document.getElementById("window_settings");
|
||||
el.RequestID = id;
|
||||
if (data.return_value.label){
|
||||
el.getElementById("custom_button").innerHTML = data.return_value.label
|
||||
};
|
||||
var controls = document.getElementById("window_settings").getControls();
|
||||
for (var x in controls) {
|
||||
switch (controls[x].type) {
|
||||
case "text":
|
||||
controls[x].value = data.values[controls[x].id];
|
||||
break;
|
||||
case "password":
|
||||
controls[x].value = data.values[controls[x].id];
|
||||
break;
|
||||
case "checkbox":
|
||||
value = data.values[controls[x].id];
|
||||
if (value == true) {
|
||||
value = "checked";
|
||||
}
|
||||
else {
|
||||
value = "";
|
||||
};
|
||||
controls[x].checked = value;
|
||||
break;
|
||||
case "select-one":
|
||||
if (controls[x].name == "enum") {
|
||||
controls[x].selectedIndex = data.values[controls[x].id];
|
||||
}
|
||||
else if (controls[x].name == "labelenum") {
|
||||
controls[x].value = data.values[controls[x].id];
|
||||
};
|
||||
break;
|
||||
};
|
||||
controls[x].onchange()
|
||||
};
|
||||
};
|
||||
|
||||
dialog.config = function (id, data, Secciones, Lista) {
|
||||
dialog.closeall();
|
||||
var el = document.getElementById("window_settings");
|
||||
|
||||
el.RequestID = id;
|
||||
el.getElementById("controls_container").innerHTML = Lista;
|
||||
el.getElementById("window_heading").innerHTML = data.title;
|
||||
if (data.custom_button != null) {
|
||||
if (!data.custom_button.visible) {
|
||||
el.getElementById("custom_button").style.display = "none"
|
||||
}
|
||||
else {
|
||||
el.getElementById("custom_button").style.display = "inline";
|
||||
el.getElementById("custom_button").innerHTML = data.custom_button.label;
|
||||
el.getElementById("custom_button").onclick = function () {
|
||||
custom_button(data.custom_button);
|
||||
};
|
||||
};
|
||||
}
|
||||
else {
|
||||
el.getElementById("custom_button").style.display = "inline";
|
||||
el.getElementById("custom_button").innerHTML = "Por defecto";
|
||||
el.getElementById("custom_button").onclick = function () {
|
||||
custom_button(null);
|
||||
};
|
||||
};
|
||||
|
||||
if (Secciones != "") {
|
||||
el.getElementById("category_container").innerHTML = Secciones;
|
||||
el.getElementById("category_container").style.display = "block";
|
||||
el.getElementById("category_General").style.display = "block";
|
||||
|
||||
}
|
||||
else {
|
||||
el.getElementById("category_container").style.display = "none";
|
||||
el.getElementById("category_undefined").style.display = "block";
|
||||
|
||||
};
|
||||
|
||||
el.getElementById("window_footer").style.display = "block";
|
||||
el.getElementById("window_footer_local").style.display = "none";
|
||||
document.getElementById("window_overlay").style.display = "block";
|
||||
el.style.display = "block";
|
||||
if (Secciones != "") {
|
||||
el.getElementById("category_container").children[0].focus();
|
||||
el.getElementById("category_General").scrollTop = 0;
|
||||
}
|
||||
else {
|
||||
el.getElementById("window_footer").children[0].focus();
|
||||
el.getElementById("category_undefined").scrollTop = 0;
|
||||
};
|
||||
center_window(el);
|
||||
};
|
||||
|
||||
dialog.settings = function () {
|
||||
dialog.closeall();
|
||||
var el = document.getElementById("window_settings");
|
||||
el.getElementById("window_heading").innerHTML = "Ajustes";
|
||||
var controls = [];
|
||||
|
||||
controls.push(replace_list(html.config.label, {
|
||||
"item_color": "#FFFFFF",
|
||||
"item_label": "Navegación:"
|
||||
}));
|
||||
|
||||
if (settings.builtin_history) {
|
||||
var value = "checked=checked";
|
||||
}
|
||||
else {
|
||||
var value = "";
|
||||
};
|
||||
|
||||
controls.push(replace_list(html.config.bool, {
|
||||
"item_color": "#FFFFFF",
|
||||
"item_label": "Usar navegación del explorador",
|
||||
"item_id": "builtin_history",
|
||||
"item_value": value
|
||||
}));
|
||||
|
||||
controls.push(replace_list(html.config.label, {
|
||||
"item_color": "#FFFFFF",
|
||||
"item_label": "Visualización:"
|
||||
}));
|
||||
|
||||
if (settings.show_fanart) {
|
||||
var value = "checked=checked";
|
||||
}
|
||||
else {
|
||||
var value = "";
|
||||
};
|
||||
|
||||
controls.push(replace_list(html.config.bool, {
|
||||
"item_color": "#FFFFFF",
|
||||
"item_label": "Mostrar Fanarts",
|
||||
"item_id": "show_fanart",
|
||||
"item_value": value
|
||||
}));
|
||||
|
||||
controls.push(replace_list(html.config.label, {
|
||||
"item_color": "#FFFFFF",
|
||||
"item_label": "Reproducción:"
|
||||
}));
|
||||
|
||||
var options = ["<option>Preguntar</option>", "<option>Indirecto</option>", "<option>Directo</option>"];
|
||||
options[settings.play_mode] = options[settings.play_mode].replace("<option>", "<option selected=selected>");
|
||||
controls.push(replace_list(html.config.list, {
|
||||
"item_type": "enum",
|
||||
"item_color": "#FFFFFF",
|
||||
"item_label": "Método de reproduccion:",
|
||||
"item_id": "play_mode",
|
||||
"item_values": options.join("")
|
||||
}));
|
||||
|
||||
options = ["<option>Preguntar</option>"];
|
||||
for (var player in players) {
|
||||
options.push("<option>" + players[player] + "</option>");
|
||||
};
|
||||
options[settings.player_mode] = options[settings.player_mode].replace("<option>", "<option selected=selected>");
|
||||
controls.push(replace_list(html.config.list, {
|
||||
"item_type": "enum",
|
||||
"item_color": "#FFFFFF",
|
||||
"item_label": "Reproductor:",
|
||||
"item_id": "player_mode",
|
||||
"item_values": options.join("")
|
||||
}));
|
||||
|
||||
el.getElementById("controls_container").innerHTML = replace_list(html.config.container, {
|
||||
"item_id": "category_all",
|
||||
"item_value": controls.join("").replace(/evaluate_controls\(this\)/g, '')
|
||||
});
|
||||
el.getElementById("category_container").style.display = "none";
|
||||
el.getElementById("category_all").style.display = "block";
|
||||
el.getElementById("window_footer").style.display = "none";
|
||||
el.getElementById("window_footer_local").style.display = "block";
|
||||
document.getElementById("window_overlay").style.display = "block";
|
||||
el.style.display = "block";
|
||||
el.children[0].focus();
|
||||
center_window(el);
|
||||
};
|
||||
|
||||
dialog.info = function (id, data) {
|
||||
dialog.closeall();
|
||||
var el = document.getElementById("window_info");
|
||||
|
||||
el.RequestID = id;
|
||||
el.getElementById("window_heading").innerHTML = data.title;
|
||||
el.getElementById("info_fanart").src = data.fanart;
|
||||
el.getElementById("info_poster").src = data.thumbnail;
|
||||
|
||||
if (data.buttons) {
|
||||
el.getElementById("window_footer").style.display = "block";
|
||||
el.getElementById("page_info").innerHTML = data.count;
|
||||
|
||||
if (data.previous) {
|
||||
el.getElementById("previous").onclick = function () {
|
||||
info_window('previous');
|
||||
};
|
||||
el.getElementById("previous").className = "control_button";
|
||||
el.getElementById("previous").disabled = false;
|
||||
}
|
||||
else {
|
||||
el.getElementById("previous").onclick = "";
|
||||
el.getElementById("previous").className = "control_button disabled";
|
||||
el.getElementById("previous").disabled = true;
|
||||
};
|
||||
|
||||
if (data.next) {
|
||||
el.getElementById("next").onclick = function () {
|
||||
info_window('next');
|
||||
};
|
||||
el.getElementById("next").className = "control_button";
|
||||
el.getElementById("next").disabled = false;
|
||||
}
|
||||
else {
|
||||
el.getElementById("next").onclick = "";
|
||||
el.getElementById("next").className = "control_button disabled";
|
||||
el.getElementById("next").disabled = true;
|
||||
};
|
||||
}
|
||||
else {
|
||||
el.getElementById("window_footer").style.display = "none";
|
||||
};
|
||||
|
||||
el.getElementById("line1_head").innerHTML = data["lines"][0]["title"];
|
||||
el.getElementById("line2_head").innerHTML = data["lines"][1]["title"];
|
||||
el.getElementById("line3_head").innerHTML = data["lines"][2]["title"];
|
||||
el.getElementById("line4_head").innerHTML = data["lines"][3]["title"];
|
||||
el.getElementById("line5_head").innerHTML = data["lines"][4]["title"];
|
||||
el.getElementById("line6_head").innerHTML = data["lines"][5]["title"];
|
||||
el.getElementById("line7_head").innerHTML = data["lines"][6]["title"];
|
||||
el.getElementById("line8_head").innerHTML = data["lines"][7]["title"];
|
||||
|
||||
el.getElementById("line1").innerHTML = data["lines"][0]["text"];
|
||||
el.getElementById("line2").innerHTML = data["lines"][1]["text"];
|
||||
el.getElementById("line3").innerHTML = data["lines"][2]["text"];
|
||||
el.getElementById("line4").innerHTML = data["lines"][3]["text"];
|
||||
el.getElementById("line5").innerHTML = data["lines"][4]["text"];
|
||||
el.getElementById("line6").innerHTML = data["lines"][5]["text"];
|
||||
el.getElementById("line7").innerHTML = data["lines"][6]["text"];
|
||||
el.getElementById("line8").innerHTML = data["lines"][7]["text"];
|
||||
|
||||
if (el.style.display == "block") {
|
||||
update = true;
|
||||
}
|
||||
else {
|
||||
update = false;
|
||||
};
|
||||
|
||||
document.getElementById("window_overlay").style.display = "block";
|
||||
el.style.display = "block";
|
||||
|
||||
auto_scroll(el.getElementById("line1"));
|
||||
auto_scroll(el.getElementById("line2"));
|
||||
auto_scroll(el.getElementById("line3"));
|
||||
auto_scroll(el.getElementById("line4"));
|
||||
auto_scroll(el.getElementById("line5"));
|
||||
auto_scroll(el.getElementById("line6"));
|
||||
auto_scroll(el.getElementById("line7"));
|
||||
auto_scroll(el.getElementById("line8"));
|
||||
|
||||
if (data["buttons"]) {
|
||||
if (!update) {
|
||||
el.getElementById("window_footer").children[3].focus();
|
||||
};
|
||||
}
|
||||
else {
|
||||
el.children[0].focus();
|
||||
};
|
||||
|
||||
center_window(el);
|
||||
};
|
||||
107
mediaserver/platformcode/template/js/main.js
Normal file
107
mediaserver/platformcode/template/js/main.js
Normal file
@@ -0,0 +1,107 @@
|
||||
HTMLElement.prototype.getElementById = function(id) {
|
||||
if (this.querySelector("#" + id)) {
|
||||
return this.querySelector("#" + id);
|
||||
};
|
||||
|
||||
for (var x = 0; x < this.children.length; x++) {
|
||||
if (this.children[x].id == id) {
|
||||
return this.children[x];
|
||||
};
|
||||
};
|
||||
|
||||
for (var x = 0; x < this.children.length; x++) {
|
||||
result = this.children[x].getElementById(id);
|
||||
if (result != null) {
|
||||
return result;
|
||||
};
|
||||
};
|
||||
return null;
|
||||
};
|
||||
|
||||
HTMLElement.prototype.getControls = function() {
|
||||
return [].concat(Array.prototype.slice.call(this.getElementsByTagName("input")), Array.prototype.slice.call(this.getElementsByTagName("select")));
|
||||
};
|
||||
|
||||
window.onload = function() {
|
||||
var url = (window.location.href.split("#")[1] ? window.location.href.split("#")[1] : "");
|
||||
dispose();
|
||||
loading.show("Cargando pagina...");
|
||||
ajax_running.remove = function(val) {
|
||||
if (this.indexOf(val) > -1) {
|
||||
this.splice(this.indexOf(val), 1);
|
||||
};
|
||||
if (!this.length && !websocket) {
|
||||
send_request(url);
|
||||
};
|
||||
};
|
||||
load_settings();
|
||||
dowload_files();
|
||||
};
|
||||
|
||||
window.onpopstate = function(e) {
|
||||
if (e.state) {
|
||||
nav_history.go(e.state - nav_history.current);
|
||||
};
|
||||
};
|
||||
|
||||
window.onresize = function() {
|
||||
dispose();
|
||||
};
|
||||
|
||||
window.getCookie = function(name) {
|
||||
var match = document.cookie.match(new RegExp(name + '=([^;]+)'));
|
||||
if (match) return match[1];
|
||||
};
|
||||
|
||||
function load_settings() {
|
||||
settings["play_mode"] = (window.getCookie("play_mode") ? parseInt(window.getCookie("play_mode")) : 0);
|
||||
settings["player_mode"] = (window.getCookie("player_mode") ? parseInt(window.getCookie("player_mode")) : 0);
|
||||
settings["show_fanart"] = (window.getCookie("show_fanart") == "false" ? false : true);
|
||||
settings["builtin_history"] = (window.getCookie("builtin_history") == "true" ? true : false);
|
||||
};
|
||||
|
||||
function save_settings() {
|
||||
var controls = document.getElementById("window_settings").getControls();
|
||||
for (var x in controls) {
|
||||
switch (controls[x].type) {
|
||||
case "text":
|
||||
case "password":
|
||||
save_setting(controls[x].id, controls[x].value);
|
||||
break;
|
||||
case "checkbox":
|
||||
save_setting(controls[x].id, controls[x].checked);
|
||||
break;
|
||||
case "select-one":
|
||||
save_setting(controls[x].id, controls[x].selectedIndex);
|
||||
break;
|
||||
};
|
||||
};
|
||||
load_settings();
|
||||
};
|
||||
|
||||
function save_setting(id, value) {
|
||||
document.cookie = id + "=" + value + '; expires=Fri, 31 Dec 9999 23:59:59 GMT';
|
||||
};
|
||||
|
||||
function dowload_files() {
|
||||
ajax_to_dict("/media/html/player_vlc.html", html, "vlc_player");
|
||||
ajax_to_dict("/media/html/player_html.html", html, "html_player");
|
||||
ajax_to_dict("/media/html/player_flash.html", html, "flash_player");
|
||||
|
||||
ajax_to_dict("/media/html/itemlist_banner.html", html, "itemlist.banner");
|
||||
ajax_to_dict("/media/html/itemlist_channel.html", html, "itemlist.channel");
|
||||
ajax_to_dict("/media/html/itemlist_movie.html", html, "itemlist.movie");
|
||||
ajax_to_dict("/media/html/itemlist_list.html", html, "itemlist.list");
|
||||
ajax_to_dict("/media/html/itemlist_menu.html", html, "itemlist.menu");
|
||||
|
||||
ajax_to_dict("/media/html/select_item.html", html, "dialog.select.item");
|
||||
|
||||
ajax_to_dict("/media/html/config_label.html", html, "config.label");
|
||||
ajax_to_dict("/media/html/config_sep.html", html, "config.sep");
|
||||
ajax_to_dict("/media/html/config_text.html", html, "config.text");
|
||||
ajax_to_dict("/media/html/config_bool.html", html, "config.bool");
|
||||
ajax_to_dict("/media/html/config_list.html", html, "config.list");
|
||||
|
||||
ajax_to_dict("/media/html/config_category.html", html, "config.category");
|
||||
ajax_to_dict("/media/html/config_container.html", html, "config.container");
|
||||
};
|
||||
739
mediaserver/platformcode/template/js/navigation.js
Normal file
739
mediaserver/platformcode/template/js/navigation.js
Normal file
@@ -0,0 +1,739 @@
|
||||
window.onkeydown = function (e) {
|
||||
if (e.keyCode == 27) {
|
||||
dialog.closeall()
|
||||
}
|
||||
|
||||
if (e.target.tagName == "BODY") {
|
||||
body_events(e);
|
||||
};
|
||||
if (document.getElementById("window_loading").contains(e.target)) {
|
||||
window_loading_events(e);
|
||||
};
|
||||
if (document.getElementById("window_settings").contains(e.target)) {
|
||||
window_settings_events(e);
|
||||
};
|
||||
if (document.getElementById("window_select").contains(e.target)) {
|
||||
window_select_events(e);
|
||||
};
|
||||
if (document.getElementById("window_ok").contains(e.target)) {
|
||||
window_generic_events(e);
|
||||
};
|
||||
if (document.getElementById("window_yesno").contains(e.target)) {
|
||||
window_generic_events(e);
|
||||
};
|
||||
if (document.getElementById("window_recaptcha").contains(e.target)) {
|
||||
window_recaptcha_events(e);
|
||||
};
|
||||
if (document.getElementById("window_progress").contains(e.target)) {
|
||||
window_generic_events(e);
|
||||
};
|
||||
if (document.getElementById("window_info").contains(e.target)) {
|
||||
window_generic_events(e);
|
||||
}
|
||||
if (document.getElementById("window_input").contains(e.target)) {
|
||||
window_input_events(e);
|
||||
};
|
||||
if (document.getElementById("itemlist").contains(e.target)) {
|
||||
itemlist_events(e);
|
||||
};
|
||||
};
|
||||
|
||||
function itemlist_events(e) {
|
||||
var el = document.getElementById('itemlist');
|
||||
|
||||
switch (e.keyCode) {
|
||||
case 96:
|
||||
case 97:
|
||||
case 98:
|
||||
case 99:
|
||||
case 100:
|
||||
case 101:
|
||||
case 102:
|
||||
case 103:
|
||||
case 104:
|
||||
case 105:
|
||||
numeric_search(e.keyCode);
|
||||
break;
|
||||
|
||||
case 93: //Menu
|
||||
e.preventDefault();
|
||||
if (e.target.parentNode.children.length == 2) {
|
||||
e.target.parentNode.children[1].onclick.apply(e.target.parentNode.children[1]);
|
||||
focused_item = e.target.parentNode.children[1];
|
||||
};
|
||||
break;
|
||||
|
||||
case 8: //BACK
|
||||
e.preventDefault();
|
||||
if (nav_history.current > 0) {
|
||||
send_request("go_back");
|
||||
};
|
||||
break;
|
||||
|
||||
case 37: //LEFT
|
||||
e.preventDefault();
|
||||
var index = Array.prototype.indexOf.call(e.target.parentNode.children, e.target);
|
||||
if (index > 0){
|
||||
e.target.parentNode.children[index - 1].focus();
|
||||
};
|
||||
break;
|
||||
|
||||
case 38: //UP
|
||||
e.preventDefault();
|
||||
var index = Array.prototype.indexOf.call(el.children, e.target.parentNode);
|
||||
if (index == 0) {
|
||||
index = el.children.length;
|
||||
};
|
||||
el.children[index - 1].children[0].focus();
|
||||
break;
|
||||
|
||||
case 39: //RIGHT
|
||||
e.preventDefault();
|
||||
var index = Array.prototype.indexOf.call(e.target.parentNode.children, e.target);
|
||||
if (index < e.target.parentNode.children.length - 1){
|
||||
e.target.parentNode.children[index + 1].focus();
|
||||
};
|
||||
break;
|
||||
|
||||
case 40: //DOWN
|
||||
e.preventDefault();
|
||||
var index = Array.prototype.indexOf.call(el.children, e.target.parentNode);
|
||||
if (index + 1 == el.children.length) {
|
||||
index = -1;
|
||||
};
|
||||
el.children[index + 1].children[0].focus();
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
||||
function window_loading_events(e) {
|
||||
switch (e.keyCode) {
|
||||
case 8: //BACK
|
||||
loading.close();
|
||||
connection_retry = false;
|
||||
e.preventDefault();
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
||||
function body_events(e) {
|
||||
switch (e.keyCode) {
|
||||
case 8: //BACK
|
||||
e.preventDefault();
|
||||
break;
|
||||
|
||||
case 37: //LEFT
|
||||
case 38: //UP
|
||||
case 39: //RIGHT
|
||||
case 40: //DOWN
|
||||
e.preventDefault();
|
||||
document.getElementById("itemlist").children[0].children[0].focus();
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
||||
function window_generic_events(e) {
|
||||
var el = (document.getElementById("window_ok").contains(e.target) ? document.getElementById("window_ok") : el);
|
||||
var el = (document.getElementById("window_yesno").contains(e.target) ? document.getElementById("window_yesno") : el);
|
||||
var el = (document.getElementById("window_progress").contains(e.target) ? document.getElementById("window_progress") : el);
|
||||
var el = (document.getElementById("window_info").contains(e.target) ? document.getElementById("window_info") : el);
|
||||
|
||||
switch (e.keyCode) {
|
||||
case 8: //BACK
|
||||
e.preventDefault();
|
||||
dialog.closeall();
|
||||
break;
|
||||
|
||||
case 38: //UP
|
||||
e.preventDefault();
|
||||
if (el.getElementById("window_footer").contains(e.target)) {
|
||||
el.children[0].focus();
|
||||
};
|
||||
break;
|
||||
|
||||
case 37: //LEFT
|
||||
e.preventDefault();
|
||||
|
||||
if (el.getElementById("window_footer").contains(e.target)) {
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("window_footer").children, e.target) -1;
|
||||
while (index >= 0 && el.getElementById("window_footer").children[index].disabled){
|
||||
index --;
|
||||
};
|
||||
if (index >=0){
|
||||
el.getElementById("window_footer").children[index].focus();
|
||||
};
|
||||
};
|
||||
break;
|
||||
|
||||
case 39: //RIGHT
|
||||
e.preventDefault();
|
||||
if (el.getElementById("window_footer").contains(e.target)) {
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("window_footer").children, e.target) +1;
|
||||
while (index < el.getElementById("window_footer").children.length && el.getElementById("window_footer").children[index].disabled){
|
||||
index ++;
|
||||
};
|
||||
if (index < el.getElementById("window_footer").children.length){
|
||||
el.getElementById("window_footer").children[index].focus();
|
||||
};
|
||||
};
|
||||
break;
|
||||
|
||||
case 40: //DOWN
|
||||
e.preventDefault();
|
||||
if (e.target.parentNode == el) {
|
||||
el.getElementById("window_footer").children[0].focus();
|
||||
};
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
||||
function window_recaptcha_events(e) {
|
||||
var el = document.getElementById("window_recaptcha");
|
||||
|
||||
switch (e.keyCode) {
|
||||
case 8: //BACK
|
||||
e.preventDefault();
|
||||
dialog.closeall();
|
||||
break;
|
||||
|
||||
case 38: //UP
|
||||
e.preventDefault();
|
||||
if (el.getElementById("window_footer").contains(e.target)) {
|
||||
el.getElementById("window_image").children[el.getElementById("window_image").children.length -1].focus();
|
||||
}
|
||||
|
||||
else {
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("window_image").children, e.target) -3;
|
||||
if (index >-1) {
|
||||
el.getElementById("window_image").children[index].focus();
|
||||
}
|
||||
else {
|
||||
el.children[0].focus();
|
||||
};
|
||||
};
|
||||
break;
|
||||
|
||||
case 37: //LEFT
|
||||
e.preventDefault();
|
||||
|
||||
if (el.getElementById("window_footer").contains(e.target)) {
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("window_footer").children, e.target) -1;
|
||||
while (index >= 0 && el.getElementById("window_footer").children[index].disabled){
|
||||
index --;
|
||||
};
|
||||
if (index >=0){
|
||||
el.getElementById("window_footer").children[index].focus();
|
||||
};
|
||||
} else if (e.target.parentNode == el.getElementById("window_image")) {
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("window_image").children, e.target) -1;
|
||||
if ([-1,2,5].indexOf(index) == -1) {
|
||||
el.getElementById("window_image").children[index].focus();
|
||||
};
|
||||
};
|
||||
break;
|
||||
|
||||
case 39: //RIGHT
|
||||
e.preventDefault();
|
||||
if (el.getElementById("window_footer").contains(e.target)) {
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("window_footer").children, e.target) +1;
|
||||
while (index < el.getElementById("window_footer").children.length && el.getElementById("window_footer").children[index].disabled){
|
||||
index ++;
|
||||
};
|
||||
if (index < el.getElementById("window_footer").children.length){
|
||||
el.getElementById("window_footer").children[index].focus();
|
||||
};
|
||||
} else if (e.target.parentNode == el.getElementById("window_image")) {
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("window_image").children, e.target) +1;
|
||||
if ([3,6,9].indexOf(index) == -1) {
|
||||
el.getElementById("window_image").children[index].focus();
|
||||
};
|
||||
};
|
||||
break;
|
||||
|
||||
case 40: //DOWN
|
||||
e.preventDefault();
|
||||
if (e.target.parentNode == el) {
|
||||
el.getElementById("window_image").children[0].focus();
|
||||
}
|
||||
else if (e.target.parentNode == el.getElementById("window_image")) {
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("window_image").children, e.target) +3;
|
||||
if (index < el.getElementById("window_image").children.length) {
|
||||
el.getElementById("window_image").children[index].focus();
|
||||
}
|
||||
else {
|
||||
el.getElementById("window_footer").children[0].focus();
|
||||
};
|
||||
};
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
||||
function window_select_events(e) {
|
||||
var el = document.getElementById('window_select');
|
||||
|
||||
switch (e.keyCode) {
|
||||
case 8: //BACK
|
||||
e.preventDefault();
|
||||
dialog.closeall();
|
||||
break;
|
||||
|
||||
case 38: //UP
|
||||
e.preventDefault();
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("control_list").children, e.target.parentNode);
|
||||
if (index != 0) {
|
||||
el.getElementById("control_list").children[index - 1].children[0].focus();
|
||||
}
|
||||
else {
|
||||
el.children[0].focus();
|
||||
};
|
||||
break;
|
||||
|
||||
case 40: //DOWN
|
||||
e.preventDefault();
|
||||
if (e.target.parentNode == el) {
|
||||
el.getElementById("control_list").children[0].children[0].focus();
|
||||
}
|
||||
else {
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("control_list").children, e.target.parentNode);
|
||||
el.getElementById("control_list").children[index + 1].children[0].focus();
|
||||
};
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
||||
function window_settings_events(e) {
|
||||
el = document.getElementById('window_settings');
|
||||
|
||||
switch (e.keyCode) {
|
||||
case 8: //BACK
|
||||
if ((e.target.tagName != "INPUT" || (e.target.type != "text" && e.target.type != "password")) && e.target.tagName != "SELECT") {
|
||||
e.preventDefault();
|
||||
dialog.closeall();
|
||||
};
|
||||
break;
|
||||
|
||||
case 38: //UP
|
||||
e.preventDefault();
|
||||
if (e.target.parentNode == el) {
|
||||
return;
|
||||
};
|
||||
if (el.getElementById("category_container").contains(e.target)) {
|
||||
el.children[0].focus();
|
||||
return;
|
||||
|
||||
}
|
||||
else if (el.getElementById("window_footer").contains(e.target) || el.getElementById("window_footer_local").contains(e.target)) {
|
||||
var index = null;
|
||||
var group = null;
|
||||
|
||||
}
|
||||
else if (el.getElementById("controls_container").contains(e.target)) {
|
||||
var group = Array.prototype.indexOf.call(el.getElementById("controls_container").children, e.target.parentNode.parentNode.parentNode);
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("controls_container").children[group].children, e.target.parentNode.parentNode) - 1;
|
||||
};
|
||||
|
||||
if (group == null) {
|
||||
for (group = 0; group < el.getElementById("category_container").children.length; group++) {
|
||||
if (el.getElementById("category_container").children[group].style.display != "none") {
|
||||
break;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (index == null) {
|
||||
index = el.getElementById("controls_container").children[group].children.length - 1;
|
||||
};
|
||||
|
||||
while (index >= 0 &&
|
||||
(el.getElementById("controls_container").children[group].children[index].children[0].className != "control" ||
|
||||
el.getElementById("controls_container").children[group].children[index].children[0].children[1].disabled ||
|
||||
el.getElementById("controls_container").children[group].children[index].style.display == "none")) {
|
||||
|
||||
index--;
|
||||
};
|
||||
|
||||
if (index >= 0) {
|
||||
el.getElementById("controls_container").children[group].children[index].children[0].children[1].focus();
|
||||
}
|
||||
else {
|
||||
if (el.getElementById("category_container").style.display == "none") {
|
||||
el.children[0].focus();
|
||||
}
|
||||
else {
|
||||
el.getElementById("category_container").children[0].focus();
|
||||
};
|
||||
};
|
||||
break;
|
||||
|
||||
case 37: //LEFT
|
||||
if ((e.target.tagName != "INPUT" || (e.target.type != "text" && e.target.type != "password")) && e.target.tagName != "SELECT") {
|
||||
e.preventDefault();
|
||||
if (el.getElementById("category_container").contains(e.target)) {
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("category_container").children, e.target);
|
||||
el.getElementById("category_container").children[index - 1].focus();
|
||||
}
|
||||
else if (el.getElementById("window_footer").contains(e.target)) {
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("window_footer").children, e.target);
|
||||
el.getElementById("window_footer").children[index - 1].focus();
|
||||
}
|
||||
else if (el.getElementById("window_footer_local").contains(e.target)) {
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("window_footer_local").children, e.target);
|
||||
el.getElementById("window_footer_local").children[index - 1].focus();
|
||||
};
|
||||
};
|
||||
break;
|
||||
|
||||
case 39: //RIGHT
|
||||
if ((e.target.tagName != "INPUT" || (e.target.type != "text" && e.target.type != "password")) && e.target.tagName != "SELECT") {
|
||||
e.preventDefault();
|
||||
if (el.getElementById("category_container").contains(e.target)) {
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("category_container").children, e.target);
|
||||
el.getElementById("category_container").children[index + 1].focus();
|
||||
}
|
||||
else if (el.getElementById("window_footer").contains(e.target)) {
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("window_footer").children, e.target);
|
||||
el.getElementById("window_footer").children[index + 1].focus();
|
||||
}
|
||||
else if (el.getElementById("window_footer_local").contains(e.target)) {
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("window_footer_local").children, e.target);
|
||||
el.getElementById("window_footer_local").children[index + 1].focus();
|
||||
};
|
||||
};
|
||||
break;
|
||||
|
||||
case 40: //DOWN
|
||||
e.preventDefault();
|
||||
if (e.target.parentNode == el) {
|
||||
if (el.getElementById("category_container").style.display == "none") {
|
||||
var index = 0;
|
||||
var group = null;
|
||||
}
|
||||
else {
|
||||
el.getElementById("category_container").children[0].focus();
|
||||
};
|
||||
}
|
||||
else if (el.getElementById("category_container").contains(e.target)) {
|
||||
var index = 0;
|
||||
var group = null;
|
||||
|
||||
}
|
||||
else if (el.getElementById("controls_container").contains(e.target)) {
|
||||
var group = Array.prototype.indexOf.call(el.getElementById("controls_container").children, e.target.parentNode.parentNode.parentNode);
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("controls_container").children[group].children, e.target.parentNode.parentNode) + 1;
|
||||
};
|
||||
|
||||
if (group == null) {
|
||||
for (group = 0; group < el.getElementById("category_container").children.length; group++) {
|
||||
if (el.getElementById("category_container").children[group].style.display != "none") {
|
||||
break;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
while (index < el.getElementById("controls_container").children[group].children.length &&
|
||||
(el.getElementById("controls_container").children[group].children[index].children[0].className != "control" ||
|
||||
el.getElementById("controls_container").children[group].children[index].children[0].children[1].disabled ||
|
||||
el.getElementById("controls_container").children[group].children[index].style.display == "none")) {
|
||||
|
||||
index++;
|
||||
};
|
||||
|
||||
if (index < el.getElementById("controls_container").children[group].children.length) {
|
||||
el.getElementById("controls_container").children[group].children[index].children[0].children[1].focus();
|
||||
}
|
||||
else {
|
||||
el.getElementById("window_footer").children[0].focus();
|
||||
el.getElementById("window_footer_local").children[0].focus();
|
||||
};
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
||||
function window_input_events(e) {
|
||||
el = document.getElementById("window_input");
|
||||
|
||||
switch (e.keyCode) {
|
||||
case 8: //BACK
|
||||
if (e.target.tagName != "INPUT") {
|
||||
e.preventDefault();
|
||||
dialog.closeall();
|
||||
};
|
||||
break;
|
||||
|
||||
case 38: //UP
|
||||
e.preventDefault();
|
||||
if (el.getElementById("window_footer").contains(e.target)) {
|
||||
el.getElementById("control_input").children[0].focus();
|
||||
}
|
||||
if (el.getElementById("control_input").contains(e.target)) {
|
||||
el.children[0].focus();
|
||||
};
|
||||
break;
|
||||
|
||||
case 37: //LEFT
|
||||
if (el.getElementById("window_footer").contains(e.target)) {
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("window_footer").children, e.target);
|
||||
el.getElementById("window_footer").children[index - 1].focus();
|
||||
e.preventDefault();
|
||||
};
|
||||
break;
|
||||
|
||||
case 39: //RIGHT
|
||||
if (el.getElementById("window_footer").contains(e.target)) {
|
||||
var index = Array.prototype.indexOf.call(el.getElementById("window_footer").children, e.target);
|
||||
el.getElementById("window_footer").children[index + 1].focus();
|
||||
e.preventDefault();
|
||||
};
|
||||
break;
|
||||
|
||||
case 40: //DOWN
|
||||
e.preventDefault();
|
||||
if (e.target.parentNode == el) {
|
||||
el.getElementById("control_input").children[0].focus();
|
||||
};
|
||||
if (el.getElementById("control_input").contains(e.target)) {
|
||||
el.getElementById("window_footer").children[0].focus();
|
||||
};
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
||||
function numeric_search(keyCode) {
|
||||
switch (keyCode) {
|
||||
case 96:
|
||||
keychar["keyCode"] = keyCode;
|
||||
keychar["Char"] = "0";
|
||||
break;
|
||||
|
||||
case 97:
|
||||
keychar["keyCode"] = keyCode;
|
||||
keychar["Char"] = "1";
|
||||
break;
|
||||
|
||||
case 98:
|
||||
if (keychar["keyCode"] == keyCode) {
|
||||
switch (keychar["Char"]) {
|
||||
case "a":
|
||||
keychar["Char"] = "b";
|
||||
break;
|
||||
case "b":
|
||||
keychar["Char"] = "c";
|
||||
break;
|
||||
case "c":
|
||||
keychar["Char"] = "2";
|
||||
break;
|
||||
case "2":
|
||||
keychar["Char"] = "a";
|
||||
break;
|
||||
};
|
||||
}
|
||||
else {
|
||||
keychar["keyCode"] = keyCode;
|
||||
keychar["Char"] = "a";
|
||||
};
|
||||
break;
|
||||
|
||||
case 99:
|
||||
if (keychar["keyCode"] == keyCode) {
|
||||
switch (keychar["Char"]) {
|
||||
case "d":
|
||||
keychar["Char"] = "e";
|
||||
break;
|
||||
case "e":
|
||||
keychar["Char"] = "f";
|
||||
break;
|
||||
case "f":
|
||||
keychar["Char"] = "3";
|
||||
break;
|
||||
case "3":
|
||||
keychar["Char"] = "d";
|
||||
break;
|
||||
};
|
||||
}
|
||||
else {
|
||||
keychar["keyCode"] = keyCode;
|
||||
keychar["Char"] = "d";
|
||||
};
|
||||
break;
|
||||
|
||||
case 100:
|
||||
if (keychar["keyCode"] == keyCode) {
|
||||
switch (keychar["Char"]) {
|
||||
case "g":
|
||||
keychar["Char"] = "h";
|
||||
break;
|
||||
case "h":
|
||||
keychar["Char"] = "i";
|
||||
break;
|
||||
case "i":
|
||||
keychar["Char"] = "4";
|
||||
break;
|
||||
case "4":
|
||||
keychar["Char"] = "g";
|
||||
break;
|
||||
};
|
||||
}
|
||||
else {
|
||||
keychar["keyCode"] = keyCode;
|
||||
keychar["Char"] = "g";
|
||||
};
|
||||
break;
|
||||
|
||||
case 101:
|
||||
if (keychar["keyCode"] == keyCode) {
|
||||
switch (keychar["Char"]) {
|
||||
case "j":
|
||||
keychar["Char"] = "k";
|
||||
break;
|
||||
case "k":
|
||||
keychar["Char"] = "l";
|
||||
break;
|
||||
case "l":
|
||||
keychar["Char"] = "5";
|
||||
break;
|
||||
case "5":
|
||||
keychar["Char"] = "j";
|
||||
break;
|
||||
};
|
||||
}
|
||||
else {
|
||||
keychar["keyCode"] = keyCode;
|
||||
keychar["Char"] = "j";
|
||||
};
|
||||
break;
|
||||
|
||||
case 102:
|
||||
if (keychar["keyCode"] == keyCode) {
|
||||
switch (keychar["Char"]) {
|
||||
case "m":
|
||||
keychar["Char"] = "n";
|
||||
break;
|
||||
case "n":
|
||||
keychar["Char"] = "o";
|
||||
break;
|
||||
case "o":
|
||||
keychar["Char"] = "6";
|
||||
break;
|
||||
case "6":
|
||||
keychar["Char"] = "m";
|
||||
break;
|
||||
};
|
||||
}
|
||||
else {
|
||||
keychar["keyCode"] = keyCode;
|
||||
keychar["Char"] = "m";
|
||||
};
|
||||
break;
|
||||
|
||||
case 103:
|
||||
if (keychar["keyCode"] == keyCode) {
|
||||
switch (keychar["Char"]) {
|
||||
case "p":
|
||||
keychar["Char"] = "q";
|
||||
break;
|
||||
case "q":
|
||||
keychar["Char"] = "r";
|
||||
break;
|
||||
case "r":
|
||||
keychar["Char"] = "s";
|
||||
break;
|
||||
case "s":
|
||||
keychar["Char"] = "7";
|
||||
break;
|
||||
case "7":
|
||||
keychar["Char"] = "p";
|
||||
break;
|
||||
};
|
||||
}
|
||||
else {
|
||||
keychar["keyCode"] = keyCode;
|
||||
keychar["Char"] = "p";
|
||||
};
|
||||
break;
|
||||
|
||||
case 104:
|
||||
if (keychar["keyCode"] == keyCode) {
|
||||
switch (keychar["Char"]) {
|
||||
case "t":
|
||||
keychar["Char"] = "u";
|
||||
break;
|
||||
case "u":
|
||||
keychar["Char"] = "u";
|
||||
break;
|
||||
case "v":
|
||||
keychar["Char"] = "8";
|
||||
break;
|
||||
case "8":
|
||||
keychar["Char"] = "t";
|
||||
break;
|
||||
};
|
||||
}
|
||||
else {
|
||||
keychar["keyCode"] = keyCode;
|
||||
keychar["Char"] = "t";
|
||||
};
|
||||
break;
|
||||
|
||||
case 105:
|
||||
if (keychar["keyCode"] == keyCode) {
|
||||
switch (keychar["Char"]) {
|
||||
case "x":
|
||||
keychar["Char"] = "y";
|
||||
break;
|
||||
case "y":
|
||||
keychar["Char"] = "z";
|
||||
break;
|
||||
case "z":
|
||||
keychar["Char"] = "w";
|
||||
break;
|
||||
case "w":
|
||||
keychar["Char"] = "9";
|
||||
break;
|
||||
case "9":
|
||||
keychar["Char"] = "x";
|
||||
break;
|
||||
};
|
||||
}
|
||||
else {
|
||||
keychar["keyCode"] = keyCode;
|
||||
keychar["Char"] = "x";
|
||||
};
|
||||
break;
|
||||
};
|
||||
|
||||
var el = document.getElementById('itemlist');
|
||||
|
||||
for (x = 0; x < el.children.length; x++) {
|
||||
if (el.children[x].children[0].children[2].innerHTML.toLowerCase().indexOf(keychar["Char"]) === 0) {
|
||||
el.children[x].children[0].focus();
|
||||
break;
|
||||
};
|
||||
if (el.children[x].children[0].children[0].innerHTML.toLowerCase().indexOf(keychar["Char"]) === 0) {
|
||||
el.children[x].children[0].focus();
|
||||
break;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
document.onkeypress = function (e) {
|
||||
if ((e || window.event).keyCode === 32) {
|
||||
if (media_player.paused) {
|
||||
media_player.play();
|
||||
}
|
||||
else {
|
||||
media_player.pause();
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
document.ondblclick = function () {
|
||||
if (media_player.requestFullscreen) {
|
||||
media_player.requestFullscreen();
|
||||
}
|
||||
else if (media_player.mozRequestFullScreen) {
|
||||
media_player.mozRequestFullScreen();
|
||||
}
|
||||
else if (media_player.webkitRequestFullscreen) {
|
||||
media_player.webkitRequestFullscreen();
|
||||
};
|
||||
};
|
||||
674
mediaserver/platformcode/template/js/protocol.js
Normal file
674
mediaserver/platformcode/template/js/protocol.js
Normal file
@@ -0,0 +1,674 @@
|
||||
function get_response(data) {
|
||||
var response = JSON.parse(data)
|
||||
var data = response.data;
|
||||
|
||||
switch (response.action) {
|
||||
case "connect":
|
||||
document.getElementById("version").innerHTML = data.version;
|
||||
document.getElementById("date").innerHTML = data.date;
|
||||
session_id = response.id;
|
||||
break;
|
||||
|
||||
case "EndItems":
|
||||
var item_list = [];
|
||||
|
||||
for (var item in data.itemlist) {
|
||||
context_items = [];
|
||||
item = data.itemlist[item];
|
||||
if (item.thumbnail && item.thumbnail.indexOf("http") != 0) {
|
||||
item.thumbnail = domain + "/local/" + encodeURIComponent(btoa(item.thumbnail));
|
||||
}
|
||||
else if (item.thumbnail & false){
|
||||
item.thumbnail = domain + "/proxy/" + encodeURIComponent(btoa(item.thumbnail));
|
||||
};
|
||||
if (item.fanart && item.fanart.indexOf("http") != 0) {
|
||||
item.fanart = domain + "/local/" + encodeURIComponent(btoa(item.fanart));
|
||||
}
|
||||
else if (item.fanart & false){
|
||||
item.fanart = domain + "/proxy/" + encodeURIComponent(btoa(item.fanart));
|
||||
};
|
||||
|
||||
if (item.action == "go_back") {
|
||||
item.url = "go_back";
|
||||
};
|
||||
|
||||
if (item.context.length ) {
|
||||
for (var x in item.context) {
|
||||
html_item = replace_list(html.dialog.select.item, {
|
||||
"item_action": "send_request('" + item.context[x].url + "')",
|
||||
"item_title": item.context[x].title
|
||||
});
|
||||
context_items.push(html_item);
|
||||
}
|
||||
var menu_button = replace_list(html.itemlist.menu, {
|
||||
"menu_items": btoa(context_items.join(""))
|
||||
});
|
||||
var menu_class = "item_with_menu";
|
||||
}
|
||||
else {
|
||||
var menu_button = "";
|
||||
var menu_class = "";
|
||||
};
|
||||
|
||||
var replace_dict = {
|
||||
"item_class": menu_class,
|
||||
"item_url": item.url,
|
||||
"item_thumbnail": item.thumbnail,
|
||||
"item_fanart": item.fanart,
|
||||
"item_title": item.title,
|
||||
"item_plot": item.plot,
|
||||
"item_menu": menu_button,
|
||||
"menu_items": btoa(context_items.join(""))
|
||||
};
|
||||
|
||||
if (html.itemlist[data.viewmode]) {
|
||||
var html_item = replace_list(html.itemlist[data.viewmode], replace_dict);
|
||||
}
|
||||
else {
|
||||
var html_item = replace_list(html.itemlist.movie, replace_dict);
|
||||
}
|
||||
item_list.push(html_item);
|
||||
|
||||
};
|
||||
|
||||
document.getElementById("itemlist").innerHTML = item_list.join("");
|
||||
set_category(data.category);
|
||||
document.getElementById("itemlist").children[0].children[0].focus();
|
||||
document.getElementById("itemlist").scrollTop = 0;
|
||||
show_images();
|
||||
|
||||
nav_history.newResponse(item_list, data.category);
|
||||
|
||||
//console.debug(nav_history)
|
||||
send_data({
|
||||
"id": response.id,
|
||||
"result": true
|
||||
});
|
||||
loading.close();
|
||||
break;
|
||||
|
||||
case "Refresh":
|
||||
nav_history.current -= 1
|
||||
send_request(nav_history.states[nav_history.current].url);
|
||||
send_data({
|
||||
"id": response.id,
|
||||
"result": true
|
||||
});
|
||||
break;
|
||||
|
||||
case "Alert":
|
||||
loading.close();
|
||||
dialog.ok(response.id, data);
|
||||
break;
|
||||
|
||||
case "notification":
|
||||
dialog.notification(response.id, data);
|
||||
break;
|
||||
|
||||
case "AlertYesNo":
|
||||
loading.close()
|
||||
dialog.yesno(response.id, data)
|
||||
break;
|
||||
|
||||
case "ProgressBG":
|
||||
dialog.progress_bg(response.id, data);
|
||||
send_data({
|
||||
"id": response.id,
|
||||
"result": true
|
||||
});
|
||||
break;
|
||||
|
||||
case "ProgressBGUpdate":
|
||||
dialog.progress_bg(response.id, data);
|
||||
break;
|
||||
|
||||
case "ProgressBGClose":
|
||||
dialog.progress_bg_close();
|
||||
send_data({
|
||||
"id": response.id,
|
||||
"result": true
|
||||
});
|
||||
break;
|
||||
|
||||
case "Progress":
|
||||
loading.close();
|
||||
dialog.progress(response.id, data);
|
||||
send_data({
|
||||
"id": response.id,
|
||||
"result": true
|
||||
});
|
||||
break;
|
||||
|
||||
case "ProgressUpdate":
|
||||
dialog.progress_update(response.id, data);
|
||||
break;
|
||||
|
||||
case "ProgressClose":
|
||||
dialog.progress_close();
|
||||
send_data({
|
||||
"id": response.id,
|
||||
"result": true
|
||||
});
|
||||
loading.close();
|
||||
break;
|
||||
|
||||
case "ProgressIsCanceled":
|
||||
send_data({
|
||||
"id": response.id,
|
||||
"result": document.getElementById("window_progress").getElementById("canceled").checked != ""
|
||||
});
|
||||
break;
|
||||
|
||||
case "isPlaying":
|
||||
send_data({
|
||||
"id": response.id,
|
||||
"result": document.getElementById("Player-popup").style.display == "block" || document.getElementById("Lista-popup").style.display == "block"
|
||||
});
|
||||
break;
|
||||
|
||||
case "Keyboard":
|
||||
loading.close();
|
||||
dialog.keyboard(response.id, data);
|
||||
break;
|
||||
|
||||
case "recaptcha":
|
||||
loading.close();
|
||||
dialog.recaptcha(response.id, data);
|
||||
break;
|
||||
|
||||
case "recaptcha_select":
|
||||
loading.close();
|
||||
dialog.recaptcha_select(response.id, data);
|
||||
break
|
||||
|
||||
case "List":
|
||||
loading.close();
|
||||
dialog.select(response.id, data);
|
||||
break;
|
||||
|
||||
case "Play":
|
||||
send_data({
|
||||
"id": response.id,
|
||||
"result": true
|
||||
});
|
||||
|
||||
loading.close();
|
||||
|
||||
if (settings.player_mode == 0) {
|
||||
var lista = [];
|
||||
for (var player in players) {
|
||||
lista.push(replace_list(html.dialog.select.item, {
|
||||
"item_title": players[player],
|
||||
"item_action": "play_mode('" + data.video_url + "','" + data.title + "','" + player + "')"
|
||||
}));
|
||||
};
|
||||
dialog.menu("Elige el Reproductor", btoa(lista.join("")));
|
||||
|
||||
}
|
||||
else {
|
||||
play_mode(data.video_url, data.title, Object.keys(players)[settings.player_mode - 1]);
|
||||
};
|
||||
|
||||
break;
|
||||
|
||||
case "Update":
|
||||
send_request(data.url);
|
||||
loading.close();
|
||||
break;
|
||||
|
||||
case "HideLoading":
|
||||
loading.close();
|
||||
break;
|
||||
|
||||
case "ShowLoading":
|
||||
loading.show();
|
||||
break;
|
||||
|
||||
case "OpenInfo":
|
||||
loading.close();
|
||||
dialog.info(response.id, data);
|
||||
break;
|
||||
|
||||
case "custom_button":
|
||||
dialog.custom_button(response.id, data);
|
||||
break;
|
||||
|
||||
case "OpenConfig":
|
||||
loading.close();
|
||||
var itemlist = {};
|
||||
default_settings = {};
|
||||
settings_controls = [];
|
||||
|
||||
for (var x in data.items) {
|
||||
|
||||
if (!itemlist[data.items[x].category]) {
|
||||
itemlist[data.items[x].category] = [];
|
||||
};
|
||||
if (data.items[x].id) {
|
||||
default_settings[data.items[x].id] = data.items[x]["default"];
|
||||
}
|
||||
if (!data.items[x].color || data.items[x].color == "auto") {
|
||||
data.items[x].color = "#FFFFFF";
|
||||
};
|
||||
if (!data.items[x].enabled && data.items[x].enable) {
|
||||
data.items[x].enabled = data.items[x].enable;
|
||||
};
|
||||
|
||||
settings_controls.push(data.items[x]);
|
||||
|
||||
switch (data.items[x].type) {
|
||||
case "sep":
|
||||
itemlist[data.items[x].category].push(replace_list(html.config.sep, {}));
|
||||
break;
|
||||
|
||||
case "lsep":
|
||||
case "label":
|
||||
itemlist[data.items[x].category].push(replace_list(html.config.label, {
|
||||
"item_color": data.items[x].color,
|
||||
"item_label": data.items[x].label
|
||||
}));
|
||||
break;
|
||||
|
||||
case "number":
|
||||
case "text":
|
||||
if (data.items[x].hidden) {
|
||||
var type = "password";
|
||||
}
|
||||
else {
|
||||
var type = "text";
|
||||
};
|
||||
if (data.items[x].type == 'number') {
|
||||
keypress = "if ('0123456789'.indexOf(event.key) == -1 && event.charCode){return false}"
|
||||
}
|
||||
else {
|
||||
keypress = "";
|
||||
};
|
||||
itemlist[data.items[x].category].push(replace_list(html.config.text, {
|
||||
"item_color": data.items[x].color,
|
||||
"item_label": data.items[x].label,
|
||||
"item_id": data.items[x].id,
|
||||
"item_value": data.items[x].value,
|
||||
"item_type": type,
|
||||
"keypress": keypress
|
||||
|
||||
}));
|
||||
break;
|
||||
|
||||
case "bool":
|
||||
if (data.items[x].value == "true" || data.items[x].value == true) {
|
||||
var value = "checked='checked'";
|
||||
}
|
||||
else {
|
||||
var value = "";
|
||||
};
|
||||
itemlist[data.items[x].category].push(replace_list(html.config.bool, {
|
||||
"item_color": data.items[x].color,
|
||||
"item_label": data.items[x].label,
|
||||
"item_id": data.items[x].id,
|
||||
"item_value": value
|
||||
}));
|
||||
break;
|
||||
|
||||
case "labelenum":
|
||||
if (!data.items[x].values) {
|
||||
var values = data.items[x].lvalues.split("|");
|
||||
}
|
||||
else {
|
||||
var values = data.items[x].values.split("|");
|
||||
};
|
||||
|
||||
var options = [];
|
||||
for (var y in values) {
|
||||
if (data.items[x].value == values[y]) {
|
||||
options.push("<option selected=selected>" + values[y] + "</option>");
|
||||
}
|
||||
else {
|
||||
options.push("<option>" + values[y] + "</option>");
|
||||
};
|
||||
};
|
||||
itemlist[data.items[x].category].push(replace_list(html.config.list, {
|
||||
"item_type": "labelenum",
|
||||
"item_color": data.items[x].color,
|
||||
"item_label": data.items[x].label,
|
||||
"item_id": data.items[x].id,
|
||||
"item_values": options
|
||||
}));
|
||||
break;
|
||||
|
||||
case "list":
|
||||
var options = [];
|
||||
for (var y in data.items[x].lvalues) {
|
||||
if (data.items[x].value == y) {
|
||||
options.push("<option selected=selected>" + data.items[x].lvalues[y] + "</option>");
|
||||
}
|
||||
else {
|
||||
options.push("<option>" + data.items[x].lvalues[y] + "</option>");
|
||||
};
|
||||
};
|
||||
|
||||
itemlist[data.items[x].category].push(replace_list(html.config.list, {
|
||||
"item_type": "enum",
|
||||
"item_color": data.items[x].color,
|
||||
"item_label": data.items[x].label,
|
||||
"item_id": data.items[x].id,
|
||||
"item_values": options
|
||||
}));
|
||||
break;
|
||||
|
||||
case "enum":
|
||||
if (!data.items[x].values) {
|
||||
var values = data.items[x].lvalues.split("|");
|
||||
}
|
||||
else {
|
||||
var values = data.items[x].values.split("|");
|
||||
};
|
||||
|
||||
var options = [];
|
||||
for (var y in values) {
|
||||
if (data.items[x].value == y) {
|
||||
options.push("<option selected=selected>" + values[y] + "</option>");
|
||||
}
|
||||
else {
|
||||
options.push("<option>" + values[y] + "</option>");
|
||||
};
|
||||
};
|
||||
|
||||
itemlist[data.items[x].category].push(replace_list(html.config.list, {
|
||||
"item_type": "enum",
|
||||
"item_color": data.items[x].color,
|
||||
"item_label": data.items[x].label,
|
||||
"item_id": data.items[x].id,
|
||||
"item_values": options
|
||||
}));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
var categories = [];
|
||||
var category_list = [];
|
||||
|
||||
for (var category in itemlist) {
|
||||
if (Object.keys(itemlist).length > 1 || category != "undefined") {
|
||||
categories.push(replace_list(html.config.category, {
|
||||
"item_label": category,
|
||||
"item_category": category
|
||||
}));
|
||||
};
|
||||
category_list.push(replace_list(html.config.container, {
|
||||
"item_id": "category_" + category,
|
||||
"item_value": itemlist[category].join("")
|
||||
}));
|
||||
|
||||
};
|
||||
dialog.config(response.id, data, categories.join(""), category_list.join(""));
|
||||
evaluate_controls();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
||||
function custom_button(data) {
|
||||
if (data == null) {
|
||||
var controls = document.getElementById("window_settings").getControls();
|
||||
|
||||
for (var x in controls) {
|
||||
switch (controls[x].type) {
|
||||
case "text":
|
||||
controls[x].value = default_settings[controls[x].id];
|
||||
break;
|
||||
case "password":
|
||||
controls[x].value = default_settings[controls[x].id];
|
||||
break;
|
||||
case "checkbox":
|
||||
value = default_settings[controls[x].id];
|
||||
if (value == true) {
|
||||
value = "checked";
|
||||
}
|
||||
else {
|
||||
value = "";
|
||||
};
|
||||
controls[x].checked = value;
|
||||
break;
|
||||
case "select-one":
|
||||
if (controls[x].name == "enum") {
|
||||
controls[x].selectedIndex = default_settings[controls[x].id];
|
||||
}
|
||||
else if (controls[x].name == "labelenum") {
|
||||
controls[x].value = default_settings[controls[x].id];
|
||||
};
|
||||
break;
|
||||
};
|
||||
controls[x].onchange()
|
||||
};
|
||||
}
|
||||
else {
|
||||
send_data({
|
||||
"id": document.getElementById("window_settings").RequestID,
|
||||
"result": "custom_button"
|
||||
});
|
||||
if (data["close"] == true) {
|
||||
dialog.closeall();
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
function info_window(comando) {
|
||||
send_data({
|
||||
"id": document.getElementById("window_info").RequestID,
|
||||
"result": comando
|
||||
});
|
||||
};
|
||||
|
||||
function save_config(Guardar) {
|
||||
if (Guardar === true) {
|
||||
var JsonAjustes = {};
|
||||
var controls = document.getElementById("window_settings").getControls();
|
||||
|
||||
for (var x in controls) {
|
||||
switch (controls[x].type) {
|
||||
case "text":
|
||||
JsonAjustes[controls[x].id] = controls[x].value;
|
||||
break;
|
||||
case "password":
|
||||
JsonAjustes[controls[x].id] = controls[x].value;
|
||||
break;
|
||||
case "checkbox":
|
||||
JsonAjustes[controls[x].id] = controls[x].checked.toString();
|
||||
break;
|
||||
case "select-one":
|
||||
if (controls[x].name == "enum") {
|
||||
JsonAjustes[controls[x].id] = controls[x].selectedIndex.toString();
|
||||
}
|
||||
else if (controls[x].name == "labelenum") {
|
||||
JsonAjustes[controls[x].id] = controls[x].value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
send_data({
|
||||
"id": document.getElementById("window_settings").RequestID,
|
||||
"result": JsonAjustes
|
||||
});
|
||||
}
|
||||
else {
|
||||
send_data({
|
||||
"id": document.getElementById("window_settings").RequestID,
|
||||
"result": false
|
||||
});
|
||||
};
|
||||
|
||||
loading.show();
|
||||
};
|
||||
|
||||
function evaluate_controls(control_changed) {
|
||||
if (typeof control_changed != "undefined") {
|
||||
for (var x in settings_controls) {
|
||||
if (settings_controls[x].id == control_changed.id) {
|
||||
switch (control_changed.type) {
|
||||
case "text":
|
||||
settings_controls[x].value = control_changed.value;
|
||||
break;
|
||||
case "password":
|
||||
settings_controls[x].value = control_changed.value;
|
||||
break;
|
||||
case "checkbox":
|
||||
settings_controls[x].value = control_changed.checked;
|
||||
break;
|
||||
case "select-one":
|
||||
if (control_changed.name == "enum") {
|
||||
settings_controls[x].value = control_changed.selectedIndex;
|
||||
}
|
||||
else if (control_changed.name == "labelenum") {
|
||||
settings_controls[x].value = control_changed.value;
|
||||
};
|
||||
break;
|
||||
};
|
||||
break;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
for (var index in settings_controls) {
|
||||
control = get_control_group(index);
|
||||
set_visible(document.getElementById("window_settings").getElementById("controls_container").children[control[0]].children[control[1]], evaluate(index, settings_controls[index].visible));
|
||||
set_enabled(document.getElementById("window_settings").getElementById("controls_container").children[control[0]].children[control[1]], evaluate(index, settings_controls[index].enabled));
|
||||
};
|
||||
};
|
||||
|
||||
function set_visible(element, visible) {
|
||||
if (visible) {
|
||||
element.style.display = "block";
|
||||
}
|
||||
else {
|
||||
element.style.display = "none";
|
||||
};
|
||||
};
|
||||
|
||||
function set_enabled(element, enabled) {
|
||||
if (element.children[0].className == "control") {
|
||||
element.children[0].children[1].disabled = !enabled;
|
||||
};
|
||||
};
|
||||
|
||||
function get_control_group(index) {
|
||||
var group = 0;
|
||||
var pos = 0;
|
||||
var children = document.getElementById("window_settings").getElementById("controls_container").children;
|
||||
for (child in children) {
|
||||
if (pos + children[child].children.length <= index) {
|
||||
group ++;
|
||||
pos += children[child].children.length;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
};
|
||||
};
|
||||
return [group, index - pos];
|
||||
};
|
||||
|
||||
function evaluate(index, condition) {
|
||||
index = parseInt(index);
|
||||
|
||||
if (typeof condition == "undefined") {
|
||||
return true;
|
||||
};
|
||||
if (typeof condition == "boolean") {
|
||||
return condition;
|
||||
};
|
||||
|
||||
if (condition.toLocaleLowerCase() == "true") {
|
||||
return true;
|
||||
}
|
||||
else if (condition.toLocaleLowerCase() == "false") {
|
||||
return false;
|
||||
};
|
||||
|
||||
const regex = /(!?eq|!?gt|!?lt)?\(([^,]+),[\"|']?([^)|'|\"]*)['|\"]?\)[ ]*([+||])?/g;
|
||||
|
||||
while ((m = regex.exec(condition)) !== null) {
|
||||
// This is necessary to avoid infinite loops with zero-width matches
|
||||
if (m.index === regex.lastIndex) {
|
||||
regex.lastIndex++;
|
||||
};
|
||||
|
||||
var operator = m[1];
|
||||
var id = parseInt(m[2]);
|
||||
var value = m[3];
|
||||
var next = m[4];
|
||||
|
||||
if (isNaN(id)) {
|
||||
return false;
|
||||
};
|
||||
|
||||
if (index + id < 0 || index + id >= settings_controls.length) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if (settings_controls[index + id].type == "list" || settings_controls[index + id].type == "enum") {
|
||||
if (settings_controls[index + id].lvalues){
|
||||
control_value = settings_controls[index + id].lvalues[settings_controls[index + id].value];
|
||||
}
|
||||
else {
|
||||
control_value = settings_controls[index + id].values[settings_controls[index + id].value];
|
||||
};
|
||||
}
|
||||
else {
|
||||
control_value = settings_controls[index + id].value;
|
||||
};
|
||||
};
|
||||
|
||||
if (["lt", "!lt", "gt", "!gt"].indexOf(operator) > -1) {
|
||||
value = parseInt(value);
|
||||
if (isNaN(value)) {
|
||||
return false;
|
||||
};
|
||||
};
|
||||
|
||||
if (["eq", "!eq"].indexOf(operator) > -1) {
|
||||
if (typeof(value) == "string") {
|
||||
if (!isNaN(parseInt(value))) {
|
||||
value = parseInt(value);
|
||||
}
|
||||
else if (value.toLocaleLowerCase() == "true") {
|
||||
value = true;
|
||||
}
|
||||
else if (value.toLocaleLowerCase() == "false") {
|
||||
value = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (operator == "eq") {
|
||||
ok = (control_value == value);
|
||||
};
|
||||
if (operator == "!eq") {
|
||||
ok = !(control_value == value);
|
||||
};
|
||||
if (operator == "gt") {
|
||||
ok = (control_value > value);
|
||||
};
|
||||
if (operator == "!gt") {
|
||||
ok = !(control_value > value);
|
||||
};
|
||||
if (operator == "lt") {
|
||||
ok = (control_value < value);
|
||||
};
|
||||
if (operator == "!lt") {
|
||||
ok = !(control_value < value);
|
||||
};
|
||||
|
||||
if (next == "|" && ok == true) {
|
||||
break;
|
||||
};
|
||||
if (next == "+" && ok == false) {
|
||||
break;
|
||||
};
|
||||
};
|
||||
return ok;
|
||||
};
|
||||
79
mediaserver/platformcode/template/js/socket.js
Normal file
79
mediaserver/platformcode/template/js/socket.js
Normal file
@@ -0,0 +1,79 @@
|
||||
function websocket_connect() {
|
||||
if (websocket) {
|
||||
websocket.close();
|
||||
};
|
||||
var status = document.getElementById("footer").getElementById("status");
|
||||
status.innerHTML = "Conectando...";
|
||||
|
||||
loading.show("Estableciendo conexión...");
|
||||
websocket = new WebSocket(websocket_host);
|
||||
websocket.onopen = function (evt) {
|
||||
loading.show();
|
||||
status.innerHTML = "Conectado";
|
||||
};
|
||||
|
||||
websocket.onclose = function (evt) {
|
||||
status.innerHTML = "Desconectado";
|
||||
};
|
||||
|
||||
websocket.onmessage = function (evt) {
|
||||
get_response(evt.data);
|
||||
};
|
||||
|
||||
websocket.onerror = function (evt) {
|
||||
websocket.close();
|
||||
};
|
||||
};
|
||||
|
||||
function websocket_send(data, retry) {
|
||||
if (!retry) {
|
||||
connection_retry = true;
|
||||
};
|
||||
if (!websocket){
|
||||
websocket_connect();
|
||||
};
|
||||
if (websocket.readyState != 1) {
|
||||
if ((websocket.readyState == 2 || websocket.readyState == 3) && connection_retry) {
|
||||
websocket_connect();
|
||||
};
|
||||
setTimeout(websocket_send, 500, data, true);
|
||||
return;
|
||||
}
|
||||
else if (websocket.readyState == 1) {
|
||||
data["id"] = session_id;
|
||||
websocket.send(JSON.stringify(data));
|
||||
};
|
||||
};
|
||||
|
||||
function send_request(url) {
|
||||
if (url == "go_back") {
|
||||
nav_history.go(-1);
|
||||
return;
|
||||
};
|
||||
|
||||
nav_history.newRequest(url);
|
||||
|
||||
loading.show();
|
||||
var send = {};
|
||||
send["request"] = url;
|
||||
websocket_send(send);
|
||||
};
|
||||
|
||||
function send_data(dato) {
|
||||
var send = {};
|
||||
send["data"] = dato;
|
||||
websocket_send(send);
|
||||
};
|
||||
|
||||
function ajax_to_dict(url, obj, key) {
|
||||
var xhttp = new XMLHttpRequest();
|
||||
ajax_running.push(xhttp);
|
||||
xhttp.onreadystatechange = function () {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
eval("obj." + key + " = xhttp.responseText");
|
||||
ajax_running.remove(xhttp)
|
||||
};
|
||||
};
|
||||
xhttp.open("GET", url, true);
|
||||
xhttp.send();
|
||||
};
|
||||
225
mediaserver/platformcode/template/js/ui.js
Normal file
225
mediaserver/platformcode/template/js/ui.js
Normal file
@@ -0,0 +1,225 @@
|
||||
function dispose() {
|
||||
var height = document.getElementById("window").offsetHeight;
|
||||
var header = document.getElementById("header").offsetHeight;
|
||||
var footer = document.getElementById("footer").offsetHeight;
|
||||
var panelheight = height - header - footer;
|
||||
document.getElementById('content').style.height = panelheight + "px";
|
||||
if (document.getElementById("window").offsetWidth < 800) {
|
||||
document.getElementById('panel_items').className = "panel_items_vertical";
|
||||
document.getElementById('panel_info').className = "panel_info_vertical";
|
||||
}
|
||||
else {
|
||||
document.getElementById('panel_items').className = "panel_items";
|
||||
document.getElementById('panel_info').className = "panel_info";
|
||||
}
|
||||
};
|
||||
|
||||
function replace_list(data, list) {
|
||||
for (var key in list) {
|
||||
var re = new RegExp("%" + key, "g");
|
||||
data = data.replace(re, list[key]);
|
||||
};
|
||||
return data;
|
||||
};
|
||||
|
||||
function play_mode(url, title, player) {
|
||||
if (!new RegExp("^(.+://)").test(url)) {
|
||||
url = domain + "/local/" + encodeURIComponent(btoa(Utf8.encode(data.video_url))) + "/video.mp4";
|
||||
}
|
||||
else {
|
||||
var indirect_url = domain + "/proxy/" + encodeURIComponent(btoa(Utf8.encode(url))) + "/video.mp4";
|
||||
};
|
||||
|
||||
if (settings.play_mode == 0 && indirect_url) {
|
||||
var lista = [];
|
||||
lista.push(replace_list(html.dialog.select.item, {
|
||||
"item_title": "Indirecto",
|
||||
"item_action": player + "('" + indirect_url + "','" + title + "')"
|
||||
}));
|
||||
lista.push(replace_list(html.dialog.select.item, {
|
||||
"item_title": "Directo",
|
||||
"item_action": player + "('" + url + "','" + title + "')"
|
||||
}));
|
||||
dialog.menu("Metodo de reproducción", btoa(lista.join("")));
|
||||
}
|
||||
else if (settings.play_mode == 1 && indirect_url) {
|
||||
eval(player)(indirect_url, title);
|
||||
}
|
||||
else {
|
||||
eval(player)(url, title);
|
||||
};
|
||||
};
|
||||
|
||||
function play(url, title) {
|
||||
window.open(url);
|
||||
}
|
||||
|
||||
function vlc_play(url, title) {
|
||||
var html_code = replace_list(html.vlc_player, {
|
||||
"video_url": url
|
||||
});
|
||||
dialog.player(title, html_code);
|
||||
}
|
||||
|
||||
function flash_play(url, title) {
|
||||
var html_code = replace_list(html.flash_player, {
|
||||
"video_url": url
|
||||
});
|
||||
dialog.player(title, html_code);
|
||||
}
|
||||
|
||||
function html_play(url, title) {
|
||||
var html_code = replace_list(html.html_player, {
|
||||
"video_url": url
|
||||
});
|
||||
dialog.player(title, html_code);
|
||||
}
|
||||
|
||||
function set_category(category) {
|
||||
var el = document.getElementById("header");
|
||||
if (category) {
|
||||
el.getElementById("heading").innerHTML = "alfa / " + category;
|
||||
document.title = "alfa / " + category;
|
||||
}
|
||||
else {
|
||||
el.getElementById("heading").innerHTML = "alfa";
|
||||
document.title = "alfa";
|
||||
};
|
||||
};
|
||||
|
||||
function focus_element(element) {
|
||||
element.focus()
|
||||
};
|
||||
|
||||
function image_error(thumbnail) {
|
||||
var src = thumbnail.src;
|
||||
if (thumbnail.src.indexOf(domain) == 0) {
|
||||
thumbnail.src = "http://media.tvalacarta.info/pelisalacarta/thumb_folder2.png";
|
||||
}
|
||||
else {
|
||||
thumbnail.src = domain + "/proxy/" + encodeURIComponent(btoa(thumbnail.src));
|
||||
}
|
||||
if (thumbnail.parentNode == document.activeElement && document.activeElement.className != "item_menu"){
|
||||
document.activeElement.onfocus();
|
||||
};
|
||||
};
|
||||
|
||||
function show_images(){
|
||||
var container = document.getElementById("itemlist");
|
||||
var images = container.getElementsByTagName("img");
|
||||
var item_height = images[0].parentNode.parentNode.offsetHeight;
|
||||
|
||||
var first = Math.floor(container.scrollTop / item_height);
|
||||
var count = Math.ceil(container.offsetHeight / item_height + (container.scrollTop / item_height - first));
|
||||
|
||||
for (var x = first; x < first + count; x++){
|
||||
var image = images[x]
|
||||
if (image && !image.src){
|
||||
image.src = image.parentNode.getElementsByClassName("thumbnail")[1].innerHTML;
|
||||
if (image.parentNode == document.activeElement){
|
||||
document.activeElement.onfocus();
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
function load_info(item, viewmode) {
|
||||
var thumbnail = item.getElementsByClassName("thumbnail")[0];
|
||||
var fanart = item.getElementsByClassName("fanart")[0];
|
||||
var title = item.getElementsByClassName("label")[0];
|
||||
var plot = item.getElementsByClassName("plot")[0];
|
||||
var el = document.getElementById("media_info");
|
||||
|
||||
el.getElementById("media_poster").src = thumbnail.src;
|
||||
el.getElementById("media_plot").innerHTML = plot.innerHTML.replace(/\n/g, "<br>");
|
||||
el.getElementById("media_title").innerHTML = title.innerHTML;
|
||||
|
||||
if (fanart.innerHTML && settings.show_fanart) {
|
||||
document.getElementById("content").style.backgroundImage = "linear-gradient(rgba(255,255,255,0.5),rgba(255,255,255,0.5)), url(" + fanart.innerHTML + ")";
|
||||
document.getElementById("content").children[0].style.opacity = ".9";
|
||||
document.getElementById("content").children[1].style.opacity = ".9";
|
||||
}
|
||||
else {
|
||||
document.getElementById("content").style.backgroundImage = "";
|
||||
document.getElementById("content").children[0].style.opacity = "";
|
||||
document.getElementById("content").children[1].style.opacity = "";
|
||||
};
|
||||
|
||||
if (viewmode == "list") {
|
||||
el.getElementById("media_poster").style.display = "block";
|
||||
el.getElementById("media_plot").style.display = "block";
|
||||
el.getElementById("media_title").style.display = "none";
|
||||
document.getElementById("version_info").style.display = "none";
|
||||
}
|
||||
else if (viewmode == "banner" || viewmode == "channel") {
|
||||
el.getElementById("media_poster").style.display = "none";
|
||||
el.getElementById("media_plot").style.display = "none";
|
||||
el.getElementById("media_title").style.display = "none";
|
||||
document.getElementById("version_info").style.display = "block";
|
||||
}
|
||||
else {
|
||||
el.getElementById("media_poster").style.display = "block";
|
||||
el.getElementById("media_plot").style.display = "block";
|
||||
el.getElementById("media_title").style.display = "block";
|
||||
document.getElementById("version_info").style.display = "none";
|
||||
}
|
||||
auto_scroll(el.getElementById("media_plot"));
|
||||
};
|
||||
|
||||
function unload_info(obj) {
|
||||
var el = document.getElementById('media_info');
|
||||
document.getElementById("version_info").style.display = "block";
|
||||
el.getElementById("media_poster").style.display = "none";
|
||||
el.getElementById("media_plot").style.display = "none";
|
||||
el.getElementById("media_title").style.display = "none";
|
||||
el.getElementById("media_poster").src = "";
|
||||
el.getElementById("media_plot").innerHTML = "";
|
||||
el.getElementById("media_title").innerHTML = "";
|
||||
document.getElementById("content").style.backgroundImage = ""
|
||||
document.getElementById("content").children[0].style.opacity = "";
|
||||
document.getElementById("content").children[1].style.opacity = "";
|
||||
};
|
||||
|
||||
function change_category(category) {
|
||||
var el = document.getElementById('window_settings');
|
||||
el.getElementById("controls_container").scrollTop = 0;
|
||||
categories = el.getElementById("controls_container").getElementsByTagName("ul");
|
||||
for (var x in categories) {
|
||||
if (categories[x].id == "category_" + category) {
|
||||
categories[x].style.display = "block";
|
||||
}
|
||||
else if (categories[x].style) {
|
||||
categories[x].style.display = "none";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
function auto_scroll(element) {
|
||||
clearInterval(element.interval);
|
||||
element.scrollLeft = 0;
|
||||
element.scrollTop = 0;
|
||||
if (element.scrollWidth > element.offsetWidth) {
|
||||
initialscrollWidth = element.scrollWidth;
|
||||
element.innerHTML = element.innerHTML + " | " + element.innerHTML;
|
||||
element.interval = setInterval(function () {
|
||||
element.scrollLeft += 1;
|
||||
if (element.scrollLeft - 1 >= element.scrollWidth - initialscrollWidth) {
|
||||
element.scrollLeft = 0;
|
||||
};
|
||||
}, 80);
|
||||
};
|
||||
if (element.scrollHeight > element.offsetHeight) {
|
||||
initialscrollHeight = element.scrollHeight;
|
||||
element.innerHTML = element.innerHTML + "</br>" + element.innerHTML;
|
||||
element.interval = setInterval(function () {
|
||||
element.scrollTop += 1;
|
||||
if (element.scrollTop >= element.scrollHeight - initialscrollHeight) {
|
||||
element.scrollTop = 0;
|
||||
};
|
||||
}, 80);
|
||||
};
|
||||
};
|
||||
|
||||
function center_window(el) {
|
||||
el.style.top = document.getElementById("window").offsetHeight / 2 - el.offsetHeight / 2 + "px";
|
||||
};
|
||||
43
mediaserver/platformcode/template/js/utils.js
Normal file
43
mediaserver/platformcode/template/js/utils.js
Normal file
@@ -0,0 +1,43 @@
|
||||
var Utf8 = { // public method for url encoding
|
||||
encode: function(string) {
|
||||
string = string.replace(/\r\n/g, "\n");
|
||||
var utftext = "";
|
||||
for (var n = 0; n < string.length; n++) {
|
||||
var c = string.charCodeAt(n);
|
||||
if (c < 128) {
|
||||
utftext += String.fromCharCode(c);
|
||||
} else if ((c > 127) && (c < 2048)) {
|
||||
utftext += String.fromCharCode((c >> 6) | 192);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
} else {
|
||||
utftext += String.fromCharCode((c >> 12) | 224);
|
||||
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
}
|
||||
|
||||
return utftext;
|
||||
}, // public method for url decoding
|
||||
decode: function(utftext) {
|
||||
var string = "";
|
||||
var i = 0;
|
||||
var c = c1 = c2 = 0;
|
||||
while (i < utftext.length) {
|
||||
c = utftext.charCodeAt(i);
|
||||
if (c < 128) {
|
||||
string += String.fromCharCode(c);
|
||||
i++;
|
||||
} else if ((c > 191) && (c < 224)) {
|
||||
c2 = utftext.charCodeAt(i + 1);
|
||||
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
||||
i += 2;
|
||||
} else {
|
||||
c2 = utftext.charCodeAt(i + 1);
|
||||
c3 = utftext.charCodeAt(i + 2);
|
||||
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
return string;
|
||||
}
|
||||
};
|
||||
139
mediaserver/platformcode/template/js/vars.js
Normal file
139
mediaserver/platformcode/template/js/vars.js
Normal file
@@ -0,0 +1,139 @@
|
||||
var domain = window.location.href.split("/").slice(0, 3).join("/");
|
||||
var focused_item = null;
|
||||
var websocket = null;
|
||||
var session_id = null;
|
||||
var default_settings = {};
|
||||
var settings_controls = [];
|
||||
var connection_retry = true;
|
||||
var settings = {};
|
||||
var loading = {};
|
||||
var dialog = {};
|
||||
var ajax_running = [];
|
||||
var keychar = {
|
||||
"keyCode": 0,
|
||||
"Time": 0,
|
||||
"Char": ""
|
||||
};
|
||||
var html = {
|
||||
"dialog": {
|
||||
"select": {}
|
||||
},
|
||||
"config": {},
|
||||
"itemlist": {}
|
||||
};
|
||||
var players = {
|
||||
"play": "Abrir enlace",
|
||||
"vlc_play": "Plugin VLC",
|
||||
"flash_play": "Reproductor Flash",
|
||||
"html_play": "Video HTML"
|
||||
};
|
||||
var nav_history = {
|
||||
"newRequest": function (url) {
|
||||
if (this.confirmed) {
|
||||
if (this.states[this.current].url == url) {
|
||||
this.states[this.current].url;
|
||||
this.states[this.current].start;
|
||||
}
|
||||
else {
|
||||
this.states[this.current].scroll = document.getElementById("itemlist").scrollTop;
|
||||
this.states[this.current].focus = Array.prototype.indexOf.call(document.getElementById("itemlist").children, focused_item.parentNode);
|
||||
this.current += 1;
|
||||
this.states.splice(this.current, 0, {
|
||||
"start": new Date().getTime(),
|
||||
"url": url
|
||||
});
|
||||
this.confirmed = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this.current == -1) {
|
||||
this.current = 0;
|
||||
this.states.push({
|
||||
"start": new Date().getTime(),
|
||||
"url": url
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.states[this.current].start = new Date().getTime();
|
||||
this.states[this.current].url = url;
|
||||
}
|
||||
}
|
||||
},
|
||||
"newResponse": function (data, category) {
|
||||
if (!this.confirmed) {
|
||||
if (this.states[this.current].focus >= 0) {
|
||||
document.getElementById("itemlist").children[this.states[this.current].focus].children[0].focus();
|
||||
document.getElementById("itemlist").scrollTop = this.states[this.current].scroll;
|
||||
}
|
||||
this.states[this.current].end = new Date().getTime();
|
||||
this.states[this.current].data = data;
|
||||
this.states[this.current].category = category;
|
||||
this.confirmed = true;
|
||||
if (settings.builtin_history && !this.from_nav) {
|
||||
if (this.current > 0) {
|
||||
history.pushState(this.current.toString(), "", "#" + this.states[this.current].url);
|
||||
}
|
||||
else {
|
||||
history.replaceState(this.current.toString(), "", "#" + this.states[this.current].url);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this.states[this.current].focus >= 0) {
|
||||
document.getElementById("itemlist").children[this.states[this.current].focus].children[0].focus();
|
||||
document.getElementById("itemlist").scrollTop = this.states[this.current].scroll;
|
||||
}
|
||||
this.states[this.current].end = new Date().getTime();
|
||||
this.states[this.current].data = data;
|
||||
this.states[this.current].category = category;
|
||||
this.states = this.states.slice(0, this.current + 1);
|
||||
}
|
||||
this.from_nav = false;
|
||||
},
|
||||
|
||||
"go": function (index) {
|
||||
if (!this.confirmed) {
|
||||
this.current -= 1;
|
||||
this.confirmed = true;
|
||||
}
|
||||
this.states[this.current].scroll = document.getElementById("itemlist").scrollTop;
|
||||
this.states[this.current].focus = Array.prototype.indexOf.call(document.getElementById("itemlist").children, focused_item.parentNode);
|
||||
|
||||
if (this.current + index < 0) {
|
||||
this.current = -1;
|
||||
this.confirmed = false;
|
||||
send_request("");
|
||||
return;
|
||||
}
|
||||
|
||||
else if (this.current + index >= this.states.lenght) {
|
||||
this.current = this.states.lenght - 1;
|
||||
}
|
||||
else {
|
||||
this.current += index;
|
||||
}
|
||||
|
||||
if (this.states[this.current].end - this.states[this.current].start > this.cache) {
|
||||
document.getElementById("itemlist").innerHTML = this.states[this.current].data.join("");
|
||||
set_category(this.states[this.current].category)
|
||||
if (this.states[this.current].focus >= 0) {
|
||||
document.getElementById("itemlist").children[this.states[this.current].focus].children[0].focus();
|
||||
}
|
||||
if (this.states[this.current].scroll) {
|
||||
document.getElementById("itemlist").scrollTop = this.states[this.current].scroll;
|
||||
}
|
||||
show_images();
|
||||
this.confirmed = true;
|
||||
}
|
||||
else {
|
||||
this.confirmed = false;
|
||||
this.from_nav = true;
|
||||
send_request(this.states[this.current].url);
|
||||
}
|
||||
},
|
||||
"current": -1,
|
||||
"confirmed": false,
|
||||
"from_nav": false,
|
||||
"states": [],
|
||||
"cache": 2000 //Tiempo para determinar si se cargará la cache o se volvera a solicitar el item (el tiempo es el que tarda en responder el servidor)
|
||||
};
|
||||
15
mediaserver/platformcode/template/manifest.json
Normal file
15
mediaserver/platformcode/template/manifest.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "alfa",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/media/icon-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"theme_color": "#00779F",
|
||||
"background_color": "#00779F",
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"orientation": "any"
|
||||
}
|
||||
224
mediaserver/platformcode/template/page.html
Normal file
224
mediaserver/platformcode/template/page.html
Normal file
@@ -0,0 +1,224 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="shortcut icon" href="/media/favicon.ico" />
|
||||
|
||||
<!-- Web as app support -->
|
||||
<link rel="manifest" href="/media/manifest.json">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
|
||||
<!-- Navigation bar color -->
|
||||
<!-- Chrome, Firefox OS and Opera -->
|
||||
<meta name="theme-color" content="#01455c">
|
||||
<!-- Windows Phone -->
|
||||
<meta name="msapplication-navbutton-color" content="#01455c">
|
||||
<!-- iOS Safari -->
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="#01455c">
|
||||
|
||||
<title>alfa</title>
|
||||
|
||||
<link rel="stylesheet" href="/media/css/alfa.css" />
|
||||
<script type="text/javascript" src="/media/js/main.js"></script>
|
||||
<script type="text/javascript" src="/media/js/vars.js"></script>
|
||||
<script type="text/javascript" src="/media/js/ui.js"></script>
|
||||
<script type="text/javascript" src="/media/js/navigation.js"></script>
|
||||
<script type="text/javascript" src="/media/js/dialogs.js"></script>
|
||||
<script type="text/javascript" src="/media/js/protocol.js"></script>
|
||||
<script type="text/javascript" src="/media/js/socket.js"></script>
|
||||
<script type="text/javascript" src="/media/js/utils.js"></script>
|
||||
<script type="text/javascript">
|
||||
websocket_host = 'ws://' + window.location.hostname + ':{$WSPORT}'
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- loading -->
|
||||
<div class="window_loading" id="window_loading">
|
||||
<span class="loading_animation"></span>
|
||||
<a class="loading_message" id="loading_message" href="javascript:void(0)">Cargando...</a>
|
||||
</div>
|
||||
|
||||
<!--/window_progress -->
|
||||
<div class="window_background_progress" id="window_background_progress">
|
||||
<div Class="window_heading" id="window_heading"></div>
|
||||
<div Class="window_message" id="window_message"></div>
|
||||
<div Class="progressbar_background" id="progressbar_background">
|
||||
<div Class="progressbar" id="progressbar"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="window_overlay" id="window_overlay"></div>
|
||||
|
||||
<!-- window_select -->
|
||||
<div class="window_select" id="window_select">
|
||||
<a class="window_close" href="javascript:void(0)" onmouseover="this.focus()" onclick="send_data({'id':this.parentNode.RequestID, 'result':-1 });dialog.closeall();"></a>
|
||||
<div class="window_heading" id="window_heading"></div>
|
||||
<ul class="control_list" id="control_list"></ul>
|
||||
</div>
|
||||
|
||||
<!-- window_ok -->
|
||||
<div class="window_ok" id="window_ok">
|
||||
<a class="window_close" href="javascript:void(0)" onmouseover="this.focus()" onclick="send_data({'id':this.parentNode.RequestID, 'result':true });dialog.closeall();"></a>
|
||||
<div class="window_heading" id="window_heading"></div>
|
||||
<div Class="window_message" id="window_message"></div>
|
||||
<div class="window_footer" id="window_footer">
|
||||
<a href="javascript:void(0)" class="control_button button_ok" onmouseover="this.focus()" onclick="send_data({'id':this.parentNode.parentNode.RequestID, 'result':true });dialog.closeall();">Aceptar</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- window_yesno -->
|
||||
<div class="window_yesno" id="window_yesno">
|
||||
<a class="window_close" href="javascript:void(0)" onmouseover="this.focus()" onclick="send_data({'id':this.parentNode.RequestID, 'result':false });dialog.closeall();"></a>
|
||||
<div class="window_heading" id="window_heading"></div>
|
||||
<div Class="window_message" id="window_message"></div>
|
||||
<div class="window_footer" id="window_footer">
|
||||
<a href="javascript:void(0)" class="control_button button_ok" onmouseover="this.focus()" onclick="send_data({'id':this.parentNode.parentNode.RequestID, 'result':true });dialog.closeall();">Si</a>
|
||||
<a href="javascript:void(0)" class="control_button button_close" onmouseover="this.focus()" onclick="send_data({'id':this.parentNode.parentNode.RequestID, 'result':false });dialog.closeall();">No</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- window_notification -->
|
||||
<div class="window_notification" id="window_notification">
|
||||
<div class="window_icon" id="window_icon"></div>
|
||||
<div Class="window_heading" id="window_heading"></div>
|
||||
<div Class="window_message" id="window_message"></div>
|
||||
</div>
|
||||
|
||||
<!--/window_progress -->
|
||||
<div class="window_progress" id="window_progress">
|
||||
<a class="window_close" href="javascript:void(0)" onmouseover="this.focus()" onclick="this.parentNode.querySelector('#canceled').checked='checked';this.parentNode.querySelector('#window_heading').innerHTML += ' Cancelando...';"></a>
|
||||
<div class="window_heading" id="window_heading"></div>
|
||||
<div Class="window_message" id="window_message"></div>
|
||||
<div Class="progress_background" id="progress_background">
|
||||
<div Class="progress" id="progress"></div>
|
||||
</div>
|
||||
<div class="window_footer" id="window_footer">
|
||||
<a href="javascript:void(0)" class="control_button button_close" onmouseover="this.focus()" onclick="this.parentNode.querySelector('#canceled').checked='checked';this.parentNode.parentNode.querySelector('#window_heading').innerHTML += ' Cancelando...';">Cancelar</a>
|
||||
<input type="checkbox" style="display:none" id="canceled">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- window_input -->
|
||||
<div class="window_input" id="window_input">
|
||||
<a class="window_close" href="javascript:void(0)" onmouseover="this.focus()" onclick="send_data({'id':this.parentNode.RequestID, 'result':null });dialog.closeall();"></a>
|
||||
<div class="window_heading" id="window_heading"></div>
|
||||
<div class="control_input" id="control_input">
|
||||
<input class="control_input" id="window_value" type="text" onkeypress="if(event.keyCode == 13){send_data({'id':this.parentNode.parentNode.RequestID, 'result':this.value });dialog.closeall();loading.show();}">
|
||||
<label class="control_input"></label>
|
||||
</div>
|
||||
<div class="window_footer" id="window_footer">
|
||||
<a href="javascript:void(0)" class="control_button button_ok" onmouseover="this.focus()" onclick="send_data({'id':this.parentNode.parentNode.RequestID, 'result':this.parentNode.parentNode.getElementById('window_value').value});dialog.closeall();loading.show();">Aceptar</a>
|
||||
<a href="javascript:void(0)" class="control_button button_close" onmouseover="this.focus()" onclick="send_data({'id':this.parentNode.parentNode.RequestID, 'result':null });dialog.closeall();">Cancelar</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- window_captcha -->
|
||||
<div class="window_recaptcha" id="window_recaptcha">
|
||||
<a class="window_close" href="javascript:void(0)" onmouseover="this.focus()" onclick="send_data({'id':this.parentNode.RequestID, 'result':null });dialog.closeall();"></a>
|
||||
<div class="window_heading" id="window_heading"></div>
|
||||
<div Class="window_message" id="window_message"></div>
|
||||
<div class="window_image" id= "window_image">
|
||||
<a href="javascript:void(0)" onmouseover="this.focus()" onmouseout="this.blur()" onclick="send_data({'id':this.parentNode.parentNode.RequestID, 'result': 0})"></a>
|
||||
<a href="javascript:void(0)" onmouseover="this.focus()" onmouseout="this.blur()" onclick="send_data({'id':this.parentNode.parentNode.RequestID, 'result': 1})"></a>
|
||||
<a href="javascript:void(0)" onmouseover="this.focus()" onmouseout="this.blur()" onclick="send_data({'id':this.parentNode.parentNode.RequestID, 'result': 2})"></a>
|
||||
<a href="javascript:void(0)" onmouseover="this.focus()" onmouseout="this.blur()" onclick="send_data({'id':this.parentNode.parentNode.RequestID, 'result': 3})"></a>
|
||||
<a href="javascript:void(0)" onmouseover="this.focus()" onmouseout="this.blur()" onclick="send_data({'id':this.parentNode.parentNode.RequestID, 'result': 4})"></a>
|
||||
<a href="javascript:void(0)" onmouseover="this.focus()" onmouseout="this.blur()" onclick="send_data({'id':this.parentNode.parentNode.RequestID, 'result': 5})"></a>
|
||||
<a href="javascript:void(0)" onmouseover="this.focus()" onmouseout="this.blur()" onclick="send_data({'id':this.parentNode.parentNode.RequestID, 'result': 6})"></a>
|
||||
<a href="javascript:void(0)" onmouseover="this.focus()" onmouseout="this.blur()" onclick="send_data({'id':this.parentNode.parentNode.RequestID, 'result': 7})"></a>
|
||||
<a href="javascript:void(0)" onmouseover="this.focus()" onmouseout="this.blur()" onclick="send_data({'id':this.parentNode.parentNode.RequestID, 'result': 8})"></a>
|
||||
</div>
|
||||
<div class="window_footer" id="window_footer">
|
||||
<a href="javascript:void(0)" class="control_button button_ok" onmouseover="this.focus()" onclick="send_data({'id':this.parentNode.parentNode.RequestID, 'result':true});dialog.closeall();loading.show();">Aceptar</a>
|
||||
<a href="javascript:void(0)" class="control_button button_close" onmouseover="this.focus()" onclick="send_data({'id':this.parentNode.parentNode.RequestID, 'result':null });dialog.closeall();">Cancelar</a>
|
||||
<a href="javascript:void(0)" class="control_button button_ok" onmouseover="this.focus()" onclick="send_data({'id':this.parentNode.parentNode.RequestID, 'result':'refresh'});dialog.closeall();loading.show();">Recargar</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--/window_settings -->
|
||||
<div id="window_settings" class="window_settings">
|
||||
<a class="window_close" href="javascript:void(0)" onmouseover="this.focus()" onclick="dialog.closeall();if(this.parentNode.getElementById('window_footer').style.display != 'none'){save_config(false)}"></a>
|
||||
<div class="window_heading" id="window_heading"></div>
|
||||
<div class="category_container" id="category_container"></div>
|
||||
<div class="controls_container" id="controls_container"></div>
|
||||
<div class="window_footer" id="window_footer_local" style="display:none">
|
||||
<a href="javascript:void(0)" class="control_button button_ok" onmouseover="this.focus()" onclick="save_settings();dialog.closeall()">Guardar</a>
|
||||
<a href="javascript:void(0)" class="control_button button_close" onmouseover="this.focus()" onclick="dialog.closeall()">Cerrar</a>
|
||||
</div>
|
||||
<div class="window_footer" id="window_footer">
|
||||
<a href="javascript:void(0)" class="control_button button_ok" onmouseover="this.focus()" onclick="dialog.closeall();save_config(true);">Guardar</a>
|
||||
<a href="javascript:void(0)" class="control_button button_close" onmouseover="this.focus()" onclick="dialog.closeall();save_config(false);">Cerrar</a>
|
||||
<a href="javascript:void(0)" class="control_button" onmouseover="this.focus()" onclick="custom_button();" id="custom_button"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--/window_info -->
|
||||
<div class="window_info" id="window_info">
|
||||
<a class="window_close" href="javascript:void(0)" onmouseover="this.focus()" onclick="dialog.closeall();info_window('close')"></a>
|
||||
<div class="window_heading" id="window_heading"></div>
|
||||
<div class="window_content">
|
||||
<img class="info_fanart" id="info_fanart">
|
||||
<img class="info_poster" id="info_poster">
|
||||
<span class="line1_head" id="line1_head"></span><span class="line1" id="line1"></span>
|
||||
<span class="line2_head" id="line2_head"></span><span class="line2" id="line2"></span>
|
||||
<span class="line3_head" id="line3_head"></span><span class="line3" id="line3"></span>
|
||||
<span class="line4_head" id="line4_head"></span><span class="line4" id="line4"></span>
|
||||
<span class="line5_head" id="line5_head"></span><span class="line5" id="line5"></span>
|
||||
<span class="line6_head" id="line6_head"></span><span class="line6" id="line6"></span>
|
||||
<span class="line7_head" id="line7_head"></span><span class="line7" id="line7"></span>
|
||||
<span class="line8_head" id="line8_head"></span><span class="line8" id="line8"></span>
|
||||
<span class="page_info" id="page_info"></span>
|
||||
</div>
|
||||
<div class="window_footer" id="window_footer">
|
||||
<a href="javascript:void(0)" class="control_button" id="previous" onmouseover="this.focus()" onclick="info_window('previous')">Anterior</a>
|
||||
<a href="javascript:void(0)" class="control_button" id="next" onmouseover="this.focus()" onclick="info_window('next')">Siguiente</a>
|
||||
<a href="javascript:void(0)" class="control_button button_close" onmouseover="this.focus()" onclick="dialog.closeall();info_window('close')">Cancelar</a>
|
||||
<a href="javascript:void(0)" class="control_button button_close" onmouseover="this.focus()" onclick="dialog.closeall();info_window('ok')">Aceptar</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- window_player -->
|
||||
<div class="window_player" id="window_player">
|
||||
<a class="window_close" href="javascript:void(0)" onmouseover="this.focus()" onclick="dialog.closeall()"></a>
|
||||
<div class="window_heading" id="window_heading"></div>
|
||||
<div id="media_content" class="media_content"></div>
|
||||
</div>
|
||||
|
||||
<div class="window" id="window">
|
||||
<div class="header" id="header">
|
||||
<div class="logo"></div>
|
||||
<h1 class="heading" id="heading">alfa</h1>
|
||||
<a class="settings" href="javascript:void(0)" onclick="dialog.settings()"></a>
|
||||
</div>
|
||||
<div class="content" id="content">
|
||||
<div class="panel_info" id="panel_info">
|
||||
<div class="media_info" id="media_info">
|
||||
<img id="media_poster" src="" />
|
||||
<h3 id="media_title"></h3>
|
||||
<div id="media_plot"></div>
|
||||
</div>
|
||||
<div class="version_info" id="version_info">
|
||||
<span class="Version" id="version"></span><br/>
|
||||
<span class="Version" id="date"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel_items" id="panel_items">
|
||||
<ul class="itemlist" id="itemlist" onscroll="show_images()">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer" id="footer">
|
||||
<div class="left">
|
||||
</div>
|
||||
<div class="links">
|
||||
<a href="#">Saber más sobre Alfa</a> | <a href="#">Foro</a>
|
||||
</div>
|
||||
<div class="status" id="status">Desconectado</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user