jase
5/4/2018 - 9:47 AM

Createing a WHOIS Checker Tutorial - Sample

<!doctype html>
<html lang="en-us">
    <head>
        <meta charset="utf-8" />
        <meta name="author" content="jAsE" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />

        <title>rantApp</title>
        <style>
            table {
                width: 100%;
                background-color: whitesmoke;
            }

            tr {
                width: auto;
                padding: 7px;
            }

            th {
                background-color: #f1f1f1;
                text-align: left;
                padding: 7px;
                width: 50%;
            }
        </style>
    </head>
    <body>
        <p>Hello.</p>
        <table id="table">
            <tr>
                <th>Record</th>
                <th>Content</th>
            </tr>
            <tr></tr>
        </table>

        <script>
            var whois = require("whois");
            var parser = require("parse-whois");

            whois.lookup("twitter.com", function(err, data) {
                var parsedData = parser.parseWhoIsData(data);
                var table = document.getElementById("table");

                for(var record of parsedData) {
                    var tableRow = table.insertRow(parsedData.indexOf(record + 1));
                    var attributeCell = tableRow.insertCell(0);
                    var valueCell = tableRow.insertCell(1);

                    attributeCell.innerHTML = record.attribute;
                    valueCell.innerHTML = record.value;
                }
            });
        </script>
    </body>
</html>
const {
    app, BrowserWindow
} = require("electron");

const path = require("path");
const url = require("url");

function createWindow() {
    browserWindow = new BrowserWindow({
        width: 800, height: 600
    });

    browserWindow.loadURL(url.format({
        pathname: path.join(__dirname, "main.html"),
        protocol: "file:",
        slashes: true
    }));
}

app.on("ready", createWindow);