]> git.wh0rd.org - chrome-ext/waterfall-buildbot-clicker.git/blame - background.js
initial code
[chrome-ext/waterfall-buildbot-clicker.git] / background.js
CommitLineData
55314fcf
MF
1// Copyright 2014 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5var storage = chrome.storage.local;
6
7// When visiting a waterfall page, show the icon.
8console.log('going...');
9chrome.webNavigation.onCommitted.addListener(function(e) {
10 setIcon(e.tabId);
11}, {url: [{hostEquals: 'uberchromegw.corp.google.com'},
12 {hostEquals: 'chromegw.corp.google.com'}]});
13
14function onClicked(tab) {
15 if (window.confirm('nuke them all?')) {
16 chrome.tabs.executeScript(tab.id, {
17 'file': 'click_all.js'
18 });
19 }
20}
21
22chrome.pageAction.onClicked.addListener(onClicked);
23
24function setIcon(tabId) {
25 //chrome.pageAction.setPopup({'tabId':tabId, 'popup':'popup.html'});
26 chrome.pageAction.setIcon({'tabId':tabId, 'path':'icon-96x96.png'});
27 chrome.pageAction.setTitle({'tabId':tabId, 'title':'Nuke It'});
28 chrome.pageAction.show(tabId);
29}