Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name HVtest
- // @namespace HV
- // @description HTML replace
- // @include http://foorum.hinnavaatlus.ee/*
- // @version 1
- // ==/UserScript==
- // lets load jQuery to be sure it's available
- function addJQuery(callback) {
- var script = document.createElement('script');
- script.setAttribute('src', '//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js');
- script.addEventListener('load', function() {
- var script = document.createElement('script');
- script.textContent = 'window.jQ=jQuery.noConflict(true);(' + callback.toString() + ')();';
- document.body.appendChild(script);
- }, false);
- document.body.appendChild(script);
- }
- function init() {
- // using jQ instead of $ to avoid conflict with the jQuery on the page
- // METHOD 1:
- // We know what elements in html we need to replace iterate thru all of those elements and replace if needed
- jQ('a.name').each(function() {
- if(jQ(this).html() == 'LiivaneLord') {
- jQ(this).html('Olavi');
- }
- })
- }
- // load jQuery and execute the initialization
- addJQuery(init);
Advertisement
Add Comment
Please, Sign In to add comment