- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / docs / examples / api / browserAction / set_page_color / popup.js
1 // Copyright (c) 2012 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
6 function click(e) {
7   chrome.tabs.executeScript(null,
8       {code:"document.body.style.backgroundColor='" + e.target.id + "'"});
9   window.close();
10 }
11
12 document.addEventListener('DOMContentLoaded', function () {
13   var divs = document.querySelectorAll('div');
14   for (var i = 0; i < divs.length; i++) {
15     divs[i].addEventListener('click', click);
16   }
17 });