OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium 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 |
| 5 function injectScripts(opt_tab) { |
| 6 chrome.tabs.executeScript({ |
| 7 file: 'lib/axs_testing.js', |
| 8 allFrames: true |
| 9 }, function() { |
| 10 console.log('successfully injected axs_testing.js'); |
| 11 chrome.tabs.executeScript({ |
| 12 file: 'hide-images.js', |
| 13 allFrames: true |
| 14 }, function() { |
| 15 console.log('successfully injected script', opt_tab ? opt_tab.url : ''); |
| 16 chrome.tabs.insertCSS({ |
| 17 file: 'hide-images.css', |
| 18 allFrames: true |
| 19 }, function() { |
| 20 console.log('successfully injected css', opt_tab ? opt_tab.url : ''); |
| 21 chrome.tabs.executeScript({ |
| 22 code: 'toggleEnabled();', |
| 23 allFrames: true |
| 24 }, function() { |
| 25 console.log('created infobar'); |
| 26 chrome.tabs.executeScript({ |
| 27 code: 'createInfobar();' |
| 28 }); |
| 29 }); |
| 30 }); |
| 31 }); |
| 32 }); |
| 33 } |
| 34 |
| 35 chrome.commands.onCommand.addListener(function(command) { |
| 36 console.log('command: ', command); |
| 37 if (command == 'example_keyboard_command') { |
| 38 injectScripts(); |
| 39 } |
| 40 }); |
| 41 |
| 42 chrome.browserAction.onClicked.addListener(function(tab) { |
| 43 injectScripts(tab); |
| 44 }); |
| 45 |
OLD | NEW |