{
"manifest_version": 2,
"name": "my extension",
"description": "Search the KB - More features coming soon",
"version": "1.4",
"permissions": [
"tabs",
"http://*/*",
"https://*/*"
],
"commands": {
"open-site": {
"suggested_key": {
"windows": "Ctrl+Shift+P",
"mac": "Command+Shift+P"
},
"description": "Opens site"
}
},
"browser_action": {
"default_title": "Search the KB!",
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"background": {
"scripts": ["background.js"]
}
}
background.js:
//document.addEventListener("click", searchThis, false);
//document.addEventListener("click",gotoKB, false);
var d = new Date();
var dateNumber = d.getDay();
var t = new Date();
var hoursLogout = t.getHours();
var m = new Date();
var minutesLogout = m.getMinutes();
var logoutTime = hoursLogout+minutesLogout
chrome.commands.onCommand.addListener(function(command) {
if (command === 'open-site') {
console.log("We did it!");
chrome.tabs.create({'url': "mywebsite"});
}
});
//opens the KB and searches using keyword from popup.html form
function searchThis() {
var search = document.getElementById("searchID")
chrome.tabs.create({'url': "website" + search.value});
}
//simply opens the KB
function gotoKB() {
chrome.tabs.create({'url': "website"});
}
//Makes Chrome remind you to do your timecard on Fridays every 4 hours
if (!document.cookie.match(/(?:^|; *)alert_timecard=1/) && dateNumber == 5) {
alert("Don't forget your timecards :)");
document.cookie = "alert_timecard=1;max-age=" + 60 * 60 * 4;
};
//Makes Chrome
if (!document.cookie.match(/(?:^|; *)alert_logout=1/) && logoutTime == 72) {
alert("Don't forget to logout!");
document.cookie = "alert_logout=1;max-age=" + 60 * 60 * 1;
};
//initializign listeners
var searchBtn = document.getElementById("searchBtn");
var kbBTN = document.getElementById("kbBtn");
searchBtn.addEventListener("click",searchThis,false);
kbBTN.addEventListener("click",gotoKB,false);
Thanks in advanced for any help. Right now, nothing shows in the console either.
--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/30c39550-a291-4687-b244-e10699bbd996%40chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/groups/opt_out.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.