mail2-nixos-config/hopglass-frontend/app.js

254 lines
712 KiB
JavaScript
Raw Normal View History

2024-12-30 13:36:07 +01:00
/**
* @license almond 0.3.3 Copyright jQuery Foundation and other contributors.
* Released under MIT license, http://github.com/requirejs/almond/LICENSE
*/
/*
Leaflet, a JavaScript library for mobile-friendly interactive maps. http://leafletjs.com
(c) 2010-2013, Vladimir Agafonkin
(c) 2010-2011, CloudMade
*/
/**
* chroma.js - JavaScript library for color conversions
*
* Copyright (c) 2011-2019, Gregor Aisch
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name Gregor Aisch may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* -------------------------------------------------------
*
* chroma.js includes colors from colorbrewer2.org, which are released under
* the following license:
*
* Copyright (c) 2002 Cynthia Brewer, Mark Harrower,
* and The Pennsylvania State University.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*
* ------------------------------------------------------
*
* Named colors are taken from X11 Color Names.
* http://www.w3.org/TR/css3-color/#svg-color
*
* @preserve
*/
/*
Leaflet.label, a plugin that adds labels to markers and vectors for Leaflet powered maps.
(c) 2012-2013, Jacob Toye, Smartrak
https://github.com/Leaflet/Leaflet.label
http://leafletjs.com
https://github.com/jacobtoye
*/
// NLS maps are copyright National library of Scotland.
/*!
* Cross-Browser Split 1.1.1
* Copyright 2007-2012 Steven Levithan <stevenlevithan.com>
* Available under the MIT License
* ECMAScript compliant, uniform cross-browser split method
*/
/*!
* numeral.js
* version : 1.5.3
* author : Adam Draper
* license : MIT
* http://adamwdraper.github.com/Numeral-js/
*/
/*!
* tablesort v3.0.2 (2015-02-25)
* http://tristen.ca/tablesort/demo/
* Copyright (c) 2015 ; Licensed MIT
*/
/*!
* numeral.js language configuration
* language : belgium-dutch (be-nl)
* author : Dieter Luypaert : https://github.com/moeriki
*/
/*!
* numeral.js language configuration
* language : simplified chinese
* author : badplum : https://github.com/badplum
*/
/*!
* numeral.js language configuration
* language : czech (cs)
* author : Anatoli Papirovski : https://github.com/apapirovski
*/
/*!
* numeral.js language configuration
* language : danish denmark (dk)
* author : Michael Storgaard : https://github.com/mstorgaard
*/
/*!
* numeral.js language configuration
* language : German in Switzerland (de-ch)
* author : Michael Piefel : https://github.com/piefel (based on work from Marco Krage : https://github.com/sinky)
*/
/*!
* numeral.js language configuration
* language : German (de) generally useful in Germany, Austria, Luxembourg, Belgium
* author : Marco Krage : https://github.com/sinky
*/
/*!
* numeral.js language configuration
* language : english united kingdom (uk)
* author : Dan Ristic : https://github.com/dristic
*/
/*!
* numeral.js language configuration
* language : spanish Spain
* author : Hernan Garcia : https://github.com/hgarcia
*/
/*!
* numeral.js language configuration
* language : spanish
* author : Hernan Garcia : https://github.com/hgarcia
*/
/*!
* numeral.js language configuration
* language : Estonian
* author : Illimar Tambek : https://github.com/ragulka
*
* Note: in Estonian, abbreviations are always separated
* from numbers with a space
*/
/*!
* numeral.js language configuration
* language : Finnish
* author : Sami Saada : https://github.com/samitheberber
*/
/*!
* numeral.js language configuration
* language : french (Canada) (fr-CA)
* author : Léo Renaud-Allaire : https://github.com/renaudleo
*/
/*!
* numeral.js language configuration
* language : french (fr-ch)
* author : Adam Draper : https://github.com/adamwdraper
*/
/*!
* numeral.js language configuration
* language : french (fr)
* author : Adam Draper : https://github.com/adamwdraper
*/
/*!
* numeral.js language configuration
* language : Hungarian (hu)
* author : Peter Bakondy : https://github.com/pbakondy
*/
/*!
* numeral.js language configuration
* language : italian Italy (it)
* author : Giacomo Trombi : http://cinquepunti.it
*/
/*!
* numeral.js language configuration
* language : japanese
* author : teppeis : https://github.com/teppeis
*/
/*!
* numeral.js language configuration
* language : netherlands-dutch (nl-nl)
* author : Dave Clayton : https://github.com/davedx
*/
/*!
* numeral.js language configuration
* language : polish (pl)
* author : Dominik Bulaj : https://github.com/dominikbulaj
*/
/*!
* numeral.js language configuration
* language : portuguese brazil (pt-br)
* author : Ramiro Varandas Jr : https://github.com/ramirovjr
*/
/*!
* numeral.js language configuration
* language : portuguese (pt-pt)
* author : Diogo Resende : https://github.com/dresende
*/
/*!
* numeral.js language configuration
* language : russian (ru)
* author : Anatoli Papirovski : https://github.com/apapirovski
*/
/*!
* numeral.js language configuration
* language : slovak (sk)
* author : Ahmed Al Hafoudh : http://www.freevision.sk
*/
/*!
* numeral.js language configuration
* language : thai (th)
* author : Sathit Jittanupat : https://github.com/jojosati
*/
/*!
* numeral.js language configuration
* language : turkish (tr)
* author : Ecmel Ercan : https://github.com/ecmel, Erhan Gundogan : https://github.com/erhangundogan, Burak Yiğit Kaya: https://github.com/BYK
*/
(function(){function r(e){return new Promise(function(t,n){var r=new XMLHttpRequest;r.open("GET",e),r.onload=function(){r.status==200?t(r.response):n(Error(r.statusText))},r.onerror=function(){n(Error("Network Error"))},r.send()})}function i(e){return r(e).then(JSON.parse)}function s(e,t){return t.slice().sort(function(t,n){return t[e]-n[e]}).reverse()}function o(e,t,n){return n.filter(function(n){return n[e].isAfter(t)})}function u(e){return e.reduce(function(e,t){return e+t},0)}function a(){return 1}function f(e){return e===undefined?!0:e}function l(e,t){var n=t.shift();return n in e?t.length==0?e[n]:l(e[n],t):null}function c(){var e="test";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(t){return!1}}function h(e,t){for(key in t){var n=new RegExp(key,"g");e=e.replace(n,t[key])}return e}function p(e){return!e.flags.online}function d(e){return e.flags.online}function v(e){return"location"in e.nodeinfo&&Math.abs(e.nodeinfo.location.latitude)<90&&Math.abs(e.nodeinfo.location.longitude)<180}function m(e,t){var n={};return t.forEach(function(e){n[e.nodeinfo.node_id]=!0}),e.filter(function(e){return!(e.nodeinfo.node_id in n)})}function g(e){if(isNaN(e.distance))return;return numeral(e.distance).format("0,0")+" m"}function y(e){return numeral(1/e.tq).format("0%")}function b(e,t,n){if(n===null||n==undefined)return;var r=document.createElement("tr"),i=document.createElement("th");typeof t=="string"?i.textContent=t:(i.appendChild(t),r.className="routerpic"),r.appendChild(i);var s=document.createElement("td");return typeof n=="function"?n(s):s.appendChild(document.createTextNode(n)),r.appendChild(s),e.appendChild(r),s}function w(e,t,n){return el=document.createElement("iframe"),t=typeof t!="undefined"?t:"100%",n=typeof n!="undefined"?n:"350px",e.src?el.src=e.src:el.src=e,e.frameBorder?el.frameBorder=e.frameBorder:el.frameBorder=1,e.width?el.width=e.width:el.width=t,e.height?el.height=e.height:el.height=n,el.scrolling="no",el.seamless="seamless",el}function E(e,t){var n,r;t=typeof t!="undefined"?t:{},e.thumbnail&&(n=document.createElement("img"),n.src=h(e.thumbnail,t)),e.caption&&(r=h(e.caption,t),n||(n=document.createTextNode(r))),e.iframe&&(n=w(e.iframe,e.width,e.height),e.iframe.src?n.src=h(e.iframe.src,t):n.src=h(e.iframe,t));var i=document.createElement("p");if(e.href){var s=document.createElement("a");s.target="_blank",s.href=h(e.href,t),s.appendChild(n),r&&e.thumbnail&&(s.title=r),i.appendChild(s)}else i.appendChild(n);return i}function S(e){if(!e.clients)return[];var t=Math.max(e.clients.total-e.clients.wifi,0),n=Math.max(e.clients.wifi-e.clients.wifi24-e.clients.wifi5,0),r=e.clients.wifi24,i=e.clients.wifi5;return[{count:t,label:"Kabel",color:"#E3A619"},{count:n,label:"Sonstige Wifi",color:"#D10E2A"},{count:r,label:"2.4GHz",color:"#DC0067"},{count:i,label:"5GHz",color:"#0A9C92"}]}function x(e,t){var n=S(e),r=n.map(function(e){return e.count}).reduce(function(e,t){return e+t},0),i;for(var s=0;s<n.length;s++)t<r&&(i=n[s].color),r-=n[s].count;return i}var e,t,n;(function(r){function v(e,t){return h.call(e,t)}function m(e,t){var n,r,i,s,o,u,a,f,c,h,p,v,m=t&&t.split("/"),g=l.map,y=g&&g["*"]||{};if(e){e=e.split("/"),o=e.length-1,l.nodeIdCompat&&d.test(e[o])&&(e[o]=e[o].replace(d,"")),e[0].charAt(0)==="."&&m&&(v=m.slice(0,m.length-1),e=v.concat(e));for(c=0;c<e.length;c++){p=e[c];if(p===".")e.splice(c,1),c-=1;else if(p===".."){if(c===0||c===1&&e[2]===".."||e[c-1]==="..")continue;c>0&&(e.splice(c-1,2),c-=2)}}e=e.join("/")}if((m||y)&&g){n=e.split("/");for(c=n.length;c>0;c-=1){r=n.slice(0,c).join("/");if(m)for(h=m.length;h>0;h-=1){i=g[m.slice(0,h).join("/")];if(i){i=i[r];if(i){s=i,u=c;break}}}if(s)break;!a&&y&&y[r]&&(a=y[r],f=c)}!s&&a&&(s=a,u=f),s&&(n.splice(0,u,s),e=n.join("/"))}return e}function g(e,t){return function(){var n=p.call(arguments,0);return typeof n[0]!="string"&&n.length===1&&n.push(null),s.apply(r,n.concat([e,t]))}}function y(e){return function(t){return m(t,e)}}function b(e){return function(t){a[e]=t}}function w(e){if(v(f,e)){var t=f[e];delete f[e],c[e]=!0,i.apply(r,t)}if(!v(a,e)&&!v(c,e))th