something

This commit is contained in:
2026-04-03 09:55:42 +02:00
parent 94710dbd9e
commit 28f5796ee5
17 changed files with 75 additions and 157 deletions
+19 -45
View File
@@ -11,18 +11,12 @@ var isBSD;
var isMacOSX;
var isInternetExplorer;
var isEdge;
;
var isSafari;
;
var isOpera;
;
var isChrome;
;
var isFirefox;
;
var webkitVer;
var isNativeChrome;
;
var BrowserName;
var OSName;
{
@@ -43,39 +37,23 @@ var OSName;
webkitVer = parseInt((/WebKit\/([0-9]+)/.exec(navigator.appVersion) || ["", "0"])[1], 10) || void 0; // also match AppleWebKit
isNativeChrome = isAndroid && webkitVer <= 537 && navigator.vendor.toLowerCase().indexOf('google') == 0;
BrowserName = "Unknown";
if (isInternetExplorer)
BrowserName = "IE";
else if (isEdge)
BrowserName = "Edge";
else if (isSafari)
BrowserName = "Safari";
else if (isOpera)
BrowserName = "Opera";
else if (isChrome)
BrowserName = "Chrome";
else if (isFirefox)
BrowserName = "Firefox";
else if (isNativeChrome)
BrowserName = "NativeChrome";
else
BrowserName = "Unknown";
if (isInternetExplorer) BrowserName = "IE";
else if (isEdge) BrowserName = "Edge";
else if (isSafari) BrowserName = "Safari";
else if (isOpera) BrowserName = "Opera";
else if (isChrome) BrowserName = "Chrome";
else if (isFirefox) BrowserName = "Firefox";
else if (isNativeChrome) BrowserName = "NativeChrome";
else BrowserName = "Unknown";
OSName = "Unknown";
if (isAndroid)
OSName = "Android";
else if (isIOS)
OSName = "iOS";
else if (isIPadOS)
OSName = "iPadOS";
else if (isWindows)
OSName = "Windows";
else if (isLinux)
OSName = "Linux";
else if (isBSD)
OSName = "BSD";
else if (isMacOSX)
OSName = "MacOSX";
else
OSName = "Unknown";
if (isAndroid) OSName = "Android";
else if (isIOS) OSName = "iOS";
else if (isIPadOS) OSName = "iPadOS";
else if (isWindows) OSName = "Windows";
else if (isLinux) OSName = "Linux";
else if (isBSD) OSName = "BSD";
else if (isMacOSX) OSName = "MacOSX";
else OSName = "Unknown";
}
;
var WakeLock = /** @class */ (function () {
@@ -91,8 +69,7 @@ var WakeLock = /** @class */ (function () {
WakeLock.AddSourceToVideo(video, 'mp4', 'data:video/mp4;base64,' + WakeLock.VideoMp4);
document.body.appendChild(video);
this.LockElement = video;
}
else {
} else {
this.Logger.Log("Using WakeLock API.");
this.LockElement = null;
}
@@ -109,8 +86,7 @@ var WakeLock = /** @class */ (function () {
_this.Logger.Log("WakeLock request failed.");
console.log("WakeLock request failed.");
});
}
catch (err) {
} catch (err) {
this.Logger.Log("WakeLock request failed.");
console.log("WakeLock request failed.");
}
@@ -123,9 +99,7 @@ var WakeLock = /** @class */ (function () {
_this.LockElement.play().catch(err => {
console.error("LockElement failed:", err);
});
} else {
console.warn("LockElement not a media element or already assigned.");
}
} else console.warn("LockElement not a media element or already assigned.");
}
};
WakeLock.AddSourceToVideo = function (element, type, dataURI) {
+7 -9
View File
@@ -1,12 +1,12 @@
function tuneUp() {
if (socket.readyState === WebSocket.OPEN) {
getCurrentFreq();
let addVal = 0;
if (currentFreq < 0.52) addVal = 9 - (Math.round(currentFreq*1000) % 9);
else if (currentFreq < 1.71) {
// TODO: Rework to replace 9 with 9 or 10 based on regionalisation setting
addVal = 9 - (Math.round(currentFreq*1000) % 9);
var step = 9;
if(localStorage.getItem('rdsMode') == 'true') step = 10
addVal = step - (Math.round(currentFreq*1000) % step);
} else if (currentFreq < 29.6) addVal = 5 - (Math.round(currentFreq*1000) % 5);
else if (currentFreq >= 65.9 && currentFreq < 74) addVal = 30 - ((Math.round(currentFreq*1000) - 65900) % 30);
else addVal = 100 - (Math.round(currentFreq*1000) % 100);
@@ -20,8 +20,9 @@ function tuneDown() {
let subVal = 0;
if (currentFreq < 0.52) subVal = (Math.round(currentFreq*1000) % 9 == 0) ? 9 : (Math.round(currentFreq*1000) % 9);
else if (currentFreq < 1.71) {
// TODO: Rework to replace 9 with 9 or 10 based on regionalisation setting (Americans use 10, because of dumbfuckinstan)
subVal = (Math.round(currentFreq*1000) % 9 == 0) ? 9 : (Math.round(currentFreq*1000) % 9);
var step = 9;
if(localStorage.getItem('rdsMode') == 'true') step = 10
subVal = (Math.round(currentFreq*1000) % step == 0) ? step : (Math.round(currentFreq*1000) % step);
} else if (currentFreq < 29.6) subVal = (Math.round(currentFreq*1000) % 5 == 0) ? 5 : (Math.round(currentFreq*1000) % 5);
else if (currentFreq > 65.9 && currentFreq <= 74) subVal = ((Math.round(currentFreq*1000) - 65900) % 30 == 0) ? 30 : ((Math.round(currentFreq*1000) - 65900) % 30);
else subVal = (Math.round(currentFreq*1000) % 100 == 0) ? 100 : (Math.round(currentFreq*1000) % 100);
@@ -39,9 +40,6 @@ function resetRDS() {
}
function getCurrentFreq() {
currentFreq = $('#data-frequency').text();
currentFreq = parseFloat(currentFreq).toFixed(3);
currentFreq = parseFloat(currentFreq);
currentFreq = Math.round(parseFloat($('#data-frequency').text()) * 1000) / 1000;
return currentFreq;
}
+10 -3
View File
@@ -9,6 +9,12 @@ class WebSocketAudioPlayer {
this.started = false;
}
_trimBuffer() {
if (!this.sourceBuffer.updating && this.audio.currentTime > 5) {
this.sourceBuffer.remove(0, this.audio.currentTime - 2);
}
}
start() {
this.audio = new Audio();
this.mediaSource = new MediaSource();
@@ -20,11 +26,11 @@ class WebSocketAudioPlayer {
this.ws = new WebSocket(this.url);
this.ws.binaryType = 'arraybuffer';
this.ws.onopen = () => this.ws.send(JSON.stringify({ type: 'fallback', data: 'mp3' }));
this.ws.onmessage = (event) => {
this.queue.push(event.data);
this._appendNext();
if (!this.started && this.queue.length === 0) { this.audio.play(); this.started = true; }
this._trimBuffer();
};
this.ws.onclose = () => {
if (this.mediaSource.readyState === 'open') this.mediaSource.endOfStream();
@@ -99,7 +105,7 @@ function OnPlayButtonClick(_ev) {
}
$playbutton.addClass('bg-gray').prop('disabled', true);
setTimeout(() => $playbutton.removeClass('bg-gray').prop('disabled', false), 3000);
setTimeout(() => $playbutton.removeClass('bg-gray').prop('disabled', false), 2500);
}
function updateVolume() {
@@ -108,4 +114,5 @@ function updateVolume() {
else console.warn("Stream is not initialized.");
}
$(document).ready(Init);
$(document).ready(Init);
window.addEventListener('load', Init, false);
-4
View File
@@ -1,7 +1,3 @@
// WebSocket connection located in ./websocket.js
var parsedData, signalChart, previousFreq;
var data = [];
var signalData = [];
-2
View File
@@ -19,8 +19,6 @@ function checkScroll() {
}
}
$(document).ready(function () {
let $container = $(".scrollable-container");
let $leftArrow = $(".scroll-left");
+1 -1
View File
@@ -1,2 +1,2 @@
const versionDate = new Date('Feb 24, 2026 15:00:00');
const versionDate = new Date('Apr 3, 2026 9:30:00');
const currentVersion = `v1.4.0a [${versionDate.getDate()}/${versionDate.getMonth() + 1}/${versionDate.getFullYear()}]`;
+1 -1
View File
@@ -16,7 +16,7 @@ function updateWizardContent() {
$('.btn-prev').toggle(visibleStepIndex !== 0);
$('.btn-next').text(visibleStepIndex === 4 ? 'Save' : 'Next');
visibleStepIndex === 3 && mapReload();
visibleStepIndex === 3 && mapReload(); // What is this? Javascript? Toy?
}
function navigateStep(isNext) {