Skip to content

Instantly share code, notes, and snippets.

@a-pasquale
Last active June 2, 2017 18:17
Show Gist options
  • Save a-pasquale/bce51850e74cf36087f83e754fc2b7c7 to your computer and use it in GitHub Desktop.
Save a-pasquale/bce51850e74cf36087f83e754fc2b7c7 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Add to Cart Text Replacer
// @namespace https://holyokecodes.org/
// @version 0.1
// @description try to take over the world!
// @author Andrew Pasquale
// @match */*
// @grant none
// @require http://code.jquery.com/jquery-3.2.1.min.js
// ==/UserScript==
(function() {
'use strict';
$('div, p, h1, h2, h3, li, span, a').contents().filter(function() {
// Filter text nodes
return this.nodeType == 3;
}).each(function(){
this.textContent = this.textContent.replace(/Add to [Cc]art/g, 'Buy for Andrew!');
// Or whatever text you want to replace...
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment