Initial commit

This commit is contained in:
2018-09-24 00:50:31 +08:00
commit d8abaf3db6
119 changed files with 4536 additions and 0 deletions
+162
View File
@@ -0,0 +1,162 @@
<!--
yunkong2.yunkong2.kodi Widget-Set
version: "0.0.6"
Copyright 10.2015-2016 instalator<vvvalt@mail.ru>
-->
<link rel="stylesheet" href="widgets/kodi/css/style.css" />
<script type="text/javascript" src="widgets/kodi/js/kodi.js"></script>
<script id="tplkodiProgressBar"
type="text/ejs"
class="vis-tpl"
data-vis-prev='<img style="width:110px; height:10px" src="widgets/kodi/img/w_icon/progress.png"></img>'
data-vis-attrs="oid_seek/id/;"
data-vis-set="kodi"
data-vis-type="val"
data-vis-name="Progress Bar">
<div class="vis-widget <%== this.data.attr('class') %>" style="width:200px; height:20px; overflow: initial" id="<%= this.data.attr('wid') %>" >
<% vis.binds.kodi.Progress(this.data.wid, this.view, this.data, this.style);%>
</div>
</script>
<script id="tplkodiPlaylist"
type="text/ejs"
class="vis-tpl"
data-vis-prev='<img style="width:110px; height:90px" src="widgets/kodi/img/w_icon/playlist.png"></img>'
data-vis-attrs="oid_playlist/id/;oid_position/id;oid_server/id/;"
data-vis-set="kodi"
data-vis-type="val"
data-vis-name="KODI Playlist">
<div class="vis-widget <%== this.data.attr('class') %>" style="width:500px; height:240px" id="<%= this.data.attr('wid') %>" >
<div id="kodiplaylist">
<ul id="playListContainer">
</ul>
</div>
<% vis.binds.kodi.Playlist(this.data.wid, this.view, this.data, this.style);%>
</div>
</script>
<script id="tplkodiThumbnail"
type="text/ejs"
class="vis-tpl"
data-vis-prev='<img style="width:110px; height:110px" src="widgets/kodi/img/defaultplaylist.png"></img>'
data-vis-attrs="oid_thumbnail/id/;oid_type/id/;oid_server/id/;"
data-vis-set="kodi"
data-vis-type="val"
data-vis-name="KODI Thumbnail">
<div class="vis-widget <%== this.data.attr('class') %>" style="width:110px; height:110px" id="<%= this.data.attr('wid') %>" >
<ul class="kodicover">
<li class="cover"></li>
</ul>
<% vis.binds.kodi.Thumbnail(this.data.wid, this.view, this.data, this.style);%>
</div>
</script>
<script id="tplkodiCodec"
type="text/ejs"
class="vis-tpl"
data-vis-prev='<img style="width:100px; height:50px" src="widgets/kodi/img/w_icon/codec.png"></img>'
data-vis-attrs="oid_codec/id/;"
data-vis-set="kodi"
data-vis-type="val"
data-vis-name="KODI codec info">
<div class="vis-widget <%== this.data.attr('class') %>" style="width:100px; height:50px" id="<%= this.data.attr('wid') %>" >
<ul class="kodiinfo">
<li class="codec"></li>
</ul>
<% vis.binds.kodi.CodecInfo(this.data.wid, this.view, this.data, this.style);%>
</div>
</script>
<script id="tplkodiAspect"
type="text/ejs"
class="vis-tpl"
data-vis-prev='<img style="width:67px; height:50px" src="widgets/kodi/img/w_icon/aspect.png"></img>'
data-vis-attrs="oid_aspect/id/;"
data-vis-set="kodi"
data-vis-type="val"
data-vis-name="KODI AspectRatio info">
<div class="vis-widget <%== this.data.attr('class') %>" style="width:70px; height:50px" id="<%= this.data.attr('wid') %>" >
<ul class="kodiinfo">
<li class="aspect"></li>
</ul>
<% vis.binds.kodi.AspectInfo(this.data.wid, this.view, this.data, this.style);%>
</div>
</script>
<script id="tplkodiResolut"
type="text/ejs"
class="vis-tpl"
data-vis-prev='<img style="width:67px; height:50px" src="widgets/kodi/img/w_icon/resolution.png"></img>'
data-vis-attrs="oid_resolut/id/;"
data-vis-set="kodi"
data-vis-type="val"
data-vis-name="KODI Video Resolution info">
<div class="vis-widget <%== this.data.attr('class') %>" style="width:70px; height:50px" id="<%= this.data.attr('wid') %>" >
<ul class="kodiinfo">
<li class="resolut"></li>
</ul>
<% vis.binds.kodi.ResolutInfo(this.data.wid, this.view, this.data, this.style);%>
</div>
</script>
<script id="tplkodiChannel"
type="text/ejs"
class="vis-tpl"
data-vis-prev='<img style="width:64px; height:50px" src="widgets/kodi/img/w_icon/channel.png"></img>'
data-vis-attrs="oid_channel/id/;"
data-vis-set="kodi"
data-vis-type="val"
data-vis-name="KODI Audio Channel info">
<div class="vis-widget <%== this.data.attr('class') %>" style="width:70px; height:50px" id="<%= this.data.attr('wid') %>" >
<ul class="kodiinfo">
<li class="channel"></li>
</ul>
<% vis.binds.kodi.ChannelInfo(this.data.wid, this.view, this.data, this.style);%>
</div>
</script>
<script id="tplkodiVideoCodec"
type="text/ejs"
class="vis-tpl"
data-vis-prev='<img style="width:100px; height:50px" src="widgets/kodi/img/w_icon/video_codec.png"></img>'
data-vis-attrs="oid_videocodec/id/;"
data-vis-set="kodi"
data-vis-type="val"
data-vis-name="KODI VideoCodec info">
<div class="vis-widget <%== this.data.attr('class') %>" style="width:100px; height:50px" id="<%= this.data.attr('wid') %>" >
<ul class="kodiinfo">
<li class="videocodec"></li>
</ul>
<% vis.binds.kodi.VideoCodec(this.data.wid, this.view, this.data, this.style);%>
</div>
</script>
<script id="tplkodiButton"
type="text/ejs"
class="vis-tpl"
data-vis-prev='<img style="width:110px; height:20px" src="widgets/kodi/img/w_icon/button.png"></img>'
data-vis-attrs="oid_play/id/;oid_speed/id;oid_prev/id;oid_next/id;oid_stop/id;oid_mute/id;oid_rpt/id;oid_shf/id;oid_seek/id;"
data-vis-set="kodi"
data-vis-type="val"
data-vis-name="KODI Button">
<div class="vis-widget <%== this.data.attr('class') %>" style="width:400px; height:50px" id="<%= this.data.attr('wid') %>" >
<ul id="kodicontrols">
<li class="prev"></li>
<li class="rewind"></li>
<li class="playpause"></li>
<li class="stop"></li>
<li class="forward"></li>
<li class="next"></li>
<li class="repeat"></li>
<li class="shuffle"></li>
</ul>
<% vis.binds.kodi.Button(this.data.wid, this.view, this.data, this.style);%>
</div>
</script>
+108
View File
@@ -0,0 +1,108 @@
.yunkong2.kodi-class {
font-style: italic;
}
.kodicover, .cover{
width: 100%;
height: 100%;
text-align:center;
background-position: center top;
background-repeat: no-repeat;
background-size: cover;
margin: 0;
padding: 0;
}
.cover.adef {
background-image: url("../img/defaultplaylist.png") !important;
background-position: center top;
background-repeat: no-repeat;
background-size: cover;
width:100%;
height:100%;
margin: 0;
padding: 0;
}
.cover.vdef {
background-image: url("../img/defaultvideo.png") !important;
background-position: center top;
background-repeat: no-repeat;
background-size: cover;
width:100%;
height:100%;
margin: 0;
padding: 0;
}
#progressbar {
width: 100%;
height: 100%;
}
#kodiplaylist {
height: 100%;
width: 100%;
overflow-x: hidden;
}
#kodiplaylist li:hover, #kodiplaylist li:nth-child(even):hover { background-color:#00bd9b; color:#fff; }
#kodiplaylist li.active{
background-color:#00bd9b;
color:#fff;
}
#kodiplaylist li img{
box-shadow: 0 0 5px 0px #FFF, 0 0 0 1px #000, 0 0 0 1px #484848;
border-radius: 5px;
}
#kodiplaylist ul {
margin: 0;
padding-left: 5px;
clear: both;
cursor: pointer;
}
#kodicontrols, .kodiinfo{
height: 100%;
width: 100%;
padding: 0px;
margin: 0px;
}
#kodicontrols li {
float:left;
display:inline-block;
width:50px;
height: 50px;
text-align:center;
}
.kodiinfo li{
width: 100%;
height: 100%;
text-align:center;
background-position: center top;
background-repeat: no-repeat;
background-size: cover;
}
.prev { background: url("../img/btn/btn_sprite.png") -48px -48px }
.prev:hover { background: url("../img/btn/btn_sprite.png") -48px -0px;}
.rewind { background: url("../img/btn/btn_sprite.png") -144px 48px;}
.rewind:hover { background: url("../img/btn/btn_sprite.png") -144px -0px;}
.playpause { background: url("../img/btn/btn_sprite.png") -192px -48px }
.playpause:hover { background: url("../img/btn/btn_sprite.png") -192px -0px;}
.playpause.play { background: url("../img/btn/btn_sprite.png") -240px -48px;}
.playpause.play:hover { background: url("../img/btn/btn_sprite.png") -240px -0px}
.stop { background: url("../img/btn/btn_sprite.png") -528px 48px;}
.stop:hover { background: url("../img/btn/btn_sprite.png") -528px -0px;}
.forward { background: url("../img/btn/btn_sprite.png") -96px -48px}
.forward:hover { background: url("../img/btn/btn_sprite.png") -96px -0px}
.next { background: url("../img/btn/btn_sprite.png") -0px -48px}
.next:hover { background: url("../img/btn/btn_sprite.png") -0px -0px}
.repeat { background: url("../img/btn/btn_sprite.png") -480px -48px;}
.repeat:hover { background: url("../img/btn/btn_sprite.png") -480px -0px;}
.repeat.one { background: url("../img/btn/btn_sprite.png") -432px -48px;}
.repeat.one:hover { background: url("../img/btn/btn_sprite.png") -432px -0px;}
.repeat.all { background: url("../img/btn/btn_sprite.png") -384px -48px;}
.repeat.all:hover { background: url("../img/btn/btn_sprite.png") -384px -0px;}
.shuffle { background: url("../img/btn/btn_sprite.png") -336px -48px;}
.shuffle:hover { background: url("../img/btn/btn_sprite.png") -336px -0px}
.shuffle.on { background: url("../img/btn/btn_sprite.png") -288px -48px;}
.shuffle.on:hover { background: url("../img/btn/btn_sprite.png") -288px -0px;}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1003 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

+432
View File
@@ -0,0 +1,432 @@
/*
kodi Widget-Set
Copyright 10.2015-2016 instalator<vvvalt@mail.ru>
*/
"use strict";
if (vis.editMode) {
$.extend(true, systemDictionary, {
"myColor": {"en": "myColor", "de": "mainColor", "ru": "Мой цвет"},
"myColor_tooltip": {
"en": "Description of\x0AmyColor",
"de": "Beschreibung von\x0AmyColor",
"ru": "Описание\x0AmyColor"
},
"oid_playlist": {"en": "playlist", "de": "playlist", "ru": "playlist"},
"oid_pvrplaylist": {"en": "PVR playlist", "de": "PVR playlist", "ru": "PVR playlist"},
"oid_position": {"en": "position", "de": "position", "ru": "position"},
"oid_codec": {"en": "codec", "de": "codec", "ru": "codec"},
"oid_aspect": {"en": "video_aspect", "de": "video_aspect", "ru": "video_aspect"},
"oid_channel": {"en": "channels", "de": "channels", "ru": "channels"},
"oid_videocodec": {"en": "video_codec", "de": "video_codec", "ru": "video_codec"},
"oid_play": {"en": "play", "de": "play", "ru": "play"},
"oid_speed": {"en": "speed", "de": "speed", "ru": "speed"},
"oid_prev": {"en": "previous", "de": "previous", "ru": "previous"},
"oid_next": {"en": "next", "de": "next", "ru": "next"},
"oid_stop": {"en": "stop", "de": "stop", "ru": "stop"},
"oid_mute": {"en": "mute", "de": "mute", "ru": "mute"},
"oid_rpt": {"en": "repeat", "de": "repeat", "ru": "repeat"},
"oid_shf": {"en": "shuffle", "de": "shuffle", "ru": "shuffle"},
"oid_seek": {"en": "seek", "de": "seek", "ru": "seek"},
"oid_server": {
"en": "IP адрес и порт веб сервера коди. Например: 127.0.0.1:80",
"de": "IP адрес и порт веб сервера коди. Например: 127.0.0.1:80",
"ru": "IP адрес и порт веб сервера коди. Например: 127.0.0.1:80"},
"oid_resolut": {"en": "video_height", "de": "video_height", "ru": "video_height"}
});
}
$.extend(true, systemDictionary, {
"Instance": {"en": "Instance", "de": "Instanz", "ru": "Инстанция"}
});
vis.binds.kodi = {
version: "0.2.2",
showVersion: function () {
if (vis.binds.kodi.version) {
console.log('Version kodi: ' + vis.binds.kodi.version);
vis.binds.kodi.version = null;
}
},
states: {
oid_seek: {val: 0, selector: '', objName: 'oid_seek'},
oid_curtimetotal: {val: undefined, selector: '', objName: 'curtimetotal'}
},
/***********************************************************************/
Thumbnail: function (widgetID, view, data, style) {
var $div = $('#' + widgetID);
var type = null;
// if nothing found => wait
if (!$div.length) {
return setTimeout(function () {
vis.binds.kodi.Thumbnail(widgetID, view, data, style);
}, 100);
}
function Thumb(cover){
var url_thumb;
if (vis.editMode) {
$div.find('li').removeClass().addClass("cover adef").css('backgroundImage', 'url()');
} else {
if (cover && cover !== 'image://DefaultAlbumCover.png/'){
url_thumb = 'http://' + data.oid_server + '/image/' + encodeURI(cover);
$div.find('li').removeClass().addClass("cover").css('backgroundImage', 'url('+url_thumb+')');
} else {
if (type == 'video'){
$div.find('li').removeClass().addClass("cover vdef").css('backgroundImage', 'url()');
} else {
$div.find('li').removeClass().addClass("cover adef").css('backgroundImage', 'url()');
}
}
}
}
// subscribe on updates of value
if (data.oid_thumbnail) {
vis.states.bind(data.oid_thumbnail + '.val', function (e, newVal, oldVal) {
Thumb(newVal);
});
}
if (data.oid_type) {
vis.states.bind(data.oid_type + '.val', function (e, newVal, oldVal) {
type = newVal;
Thumb();
});
}
Thumb(vis.states[data.oid_thumbnail + '.val']);
},
/************************************************************************/
Progress: function (widgetID, view, data, style) {
var $div = $('#' + widgetID);
if (!$div.length) {
return setTimeout(function () {
vis.binds.kodi.Progress(widgetID, view, data, style);
}, 100);
}
$(function(){
$div.progressbar({
value: 0
});
});
$div.on('click', function(e){
var maxWidth = $(this).css("width").slice(0, -2);
//var left = $(this).css("left").slice(0, -2);
var clickPos = e.pageX - this.offsetLeft;
var percentage = clickPos / maxWidth * 100;
vis.setValue(data.oid_seek, percentage);
$div.progressbar("option","value", percentage);
});
// subscribe on updates of value
if (data.oid_seek) {
vis.states.bind(data.oid_seek + '.val', function (e, newVal, oldVal) {
$div.progressbar("value", newVal);
});
}
},
/**************************************************************************/
Button: function (widgetID, view, data, style) {
var $div = $('#' + widgetID);
if (!$div.length) {
return setTimeout(function () {
vis.binds.kodi.Button(widgetID, view, data, style);
}, 100);
}
$("#kodicontrols .prev").on('click',function(){
vis.setValue(data.oid_prev, '');
});
$("#kodicontrols .rewind").on('click',function(){
var seek = vis.states[data.oid_seek + '.val'];
vis.setValue(data.oid_speed, 'decrement');
});
$("#kodicontrols .playpause").on('click',function(){
var speed = vis.states[data.oid_speed + '.val'];
if (speed === 1){
vis.setValue(data.oid_speed, 0);
} else {
vis.setValue(data.oid_speed, 1);
}
});
$("#kodicontrols .stop").on('click',function(){
vis.setValue(data.oid_stop, '');
});
$("#kodicontrols .forward").on('click',function(){
var seek = vis.states[data.oid_seek + '.val'];
vis.setValue(data.oid_speed, 'increment');
});
$("#kodicontrols .next").on('click',function(){
vis.setValue(data.oid_next, '');
});
$("#kodicontrols .repeat").on('click',function(){
var rpt = vis.states[data.oid_rpt + '.val'];
if (rpt === 'off'){
vis.setValue(data.oid_rpt, 'one');
} else if (rpt === 'one'){
vis.setValue(data.oid_rpt, 'all');
} else if (rpt === 'all'){
vis.setValue(data.oid_rpt, 'off');
}
});
$("#kodicontrols .shuffle").on('click',function(){
var shf = vis.states[data.oid_shf + '.val'];
if (shf === false){
vis.setValue(data.oid_shf, true);
} else {
vis.setValue(data.oid_shf, false);
}
});
// subscribe on updates of value
if (data.oid_speed) {
vis.states.bind(data.oid_speed + '.val', function (e, newVal, oldVal) {
var sp = $("#kodicontrols > .playpause");
if (newVal !== 1){
sp.removeClass().addClass('playpause play');
} else {
sp.removeClass().addClass('playpause');
}
});
}
if (data.oid_rpt) {
vis.states.bind(data.oid_rpt + '.val', function (e, newVal, oldVal) {
var r = $("#kodicontrols > .repeat");
if (newVal == 'off'){
r.removeClass();
r.addClass("repeat off");
} else if (newVal == 'one'){
r.removeClass();
r.addClass("repeat one");
} else if (newVal == 'all'){
r.removeClass();
r.addClass("repeat all");
}
});
}
if (data.oid_shf) {
vis.states.bind(data.oid_shf + '.val', function (e, newVal, oldVal) {
var s = $("#kodicontrols > .shuffle");
if (newVal === true || newVal === 'true'){
s.removeClass('off').addClass('on');
} else {
s.removeClass('on').addClass('off');
}
});
}
},
/**************************************************************************/
Playlist: function (widgetID, view, data, style) {
var $div = $('#' + widgetID);
// if nothing found => wait
if (!$div.length) {
return setTimeout(function () {
vis.binds.kodi.Playlist(widgetID, view, data, style);
}, 100);
}
var playlist;
function SetPlaylist(val){
playlist = JSON.parse(val);
var _playlist = {};
if (playlist){
_playlist = playlist;
$div.find("#playListContainer").empty();
_playlist.forEach(function(item, i, arr) {
$div.find("#playListContainer").append("<li class='item"+(i+1)+"'>"+(i+1)+' - '+_playlist[i].label+"</li>");
});
$div.find("#playListContainer .item"+(parseInt(vis.states[data.oid_position + '.val'])+1)).addClass("active");
$div.find('#playListContainer').on('click', "li", function(){
var n=$(this).index();
vis.setValue(data.oid_position, n);
});
} else if (playlist.channels){
_playlist = playlist.channels;
$div.find("#playListContainer").empty();
_playlist.forEach(function(item, i, arr) {
var url = 'http://'+data.oid_server+'/image/' + encodeURI(_playlist[i].thumbnail);
$div.find("#playListContainer").append("<li class='item"+(i+1)+"'><img src='"+url+"' style='width: 50px; height: 50px; vertical-align: middle; margin: 2px;'> "+_playlist[i].label+"</li>");
});
$div.find("#playListContainer .item"+(parseInt(vis.states[data.oid_position + '.val'])+1)).addClass("active");
$div.find('#playListContainer').on('click', "li", function(){
var n=$(this).index()+1;
vis.setValue(data.oid_position, n);
});
}
}
// subscribe on updates of value
if (data.oid_playlist) {
vis.states.bind(data.oid_playlist + '.val', function (e, newVal, oldVal) {
SetPlaylist(newVal);
});
}
if (data.oid_position) {
vis.states.bind(data.oid_position + '.val', function (e, newVal, oldVal) {
$div.find("#playListContainer li").removeClass("active");
newVal = parseInt(newVal);
if (playlist.items){
newVal++;
}
$div.find("#playListContainer .item"+ newVal).addClass("active");
});
}
if ($div.length){
SetPlaylist(vis.states[data.oid_playlist + '.val']);
}
},
/************************************************************************/
CodecInfo: function (widgetID, view, data, style) {
var $div = $('#' + widgetID);
// if nothing found => wait
if (!$div.length) {
return setTimeout(function () {
vis.binds.kodi.CodecInfo(widgetID, view, data, style);
}, 100);
}
function SetCodecInfo(val){
if (val){
$('.kodiinfo > .codec').css('backgroundImage', 'url(./widgets/kodi/img/audio/'+val+'.png)');
}
}
// subscribe on updates of value
if (data.oid_codec) {
vis.states.bind(data.oid_codec + '.val', function (e, newVal, oldVal) {
SetCodecInfo(newVal);
});
}
if (vis.editMode) {
SetCodecInfo('dtshd_ma');
} else {
SetCodecInfo(vis.states[data.oid_codec + '.val']);
}
},
/************************************************************************/
AspectInfo: function (widgetID, view, data, style) {
var $div = $('#' + widgetID);
// if nothing found => wait
if (!$div.length) {
return setTimeout(function () {
vis.binds.kodi.AspectInfo(widgetID, view, data, style);
}, 100);
}
function SetAspectInfo(val){
if (val){
val = parseFloat(val).toFixed(2);
$('.kodiinfo > .aspect').css('backgroundImage', 'url(./widgets/kodi/img/aspectratio/'+val+'.png)');
}
}
// subscribe on updates of value
if (data.oid_aspect) {
vis.states.bind(data.oid_aspect + '.val', function (e, newVal, oldVal) {
SetAspectInfo(newVal);
});
}
if (vis.editMode) {
SetAspectInfo('1.78');
} else {
SetAspectInfo(vis.states[data.oid_aspect + '.val']);
}
},
/************************************************************************/
ResolutInfo: function (widgetID, view, data, style) {
var $div = $('#' + widgetID);
// if nothing found => wait
if (!$div.length) {
return setTimeout(function () {
vis.binds.kodi.ResolutInfo(widgetID, view, data, style);
}, 100);
}
function SetResolutInfo(val){
if (val){
$('.kodiinfo > .resolut').css('backgroundImage', 'url(./widgets/kodi/img/video/'+val+'.png)');
}
}
// subscribe on updates of value
if (data.oid_resolut) {
vis.states.bind(data.oid_resolut + '.val', function (e, newVal, oldVal) {
SetResolutInfo(newVal);
});
}
if (vis.editMode) {
SetResolutInfo('1080');
} else {
SetResolutInfo(vis.states[data.oid_resolut + '.val']);
}
},
/************************************************************************/
ChannelInfo: function (widgetID, view, data, style) {
var $div = $('#' + widgetID);
// if nothing found => wait
if (!$div.length) {
return setTimeout(function () {
vis.binds.kodi.ChannelInfo(widgetID, view, data, style);
}, 100);
}
function SetChannelInfo(val){
if (val){
$('.kodiinfo > .channel').css('backgroundImage', 'url(./widgets/kodi/img/audio/'+val+'.png)');
}
}
// subscribe on updates of value
if (data.oid_channel) {
vis.states.bind(data.oid_channel + '.val', function (e, newVal, oldVal) {
SetChannelInfo(newVal);
});
}
if (vis.editMode) {
SetChannelInfo('6');
} else {
SetChannelInfo(vis.states[data.oid_channel + '.val']);
}
},
/************************************************************************/
VideoCodec: function (widgetID, view, data, style) {
var $div = $('#' + widgetID);
// if nothing found => wait
if (!$div.length) {
return setTimeout(function () {
vis.binds.kodi.VideoCodec(widgetID, view, data, style);
}, 100);
}
function SetVideoCodecInfo(val){
if (val){
$('.kodiinfo > .videocodec').css('backgroundImage', 'url(./widgets/kodi/img/video/'+val+'.png)');
}
}
// subscribe on updates of value
if (data.oid_videocodec) {
vis.states.bind(data.oid_videocodec + '.val', function (e, newVal, oldVal) {
SetVideoCodecInfo(newVal);
});
}
if (vis.editMode) {
SetVideoCodecInfo('vhs');
} else {
SetVideoCodecInfo(vis.states[data.oid_videocodec + '.val']);
}
}
/***********************************************************************/
};
/*if (vis.editMode) {
vis.binds.kodi.changeOid = function (widgetID, view, newId, attr, isCss) {
//console.log('---------: ' + widgetID +' - '+view+' - '+newId+' - '+attr+' - '+isCss);
newId = newId ? newId.substring(0, newId.length - attr.length + 'oid_'.length) : '';
var changed = [];
for (var s in vis.binds.kodi.states) {
if (s === 'oid_curtime' || !vis.binds.kodi.states[s].objName) continue;
if (vis.objects[newId + vis.binds.kodi.states[s].objName]) {
changed.push(s);
vis.views[view].widgets[widgetID].data[s] = newId + vis.binds.kodi.states[s].objName;
vis.widgets[widgetID].data[s] = newId + vis.binds.kodi.states[s].objName;
}
}
return changed;
};
}*/
vis.binds.kodi.showVersion();