OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 // Store settings in the synchronized repository. |
| 6 var storage = chrome.experimental.storage.sync; |
| 7 var message = document.querySelector('#message'); |
| 8 |
| 9 // Check if there is CSS specified. |
| 10 storage.get('css', function(items) { |
| 11 console.log(items); |
| 12 // If there is CSS specified, inject it into the page. |
| 13 if (items.css) { |
| 14 chrome.tabs.insertCSS(null, {code: items.css}, function() { |
| 15 if (chrome.extension.lastError) { |
| 16 message.innerText = 'Not allowed to inject CSS into special page.'; |
| 17 } else { |
| 18 message.innerText = 'Injected style!'; |
| 19 } |
| 20 }); |
| 21 } else { |
| 22 var optionsUrl = chrome.extension.getURL('options.html'); |
| 23 message.innerHTML = 'Set a style in the <a target="_blank" href="' + |
| 24 optionsUrl + '">options page</a> first.'; |
| 25 } |
| 26 }); |
| 27 |
OLD | NEW |