Skip to content

Instantly share code, notes, and snippets.

@Noitidart
Noitidart / _example-TwitterRequestToken-PLAINTEXT.js
Created February 20, 2014 12:08
_example-TwitterRequestToken-PLAINTEXT
Cu.import('chrome://cdumpjsm/content/cDump.jsm');
initSHA1(this); //onload must run this once
var HTTPMethod = 'POST';
var requestURL = 'https://api.twitter.com/oauth/request_token';
var APIKey = 'AjONvgAdbD8YWCtRn5U9yA'; //also known as oauth_consumer_key //from your app page on twitter dev site
var ConsumerSecret = 'jrcJKxvJ92NeeV48RL1lotN9PigbxCCbqUkKj237yio'; //from your app page on twitter dev site
var OAuthTokenSecret = '';
var param = {
@Noitidart
Noitidart / _ff-addon-snippet-XulPanelAnimShowAnimHide.js
Last active August 29, 2015 13:56
_ff-addon-snippet-XulPanelAnimShowAnimHide - Copy paste script for Firefox Scratchpad with Environment set to Browser. It adds a panel as type arrow. All type arrow panels are animated on show but not on out, this snippet makes it animate on hide as well. Option to remove panel on end of animation or just hide it (see comments one Line 18 and 19…
var win = Services.wm.getMostRecentWindow('navigator:browser');
var panel = win.document.createElement('panel');
var props = {
type: 'arrow',
style: 'width:300px;height:100px;'
}
for (var p in props) {
panel.setAttribute(p, props[p]);
}
@Noitidart
Noitidart / _ff-addon-snippet-RedirectChannel.js
Last active September 10, 2015 17:40
_ff-addon-snippet-RedirectChannel: This snippet uses observer service and http-on-modify-request to listen to if google.com is loaded and it redirects to bing.com. A Firefox addon snippet that must be run from privelaged scope.
Cu.import('resource://gre/modules/Services.jsm');
var httpRequestObserver =
{
observe: function(subject, topic, data)
{
var httpChannel, requestURL;
if (topic == 'http-on-modify-request') {
httpChannel = subject.QueryInterface(Ci.nsIHttpChannel);
@Noitidart
Noitidart / _template-BootstrapSQLite.js
Created February 26, 2014 08:11
_template-BootstrapSQLite - Bare bones of bootstrapped SQLite addon
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
const self = {
id: 'Floppers',
suffix: '@jetpack',
path: 'chrome://floppers/content/',
aData: 0,
};
const myServices = {};
Cu.import('resource://gre/modules/Services.jsm');
@Noitidart
Noitidart / _template_construction-RoarPanelMessages.htm
Last active August 29, 2015 13:56
_template_construction-RoarPanelMessages - HTML panels with style for message displaying. Forked from builder.addons.mozilla.org.
<div style="left: 10px; top: 10px;" class="roar-body">
<div id="shipyard-hrtypyw7" style="opacity: 1;" class="roar error"><div style="" class="roar-bg"></div><div class="roar-icon"></div><h3>Install Add-on Builder Helper</h3><p>To test this add-on, please install the <a id="install_addon_helper" href="https://addons.mozilla.org/firefox/downloads/latest/182410?src=external-builder">Add-on Builder Helper add-on</a></p></div>
<div id="shipyard-hrtypyw7" style="opacity: 1;" class="roar warning"><div style="" class="roar-bg"></div><div class="roar-icon"></div><h3>Install Add-on Builder Helper</h3><p>To test this add-on, please install the <a id="install_addon_helper" href="https://addons.mozilla.org/firefox/downloads/latest/182410?src=external-builder">Add-on Builder Helper add-on</a></p></div>
<div id="shipyard-hrtypyw7" style="opacity: 1;" class="roar message"><div style="" class="roar-bg"></div><div class="roar-icon"></div><h3>Install Add-on Builder Helper</h3><p>To test this add-on, please install the <a id
@Noitidart
Noitidart / _snippet-ff-addon-AppendFlag.js
Created February 27, 2014 07:16
_snippet-ff-addon-AppendFlag - This is a snippet to show you how to append a flag to existing flags. Plan to figure out how to remove a flag from existing flags.
var loadFlags = chan.loadFlags;
if (chan.URI.schemeIs("https"))
loadFlags &= ~chan.INHIBIT_PERSISTENT_CACHING; //the &= ~ will add it
@Noitidart
Noitidart / _template-ff-addon-BootstrapURLIconWidget.xpi
Last active December 15, 2017 07:55 — forked from Noitidart/bootstrap.js
_template-ff-addon-BootstrapURLIconWidget - This bootstrap addon shows how to add an icon to the URL bar and when clicked it opens a panel.
@Noitidart
Noitidart / _ff-addon-template-BootstrapWatchHostEventListener.xpi
Last active August 29, 2015 13:56 — forked from Noitidart/_template-bootstrapSkeleton.xpi
_ff-addon-template-BootstrapWatchHostEventListener - Uses event listener (DOMContentLoaded) to watch page loads in all tabs and windows with gBrowser. When a page matching a certain host name is found it will inject into it. It also shows you how to attach event listeners to injected elements and elements that were already in the webpage.
@Noitidart
Noitidart / _ff-addon-template-BootstrapCustomEventListeners.xpi
Last active August 29, 2015 13:56 — forked from Noitidart/_ff-addon-template-BootstrapWatchHostEventListener.xpi
_ff-addon-template-BootstrapAddEventListenerCustomEvent.xpi - This shows how to listen to and respond to custom events dispatched by web pages.
@Noitidart
Noitidart / _ff-addon-snippet-OpenNewTabGetIframeHtml.js
Created March 1, 2014 23:17
_ff-addon-snippet-OpenNewTabGetIframeHtml - This snippet must run in privelaged scope. It opens a new tab and messages you when it loads, and it looks for all iframes in that new tab and messages you when iframes contentDocument is ready and populated. I do need a better way to test if iframe is loading/loaded on initial run of the getIframeHtml…
Components.utils.import('resource://gre/modules/Services.jsm')
var aDOMWindow = Services.wm.getMostRecentWindow('navigator:browser');
var newTabBrowser = aDOMWindow.gBrowser.getBrowserForTab(aDOMWindow.gBrowser.loadOneTab('http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_tolocaletimestring', {
inBackground: false
}));
newTabBrowser.addEventListener('load', function onloadFunc() {
Services.appShell.hiddenDOMWindow.console.log('tab loaded');
newTabBrowser.removeEventListener('load', arguments.callee, true);
var doc = newTabBrowser.contentDocument;
var win = doc.defaultView;