This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ | |
/* vim: set ts=2 et sw=2 tw=80 filetype=javascript: */ | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | |
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
"use strict"; | |
/** | |
* This module implements a subset of "Task.js" <http://taskjs.org/>. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tabs.on('ready', function(tab) { | |
reportError("tab activated"); | |
let gBrowser = Svc.Services.wm.getMostRecentWindow("navigator:browser").gBrowser; | |
let doc = gBrowser.contentDocument; | |
let browser = gBrowser.getBrowserForDocument(doc); | |
if (browser.engines) { | |
reportError(Object.keys(browser.engines[0])); | |
browser.engines.forEach(function({uri, title, icon}) { | |
let type = (/xml$/).test(uri) ? Ci.nsISearchEngine.DATA_XML : Ci.nsISearchEngine.DATA_TEXT; | |
let e = Svc.Services.search.currentEngine; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getDominantColor(aImg) { | |
let canvas = document.createElement("canvas"); | |
canvas.height = aImg.height; | |
canvas.width = aImg.width; | |
let context = canvas.getContext("2d"); | |
context.drawImage(aImg, 0, 0); | |
// keep track of how many times a color appears in the image | |
let colorCount = {}; |