Off Topic > Drama

Blockland Greasemonkey Scripts

Pages: << < (61/80) > >>

Club559:


--- Quote from: Dnitro on January 21, 2012, 11:36:50 AM ---I saw somewhere it said to make a notepad file and save it as user.js, I did that but it didn't work.

--- End quote ---

Did you put the keys at the top?


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

Or are you having trouble with the actual scripting itself?

Coolio:

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

Club559:


--- Quote from: Club559 on January 21, 2012, 11:39:29 AM ----snip-

--- End quote ---

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

Dnitro:

I copy pasted
--- Code: ---// ==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>'
}
}
--- End code ---
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.

Otis Da HousKat:



Pages: << < (61/80) > >>

Go to full version