Skip to content

Instantly share code, notes, and snippets.

@yajd
yajd / 9244868.xpi
Last active August 29, 2015 13:56
_template-ff-addon-BootstrapWatchHostProgListener - A template for bootstrapped Firefox addon that uses progress listeners to watch for page loads and when a page load matches host that you specify it will inject to it.
@yajd
yajd / test.js
Created February 28, 2014 22:47
checking var types with obj.getproto
<!DOCTYPE html>
<html>
<body>
<script>
/*
function Animal() {}
var b = new Animal;
@yajd
yajd / cDump alt.js
Last active August 29, 2015 13:56
Alternative to cDump
//from ff privelage scope
Services.appShell.hiddenDOMWindow.console
//from non-priv scope just do console.log or console.ingo
//docs here: https://developer.mozilla.org/en-US/docs/Web/API/console.info
@yajd
yajd / _js-tutorial-CustomObjects.js
Last active August 29, 2015 13:56
_js-tutorial-CustomObjectsAndPrototype - I finally learned and understood custom objects AND prototype. Start with learning prototype in this tutorial "[The prototype object of JavaScript](http://www.javascriptkit.com/javatutors/proto.shtml)" and when you get to the "[Creating custom objects in JavaScript](http://javascriptkit.com/javatutors/obj…
//dummy just see the description
//i had one question, on the final page of the prototype tut (4th page)
//create dummy object
function dummy(){
}
//Create custom property
function dummyproperty(){
}
@yajd
yajd / _ff-addon-snippet-PrettyPrintFromVariableViewConsoleLog.js
Last active August 29, 2015 13:56
_ff-addon-snippet-PrettyPrintFromVariableViewConsoleLog - Instead of cDump, do Services.appShell.hiddenDOMWindow.console.log or console.info then can view absoultely everything in VariableViewer in Browser Console. However cannot make file of it and diff so I am creating this snippet that prints the current variable dump in VariableViewer into a…
function takeToTabTheCurViewVar() { //whatever var is currently showing is printed to tab
var opts = {
title: 'inaugral',
maxDepth: 0,
varName: 'window'
};
var me = Services.wm.getMostRecentWindow(null);
var console = Services.appShell.hiddenDOMWindow.console;
@yajd
yajd / _noitidart.github.io
Last active August 29, 2015 13:56
todo: noitidart.github.io
in chrome
-the class sicial_icons is blocked by adblock
-on refresh or tab dupe the form doent remember
contact:
5px padding on boxes is making it exceed form width, one soln is to set width to 300px (right now is 100%)
_ig-commit - 3/3/14
fixed form
@yajd
yajd / gist:9381436
Created March 6, 2014 03:01
_ff-addon-snippet-TwoPartToolbarButton - This makes a different panel open depending on if you click the left part or the right part of the toolbar button.
var doc = document; //to put this back in sdk do const doc = require('sdk/window/utils').getMostRecentBrowserWindow().document;
var navBar = doc.getElementById('nav-bar')
var btn = doc.createElement('toolbarbutton');
btn.setAttribute('id', 'hylytit');
btn.setAttribute('type', 'menu-button');
btn.setAttribute('class', 'toolbarbutton-1');
btn.setAttribute('image', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAPCAYAAADtc08vAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2hpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA
@yajd
yajd / gist:9381934
Last active August 29, 2015 13:57
_ff-addon-snippet-FindAndSelectAllNonFindBar - wip i dont understand the state listener stuff
var doc = gBrowser.contentDocument;
var ctrler = _getSelectionController(doc.defaultView);
var searchRange = doc.createRange();
searchRange.selectNodeContents(doc.documentElement);
let startPt = searchRange.cloneRange();
startPt.collapse(true);
let endPt = searchRange.cloneRange();
@yajd
yajd / bootstrap.js
Last active August 29, 2015 13:57
HighlightOnSelection inital.rev1 work
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
const self = {
id: 'HilteOnSelection',
suffix: '@jetpack',
path: 'chrome://hiliteonselection/content/',
aData: 0,
};
const myServices = {};
Cu.import('resource://gre/modules/Services.jsm');
@yajd
yajd / gist:9421328
Created March 7, 2014 22:13
Alertnative to DOMNodeInsetd MutEvent that doent use MutObs: http://stackoverflow.com/questions/6997826/alternative-to-domnodeinserted#10343915
@keyframes nodeInserted {
from {
outline-color: #fff;
}
to {
outline-color: #000;
}
}
div.some-control {