window.onload = function(){
	var Surl
	chrome.runtime.sendMessage({phrase: "Giff phrase"}, function(response){
			document.getElementById("xphrase").innerHTML = response.phrase;
		});
		
		document.getElementById("WLpage").onclick = function(){
		chrome.storage.local.get("currentURL",function(item){
			Surl = JSON.stringify(item.currentURL);
			chrome.storage.local.clear();
		chrome.storage.sync.get(function(cfg) {
		if(typeof(cfg["whitepage"]) !== 'undefined' && cfg["whitepage"] instanceof Array) { 
		cfg["whitepage"].push(Surl);
		} else {
			cfg["whitepage"] = [Surl];
		}
		chrome.storage.sync.set(cfg);
		});
		});
		
		};
		
		document.getElementById("WLphrase").onclick = function(){
		var phrase = document.getElementById("xphrase").innerHTML;
		chrome.runtime.sendMessage({command: phrase}, function(response){
			console.log(response.feedback);
		});
		this.disabled = true;
		this.innerHTML = "Phrase whitelisted";
	}
		
}

@@ -31,16 +31,101 @@
 ar Surl%0A
+%09// Fetch the detected phrase from the background script and display it on the page.%0A
 %09chrome.
@@ -256,26 +256,76 @@
 phrase;%0A
-%09
 %09%7D);%0A%09
-%09
 %0A%09
+// When user whitelists page, add page to whitelist%0A
 %09documen
@@ -503,24 +503,25 @@
 .clear();%0A%09%09
+%09
 chrome.stora
@@ -548,16 +548,18 @@
 (cfg) %7B%0A
+%09%09
 %09%09if(typ
@@ -637,16 +637,19 @@
 ray) %7B %0A
+%09%09%09
 %09%09cfg%5B%22w
@@ -677,17 +677,26 @@
 ;%0A%09%09
-%7D 
+%09%09%7D %0A%09%09%09%09
 else %7B%0A
+%09%09
 %09%09%09c
@@ -725,14 +725,18 @@
 l%5D;%0A
+%09%09
 %09%09%7D%0A%09%09
+%09
+%09
 chro
@@ -759,24 +759,25 @@
 set(cfg);%0A%09%09
+%09
 %7D);%0A%09%09%7D);%0A%09%09
@@ -779,19 +779,89 @@
 );%0A%09
-%09%0A%09
+%0A
 %09%7D;%0A%09
-%09%0A%09
+// When user adds phrase to whitelist, update trie and disable the button.%0A
 %09doc
@@ -1152,14 +1152,12 @@
 ted%22;%0A%09%7D
-%0A%09
 %09%0A%7D%0A

Clean up alertPhrase.js