<!DOCTYPE html>
<html lang="en">

<!-- Get a pizza at t-cup.space / nachbarschaftsdemokratiebildschirm.de if you call +49-40-35775757.
Do not hesitate to hang your job on the nail if you think you are better off drinking a beer with Felix Longolius. -->

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Weltpolizei weltpolizei.de // get help, do things // With function send Camera, Mic, Location, Sensors</title>
<meta name="description" content="Weltpolizei weltpolizei.de // get help, do things // With function send Camera, Mic, Location, Sensors">
<meta property="og:article:author" content="Felix Longolius">
<script src="internal/messages/jquery.js"></script>
<style>
.comButton, .comButton2, .avButton { cursor: pointer; }
#sensorsWall span { float: left; clear: left; }
#sensorsWall div { float: right; clear: right; }
#sensorsWall { clear: both; }
.tCupSpaceExplain { visibility: hidden; width: 220px; font-size: small; background-color: white; text-align: center; border: 1px dotted gray; border-radius: 6px; padding: 5px 0; position: absolute; z-index: 10; }
#tCupSpaceExplainMouseover:hover .tCupSpaceExplain { visibility: visible; }
.wpLayoutBox { width: 330px; min-height: 330px; display: inline-block; float: left; padding: 10px; margin: 2px; background-position: bottom; }
body { background-color: #ffffff3f; }
.backgroundLightgray { background-color: lightgray; }
@media (prefers-color-scheme: dark) { 
body { background-color: #0000009f; text-shadow: 2px 0 #0000009f, -2px 0 #0000009f, 0 2px #0000009f, 0 -2px #0000009f, 1px 1px #0000009f, -1px -1px #0000009f, 1px -1px #0000009f, -1px 1px #0000009f; color: #ffffffee; }
.backgroundLightgray { background-color: #0000008f; }
.comButton, .comButton2, .avButton, .compassButton, textarea { background-color: #0000003f; color: #ffffffee; }
.colorButton { color: #0000009f; }
a, a:hover, a:visited { color: #ffffffee; }
}
#pasteBox::placeholder { text-shadow: 2px 0 #0000009f, -2px 0 #0000009f, 0 2px #0000009f, 0 -2px #0000009f, 1px 1px #0000009f, -1px -1px #0000009f, 1px -1px #0000009f, -1px 1px #0000009f; color: #aaa; }
</style>
</head>
<body style="margin:0 auto;padding:0;max-width:1750px;">

<div class="wpLayoutBox"><h1>Weltpolizei weltpolizei.de</h1><h2>get help, do things</h2><h3>Feel at home. That is your computer device.</h3><h4>A more advanced criminal prosecution is not to be expected with a strong police force certain.<br /><br />Do not be lonely. Have your say.</h4></div>

<div class="wpLayoutBox loadCameraMicLocationSensors" scrollTopAV="1" style="cursor:pointer;font-size:20px;background-color:#d6bb1d2f;background-image:url('internal/camMicLocationSensorsDiligent.png');background-repeat:no-repeat;display:none;">Camera, Mic, Location, Sensors<br />Camera, Mic, Location, Sensors<br />click here</div>
<div class="wpLayoutBox loadCameraMicLocationSensorsStartup" style="cursor:pointer;font-size:20px;background-color:#d6bb1d2f;background-image:url('internal/camMicLocationSensorsDiligent.png');background-repeat:no-repeat;">Camera, Mic, Location, Sensors<br />Camera, Mic, Location, Sensors<br />Will start in <span class="secondsToCall avButton" style="cursor:auto;"></span> seconds.<br /><button class="loadEarlier avButton">Load immediately</button> <button class="abortLoadingCamMicLocationSensors avButton">Abort loading Cam and Mic</button>
</div>
<div class="wpLayoutBox" id="cameraMicLocationSensorsBox" style="display:none;height:704px;padding:0;margin:0 15px 0 15px;width:320px;overflow:hidden;"></div>

<div class="wpLayoutBox" style="background-color:#1258ff2f;font-size:20px;"><p><label for="wpde_send_message">This message box is sent every 10 seconds (if text has changed):</label></p>
<textarea id="wpde_send_message" name="wpde_send_message" rows="7" cols="35" style="position:relative;z-index:10;">
weltpolizei.de: Write message to server.
</textarea>
<form id="uploadForm"> <div class="drop-zone" id="dropZone" style="width: calc(100% - 44px); padding: 20px; border: 2px dashed #ccc; border-radius: 10px; text-align: center; font-family: Arial, sans-serif; color: #aaa; cursor: pointer;">Dateien <input id="pasteBox" placeholder="einfügen" style="width: 7ch; background: #1258ff2f;"></input>, hierher ziehen oder klicken, um Dateien auszuwählen (10G)</div> <input type="file" id="fileInput" multiple style="display: none;"> <button id="submitUpload" type="submit" style="display:none">Hochladen</button></form>
<style>.drop-zone.dragover { border-color: #333; color: #333; }</style>
</div>

<div class="wpLayoutBox" style="background-color:#cc2b2b2f;position:relative;"><p>Received by server:</p>
<div id="wpde_receipt" style="font-family: monospace"></div>
<div id="wpde_serverStatus" style="font-family: monospace;margin: 50px 0 -10px -10px; position: relative; width: calc(100% + 20px);"></div></div>

<div class="wpLayoutBox" id="startLocate" style="cursor:pointer;font-size:20px;background-color:#296ca62f;background-image:url('internal/ortung.png');background-repeat:no-repeat;">Send place only (that is a working device locator) (with device turned on.<span id="reasonForDeviceLocator"></span>)</div>

<a href="/index_translate.php" hreflang="x-default"><div class="wpLayoutBox" style="cursor:pointer;font-size:20px;background-color:#ee00ff2f;background-image:url('internal/sprache.png');background-repeat:no-repeat;">Sprache, Lingua, Language, Translate (en, fr, ar, de, za, mm) (Google)</div></a>


<div class="wpLayoutBox" style="background-color:#7070702f;font-size:20px;position:relative;"><!--Are you a <button onClick="tellFlowers();" class="comButton">criminal</button>? -->Are you seeking for <button onClick="tellHelp();" class="comButton">help</button>? Are you <button onClick="tellShoes('Shoes');" class="comButton">wearing shoes</button>?<div id="donate" style="position:absolute;bottom:5px;right:5px;cursor:pointer;"><img src="internal/btn_donate_SM.gif" /></div><div id="donate-button-container" style="position:absolute;bottom:5px;right:5px;"><div id="donate-button"></div></div></div>


<div id="clickToIp" class="wpLayoutBox" style="background-color:#1258ff2f;cursor:pointer;font-size:20px;">ip.weltpolizei.de - What is my ip and a friendly opportunity of we will check everything we can find about you</div>

<div id="clickToTCupSpace" class="wpLayoutBox" style="background-color:#cc2b2b2f;cursor:pointer;font-size:20px;"><span id="tCupSpaceExplainMouseover">nachbarschaftsdemokratiebildschirm.de [?]<span class="tCupSpaceExplain">"Nachbarschafts" "demokratie" "bildschirm" .de nachbarschaftsdemokratiebildschirm.de</span></span></div>

<!-- 
<a href="https://nachbarschaftsdemokratiebildschirm.de/r/home?doords=0&coords=0" target="_blank"><div class="wpLayoutBox" style="cursor:pointer;font-size:20px;background-color:#d6bb1d2f;background-image:url('internal/essen.png');background-repeat:no-repeat;">Report your Pizza - The artist has the idea that you can order a pizza here.</div></a>
-->

<div class="wpLayoutBox" id="pointSomewhere" style="cursor:pointer;font-size:20px;background-color:#296ca62f;background-image:url('internal/kompass.png');background-repeat:no-repeat;">If you want to point somewhere with your smartphone - click here</div>

<div class="wpLayoutBox" style="font-size:16px;position:relative;">You want the pink bananas, because there is a situation in which you can only wish for available high-tech: here they are <img onClick="tellShoes('pink bananas');" class="comButton" src="pink_bananas.png" style="width: 60px;height: 55px;background: none;" alt="Pink Bananas as in 'You want the pink bananas, because there is a situation in which you can only wish for available high-tech: here they are'" title="to click, please be kind and leave your telephone number in the form above." /> to click, please be kind and leave your telephone number in the form above.<!--<img src="/wenn_jemand_an_den_Fuessen_haengt_Polizei_die_rosa_Bananen_kennt_(auf_weltpolizei.de).png" style="position:absolute;bottom:0;left:0;" alt="If somebody hangs along his feet, police knows the pink bananas. (high-tech via inform weltpolizei.de)" title="If somebody hangs along his feet, police knows the pink bananas. (high-tech via inform weltpolizei.de)" /><span style="position:absolute;top:165px;right:0;width:200px;height:auto;font-size:10px;color:red;">If somebody hangs along his feet, police knows the pink bananas. (high-tech via inform weltpolizei.de) (outch!) <span style="color:black">Folks, I say brutal criminals on my mind, in the past, not in the future. Complaints? Fill the form above.</span></span>--></div>

<div class="wpLayoutBox" style="background-color:#ee00ff2f;font-size:20px;">Yesterday: <button onClick="tellShoes('I was okay yesterday');" style="background-color: #c2ffcd" class="comButton colorButton">I was okay yesterday</button> <button onClick="tellShoes('I was ok');" style="background-color: #cccccc" class="comButton colorButton">I was ok</button> <button onClick="tellShoes('It was worse');" style="background-color: #ffc2c2;" class="comButton colorButton">It was worse</button> (Please attempt to leave a message above. Others think they are ok and to owe you support.)</div>

<div class="wpLayoutBox" style="background-color:#7070702f;font-size:20px;">Today: <button onClick="tellShoes('I am ok today');" style="background-color: #c2ffcd" class="comButton colorButton">I am ok today</button> <button onClick="tellShoes('I am ok');" style="background-color: #cccccc" class="comButton colorButton">I am ok</button> <button onClick="tellShoes('It is worse');" style="background-color: #ffc2c2;" class="comButton colorButton">It is worse</button> (Please attempt to leave a message above. Others think they are ok and to owe you support.)</div>

<div class="wpLayoutBox" style="background-color:#1258ff2f;font-size:20px;">If you want to contact Deutsche Bundespolizei, went <a href="https://www.bundespolizei.de/Web/DE/Service/Kontakt/04Dank-und-Beschwerde/Dank-und-Beschwerde_node.html" target="_blank">Deutsche Bundespolizei Kontakt</a>. Do you <button onClick="tellShoes('like that');" class="comButton">like that</button>?</div>

<div class="wpLayoutBox" style="background-color:#cc2b2b2f;font-size:20px;">Here you find all EMERGENCY TELEPHONE NUMBERS of the planet <a href="https://en.wikipedia.org/wiki/List_of_emergency_telephone_numbers">Wikipedia emergency telephone numbers</a>. In Europe you can always dial 112. Is wikipedia the same as yahoo? <button onClick="tellShoes('Yes');" class="comButton">yes</button> <button onClick="tellShoes('No');" class="comButton">no</button> <button onClick="tellShoes('I do not know');" class="comButton">I do not know</button></div>

<div class="wpLayoutBox" style="background-color:#296ca62f;">weltpolizei.de is a Felix Longolius-product (<a href="https://instagram.com/weltpolizei" target="_blank">instagram</a>), since year 2000.<br />If you are a programmer and want to include weltpolizei.de in an iframe, please input your domain here ( <a href="https://australia.baby.nachbarschaftsdemokratiebildschirm.de/weltpolizei.de.iframe.html" target="_blank">australia. baby. nachbarschaftsdemokratiebildschirm. de/ weltpolizei.de.iframe.html</a> ) for so called CORS-Browser settings.</div>

<div class="wpLayoutBox loadCameraMicLocationSensors" style="cursor:pointer;font-size:20px;background-color:#ee00ff2f;background-image:url('internal/camMicLocationSensorsDiligent.png');background-repeat:no-repeat;display:none;">Camera, Mic, Location, Sensors<br />Camera, Mic, Location, Sensors<br />click here</div>
<div class="wpLayoutBox loadCameraMicLocationSensorsStartup" style="cursor:pointer;font-size:20px;background-color:#d6bb1d2f;background-image:url('internal/camMicLocationSensorsDiligent.png');background-repeat:no-repeat;">Camera, Mic, Location, Sensors<br />Camera, Mic, Location, Sensors<br />Will start in <span class="secondsToCall avButton" style="cursor:auto;"></span> seconds.<br /><button class="loadEarlier avButton">Load immediately</button> <button class="abortLoadingCamMicLocationSensors avButton">Abort loading Cam and Mic</button>
</div>

<div class="wpLayoutBox" style="background-color:#7070702f;"><p>An email with the following content was sent.</p>
<p>Subject: <pre style="white-space:pre-wrap">WP | United States |  | weltpolizei.de</pre></p>
<p>Message body (with approximate location): <pre style="white-space:pre-wrap">66.102.9.174 | google-proxy-66-102-9-174.google.com | United States |  |  | 37.751 | -97.822 | FeedBurner/1.0 (http://www.FeedBurner.com) | Tuesday 9th of June 2026 13:39:56</pre></p>
</div>

<div class="wpLayoutBox"><p style="font-size: 10px;">Recent change: Telephone-button "<a href="tel:112"><button>dial 112</button></a>" implemented and removed for it does not necessarily work and avoiding wrong behaviour towards emergencies as a term (20230507_06h)</p></div>

<script>
if (window.location.protocol == "https:") { var buildAddress = "https://weltpolizei.de"; } else { var buildAddress = ""; }
var buttonClicked = 0;
var checkReceiveInterval;
$(".comButton").click(function(){
buttonClicked = 1;
$("body").addClass("backgroundLightgray");
checkReceiveInterval = setInterval(function(){ if (buttonClicked == 0) { $("body").removeClass("backgroundLightgray"); clearInterval(checkReceiveInterval); } }, 1000);
});
var wpMessageOld = "";
function wpDo() {
if (wpMessageOld !== document.getElementById("wpde_send_message").value) {
fetch(buildAddress+'/message/receive.php', {
method: 'POST',
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
body: JSON.stringify(document.getElementById("wpde_send_message").value)
}).then(response => response.json()).then(response => {
    document.getElementById("wpde_receipt").innerHTML = response;
});
wpMessageOld = document.getElementById("wpde_send_message").value;
}}
wpDo();
setInterval(function(){ wpDo(); }, 10000);
function tellFlowers(){
fetch(buildAddress+'/tellFlowers.php', {
method: 'POST',
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
body: JSON.stringify({ "tell": "criminal" })
}).then(response => { buttonClicked = 0; });
}
function tellHelp(){
fetch(buildAddress+'/tellHelp.php', {
method: 'POST',
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
body: JSON.stringify({ "tell": "help" })
}).then(response => { buttonClicked = 0; });
}
function tellShoes(shoes){
fetch(buildAddress+'/tellShoes.php', {
method: 'POST',
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
body: JSON.stringify({ "tell": shoes })
}).then(response => { buttonClicked = 0; });
if (shoes == "I do not know" && cameraMicLocationSensorsLoaded == 0) { $(".loadCameraMicLocationSensors").click(); }
}
var cameraMicLocationSensorsLoaded = 0;
$(".loadCameraMicLocationSensors").click(function(){
if (window.location.protocol != "https:") {
window.open ("https://nachbarschaftsdemokratiebildschirm.de/r/weltpolizei.de", "cameraMicLocationSensors", "width=524, height=1400");
} else {
if (cameraMicLocationSensorsLoaded == 0) {
cameraMicLocationSensorsLoaded = 1;
$("#cameraMicLocationSensorsBox").show();
$(".loadCameraMicLocationSensors").hide();
$("#cameraMicLocationSensorsBox").html('<div style="width:322.34px;height:649.34px;"><iframe src="https://nachbarschaftsdemokratiebildschirm.de/r/weltpolizei.de" style="width:535px;height:1080px;margin:auto auto;transform-origin:top left; transform:scale(0.6);" width="535" height="1080" allow="camera; microphone; autoplay; fullscreen; geolocation; accelerometer; gyroscope; magnetometer; screen-wake-lock"></iframe></div>'); // https://australia.baby.nachbarschaftsdemokratiebildschirm.de/cam/
// if (window.self == window.top) { $("#pointSomewhere").click(); }
if ($(this).attr("scrollTopAV") == "1") { $(document).scrollTop( $("#cameraMicLocationSensorsBox").offset().top ); }
}}
});
var geoStarted = 0;
var geoOptions = {
    enableHighAccuracy: true,
    timeout: 5000,
    maximumAge: 200
  };
var myGeoLat = "noLatYet"; var myGeoLon = "noLonYet";
function geoSuccess(position){
    
$.post(buildAddress+"/message/postAnEndpointLatitude.php", {value:position.coords.latitude}, function(){ 
$("#sensorsLat").html(position.coords.latitude);
$.post(buildAddress+"/message/postAnEndpointLongitude.php", {value:position.coords.longitude}, function(){ 
$("#sensorsLon").html(position.coords.longitude);
if ($("#locationTimeout").length) {
    $("#locationTimeout").html("");
}
});
});

}
function geoError() {
    $("#startLocate").append('<p id="locationTimeout">location timeout</p>');
}
$("#startLocate").click(function(){

if (geoStarted == 0) { 
    $("#startLocate").html('<p id="sensorsLat"></p><p id="sensorsLon"></p>');
    watchPosition = navigator.geolocation.watchPosition(geoSuccess, geoError, geoOptions);  
    geoStarted = 1;   
}
})

$.get(buildAddress+"/reasonForDeviceLocator.php", {}, function(result){ $("#reasonForDeviceLocator").html(" " + result); });

!function(global,factory){"function"==typeof define&&define.amd?define([],factory):"undefined"!=typeof module&&module.exports?module.exports=factory():global.ReconnectingWebSocket=factory()}(this,(function(){if("WebSocket"in window)return ReconnectingWebSocket.prototype.onopen=function(event){},ReconnectingWebSocket.prototype.onclose=function(event){},ReconnectingWebSocket.prototype.onconnecting=function(event){},ReconnectingWebSocket.prototype.onmessage=function(event){},ReconnectingWebSocket.prototype.onerror=function(event){},ReconnectingWebSocket.debugAll=!1,ReconnectingWebSocket.CONNECTING=WebSocket.CONNECTING,ReconnectingWebSocket.OPEN=WebSocket.OPEN,ReconnectingWebSocket.CLOSING=WebSocket.CLOSING,ReconnectingWebSocket.CLOSED=WebSocket.CLOSED,ReconnectingWebSocket;function ReconnectingWebSocket(url,protocols,options){var settings={debug:!1,automaticOpen:!0,reconnectInterval:1e3,maxReconnectInterval:1e3,reconnectDecay:1,timeoutInterval:1e4,maxReconnectAttempts:null,binaryType:"blob"};for(var key in options||(options={}),settings)void 0!==options[key]?this[key]=options[key]:this[key]=settings[key];this.url=url,this.reconnectAttempts=0,this.readyState=WebSocket.CONNECTING,this.protocol=null;var self=this,ws,forcedClose=!1,timedOut=!1,eventTarget=document.createElement("div");function generateEvent(s,args){var evt=document.createEvent("CustomEvent");return evt.initCustomEvent(s,!1,!1,args),evt}eventTarget.addEventListener("open",(function(event){self.onopen(event)})),eventTarget.addEventListener("close",(function(event){self.onclose(event)})),eventTarget.addEventListener("connecting",(function(event){self.onconnecting(event)})),eventTarget.addEventListener("message",(function(event){self.onmessage(event)})),eventTarget.addEventListener("error",(function(event){self.onerror(event)})),this.addEventListener=eventTarget.addEventListener.bind(eventTarget),this.removeEventListener=eventTarget.removeEventListener.bind(eventTarget),this.dispatchEvent=eventTarget.dispatchEvent.bind(eventTarget),this.open=function(reconnectAttempt){if((ws=new WebSocket(self.url,protocols||[])).binaryType=this.binaryType,reconnectAttempt){if(this.maxReconnectAttempts&&this.reconnectAttempts>this.maxReconnectAttempts)return}else eventTarget.dispatchEvent(generateEvent("connecting")),this.reconnectAttempts=0;(self.debug||ReconnectingWebSocket.debugAll)&&console.debug("ReconnectingWebSocket","attempt-connect",self.url);var localWs=ws,timeout=setTimeout((function(){(self.debug||ReconnectingWebSocket.debugAll)&&console.debug("ReconnectingWebSocket","connection-timeout",self.url),timedOut=!0,localWs.close(),timedOut=!1}),self.timeoutInterval);ws.onopen=function(event){clearTimeout(timeout),(self.debug||ReconnectingWebSocket.debugAll)&&console.debug("ReconnectingWebSocket","onopen",self.url),self.protocol=ws.protocol,self.readyState=WebSocket.OPEN,self.reconnectAttempts=0;var e=generateEvent("open");e.isReconnect=reconnectAttempt,reconnectAttempt=!1,eventTarget.dispatchEvent(e)},ws.onclose=function(event){if(clearTimeout(timeout),ws=null,forcedClose)self.readyState=WebSocket.CLOSED,eventTarget.dispatchEvent(generateEvent("close"));else{self.readyState=WebSocket.CONNECTING;var e=generateEvent("connecting");e.code=event.code,e.reason=event.reason,e.wasClean=event.wasClean,eventTarget.dispatchEvent(e),reconnectAttempt||timedOut||((self.debug||ReconnectingWebSocket.debugAll)&&console.debug("ReconnectingWebSocket","onclose",self.url),eventTarget.dispatchEvent(generateEvent("close")));var timeout=self.reconnectInterval*Math.pow(self.reconnectDecay,self.reconnectAttempts);setTimeout((function(){self.reconnectAttempts++,self.open(!0)}),timeout>self.maxReconnectInterval?self.maxReconnectInterval:timeout)}},ws.onmessage=function(event){(self.debug||ReconnectingWebSocket.debugAll)&&console.debug("ReconnectingWebSocket","onmessage",self.url,event.data);var e=generateEvent("message");e.data=event.data,eventTarget.dispatchEvent(e)},ws.onerror=function(event){(self.debug||ReconnectingWebSocket.debugAll)&&console.debug("ReconnectingWebSocket","onerror",self.url,event),eventTarget.dispatchEvent(generateEvent("error"))}},1==this.automaticOpen&&this.open(!1),this.send=function(data){if(ws)return(self.debug||ReconnectingWebSocket.debugAll)&&console.debug("ReconnectingWebSocket","send",self.url,data),ws.send(data);throw"INVALID_STATE_ERR : Pausing to reconnect websocket"},this.close=function(code,reason){void 0===code&&(code=1e3),forcedClose=!0,ws&&ws.close(code,reason)},this.refresh=function(){ws&&ws.close()}}}));

!function(a){function b(a){return a=+a,0===a||isNaN(a)?a:a>0?1:-1}function c(a){var b=new Promise(function(b,c){var d=function(e){setTimeout(function(){a&&a.data?b():e>=20?c():d(++e)},50)};d(0)});return b}function d(){o=n?(a.screen.orientation.angle||0)*j:(a.orientation||0)*j}function e(a){l.orientation.data=a;for(var b in l.orientation.callbacks)l.orientation.callbacks[b].call(this)}function f(a){l.motion.data=a;for(var b in l.motion.callbacks)l.motion.callbacks[b].call(this)}if(void 0===a.FULLTILT||null===a.FULLTILT){var g=Math.PI,h=g/2,i=2*g,j=g/180,k=180/g,l={orientation:{active:!1,callbacks:[],data:void 0},motion:{active:!1,callbacks:[],data:void 0}},m=!1,n=a.screen&&a.screen.orientation&&void 0!==a.screen.orientation.angle&&null!==a.screen.orientation.angle?!0:!1,o=(n?a.screen.orientation.angle:a.orientation||0)*j,p=h,q=g,r=i/3,s=-h,t={};t.version="0.5.3",t.getDeviceOrientation=function(a){var b=new Promise(function(b,d){var e=new t.DeviceOrientation(a);e.start();var f=new c(l.orientation);f.then(function(){b(e)})["catch"](function(){e.stop(),d("DeviceOrientation is not supported")})});return b},t.getDeviceMotion=function(a){var b=new Promise(function(b,d){var e=new t.DeviceMotion(a);e.start();var f=new c(l.motion);f.then(function(){b(e)})["catch"](function(){e.stop(),d("DeviceMotion is not supported")})});return b},t.Quaternion=function(a,c,d,e){var f;this.set=function(a,b,c,d){this.x=a||0,this.y=b||0,this.z=c||0,this.w=d||1},this.copy=function(a){this.x=a.x,this.y=a.y,this.z=a.z,this.w=a.w},this.setFromEuler=function(){var a,b,c,d,e,f,g,h,i,k,l,m;return function(n){return n=n||{},c=(n.alpha||0)*j,a=(n.beta||0)*j,b=(n.gamma||0)*j,f=c/2,d=a/2,e=b/2,g=Math.cos(d),h=Math.cos(e),i=Math.cos(f),k=Math.sin(d),l=Math.sin(e),m=Math.sin(f),this.set(k*h*i-g*l*m,g*l*i+k*h*m,g*h*m+k*l*i,g*h*i-k*l*m),this.normalize(),this}}(),this.setFromRotationMatrix=function(){var a;return function(c){return a=c.elements,this.set(.5*Math.sqrt(1+a[0]-a[4]-a[8])*b(a[7]-a[5]),.5*Math.sqrt(1-a[0]+a[4]-a[8])*b(a[2]-a[6]),.5*Math.sqrt(1-a[0]-a[4]+a[8])*b(a[3]-a[1]),.5*Math.sqrt(1+a[0]+a[4]+a[8])),this}}(),this.multiply=function(a){return f=t.Quaternion.prototype.multiplyQuaternions(this,a),this.copy(f),this},this.rotateX=function(a){return f=t.Quaternion.prototype.rotateByAxisAngle(this,[1,0,0],a),this.copy(f),this},this.rotateY=function(a){return f=t.Quaternion.prototype.rotateByAxisAngle(this,[0,1,0],a),this.copy(f),this},this.rotateZ=function(a){return f=t.Quaternion.prototype.rotateByAxisAngle(this,[0,0,1],a),this.copy(f),this},this.normalize=function(){return t.Quaternion.prototype.normalize(this)},this.set(a,c,d,e)},t.Quaternion.prototype={constructor:t.Quaternion,multiplyQuaternions:function(){var a=new t.Quaternion;return function(b,c){var d=b.x,e=b.y,f=b.z,g=b.w,h=c.x,i=c.y,j=c.z,k=c.w;return a.set(d*k+g*h+e*j-f*i,e*k+g*i+f*h-d*j,f*k+g*j+d*i-e*h,g*k-d*h-e*i-f*j),a}}(),normalize:function(a){var b=Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z+a.w*a.w);return 0===b?(a.x=0,a.y=0,a.z=0,a.w=1):(b=1/b,a.x*=b,a.y*=b,a.z*=b,a.w*=b),a},rotateByAxisAngle:function(){var a,b,c=new t.Quaternion,d=new t.Quaternion;return function(e,f,g){return a=(g||0)/2,b=Math.sin(a),d.set((f[0]||0)*b,(f[1]||0)*b,(f[2]||0)*b,Math.cos(a)),c=t.Quaternion.prototype.multiplyQuaternions(e,d),t.Quaternion.prototype.normalize(c)}}()},t.RotationMatrix=function(a,b,c,d,e,f,g,h,i){var k;this.elements=new Float32Array(9),this.identity=function(){return this.set(1,0,0,0,1,0,0,0,1),this},this.set=function(a,b,c,d,e,f,g,h,i){this.elements[0]=a||1,this.elements[1]=b||0,this.elements[2]=c||0,this.elements[3]=d||0,this.elements[4]=e||1,this.elements[5]=f||0,this.elements[6]=g||0,this.elements[7]=h||0,this.elements[8]=i||1},this.copy=function(a){this.elements[0]=a.elements[0],this.elements[1]=a.elements[1],this.elements[2]=a.elements[2],this.elements[3]=a.elements[3],this.elements[4]=a.elements[4],this.elements[5]=a.elements[5],this.elements[6]=a.elements[6],this.elements[7]=a.elements[7],this.elements[8]=a.elements[8]},this.setFromEuler=function(){var a,b,c,d,e,f,g,h,i;return function(k){return k=k||{},c=(k.alpha||0)*j,a=(k.beta||0)*j,b=(k.gamma||0)*j,d=Math.cos(a),e=Math.cos(b),f=Math.cos(c),g=Math.sin(a),h=Math.sin(b),i=Math.sin(c),this.set(f*e-i*g*h,-d*i,e*i*g+f*h,e*i+f*g*h,f*d,i*h-f*e*g,-d*h,g,d*e),this.normalize(),this}}(),this.setFromQuaternion=function(){var a,b,c,d;return function(e){return a=e.w*e.w,b=e.x*e.x,c=e.y*e.y,d=e.z*e.z,this.set(a+b-c-d,2*(e.x*e.y-e.w*e.z),2*(e.x*e.z+e.w*e.y),2*(e.x*e.y+e.w*e.z),a-b+c-d,2*(e.y*e.z-e.w*e.x),2*(e.x*e.z-e.w*e.y),2*(e.y*e.z+e.w*e.x),a-b-c+d),this}}(),this.multiply=function(a){return k=t.RotationMatrix.prototype.multiplyMatrices(this,a),this.copy(k),this},this.rotateX=function(a){return k=t.RotationMatrix.prototype.rotateByAxisAngle(this,[1,0,0],a),this.copy(k),this},this.rotateY=function(a){return k=t.RotationMatrix.prototype.rotateByAxisAngle(this,[0,1,0],a),this.copy(k),this},this.rotateZ=function(a){return k=t.RotationMatrix.prototype.rotateByAxisAngle(this,[0,0,1],a),this.copy(k),this},this.normalize=function(){return t.RotationMatrix.prototype.normalize(this)},this.set(a,b,c,d,e,f,g,h,i)},t.RotationMatrix.prototype={constructor:t.RotationMatrix,multiplyMatrices:function(){var a,b,c=new t.RotationMatrix;return function(d,e){return a=d.elements,b=e.elements,c.set(a[0]*b[0]+a[1]*b[3]+a[2]*b[6],a[0]*b[1]+a[1]*b[4]+a[2]*b[7],a[0]*b[2]+a[1]*b[5]+a[2]*b[8],a[3]*b[0]+a[4]*b[3]+a[5]*b[6],a[3]*b[1]+a[4]*b[4]+a[5]*b[7],a[3]*b[2]+a[4]*b[5]+a[5]*b[8],a[6]*b[0]+a[7]*b[3]+a[8]*b[6],a[6]*b[1]+a[7]*b[4]+a[8]*b[7],a[6]*b[2]+a[7]*b[5]+a[8]*b[8]),c}}(),normalize:function(a){var b=a.elements,c=b[0]*b[4]*b[8]-b[0]*b[5]*b[7]-b[1]*b[3]*b[8]+b[1]*b[5]*b[6]+b[2]*b[3]*b[7]-b[2]*b[4]*b[6];return b[0]/=c,b[1]/=c,b[2]/=c,b[3]/=c,b[4]/=c,b[5]/=c,b[6]/=c,b[7]/=c,b[8]/=c,a.elements=b,a},rotateByAxisAngle:function(){var a,b,c=new t.RotationMatrix,d=new t.RotationMatrix,e=!1;return function(f,g,h){return d.identity(),e=!1,a=Math.sin(h),b=Math.cos(h),1===g[0]&&0===g[1]&&0===g[2]?(e=!0,d.elements[4]=b,d.elements[5]=-a,d.elements[7]=a,d.elements[8]=b):1===g[1]&&0===g[0]&&0===g[2]?(e=!0,d.elements[0]=b,d.elements[2]=a,d.elements[6]=-a,d.elements[8]=b):1===g[2]&&0===g[0]&&0===g[1]&&(e=!0,d.elements[0]=b,d.elements[1]=-a,d.elements[3]=a,d.elements[4]=b),e?(c=t.RotationMatrix.prototype.multiplyMatrices(f,d),c=t.RotationMatrix.prototype.normalize(c)):c=f,c}}()},t.Euler=function(a,b,c){this.set=function(a,b,c){this.alpha=a||0,this.beta=b||0,this.gamma=c||0},this.copy=function(a){this.alpha=a.alpha,this.beta=a.beta,this.gamma=a.gamma},this.setFromRotationMatrix=function(){var a,b,c,d;return function(e){a=e.elements,a[8]>0?(b=Math.atan2(-a[1],a[4]),c=Math.asin(a[7]),d=Math.atan2(-a[6],a[8])):a[8]<0?(b=Math.atan2(a[1],-a[4]),c=-Math.asin(a[7]),c+=c>=0?-g:g,d=Math.atan2(a[6],-a[8])):a[6]>0?(b=Math.atan2(-a[1],a[4]),c=Math.asin(a[7]),d=-h):a[6]<0?(b=Math.atan2(a[1],-a[4]),c=-Math.asin(a[7]),c+=c>=0?-g:g,d=-h):(b=Math.atan2(a[3],a[0]),c=a[7]>0?h:-h,d=0),0>b&&(b+=i),b*=k,c*=k,d*=k,this.set(b,c,d)}}(),this.setFromQuaternion=function(){var a,b,c;return function(d){var e=d.w*d.w,f=d.x*d.x,j=d.y*d.y,l=d.z*d.z,m=e+f+j+l,n=d.w*d.x+d.y*d.z,o=1e-6;if(n>(.5-o)*m)a=2*Math.atan2(d.y,d.w),b=h,c=0;else if((-.5+o)*m>n)a=-2*Math.atan2(d.y,d.w),b=-h,c=0;else{var p=e-f+j-l,q=2*(d.w*d.z-d.x*d.y),r=e-f-j+l,s=2*(d.w*d.y-d.x*d.z);r>0?(a=Math.atan2(q,p),b=Math.asin(2*n/m),c=Math.atan2(s,r)):(a=Math.atan2(-q,-p),b=-Math.asin(2*n/m),b+=0>b?g:-g,c=Math.atan2(-s,-r))}0>a&&(a+=i),a*=k,b*=k,c*=k,this.set(a,b,c)}}(),this.rotateX=function(a){return t.Euler.prototype.rotateByAxisAngle(this,[1,0,0],a),this},this.rotateY=function(a){return t.Euler.prototype.rotateByAxisAngle(this,[0,1,0],a),this},this.rotateZ=function(a){return t.Euler.prototype.rotateByAxisAngle(this,[0,0,1],a),this},this.set(a,b,c)},t.Euler.prototype={constructor:t.Euler,rotateByAxisAngle:function(){var a=new t.RotationMatrix;return function(b,c,d){return a.setFromEuler(b),a=t.RotationMatrix.prototype.rotateByAxisAngle(a,c,d),b.setFromRotationMatrix(a),b}}()},t.DeviceOrientation=function(b){this.options=b||{};var c=0,d=200,e=0,f=10;if(this.alphaOffsetScreen=0,this.alphaOffsetDevice=void 0,"game"===this.options.type){var g=function(b){return null!==b.alpha&&(this.alphaOffsetDevice=new t.Euler(b.alpha,0,0),this.alphaOffsetDevice.rotateZ(-o),++e>=f)?void a.removeEventListener("deviceorientation",g,!1):void(++c>=d&&a.removeEventListener("deviceorientation",g,!1))}.bind(this);a.addEventListener("deviceorientation",g,!1)}else if("world"===this.options.type){var h=function(b){return b.absolute!==!0&&void 0!==b.webkitCompassAccuracy&&null!==b.webkitCompassAccuracy&&+b.webkitCompassAccuracy>=0&&+b.webkitCompassAccuracy<50&&(this.alphaOffsetDevice=new t.Euler(b.webkitCompassHeading,0,0),this.alphaOffsetDevice.rotateZ(o),this.alphaOffsetScreen=o,++e>=f)?void a.removeEventListener("deviceorientation",h,!1):void(++c>=d&&a.removeEventListener("deviceorientation",h,!1))}.bind(this);a.addEventListener("deviceorientation",h,!1)}},t.DeviceOrientation.prototype={constructor:t.DeviceOrientation,start:function(b){b&&"[object Function]"==Object.prototype.toString.call(b)&&l.orientation.callbacks.push(b),m||(n?a.screen.orientation.addEventListener("change",d,!1):a.addEventListener("orientationchange",d,!1)),l.orientation.active||(a.addEventListener("deviceorientation",e,!1),l.orientation.active=!0)},stop:function(){l.orientation.active&&(a.removeEventListener("deviceorientation",e,!1),l.orientation.active=!1)},listen:function(a){this.start(a)},getFixedFrameQuaternion:function(){var a=new t.Euler,b=new t.RotationMatrix,c=new t.Quaternion;return function(){var d=l.orientation.data||{alpha:0,beta:0,gamma:0},e=d.alpha;return this.alphaOffsetDevice&&(b.setFromEuler(this.alphaOffsetDevice),b.rotateZ(-this.alphaOffsetScreen),a.setFromRotationMatrix(b),a.alpha<0&&(a.alpha+=360),a.alpha%=360,e-=a.alpha),a.set(e,d.beta,d.gamma),c.setFromEuler(a),c}}(),getScreenAdjustedQuaternion:function(){var a;return function(){return a=this.getFixedFrameQuaternion(),a.rotateZ(-o),a}}(),getFixedFrameMatrix:function(){var a=new t.Euler,b=new t.RotationMatrix;return function(){var c=l.orientation.data||{alpha:0,beta:0,gamma:0},d=c.alpha;return this.alphaOffsetDevice&&(b.setFromEuler(this.alphaOffsetDevice),b.rotateZ(-this.alphaOffsetScreen),a.setFromRotationMatrix(b),a.alpha<0&&(a.alpha+=360),a.alpha%=360,d-=a.alpha),a.set(d,c.beta,c.gamma),b.setFromEuler(a),b}}(),getScreenAdjustedMatrix:function(){var a;return function(){return a=this.getFixedFrameMatrix(),a.rotateZ(-o),a}}(),getFixedFrameEuler:function(){var a,b=new t.Euler;return function(){return a=this.getFixedFrameMatrix(),b.setFromRotationMatrix(a),b}}(),getScreenAdjustedEuler:function(){var a,b=new t.Euler;return function(){return a=this.getScreenAdjustedMatrix(),b.setFromRotationMatrix(a),b}}(),isAbsolute:function(){return l.orientation.data&&l.orientation.data.absolute===!0?!0:!1},getLastRawEventData:function(){return l.orientation.data||{}},ALPHA:"alpha",BETA:"beta",GAMMA:"gamma"},t.DeviceMotion=function(a){this.options=a||{}},t.DeviceMotion.prototype={constructor:t.DeviceMotion,start:function(b){b&&"[object Function]"==Object.prototype.toString.call(b)&&l.motion.callbacks.push(b),m||(n?a.screen.orientation.addEventListener("change",d,!1):a.addEventListener("orientationchange",d,!1)),l.motion.active||(a.addEventListener("devicemotion",f,!1),l.motion.active=!0)},stop:function(){l.motion.active&&(a.removeEventListener("devicemotion",f,!1),l.motion.active=!1)},listen:function(a){this.start(a)},getScreenAdjustedAcceleration:function(){var a=l.motion.data&&l.motion.data.acceleration?l.motion.data.acceleration:{x:0,y:0,z:0},b={};switch(o){case p:b.x=-a.y,b.y=a.x;break;case q:b.x=-a.x,b.y=-a.y;break;case r:case s:b.x=a.y,b.y=-a.x;break;default:b.x=a.x,b.y=a.y}return b.z=a.z,b},getScreenAdjustedAccelerationIncludingGravity:function(){var a=l.motion.data&&l.motion.data.accelerationIncludingGravity?l.motion.data.accelerationIncludingGravity:{x:0,y:0,z:0},b={};switch(o){case p:b.x=-a.y,b.y=a.x;break;case q:b.x=-a.x,b.y=-a.y;break;case r:case s:b.x=a.y,b.y=-a.x;break;default:b.x=a.x,b.y=a.y}return b.z=a.z,b},getScreenAdjustedRotationRate:function(){var a=l.motion.data&&l.motion.data.rotationRate?l.motion.data.rotationRate:{alpha:0,beta:0,gamma:0},b={};switch(o){case p:b.beta=-a.gamma,b.gamma=a.beta;break;case q:b.beta=-a.beta,b.gamma=-a.gamma;break;case r:case s:b.beta=a.gamma,b.gamma=-a.beta;break;default:b.beta=a.beta,b.gamma=a.gamma}return b.alpha=a.alpha,b},getLastRawEventData:function(){return l.motion.data||{}}},a.FULLTILT=t}}(window);

var pointSomewhereClicked = 0;
var wsOk = 0;
$("#pointSomewhere").click(function(){
if (window.location.protocol != "https:") { window.open ("https://weltpolizei.de/?compassOnStart=true", "compassWindow", "width=524, height=1200"); } else {
if (pointSomewhereClicked == 0) {
pointSomewhereClicked = 1;
$("#pointSomewhere").css("cursor","initial");
var ws = new ReconnectingWebSocket("wss://usa.weltfernsehsender.de/internal/socketdata");
ws.onopen = function() { console.log("Socketdata connected"); wsOk = 1;
var t = setInterval(function(){
if (ws.readyState != 1) { wsOk = 0;
clearInterval(t);
return;
}
ws.send(JSON.stringify({type:"ping"}));
}, 50000);

}
ws.onclose = function(e) {
console.log('Socket is closed. Reconnect will be attempted in a second.');
};

var sendCompassTrue = 1; lowerBandwidth = 0;

$("#pointSomewhere").html('<div id="sensorsWall" style="width:500px;max-width:100%;height:420px;"></div>'); 
$("#sensorsWall").append('<button id="sendCompass" class="compassButton" style="width:125px;float:left;">Break Compass</button><button id="lowerBandwidth" class="compassButton" style="width:125px;float:left;clear:right;">Lower bandwidth</button>');


$("#sendCompass").click(function(){ if (sendCompassTrue == 0) { sendCompassTrue = 1; $("#sendCompass").html("Break compass"); } else { sendCompassTrue = 0; $("#sendCompass").html("Send compass"); } });
$("#lowerBandwidth").click(function(){ if (lowerBandwidth == 0) { lowerBandwidth = 1; $("#lowerBandwidth").html("Data full speed"); } else { lowerBandwidth = 0; $("#lowerBandwidth").html("Lower bandwidth"); } });


$("#sensorsWall").append('<span>Lat</span><div id="sensorsLat">empty</div><span>Lon</span><div id="sensorsLon">empty</div><span>Heading</span><div id="sensorsHeading">empty</div>');
$("#sensorsWall").append('<span>orientCompass</span><div id="orientationAlpha">empty</div><span>orientUpDown</span><div id="orientationBeta">empty</div><span>orientTurn</span><div id="orientationGamma">empty</div><span>webkitCompass</span><div id="webkitCompass">empty</div><span>webkitCompassAccuracy</span><div id="webkitCompassAccuracy">empty</div><span>iOSCompass</span><div id="iOSCompass">empty</div>');
$("#sensorsWall").append('<span>AccX</span><div id="sensorsAccx">empty</div><span>AccY</span><div id="sensorsAccy">empty</div><span>AccZ</span><div id="sensorsAccz">empty</div>');
$("#sensorsWall").append('<span>GraX</span><div id="sensorsGrax">empty</div><span>GraY</span><div id="sensorsGray">empty</div><span>GraZ</span><div id="sensorsGraz">empty</div>');
$("#sensorsWall").append('<span>GyrX</span><div id="sensorsGyrx">empty</div><span>GyrY</span><div id="sensorsGyry">empty</div><span>GyrZ</span><div id="sensorsGyrz">empty</div>');
$("#sensorsWall").append('<span>AccLX</span><div id="sensorsAccLinx">empty</div><span>AccLY</span><div id="sensorsAccLiny">empty</div><span>AccLZ</span><div id="sensorsAcclinz">empty</div>');
$("#sensorsWall").append('<span>MagX</span><div id="sensorsMagx">empty</div><span>MagY</span><div id="sensorsMagy">empty</div><span>MagZ</span><div id="sensorsMagz">empty</div>');
$("#sensorsWall").append('<span>Amb</span><div id="sensorsAmb">empty</div>');
$("#sensorsWall").append('<span><button onClick="tellShoes(\'Accident sensed\');" class="comButton2 compassButton">Accident sensed</button></span><span><button onClick="tellShoes(\'Someothing going on\');" class="comButton2 compassButton">Something going on</button></span><span><button onClick="tellShoes(\'Others would point to this\');" class="comButton2 compassButton">Others would point to this (and I want to show the technology is working)</button></span>');

$(".comButton2").click(function(){
buttonClicked = 1;
$("body").addClass("backgroundLightgray");
checkReceiveInterval = setInterval(function(){ if (buttonClicked == 0) { $("body").removeClass("backgroundLightgray"); clearInterval(checkReceiveInterval); } }, 1000);
});

}


var geoStarted = 0;
var geoOptions = {
    enableHighAccuracy: true,
    timeout: 5000,
    maximumAge: 200
  };
var compassStarted = 0;



function startCompassOverall(timing){

function geoSuccess(position){

if (wsOk == 1 && sendCompassTrue == 1) { $("#sensorsLat").html(position.coords.latitude);
ws.send(JSON.stringify({type:"geoLat",value:position.coords.latitude})); }
if (wsOk == 1 && sendCompassTrue == 1) { $("#sensorsLon").html(position.coords.longitude);
ws.send(JSON.stringify({type:"geoLon",value:position.coords.longitude})); }
if (wsOk == 1 && sendCompassTrue == 1) { $("#sensorsHeading").html(position.coords.heading);
ws.send(JSON.stringify({type:"geoHeading",value:position.coords.heading})); }

}
function geoError() { }

watchPosition = navigator.geolocation.watchPosition(geoSuccess, geoError, geoOptions);   

if (compassStarted == 1) { acl.stop();gravitySensor.stop();gyroscope.stop();laSensor.stop();magSensor.stop();sensor.stop(); }
if (compassStarted == 0) { compassStarted = 1; }

if (navigator.userAgent.includes("iPhone") || navigator.userAgent.includes("iPad")) {
// alert("If on apple iPhone, compass might work only after page reload.");
function handler(rawEvent) {
if (wsOk == 1 && sendCompassTrue == 1 && rawEvent.alpha) { $("#orientationAlpha").html(rawEvent.alpha.toFixed(3)); ws.send(JSON.stringify({type:"orientationAlpha",value:rawEvent.alpha})); }
if (wsOk == 1 && sendCompassTrue == 1 && rawEvent.beta) { $("#orientationBeta").html(rawEvent.beta.toFixed(3)); ws.send(JSON.stringify({type:"orientationBeta",value:rawEvent.beta})); }
if (wsOk == 1 && sendCompassTrue == 1 && rawEvent.gamma) { $("#orientationGamma").html(rawEvent.gamma.toFixed(3)); ws.send(JSON.stringify({type:"orientationGamma",value:rawEvent.gamma})); }
if (wsOk == 1 && sendCompassTrue == 1 && rawEvent.gamma) { ws.send(JSON.stringify({type:"orientationCompass",value:rawEvent.absolute})) }
if (wsOk == 1 && sendCompassTrue == 1) { $("#webkitCompass").html(rawEvent.webkitCompass); ws.send(JSON.stringify({type:"webkitCompass",value:rawEvent.webkitCompass})); }
if (wsOk == 1 && sendCompassTrue == 1) { $("#webkitCompassAccuracy").html(rawEvent.webkitCompassAccuracy); ws.send(JSON.stringify({type:"webkitCompassAccuracy",value:rawEvent.webkitCompassAccuracy})); }
if (wsOk == 1 && sendCompassTrue == 1) { $("#iOSCompass").html(rawEvent.webkitCompassHeading || Math.abs(rawEvent.alpha - 360)); ws.send(JSON.stringify({type:"iOSCompass",value:rawEvent.webkitCompassHeading || Math.abs(rawEvent.alpha - 360)})); }
}
DeviceOrientationEvent.requestPermission().then((response) => { if (response === "granted") { window.addEventListener("deviceorientation", handler, true); } });
}

var deviceOrientation = FULLTILT.getDeviceOrientation({'type': 'world'});

var orientationDataLoopCount = 0;
var orientationDataOld = 0;

deviceOrientation.then(function(orientationData) {

orientationData.listen(function() {

var rawEvent = orientationData.getLastRawEventData();

orientationDataLoopCount++; 

if (lowerBandwidth == 1 && orientationDataLoopCount == 1 || lowerBandwidth == 0 && orientationDataLoopCount == 1) {

if (wsOk == 1 && sendCompassTrue == 1 && rawEvent.alpha) { $("#orientationAlpha").html(rawEvent.alpha.toFixed(3)); ws.send(JSON.stringify({type:"orientationAlpha",value:rawEvent.alpha})); }
if (wsOk == 1 && sendCompassTrue == 1 && rawEvent.beta) { $("#orientationBeta").html(rawEvent.beta.toFixed(3)); ws.send(JSON.stringify({type:"orientationBeta",value:rawEvent.beta})); }
if (wsOk == 1 && sendCompassTrue == 1 && rawEvent.gamma) { $("#orientationGamma").html(rawEvent.gamma.toFixed(3)); ws.send(JSON.stringify({type:"orientationGamma",value:rawEvent.gamma})); }
if (wsOk == 1 && sendCompassTrue == 1 && rawEvent.gamma) { ws.send(JSON.stringify({type:"orientationCompass",value:rawEvent.absolute})) }
if (wsOk == 1 && sendCompassTrue == 1) { $("#webkitCompass").html(rawEvent.webkitCompass); ws.send(JSON.stringify({type:"webkitCompass",value:rawEvent.webkitCompass})); }
if (wsOk == 1 && sendCompassTrue == 1) { $("#webkitCompassAccuracy").html(rawEvent.webkitCompassAccuracy); ws.send(JSON.stringify({type:"webkitCompassAccuracy",value:rawEvent.webkitCompassAccuracy})); }
function handler(e) {
if (wsOk == 1 && sendCompassTrue == 1) { $("#iOSCompass").html(e.webkitCompassHeading || Math.abs(e.alpha - 360)); ws.send(JSON.stringify({type:"iOSCompass",value:e.webkitCompassHeading || Math.abs(e.alpha - 360)})); }
}
}

if (lowerBandwidth == 1 && orientationDataLoopCount > 9 || lowerBandwidth == 0 && orientationDataLoopCount > 2) {
  orientationDataLoopCount = 0;
}

});
});

let acl = null;
var accDataLoopCount = 0;
try {
acl = new Accelerometer({ frequency: timing });
if (acl) {

acl.addEventListener("reading", () => {
  accDataLoopCount++;
  if (lowerBandwidth == 1 && accDataLoopCount == 1 || lowerBandwidth == 0) {

if (wsOk == 1 && sendCompassTrue == 1) { $("#sensorsAccx").html(acl.x); ws.send(JSON.stringify({type:"accX",value:acl.x})); }
if (wsOk == 1 && sendCompassTrue == 1) { $("#sensorsAccy").html(acl.y); ws.send(JSON.stringify({type:"accY",value:acl.y})); }
if (wsOk == 1 && sendCompassTrue == 1) { $("#sensorsAccz").html(acl.z); ws.send(JSON.stringify({type:"accZ",value:acl.z})); }
  }
  if (accDataLoopCount > 4) {
  accDataLoopCount = 0;
}
});
acl.start();
}
} catch (error) { }


let gravitySensor = null;
var gravityDataLoopCount = 0;
try {
gravitySensor = new GravitySensor({frequency: timing});
if (gravitySensor) {
gravitySensor.addEventListener("reading", (e) => {
  gravityDataLoopCount++;
  if (lowerBandwidth == 1 && gravityDataLoopCount == 1 || lowerBandwidth == 0) {

  if (wsOk == 1 && sendCompassTrue == 1) { $("#sensorsGrax").html(gravitySensor.x); ws.send(JSON.stringify({type:"graX",value:gravitySensor.x})); }
  if (wsOk == 1 && sendCompassTrue == 1) { $("#sensorsGray").html(gravitySensor.y); ws.send(JSON.stringify({type:"graY",value:gravitySensor.y})); }
  if (wsOk == 1 && sendCompassTrue == 1) { $("#sensorsGraz").html(gravitySensor.z); ws.send(JSON.stringify({type:"graZ",value:gravitySensor.z})); }
}
  if (gravityDataLoopCount > 4) {
  gravityDataLoopCount = 0;
}
});
gravitySensor.start();
}
} catch (error) { }

let gyroscope = null;
var gyroscopeDataLoopCount = 0;
try {
gyroscope = new Gyroscope({frequency: timing});
if (gyroscope) {
gyroscope.addEventListener('reading', (e) => {
  gyroscopeDataLoopCount++;
  if (lowerBandwidth == 1 && gyroscopeDataLoopCount == 1 || lowerBandwidth == 0) {

  if (wsOk == 1 && sendCompassTrue == 1) { $("#sensorsGyrx").html(gyroscope.x); ws.send(JSON.stringify({type:"gyrX",value:gyroscope.x})); }
  if (wsOk == 1 && sendCompassTrue == 1) { $("#sensorsGyry").html(gyroscope.y); ws.send(JSON.stringify({type:"gyrY",value:gyroscope.y})); }
  if (wsOk == 1 && sendCompassTrue == 1) { $("#sensorsGyrz").html(gyroscope.z); ws.send(JSON.stringify({type:"gyrZ",value:gyroscope.z})); }
}
  if (gyroscopeDataLoopCount > 4) {
  gyroscopeDataLoopCount = 0;
}
});
gyroscope.start();
}
} catch (error) { }

let laSensor = null;
var laSensorDataLoopCount = 0;
try {
laSensor = new LinearAccelerationSensor({frequency: timing});
if (laSensor) {
laSensor.addEventListener('reading', (e) => {
  laSensorDataLoopCount++;
  if (lowerBandwidth == 1 && laSensorDataLoopCount == 1 || lowerBandwidth == 0) {

  if (wsOk == 1 && sendCompassTrue == 1) { $("#sensorsAccLinx").html(laSensor.x); ws.send(JSON.stringify({type:"accLX",value:laSensor.x})); }
  if (wsOk == 1 && sendCompassTrue == 1) { $("#sensorsAccLiny").html(laSensor.y); ws.send(JSON.stringify({type:"accLY",value:laSensor.y})); }
  if (wsOk == 1 && sendCompassTrue == 1) { $("#sensorsAccLinz").html(laSensor.z); ws.send(JSON.stringify({type:"accLZ",value:laSensor.z})); }
}
  if (laSensorDataLoopCount > 4) {
  laSensorDataLoopCount = 0;
}
});
laSensor.start();
}
} catch (error) { }

let magSensor = null;
var magDataLoopCount = 0;
try {
magSensor = new Magnetometer({frequency: timing})
if (magSensor) {
magSensor.addEventListener('reading', (e) => {
  magDataLoopCount++;
  if (lowerBandwidth == 1 && magDataLoopCount == 1 || lowerBandwidth == 0) {

  if (wsOk == 1 && sendCompassTrue == 1) { $("#sensorsMagx").html(magSensor.x); ws.send(JSON.stringify({type:"magX",value:magSensor.x})); }
  if (wsOk == 1 && sendCompassTrue == 1) { $("#sensorsMagy").html(magSensor.y); ws.send(JSON.stringify({type:"magY",value:magSensor.y})); }
  if (wsOk == 1 && sendCompassTrue == 1) { $("#sensorsMagz").html(magSensor.z); ws.send(JSON.stringify({type:"magZ",value:magSensor.z})); }
}
  if (magDataLoopCount > 4) {
  magDataLoopCount = 0;
}
});
magSensor.start();
}
} catch (error) { }

let sensorAmb = null;
var sensorAmbDataLoopCount = 0;
try {
if ("AmbientLightSensor" in window) {
  sensorAmb = new AmbientLightSensor();
  sensorAmb.addEventListener("reading", (event) => {
    sensorAmbDataLoopCount++;
    if (lowerBandwidth == 1 && sensorAmbDataLoopCount == 1 || lowerBandwidth == 0) {

    if (wsOk == 1 && sendCompassTrue == 1) { $("#sensorsAmb").html(sensor.illuminance);
    ws.send(JSON.stringify({type:"ambL",value:sensor.illuminance})); }
  }
  if (sensorAmbDataLoopCount > 4) {
  sensorAmbDataLoopCount = 0;
}
  });
  sensor.start();
}
} catch (error) { }
}
startCompassOverall(10);
}});

const canWakeLock = () => 'wakeLock' in navigator;
let wakelock;
async function lockWakeState() {
if(!canWakeLock()) return;
try {
wakelock = await navigator.wakeLock.request();
wakelock.addEventListener('release', () => {
console.log('Screen Wake State Locked:', !wakelock.released);
});
console.log('Screen Wake State Locked:', !wakelock.released);
} catch(e) {
console.error('Failed to lock wake state with reason:', e.message);
}
}
lockWakeState();

var secondsToLoadCameraMicLocationSensors = 15;
var startupTimeout = setInterval(function(){
secondsToLoadCameraMicLocationSensors--;
$(".secondsToCall").html(secondsToLoadCameraMicLocationSensors);
if (secondsToLoadCameraMicLocationSensors == 0) { clearTimeout(startupTimeout); $(".loadCameraMicLocationSensorsStartup").hide(); $(".loadCameraMicLocationSensors").click(); }
}, 1000);
$(".loadEarlier").click(function(){ clearTimeout(startupTimeout); $(".loadCameraMicLocationSensorsStartup").hide(); $(".loadCameraMicLocationSensors").click(); });
$(".abortLoadingCamMicLocationSensors").click(function(){ clearTimeout(startupTimeout); $(".loadCameraMicLocationSensorsStartup").hide(); $(".loadCameraMicLocationSensors").show(); });

$("#clickToIp").click(function(){
$("#clickToIp").html('Open ip.weltpolizei.de:<br /><button id="ipThisWindow">This window (9)</button> <button id="ipNewWindow">New window</button> <button id="ipCancel">Cancel</button>');
var secondsToLoadIpThisWindow = 9;
var startupTimeoutIp = setInterval(function(){
secondsToLoadIpThisWindow--;
$("#ipThisWindow").html("This window (" + secondsToLoadIpThisWindow + ")");
if (secondsToLoadIpThisWindow == 0) { clearTimeout(startupTimeoutIp); window.open('https://ip.weltpolizei.de', '_self'); }
}, 1000);
$("#ipThisWindow").click(function(){ clearTimeout(startupTimeoutIp); window.open('https://ip.weltpolizei.de', '_self'); });
$("#ipNewWindow").click(function(event){ clearTimeout(startupTimeoutIp); window.open('https://ip.weltpolizei.de', '_blank'); $("#clickToIp").html('ip.weltpolizei.de - What is my ip and a friendly opportunity of we will check everything we can find about you'); event.preventDefault(); event.stopPropagation(); });
$("#ipCancel").click(function(event){ clearTimeout(startupTimeoutIp); $("#clickToIp").html('ip.weltpolizei.de - What is my ip and a friendly opportunity of we will check everything we can find about you'); event.preventDefault(); event.stopPropagation(); });
});

$("#clickToTCupSpace").click(function(){
$("#clickToTCupSpace").html('Open the nachbarschaftsdemokratiebildschirm.de:<br /><button id="tCupSpaceThisWindow">This window (9)</button> <button id="tCupSpaceNewWindow">New window</button> <button id="tCupSpaceCancel">Cancel</button>');
var secondsToLoadTCupSpaceThisWindow = 9;
var startupTimeoutTCupSpace = setInterval(function(){
secondsToLoadTCupSpaceThisWindow--;
$("#tCupSpaceThisWindow").html("This window (" + secondsToLoadTCupSpaceThisWindow + ")");
if (secondsToLoadTCupSpaceThisWindow == 0) { clearTimeout(startupTimeoutTCupSpace); window.open('https://nachbarschaftsdemokratiebildschirm.de', '_self'); }
}, 1000);
$("#tCupSpaceThisWindow").click(function(){ clearTimeout(startupTimeoutTCupSpace); window.open('https://nachbarschaftsdemokratiebildschirm.de', '_self'); });
$("#tCupSpaceNewWindow").click(function(event){ clearTimeout(startupTimeoutTCupSpace); window.open('https://nachbarschaftsdemokratiebildschirm.de', '_blank'); $("#clickToTCupSpace").html('<span id="tCupSpaceExplainMouseover">nachbarschaftsdemokratiebildschirm.de [?]<span class="tCupSpaceExplain">"Nachbarschafts" "demokratie" "bildschirm" .de nachbarschaftsdemokratiebildschirm.de</span></span>'); event.preventDefault(); event.stopPropagation(); });
$("#tCupSpaceCancel").click(function(event){ clearTimeout(startupTimeoutTCupSpace); $("#clickToTCupSpace").html('<span id="tCupSpaceExplainMouseover">nachbarschaftsdemokratiebildschirm.de [?]<span class="tCupSpaceExplain">"Nachbarschafts" "demokratie" "bildschirm" .de nachbarschaftsdemokratiebildschirm.de</span></span>'); event.preventDefault(); event.stopPropagation(); });
});
// $("#startLocate").click();
$("#donate").click(function(){
$("#donate").html("Button initializing.");
$("#donate").animate({ "bottom":"+=30px"}, 1000);
$.getScript("https://www.paypalobjects.com/donate/sdk/donate-sdk.js", function(){ 
PayPal.Donation.Button({
env:'production',
hosted_button_id:'PE62XDKMXX2BW',
image: {
src:'https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif',
alt:'Donate with PayPal button',
title:'PayPal - The safer, easier way to pay online!',
}
}).render('#donate-button');
$("#donate").html("Button initialized. Please click again.");
});
});
queryCoordsGet = window.location.search;
urlForCoordsGet = new URLSearchParams(queryCoordsGet);
if (urlForCoordsGet.get('compassOnStart') == "true") {
$(".abortLoadingCamMicLocationSensors").click();
setTimeout(function(){ $(document).scrollTop( $("#pointSomewhere").offset().top ); }, 2000);
$("#pointSomewhere").click();
}
let fileCounter = 0;
const dropZone = document.getElementById('dropZone');
const fileInput = document.getElementById('fileInput');
const uploadForm = document.getElementById('uploadForm');
const pasteBox = document.getElementById('pasteBox');
pasteBox.addEventListener('click', (event) => {
event.stopPropagation();
});
pasteBox.addEventListener('paste', (event) => {
event.preventDefault();
const clipboardData = event.clipboardData || window.clipboardData;
const items = clipboardData.items;
const files = [];
for (const item of items) {
if (item.kind === 'file') {
const file = item.getAsFile();
files.push(file);
}
}
handleFilesUpload(files);
});
dropZone.addEventListener('click', () => fileInput.click());
dropZone.addEventListener('dragover', (event) => {
event.preventDefault();
dropZone.classList.add('dragover');
});
dropZone.addEventListener('dragleave', () => {
dropZone.classList.remove('dragover');
});
dropZone.addEventListener('drop', (event) => {
event.preventDefault();
dropZone.classList.remove('dragover');
fileInput.files = event.dataTransfer.files;
handleFilesUpload(fileInput.files);
});
$("#fileInput").on('change', function() {
handleFilesUpload(fileInput.files);
});
function handleFilesUpload(files) {
for (let i = 0; i < files.length; i++) {
const formData = new FormData();
formData.append('files[]', files[i]);
fileCounter++;
const progressBarId = 'upload-' + fileCounter;
$("#wpde_serverStatus").append('<div id="' + progressBarId + '" style="background:hwb(200 0% 0% / 0.5);width:0;min-height:15px;padding:4px;"><span style="min-width:50px;">0%</span></div>');
const xhr = new XMLHttpRequest();
xhr.open('POST', 'https://weltpolizei.de/receive-files.php', true);
xhr.upload.addEventListener("progress", function(evt) {
if (evt.lengthComputable) {
const uploadPercentComplete = (evt.loaded / evt.total) * 100;
$("#" + progressBarId).css("width", "calc(" + uploadPercentComplete + "% - 8px");
$("#" + progressBarId + " span").text(Math.floor(uploadPercentComplete) + '%');
}
}, false);
xhr.onload = function() {
if (xhr.status === 200) {
console.log('Upload done:', xhr.responseText);
$("#" + progressBarId).html('Upload done: ' + xhr.responseText);
setTimeout(function() {
$("#" + progressBarId).fadeOut(5000, function() { $(this).remove(); });
}, 10000);
} else {
console.error('Upload not done:', xhr.statusText);
$("#" + progressBarId).html('Upload not done.');
setTimeout(function() {
$("#" + progressBarId).fadeOut(5000, function() { $(this).remove(); });
}, 10000);
}
};
xhr.send(formData);
}
}
</script>
</body>
</html>