Current time: 01-08-2009, 11:29 AM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating Custom MyCode
09-06-2006, 02:40 PM
Post: #11
RE: Creating Custom MyCode
is there any way we can filter or perform checks/modifications to the variables given?

Say with embedding stuff, it doesn't specify a mime type or whatever, I believe it could potentially be unsafe, if someone was able to apply a mime type, or something similar.
Find all posts by this user
Quote this message in a reply
09-06-2006, 03:07 PM
Post: #12
RE: Creating Custom MyCode
asmilewyt Wrote:oh it doesn't work.just show the blank in the post
Check this.

Flash tag
Replacement
<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\">
<param name=\"movie\" value=\"$1\" />
<param name=\"quality\" value=\"high\" />
<embed src=\"$1\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\"></embed>
</object>

WMP tag
Replacement
<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" name="mediaplayer1" ShowStatusBar="true" EnableContextMenu="true" autostart="false" width="320" height="240" loop="false" src="$1" />
Find all posts by this user
Quote this message in a reply
09-06-2006, 04:16 PM (This post was last modified: 09-06-2006 04:17 PM by Aweb.)
Post: #13
RE: Creating Custom MyCode
Here is a better flash tag that supports width and height

Syntax : [flash=WidthxHeight]URL[/flash]

Regular expression :
\[flash\=(.*?)x(.*?)\](.*?)\[/flash\]

Replacement :
<object width="$1" height="$2"><param name="movie" value="somefilename.swf"><embed src="$3" width="$1" height="$2"></embed></object>

(No line breaks because it makes line breaks on the posts too
Find all posts by this user
Quote this message in a reply
09-12-2006, 06:53 AM
Post: #14
RE: Creating Custom MyCode
I'm trying to get a spoiler tag to work.  I know there's a mod for this, but I'd rather just create a custom mycode than have to have a mod for it.

I added the simple function to jscripts/general.js:
Code:
function showSpoiler(block)
{
   block.nextSibling.nextSibling.style.display ="block";
   block.parentNode.removeChild(block);
}

As my replacement code, I have:
PHP Code:
<input type="button" style="background:black;color:white;" onClick="showSpoiler(this);" value="SPOILER - Click to Show">
<
span style="display:none">$1</span

I know the javascript and html work, because I've used that exact code on my website several times.  I can't figure out what's preventing it from working in MyBB though.  Any ideas?
Find all posts by this user
Quote this message in a reply
09-13-2006, 03:33 AM
Post: #15
RE: Creating Custom MyCode
Well, this appears to be a bug. I looked at the source code for the page that's output and discovered why it isn't working.

Instead of onClick="showSpoiler(this);", the board is for some unknown reason outputting o<strong></strong>nClick="showSpoiler(this);"

wtf???
Find all posts by this user
Quote this message in a reply
09-13-2006, 04:59 AM
Post: #16
RE: Creating Custom MyCode
That would be MyBB's "Javascript fixer" in action. Toungue It basically tries to make sure no dangerous Javascript sneaks through the post parser. The only way to avoid it is to use a plugin and the "parse_message_end" hook.
Visit this user's website Find all posts by this user
Quote this message in a reply
09-13-2006, 07:09 AM
Post: #17
RE: Creating Custom MyCode
I figured it might be something like that but WHY would the javascript fixer be "fixing" custom MyCode? I think that's something that should be changed.
Find all posts by this user
Quote this message in a reply
09-13-2006, 11:32 AM
Post: #18
RE: Creating Custom MyCode
It stripped it after parsing the post however this will be changed to before for subsequent releases.

Chris Boulton
Rate MyBB @ HotScripts.com - Show your support!
You can also Write a review! - Help us grow!
Visit this user's website Find all posts by this user
Quote this message in a reply
09-13-2006, 06:46 PM (This post was last modified: 09-13-2006 09:32 PM by Galen.)
Post: #19
RE: Creating Custom MyCode
Ah, so in the next release, my javascript will work?  That'll be nice Smile

Edit: Oh yes, the MyCode replacement text definately needs to be run without being parsed. I just tried setting up a "text quote" that uses a textarea in place of the quote_body div. It was very nice, except that all line breaks got parsed, so in the text box you'd see <br /> all over the place. Hehehe...
Find all posts by this user
Quote this message in a reply
09-14-2006, 12:00 PM (This post was last modified: 09-14-2006 12:03 PM by Ozidave.)
Post: #20
RE: Creating Custom MyCode
Aweb Wrote:Here is a better flash tag that supports width and height

Syntax : [flash=WidthxHeight]URL[/flash]

Regular expression :
\[flash\=(.*?)x(.*?)\](.*?)\[/flash\]

Replacement :
<object width="$1" height="$2"><param name="movie" value="somefilename.swf"><embed src="$3" width="$1" height="$2"></embed></object>

(No line breaks because it makes line breaks on the posts too

Sure one can use additional variables to parse the width and height... But what's the point when one is only going to set it once in the MyCode.. Not unless you want the poster to be able to change the wrapper height and width to enlarge the display ??

Not something I would like a user to be able to do...

Have a look here > http://community.mybboard.net/showthread...4#pid80914

It's simple enough without giving the user the option to float the variables... Wink
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: