diff --git a/public/assets/2021whois.js b/public/assets/2021whois.js index 0429029..1f18499 100644 --- a/public/assets/2021whois.js +++ b/public/assets/2021whois.js @@ -2,7 +2,8 @@ var locked = false, input = document.getElementById('lookup-input'), submit = document.getElementById('lookup-submit'), - result = document.getElementById('lookup-result'); + result = document.getElementById('lookup-result'), + tabs = document.getElementById('lookup-tabs'); var lock = function() { if(locked) @@ -32,41 +33,45 @@ xhr.addEventListener('load', function() { var resp = JSON.parse(xhr.responseText); - if(resp.error) { + if(resp.error) alert(resp.text); - } else { - var lastWhois = resp.result.responses[resp.result.responses.length - 1], - isIpAddr = false; - for(var i = 0; i < lastWhois.lines.length; ++i) { - var line = lastWhois.lines[i]; - if(line.substring(0, 4) === 'inet') { - isIpAddr = true; - break; - } + tabs.innerHTML = ''; + if(resp.result && resp.result.responses) { + for(var i = 0; i < resp.result.responses.length; ++i) { + (function(response) { + var tab = document.createElement('a'), + tabHeader = document.createElement('div'), + tabServer = document.createElement('div'); + + tab.href = 'javascript:;'; + tab.className = 'whois-result-tab'; + if(i === 0) tab.className += ' whois-result-tab-active'; + + tab.onclick = function() { + var active = document.querySelector('.whois-result-tab-active'); + if(active) active.classList.remove('whois-result-tab-active'); + tab.classList.add('whois-result-tab-active'); + result.textContent = response.lines.join("\r\n").trim(); + }; + + tabHeader.className = 'whois-result-tab-header'; + tabHeader.textContent = i === 0 ? 'Result' : ('Hop #' + (resp.result.responses.length - i).toString()); + + tabServer.className = 'whois-result-tab-server'; + tabServer.textContent = response.server; + console.log(response); + + tab.appendChild(tabHeader); + tab.appendChild(tabServer); + tabs.appendChild(tab); + })(resp.result.responses[i]); } - - var text = ''; - - if(isIpAddr) { - text += 'RESULTS FOUND: ' + resp.result.responses.length.toString() + "\r\n"; - for(var i = 0; i < resp.result.responses.length; ++i) { - var response = resp.result.responses[i]; - text += "\r\n-------------\r\n"; - text += 'Lookup results for ' + resp.result.target + ' from ' + response.server + ":\r\n\r\n"; - text += response.lines.join("\r\n").trim() + "\r\n"; - } - } else { - for(var i = 0; i < resp.result.responses.length; ++i) { - var response = resp.result.responses[i]; - text += resp.result.target + ' domain lookup result from ' + response.server + "\r\n\r\n"; - text += response.lines.join("\r\n").trim() + "\r\n\r\n"; - } - } - - result.textContent = text; } + if(tabs.firstChild) + tabs.firstChild.click(); + unlock(); }); xhr.open('GET', '/whois/lookup?target=' + encodeURIComponent(target)); diff --git a/public/assets/2022.css b/public/assets/2022.css new file mode 100644 index 0000000..63d6744 --- /dev/null +++ b/public/assets/2022.css @@ -0,0 +1,12 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; + position: relative; + outline-style: none; +} + +html, body { + width: 100%; + height: 100%; +} diff --git a/public/css/2021.css b/public/css/2021.css index 0e41c91..c695ee3 100644 --- a/public/css/2021.css +++ b/public/css/2021.css @@ -1182,3 +1182,43 @@ body { .whois-locked .whois-result { opacity: .5; } + +.whois-result-tabs { + display: flex; + margin: 0 5px; +} +.whois-locked .whois-result-tabs { + opacity: .5; +} +.whois-result-tab { + margin: 0 5px; + padding: 6px 10px; + font-size: 14px; + transition: opacity .2s; + background-color: #202020; + border-radius: 5px; + box-shadow: 0 1px 5px #222; + opacity: .5; + cursor: pointer; + display: block; + color: #fff; + text-decoration: none; +} +.whois-result-tab:hover, +.whois-result-tab:focus { + opacity: .7; +} +.whois-result-tab-active { + opacity: 1 !important; +} +.whois-result-tab-header { + font-size: 1.3em; + line-height: 1.2em; +} +.whois-result-tab-server { + font-size: .9em; + line-height: 1.2em; + color: #888; + white-space: pre-wrap; + font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; +} diff --git a/public/userscripts/index.php b/public/userscripts/index.php deleted file mode 100644 index 04e02ce..0000000 --- a/public/userscripts/index.php +++ /dev/null @@ -1,59 +0,0 @@ - 'remove-trending-tab.user.js', - 'name' => 'Remove the Youtube Trending Tab', - ], - [ - 'file' => 'skip-youtube-home.user.js', - 'name' => 'Skip the Youtube homepage and go straight to subscriptions', - ], - [ - 'file' => 'mpvfriend.user.js', - 'name' => 'Open youtube links in mpv', - ], -]; - -$userstyles = [ - [ - 'file' => 'sock-emote-overflow-fix.user.css', - 'name' => 'Fix emoticon overflow in sock chat client', - ], - [ - 'file' => 'nabucco-cleanup.user.css', - 'name' => 'Cleaner nabucco', - ], -]; -?> -