Skip to content

Instantly share code, notes, and snippets.

Jefferson Scher jscher2000

View GitHub Profile
@jscher2000
jscher2000 / override-atpage-margin.js
Created Dec 9, 2018
Override @page{margin} rules with reasonable values
View override-atpage-margin.js
// Override @page{margin} rule if found
var docSS = document.styleSheets, ss, ess;
for (var i=0; i<docSS.length; i++){
if (!docSS[i].disabled){
// check content of style sheet for @page (type 6 style sheet)
// https://developer.mozilla.org/en-US/docs/Web/API/CSSRule#Type_constants
ss = docSS[i];
for (var j=0; j<ss.cssRules.length; j++){
if (ss.cssRules[j].type == 6){ // Page sheet
if (ss.cssRules[j].cssText.indexOf('margin') > -1){
@jscher2000
jscher2000 / showAsPrint.js
Last active Mar 29, 2019
Emulate print media in Firefox 62 (userscript work in progress)
View showAsPrint.js
// For Firefox's Web Console, creates the functions showAsPrint() and undoShowAsPrint()
// to roughly emulate print media and revert
function showAsPrint(){
var docSS = document.styleSheets, ss, oldMedia, newMedia, rules;
var p2s = function(media){
if (media.indexOf('all') > -1) return media; //no need to change
if (media == 'print') return 'all, wasprint'; //show on screen, too
if (media.indexOf('print') > -1 && media.indexOf('screen') > -1) return media; //no need to change
if (media == 'screen') return 'wasscreen'; //hide these rules
if (media.indexOf('screen') > -1) return media.replace('screen', 'wasscreen'); //hide these rules
@jscher2000
jscher2000 / logins2csv.js
Created Sep 18, 2018
Dump Firefox Logins as CSV to Browser Console
View logins2csv.js
// Run code in Browser Console after enabling Chrome Debugging --
// about:config => devtools.chrome.enabled => true
try {
signons = Services.logins.getAllLogins();
var csv = '"Site","Username","Password"';
for (var i=0; i<signons.length; i++){
csv += '\n';
csv += signons[i].httpRealm ?
('"' + signons[i].hostname + ' (' + signons[i].httpRealm + ')","') :
'"' + signons[i].hostname + '","';
@jscher2000
jscher2000 / gist:3ff0d847db967a3d8c2385a5de05a677
Created Apr 6, 2018
Fix Gmail Message Times When Resisting Fingerprinting (user script / pre-alpha)
View gist:3ff0d847db967a3d8c2385a5de05a677
// ==UserScript==
// @name Fix Gmail Message Times When Resisting Fingerprinting
// @author Jefferson "jscher2000" Scher
// @namespace JeffersonScher
// @version 0.1 Pre-Alpha
// @copyright Copyright 2018 Jefferson Scher
// @license BSD-3-Clause
// @include https://mail.google.com/mail/*
// @grant GM_registerMenuCommand
// ==/UserScript==
@jscher2000
jscher2000 / addon-update-date.js
Created Mar 18, 2018
Browser Console Script to Show Latest Add-on Update Dates
View addon-update-date.js
var AM = Components.utils.import("resource://gre/modules/AddonManager.jsm");
AM.AddonManager.getAllAddons((aAddonsList) => {
updatelog = [];
for (let addon of aAddonsList) {
if (addon.updateDate && !addon.hidden){
strActive = (addon.isActive) ? ' (Enabled)' : ' (Disabled)';
strDateTime = addon.updateDate.toISOString();
if (addon.type == 'extension')
updatelog.push('Updated: ' + strDateTime.substr(0, strDateTime.indexOf('T')) + '; Name: ' + addon.name + '; Version: ' + addon.version + strActive);
else
View firefox-edge-light-dark(light).css
/* Firefox Edge v1.12.0 */
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
@-moz-document url("chrome://browser/content/browser.xul"),
url("chrome://browser/content/bookmarks/bookmarksPanel.xul"),
url("chrome://browser/content/history/history-panel.xul") {
:root {
--chrome-background-color: var(--second-level-bg-color) !important;
--chrome-secondary-background-color: var(--top-level-bg-color) !important;
View firefox-edge-light-dark.css
/* Firefox Edge v1.12.0 */
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
@-moz-document url("chrome://browser/content/browser.xul"),
url("chrome://browser/content/bookmarks/bookmarksPanel.xul"),
url("chrome://browser/content/history/history-panel.xul") {
:root {
--chrome-background-color: var(--second-level-bg-color) !important;
--chrome-secondary-background-color: var(--top-level-bg-color) !important;
@jscher2000
jscher2000 / color-gray-bookmark-folders.css
Last active Nov 11, 2017
Color the gray folder and other container icons in Firefox 56+
View color-gray-bookmark-folders.css
/* Colored bookmark sidebar, toolbar, menu button containers */
/* Standard folder */
#bookmarks-view treechildren::-moz-tree-image(container),
#PlacesToolbarItems toolbarbutton[container="true"] .toolbarbutton-icon,
#PlacesToolbarItems menu[container="true"] .menu-iconic-left,
#BMB_bookmarksPopup menu[container="true"] .menu-iconic-icon {
fill: #e8bb00 !important; /* slightly muted gold */
}
/* Live Bookmark (RSS Feed) */
#bookmarks-view treechildren::-moz-tree-image(container, livemark),
@jscher2000
jscher2000 / Hide_Media_Play_Command.user.js
Created Nov 5, 2017
Hide the play command for video elements
View Hide_Media_Play_Command.user.js
// ==UserScript==
// @name Hide Media Play Command
// @namespace Violentmonkey Scripts
// @match *://*/*
// @grant none
// ==/UserScript==
/* Supplements but does not replace media.autoplay.enabled = false
* PROBLEM: in testing on YouTube, userStart() reports "pending" and the video doesn't play, when it's the initial page load.
* Videos you load from thumbnails work as expected. */
@jscher2000
jscher2000 / decompress-mozlz4-snippet.txt
Last active Mar 29, 2019
Browser Console Snippet to decompress mozlz4 and jsonlz4 files
View decompress-mozlz4-snippet.txt
/* Decompression Script for the Browser Console
NOTE: BEFORE RUNNING THIS SCRIPT, CHECK THIS SETTING:
Type or paste about:config into the address bar and press Enter
Click the button promising to be careful
In the search box type devt and pause while Firefox filters the list
If devtools.chrome.enabled is false, double-click it to toggle to true
Paste this entire script into the command line at the bottom of the Browser Console (Windows: Ctrl+Shift+j)
Then press Enter to run the script. A file picker should promptly open.
You can’t perform that action at this time.