Skip to content

Instantly share code, notes, and snippets.

@krisrice
Created February 2, 2023 17:38
Show Gist options
  • Save krisrice/78ad2e233d4918513287771dfd9ecb06 to your computer and use it in GitHub Desktop.
Save krisrice/78ad2e233d4918513287771dfd9ecb06 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Raptor Web
// @namespace http://localhost:8080/ords/klrice/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://localhost:8080/ords/klrice/*
// @grant none
// @run-at document-idle
// ==/UserScript==
(function() {
'use strict';
function changeProductName(){
$(".sdw-brand__text").html("Raptor Web");
}
// Convenience function to execute your callback only after an element matching readySelector has been added to the page.
// Example: runWhenReady('.search-result', augmentSearchResults);
// Gives up after 1 minute.
function runWhenReady(readySelector, callback) {
var numAttempts = 0;
var tryNow = function() {
var elem = document.querySelector(readySelector);
if (elem) {
callback(elem);
} else {
numAttempts++;
if (numAttempts >= 34) {
console.warn('Giving up after 34 attempts. Could not find: ' + readySelector);
} else {
setTimeout(tryNow, 250 * Math.pow(1.1, numAttempts));
}
}
};
tryNow();
}
// Your code here...
runWhenReady('.sdw-brand__text', changeProductName);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment