aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRblSb <msrblsb@gmail.com>2021-02-14 06:46:05 +0300
committerRblSb <msrblsb@gmail.com>2021-02-14 06:46:05 +0300
commit600156045aa6f93c79fd57ee4e76d588b3f734e6 (patch)
tree85f1910e202091a2c446e21a4f938214c66b311c
parent5b4d9c6257f7563ef685ab383037906355fbf054 (diff)
Subtitles url input
Can be enabled by plugins
-rw-r--r--build/server.js143
-rw-r--r--res/client.js41
-rw-r--r--res/css/des.css2
-rw-r--r--res/index.html3
-rw-r--r--res/langs/en.json1
-rw-r--r--res/langs/ru.json1
-rw-r--r--src/Types.hx2
-rw-r--r--src/client/Buttons.hx8
-rw-r--r--src/client/JsApi.hx15
-rw-r--r--src/client/Main.hx4
-rw-r--r--src/client/Player.hx1
-rw-r--r--src/client/players/Raw.hx9
12 files changed, 146 insertions, 84 deletions
diff --git a/build/server.js b/build/server.js
index 5555428..de01d18 100644
--- a/build/server.js
+++ b/build/server.js
@@ -621,7 +621,7 @@ JsonParser_$11.prototype = $extend(json2object_reader_BaseParser.prototype,{
this.value.clientName = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos);
break;
case "clients":
- this.value.clients = this.loadObjectField(($_=new JsonParser_$39(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos);
+ this.value.clients = this.loadObjectField(($_=new JsonParser_$41(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos);
break;
case "oldClientName":
this.value.oldClientName = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"oldClientName",assigned,this.value.oldClientName,pos);
@@ -633,7 +633,7 @@ JsonParser_$11.prototype = $extend(json2object_reader_BaseParser.prototype,{
this.objectErrors(assigned,pos);
}
,getAuto: function() {
- return { clientName : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$39([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), oldClientName : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))};
+ return { clientName : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$41([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), oldClientName : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))};
}
,__class__: JsonParser_$11
});
@@ -741,7 +741,7 @@ JsonParser_$17.prototype = $extend(json2object_reader_BaseParser.prototype,{
var field = o[_g];
++_g;
if(field.name == "pos") {
- this.value.pos = this.loadObjectField(($_=new JsonParser_$42(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"pos",assigned,this.value.pos,pos);
+ this.value.pos = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"pos",assigned,this.value.pos,pos);
} else {
this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos)));
}
@@ -749,7 +749,7 @@ JsonParser_$17.prototype = $extend(json2object_reader_BaseParser.prototype,{
this.objectErrors(assigned,pos);
}
,getAuto: function() {
- return { pos : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))};
+ return { pos : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))};
}
,__class__: JsonParser_$17
});
@@ -1027,7 +1027,7 @@ JsonParser_$30.prototype = $extend(json2object_reader_BaseParser.prototype,{
var field = o[_g];
++_g;
if(field.name == "clients") {
- this.value.clients = this.loadObjectField(($_=new JsonParser_$39(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos);
+ this.value.clients = this.loadObjectField(($_=new JsonParser_$41(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos);
} else {
this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos)));
}
@@ -1035,7 +1035,7 @@ JsonParser_$30.prototype = $extend(json2object_reader_BaseParser.prototype,{
this.objectErrors(assigned,pos);
}
,getAuto: function() {
- return { clients : new JsonParser_$39([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))};
+ return { clients : new JsonParser_$41([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))};
}
,__class__: JsonParser_$30
});
@@ -1107,7 +1107,7 @@ JsonParser_$35.__name__ = true;
JsonParser_$35.__super__ = json2object_reader_BaseParser;
JsonParser_$35.prototype = $extend(json2object_reader_BaseParser.prototype,{
onIncorrectType: function(pos,variable) {
- this.errors.push(json2object_Error.IncorrectType(variable,"{ url : String, title : String, isTemp : Bool, isIframe : Bool, duration : Float, author : String }",pos));
+ this.errors.push(json2object_Error.IncorrectType(variable,"{ url : String, title : String, ?subs : Null<String>, isTemp : Bool, isIframe : Bool, duration : Float, author : String }",pos));
json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable);
}
,loadJsonNull: function(pos,variable) {
@@ -1115,7 +1115,7 @@ JsonParser_$35.prototype = $extend(json2object_reader_BaseParser.prototype,{
}
,loadJsonObject: function(o,pos,variable) {
var assigned = new haxe_ds_StringMap();
- this.objectSetupAssign(assigned,["author","duration","isIframe","isTemp","title","url"],[false,false,false,false,false,false]);
+ this.objectSetupAssign(assigned,["author","duration","isIframe","isTemp","subs","title","url"],[false,false,false,false,true,false,false]);
this.value = this.getAuto();
var _g = 0;
while(_g < o.length) {
@@ -1134,6 +1134,9 @@ JsonParser_$35.prototype = $extend(json2object_reader_BaseParser.prototype,{
case "isTemp":
this.value.isTemp = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isTemp",assigned,this.value.isTemp,pos);
break;
+ case "subs":
+ this.value.subs = this.loadObjectField(($_=new JsonParser_$40(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"subs",assigned,this.value.subs,pos);
+ break;
case "title":
this.value.title = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"title",assigned,this.value.title,pos);
break;
@@ -1147,7 +1150,7 @@ JsonParser_$35.prototype = $extend(json2object_reader_BaseParser.prototype,{
this.objectErrors(assigned,pos);
}
,getAuto: function() {
- return { author : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), duration : new JsonParser_$37([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isIframe : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isTemp : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), title : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), url : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))};
+ return { author : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), duration : new JsonParser_$37([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isIframe : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isTemp : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), subs : new JsonParser_$40([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), title : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), url : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))};
}
,__class__: JsonParser_$35
});
@@ -1210,26 +1213,26 @@ JsonParser_$38.prototype = $extend(json2object_reader_BaseParser.prototype,{
}
,__class__: JsonParser_$38
});
-var JsonParser_$39 = function(errors,putils,errorType) {
+var JsonParser_$40 = function(errors,putils,errorType) {
if(errorType == null) {
errorType = 0;
}
json2object_reader_BaseParser.call(this,errors,putils,errorType);
};
-JsonParser_$39.__name__ = true;
-JsonParser_$39.__super__ = json2object_reader_BaseParser;
-JsonParser_$39.prototype = $extend(json2object_reader_BaseParser.prototype,{
+JsonParser_$40.__name__ = true;
+JsonParser_$40.__super__ = json2object_reader_BaseParser;
+JsonParser_$40.prototype = $extend(json2object_reader_BaseParser.prototype,{
onIncorrectType: function(pos,variable) {
- this.errors.push(json2object_Error.IncorrectType(variable,"Array<ClientData>",pos));
+ this.errors.push(json2object_Error.IncorrectType(variable,"String",pos));
json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable);
}
,loadJsonNull: function(pos,variable) {
this.value = null;
}
- ,loadJsonArray: function(a,pos,variable) {
- this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$41(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable);
+ ,loadJsonString: function(s,pos,variable) {
+ this.value = s;
}
- ,__class__: JsonParser_$39
+ ,__class__: JsonParser_$40
});
var JsonParser_$41 = function(errors,putils,errorType) {
if(errorType == null) {
@@ -1241,6 +1244,27 @@ JsonParser_$41.__name__ = true;
JsonParser_$41.__super__ = json2object_reader_BaseParser;
JsonParser_$41.prototype = $extend(json2object_reader_BaseParser.prototype,{
onIncorrectType: function(pos,variable) {
+ this.errors.push(json2object_Error.IncorrectType(variable,"Array<ClientData>",pos));
+ json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable);
+ }
+ ,loadJsonNull: function(pos,variable) {
+ this.value = null;
+ }
+ ,loadJsonArray: function(a,pos,variable) {
+ this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$43(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable);
+ }
+ ,__class__: JsonParser_$41
+});
+var JsonParser_$43 = function(errors,putils,errorType) {
+ if(errorType == null) {
+ errorType = 0;
+ }
+ json2object_reader_BaseParser.call(this,errors,putils,errorType);
+};
+JsonParser_$43.__name__ = true;
+JsonParser_$43.__super__ = json2object_reader_BaseParser;
+JsonParser_$43.prototype = $extend(json2object_reader_BaseParser.prototype,{
+ onIncorrectType: function(pos,variable) {
this.errors.push(json2object_Error.IncorrectType(variable,"{ name : String, group : Int }",pos));
json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable);
}
@@ -1257,7 +1281,7 @@ JsonParser_$41.prototype = $extend(json2object_reader_BaseParser.prototype,{
++_g;
switch(field.name) {
case "group":
- this.value.group = this.loadObjectField(($_=new JsonParser_$42(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"group",assigned,this.value.group,pos);
+ this.value.group = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"group",assigned,this.value.group,pos);
break;
case "name":
this.value.name = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos);
@@ -1269,47 +1293,26 @@ JsonParser_$41.prototype = $extend(json2object_reader_BaseParser.prototype,{
this.objectErrors(assigned,pos);
}
,getAuto: function() {
- return { group : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), name : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))};
+ return { group : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), name : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))};
}
- ,__class__: JsonParser_$41
-});
-var JsonParser_$42 = function(errors,putils,errorType) {
- if(errorType == null) {
- errorType = 0;
- }
- json2object_reader_BaseParser.call(this,errors,putils,errorType);
- this.value = 0;
-};
-JsonParser_$42.__name__ = true;
-JsonParser_$42.__super__ = json2object_reader_BaseParser;
-JsonParser_$42.prototype = $extend(json2object_reader_BaseParser.prototype,{
- onIncorrectType: function(pos,variable) {
- this.errors.push(json2object_Error.IncorrectType(variable,"Int",pos));
- json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable);
- }
- ,loadJsonNumber: function(f,pos,variable) {
- this.value = this.loadJsonInt(f,pos,variable,this.value);
- }
- ,__class__: JsonParser_$42
+ ,__class__: JsonParser_$43
});
var JsonParser_$44 = function(errors,putils,errorType) {
if(errorType == null) {
errorType = 0;
}
json2object_reader_BaseParser.call(this,errors,putils,errorType);
+ this.value = 0;
};
JsonParser_$44.__name__ = true;
JsonParser_$44.__super__ = json2object_reader_BaseParser;
JsonParser_$44.prototype = $extend(json2object_reader_BaseParser.prototype,{
onIncorrectType: function(pos,variable) {
- this.errors.push(json2object_Error.IncorrectType(variable,"Array<ClientData>",pos));
+ this.errors.push(json2object_Error.IncorrectType(variable,"Int",pos));
json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable);
}
- ,loadJsonNull: function(pos,variable) {
- this.value = null;
- }
- ,loadJsonArray: function(a,pos,variable) {
- this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$41(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable);
+ ,loadJsonNumber: function(f,pos,variable) {
+ this.value = this.loadJsonInt(f,pos,variable,this.value);
}
,__class__: JsonParser_$44
});
@@ -1323,14 +1326,14 @@ JsonParser_$46.__name__ = true;
JsonParser_$46.__super__ = json2object_reader_BaseParser;
JsonParser_$46.prototype = $extend(json2object_reader_BaseParser.prototype,{
onIncorrectType: function(pos,variable) {
- this.errors.push(json2object_Error.IncorrectType(variable,"Bool",pos));
+ this.errors.push(json2object_Error.IncorrectType(variable,"Array<ClientData>",pos));
json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable);
}
,loadJsonNull: function(pos,variable) {
this.value = null;
}
- ,loadJsonBool: function(b,pos,variable) {
- this.value = b;
+ ,loadJsonArray: function(a,pos,variable) {
+ this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$43(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable);
}
,__class__: JsonParser_$46
});
@@ -1344,14 +1347,14 @@ JsonParser_$48.__name__ = true;
JsonParser_$48.__super__ = json2object_reader_BaseParser;
JsonParser_$48.prototype = $extend(json2object_reader_BaseParser.prototype,{
onIncorrectType: function(pos,variable) {
- this.errors.push(json2object_Error.IncorrectType(variable,"String",pos));
+ this.errors.push(json2object_Error.IncorrectType(variable,"Bool",pos));
json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable);
}
,loadJsonNull: function(pos,variable) {
this.value = null;
}
- ,loadJsonString: function(s,pos,variable) {
- this.value = s;
+ ,loadJsonBool: function(b,pos,variable) {
+ this.value = b;
}
,__class__: JsonParser_$48
});
@@ -1384,7 +1387,7 @@ JsonParser_$5.prototype = $extend(json2object_reader_BaseParser.prototype,{
this.value.clientName = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos);
break;
case "clients":
- this.value.clients = this.loadObjectField(($_=new JsonParser_$39(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos);
+ this.value.clients = this.loadObjectField(($_=new JsonParser_$41(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos);
break;
case "config":
this.value.config = this.loadObjectField(($_=new JsonParser_$52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"config",assigned,this.value.config,pos);
@@ -1402,7 +1405,7 @@ JsonParser_$5.prototype = $extend(json2object_reader_BaseParser.prototype,{
this.value.isUnknownClient = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isUnknownClient",assigned,this.value.isUnknownClient,pos);
break;
case "itemPos":
- this.value.itemPos = this.loadObjectField(($_=new JsonParser_$42(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"itemPos",assigned,this.value.itemPos,pos);
+ this.value.itemPos = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"itemPos",assigned,this.value.itemPos,pos);
break;
case "videoList":
this.value.videoList = this.loadObjectField(($_=new JsonParser_$33(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"videoList",assigned,this.value.videoList,pos);
@@ -1414,7 +1417,7 @@ JsonParser_$5.prototype = $extend(json2object_reader_BaseParser.prototype,{
this.objectErrors(assigned,pos);
}
,getAuto: function() {
- return { clientName : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$39([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), config : new JsonParser_$52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), globalIp : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), history : new JsonParser_$53([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isPlaylistOpen : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isUnknownClient : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), itemPos : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), videoList : new JsonParser_$33([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))};
+ return { clientName : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$41([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), config : new JsonParser_$52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), globalIp : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), history : new JsonParser_$53([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isPlaylistOpen : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isUnknownClient : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), itemPos : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), videoList : new JsonParser_$33([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))};
}
,__class__: JsonParser_$5
});
@@ -1474,46 +1477,46 @@ JsonParser_$52.prototype = $extend(json2object_reader_BaseParser.prototype,{
this.value.filters = this.loadObjectField(($_=new JsonParser_$57(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"filters",assigned,this.value.filters,pos);
break;
case "isVerbose":
- this.value.isVerbose = this.loadObjectField(($_=new JsonParser_$46(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isVerbose",assigned,this.value.isVerbose,pos);
+ this.value.isVerbose = this.loadObjectField(($_=new JsonParser_$48(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isVerbose",assigned,this.value.isVerbose,pos);
break;
case "localAdmins":
this.value.localAdmins = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"localAdmins",assigned,this.value.localAdmins,pos);
break;
case "maxLoginLength":
- this.value.maxLoginLength = this.loadObjectField(($_=new JsonParser_$42(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"maxLoginLength",assigned,this.value.maxLoginLength,pos);
+ this.value.maxLoginLength = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"maxLoginLength",assigned,this.value.maxLoginLength,pos);
break;
case "maxMessageLength":
- this.value.maxMessageLength = this.loadObjectField(($_=new JsonParser_$42(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"maxMessageLength",assigned,this.value.maxMessageLength,pos);
+ this.value.maxMessageLength = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"maxMessageLength",assigned,this.value.maxMessageLength,pos);
break;
case "permissions":
this.value.permissions = this.loadObjectField(($_=new JsonParser_$59(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"permissions",assigned,this.value.permissions,pos);
break;
case "port":
- this.value.port = this.loadObjectField(($_=new JsonParser_$42(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"port",assigned,this.value.port,pos);
+ this.value.port = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"port",assigned,this.value.port,pos);
break;
case "requestLeaderOnPause":
this.value.requestLeaderOnPause = this.loadObjectField(($_=new JsonParser_$38(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"requestLeaderOnPause",assigned,this.value.requestLeaderOnPause,pos);
break;
case "salt":
- this.value.salt = this.loadObjectField(($_=new JsonParser_$48(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"salt",assigned,this.value.salt,pos);
+ this.value.salt = this.loadObjectField(($_=new JsonParser_$40(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"salt",assigned,this.value.salt,pos);
break;
case "serverChatHistory":
- this.value.serverChatHistory = this.loadObjectField(($_=new JsonParser_$42(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"serverChatHistory",assigned,this.value.serverChatHistory,pos);
+ this.value.serverChatHistory = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"serverChatHistory",assigned,this.value.serverChatHistory,pos);
break;
case "templateUrl":
this.value.templateUrl = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"templateUrl",assigned,this.value.templateUrl,pos);
break;
case "totalVideoLimit":
- this.value.totalVideoLimit = this.loadObjectField(($_=new JsonParser_$42(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"totalVideoLimit",assigned,this.value.totalVideoLimit,pos);
+ this.value.totalVideoLimit = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"totalVideoLimit",assigned,this.value.totalVideoLimit,pos);
break;
case "userVideoLimit":
- this.value.userVideoLimit = this.loadObjectField(($_=new JsonParser_$42(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"userVideoLimit",assigned,this.value.userVideoLimit,pos);
+ this.value.userVideoLimit = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"userVideoLimit",assigned,this.value.userVideoLimit,pos);
break;
case "youtubeApiKey":
this.value.youtubeApiKey = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"youtubeApiKey",assigned,this.value.youtubeApiKey,pos);
break;
case "youtubePlaylistLimit":
- this.value.youtubePlaylistLimit = this.loadObjectField(($_=new JsonParser_$42(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"youtubePlaylistLimit",assigned,this.value.youtubePlaylistLimit,pos);
+ this.value.youtubePlaylistLimit = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"youtubePlaylistLimit",assigned,this.value.youtubePlaylistLimit,pos);
break;
default:
this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos)));
@@ -1522,7 +1525,7 @@ JsonParser_$52.prototype = $extend(json2object_reader_BaseParser.prototype,{
this.objectErrors(assigned,pos);
}
,getAuto: function() {
- return { channelName : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), emotes : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), filters : new JsonParser_$57([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isVerbose : new JsonParser_$46([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), localAdmins : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxLoginLength : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxMessageLength : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), permissions : new JsonParser_$59([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), port : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), requestLeaderOnPause : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), salt : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), serverChatHistory : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), templateUrl : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), totalVideoLimit : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), userVideoLimit : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubeApiKey : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubePlaylistLimit : new JsonParser_$42([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))};
+ return { channelName : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), emotes : new JsonParser_$56([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), filters : new JsonParser_$57([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isVerbose : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), localAdmins : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxLoginLength : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxMessageLength : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), permissions : new JsonParser_$59([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), port : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), requestLeaderOnPause : new JsonParser_$38([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), salt : new JsonParser_$40([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), serverChatHistory : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), templateUrl : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), totalVideoLimit : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), userVideoLimit : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubeApiKey : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubePlaylistLimit : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))};
}
,__class__: JsonParser_$52
});
@@ -1841,7 +1844,7 @@ JsonParser_$7.prototype = $extend(json2object_reader_BaseParser.prototype,{
++_g;
switch(field.name) {
case "paused":
- this.value.paused = this.loadObjectField(($_=new JsonParser_$46(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"paused",assigned,this.value.paused,pos);
+ this.value.paused = this.loadObjectField(($_=new JsonParser_$48(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"paused",assigned,this.value.paused,pos);
break;
case "rate":
this.value.rate = this.loadObjectField(($_=new JsonParser_$50(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"rate",assigned,this.value.rate,pos);
@@ -1856,7 +1859,7 @@ JsonParser_$7.prototype = $extend(json2object_reader_BaseParser.prototype,{
this.objectErrors(assigned,pos);
}
,getAuto: function() {
- return { paused : new JsonParser_$46([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), rate : new JsonParser_$50([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), time : new JsonParser_$37([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))};
+ return { paused : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), rate : new JsonParser_$50([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), time : new JsonParser_$37([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))};
}
,__class__: JsonParser_$7
});
@@ -1889,13 +1892,13 @@ JsonParser_$9.prototype = $extend(json2object_reader_BaseParser.prototype,{
this.value.clientName = this.loadObjectField(($_=new JsonParser_$36(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos);
break;
case "clients":
- this.value.clients = this.loadObjectField(($_=new JsonParser_$44(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos);
+ this.value.clients = this.loadObjectField(($_=new JsonParser_$46(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos);
break;
case "isUnknownClient":
- this.value.isUnknownClient = this.loadObjectField(($_=new JsonParser_$46(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isUnknownClient",assigned,this.value.isUnknownClient,pos);
+ this.value.isUnknownClient = this.loadObjectField(($_=new JsonParser_$48(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isUnknownClient",assigned,this.value.isUnknownClient,pos);
break;
case "passHash":
- this.value.passHash = this.loadObjectField(($_=new JsonParser_$48(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"passHash",assigned,this.value.passHash,pos);
+ this.value.passHash = this.loadObjectField(($_=new JsonParser_$40(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"passHash",assigned,this.value.passHash,pos);
break;
default:
this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos)));
@@ -1904,7 +1907,7 @@ JsonParser_$9.prototype = $extend(json2object_reader_BaseParser.prototype,{
this.objectErrors(assigned,pos);
}
,getAuto: function() {
- return { clientName : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$44([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isUnknownClient : new JsonParser_$46([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), passHash : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))};
+ return { clientName : new JsonParser_$36([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$46([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isUnknownClient : new JsonParser_$48([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), passHash : new JsonParser_$40([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))};
}
,__class__: JsonParser_$9
});
diff --git a/res/client.js b/res/client.js
index a40cdd8..b07e727 100644
--- a/res/client.js
+++ b/res/client.js
@@ -610,10 +610,10 @@ client_Buttons.init = function(main) {
var mediaUrl = window.document.querySelector("#mediaurl");
mediaUrl.oninput = function() {
var value = mediaUrl.value;
- if(value != "" && main.isRawPlayerLink(value) && main.isSingleVideoLink(value)) {
- return window.document.querySelector("#mediatitleblock").style.display = "";
- } else {
- return window.document.querySelector("#mediatitleblock").style.display = "none";
+ var isRawSingleVideo = value != "" && main.isRawPlayerLink(value) && main.isSingleVideoLink(value);
+ window.document.querySelector("#mediatitleblock").style.display = isRawSingleVideo ? "" : "none";
+ if(client_JsApi.hasSubtitleSupport()) {
+ window.document.querySelector("#subsurlblock").style.display = isRawSingleVideo ? "" : "none";
}
};
mediaUrl.onfocus = mediaUrl.oninput;
@@ -951,6 +951,19 @@ client_JsApi.getLocalIp = $hx_exports["client"]["JsApi"]["getLocalIp"] = functio
client_JsApi.getGlobalIp = $hx_exports["client"]["JsApi"]["getGlobalIp"] = function() {
return client_JsApi.main.globalIp;
};
+client_JsApi.addSubtitleSupport = $hx_exports["client"]["JsApi"]["addSubtitleSupport"] = function(format) {
+ format = StringTools.trim(format).toLowerCase();
+ if(client_JsApi.subtitleFormats.indexOf(format) != -1) {
+ return;
+ }
+ client_JsApi.subtitleFormats.push(format);
+};
+client_JsApi.hasSubtitleSupport = $hx_exports["client"]["JsApi"]["hasSubtitleSupport"] = function(format) {
+ if(format == null) {
+ return client_JsApi.subtitleFormats.length > 0;
+ }
+ return client_JsApi.subtitleFormats.indexOf(format) != -1;
+};
client_JsApi.once = $hx_exports["client"]["JsApi"]["once"] = function(type,func) {
client_JsApi.onceListeners.push({ type : type, func : func});
};
@@ -1104,6 +1117,11 @@ client_Main.prototype = {
_gthis.addVideoUrl(true);
}
};
+ window.document.querySelector("#subsurl").onkeydown = function(e) {
+ if(e.keyCode == 13) {
+ _gthis.addVideoUrl(true);
+ }
+ };
window.document.querySelector("#ce_queue_next").onclick = function(e) {
_gthis.addIframe(false);
};
@@ -1213,7 +1231,7 @@ client_Main.prototype = {
if(data.url == null) {
data.url = url;
}
- _gthis.send({ type : "AddVideo", addVideo : { item : { url : data.url, title : data.title, author : _gthis.personal.name, duration : data.duration, isTemp : isTemp, isIframe : data.isIframe == true}, atEnd : atEnd}});
+ _gthis.send({ type : "AddVideo", addVideo : { item : { url : data.url, title : data.title, author : _gthis.personal.name, duration : data.duration, isTemp : isTemp, subs : data.subs, isIframe : data.isIframe == true}, atEnd : atEnd}});
callback();
});
}
@@ -1277,7 +1295,7 @@ client_Main.prototype = {
var data = JSON.parse(e.data);
if(this.config != null && this.config.isVerbose) {
var t = data.type;
- haxe_Log.trace("Event: " + data.type,{ fileName : "src/client/Main.hx", lineNumber : 348, className : "client.Main", methodName : "onMessage", customParams : [Reflect.field(data,t.charAt(0).toLowerCase() + HxOverrides.substr(t,1,null))]});
+ haxe_Log.trace("Event: " + data.type,{ fileName : "src/client/Main.hx", lineNumber : 352, className : "client.Main", methodName : "onMessage", customParams : [Reflect.field(data,t.charAt(0).toLowerCase() + HxOverrides.substr(t,1,null))]});
}
client_JsApi.fireOnceEvent(data);
switch(data.type) {
@@ -1954,7 +1972,7 @@ client_Player.prototype = {
if(item == null) {
return;
}
- this.player.loadVideo({ url : src, title : item.title, author : item.author, duration : item.duration, isTemp : item.isTemp, isIframe : item.isIframe});
+ this.player.loadVideo({ url : src, title : item.title, author : item.author, duration : item.duration, subs : item.subs, isTemp : item.isTemp, isIframe : item.isIframe});
}
,removeVideo: function() {
client_JsApi.fireVideoRemoveEvents(this.items[this.itemPos]);
@@ -2452,6 +2470,7 @@ var client_players_Raw = function(main,player) {
this.isHlsLoaded = false;
this.playAllowed = true;
this.matchName = new EReg("^(.+)\\.(.+)","");
+ this.subsInput = window.document.querySelector("#subsurl");
this.titleInput = window.document.querySelector("#mediatitle");
this.playerEl = window.document.querySelector("#ytapiplayer");
this.main = main;
@@ -2489,6 +2508,11 @@ client_players_Raw.prototype = {
return;
}
this.titleInput.value = "";
+ var subs = "";
+ if(client_JsApi.hasSubtitleSupport()) {
+ subs = StringTools.trim(this.subsInput.value);
+ this.subsInput.value = "";
+ }
var video = window.document.createElement("video");
video.src = url;
video.onerror = function(e) {
@@ -2501,7 +2525,7 @@ client_players_Raw.prototype = {
if(_gthis.playerEl.contains(video)) {
_gthis.playerEl.removeChild(video);
}
- callback({ duration : video.duration, title : title});
+ callback({ duration : video.duration, title : title, subs : subs});
};
client_Utils.prepend(this.playerEl,video);
if(isHls) {
@@ -3565,6 +3589,7 @@ js_Boot.__toStr = ({ }).toString;
Lang.langs = new haxe_ds_StringMap();
Lang.ids = ["en","ru"];
Lang.lang = HxOverrides.substr($global.navigator.language,0,2).toLowerCase();
+client_JsApi.subtitleFormats = [];
client_JsApi.videoChange = [];
client_JsApi.videoRemove = [];
client_JsApi.onceListeners = [];
diff --git a/res/css/des.css b/res/css/des.css
index 8788bdd..6877c81 100644
--- a/res/css/des.css
+++ b/res/css/des.css
@@ -375,7 +375,7 @@ header h4 {
margin-bottom: 1rem;
}
-#mediatitle {
+#mediatitle, #subsurl {
margin-left: 2rem;
flex-grow: 1;
}
diff --git a/res/index.html b/res/index.html
index 753a9a5..c7673b1 100644
--- a/res/index.html
+++ b/res/index.html
@@ -64,6 +64,9 @@
<div id="mediatitleblock" class="display-flex" style="display: none;">
<input id="mediatitle" type="text" placeholder="${optionalTitle}">
</div>
+ <div id="subsurlblock" class="display-flex" style="display: none;">
+ <input id="subsurl" type="text" placeholder="${subtitlesUrlOptional}">
+ </div>
<div>
<button id="queue_next">${queueNext}</button>
<button id="queue_end">${queueLast}</button>
diff --git a/res/langs/en.json b/res/langs/en.json
index 26dbf24..e8a9680 100644
--- a/res/langs/en.json
+++ b/res/langs/en.json
@@ -65,6 +65,7 @@
"addAsTemporary": "Add as temporary",
"mediaUrl": "Media URL",
"optionalTitle": "Title (optional)",
+ "subtitlesUrlOptional": "Subtitles URL (optional)",
"addTemplateUrl": "Add template URL",
"queueNext": "Queue next",
"queueLast": "Queue last",
diff --git a/res/langs/ru.json b/res/langs/ru.json
index 70d9917..24f5d34 100644
--- a/res/langs/ru.json
+++ b/res/langs/ru.json
@@ -65,6 +65,7 @@
"addAsTemporary": "Добавить как временный",
"mediaUrl": "Ссылка на видео",
"optionalTitle": "Заголовок (необязательно)",
+ "subtitlesUrlOptional": "Ссылка на субтитры (необязательно)",
"addTemplateUrl": "Добавить пример ссылки",
"queueNext": "След.",
"queueLast": "В конец",
diff --git a/src/Types.hx b/src/Types.hx
index 02a2cee..519ac76 100644
--- a/src/Types.hx
+++ b/src/Types.hx
@@ -11,6 +11,7 @@ typedef VideoData = {
duration:Float,
?title:String,
?url:String,
+ ?subs:String,
?isIframe:Bool
}
@@ -90,6 +91,7 @@ typedef VideoItem = {
title:String,
author:String,
duration:Float,
+ ?subs:String,
isTemp:Bool,
isIframe:Bool
}
diff --git a/src/client/Buttons.hx b/src/client/Buttons.hx
index 538aaa0..8ed259a 100644
--- a/src/client/Buttons.hx
+++ b/src/client/Buttons.hx
@@ -154,10 +154,10 @@ class Buttons {
final mediaUrl:InputElement = cast ge("#mediaurl");
mediaUrl.oninput = () -> {
final value = mediaUrl.value;
- if (value != "" && main.isRawPlayerLink(value) && main.isSingleVideoLink(value)) {
- ge("#mediatitleblock").style.display = "";
- } else {
- ge("#mediatitleblock").style.display = "none";
+ final isRawSingleVideo = value != "" && main.isRawPlayerLink(value) && main.isSingleVideoLink(value);
+ ge("#mediatitleblock").style.display = isRawSingleVideo ? "" : "none";
+ if (JsApi.hasSubtitleSupport()) {
+ ge("#subsurlblock").style.display = isRawSingleVideo ? "" : "none";
}
}
mediaUrl.onfocus = mediaUrl.oninput;
diff --git a/src/client/JsApi.hx b/src/client/JsApi.hx
index b0938f8..b97c0f0 100644
--- a/src/client/JsApi.hx
+++ b/src/client/JsApi.hx
@@ -6,6 +6,7 @@ import Types.VideoItem;
import js.Browser.document;
import js.Browser.window;
import js.Syntax;
+using StringTools;
private typedef VideoChangeFunc = (item:VideoItem)->Void;
private typedef OnceEventFunc = (event:WsEvent)->Void;
@@ -14,6 +15,7 @@ class JsApi {
static var main:Main;
static var player:Player;
+ static final subtitleFormats = [];
static final videoChange:Array<VideoChangeFunc> = [];
static final videoRemove:Array<VideoChangeFunc> = [];
static final onceListeners:Array<{type:WsEventType, func:OnceEventFunc}> = [];
@@ -101,6 +103,19 @@ class JsApi {
}
@:expose
+ static function addSubtitleSupport(format:String):Void {
+ format = format.trim().toLowerCase();
+ if (subtitleFormats.contains(format)) return;
+ subtitleFormats.push(format);
+ }
+
+ @:expose
+ public static function hasSubtitleSupport(?format:String):Bool {
+ if (format == null) return subtitleFormats.length > 0;
+ return subtitleFormats.contains(format);
+ }
+
+ @:expose
public static function once(type:WsEventType, func:OnceEventFunc):Void {
onceListeners.push({type: type, func: func});
}
diff --git a/src/client/Main.hx b/src/client/Main.hx
index 78b3504..b9c9892 100644
--- a/src/client/Main.hx
+++ b/src/client/Main.hx
@@ -150,6 +150,9 @@ class Main {
ge("#mediatitle").onkeydown = (e:KeyboardEvent) -> {
if (e.keyCode == KeyCode.Return) addVideoUrl(true);
}
+ ge("#subsurl").onkeydown = (e:KeyboardEvent) -> {
+ if (e.keyCode == KeyCode.Return) addVideoUrl(true);
+ }
ge("#ce_queue_next").onclick = e -> addIframe(false);
ge("#ce_queue_end").onclick = e -> addIframe(true);
@@ -267,6 +270,7 @@ class Main {
author: personal.name,
duration: data.duration,
isTemp: isTemp,
+ subs: data.subs,
isIframe: data.isIframe == true
},
atEnd: atEnd
diff --git a/src/client/Player.hx b/src/client/Player.hx
index 9ee3ead..735f73c 100644
--- a/src/client/Player.hx
+++ b/src/client/Player.hx
@@ -142,6 +142,7 @@ class Player {
title: item.title,
author: item.author,
duration: item.duration,
+ subs: item.subs,
isTemp: item.isTemp,
isIframe: item.isIframe
});
diff --git a/src/client/players/Raw.hx b/src/client/players/Raw.hx
index 2b1530d..cafe147 100644
--- a/src/client/players/Raw.hx
+++ b/src/client/players/Raw.hx
@@ -18,6 +18,7 @@ class Raw implements IPlayer {
final player:Player;
final playerEl:Element = ge("#ytapiplayer");
final titleInput:InputElement = cast ge("#mediatitle");
+ final subsInput:InputElement = cast ge("#subsurl");
final matchName = ~/^(.+)\.(.+)/;
var controlsHider:Timer;
var playAllowed = true;
@@ -53,6 +54,11 @@ class Raw implements IPlayer {
}
titleInput.value = "";
+ var subs = "";
+ if (JsApi.hasSubtitleSupport()) {
+ subs = subsInput.value.trim();
+ subsInput.value = "";
+ }
final video = document.createVideoElement();
video.src = url;
video.onerror = e -> {
@@ -63,7 +69,8 @@ class Raw implements IPlayer {
if (playerEl.contains(video)) playerEl.removeChild(video);
callback({
duration: video.duration,
- title: title
+ title: title,
+ subs: subs
});
}
Utils.prepend(playerEl, video);
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage