Skip to content

Instantly share code, notes, and snippets.

View fontdetector.js
function getFont(element) {
// create canvas in owner doc to get @font-face fonts
var doc = element.ownerDocument;
var canvas = doc.createElement("canvas");
var context = canvas.getContext("2d");
if(!context.measureText)
return "Text";
var style = doc.defaultView.getComputedStyle(element, null);
View getAllStyleSheets.js
function allStyleSheets(doc) {
var stylesheets = [];
for(var i = 0; i < doc.styleSheets.length; i++)
stylesheets = stylesheets.concat(getStyleSheets(doc.styleSheets[i]));
return stylesheets;
}
function getStyleSheets(stylesheet) {
if(!stylesheet)
return []; // Firefox protects against @import statement loops
View report_couchdb.py
import httplib
import json
result = {
"firefox": {
"build_id": "20100401064631",
"version": "3.6.3"
},
"run_id": 0,
"timestamp": 1279376772,
View gist:557129
properties of jquery couchdb's 'db' object:
name
uri
compact
viewCleanup
compactView
create
drop
info
changes
View securable-module.diff
diff --git a/Users/harth/jetpack-sdk/packages/jetpack-core/lib/securable-module.js b/mozmill/mozmill/extension/resource/modules/securable-module.js
index 57173a9..794c3e2 100644
--- a/Users/harth/jetpack-sdk/packages/jetpack-core/lib/securable-module.js
+++ b/mozmill/mozmill/extension/resource/modules/securable-module.js
@@ -204,7 +204,6 @@
};
return chrome;
}
-
var path = self.fs.resolveModule(rootDir, module);
View gist:563250
Components.utils.import("resource://gre/modules/ctypes.jsm");
var EXPORTED_SYMBOLS = ["open"];
nspr = ctypes.open('/Applications/Minefield.app/Contents/MacOS/libnspr4.dylib');
var PR_AF_INET = 2;
var port = 2387;
View Jakefile.js
/*
Turns CommonJS package into a browser file.
Minifying requires UglifyJS (http://github.com/mishoo/UglifyJS)
to be in the dir above this one.
uses node-jake http://github.com/mde/node-jake
run with 'jake [build|minify|clean]'
*/
var fs = require("fs"),
path = require("path"),
View menus.diff
diff --git a/mozmill/mozmill/extension/resource/modules/controller.js b/mozmill/mozmill/extension/resource/modules/controller.js
index ffd8467..64f5ea3 100644
--- a/mozmill/mozmill/extension/resource/modules/controller.js
+++ b/mozmill/mozmill/extension/resource/modules/controller.js
@@ -100,47 +100,6 @@ waitForEvents.prototype = {
}
}
-/**
- * Dynamically create hierarchy of available menu entries
@harthur
harthur / modal_dialog.diff
Created Nov 22, 2010
Mozmill modal dialog shared module refactor
View modal_dialog.diff
# HG changeset patch
# Parent 6585aa4bca819847388eb3ea0e43622b0f9739e0
# User Henrik Skupin <hskupin@mozilla.com>
Bug 560820 - Refactor modal dialog to lower count of test failures. r=ctalbert
diff --git a/shared-modules/modal-dialog.js b/shared-modules/modal-dialog.js
--- a/shared-modules/modal-dialog.js
+++ b/shared-modules/modal-dialog.js
@@ -42,144 +42,101 @@
*
@harthur
harthur / dnd.js
Created Dec 7, 2010
mozmill drag and drop shared module WIP
View dnd.js
var EventUtils = {}; Components.utils.import('resource://mozmill/stdlib/EventUtils.js', EventUtils);
var dragBy = function(element, offsetX, offsetY, contentWindow) {
var rect = element.getBoundingClientRect();
var startX = (rect.right - rect.left)/2;
var startY = (rect.bottom - rect.top)/2;
var incrementX = offsetX / 2;
var incrementY = offsetY / 2;
EventUtils.synthesizeMouse(