edit: nevermind, i got it!
the debugged code is here
// ==UserScript== // @name Antidote! // @namespace rookwood101,Cocolover,LS97,flashgocrazy,roijac // @description Enable youtube and projects on scratch forum // @include http://scratch.mit.edu/forums/viewtopic.php* // @version 1.1 // ==/UserScript== var version = 11; if (document.URL.indexOf('http://scratch.mit.edu/forums/viewtopic.php') != -1) { var containerelements = Array.prototype.slice.call(document.getElementsByClassName('postmsg')).concat(Array.prototype.slice.call(document.getElementsByClassName('incqbox'))); var p_elements = new Array(); for (i=0;i<containerelements.length;i++) { p_elements = p_elements.concat(Array.prototype.slice.call(containerelements[i].getElementsByTagName('p'))); } for (j=0;j<p_elements.length;j++) { var code = p_elements[j].innerHTML; //replace youtube tags var addYoutube = code; var youtubeids = new Array(); for (i=0;i<addYoutube.split(/\[youtube\]/i).length-1;i++) { youtubeids[i] = addYoutube.split(/\[youtube\]/i)[i+1].split(/\[\/youtube\]/i)[0]; if (youtubeids[i].replace(/[a-zA-Z0-9\-_]+/, "") != "") { youtubeids[i] = 'dQw4w9WgXcQ'; } } for (i=0;i<youtubeids.length;i++) { addYoutube = addYoutube.replace(/\[youtube\]([a-zA-Z0-9\-_]+)\[\/youtube\]/i, '<iframe width="510" height="315" src="http://www.youtube.com/embed/' + youtubeids[i] + '"frameborder="0" allowfullscreen></iframe>'); } //replace project tags var projectpath = new Array(); for (i=0;i<addYoutube.split(/\[scratch=flash\]/i).length-1;i++) { projectpath[i] = addYoutube.split(/\[scratch=flash\]/i)[i+1].split(/\[\/scratch\]/i)[0]; if (projectpath[i].replace(/[a-zA-Z0-9]+\/[0-9]+/i, "") != "") { projectpath[i] = 'Mike16112/675815'; } } var addProjects = addYoutube; for (i=0;i<projectpath.length;i++) { addProjects = addProjects.replace(/\[scratch=flash\]([a-zA-Z0-9]+\/[0-9]+)\[\/scratch\]/i, '<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/' + projectpath[i] + '.sb?version=1.1"></object>'); } //Saving Changes p_elements[j].innerHTML = addProjects; } document.getElementsByTagName("body")[0].innerHTML = document.getElementsByTagName("body")[0].innerHTML.replace(/antidoteexists=false/ig, 'antidoteexists=true&version=' + version); }
This fixes the problem of bbcode inside [code ] tag, which now doesn't get parsed. rookwood, you should probably update the script, LS97 should probably ipdate the php code to alert the user if the version is smaller than 11
edit: forgot to say i also removed the [img] tag parsing
Last edited by roijac (2012-04-17 09:38:42)
Offline
You know images are back on, roijac?
Offline
roijac wrote:
edit: nevermind, i got it!
the debugged code is hereCode:
// ==UserScript== // @name Antidote! // @namespace rookwood101,Cocolover,LS97,flashgocrazy,roijac // @description Enable youtube and projects on scratch forum // @include http://scratch.mit.edu/forums/viewtopic.php* // @version 1.1 // ==/UserScript== var version = 11; if (document.URL.indexOf('http://scratch.mit.edu/forums/viewtopic.php') != -1) { var containerelements = Array.prototype.slice.call(document.getElementsByClassName('postmsg')).concat(Array.prototype.slice.call(document.getElementsByClassName('incqbox'))); var p_elements = new Array(); for (i=0;i<containerelements.length;i++) { p_elements = p_elements.concat(Array.prototype.slice.call(containerelements[i].getElementsByTagName('p'))); } for (j=0;j<p_elements.length;j++) { var code = p_elements[j].innerHTML; //replace youtube tags var addYoutube = code; var youtubeids = new Array(); for (i=0;i<addYoutube.split(/\[youtube\]/i).length-1;i++) { youtubeids[i] = addYoutube.split(/\[youtube\]/i)[i+1].split(/\[\/youtube\]/i)[0]; if (youtubeids[i].replace(/[a-zA-Z0-9\-_]+/, "") != "") { youtubeids[i] = 'dQw4w9WgXcQ'; } } for (i=0;i<youtubeids.length;i++) { addYoutube = addYoutube.replace(/\[youtube\]([a-zA-Z0-9\-_]+)\[\/youtube\]/i, '<iframe width="510" height="315" src="http://www.youtube.com/embed/' + youtubeids[i] + '"frameborder="0" allowfullscreen></iframe>'); } //replace project tags var projectpath = new Array(); for (i=0;i<addYoutube.split(/\[scratch=flash\]/i).length-1;i++) { projectpath[i] = addYoutube.split(/\[scratch=flash\]/i)[i+1].split(/\[\/scratch\]/i)[0]; if (projectpath[i].replace(/[a-zA-Z0-9]+\/[0-9]+/i, "") != "") { projectpath[i] = 'Mike16112/675815'; } } var addProjects = addYoutube; for (i=0;i<projectpath.length;i++) { addProjects = addProjects.replace(/\[scratch=flash\]([a-zA-Z0-9]+\/[0-9]+)\[\/scratch\]/i, '<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/' + projectpath[i] + '.sb?version=1.1"></object>'); } //Saving Changes p_elements[j].innerHTML = addProjects; } document.getElementsByTagName("body")[0].innerHTML = document.getElementsByTagName("body")[0].innerHTML.replace(/antidoteexists=false/ig, 'antidoteexists=true&version=' + version); }This fixes the problem of bbcode inside [code ] tag, which now doesn't get parsed. rookwood, you should probably update the script, LS97 should probably ipdate the php code to alert the user if the version is smaller than 11
edit: forgot to say i also removed the [url]tag parsing
Great work! I think we should maybe think up a way of making it so only trusted members can use it, although there's no definitive way to do this.
Offline
next issue is to find a way of preventing projects from being autoplaying
another detail: projects and videos in sigs don't get parsed, because there's no place for them, so they're a bit unnecessary. i could add that if you want
Last edited by roijac (2012-04-17 11:22:12)
Offline
LS97 wrote:
I will discuss the issue with rookwood101 and I'm sure he will agree to remove Antidote from the "public".
Thanks!
LS97 wrote:
This experimental version of Antidote could certainly turn out to be a productive way of trying out new features for the 2.0 forums. I will definitely be trying this out with rookwood (I already have some ideas ) and we'll be sure to contact the team if we come up with anything interesting!
Sounds good!
Offline
Is it possible to add a video file to your scratch project?
Offline
123therealwoodstock wrote:
Is it possible to add a video file to your scratch project?
Not unless you hack scratch! (If you want to do just that, search shift-click R in the search bar on the main site.)
Last edited by PullJosh (2012-04-27 17:05:40)
Offline
PullJosh wrote:
123therealwoodstock wrote:
Is it possible to add a video file to your scratch project?
Not unless you hack scratch! (If you want to do just that, search shift-click R in the search bar on the main site.)
Oh, and you aren't actually hacking Scratch, when you do that.
Offline
rookwood, I don't know if this is under your area of expertise, but I downloaded the latest version of flash for Internet Explorer 9, put it in compatibility mode, and the flahs player won't work. Can you help me? Thanks.
Offline
the pictures work (always); but youtube and scratch work. lets see if HTML iFrames work. Instead of letting scratch convert it, nobody does!:
<iFrame src="http://scratch.mit.edu/rookwood101/1951425"></iFrame>
<iFrame src="http://scratch.mit.edu/rookwood101/1951425"></iFrame>
Offline
Firedrake969 wrote:
rookwood, I don't know if this is under your area of expertise, but I downloaded the latest version of flash for Internet Explorer 9, put it in compatibility mode, and the flahs player won't work. Can you help me? Thanks.
your signature; i am running safari on windows! does this smiley work; (~) :~:
Offline
Firedrake969 wrote:
rookwood, I don't know if this is under your area of expertise, but I downloaded the latest version of flash for Internet Explorer 9, put it in compatibility mode, and the flahs player won't work. Can you help me? Thanks.
Simple solution: download firefox! :p
Offline
coolhogs wrote:
PullJosh wrote:
123therealwoodstock wrote:
Is it possible to add a video file to your scratch project?
Not unless you hack scratch! (If you want to do just that, search shift-click R in the search bar on the main site.)
Oh, and you aren't actually hacking Scratch, when you do that.
After you Shift-click the R in the scratch logo select 'turn fill screen off', click the white frame, click new morph and look for movie. no you are NOT hacking, it is just using not fill screen mode witch is how you access MIT Squeak and make browser 'hacks' (making scratch a scratch mod through the system browser).
Offline
I would like to suggest a new tag for andidote: the offtopic tag to signify something is offtopic, as seen in this forum thread. (not on scratch)
Offline
how does the scratch tag work? I can't seem to figure it out! do you put the source inside the tags or what?
Offline
yeah, the scratch tag isnt working for me.
Offline
[scratch=flash]Jonathan50/2794894[/scratch]
Last edited by Jonathan50 (2012-09-28 05:04:47)
Offline
flashgocrazy wrote:
[youtube]JTuXPUP06H0[/youtube] test
Last edited by Jonathan50 (2012-09-28 16:54:50)
Offline
jontmy00 wrote:
Jonathan50 wrote:
[scratch=flash]Jonathan50/2794894[/scratch]
That is a necropost. Please avoid doing that.
but the tread is still relevant
Offline
Hello,
This looks really cool so I thought I would try it out as many of my images NEVER load, however when I click the link Chrome blocks it and when I click more info it says you have to upload it to the Chrome Store for safety
Offline
bannanaman wrote:
Hello,
This looks really cool so I thought I would try it out as many of my images NEVER load, however when I click the link Chrome blocks it and when I click more info it says you have to upload it to the Chrome Store for safety
Well, this topic is really old. Let me tell you the story:
A long long time ago, when even I was a baby at Scratch, the forum images were disabled for everyone because of a recent troll attack. Thousands of scratchers complained, but, one scratcher by the name of rookwood101 created a script so that people could see images again.
The ST approved this and said it was fine that he did this. As you can see by the number of pages, many people downloaded it. But when the ST allowed images back, this antidote didn't work and caused a lot of glitches.
One scratch even created a topic saying people shouldn't download the antidote any more because it didn't work.
Well, that's my story!
Offline