Skip to content

Instantly share code, notes, and snippets.

@Infocatcher
Infocatcher / timer.js
Last active August 29, 2015 13:58
SetTimer() lib for AkelPad (test version)
// http://akelpad.sourceforge.net/forum/viewtopic.php?p=24559#24559
// http://infocatcher.ucoz.net/js/akelpad_scripts/Include/timer.js
// https://github.com/Infocatcher/AkelPad_scripts/blob/master/Include/timer.js
// (c) Infocatcher 2014
// version 0.1.0 - 2014-04-06
// Helper functions for user32::SetTimer()
// Usage example:
/*
// http://akelpad.sourceforge.net/forum/viewtopic.php?p=21354#21354
// http://infocatcher.ucoz.net/js/akelpad_scripts/winMergeTabs.js
// https://github.com/Infocatcher/AkelPad_scripts/blob/master/winMergeTabs.js
// (c) Infocatcher 2013
// version 0.1.1.1 - 2013-08-07
// Compare contents of current and next selected tab using WinMerge (http://winmerge.org/)
// or any other compare tool
@Infocatcher
Infocatcher / redirector.js
Last active August 29, 2015 13:57
Redirector example for Gecko 20+
// https://gist.github.com/Infocatcher/9523286
// 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/.
// Redirector example for Gecko 20+
// (c) Infocatcher 2014 <https://github.com/Infocatcher>
Services.obs.addObserver(observer, "http-on-modify-request", false);
@Infocatcher
Infocatcher / createDownloadStack.js
Created February 19, 2014 13:08
Call stack for last DownloadStore.prototype.load() -> Downloads.createDownload(), https://github.com/Infocatcher/Download_Panel_Tweaker/issues/5
before@resource://gre/modules/XPIProvider.jsm -> .../[email protected]!/bootstrap.js:492
wrapper@chrome://downloadpaneltweaker/content/patcher.jsm:36
task_DS_load@resource://gre/modules/DownloadStore.jsm:120
TaskImpl_run@resource://gre/modules/Task.jsm:233
resolve@resource://gre/modules/commonjs/sdk/core/promise.js:118
then@resource://gre/modules/commonjs/sdk/core/promise.js:43
then@resource://gre/modules/commonjs/sdk/core/promise.js:153
TaskImpl_handleResultValue@resource://gre/modules/Task.jsm:269
TaskImpl_run@resource://gre/modules/Task.jsm:235
resolve@resource://gre/modules/commonjs/sdk/core/promise.js:118
@Infocatcher
Infocatcher / downloads.json
Created February 18, 2014 07:22
Test for https://github.com/Infocatcher/Download_Panel_Tweaker/issues/5, place it into Firefox profile to receive "Error: too much recursion Source file: resource://gre/modules/commonjs/sdk/core/promise.js Line: 110"
{
"list": [
{
"source": "http://example.com",
"target": "D:\\foo.htm",
"startTime": "2020-01-01T00:00:00.000Z",
"succeeded": true,
"totalBytes": 666
},
{
@Infocatcher
Infocatcher / leakTestWindow.js
Created December 28, 2013 20:28
Test Firefox/SeaMonkey extension for memory leaks: automatically opens/closes browser windows. First appears here: https://github.com/Infocatcher/Private_Tab/issues/45#issuecomment-17063542
var count = 25;
var delay = 1000;
function leakTestPrototype() {
for(var i = 1; i <= count; ++i) {
var win = window.openDialog(location.href, "", "chrome,all");
win.addEventListener("load", function loader(e) {
win.removeEventListener(e.type, loader, false);
win.setTimeout(function() {
win.document.documentElement.setAttribute("titlemodifier", "[" + i + "/" + count + "]");
win.gBrowser.updateTitlebar();
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@-moz-document url("chrome://browser/content/browser.xul") {
/* Add icon to pinned private tabs, https://addons.mozilla.org/addon/private-tab/ */
.tabbrowser-tab[pinned][privateTab-isPrivate] .tab-icon-image {
/* Trick: change binding to break "src" attribute */
-moz-binding: url("chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton") !important;
}
.tabbrowser-tab[pinned][privateTab-isPrivate] .tab-icon-image > .toolbarbutton-icon {
list-style-image: url("chrome://browser/skin/Privacy-16.png") !important;
// https://gist.github.com/Infocatcher/6484572
// Based on https://gist.github.com/Infocatcher/5891622
var options = {
showTooltips: true,
openInBackground: false
};
var menu = [
// cb_url:
@Infocatcher
Infocatcher / dontRemoveFinishedDownloads.js
Last active December 22, 2015 09:29
Firefox: don't remove finished downloads (browser.download.useToolkitUI = false), code for Custom Buttons extension https://addons.mozilla.org/addon/custom-buttons/ ("initialization" section)
// https://gist.github.com/Infocatcher/6452231
// More: https://github.com/Infocatcher/Download_Panel_Tweaker
// (c) Infocatcher 2013
var retentionDays = 21;
function dontRemoveFinishedDownloads(patch) {
// See https://github.com/Infocatcher/Download_Panel_Tweaker/issues/5 for details
try { // Firefox 26+
// http://mxr.mozilla.org/mozilla-central/source/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
var {DownloadIntegration} = Components.utils.import("resource://gre/modules/DownloadIntegration.jsm", {});
// Download images from selection example for Custom Buttons or DragIt Firefox extension
// https://addons.mozilla.org/addon/custom-buttons/
// https://addons.mozilla.org/addon/dragit-formerly-drag-de-go/
// Options:
var program = "%ProgramFiles%\\XnView\\xnview.exe";
var args = []; // Additional arguments, paths to temp files will be added after them
var tmpFilePrefix = this && this instanceof XULElement && this.localName == "toolbarbutton" // Looks like Custom Buttons
? "cb_tmp"
: "DragIt_tmp";