Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @name Skip steamcommunity.com/linkfilter
// @namespace dev/null
// @include https://steamcommunity.com/linkfilter/?url=*
// @version 0.1
// @run-at document-start
// @grant none
// ==/UserScript==
if(/\?url=(.*)$/.test(location.href))
var uris = {
"http://example.com/": true,
"https://example.com/": true,
"https://example.com/foo/bar.php?key=val&key2=val2#hash": true,
"file:///": true,
"ftp://example.com": true,
//"about:": true, // Removed in new versions
"about:newtab": true,
"about:config": true,
"about:cache?device=memory": true,
@Infocatcher
Infocatcher / turn-off-signatures.js
Created January 20, 2017 20:39
Turn off extensions signatures in Firefox (see comments in the code)
// Turn off extensions signatures in Firefox
// Use at your own risk!
// Usage:
// Start browser with rights to write into his install directory (run as administrator)
// devtools.chrome.enabled = true (in about:config)
// Open Scratchpad: Shift+F4 (Tools - Web-Developer - Scratchpad)
// Set: Environment - Browser
// Then paste following code and press Run, browser will be restarted, than enjoy
@Infocatcher
Infocatcher / getDownloadHistory.js
Last active October 25, 2016 17:10
Tricky way to detect if there something to remove using nsIDownloadHistory.removeAllDownloads()
function getDownloadHistory() {
var query = PlacesUtils.history.getNewQuery();
query.setTransitions([Components.interfaces.nsINavHistoryService.TRANSITION_DOWNLOAD], 1);
var options = PlacesUtils.history.getNewQueryOptions();
options.resultType = options.RESULTS_AS_URI;
options.queryType = Components.interfaces.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY;
options.includeHidden = true;
var result = PlacesUtils.history.executeQuery(query, options);
var contents = result.root;
function getVKChar(vk) {
// Firefox doesn't have string representation for some codes...
// https://developer.mozilla.org/en-US/docs/DOM/KeyboardEvent#Virtual_key_codes
if(/^VK_(?:NUMPAD)?([\d+A-Z])$/.test(vk))
return RegExp.$1;
switch(vk) {
case "VK_SPACE": return " "; //32
case "VK_COLON": return ":"; //58
case "VK_SEMICOLON": return ";"; //59
case "VK_LESS_THAN": return "<"; //60
@Infocatcher
Infocatcher / document-start.user.js
Last active March 5, 2016 19:48
Testcase for Greasemonkey: will be executed twice in Greasemonkey 3.7 (https://github.com/greasemonkey/greasemonkey/issues/2371)
// ==UserScript==
// @name about:blank?UserScripts/test
// @namespace dev/null
// @include about:blank?UserScripts/test
// @run-at document-start
// @version 1
// @grant none
// ==/UserScript==
console.log("test: " + document.readyState);
@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", {});