Creates a button next to the 'Add your Comments' one which provides an AJAX-driven preview of the post in the desired format. The preview is made to look like a new comment, much like an AJAX-ified version of yay-hooray's preview system.
This is an updated version of what the lussumo forum is running.
Other Requirements (if any):
works like a charm on my board. thanks a bunch.
Wanderer Yes my only problem with it is the preview.png looking ugly in Exploder so I changed it to a .gif and it looks much better.
Posted: Thursday, 5 April 2007 at 7:34AM
Cause alls the PNG Files (such as the Smileys from the Smiley ext.) such ugly borders? I also recognized it, but instructed my users, to use firefox :P
so simply converting all PNG to GIFs? (and changing the according links)
Wanderer GIFs need to be made with the background color they will sit on in mind, so if it's white all the time or pale blue all the time that's fine.
If you make a GIF with a white mask and place it over a pale blue background it will have a white halo around it - ugly.
If there are many background colors to take into account, PNGs are better because they have true transparency, except for Exploder of course.
Posted: Thursday, 5 April 2007 at 7:42AM
meens, I have to make them, when I have definitely found my style and know, which transperancy color I need, or neglect the pooor IEx users
Wanderer If you want to persist with PNGs, try putting the code below into a text file called pngfix.js and place it on your server.
Then put this into the head section of each page...
<script type="text/javascript" src="http://www.yourdomain/forum/pngfix.js"></script>// Correctly handle PNG transparency in Win IE 5.5 or higher.<br />// http://www.infolink.net.au<br /><br />function correctPNG() <br /> {<br /> for(var i=0; i<document.images.length; i++)<br /> {<br /> var img = document.images[i]<br /> var imgName = img.src.toUpperCase()<br /> if (imgName.substring(imgName.length-3, imgName.length) == "PNG")<br /> {<br /> var imgID = (img.id) ? "id='" + img.id + "' " : ""<br /> var imgClass = (img.className) ? "class='" + img.className + "' " : ""<br /> var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "<br /> var imgStyle = "display:inline-block;" + img.style.cssText <br /> if (img.align == "left") imgStyle = "float:left;" + imgStyle<br /> if (img.align == "right") imgStyle = "float:right;" + imgStyle<br /> if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle <br /> var strNewHTML = "<span " + imgID + imgClass + imgTitle<br /> + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"<br /> + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"<br /> + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" <br /> img.outerHTML = strNewHTML<br /> i = i-1<br /> }<br /> }<br /> }<br />window.attachEvent("onload", correctPNG);
It works well but may take a few seconds on each page depending on how many PNGs it has to fix and how big they are.
Posted: Thursday, 5 April 2007 at 7:58AM
ok ok, I'll try it... I'll post, wheter it works...
Thanks so long
now you can do this through Nuggets, I guess.
Wanderer Yes, Nugget would be ideal for this, add it to a "head tag" pan and cook it!
Posted: Thursday, 5 April 2007 at 6:54PM
don't escape single quotes. Nuggets will do it by itself
try this. provided this code actually works.??<br /><script type="text/javascript">function correctPNG()<br />{<br />for(var i=0; i<document.images.length; i++)<br />{<br />var img = document.images[i]<br />var imgName = img.src.toUpperCase()<br />if (imgName.substring(imgName.length-3, imgName.length) == "PNG")<br />{<br />var imgID = (img.id) ? "id='" + img.id + "' " : ""<br />var imgClass = (img.className) ? "class='" + img.className + "' " : ""<br />var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "<br />var imgStyle = "display:inline-block;" + img.style.cssText<br />if (img.align == "left") imgStyle = "float:left;" + imgStyle<br />if (img.align == "right") imgStyle = "float:right;" + imgStyle<br />if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle<br />var strNewHTML = "<span " + imgID + imgClass + imgTitle<br />+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"<br />+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"<br />+ "(src='" + img.src + "', sizingMethod='scale');\"></span>"<br />img.outerHTML = strNewHTML<br />i = i-1<br />}<br />}<br />}<br />if (window.attachEvent)<br />window.attachEvent("onload", correctPNG);<br />else<br />window.onload=correctPNG;<br /><br /></script><br />
well, this doesn't work for me. This way the script-nugget kills off an image one also located in the Head tag. Whereas that wasn't the case with Wanderer's option.
whats ur website
and where is the png image
Wanderer I didn't mean put the entire JavaScript in the Head Nugget, simply the link to it....
<script type="text/javascript" src="/wherever.it.lives/pngfix.js"></script>
Posted: Thursday, 5 April 2007 at 10:15PM
@Wanderer - I know that :)
@MySchizoBuddy - the png image is also in the Head tag (1) with the script there as (0) (now it is with the Wanderer's option):
here
PS: Ooops.. just found out that it doesn't work in Opera (mac)
yes, I haven't tested it with some other browsers, but Wanderer's script (no matter how activated) does kill pngs in (mac) Opera
u shouldn't need png fix for opera. so just wrap the script around <!--[if IE]><script type="text/javascript" src="/wherever.it.lives/pngfix.js"></script><![endif]-->
thanks :)
works great, thanks!
Uploaded version 2.5 of Preview Post.
hmm, recently moved to a new server - along with spellchecker - preview post is not working - I tried version 2.5 - then i reverted to version 2.1. No luck, the message I'm getting is:
Line: 55
Char: 4
Error: Unknown runtime error
Code: 0
I'm using the tabled theme
I'm getting extra lines in the preview, compared to the submitted message. Maybe AutoP interferes with this extension?
Is it possible to use this extension with the delbat theme?
Conflict between FCKeditor and Preview Post 2.1? # 16
Any chance of getting this patch into preview post? It seemed to work just fine for me with and without FCK enabled.
mattucf, yes, I think it does. If you have any ideas on stopping it conflicting, please let me know in the AutoP discussion.
Uploaded version 2.5.1 of Preview Post.
ok I added it in
Lovely job SirNot, thanks :)
Just a random thought related to IE6, now that IE7 is out and gaining ground, would it be worth changing the preview graphic back to being an alpha blended PNG and adding the GIF one just for IE6 and lower via a conditional style sheet? It's just that the preview graphic looks a little rough now when it was smooth before (I understand the reasons for changing it at the time).
I started trying to hack the preview.js file to output code that would work with the tabled theme, but I'm absolute rubbish with Javascript. Anyone else willing to help out and take a stab at it?
any ideas on the fix for FCK conflict?
2.5.1 includes the fix, just read the 5 or so posts directly before yours...
It's working in my Vanilla test forums. You will need to be signed up and logged in to try it out.
I am running 2.5.1 and the latest FCK :-) Any suggestions
Check the order of activation of the extensions in the header and try and duplicate it - see if it helps. Actually, before you do that, post the order of activation of your extensions here so we have a record. If there's a conflict in the extension activation ordering that is causing this we need to know. Where are your forums, always helps if we can have a look around.
hey stash - vintagebaseballcardforum.com is the forum. I actually deactivated them both - reuploaded - made the change suggested in FCK and then activated FCK followed by PP. Thanks for your help on this.
So it's working now?
it still seems funky to me.
Interesting, if you try and embed an image and don't properly write the code - the preview shoves all the text to the "left" side of the screen. If you write the code properly - it displays in the correct place. You might want to consider looking into that.
Could anyone please rewrite this extension so that it would work in tabled / delbat themes? I tried my best, but didn't succeed.
it should just be a matter of fixing up the js to find/insert different html...
Yeah, I know. Guess I lack the skills :]
Nice - thanks, SirNot.
Not sure if you're after WYSIWYG perfection - if so, only flaws I've seen are Vanillacons don't show and addressee / BG color of whispers isn't added (one user remarked this made her uneasy about hitting "submit").
Uploaded version 2.5.2 of Preview Post.
fixed so it reflects whisper status of comment-to-be.
wow.
Wanderer Wow indeed, no flies on SirNot!
Has anyone else found a possible conflict with PreviewPost and MemberList? With MemberList disabled, Preview works fine, but with MemberList enabled I get:
Warning: include(extensions/MembersList/conf/language.php) [function.include]: failed to open stream: No such file or directory in /home/marrow/public_html/vanilla/extensions/MembersList/default.php on line 36
Warning: include() [function.include]: Failed opening 'extensions/MembersList/conf/language.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/marrow/public_html/vanilla/extensions/MembersList/default.php on line 36
Warning: include(extensions/MembersList/conf/settings.php) [function.include]: failed to open stream: No such file or directory in /home/marrow/public_html/vanilla/extensions/MembersList/default.php on line 37
Warning: include() [function.include]: Failed opening 'extensions/MembersList/conf/settings.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/marrow/public_html/vanilla/extensions/MembersList/default.php on line 37
Test
Alty-im getting the exact same error with preview post/Memeber list : did you find a fix?
The problem is that MemberList uses a static include path (ie, 'extensions/MemberList/whatever.php'). I'm not sure why that causes a problem, but it does. You need to change the various include paths to $Configuration['EXTENSIONS_PATH'].'MemberList/whatever.php', or the appropriate path.
as timfire said what causes the problem is MemberList's use of relative paths rather than absolute ones. this causes the errors during the preview because ajax.php is not in the root vanilla directory, as MemberList assumes it to be.
Problem:
Preview Post 2.5.2 working fine with my FCKeditor.
Im just getting the background "preview.gif" repeated, looking ugly :(
even if preview.css says:
#Comment_Preview {
background-position: center top;
background-repeat: no-repeat;
}
He is repeating it on my firefox 2.0.0.12.
any hint or idea? solution?
thx
i think i know why :(
my style "Europe After The Rain" is using a reapeating pic where the "Preview" image now is shown ...
thats why he is reapeating it even if the preview.css says: no-reapeat
i think the style css is cuting this order from the preview.css
someone got any idea how get the image NOT repeated if the user is viewing the preview?
Addons are custom features that you can add to your Vanilla forum. Addons are created by our community of developers and people like you!
We review addons to make sure they are safe and don't cause bugs. An addon is considered to be "Vanilla Approved" once our review process is complete.