From: Andrew Lorimer Date: Mon, 19 Aug 2019 08:58:59 +0000 (+1000) Subject: clean up manifest X-Git-Url: https://git.lorimer.id.au/newtab.git/diff_plain/d5857088321df2367e89fc705be855856d4719e5 clean up manifest --- diff --git a/bin/newtab.crx b/bin/newtab.crx deleted file mode 100644 index 5f58c29..0000000 Binary files a/bin/newtab.crx and /dev/null differ diff --git a/bin/newtab.pem b/bin/newtab.pem deleted file mode 100644 index b83a7a9..0000000 --- a/bin/newtab.pem +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDGI+f+O+G9o1AH -XPkj/eaNfZ6rnhpQ3UURkckXT/NIdN25Md763IY+QuWEF1rbU56mua1BR49Of3L7 -JfZ3abBnJyiJbp4amKILrXqoHKxwUFSb4MMVR4vfzy7U91Ko7K7F0Jorog+plGGT -XpZsqaAa1bNI7XKEkGj5K2/20ErZXERVugz/KFlPiaBjevW29JzEMtCnYk5Iug6l -+PAVzgGUm94f4MjFoZ98Y20sKpMdFV4l6uyxzEaZXl8h0YLy+VXTAcgBj9aFXWbH -BOPRyI3tl9aoLwdzCZnJLVs5nbZ40MNYx0LL8mOp71fjoCJlnWblVuKSw3rZsy3j -H3iswn+1AgMBAAECggEAAmLhwdJl11llcamT3ZgPxfYPa57Rbig0XYrsaYufWfgz -dpmYcEeO/BcOABd+UHgjGc35YVALeaCfolt8xD1Rc/6AGI9N7ZbzjpNTpHBtkKmD -KrUavfYQtItoJXY2/FDer7x7QCATXp0QyLt+kq7Y7u+PxOBGkFEwHfpYGtrusjyN -SfquI4zR0Tb3UIQVYJN60K6+LVp8kFUj4tcPXKL+vnSeyFgPrgzL5Pn4tDyKI+3q -Eg2UFni8ZDI3Y0Wb0y+9mxiYZVhmrzuSRqUcV7zf9hisRthUf8nsP+OCZ6kln7dk -6Gb3BRHooJel3ur+6mHbLQWJMJR1HMjP62yu1CPJcQKBgQDixrTeRXNDVCUg2gb4 -6G9Lp/FrANVDPfaSpMkeTDWi1RpOaSkKdIZWC3+TnJeUWHNvf9enShLQtCLLMK6V -2/C2EfvtgJ7ZkzAE8y9FBNfAsN6lEzPpXUpXzq6rb0gL3amqHR/lyT24oNEssnxA -yct68EZM3lF8rF3YfVpljSoGwwKBgQDfrIG+vQDTJ9IIjZel+reX5Rqwjmlxm2oM -sgZeDim48FabBotqwU49gDd6p4/JAg8YH60fCck+A15Tu08fYNBsftEjC/hY+LYA -HbmP1sTkWluH/Qq+P1wtTrILtPGBvmw6ddFg5DOSnKvFUcLC2tSHsjNCm9TgJFqb -LAW7aa8oJwKBgG4er5V/hAkdwynAtcIInILQeprLPMP6QtHS0xazSxhXAv8wcY1y -KAmAa+LyF2khymxKWB4UCi7uSjcA3MZIlwrSkNMzse9VWewNatbJEzuup27hdEPN -2VvqMUduMj4Q1WKV4fdjUWVmMizSPyP22ahJJNoO2uL/kFKgDFVjxxShAoGBAIqO -HO0fvWQQFb5wn5EUxyfTpv3Zqh3S7RWiLemTkmrajnuHyVM/HY1hYHydUadtnBYQ -gThp4nyEr6jkrfW9Dj83K6wvHQ9YOb3GrA0bOGpQQsTxjfcd3qa+SfKQis4ZPIfW -NfZ0RjI61PjtVd1Im0DXtYM8btjODEZ1NbPLmtIfAoGAeIOZneR8SvcDkv/NgYtN -4xt9ftcbGwIWgjgar9diSgOUgOUDEk0AAkx+CNNYVBJf6eYZdc71I2sBumNqKcE4 -+TJzYywWQvEmRudg2kapZcNYMVZUNU+1+MEtvKn8f8q0istXr5+Lhb5PE+yBcirt -kwdy2Y0qIBaUnJwx8jNhT+o= ------END PRIVATE KEY----- diff --git a/main.js b/main.js index 2993dfc..3af538f 100644 --- a/main.js +++ b/main.js @@ -7,6 +7,7 @@ var hoverbg = "#434c5e"; var hoverbg2 = "#848ead"; var editMode = false; var dragSrcEl = null; +var thumbServer = "https://www.google.com/s2/favicons?domain="; var defaultColumns= [ ["General", ["Github", "https://github.com"], @@ -83,6 +84,7 @@ function parseColumns(config) { } } + function genColumn(title) { // Generate HTML elements for a column (without items) @@ -117,6 +119,7 @@ function genColumn(title) { } + function genItem(ul, nme, url) { // Generate HTML elements for an item @@ -125,9 +128,7 @@ function genItem(ul, nme, url) { li.setAttribute("class", ul.id + "-" + (ul.getElementsByTagName("li").length + 1).toString() ); li.addEventListener("mouseup", saveConfig); - var img = document.createElement("img"); - img.className = "icon"; - img.src = "https://www.google.com/s2/favicons?domain=" + url; + var img = requestThumbnail(url); var link = document.createElement("a"); link.className = "item"; @@ -149,6 +150,23 @@ function genItem(ul, nme, url) { } +function requestThumbnail(imageUrl) { + // Get thumbnail from Google's favicon server + var img = document.createElement("img"); + var xhr = new XMLHttpRequest(); + xhr.open('GET', thumbServer + imageUrl); + xhr.responseType = "blob"; + xhr.onload = function() { + img.setAttribute("data-src", thumbServer + imageUrl); + img.className = "icon"; + var objUrl = URL.createObjectURL(xhr.response); + img.setAttribute("src", objUrl); + }.bind(this); + xhr.send(); + return img; +} + + // -------------------------------- // // Edit mode diff --git a/manifest.json b/manifest.json index db02f70..320055b 100644 --- a/manifest.json +++ b/manifest.json @@ -5,10 +5,11 @@ "content_security_policy": "script-src 'self'; object-src 'self'", "manifest_version": 2, "name": "newtab", + "description": "A simple new tab page with customisable links", "options_ui": { "chrome_style": true, "page": "options.html" }, - "permissions": [ "management", "storage"], - "version": "1" + "permissions": [ "storage" ], + "version": "2" }