PDA

View Full Version : js helpp [greasemonkey ext]



MrCraig
12-02-2009, 09:39 PM
Ok basically the smilies on bebo are peeing me off. :)
So i started writing this greasemonkey script to replace them with nicer ones

But it doesnt work..

"permission denied to call method Location.toString"
"missing ) after argument list"

heres code i got


// ==UserScript==
// @name Bebo Smilies
// @namespace http://www.mrcraig.net
// @description Converts bebo smilies into more visually appealing ones
// @include http://www.bebo.com/*
// ==/UserScript==

var str = document.getElementById("content_Comment").innerHTML;

var str = str.replace("<img src="http://s.bebo.com/img/smiley_wink.gif" alt=";)" />","");

document.getElementById("content_Comment").innerHTML = str;
Any help please?

Im only trying to replace the wink smilie with blank to try this out before i do all of them

Thankyou :)
Craig.

Edit by Robbie! (Forum Moderator) - Moved to Coding Help. Please post in the correct section next time, thanks

Iszak
14-02-2009, 04:45 AM
Let me start off by saying I wish there was a cleaner way to do this like using an array of searches and replaces much like in PHP, but unfortunately I couldn't find one. Secondly this script isn't exactly what you wanted, although it does replace smileys with nothing, it is intended for you to fill out the new urls for each smiley and then it'll replace them. Otherwise I could of made a much shorter smiley to remove it all. Anyway, here it is enjoy.



// ==UserScript==
// @name Bebo Smilies
// @namespace http://www.mrcraig.net
// @description Converts bebo smilies into more visually appealing ones.
// @include http://www.bebo.com/*
// ==/UserScript==

var comments = document.getElementById('content_Comment').innerHT ML;

/* The Original Smileys */
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley.gif"[^>]*>/g, ''); // Happy Smiley
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley_sad.gif"[^>]*>/g, ''); // Sad Smiley
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley_big_grin.gif"[^>]*>/g, ''); // Grinning Smiley
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley_oh.gif"[^>]*>/g, ''); // Oh Smiley
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley_ohmygod.gif"[^>]*>/g, ''); // Oh My God Smiley
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley_laugh.gif"[^>]*>/g, ''); // Laughing Smiley
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley_wink.gif"[^>]*>/g, ''); // Winking Smiley
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley_grrr.gif"[^>]*>/g, ''); // Angry Smiley
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley_sleep.gif"[^>]*>/g, ''); // Sleepy Smiley
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley_toungeout.gif"[^>]*>/g, ''); // Tounge Out Smiley

/* The Extra Smileys */
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley\/bebosummer.gif"[^>]*>/g, ''); // Bebo Summer
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley\/gold.gif"[^>]*>/g, ''); // Gold Medal
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley\/silver.gif"[^>]*>/g, ''); // Silver Medal
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley\/bronze.gif"[^>]*>/g, ''); // Bronze Medal
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/mobile\/mobileB.gif"[^>]*>/g, ''); // Mobile Bebo
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley\/skittles-green.gif"[^>]*>/g, ''); // Skittle (Green)
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley\/skittles-yellow.gif"[^>]*>/g, ''); // Skittle (Yellow)
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley\/skittles-orange.gif"[^>]*>/g, ''); // Skittle (Orange)
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley\/skittles-pink.gif"[^>]*>/g, ''); // Skittle (Pink)
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley\/skittles-red.gif"[^>]*>/g, ''); // Skittle (Red)
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley\/skittles-purple.gif"[^>]*>/g, ''); // Skittle (Purple)
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley\/4leafclover.gif"[^>]*>/g, ''); // Four Leaf Clover
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley_bebo.gif"[^>]*>/g, ''); // Bebo
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley\/rednose.gif"[^>]*>/g, ''); // Red Nose
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley\/jack-o-lantern.gif"[^>]*>/g, ''); // Jack-O-Lantern
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley\/cupid.gif"[^>]*>/g, ''); // Cupid
var comments = comments.replace(/<img.*src="http:\/\/s.bebo.com\/img\/smiley_moon.gif"[^>]*>/g, ''); // Smiley Mooning

document.getElementById('content_Comment').innerHT ML = comments;

Want to hide these adverts? Register an account for free!