Advertisement
xkeshav

popup.js

Oct 16th, 2014
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. debugger;
  2. chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
  3.     chrome.browserAction.getTitle({tabId: tabs[0].id}, function(result) {
  4.         console.log( tabId + "==Browser action title==", result);
  5.     });
  6. });
  7.  
  8. function click(e) {
  9.   // console.log(e.target);
  10.   chrome.tabs.executeScript(null, {
  11.     code:"document.body.style.backgroundColor='" + e.target.className + "'"
  12.   });
  13.   window.close();
  14. }
  15.  
  16. document.addEventListener('DOMContentLoaded', function () {
  17.   var li = document.querySelectorAll('li');
  18.   for (var i = 0; i < li.length; i++) {
  19.     li[i].addEventListener('click', click);
  20.   }
  21. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement