|
| 1 | +/******************************************************************************* |
| 2 | +
|
| 3 | + httpswitchboard - a Chromium browser extension to black/white list requests. |
| 4 | + Copyright (C) 2014 Contributors to HTTP Switchboard |
| 5 | +
|
| 6 | + This program is free software: you can redistribute it and/or modify |
| 7 | + it under the terms of the GNU General Public License as published by |
| 8 | + the Free Software Foundation, either version 3 of the License, or |
| 9 | + (at your option) any later version. |
| 10 | +
|
| 11 | + This program is distributed in the hope that it will be useful, |
| 12 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | + GNU General Public License for more details. |
| 15 | +
|
| 16 | + You should have received a copy of the GNU General Public License |
| 17 | + along with this program. If not, see {http://www.gnu.org/licenses/}. |
| 18 | +
|
| 19 | + Home: https://github.com/gorhill/httpswitchboard |
| 20 | +*/ |
| 21 | + |
| 22 | +/******************************************************************************/ |
| 23 | + |
| 24 | +(function() { |
| 25 | + |
| 26 | +/******************************************************************************/ |
| 27 | + |
| 28 | +var gotoDashboard = function(which) { |
| 29 | + chrome.runtime.sendMessage({ |
| 30 | + what: 'gotoExtensionURL', |
| 31 | + url: 'dashboard.html#' + which |
| 32 | + }); |
| 33 | +}; |
| 34 | + |
| 35 | +/******************************************************************************/ |
| 36 | + |
| 37 | +var onCommand = function(command) { |
| 38 | + switch ( command ) { |
| 39 | + case 'open-statistics': |
| 40 | + gotoDashboard('statistics'); |
| 41 | + break; |
| 42 | + case 'open-ubiquitous-rules': |
| 43 | + gotoDashboard('ubiquitous-rules'); |
| 44 | + break; |
| 45 | + case 'open-scoped-rules': |
| 46 | + gotoDashboard('scoped-rules'); |
| 47 | + break; |
| 48 | + case 'open-settings': |
| 49 | + gotoDashboard('settings'); |
| 50 | + break; |
| 51 | + } |
| 52 | +}; |
| 53 | + |
| 54 | +/******************************************************************************/ |
| 55 | + |
| 56 | +chrome.commands.onCommand.addListener(onCommand); |
| 57 | + |
| 58 | +/******************************************************************************/ |
| 59 | + |
| 60 | +})(); |
0 commit comments