Skip to content

Commit

Permalink
Add option page
Browse files Browse the repository at this point in the history
  • Loading branch information
christianesperar committed Jul 8, 2018
1 parent ad57c6f commit ce55fda
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"name":"Remove Most Visited Pages","short_name":"RMVP","description":"Remove Most Visited Pages by redirecting the new tab page to Google homepage","icons":{"16":"icons/16.png","48":"icons/48.png","128":"icons/128.png"},"author":"Christian Esperar","version":"2.1.0","incognito":"split","chrome_url_overrides":{"newtab":"blank.html"},"manifest_version":2,"content_scripts":[{"matches":["*://www.google.com/*","*://www.google.ad/*","*://www.google.ae/*","*://www.google.com.af/*","*://www.google.com.ag/*","*://www.google.com.ai/*","*://www.google.al/*","*://www.google.am/*","*://www.google.co.ao/*","*://www.google.com.ar/*","*://www.google.as/*","*://www.google.at/*","*://www.google.com.au/*","*://www.google.az/*","*://www.google.ba/*","*://www.google.com.bd/*","*://www.google.be/*","*://www.google.bf/*","*://www.google.bg/*","*://www.google.com.bh/*","*://www.google.bi/*","*://www.google.bj/*","*://www.google.com.bn/*","*://www.google.com.bo/*","*://www.google.com.br/*","*://www.google.bs/*","*://www.google.bt/*","*://www.google.co.bw/*","*://www.google.by/*","*://www.google.com.bz/*","*://www.google.ca/*","*://www.google.cd/*","*://www.google.cf/*","*://www.google.cg/*","*://www.google.ch/*","*://www.google.ci/*","*://www.google.co.ck/*","*://www.google.cl/*","*://www.google.cm/*","*://www.google.cn/*","*://www.google.com.co/*","*://www.google.co.cr/*","*://www.google.com.cu/*","*://www.google.cv/*","*://www.google.com.cy/*","*://www.google.cz/*","*://www.google.de/*","*://www.google.dj/*","*://www.google.dk/*","*://www.google.dm/*","*://www.google.com.do/*","*://www.google.dz/*","*://www.google.com.ec/*","*://www.google.ee/*","*://www.google.com.eg/*","*://www.google.es/*","*://www.google.com.et/*","*://www.google.fi/*","*://www.google.com.fj/*","*://www.google.fm/*","*://www.google.fr/*","*://www.google.ga/*","*://www.google.ge/*","*://www.google.gg/*","*://www.google.com.gh/*","*://www.google.com.gi/*","*://www.google.gl/*","*://www.google.gm/*","*://www.google.gp/*","*://www.google.gr/*","*://www.google.com.gt/*","*://www.google.gy/*","*://www.google.com.hk/*","*://www.google.hn/*","*://www.google.hr/*","*://www.google.ht/*","*://www.google.hu/*","*://www.google.co.id/*","*://www.google.ie/*","*://www.google.co.il/*","*://www.google.im/*","*://www.google.co.in/*","*://www.google.iq/*","*://www.google.is/*","*://www.google.it/*","*://www.google.je/*","*://www.google.com.jm/*","*://www.google.jo/*","*://www.google.co.jp/*","*://www.google.co.ke/*","*://www.google.com.kh/*","*://www.google.ki/*","*://www.google.kg/*","*://www.google.co.kr/*","*://www.google.com.kw/*","*://www.google.kz/*","*://www.google.la/*","*://www.google.com.lb/*","*://www.google.li/*","*://www.google.lk/*","*://www.google.co.ls/*","*://www.google.lt/*","*://www.google.lu/*","*://www.google.lv/*","*://www.google.com.ly/*","*://www.google.co.ma/*","*://www.google.md/*","*://www.google.me/*","*://www.google.mg/*","*://www.google.mk/*","*://www.google.ml/*","*://www.google.com.mm/*","*://www.google.mn/*","*://www.google.ms/*","*://www.google.com.mt/*","*://www.google.mu/*","*://www.google.mv/*","*://www.google.mw/*","*://www.google.com.mx/*","*://www.google.com.my/*","*://www.google.co.mz/*","*://www.google.com.na/*","*://www.google.com.nf/*","*://www.google.com.ng/*","*://www.google.com.ni/*","*://www.google.ne/*","*://www.google.nl/*","*://www.google.no/*","*://www.google.com.np/*","*://www.google.nr/*","*://www.google.nu/*","*://www.google.co.nz/*","*://www.google.com.om/*","*://www.google.com.pa/*","*://www.google.com.pe/*","*://www.google.com.pg/*","*://www.google.com.ph/*","*://www.google.com.pk/*","*://www.google.pl/*","*://www.google.pn/*","*://www.google.com.pr/*","*://www.google.ps/*","*://www.google.pt/*","*://www.google.com.py/*","*://www.google.com.qa/*","*://www.google.ro/*","*://www.google.ru/*","*://www.google.rw/*","*://www.google.com.sa/*","*://www.google.com.sb/*","*://www.google.sc/*","*://www.google.se/*","*://www.google.com.sg/*","*://www.google.sh/*","*://www.google.si/*","*://www.google.sk/*","*://www.google.com.sl/*","*://www.google.sn/*","*://www.google.so/*","*://www.google.sm/*","*://www.google.sr/*","*://www.google.st/*","*://www.google.com.sv/*","*://www.google.td/*","*://www.google.tg/*","*://www.google.co.th/*","*://www.google.com.tj/*","*://www.google.tk/*","*://www.google.tl/*","*://www.google.tm/*","*://www.google.tn/*","*://www.google.to/*","*://www.google.com.tr/*","*://www.google.tt/*","*://www.google.com.tw/*","*://www.google.co.tz/*","*://www.google.com.ua/*","*://www.google.co.ug/*","*://www.google.co.uk/*","*://www.google.com.uy/*","*://www.google.co.uz/*","*://www.google.com.vc/*","*://www.google.co.ve/*","*://www.google.vg/*","*://www.google.co.vi/*","*://www.google.com.vn/*","*://www.google.vu/*","*://www.google.ws/*","*://www.google.rs/*","*://www.google.co.za/*","*://www.google.co.zm/*","*://www.google.co.zw/*","*://www.google.cat/*"],"css":["search.css"],"js":["search.js"],"run_at":"document_start"}]}
{"name":"Remove Most Visited Pages","short_name":"RMVP","description":"Remove Most Visited Pages by redirecting the new tab page to Google homepage","icons":{"16":"icons/16.png","48":"icons/48.png","128":"icons/128.png"},"author":"Christian Esperar","version":"2.1.0","incognito":"split","chrome_url_overrides":{"newtab":"blank.html"},"permissions":["storage"],"options_page":"options/options.html","manifest_version":2,"content_scripts":[{"matches":["*://www.google.com/*","*://www.google.ad/*","*://www.google.ae/*","*://www.google.com.af/*","*://www.google.com.ag/*","*://www.google.com.ai/*","*://www.google.al/*","*://www.google.am/*","*://www.google.co.ao/*","*://www.google.com.ar/*","*://www.google.as/*","*://www.google.at/*","*://www.google.com.au/*","*://www.google.az/*","*://www.google.ba/*","*://www.google.com.bd/*","*://www.google.be/*","*://www.google.bf/*","*://www.google.bg/*","*://www.google.com.bh/*","*://www.google.bi/*","*://www.google.bj/*","*://www.google.com.bn/*","*://www.google.com.bo/*","*://www.google.com.br/*","*://www.google.bs/*","*://www.google.bt/*","*://www.google.co.bw/*","*://www.google.by/*","*://www.google.com.bz/*","*://www.google.ca/*","*://www.google.cd/*","*://www.google.cf/*","*://www.google.cg/*","*://www.google.ch/*","*://www.google.ci/*","*://www.google.co.ck/*","*://www.google.cl/*","*://www.google.cm/*","*://www.google.cn/*","*://www.google.com.co/*","*://www.google.co.cr/*","*://www.google.com.cu/*","*://www.google.cv/*","*://www.google.com.cy/*","*://www.google.cz/*","*://www.google.de/*","*://www.google.dj/*","*://www.google.dk/*","*://www.google.dm/*","*://www.google.com.do/*","*://www.google.dz/*","*://www.google.com.ec/*","*://www.google.ee/*","*://www.google.com.eg/*","*://www.google.es/*","*://www.google.com.et/*","*://www.google.fi/*","*://www.google.com.fj/*","*://www.google.fm/*","*://www.google.fr/*","*://www.google.ga/*","*://www.google.ge/*","*://www.google.gg/*","*://www.google.com.gh/*","*://www.google.com.gi/*","*://www.google.gl/*","*://www.google.gm/*","*://www.google.gp/*","*://www.google.gr/*","*://www.google.com.gt/*","*://www.google.gy/*","*://www.google.com.hk/*","*://www.google.hn/*","*://www.google.hr/*","*://www.google.ht/*","*://www.google.hu/*","*://www.google.co.id/*","*://www.google.ie/*","*://www.google.co.il/*","*://www.google.im/*","*://www.google.co.in/*","*://www.google.iq/*","*://www.google.is/*","*://www.google.it/*","*://www.google.je/*","*://www.google.com.jm/*","*://www.google.jo/*","*://www.google.co.jp/*","*://www.google.co.ke/*","*://www.google.com.kh/*","*://www.google.ki/*","*://www.google.kg/*","*://www.google.co.kr/*","*://www.google.com.kw/*","*://www.google.kz/*","*://www.google.la/*","*://www.google.com.lb/*","*://www.google.li/*","*://www.google.lk/*","*://www.google.co.ls/*","*://www.google.lt/*","*://www.google.lu/*","*://www.google.lv/*","*://www.google.com.ly/*","*://www.google.co.ma/*","*://www.google.md/*","*://www.google.me/*","*://www.google.mg/*","*://www.google.mk/*","*://www.google.ml/*","*://www.google.com.mm/*","*://www.google.mn/*","*://www.google.ms/*","*://www.google.com.mt/*","*://www.google.mu/*","*://www.google.mv/*","*://www.google.mw/*","*://www.google.com.mx/*","*://www.google.com.my/*","*://www.google.co.mz/*","*://www.google.com.na/*","*://www.google.com.nf/*","*://www.google.com.ng/*","*://www.google.com.ni/*","*://www.google.ne/*","*://www.google.nl/*","*://www.google.no/*","*://www.google.com.np/*","*://www.google.nr/*","*://www.google.nu/*","*://www.google.co.nz/*","*://www.google.com.om/*","*://www.google.com.pa/*","*://www.google.com.pe/*","*://www.google.com.pg/*","*://www.google.com.ph/*","*://www.google.com.pk/*","*://www.google.pl/*","*://www.google.pn/*","*://www.google.com.pr/*","*://www.google.ps/*","*://www.google.pt/*","*://www.google.com.py/*","*://www.google.com.qa/*","*://www.google.ro/*","*://www.google.ru/*","*://www.google.rw/*","*://www.google.com.sa/*","*://www.google.com.sb/*","*://www.google.sc/*","*://www.google.se/*","*://www.google.com.sg/*","*://www.google.sh/*","*://www.google.si/*","*://www.google.sk/*","*://www.google.com.sl/*","*://www.google.sn/*","*://www.google.so/*","*://www.google.sm/*","*://www.google.sr/*","*://www.google.st/*","*://www.google.com.sv/*","*://www.google.td/*","*://www.google.tg/*","*://www.google.co.th/*","*://www.google.com.tj/*","*://www.google.tk/*","*://www.google.tl/*","*://www.google.tm/*","*://www.google.tn/*","*://www.google.to/*","*://www.google.com.tr/*","*://www.google.tt/*","*://www.google.com.tw/*","*://www.google.co.tz/*","*://www.google.com.ua/*","*://www.google.co.ug/*","*://www.google.co.uk/*","*://www.google.com.uy/*","*://www.google.co.uz/*","*://www.google.com.vc/*","*://www.google.co.ve/*","*://www.google.vg/*","*://www.google.co.vi/*","*://www.google.com.vn/*","*://www.google.vu/*","*://www.google.ws/*","*://www.google.rs/*","*://www.google.co.za/*","*://www.google.co.zm/*","*://www.google.co.zw/*","*://www.google.cat/*"],"css":["search.css"],"js":["search.js"],"run_at":"document_start"}]}
2 changes: 1 addition & 1 deletion dist/search.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
"chrome_url_overrides": {
"newtab": "blank.html"
},
"permissions": [
"storage"
],
"options_page": "options/options.html",
"manifest_version": 2,
"content_scripts": [
{
Expand Down
18 changes: 18 additions & 0 deletions src/options/options.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<html>
<head>
<title>Remove Most Visited Pages Options</title>
<script type="text/javascript" src="options.js"></script>
</head>

<body class="rmvp">
<h1>Remove Most Visited Pages Options</h1>
<p>
<label>
<input type="checkbox" class="rvmp__checkbox">
Go directly to the website if search query is url format
</label>
</p>

<button id="rmvp__save">Save</button>
</body>
</html>
33 changes: 33 additions & 0 deletions src/options/options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const RMVPOptions = {
/**
* Attach events once DOM contents are loaded
* @return void
*/
onLoad: () => {
[RMVPOptions.inputs, RMVPOptions.button] = [
document.getElementsByClassName('rvmp__checkbox'),
document.getElementById('rmvp__save'),
];
// Go directly to the website if search query is url format
const urlRedirection = RMVPOptions.inputs[0];

// Get options set by the user
chrome.storage.sync.get([
'RMVP_Options_UrlRedirection',
], (result) => {
// Go directly to the website if search query is url format
urlRedirection.checked = [undefined, true].indexOf(result.RMVP_Options_UrlRedirection) > -1;
});

// Update options set by the user
RMVPOptions.button.addEventListener('click', () => {
chrome.storage.sync.set({
RMVP_Options_UrlRedirection: urlRedirection.checked,
}, () => {
// Do something
});
});
},
};

document.addEventListener('DOMContentLoaded', RMVPOptions.onLoad, false);
8 changes: 7 additions & 1 deletion src/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ const RMVP = {
return true;
}

RMVP.search.addEventListener('keydown', keyEvent);
// Get options set by the user
chrome.storage.sync.get(['RMVP_Options_UrlRedirection'], (result) => {
// Check if url redirection features is set
if ([undefined, true].indexOf(result.RMVP_Options_UrlRedirection) > -1) {
RMVP.search.addEventListener('keydown', keyEvent);
}
});
},
};

Expand Down

0 comments on commit ce55fda

Please sign in to comment.