NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Hide Annoying BitBucket Diffs // @namespace http://sagegerard.com // @version 0.1 // @description Hides bulky diff blocks for autogenerated files in BitBucket pull requests using RegExp patterns defined by clear-text resource // @author Sage Gerard // @match https://*.bitbucket.org/*/pull-requests/* // @resource ignorePatterns http://pastebin.com/5mNJ0FHv // @grant GM_getResourceText // ==/UserScript== (function() { 'use strict'; var timer = setInterval(function() { const diffBlocks = document.querySelectorAll('.commentable-diff'); const len = diffBlocks.length; const textSource = GM_getResourceText("ignorePatterns"); if (!textSource) { console.log('[HABD] Could not load ignore patterns to hide BitBucket diffs, or no patterns were defined. Check your resource?'); return; } const patterns = textSource.split(/\r?\n/).map((pattern) => new RegExp(pattern)); if (len > 0) { for (let i = 0; i < len; ++i) { const db = diffBlocks[i]; const filename = db.getAttribute('data-filename'); if (patterns.some(re => re.test(filename))) { db.remove(); console.log('[HABD] Removed diff block for ', filename); } } clearInterval(timer); } }, 500); })();