clean up manifest
authorAndrew Lorimer <andrew@lorimer.id.au>
Mon, 19 Aug 2019 08:58:59 +0000 (18:58 +1000)
committerAndrew Lorimer <andrew@lorimer.id.au>
Mon, 19 Aug 2019 08:58:59 +0000 (18:58 +1000)
bin/newtab.crx [deleted file]
bin/newtab.pem [deleted file]
main.js
manifest.json
diff --git a/bin/newtab.crx b/bin/newtab.crx
deleted file mode 100644 (file)
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 (file)
index b83a7a9..0000000
+++ /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 2993dfcf22a1fdf131d48cee52fcd32252f7fe7b..3af538f7857854c43f3a391643cb0b0111d5200d 100644 (file)
--- a/main.js
+++ b/main.js
@@ -7,6 +7,7 @@ var hoverbg = "#434c5e";
 var hoverbg2 = "#848ead";
 var editMode = false;
 var dragSrcEl = null;
 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"],
 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)
 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
 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);
 
   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";
 
   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
 // --------------------------------
 //
 // Edit mode
index db02f70e28e8c810aa984b2a39155c4818dac921..320055b959580bce3661ab9bc817ddc0b65bedf6 100644 (file)
@@ -5,10 +5,11 @@
    "content_security_policy": "script-src 'self'; object-src 'self'",
    "manifest_version": 2,
    "name": "newtab",
    "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"
    },
    "options_ui": {
       "chrome_style": true,
       "page": "options.html"
    },
-   "permissions": [ "management", "storage"],
-   "version": "1"
+   "permissions": [ "storage" ],
+   "version": "2"
 }
 }