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)
Offline
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)
Offline
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 
and not
or 
Last edited by williambl (2012-06-03 16:08:16)
Offline
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.
Offline
By the way, document.getElementByClassName is not supported by all browsers. Rather, you should use IDs, and use document.getElementById.
Offline
williambl wrote:
I still only get the result shown here: http://epic.punbb-hosting.com/viewtopic.php?id=22
Hmm... works in chrome.
Offline
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.
Offline
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)
Offline
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>?
Offline
Geonro, check our forums, I have sent you an email of your new password. PunBB said I had to change for some reason.
Offline
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
Offline
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
Offline
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.
Offline
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)
Offline
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.
Offline
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:
<!-- 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, "&");
blocks[i].innerHTML = blocks[i].innerHTML.replace(/</g, "<");
blocks[i].innerHTML = blocks[i].innerHTML.replace(/>/g, ">");
blocks[i].innerHTML = blocks[i].innerHTML.replace(/"/g, """);
blocks[i].innerHTML = blocks[i].innerHTML.replace(/'/, "'");
}
}
scratchBlocksPlugin.parse({containerTag: 'pre', containerClass: 'blocks'});
</script>
<!-- End Scratchblocks Code -->4. Upload block images
as hat_bg.png
as hat_rightedge.png
as gf.png.
http://scratch.mit.edu/ext/blocksplugin/cwrap.png as cwrap.png
Offline
XenoK wrote:
ok it works but it thinks all the blocks are obsolete
What? Are you sure you're using them right?
Offline
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!
Offline
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.
Offline
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!
Offline
Is this compatible with Fluxbb 1.5? And where do we add the image files and where do we find them?

Offline