Skip to content

Instantly share code, notes, and snippets.

@fleimisch
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

  • Save fleimisch/4fd7c1eb89180e62e583 to your computer and use it in GitHub Desktop.

Select an option

Save fleimisch/4fd7c1eb89180e62e583 to your computer and use it in GitHub Desktop.
JavaScript Snippets
// USE either script 1 or script 2, don't combine!
// SCRIPT 1:
$(document).ready(function(){
$(".SearchResultsTop .Left span").html(function(index, text) {
return text.replace('items matching your criteria', 'Tests matching');
});
});
// SCRIPT 2:
function nativeSelector() {
var elements = document.querySelectorAll("body, body *");
var results = [];
var child;
for(var i = 0; i < elements.length; i++) {
child = elements[i].childNodes[0];
if(elements[i].hasChildNodes() && child.nodeType == 3) {
results.push(child);
}
}
return results;
}
var textnodes = nativeSelector(),
_nv;
for (var i = 0, len = textnodes.length; i<len; i++){
_nv = textnodes[i].nodeValue;
textnodes[i].nodeValue = _nv.replace(/S\/./g,'TZS');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment