Skip to content

Instantly share code, notes, and snippets.

Noitidart Noitidart

Block or report user

Report or block Noitidart

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Noitidart
Noitidart / _ff-addon-snippet-winapi_setMouseHook.js
Last active Aug 27, 2015
_ff-addon-snippet-winapi_setMouseHook - Uses js-ctypes to set a mouse hook. [jsctypes] [winapi]
View _ff-addon-snippet-winapi_setMouseHook.js
Cu.import('resource://gre/modules/ctypes.jsm');
var is64bit = ctypes.voidptr_t.size == 4 ? false : true;
var ifdef_UNICODE = true;
var TYPES = {
ABI: is64bit ? ctypes.default_abi : ctypes.winapi_abi,
CALLBACK_ABI: is64bit ? ctypes.default_abi : ctypes.stdcall_abi,
BOOL: ctypes.bool,
@Noitidart
Noitidart / bootstrap.js
Created Jan 30, 2014
Demo on how to create ff-addon that listens to page loads and inserts a DIV element into it. This example inserts a blue div 200x200 pixels at top left if mozillazine is found in the address. This demo uses an alternative method to window listeners, it uses the observer service and document-element-inserted, this watches chrome windows which do …
View bootstrap.js
const {interfaces: Ci, utils: Cu} = Components;
Cu.import('resource://gre/modules/Services.jsm');
const locationToMatch = 'mozillazine';
function addDiv(theDoc) {
//Cu.reportError('addDiv');
if (!theDoc) {
Cu.reportError('no theDoc!')
//document not provided, it is undefined likely
return;
@Noitidart
Noitidart / bootstrap.js
Created Feb 2, 2014
This bootstrap addon shows how to add a menu item to the content context menu.
View bootstrap.js
const {interfaces: Ci,utils: Cu} = Components;
Cu.import('resource://gre/modules/Services.jsm');
/*start - windowlistener*/
var windowListener = {
//DO NOT EDIT HERE
onOpenWindow: function (aXULWindow) {
// Wait for the window to finish loading
let aDOMWindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow);
aDOMWindow.addEventListener("load", function () {
@Noitidart
Noitidart / bootstrap.js
Last active Aug 29, 2015 — forked from Noitidart/bootstrap.js
This bootstrap addon shows how to add a menu item to the content context menu. FORK: This fork is different in that it shows how to make that menu item hidden or shown based on if the user opens the popup from a link that contains 'mozilla' in its href.
View bootstrap.js
const {interfaces: Ci,utils: Cu} = Components;
Cu.import('resource://gre/modules/Services.jsm');
/*start - windowlistener*/
var windowListener = {
//DO NOT EDIT HERE
onOpenWindow: function (aXULWindow) {
// Wait for the window to finish loading
let aDOMWindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow);
aDOMWindow.addEventListener("load", function () {
@Noitidart
Noitidart / gist:8906220
Last active Aug 29, 2015
manny42_firefoxExtensionTest_lib_main.js
View gist:8906220
const {Cc, Ci, Cu, components} = require('chrome');
Cu.import('resource://gre/modules/Services.jsm');
var utils = require("sdk/window/utils");
var tabs = require("sdk/tabs");
var self = require("sdk/self");
var data = self.data;
function createPanel() {
var winsize = tabs.activeTab.attach({
View cDumpNeo_bootstrap.js
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
const self = {
id: 'Bootstrap-Skeleton-Plus',
suffix: '@jetpack',
path: 'chrome://bootstrap-skeleton-plus/content/',
aData: 0,
};
const myServices = {};
Cu.import('resource://gre/modules/Services.jsm');
@Noitidart
Noitidart / _scratchpad-AlertWithinScratchpad
Created Feb 17, 2014
In Firefox, when in scratchpad and working in Environment > Browser, if do alert, it alerts in the window behind it, to make the alert happen within the scratchpad window use this technique.
View _scratchpad-AlertWithinScratchpad
var spwin = Services.wm.getMostRecentWindow(null); //this gets the scratchpad window
var str = 'rawr';
var str = str[0].toUpperCase() + str.substr(1);
spwin.alert(str) // will upper case str this is just to demo the alert comes in the scratchpad window
@Noitidart
Noitidart / _ff-addon-snippet-HTTPWraper.js
Last active Aug 29, 2015
_firefox-addon-snippet-HTTPWrapper - Forked from an addon long ago and slightly tweaked here and there. Designed for use in privelaged scope, meaning it does not need access to nsIDOMWindow for any properies or functions.
View _ff-addon-snippet-HTTPWraper.js
var XMLHttpRequest = Cc['@mozilla.org/xmlextras/xmlhttprequest;1'];
var timeoutTimer;
/**
* The following keys can be sent:
* onSuccess (required) a function called when the response is 2xx
* onFailure a function called when the response is not 2xx (IF onFailure and onTimeout are defined, when times out then onTimeout is executed only and not onFailure. IF onFailure is defined and onTimeout is NOT defined then when times out it will execute onFailure) (not called if aborted)
* username The username for basic auth
* password The password for basic auth
* overrideMimeType The mime type to use for non-XML response mime types
* timeout A timeout value in milliseconds for the response
You can’t perform that action at this time.