This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-04-11 10:13:49

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Like BBCode Plugin

Since the like button was such a success (78 likes and counting,) I decided to make a BBCode tag for it.
Like Button

Code:

[likebtn ]site_to_like[/likebtn ]

Remove the spaces in the BBCode tags.
Also...
The Like Counter

Code:

[likecount ]site_to_like[/likecount ]

Again, remove the spaces in the BBCode tags.
Download here: http://dl.dropbox.com/u/69615840/liketag.user.js

EDIT: now like this post!!!
[center]
[likebtn]http://scratch.mit.edu/forums/viewtopic.php?id=94541[/likebtn]
[likecount]http://scratch.mit.edu/forums/viewtopic.php?id=94541[/likecount] people like this post.
[/center]

Last edited by GeonoTRON2000 (2012-04-11 10:15:07)


http://i.imgur.com/BAEgGDL.png

Offline

 

#2 2012-04-11 22:47:09

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: Like BBCode Plugin

bump


http://i.imgur.com/BAEgGDL.png

Offline

 

#3 2012-04-11 22:56:39

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: Like BBCode Plugin

I've always been wondering: how do you make a .js file into a browser extension? I only know how to make a Chrome .crx file.

Is there a tutorial or something?


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#4 2012-04-11 22:57:46

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Like BBCode Plugin

jvvg wrote:

I've always been wondering: how do you make a .js file into a browser extension? I only know how to make a Chrome .crx file.

Is there a tutorial or something?

It's called a userscript. You end it with .user.js.

Code:

// ==UserScript==
// @name           Script name
// @namespace      Not sure...
// @description    Short description
// @include        http://google.com/ (only on google.com homepage)
// @include        http://*.google.com/ (only on anything.google.com homepage)
// @include        http://*.google.com/* (anything on anything.google.com)
// @include        http://*.google.tld/* (anything on anything.google.anything)
// @exclude        http://mail.google.tld/* (don't run on GMail)
// ==/UserScript==
 
// Regular old JavaScript code goes here.

Offline

 

#5 2012-04-11 23:24:27

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: Like BBCode Plugin

jvvg wrote:

Is there a tutorial or something?

Here's an example of how to make your own BBCodes with a UserScript (this is my antidote script):

Code:

// ==UserScript==
// @name           Scratch Forums Image Fix
// @namespace      GeonoTRON2000,Scratch
// @description    Turns [img] BBCode tag into an image
// @version        1.6.0.0
// @include        http://scratch.mit.edu/forums/*
// @include        http://scratch.mit.edu/tbgforums/*
// ==/UserScript==

// get a copy of the page html
var thishtml = document.body.innerHTML;

// define your opening and closing tags (regular expressions with global modifiers)
var open = /\[img\]/g;
var close = /\[\/img\]/g;
var flashopen = /\[flash\]/g;
var flashclose = /\[\/flash\]/g;
var ytopen = /\[youtube\]/g;
var ytclose = /\[\/youtube\]/g;
var sopen = /\[scratch=flash\]/g;
var sclose = /\[\/scratch\]/g;
var nothere = /antidoteexists=false/g;
var forumlink = /http:\/\/scratch.mit.edu\/forums\/viewtopic.php\?id=85229/g;

// replace your tags with HTML
thishtml = thishtml.replace(open, "<img onload=\"\" src=\"");
thishtml = thishtml.replace(close, "\" style=\"max-width: 510px;\" />");
thishtml = thishtml.replace(flashopen, "<embed type=\"application/x-shockwave-flash\" style=\"max-width: 510px;\" src=\"");
thishtml = thishtml.replace(flashclose, "\"></embed>");
thishtml = thishtml.replace(ytopen, "<iframe style=\"max-width: 510px;\" width=\"560\" height=\"315\" src=\"http://www.youtube.com/embed/");
thishtml = thishtml.replace(ytclose, "\" frameborder=\"0\" allowfullscreen></iframe>");
thishtml = thishtml.replace(sopen, "<object width='483' height='387' type='application/x-shockwave-flash' data='http://scratch.mit.edu/static/misc/PlayerOnly.swf'><param name='allowScriptAccess' value='sameDomain'><param name='allowFullScreen' value='true'><param name='flashvars' value='project=http://scratch.mit.edu/static/projects/");
thishtml = thishtml.replace(sclose, ".sb?version=1'></object>");
thishtml = thishtml.replace(nothere, "antidoteexists=true&version=10");
thishtml = thishtml.replace(forumlink, "http://scratch.mit.edu/forums/viewtopic.php?id=93227");

// apply your changes to the page
document.body.innerHTML = thishtml;

EDIT: added helpful comments.

Last edited by GeonoTRON2000 (2012-04-11 23:26:39)


http://i.imgur.com/BAEgGDL.png

Offline

 

#6 2012-04-12 04:32:52

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Like BBCode Plugin

[center]javascript:while(true){alert("stop making those stupid vulnerable scripts! disable it now!")}[/center]

new version

Last edited by roijac (2012-04-15 13:49:35)

Offline

 

#7 2012-04-12 10:20:56

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: Like BBCode Plugin

roijac wrote:

[likecount]' onload='while(true){alert("stop making those stupid vulnerable scripts! disable it now!")}[/likecount]

Ok... new version.  That no longer works.  I didn't realize people were going to try to hack it *sigh*, but whatever.  Hackers gonna hack.


http://i.imgur.com/BAEgGDL.png

Offline

 

#8 2012-04-12 10:29:04

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Like BBCode Plugin

check MY new version

Offline

 

#9 2012-04-12 21:15:14

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: Like BBCode Plugin

scimonster wrote:

jvvg wrote:

I've always been wondering: how do you make a .js file into a browser extension? I only know how to make a Chrome .crx file.

Is there a tutorial or something?

It's called a userscript. You end it with .user.js.

Code:

// ==UserScript==
// @name           Script name
// @namespace      Not sure...
// @description    Short description
// @include        http://google.com/ (only on google.com homepage)
// @include        http://*.google.com/ (only on anything.google.com homepage)
// @include        http://*.google.com/* (anything on anything.google.com)
// @include        http://*.google.tld/* (anything on anything.google.anything)
// @exclude        http://mail.google.tld/* (don't run on GMail)
// ==/UserScript==
 
// Regular old JavaScript code goes here.

Thanks, I will use that in the future.


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#10 2012-04-12 22:58:30

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: Like BBCode Plugin

roijac wrote:

[likebtn]' onmousedown='while(true){alert("stop making those stupid vulnerable scripts! disable it now!")}[/likebtn]

new version

Right back at 'ya!  Lol... nothing javascript will work now... muahahahaha...
Well... if you manage to embed a <script> tag, that might work, but otherwise... muahahahaha....


http://i.imgur.com/BAEgGDL.png

Offline

 

#11 2012-04-14 15:30:46

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Like BBCode Plugin

GeonoTRON2000 wrote:

roijac wrote:

<a href='http://like.cfagency.org/like.php?site=' onmousedown='while(true){alert("stop making those stupid vulnerable scripts! disable it now!")}'><img src='http://like.cfagency.org/like.png' width='64' height='64' /></a>

new version

Right back at 'ya!  Lol... nothing javascript will work now... muahahahaha...
Well... if you manage to embed a <script> tag, that might work, but otherwise... muahahahaha....

muahahahaha....
have no idea what's happening, but this works at least on my firefox  tongue

Last edited by roijac (2012-04-14 15:30:56)

Offline

 

#12 2012-04-14 16:13:15

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: Like BBCode Plugin

Well... I have no idea how to help firefox people, but chrome works fine.
Sorry, I get them (firefox and safari) confused because I never use them.

Last edited by GeonoTRON2000 (2012-04-14 16:27:35)


http://i.imgur.com/BAEgGDL.png

Offline

 

#13 2012-04-15 07:38:40

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Like BBCode Plugin

got it, you should use document.getElementsByName() instead of the not cross-supported document.all

Offline

 

#14 2012-04-15 12:48:11

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: Like BBCode Plugin

roijac wrote:

got it, you should use document.getElementsByName() instead of the not cross-supported document.all

Thanks for the tip.  It works with firefox now!


http://i.imgur.com/BAEgGDL.png

Offline

 

#15 2012-04-15 13:43:33

3DSfan12345
Scratcher
Registered: 2011-04-02
Posts: 500+

Re: Like BBCode Plugin

bump


R.I.P Scratch 1.4
July 7,2009-May 5,2013

Offline

 

#16 2012-04-15 14:04:57

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Like BBCode Plugin

GeonoTRON2000 wrote:

roijac wrote:

got it, you should use document.getElementsByName() instead of the not cross-supported document.all

Thanks for the tip.  It works with firefox now!

oh wait this still doesn't work :

Offline

 

#17 2012-04-15 15:53:23

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: Like BBCode Plugin

roijac wrote:

GeonoTRON2000 wrote:

roijac wrote:

got it, you should use document.getElementsByName() instead of the not cross-supported document.all

Thanks for the tip.  It works with firefox now!

oh wait this still doesn't work :

???
Maybe you need to reinstall.  It works fine in my firefox.

EDIT: Oh, you mean the getElementsByName().  I know that doesn't work.  What does is this:

Code:

var elements;
elements = document.all;
if (!elements) {
  elements = document.getElementsByTagName("*");
}

Last edited by GeonoTRON2000 (2012-04-15 16:23:15)


http://i.imgur.com/BAEgGDL.png

Offline

 

#18 2012-04-15 18:08:59

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: Like BBCode Plugin

bump


http://i.imgur.com/BAEgGDL.png

Offline

 

#19 2012-04-17 10:23:15

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: Like BBCode Plugin

bump


http://i.imgur.com/BAEgGDL.png

Offline

 

#20 2012-06-18 22:59:20

funelephant
Scratcher
Registered: 2010-07-02
Posts: 1000+

Re: Like BBCode Plugin

How do you put it in a sig?


nicki begs to differ
http://24.media.tumblr.com/ab0e6e8fd347c5e39c2821bcab9d16e6/tumblr_mgu35sui1L1rfb7aqo2_500.gif

Offline

 

#21 2012-06-18 23:24:53

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: Like BBCode Plugin

*coughcough* necropost *coughcough*

Anyways, use:

Code:

[url=http://like.cfagency.org/like.php?site=referer][img ]http://like.cfagency.org/like.png[/img ][/url] - [img ]http://like.cfagency.org/counter.php?site=referer[/img ] likes.

Image tags spaced out, so fix those.


http://i.imgur.com/BAEgGDL.png

Offline

 

#22 2012-06-19 07:46:42

funelephant
Scratcher
Registered: 2010-07-02
Posts: 1000+

Re: Like BBCode Plugin

GeonoTRON2000 wrote:

*coughcough* necropost *coughcough*

Anyways, use:

Code:

[url=http://like.cfagency.org/like.php?site=referer][img ]http://like.cfagency.org/like.png[/img ][/url] - [img ]http://like.cfagency.org/counter.php?site=referer[/img ] likes.

Image tags spaced out, so fix those.

2 months is not a necropost. Should I get you some cold medicine for that cough of yours?


nicki begs to differ
http://24.media.tumblr.com/ab0e6e8fd347c5e39c2821bcab9d16e6/tumblr_mgu35sui1L1rfb7aqo2_500.gif

Offline

 

#23 2012-06-19 07:48:41

777w
Scratcher
Registered: 2009-02-10
Posts: 1000+

Re: Like BBCode Plugin

funelephant wrote:

GeonoTRON2000 wrote:

*coughcough* necropost *coughcough*

Anyways, use:

Code:

[url=http://like.cfagency.org/like.php?site=referer][img ]http://like.cfagency.org/like.png[/img ][/url] - [img ]http://like.cfagency.org/counter.php?site=referer[/img ] likes.

Image tags spaced out, so fix those.

2 months is not a necropost. Should I get you some cold medicine for that cough of yours?

2 months can be considered a necropost if the topic is irrelevant or the project has been cancelled or dropped

Offline

 

#24 2012-06-19 08:04:04

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Like BBCode Plugin

Yeah, necroposts are irrelevant posts that don't further the discussion. You should be glad people are still discussing your plugin.  smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#25 2012-06-19 11:03:50

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: Like BBCode Plugin

sparks wrote:

Yeah, necroposts are irrelevant posts that don't further the discussion. You should be glad people are still discussing your plugin.  smile

No, but you see, that wasn't relevant to my plugin, it was relevant to my signature.
My plugin got old about a month ago.

@funelephant: *coughcoughcough* yes, I would like some cold medicine, thank you very much.

Last edited by GeonoTRON2000 (2012-06-19 11:04:43)


http://i.imgur.com/BAEgGDL.png

Offline

 

Board footer