vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Adding code selection button to postbit? (https://vborg.vbsupport.ru/showthread.php?t=236482)

Simon Lloyd 02-21-2010 11:59 PM

thanks for taking a look, it seems you have to go to some lengths to make this work in Firefox, i have it wotking in IE (not the example you linked to) but my whole reason for this was to please my firefox users.

I'll keep searching and post back.

kh99 02-22-2010 12:51 AM

I found this page: https://developer.mozilla.org/en/DOM/Selection which is the DOM referenece for FF (I think), and I made this example which works in FF:

Code:

<script type="text/javascript">
    function FFSelect(node)
    {
        r = document.createRange();
        r.selectNodeContents(node);
        window.getSelection().removeAllRanges();
        window.getSelection().addRange(r);
    }
</script>
<div style="margin:20px; margin-top:5px">
        <div class="smallfont" style="margin-bottom:2px">Code:</div>
        <pre name="codearea" class="alt2" dir="ltr" style="
                margin: 0px;
                padding: 0;
                border: 1px inset;
                width: 900;
                height: 400px;
                text-align: left;
                overflow: auto">This is some code to select</pre><input type="button" value="Highlight Code" onClick="javascript:this.parentNode.children[1].focus();FFSelect(this.parentNode.children[1]);">
</div>


Of course it won't work in IE, so I think what you really need is one Select function that tests for which functions exists and does the appropriate thing. Sorry I don't have time to work it all out just now.

Simon Lloyd 02-22-2010 08:49 PM

I found the solution thanks, the script in this instance had to be included with the bbcode....all sorted now, thanks for all your help!

Marco van Herwaarden 02-25-2010 10:43 AM

A thread (post) is already a form when viewed by a staff member, and as far as i know you can not nest forms.


All times are GMT. The time now is 03:49 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02221 seconds
  • Memory Usage 1,726KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete