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

#26 2011-12-30 09:10:33

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Adding the images back in to your scratch forum experience

roijac wrote:

you may want to do something like <img src=image.jpg width=whatever> because it doesn't resize anymore  smile

how about
style="max-width: whatever;"

Offline

 

#27 2011-12-30 09:24:10

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Adding the images back in to your scratch forum experience

It seems to me like you're always forgetting the closing / for HTML elements... I only had a quick look at the code, but the JS looks fine (except for some very big lack of optimization)

Offline

 

#28 2011-12-30 09:26:53

flashgocrazy
Scratcher
Registered: 2011-01-12
Posts: 500+

Re: Adding the images back in to your scratch forum experience

LS97 wrote:

It seems to me like you're always forgetting the closing / for HTML elements... I only had a quick look at the code, but the JS looks fine (except for some very big lack of optimization)

how do I fix it?


◕‿◕

Offline

 

#29 2011-12-30 09:28:09

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Adding the images back in to your scratch forum experience

flashgocrazy wrote:

LS97 wrote:

It seems to me like you're always forgetting the closing / for HTML elements... I only had a quick look at the code, but the JS looks fine (except for some very big lack of optimization)

how do I fix it?

Here, let me do it for ya... watch this thread for an edit in 3 minutes!

EDIT
done  smile

Code:

// ==UserScript==
// @name           enable images on scratch forum and have bbcode
// @namespace      flash
// @description    enable images on scratch forum and have more bbcode
// @include        http://scratch.mit.edu/forums/*
// ==/UserScript==
var bodyInner = document.body.innerHTML;
// Images
var replaceOne = bodyInner.replace('[img]', "<img src='");
var replaceTwo = replaceOne.replace('[/img]', "' />");
document.body.innerHTML = replaceTwo;
// Scratch Projects
var replaceOne = bodyInner.replace('[scratch=flash]', "<embed src=http://scratch.mit.edu/static/misc/PlayerOnly.swf?project=http://'");
var replaceTwo = replaceOne.replace('[/scratch=flash]', "' />");
document.body.innerHTML = replaceTwo;
// Youtube
var replaceOne = bodyInner.replace('[youtube]', "<embed src=www.youtube.com/embed/'");
var replaceTwo = replaceOne.replace('[/youtube]', " /'>");
document.body.innerHTML = replaceTwo;

Last edited by LS97 (2011-12-30 09:32:15)

Offline

 

#30 2011-12-30 09:35:45

flashgocrazy
Scratcher
Registered: 2011-01-12
Posts: 500+

Re: Adding the images back in to your scratch forum experience

[youtube]JTuXPUP06H0[/youtube] testing


◕‿◕

Offline

 

#31 2011-12-30 09:38:57

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Adding the images back in to your scratch forum experience

worky?  tongue

Offline

 

#32 2011-12-30 09:43:30

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

Re: Adding the images back in to your scratch forum experience

@ls97

Code:

// ==UserScript==
// @name           enable images on scratch forum
// @namespace      rookwood101
// @description    enable images on scratch forum
// @include        http://scratch.mit.edu/forums/viewtopic.php*
// ==/UserScript==
if (document.URL.indexOf('http://scratch.mit.edu/forums/viewtopic.php') != -1) {
var bodyElement = document.getElementsByTagName("body")[0];
var bodyInner = bodyElement.innerHTML;
for (i=0;i<bodyInner.split(/\[img\]/i).length-1;i++) {
var replaceOne = bodyInner.replace(/\[img\]/ig, '<img src="');
var replaceTwo = replaceOne.replace(/\[\/img\]/ig, '" style="max-width: 100"/>');
document.getElementsByTagName("body")[0].innerHTML = replaceTwo;
}
}

what's wrong?  sad

test:
http://i1027.photobucket.com/albums/y339/silvisoft/sigB-1.png

Last edited by roijac (2011-12-30 09:45:32)

Offline

 

#33 2011-12-30 09:44:52

flashgocrazy
Scratcher
Registered: 2011-01-12
Posts: 500+

Re: Adding the images back in to your scratch forum experience

LS97 wrote:

worky?  tongue

almost....
By the way have you checked out  this post? I can do a review on your mod, bingo


◕‿◕

Offline

 

#34 2011-12-30 09:45:23

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Adding the images back in to your scratch forum experience

@roijac:
Why is that so complicated? Let me try understanding it and cutting it down a bit...

Offline

 

#35 2011-12-30 09:48:43

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Adding the images back in to your scratch forum experience

roijac, try that:

Code:

// ==UserScript==
// @name           enable images on scratch forum
// @namespace      rookwood101
// @description    enable images on scratch forum
// @include        http://scratch.mit.edu/forums/viewtopic.php*
// ==/UserScript==
var bodyInner = document.body.innerHTML;
for (i=0; i<bodyInner.split(/\[img\]/i).length-1; i++) {
  var replaceOne = bodyInner.replace(/\[img\]/i, '<img src="');
  var replaceTwo = replaceOne.replace(/\[\/img\]/i, '" style="max-width: 300"/>');
  document.body.innerHTML = replaceTwo;
}

Offline

 

#36 2011-12-30 09:52:28

flashgocrazy
Scratcher
Registered: 2011-01-12
Posts: 500+

Re: Adding the images back in to your scratch forum experience

LS97 wrote:

worky?  tongue

Its still not working!
You can check it here


◕‿◕

Offline

 

#37 2011-12-30 09:54:34

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

Re: Adding the images back in to your scratch forum experience

@ls97, your code doesn't work, it gets messed up with words like [img]  tongue


btw, did you know that writing [img] is messing smilies up with my script?  big_smile

[img] smile

Last edited by roijac (2011-12-30 09:58:33)

Offline

 

#38 2011-12-30 09:55:13

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: Adding the images back in to your scratch forum experience

LS97 wrote:

roijac, try that:

Code:

// ==UserScript==
// @name           enable images on scratch forum
// @namespace      rookwood101
// @description    enable images on scratch forum
// @include        http://scratch.mit.edu/forums/viewtopic.php*
// ==/UserScript==
var bodyInner = document.body.innerHTML;
for (i=0; i<bodyInner.split(/\[img\]/i).length-1; i++) {
  var replaceOne = bodyInner.replace(/\[img\]/i, '<img src="');
  var replaceTwo = replaceOne.replace(/\[\/img\]/i, '" style="max-width: 300"/>');
  document.body.innerHTML = replaceTwo;
}

for some reason only the first image on a page works with any of the scripts and chrome, any help?


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#39 2011-12-30 09:59:03

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Adding the images back in to your scratch forum experience

@flash, see if this works:

Code:

// ==UserScript==
// @name           Extra BBCode for Scratch Fora
// @namespace      flash and LS97
// @description    Enable images on the Scratch forums and feature more BB-Code!
// @include        http://scratch.mit.edu/forums/viewtopic.php*
// ==/UserScript==
var bodyInner = document.body.innerHTML;

// Images
document.body.innerHTML = bodyInner.replace(/\[img\]/ig, "<img src='").replace(/\[\/img\]/ig, "' />");

// Scratch Projects
document.body.innerHTML = bodyInner.replace(/\[scratch=flash\]/, "<object width="483" height="387" type="application/x-shockwave-flash" data="http://scratch.mit.edu/static/misc/PlayerOnly.swf"><param name="allowScriptAccess" value="always"><param name="allowFullScreen" value="true"><param name="flashvars" value="project=http://scratch.mit.edu/static/projects/'").replace(/\[\/scratch=flash\]/, "'"></object>");

// Youtube
document.body.innerHTML = bodyInner.replace(/[\youtube\]/, "<iframe width="420" height="315" src="http://www.youtube.com/embed/'").replace(/\[\/youtube\]/, " '" frameborder="0" allowfullscreen></iframe>");

Offline

 

#40 2011-12-30 10:03:12

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Adding the images back in to your scratch forum experience

Something really stupid is probably missing from my scripts...
But with only notepad to write with on this computer, the error could be anywhere...

Offline

 

#41 2011-12-30 10:07:06

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: Adding the images back in to your scratch forum experience

LS97 wrote:

@flash, see if this works:

Code:

// ==UserScript==
// @name           Extra BBCode for Scratch Fora
// @namespace      flash and LS97
// @description    Enable images on the Scratch forums and feature more BB-Code!
// @include        http://scratch.mit.edu/forums/viewtopic.php*
// ==/UserScript==
var bodyInner = document.body.innerHTML;

// Images
document.body.innerHTML = bodyInner.replace(/\[img\]/ig, "<img src='").replace(/\[\/img\]/ig, "' />");

// Scratch Projects
document.body.innerHTML = bodyInner.replace(/\[scratch=flash\]/, "<object width="483" height="387" type="application/x-shockwave-flash" data="http://scratch.mit.edu/static/misc/PlayerOnly.swf"><param name="allowScriptAccess" value="always"><param name="allowFullScreen" value="true"><param name="flashvars" value="project=http://scratch.mit.edu/static/projects/'").replace(/\[\/scratch=flash\]/, "'"></object>");

// Youtube
document.body.innerHTML = bodyInner.replace(/[\youtube\]/, "<iframe width="420" height="315" src="http://www.youtube.com/embed/'").replace(/\[\/youtube\]/, " '" frameborder="0" allowfullscreen></iframe>");

nope.only one image per page, and no youtube player.  Also, it happens with every script that I have downloaded for this.


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#42 2011-12-30 10:09:45

flashgocrazy
Scratcher
Registered: 2011-01-12
Posts: 500+

Re: Adding the images back in to your scratch forum experience

LS97 wrote:

@flash, see if this works:

Code:

// ==UserScript==
// @name           Extra BBCode for Scratch Fora
// @namespace      flash and LS97
// @description    Enable images on the Scratch forums and feature more BB-Code!
// @include        http://scratch.mit.edu/forums/viewtopic.php*
// ==/UserScript==
var bodyInner = document.body.innerHTML;

// Images
document.body.innerHTML = bodyInner.replace(/\[img\]/ig, "<img src='").replace(/\[\/img\]/ig, "' />");

// Scratch Projects
document.body.innerHTML = bodyInner.replace(/\[scratch=flash\]/, "<object width="483" height="387" type="application/x-shockwave-flash" data="http://scratch.mit.edu/static/misc/PlayerOnly.swf"><param name="allowScriptAccess" value="always"><param name="allowFullScreen" value="true"><param name="flashvars" value="project=http://scratch.mit.edu/static/projects/'").replace(/\[\/scratch=flash\]/, "'"></object>");


// Youtube
document.body.innerHTML = bodyInner.replace(/[\youtube\]/, "<iframe width="420" height="315" src="http://www.youtube.com/embed/'").replace(/\[\/youtube\]/, " '" frameborder="0" allowfullscreen></iframe>");

testing image
http://www.likiti.com/media/wysiwyg/Rubik/noch/second/RB-CR-222-MONK-POP-1/Rubik%27s_2jie_monkeyhead_black_1.jpg
testing scratch project
[scratch=flash]Mr-Negitive/1772157.sb?version=1[/scratch=flash]
testing youtube...
[youtube]JTuXPUP06H0[/youtube]

Last edited by flashgocrazy (2011-12-30 10:10:30)


◕‿◕

Offline

 

#43 2011-12-30 10:14:24

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Adding the images back in to your scratch forum experience

It's really weird, because I told it to go through all images (global tag), maybe it didn't listen...  sad

Offline

 

#44 2011-12-30 11:36:44

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: Adding the images back in to your scratch forum experience

gbear605 wrote:

LS97 wrote:

@flash, see if this works:

Code:

// ==UserScript==
// @name           Extra BBCode for Scratch Fora
// @namespace      flash and LS97
// @description    Enable images on the Scratch forums and feature more BB-Code!
// @include        http://scratch.mit.edu/forums/viewtopic.php*
// ==/UserScript==
var bodyInner = document.body.innerHTML;

// Images
document.body.innerHTML = bodyInner.replace(/\[img\]/ig, "<img src='").replace(/\[\/img\]/ig, "' />");

// Scratch Projects
document.body.innerHTML = bodyInner.replace(/\[scratch=flash\]/, "<object width="483" height="387" type="application/x-shockwave-flash" data="http://scratch.mit.edu/static/misc/PlayerOnly.swf"><param name="allowScriptAccess" value="always"><param name="allowFullScreen" value="true"><param name="flashvars" value="project=http://scratch.mit.edu/static/projects/'").replace(/\[\/scratch=flash\]/, "'"></object>");

// Youtube
document.body.innerHTML = bodyInner.replace(/[\youtube\]/, "<iframe width="420" height="315" src="http://www.youtube.com/embed/'").replace(/\[\/youtube\]/, " '" frameborder="0" allowfullscreen></iframe>");

nope.only one image per page, and no youtube player.  Also, it happens with every script that I have downloaded for this.

If you download the newer one, it should work. It does for me.

I'll post a screenshot of the blocklibrary back in action in chrome:

http://yourimg.in/m/1o19056.png

I was looking at my code compared to your code, and I can't understand why mine needs the for loop, AND the /g regex code because in theory it shouldn't need one with the other.

Last edited by rookwood101 (2011-12-30 11:40:49)


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

Offline

 

#45 2011-12-30 11:51:24

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: Adding the images back in to your scratch forum experience

Code:

// ==UserScript==
// @name           enable images on scratch forum
// @namespace      rookwood101
// @description    enable images on scratch forum
// @include        http://scratch.mit.edu/forums/viewtopic.php*
// ==/UserScript==
if (document.URL.indexOf('http://scratch.mit.edu/forums/viewtopic.php') != -1) {
    var bodyElement = document.getElementsByTagName("body")[0];
    var bodyInner = bodyElement.innerHTML;
    var addImages = bodyInner.replace(/\[img\]/ig, '<img src="').replace(/\[\/img\]/ig, '">');
    var addYoutube = addImages.replace(/\[youtube\]/ig, '<iframe width="420" height="315" src="http://www.youtube.com/embed/').replace(/\[\/youtube\]/ig, '"frameborder="0" allowfullscreen></iframe>');
    var addProjects = addYoutube.replace(/\[scratch=flash\]/ig, '<object width="483" height="387" type="application/x-shockwave-flash" data="http://scratch.mit.edu/static/misc/PlayerOnly.swf"><param name="allowScriptAccess" value="always"><param name="allowFullScreen" value="true"><param name="flashvars" value="project=http://scratch.mit.edu/static/projects/').replace(/\[\/scratch\]/ig, '.sb?version=1"></object>');
    document.getElementsByTagName("body")[0].innerHTML = addProjects;
}

Done! (haven't added scratch projects yet though) - Edit: have now

The reason why your code for scratch projects doesn't work is because you have the url wrong.

Using this script will ruin this page of the topic as the code posted on here interferes with the script. I have set up a post here to test it though.

Last edited by rookwood101 (2011-12-30 12:21:38)


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

Offline

 

#46 2011-12-30 12:39:04

meowmeow55
Scratcher
Registered: 2008-12-24
Posts: 1000+

Re: Adding the images back in to your scratch forum experience

Erm, you might want to add something that makes stuff not show up in code boxes...
It's breaking this page  tongue


Yawn.

Offline

 

#47 2011-12-30 12:47:31

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: Adding the images back in to your scratch forum experience

Yes, I noticed that - easier said than done though.


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

Offline

 

#48 2011-12-30 14:11:33

cocolover76
Scratcher
Registered: 2011-10-09
Posts: 500+

Re: Adding the images back in to your scratch forum experience

rookwood101 wrote:

[scratch=flash]rookwood101/1951425[/scratch]

I removed this since I had to disable the plugin to see this because I broke this page XD

Last edited by cocolover76 (2011-12-30 14:14:29)


http://i.imgur.com/HfEPZ.gifhttp://i.imgur.com/pvKb6.png

Offline

 

#49 2011-12-30 14:13:32

Servine
Scratcher
Registered: 2011-03-19
Posts: 1000+

Re: Adding the images back in to your scratch forum experience

Omigosh! Thankyou!


http://bluetetrarpg.x10.mx/usercard/?name=Servine

Offline

 

#50 2011-12-30 14:14:39

flashgocrazy
Scratcher
Registered: 2011-01-12
Posts: 500+

Re: Adding the images back in to your scratch forum experience

testing[url=javascript:var bodyElement = document.getElementsByTagName("body")[0]; var bodyInner = bodyElement.innerHTML; var replaceOne = bodyInner.replace("[img]", "<img src='"); var replaceTwo = replaceOne.replace("[/img]", "'>"); document.write("<h3>Optimized by a script by Coco and Bobbybee!  smile </h3>" + replaceTwo);]test[/url]


◕‿◕

Offline

 

Board footer