-
Notifications
You must be signed in to change notification settings - Fork 0
/
background.js
43 lines (35 loc) · 1.4 KB
/
background.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Called when a message is passed. We assume that the content script
// wants to show the page action.
// function onRequest(request, sender, sendResponse) {
// // Show the page action for the tab that the sender (content script)
// // was on.
// chrome.pageAction.show(sender.tab.id);
// // $('body').highlight('with');//, "onur");
// // $('.highlight').data({ placement: 'n' });
// chrome.browserAction.onClicked.addListener(function(tab) {
// chrome.tabs.executeScript({
// code: 'document.body.style.backgroundColor="red"'
// });
// });
// // alert("Zaaa");
// // Return nothing to let the connection be cleaned up.
// sendResponse({});
// };
chrome.browserAction.onClicked.addListener(function(tab) {
7 // No tabs or host permissions needed!
8 console.log('Turning ' + tab.url + ' red!');
9 chrome.tabs.executeScript({
10 code: 'document.body.style.backgroundColor="red"'
11 });
12 });
// chrome.tabs.executeScript( {
// code: "window.getSelection().toString();"
// }, function(selection) {
// document.getElementById("output").value = selection[0];
// alert(selection[0]);
// });
// Listen for the content script to send a message to the background page.
// chrome.extension.onRequest.addListener(onRequest);