Last active
August 5, 2016 11:15
-
-
Save scott-ad-riley/c611f6dc8becbe2cc25678c47460a4bd to your computer and use it in GitHub Desktop.
Rails/Generic JS Snippets
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
// prints out all links on the page, in alphabetical order with duplicates removed | |
(function () {console.table([].map.call(document.querySelectorAll('a'), function (a) {return a.hostname}).filter( | |
function (h,i,s) {return s.indexOf(h) === i}).sort()) | |
}()) |
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
// paste into the console of the page you are testing | |
// gives you a count of the times it occurs on the page, with the key for the text that is missing | |
(function () {var missing = {};$(".translation_missing").each(function (i, $el) { | |
var text = $el.title.replace('translation missing: ', '') | |
missing[text] = missing[text] ? missing[text] + 1 : 1; | |
});return missing;}()) |
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
(function () {var missing = {};[].forEach.call(document.getElementsByClassName('translation_missing'), function (div) { | |
var text = div.title.replace('translation missing: ',''); | |
missing[text] = missing[text] ? missing[text] + 1 : 1; | |
});return missing;})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment