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

#26 2012-06-03 15:46:09

williambl
Scratcher
Registered: 2011-04-08
Posts: 100+

Re: Using scratchblocks on your forum!

GeonoTRON2000 wrote:

Here's what I have (place under the embed code in the first post):

Code:

<script type="text/javascript">
// basic settings
var protocol = self.location.href.split("/")[0].substring(0, self.location.href.split("/")[0].length-2);
var base_url = self.location.href.split("/")[2];
var L;
var directory = "";
for (L = 3; L < self.location.href.split("/").length-1) {
  directory += "/"+self.location.href.split("/")[L];
}
L=null;
// the green flag
var imgs = document.getElementsByTagName("img");
for (L = 0; L < imgs.length; L++) {
  if (imgs[L].src==protocol+"://"+base_url+directory+"/gf.png" || imgs[L].src == "gf.png") {
    imgs[L].src = "http://scratch.mit.edu/ext/blocksplugin/gf.png";
  }
}
L = null;

// the hat block and C block
var divs = document.getElementsByTagName("div");
for (L = 0; L < divs.length; L++) {
  var div = divs[L];
  if (div.style.backgroundImage == "url("+protocol+"://"+base_url+directory+"/hat_bg.png)" || div.style.backgroundImage == "url('"+protocol+"://"+base_url+directory+"/hat_bg.png')" || div.style.backgroundImage == "url('hat_bg.png')" || div.style.backgroundImage == "url(hat_bg.png)") {
     div.style.backgroundImage = "url(http://scratch.mit.edu/ext/blocksplugin/hat_bg.png)";
  }
  else if (div.style.backgroundImage == "url("+protocol+"://"+base_url+directory+"/cwrap.png)" || div.style.backgroundImage == "url('"+protocol+"://"+base_url+directory+"/cwrap.png')" || div.style.backgroundImage == "url('cwrap.png')" || div.style.backgroundImage == "url(cwrap.png)") {
     div.style.backgroundImage = "url(http://scratch.mit.edu/ext/blocksplugin/cwrap.png)";
  }
}
</script>

Can you test it for me?

Where do I put it? I don't understand where. main.tpl doesn't work.

Last edited by williambl (2012-06-03 15:48:55)


http://internetometer.com/imagesmall/34650.png
http://www.danasoft.com/sig/Epicnesssign.jpg

Offline

 

#27 2012-06-03 15:54:44

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

Re: Using scratchblocks on your forum!

williambl wrote:

GeonoTRON2000 wrote:

Here's what I have (place under the embed code in the first post):
Code
Can you test it for me?

Where do I put it? I don't understand where. main.tpl doesn't work.

Put it in main.tpl, on the line before </body>

I made some edits to the code, so you might want to copy it again.

Last edited by GeonoTRON2000 (2012-06-03 15:59:40)


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

Offline

 

#28 2012-06-03 16:07:06

williambl
Scratcher
Registered: 2011-04-08
Posts: 100+

Re: Using scratchblocks on your forum!

GeonoTRON2000 wrote:

williambl wrote:

GeonoTRON2000 wrote:

Here's what I have (place under the embed code in the first post):
Code
Can you test it for me?

Where do I put it? I don't understand where. main.tpl doesn't work.

Put it in main.tpl, on the line before </body>

I made some edits to the code, so you might want to copy it again.

That only works for http://img214.imageshack.us/img214/8501/64730809.png
and not http://img194.imageshack.us/img194/6569/hatbg.png or http://img16.imageshack.us/img16/5030/cwrap.png

Last edited by williambl (2012-06-03 16:08:16)


http://internetometer.com/imagesmall/34650.png
http://www.danasoft.com/sig/Epicnesssign.jpg

Offline

 

#29 2012-06-03 16:23:14

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

Re: Using scratchblocks on your forum!

williambl wrote:

GeonoTRON2000 wrote:

williambl wrote:


Where do I put it? I don't understand where. main.tpl doesn't work.

Put it in main.tpl, on the line before </body>

I made some edits to the code, so you might want to copy it again.

That only works for http://img214.imageshack.us/img214/8501/64730809.png
and not http://img194.imageshack.us/img194/6569/hatbg.png or http://img16.imageshack.us/img16/5030/cwrap.png

Hmm...   I tried it on joletole's forums, and it worked.


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

Offline

 

#30 2012-06-03 16:32:24

bobbybee
Scratcher
Registered: 2009-10-18
Posts: 1000+

Re: Using scratchblocks on your forum!

By the way, document.getElementByClassName is not supported by all browsers. Rather, you should use IDs, and use document.getElementById.


I support the Free Software Foundation. Protect our digital rights!

Offline

 

#31 2012-06-03 16:55:33

williambl
Scratcher
Registered: 2011-04-08
Posts: 100+

Re: Using scratchblocks on your forum!

I still only get the result shown here: http://epic.punbb-hosting.com/viewtopic.php?id=22


http://internetometer.com/imagesmall/34650.png
http://www.danasoft.com/sig/Epicnesssign.jpg

Offline

 

#32 2012-06-03 22:02:53

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

Re: Using scratchblocks on your forum!

williambl wrote:

I still only get the result shown here: http://epic.punbb-hosting.com/viewtopic.php?id=22

Hmm... works in chrome.


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

Offline

 

#33 2012-06-03 22:06:14

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

Re: Using scratchblocks on your forum!

GeonoTRON2000 wrote:

williambl wrote:

I still only get the result shown here: http://epic.punbb-hosting.com/viewtopic.php?id=22

Hmm... works in chrome.

Me too, unless the /nothing was meant to be a comment.


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

Offline

 

#34 2012-06-04 02:51:12

williambl
Scratcher
Registered: 2011-04-08
Posts: 100+

Re: Using scratchblocks on your forum!

Then firefox doesn't work with it...

EDIT: Chrome does though...
EDIT2: The /nothing block only happens with chrome and I never actually put it there. I think it thinks it is a html tag so it just put it there.

Last edited by williambl (2012-06-04 02:58:38)


http://internetometer.com/imagesmall/34650.png
http://www.danasoft.com/sig/Epicnesssign.jpg

Offline

 

#35 2012-06-05 10:05:10

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

Re: Using scratchblocks on your forum!

bump


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

Offline

 

#36 2012-06-08 21:03:12

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: Using scratchblocks on your forum!

hi, I'm using 000webhost for hosting, and phpbb3, to be exact.  It's doesn't seem to work for me.  Do I put the script in before the ?> or after that, and before the </html>?


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#37 2012-06-08 21:04:39

joletole
Scratcher
Registered: 2011-02-20
Posts: 1000+

Re: Using scratchblocks on your forum!

Geonro, check our forums, I have sent you an email of your new password. PunBB said I had to change for some reason.

Offline

 

#38 2012-06-08 22:01:40

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: Using scratchblocks on your forum!

XenoK wrote:

hi, I'm using 000webhost for hosting, and phpbb3, to be exact.  It's doesn't seem to work for me.  Do I put the script in before the ?> or after that, and before the </html>?

bump


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#39 2012-06-09 10:07:44

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: Using scratchblocks on your forum!

XenoK wrote:

XenoK wrote:

hi, I'm using 000webhost for hosting, and phpbb3, to be exact.  It's doesn't seem to work for me.  Do I put the script in before the ?> or after that, and before the </html>?

bump


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#40 2012-06-09 11:49:11

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

Re: Using scratchblocks on your forum!

XenoK wrote:

XenoK wrote:

XenoK wrote:

hi, I'm using 000webhost for hosting, and phpbb3, to be exact.  It's doesn't seem to work for me.  Do I put the script in before the ?> or after that, and before the </html>?

bump

You should use the phpBB3 section, so (edited):

Put the code on the top of scripts_footer.html (use the template editor), then add the BBCode.


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

Offline

 

#41 2012-06-09 12:10:48

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: Using scratchblocks on your forum!

ok, I'm in the template editor.  I don't see a scripts_footer.html, though I see a simple_footer.html, an overall_footer.html, and a ucp_footer.html, and a mcp_footer.html

Last edited by XenoK (2012-06-09 12:11:38)


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#42 2012-06-09 12:40:22

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

Re: Using scratchblocks on your forum!

XenoK wrote:

ok, I'm in the template editor.  I don't see a scripts_footer.html, though I see a simple_footer.html, an overall_footer.html, and a ucp_footer.html, and a mcp_footer.html

Use overall_footer.html.


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

Offline

 

#43 2012-06-09 12:46:33

SciTecCf
Scratcher
Registered: 2011-11-23
Posts: 1000+

Re: Using scratchblocks on your forum!

I need help with adding this on PunBB Forums... I didn't even know that it was possible to add custom BBCodes to PunBB! Please give detailed instructions. I am using PunBB 1.4.1 on 1FreeHosting.


http://bit.ly/LCZEJRhttp://bit.ly/LSONcOhttp://bit.ly/LF3vIc
http://trinary.site40.net/images/scratchrank.php?username=SciTecCf&amp;display=small

Offline

 

#44 2012-06-09 12:59:03

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

Re: Using scratchblocks on your forum!

SciTecCf wrote:

I need help with adding this on PunBB Forums... I didn't even know that it was possible to add custom BBCodes to PunBB! Please give detailed instructions. I am using PunBB 1.4.1 on 1FreeHosting.

1. Find web_root/include/template/main.tpl (replace web_root with whatever your publishing directory is (mine is /public_html/, some people have /www/.)

2. Find </body> in main.tpl

3. Add before </body> in main.tpl:

Code:

<!-- Begin Scratchblocks Code -->
<script type="text/javascript">
// convert the BBCode tag
var j;
var posts = document.getElementsByClassName("postmsg");
for (j = 0; j < posts.length; j++) {
  var post = posts[j];
  var thishtml = post.innerHTML;
  var scripts = [];
  var i;
  for (i = 0; i < thishtml.split("[scratchblocks]").length - 1; i++) {
    var script = thishtml.split("[scratchblocks]")[i+1].split("[/scratchblocks]")[0];
    scripts[i] = script;
  }

  for (i = 0; i < thishtml.split("[scratchblocks]").length; i++) {
    thishtml = thishtml.replace(/\[scratchblocks\](.+?)\[\/scratchblocks\]/i, "<pre class=\"blocks\">"+scripts[i]+"</pre>");
  }

  post.innerHTML = thishtml;
}
</script>
<script type="text/javascript" src="http://scratch.mit.edu/ext/blocksplugin/blocksplugin.js"></script>
<script type="text/javascript">
var blocks = document.getElementsByClassName("blocks");
var i;
for (i=0; i<blocks.length; i++) {
  if (blocks[i].innerText) {
    blocks[i].innerHTML = blocks[i].innerText;
  }
  else {
    blocks[i].innerHTML = blocks[i].innerHTML.replace(/<br \/>/gi, "\r\n");
    blocks[i].innerHTML = blocks[i].innerHTML.replace(/<br>/gi, "\r\n");
    blocks[i].innerHTML = blocks[i].innerHTML.replace(/&/g, "&amp;");
    blocks[i].innerHTML = blocks[i].innerHTML.replace(/</g, "&lt;");
    blocks[i].innerHTML = blocks[i].innerHTML.replace(/>/g, "&gt;");
    blocks[i].innerHTML = blocks[i].innerHTML.replace(/"/g, "&quot;");
    blocks[i].innerHTML = blocks[i].innerHTML.replace(/'/, "'");
  }
}
scratchBlocksPlugin.parse({containerTag: 'pre', containerClass: 'blocks'});
</script>
<!-- End Scratchblocks Code -->

4. Upload block images
http://scratch.mit.edu/ext/blocksplugin/hat_bg.png as hat_bg.png
http://scratch.mit.edu/ext/blocksplugin/hat_rightedge.png as hat_rightedge.png
http://scratch.mit.edu/ext/blocksplugin/gf.png as gf.png.
http://scratch.mit.edu/ext/blocksplugin/cwrap.png as cwrap.png


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

Offline

 

#45 2012-06-09 13:14:48

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: Using scratchblocks on your forum!

ok it works but it thinks all the blocks are obsolete


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#46 2012-06-09 14:50:49

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

Re: Using scratchblocks on your forum!

XenoK wrote:

ok it works but it thinks all the blocks are obsolete

What?  Are you sure you're using them right?


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

Offline

 

#47 2012-06-09 15:06:57

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: Using scratchblocks on your forum!

GeonoTRON2000 wrote:

XenoK wrote:

ok it works but it thinks all the blocks are obsolete

What?  Are you sure you're using them right?

nvr mind, p110 got them to work.  Also, what's up with the repeat block?  The side is missing!


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#48 2012-06-09 16:00:07

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

Re: Using scratchblocks on your forum!

XenoK wrote:

GeonoTRON2000 wrote:

XenoK wrote:

ok it works but it thinks all the blocks are obsolete

What?  Are you sure you're using them right?

nvr mind, p110 got them to work.  Also, what's up with the repeat block?  The side is missing!

You need to upload cwrap.png.  See here, step #4.


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

Offline

 

#49 2012-06-09 16:30:18

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: Using scratchblocks on your forum!

GeonoTRON2000 wrote:

XenoK wrote:

GeonoTRON2000 wrote:


What?  Are you sure you're using them right?

nvr mind, p110 got them to work.  Also, what's up with the repeat block?  The side is missing!

You need to upload cwrap.png.  See here, step #4.

thx!  It completely works now!


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#50 2012-06-16 15:15:02

stevetheipad
Scratcher
Registered: 2011-08-06
Posts: 1000+

Re: Using scratchblocks on your forum!

Is this compatible with Fluxbb 1.5? And where do we add the image files and where do we find them?


http://i.imgur.com/0x8ia.jpg
gone

Offline

 

Board footer