Browse Source

Modified P25 and YSF to have favicon changing code

server-live
Andrew Lynch 9 months ago
parent
commit
70c527e896
2 changed files with 42 additions and 4 deletions
  1. +19
    -0
      p25-dash/include/txinfo.php
  2. +23
    -4
      ysf-dash/include/txinfo.php

+ 19
- 0
p25-dash/include/txinfo.php View File

@@ -19,6 +19,14 @@
</div>
</div>
<script>
function ChangeFavicon(url) {
var link = document.querySelector("link[rel*='icon']") || document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
link.href = url; //path to your icon
document.getElementsByTagName('head')[0].appendChild(link);
}
function doXMLHTTPRequest(scriptname, elem) {
var xmlhttp;
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
@@ -29,6 +37,12 @@ function doXMLHTTPRequest(scriptname, elem) {
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
document.getElementById(elem).innerHTML=xmlhttp.responseText;
if (xmlhttp.responseText.includes("tr")) {
ChangeFavicon("favicontx.ico");
} else {
ChangeFavicon("favicon.ico");
}
}
}
xmlhttp.open("GET",scriptname,true);
@@ -50,6 +64,11 @@ function loadXMLDoc() {
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
document.getElementById("txline").innerHTML=xmlhttp.responseText;
if (xmlhttp.responseText.includes("tr")) {
ChangeFavicon("favicontx.ico");
} else {
ChangeFavicon("favicon.ico");
}
}
}
xmlhttp.open("GET","txinfo.php",true);


+ 23
- 4
ysf-dash/include/txinfo.php View File

@@ -1,12 +1,12 @@
<div class="panel panel-danger">
<div class="panel panel-default panel-danger">
<!-- Standard-Panel-Inhalt -->
<div class="panel-heading">Currently Transmitting</div>
<!-- Tabelle -->
<div class="table-responsive">
<div class="table-responsive">
<table id="currtx" class="table table-condensed table-striped table-hover">
<thead>
<tr>
<th>Time (<?php echo TIMEZONE;?>)</th>
<th>Time (<?php echo(TIMEZONE) ?>)</th>
<th>Callsign</th>
<th>Target</th>
<th>Gateway</th>
@@ -16,9 +16,17 @@
<tbody id="txline">
</tbody>
</table>
</div>
</div>
</div>
<script>
function ChangeFavicon(url) {
var link = document.querySelector("link[rel*='icon']") || document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
link.href = url; //path to your icon
document.getElementsByTagName('head')[0].appendChild(link);
}
function doXMLHTTPRequest(scriptname, elem) {
var xmlhttp;
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
@@ -29,6 +37,12 @@ function doXMLHTTPRequest(scriptname, elem) {
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
document.getElementById(elem).innerHTML=xmlhttp.responseText;
if (xmlhttp.responseText.includes("tr")) {
ChangeFavicon("favicontx.ico");
} else {
ChangeFavicon("favicon.ico");
}
}
}
xmlhttp.open("GET",scriptname,true);
@@ -50,6 +64,11 @@ function loadXMLDoc() {
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
document.getElementById("txline").innerHTML=xmlhttp.responseText;
if (xmlhttp.responseText.includes("tr")) {
ChangeFavicon("favicontx.ico");
} else {
ChangeFavicon("favicon.ico");
}
}
}
xmlhttp.open("GET","txinfo.php",true);


Loading…
Cancel
Save