The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Trying to put a link in window.open window that puts text in post textarea-half works
On my forum I have replaced the attachment window popup with a window.open link to a page of my own. I want this page to operate in a manner similar to the smilies page. In that, when you click on a link, it puts text in the textarea for your post.
I wanted to use the exact method the smilies page used but the code has been compressed and is too hard to read. Instead, I tried to simulate that page from what I could decipher. In the post area I modified the existing attachment javascript to be this: HTML Code:
document.write('<input type="button" id="manage_attachments_button" class="button" tabindex="1" style="font-weight:normal" value="$vbphrase[manage_attachments]" title="$vbphrase[add_edit_files_attached]" onclick="window.open(\'http://www.reefsome.com/gallery/v/ludnix\',\'\',\'width=1024,height=768\');" />');
In the page that opens I put this javascript: HTML Code:
function addToPost(text){ posttext = window.opener.document.getElementById('vB_Editor_001_textarea'); posttext.value += text; } if(window.opener != null){ document.write('<br /><a onclick="addToPost(\'\\nadded some content\');" style="cursor: pointer;">test</a>'); } This code works - but not for everyone. It seems as though, on some systems, it doesn't write to the text area. However, when tested, it does write to another textarea on the same page. When I added another textarea to the post page and modified the javascript to add to that textarea it successfully added the message to that textarea. You can test if for yourself by going to www.reefsome.com/forums/ and using this login: Code:
username: test password: brokenjs I have absolutely no idea what could be causing this. The smilies page works on the same systems and as far as I could tell (and it was kind of hard to tell) the smilies page works in a manner similar to this. --------------- Added [DATE]1246328205[/DATE] at [TIME]1246328205[/TIME] --------------- I retrieved the generated HTML source code from one of the systems that this code wasn't working on. I then compared that source with the html source of my own and found that this line did not match: HTML Code:
<input type="hidden" name="wysiwyg" id="vB_Editor_001_mode" value="1" /> <script type="text/javascript"> <!-- vB_Editor['vB_Editor_001'] = new vB_Text_Editor('vB_Editor_001', 1, '14', '1', undefined, ''); //--> </script> After figuring out that these lines were the difference between the "enhanced" editor and the "standard" editor I ended up disabling use of the enhanced editor. This is sort of the easy way out but I really don't feel as though the use of the enhanced editor is worth the time it would take to learn vbulletin's method and adapt it. However, if anyone could offer insight on an easy way to get around this then I'm all for it. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|