From: Andrew Lorimer Date: Sun, 18 Aug 2019 11:09:24 +0000 (+1000) Subject: remove sites.js and tidy up HTML X-Git-Url: https://git.lorimer.id.au/newtab.git/diff_plain/704b03ae6238b1d9958cf07b9253b49734a8247b remove sites.js and tidy up HTML --- diff --git a/main.js b/main.js index 01b293c..34f7cdc 100644 --- a/main.js +++ b/main.js @@ -129,7 +129,6 @@ function genItem(ul, nme, url) { var img = document.createElement("img"); img.className = "icon"; img.src = "https://www.google.com/s2/favicons?domain=" + url; - img.alt = extractDomain(url, 1); var link = document.createElement("a"); link.className = "item"; diff --git a/newtab.html b/newtab.html index 247621d..b572bfe 100644 --- a/newtab.html +++ b/newtab.html @@ -1,21 +1,26 @@ + + New Tab - - + + e + - + + + + diff --git a/sites.js b/sites.js deleted file mode 100644 index 1598be3..0000000 --- a/sites.js +++ /dev/null @@ -1,49 +0,0 @@ -function extractDomain(url, y) { - var domain; - - //remove protocol - if (url.indexOf("://") > -1) { - domain = url.split('/')[2]; - } - else { - domain = url.split('/')[0]; - } - - //remove port number - domain = domain.split(':')[0]; - - if (y == 1) { - - d = splitHostname(domain); - - if (d.subdomain != "www" && d.subdomain != "") { - return d.subdomain; - } - else { - return d.domain; - } - - } else { - return domain; - } -} - -function addhttp(url) { - if (!/^(f|ht)tps?:\/\//i.test(url)) { - url = "http://" + url; - } - return url; -} - -function splitHostname(h) { - var result = {}; - var urlParts = new RegExp('([a-z\-0-9]{2,63})\.([a-z\.]{2,5})$').exec(h); - if (urlParts == null) { - console.log("Error formatting link " + h); - return ""; - } - result.domain = urlParts[1]; - result.type = urlParts[2]; - result.subdomain = h.replace(result.domain + '.' + result.type, '').slice(0, -1);; - return result; -} diff --git a/style.css b/style.css index 8e6fb74..f36e5d6 100644 --- a/style.css +++ b/style.css @@ -22,7 +22,7 @@ body { justify-content: center; } -.favorites { +#links { display: flex; flex-direction: row; display: -webkit-flex;