-
-
Save ebetancourt/d09174b8133ba98052bfa31eb95da7da to your computer and use it in GitHub Desktop.
Bookmarklets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wrap any function in | |
javascript: (function () { | |
// javascript goes here | |
})(); | |
minify and then create a bookmark with the URL as the minified JavaScript | |
// grayscale all images without an alt tag | |
const css = document.createElement("style"); | |
css.type = "text/css"; | |
css.innerHTML = "img[alt=\"\"],img:not([alt]){ filter:grayscale(100%) }"; | |
document.body.appendChild(css); | |
// find duplicate Id's in DOM | |
const allElements = document.getElementsByTagName("*"); | |
const allIds = {}; | |
let found = false; | |
for (let i = 0, n = allElements.length; i < n; ++i) { | |
const id = allElements[i].id; | |
if (id) { | |
if (allIds[id] === undefined) { | |
allIds[id] = 1; | |
} else { | |
found = true; | |
console.warn('Duplicate ID #' + id); | |
} | |
} | |
} | |
if (!found) { | |
console.log('No duplicate IDs found'); | |
} | |
// Hide assigned jira tickets | |
var jq = document.createElement('script'); | |
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
//hide assigned tickets | |
$('.ghx-avatar').each(function() { | |
var str = $(this)[0].outerHTML; | |
if (str.indexOf("Assignee:") >= 0) { | |
$(this).parent().hide(); | |
} | |
}) | |
// show all hidden fields on a page | |
$(function() { | |
$("body *").each(function() { | |
$(this).removeAttr("style"); | |
$(this).removeClass("hidden"); | |
}) | |
}); | |
// detect duplicate script tags on a page | |
function findDupes() { | |
var allScripts = []; | |
var dupe = false; | |
$.each(document.getElementsByTagName("script"), function(index, value) { | |
if ($.inArray(value.src, allScripts) !== -1 && value.src !== '') { | |
console.log('already loaded :: ' + value.src); | |
dupe=true; | |
} | |
allScripts.push(value.src); | |
}); | |
if(!dupe){ | |
console.log('no dupes'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment