Skip to content
Snippets Groups Projects
Commit 461b0862 authored by ands's avatar ands
Browse files

Added Jukezone widget

parent b94907d7
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@
array("Wettervorhersage", "widget_light", 3,1, 1,2),
array("TwitterWall", "widget_light", 4,1, 2,4),
array("Prepaid", "widget_light", 0,3, 2,3),
array("Dummy", "widget_dark", 2,3, 2,2),
array("Jukezone", "widget_dark", 2,3, 2,2),
array("Dummy", "widget_light", 2,5, 2,1),
array("Marvin", "widget_light", 4,5, 2,1)
);
......
......@@ -10,6 +10,82 @@
color:#ffffff;
cursor:default;
}
.widget_dark .invisiblebox {
font-family: inherit;
margin: 10;
padding: 0;
cursor:default;
}
.widget_dark .table {
border: 1px dashed #F2EFE5;
background-color:#261C13;
font-family: inherit;
margin: 0;
padding: 2;
cursor:default;
}
.widget_dark .box {
background-color:#261C13;
border: 1px dashed #F2EFE5;
font-family: inherit;
color:#ffffff;
margin: 10;
position:relative;
cursor:default;
}
.widget_dark h1 {
margin-top: 10;
margin-left: 10;
margin-bottom: 0;
padding: 0;
font-family: inherit;
font-size: 1.0em;
cursor:default;
}
.widget_dark h2 {
margin: 0;
padding: 0;
font-family: inherit;
font-size: 0.8em;
color: #dddddd;
cursor:default;
}
.widget_dark h3 {
margin: 0;
padding: 0;
font-family: inherit;
font-size: 0.6em;
color: #bbbbbb;
cursor:default;
}
.widget_dark ul {
background-color:#261C13;
margin: 0;
padding: 0;
list-style: none;
overflow:hidden;
position:relative;
height:auto;
cursor:default;
}
.widget_dark li {
background-color:#261C13;
float: left;
border-bottom: 1px dashed #F2EFE5;
width: 100%;
color: #999999;
cursor:default;
}
.widget_dark li img {
padding: 4;
cursor:default;
}
.widget_dark a, .widget_dark a:hover, .widget_dark a:visited, .widget_dark a:active {
text-decoration:none;
font-family: inherit;
......@@ -18,3 +94,9 @@
color: #aaaaaa;
cursor:default;
}
.widget_dark img
{
float:left;
cursor:default;
}
......@@ -23,7 +23,7 @@
include_once "widgets/$widgetname/$widgetname.php";
$widget = new $widgetname($widgetsizex,$widgetsizey);
$widgetoutput = $widget->giveOutput();
print("<div id='$widgetname' class='$widgetclass'
print("<div class='$widgetclass'
style='position:absolute;
left:".$widgetposx."px;top:".$widgetposy."px;
width:".$widgetsizex."px;height:".$widgetsizey."px;'>");
......
function fillJukezone(response) {
var content = '<table class="box" align="center" width="95%">';
content += '<tr><td width="30%"><h2>Status:</h2></td><td style="color:00aa00">Online</td></tr>';
content += '<tr><td width="30%"><h2>Volume:</h2></td><td>';
content += '<table cellspacing="0" cellpadding="0"><tr>';
content += '<td>[</td>';
for(var i=0;i<response['volume'];i+=2)
content += '<td onclick="setVolume('+i+')">:</td>';
content += '<td><b>||</b></td>';
for(var i=response['volume']+2;i<=100;i+=2)
content += '<td onclick="setVolume('+i+')">:</td>';
content += '<td>]</td>';
content += '</tr></table>';
content += '</td></tr>';
content += '<tr><td width="30%" valign="top"><h2>Streams:</h2></td><td><table>';
var i=0;
$.each(response['streams'], function(k,v) {
if(response['nowplaying']==i)
content += '<tr><td><h2>[</h2></td><td><h2 onclick="playStream(\''+v+'\')">'+k+'</h2></td><td><h2>]</h2></td></tr>';
else
content += '<tr><td></td><td><h2 onclick="playStream(\''+v+'\')">'+k+'</h2></td><td></td></tr>';
i++;
});
content += '</table></td></tr>';
content += '</table>';
$("#Jukezone").html(content);
}
function resetJukezone() {
var content = '<table class="box" style="align:center;width:95%;">';
content += '<tr><td width="30%"><h2>Status:</h2></td><td style="color:aa0000">Offline</td></tr>';
content += '</table>';
$("#Jukezone").html(content);
}
function setVolume(v) {
$.getJSON("widgets/Jukezone/ajax.php?volume="+v, function (response)
{
fillJukezone(response);
});
}
function playStream(v) {
$.getJSON("widgets/Jukezone/ajax.php?play="+v, function (response)
{
fillJukezone(response);
});
}
function updateJukezone() {
$.getJSON("widgets/Jukezone/ajax.php", function (response)
{
fillJukezone(response);
});
}
$(document).ready(function()
{
addFunctionToMinuteTimer(updateJukezone);
resetJukezone();
updateJukezone();
}
);
<?php
require_once 'widgets/iWidget.php';
class Jukezone implements iWidget
{
public function __construct($width, $height)
{
}
public function giveOutput()
{
$widgetOutput = '<h1>Jukezone</h1>'."\n";
$widgetOutput .= '<script src="widgets/Jukezone/Jukezone.js" type="text/javascript"></script>'."\n";
$widgetOutput .= '<span id="Jukezone"></span>'."\n";
return $widgetOutput;
}
}
?>
<?php
$requesturl = 'http://192.168.123.104/ajax.php';
//$requesturl = 'http://10.0.2.70/ajax.php';
if(isset($_GET["volume"]))
$requesturl .= '?volume='.$_GET["volume"];
if(isset($_GET["play"]))
$requesturl .= '?play='.$_GET["play"];
$httpRequest = new HttpRequest($requesturl, HttpRequest::METH_GET);
$httpRequest->send();
print($httpRequest->getResponseBody());
?>
......@@ -13,7 +13,8 @@ class ZoneOffen implements iWidget
public function giveOutput()
{
$widgetOutput = '<script src="widgets/ZoneOffen/ZoneOffen.js" type="text/javascript"></script>'."\n";
$widgetOutput .= '<center><table width="60%" height="100%" border="0" cellpadding="0" cellspacing="4">'."\n";
$widgetOutput .= '<h1>Warpzone Live:</h1>'."\n";
$widgetOutput .= '<center><table width="60%" border="0" cellpadding="0" cellspacing="4">'."\n";
$widgetOutput .= ' <tr>'."\n";
$widgetOutput .= ' <td width="50%" align="right"><b><p>Status: </p><p>Lounge: </p><p>Werkstatt: </p></b></td>'."\n";
$widgetOutput .= ' <td width="50%" align="right"><span id="ZoneOffen_values"><font color="#cc3300"><p>Unbekannt</p><p>Unbekannt</p><p>Unbekannt</p></font></span></td>'."\n";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment