NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Github Tab Size // @match https://github.com/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; const tabSize = 2; if ( location.pathname.search( /^.*\.ts$/ ) === -1 ) { return false } let curr = location.href; let dest = location.href.split( '?' )[ 0 ]; if ( location.search ){ let s = location.search.slice( 1 ).split( '&' ).filter( v => v.split( '=' )[ 0 ] !== 'ts' ); dest += `?${s.join( '&' )}`; if ( s.length ) dest += '&'; } else { dest += '?'; } dest += 'ts=' + tabSize; if ( dest !== curr ) { location.replace( dest ); } })();