Subversion Repositories oidplus

Rev

Rev 891 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
635 daniel-mar 1
/*
2
 * OIDplus 2.0
3
 * Copyright 2019 - 2021 Daniel Marschall, ViaThinkSoft
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 *     http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
 
18
var OIDplusPagePublicWhois = {
19
 
890 daniel-mar 20
        openInBrowser: function() {
21
                var url = $("#whois_url_bar")[0].innerText;
22
                //document.location.href = url;
23
                window.open(url);
24
        },
25
 
635 daniel-mar 26
        refresh_whois_url_bar: function() {
891 daniel-mar 27
                var query = "";
28
                // -------------------------------------------------------------
29
                var obj = $("#whois_query")[0].value.trim();
30
                var tmp = obj.split(":");
31
                var ns = tmp.shift();
32
                var id = tmp.join(":");
33
                if (!/^[a-z0-9]+$/.test(ns) || id.includes("$")) {
34
                        $("#whois_query_invalid")[0].style.display = "Inline";
35
                } else {
36
                        $("#whois_query_invalid")[0].style.display = "None";
37
                }
38
                query = ns + ":" + id;
39
                // -------------------------------------------------------------
890 daniel-mar 40
                var format = "text";
635 daniel-mar 41
                var radios = $("[name=format]");
42
                for (var i = 0, length = radios.length; i < length; i++) {
43
                        if (radios[i].checked) {
44
                                format = radios[i].value;
45
                        }
46
                }
890 daniel-mar 47
                if (format != "text") query += "$format="+format;
891 daniel-mar 48
                // -------------------------------------------------------------
890 daniel-mar 49
                var auth = $("#whois_auth")[0].value;
891 daniel-mar 50
                var invalid_tokens = false;
51
                if (auth != "") {
52
                        var tokens = auth.split(",");
53
                        for (var i=0; i<tokens.length; i++) {
54
                                var token = tokens[i];
55
                                if ((token == "") || token.includes("$") || token.includes("=")) {
56
                                        invalid_tokens = true;
57
                                        break;
58
                                }
59
                                tokens[i] = token.trim();
60
                        }
61
                        auth = tokens.join(",");
62
                }
63
                if (invalid_tokens) {
64
                        $("#whois_auth_invalid")[0].style.display = "Inline";
65
                        auth = "";
66
                } else {
67
                        $("#whois_auth_invalid")[0].style.display = "None";
68
                }
890 daniel-mar 69
                if (auth != "") query += "$auth="+auth;
891 daniel-mar 70
                // -------------------------------------------------------------
1288 daniel-mar 71
                $("#whois_url_bar")[0].innerText = getSystemUrl(false) + 'plugins/viathinksoft/publicPages/100_whois/whois/webwhois.php?query=' + encodeURIComponent(query);
891 daniel-mar 72
                $("#whois_query_bar")[0].innerText = query;
635 daniel-mar 73
        }
74
 
75
};