Removed older browser stuff.

This commit is contained in:
flash 2024-08-11 23:01:28 +02:00
parent e4b551a789
commit d0ba2970bd
3 changed files with 29 additions and 94 deletions

View file

@ -13,7 +13,7 @@ const exec = require('util').promisify(require('child_process').exec);
public: pathJoin(__dirname, 'public'), public: pathJoin(__dirname, 'public'),
debug: isDebug, debug: isDebug,
swc: { swc: {
es: 'es5', es: 'es2021',
}, },
vars: { vars: {
html: {}, // BUG: if this isn't definited prior, assproc will fail html: {}, // BUG: if this isn't definited prior, assproc will fail

View file

@ -26,10 +26,7 @@ body {
right: 0; right: 0;
height: 25%; height: 25%;
z-index: 0; z-index: 0;
background: -moz-linear-gradient(top, #db5176 0%, #ff9290 100%);
background: -webkit-linear-gradient(top, #db5176 0%, #ff9290 100%);
background: linear-gradient(to bottom, #db5176 0%, #ff9290 100%); background: linear-gradient(to bottom, #db5176 0%, #ff9290 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#db5176', endColorstr='#ff9290', GradientType=0);
} }
.background-gradient-bottom { .background-gradient-bottom {
@ -39,10 +36,7 @@ body {
right: 0; right: 0;
height: 25%; height: 25%;
z-index: 0; z-index: 0;
background: -moz-linear-gradient(top, #ff9290 0%, #4c8999 100%);
background: -webkit-linear-gradient(top, #ff9290 0%, #4c8999 100%);
background: linear-gradient(to bottom, #ff9290 0%, #4c8999 100%); background: linear-gradient(to bottom, #ff9290 0%, #4c8999 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff9290', endColorstr='#4c8999', GradientType=0);
} }
.container { .container {

View file

@ -1,100 +1,41 @@
#vars window build #vars window build
var createXHR = function() { const getRemoteString = url => {
if('all' in document && !('atob' in window) && 'XDomainRequest' in window) return new Promise((resolve, reject) => {
return new XDomainRequest; const xhr = new XMLHttpRequest;
xhr.onload = ev => { resolve(xhr.responseText); };
if('XMLHttpRequest' in window) xhr.onerror = ev => { reject(); };
return new XMLHttpRequest;
if('ActiveXObject' in window)
try {
return new ActiveXObject('Msxml2.XMLHTTP');
} catch(e) {
try {
return new ActiveXObject('Microsoft.XMLHTTP');
} catch(e) {}
}
throw 'no impl';
}
var getRemoteString = function(url, callback) {
try {
var xhr = createXHR();
xhr.onload = function(ev) {
callback({ success: true, info: ev, text: xhr.responseText });
};
xhr.onerror = function(ev) {
callback({ success: false, info: ev });
};
xhr.open('GET', url); xhr.open('GET', url);
xhr.send(); xhr.send();
} catch(ex) { });
callback({ success: false, info: ex });
}
}; };
var copyTextInElement = function(target, skipClipboardAPI) { (async () => {
if(!skipClipboardAPI && 'clipboard' in navigator) { const fields = document.querySelectorAll('.js-address');
// for some reason I'm supporting IE8 with this and it gets mad over the catch keyword... const urls = { ipv4: window.IPV4_LOOKUP, ipv6: window.IPV6_LOOKUP };
navigator.clipboard.writeText(target.textContent)['catch'](function(ex) {
copyTextInElement(target, true);
});
return;
}
if('execCommand' in document) { for(const field of fields) {
if('createTextRange' in document.body) { // MSIE const valueField = field.querySelector('.js-address-value');
var range = document.body.createTextRange(); if(valueField === null)
range.moveToElementText(target); return;
range.select();
} else if('getSelection' in window) { // Mozilla
var select = window.getSelection();
var range = document.createRange();
range.selectNodeContents(target);
select.removeAllRanges();
select.addRange(range);
} else return;
document.execCommand('copy'); valueField.textContent = 'loading...';
return;
}
};
(function() { const subdomain = field.getAttribute('data-subdomain');
var fields = document.querySelectorAll('.js-address'); if(typeof subdomain !== 'string' && !(subdomain in urls))
var urls = { ipv4: window.IPV4_LOOKUP, ipv6: window.IPV6_LOOKUP }; return;
for(var i = 0; i < fields.length; ++i) const copyButton = field.querySelector('.js-address-copy');
(function(field) {
var valueField = field.querySelector('.js-address-value');
if(valueField === null)
return;
var setValueField = function(text) { try {
valueField['textContent' in valueField ? 'textContent' : 'innerText'] = text; const ipAddr = await getRemoteString(urls[subdomain]);
valueField.textContent = ipAddr;
copyButton.onclick = async () => {
await navigator.clipboard.writeText(ipAddr);
}; };
} catch(ex) {
setValueField('loading...'); valueField.textContent = 'not available';
}
var subdomain = field.getAttribute('data-subdomain'); }
if(typeof subdomain !== 'string' && !(subdomain in urls))
return;
var copyButton = field.querySelector('.js-address-copy');
getRemoteString(urls[subdomain], function(info) {
if(!info.success) {
setValueField('not available');
return;
}
setValueField(info.text);
if(copyButton)
copyButton.onclick = function() { copyTextInElement(valueField); };
});
})(fields[i]);
})(); })();