Skip to content
Brad Slayter edited this page Nov 6, 2017 · 2 revisions

Welcome to the Radium Web Browser wiki!

The Radium Web Browser can be extended using JavaScript. When creating a script within the app you will have the option to inject the script before the web page loads or after. Any JavaScript that is compatible with WebKit should be valid within Radium. On this page I'll include some example scripts you can copy and paste into the app. Additionally, if you have JavaScript files in another app, you can import them in to Radium using the other apps share/export functionality.

Examples

Cloud to Butt

This script will take all instances of "Cloud" and change it to "Butt". Its especially fun once you've forgotten you've added it.

walk(document.body);

function walk(node) {
	// I stole this function from here:
	// http://is.gd/mwZp7E
	var child, next;

	switch (node.nodeType) {
		case 1:  // Element
		case 9:  // Document
		case 11: // Document fragment
			child = node.firstChild;
			while (child) {
				next = child.nextSibling;
				walk(child);
				child = next;
			}
			break;
		case 3: // Text node
			handleText(node);
			break;
	}
}

function handleText(textNode)  {
	var v = textNode.nodeValue;

    v = v.replace(/\bThe Cloud\b/g, "My Butt");
    v = v.replace(/\bThe cloud\b/g, "My butt");
    v = v.replace(/\bthe Cloud\b/g, "my Butt");
    v = v.replace(/\bthe cloud\b/g, "my butt");
    v = v.replace(/\bcloud\b/g, "butt");
    v = v.replace(/\bCloud\b/g, "Butt");
    v = v.replace(/\bclouds\b/g, "butts");
    v = v.replace(/\bClouds\b/g, "Butts");

	textNode.nodeValue = v;
}
Clone this wiki locally