Author Topic: Blockland Greasemonkey Scripts  (Read 40956 times)

I saw somewhere it said to make a notepad file and save it as user.js, I did that but it didn't work.

Did you put the keys at the top?

Code: [Select]
// ==UserScript==
// @name [name goes here]
// @description [description goes here]
// @include http://forum.blockland.us/index.php?topic=*
// @version [version goes here]
// ==/UserScript==

Or are you having trouble with the actual scripting itself?

Okay, I put the YT script into Greasemonkey. Now how do I use it?

-snip-

Nevermind. Yes, just copy it, paste it into notepad, and save it.

I copy pasted
Code: [Select]
// ==UserScript==
// @name       YT Embed
// @version    0.21
// @description  Automatic Youtube video embedding for the blockland forums.
// @include    http://forum.blockland.us/index.php?topic=*
// @copyright  2012+, Kingdaro
// ==/UserScript==

var links = document.getElementsByTagName('a');

var i;
for (i in links){
var link = links[i];
var code = '';
if (link.href.search('youtube.com')>-1){
var from = link.href.search('v=')+2;
var to = from+11;

code = link.href.substring(from,to);
}else if (link.href.search('youtu.be')>-1){
var from = link.href.lastIndexOf('/')+1;
var to = from+11; //no need for anything too complicated for youtu.be links.

code = link.href.substring(from,to);
}

if (code!=''){
link.href = null
link.innerHTML = '<iframe src="http://www.youtube.com/embed/'+code+'" width="640" height="390" allowfullscreen></iframe>'
}
}
into a .txt file named .user.js in c:/-user-/appdata/local/Google/Chrome/User Data/User scripts

I'm thinking the .txt file is the problem, as it's not a .user.js file, just a .txt. I have literally no experience with coding at all, so i'm probably missing something really basic.



I saw somewhere it said to make a notepad file and save it as user.js, I did that but it didn't work.
1. Take text.
2. Put into text editor.
3. Save As
4. "blah.user.js" with UTF-8 formatting.
5. Drag into Chrome.

Er, bit late. Didn't even see the new page. lol


1. Take text.
2. Put into text editor.
3. Save As
4. "blah.user.js" with UTF-8 formatting.
5. Drag into Chrome.
Oh ya, step 4 here is important to handle oddball characters like the null symbol in Lørd Tøny's name for the blocking script. It won't affect the youtube embedding script though.

This works, thanks.
and I have to say, this is a pretty good mod.

could you make one to block IkeTheGeneric his posts are annoying me cause hes so stupid lol

Oh ya, step 4 here is important to handle oddball characters like the null symbol in Lørd Tøny's name for the blocking script. It won't affect the youtube embedding script though.
Nope, Chrome just refuses to install it if it isn't UTF-8. Also it isn't a null, it's the danish/norwegian variation of Ö.

Nope, Chrome just refuses to install it if it isn't UTF-8. Also it isn't a null, it's the danish/norwegian variation of Ö.

it's also a null symbol

could you make one to block IkeTheGeneric his posts are annoying me cause hes so stupid lol