mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 10:49:36 +02:00
Improvements
This commit is contained in:
parent
39c19bafe8
commit
d12f285d2b
18 changed files with 19 additions and 5 deletions
|
@ -26,5 +26,19 @@ class LiveChat extends PluginAbstract{
|
||||||
require static::getChatPanelFile();
|
require static::getChatPanelFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getEmptyDataObject() {
|
||||||
|
global $global;
|
||||||
|
$server = parse_url($global['webSiteRootURL']);
|
||||||
|
$obj = new stdClass();
|
||||||
|
$obj->websocket = "ws://{$server['host']}/wss/";
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getWebSocket() {
|
||||||
|
$o = $this->getDataObject();
|
||||||
|
return $o->websocket;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,3 +1,6 @@
|
||||||
|
<?php
|
||||||
|
$p = YouPHPTubePlugin::loadPlugin("LiveChat");
|
||||||
|
?>
|
||||||
<link href="<?php echo $global['webSiteRootURL']; ?>plugin/LiveChat/view/style.css" rel="stylesheet" type="text/css"/>
|
<link href="<?php echo $global['webSiteRootURL']; ?>plugin/LiveChat/view/style.css" rel="stylesheet" type="text/css"/>
|
||||||
<script src="<?php echo $global['webSiteRootURL']; ?>plugin/LiveChat/view/script.js" type="text/javascript"></script>
|
<script src="<?php echo $global['webSiteRootURL']; ?>plugin/LiveChat/view/script.js" type="text/javascript"></script>
|
||||||
<div class="alert alert-warning" id="chatOffline">
|
<div class="alert alert-warning" id="chatOffline">
|
||||||
|
@ -30,9 +33,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
<?php
|
|
||||||
$server = parse_url($global['webSiteRootURL']);
|
|
||||||
?>
|
|
||||||
var attempChatConnections = 3;
|
var attempChatConnections = 3;
|
||||||
var conn;
|
var conn;
|
||||||
function sendJsonMessage(text, message_side) {
|
function sendJsonMessage(text, message_side) {
|
||||||
|
@ -40,8 +40,8 @@ $server = parse_url($global['webSiteRootURL']);
|
||||||
return sendMessage(text, message_side);
|
return sendMessage(text, message_side);
|
||||||
}
|
}
|
||||||
function connect() {
|
function connect() {
|
||||||
console.log('Trying to reconnect on <?php echo $server['host'] ?>');
|
console.log('Trying to reconnect on <?php echo $p->getWebSocket(); ?>');
|
||||||
conn = new WebSocket('wss://<?php echo $server['host'] ?>/wss/');
|
conn = new WebSocket('<?php echo $p->getWebSocket(); ?>');
|
||||||
conn.onopen = function (e) {
|
conn.onopen = function (e) {
|
||||||
console.log("Connection established!");
|
console.log("Connection established!");
|
||||||
attempChatConnections = 3;
|
attempChatConnections = 3;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue