From ec15079f99724cc0ad40f550687fcca2735c9afc Mon Sep 17 00:00:00 2001 From: RblSb Date: Fri, 24 Apr 2020 20:37:43 +0300 Subject: External api test --- res/client.js | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'res') diff --git a/res/client.js b/res/client.js index 89d0d81..186f01e 100644 --- a/res/client.js +++ b/res/client.js @@ -1,5 +1,7 @@ // Generated by Haxe 4.0.5 -(function ($global) { "use strict"; +(function ($hx_exports, $global) { "use strict"; +$hx_exports["client"] = $hx_exports["client"] || {}; +$hx_exports["client"]["JsApi"] = $hx_exports["client"]["JsApi"] || {}; var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; function $extend(from, fields) { var proto = Object.create(from); @@ -844,6 +846,37 @@ client_InputWithHistory.prototype = { } } }; +var client_JsApi = function() { }; +client_JsApi.__name__ = true; +client_JsApi.addPlugin = $hx_exports["client"]["JsApi"]["addPlugin"] = function(id,onLoaded) { + client_JsApi.addScriptToHead("/plugins/" + id + "/index.js",onLoaded); +}; +client_JsApi.addScriptToHead = $hx_exports["client"]["JsApi"]["addScriptToHead"] = function(url,onLoaded) { + var script = window.document.createElement("script"); + script.type = "text/javascript"; + script.onload = onLoaded; + script.src = url; + window.document.getElementsByTagName("head")[0].appendChild(script); +}; +client_JsApi.hasScriptInHead = $hx_exports["client"]["JsApi"]["hasScriptInHead"] = function(url) { + var _g = 0; + var _g1 = window.document.getElementsByTagName("head")[0].children; + while(_g < _g1.length) if(_g1[_g++].src == url) { + return true; + } + return false; +}; +client_JsApi.notifyOnVideoChange = $hx_exports["client"]["JsApi"]["notifyOnVideoChange"] = function(func) { + client_JsApi.videoChange.push(func); +}; +client_JsApi.removeFromVideoChange = $hx_exports["client"]["JsApi"]["removeFromVideoChange"] = function(func) { + HxOverrides.remove(client_JsApi.videoChange,func); +}; +client_JsApi.fireVideoChangeEvents = function(item) { + var _g = 0; + var _g1 = client_JsApi.videoChange; + while(_g < _g1.length) _g1[_g++](item); +}; var client_Main = function(host,port) { this.matchNumbers = new EReg("^-?[0-9]+$",""); this.mask = new EReg("\\${([0-9]+)-([0-9]+)}","g"); @@ -1685,6 +1718,7 @@ client_Player.prototype = { this.currentSrc = item.url; this.isLoaded = false; this.player.loadVideo(item); + client_JsApi.fireVideoChangeEvents(item); window.document.querySelector("#currenttitle").textContent = item.title; } ,removeVideo: function() { @@ -3135,7 +3169,8 @@ js_Boot.__toStr = ({ }).toString; Lang.langs = new haxe_ds_StringMap(); Lang.ids = ["en","ru"]; Lang.lang = HxOverrides.substr(window.navigator.language,0,2).toLowerCase(); +client_JsApi.videoChange = []; client_Settings.isSupported = false; js_youtube_Youtube.isLoadedAPI = false; client_Main.main(); -})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +})(typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this, typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); -- cgit v1.2.3