Activity Stream
48,167 MEMBERS
6752 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1.     
    #1
    Member

    Wink Sellect All (code/Hack)?

    I want to be able to do this in a forum :



    Can anyone help me on this?
    The "Select All" code, I know the Link Checker is from TubeNow witch ;I'll be installing soon as well.

    Thanks in advance.
    PUMA Reviewed by PUMA on . Sellect All (code/Hack)? I want to be able to do this in a forum : http://www.besthostingforums.com/images/cdn/besthostingforums.com/2009/10/9s5nw5-1.png http://www.besthostingforums.com/images/cdn/besthostingforums.com/2009/10/sfhqp3-1.png Can anyone help me on this? The "Select All" code, I know the Link Checker is from TubeNow witch ;I'll be installing soon as well. Thanks in advance. Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    phpBB code for the select all:

    Code: 
    <a href="#" onclick="selectCode(this); return false;">Select All</a>
    Code: 
    <script type="text/javascript">
    <!--
    function selectCode(a)
    {
    	// Get ID of code block
    	var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
    
    	// Not IE
    	if (window.getSelection)
    	{
    		var s = window.getSelection();
    		// Safari
    		if (s.setBaseAndExtent)
    		{
    			s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);
    		}
    		// Firefox and Opera
    		else
    		{
    			// workaround for bug # 42885
    			if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) == '<BR>')
    			{
    				e.innerHTML = e.innerHTML + '&nbsp;';
    			}
    
    			var r = document.createRange();
    			r.selectNodeContents(e);
    			s.removeAllRanges();
    			s.addRange(r);
    		}
    	}
    	// Some older browsers
    	else if (document.getSelection)
    	{
    		var s = document.getSelection();
    		var r = document.createRange();
    		r.selectNodeContents(e);
    		s.removeAllRanges();
    		s.addRange(r);
    	}
    	// IE
    	else if (document.selection)
    	{
    		var r = document.body.createTextRange();
    		r.moveToElementText(e);
    		r.select();
    	}
    }
    //-->
    </script>
    There is a catch though, that code will select all text wrapped with <code></code> tags, which is how its used in proSilver based templates.

    If you're going to use this, you'll need to modify the code a bit, or you can just create your own JS function, which would be easier/better than using phpBB's.

  4.     
    #3
    Member
    you do realize we are in the vbulletin section right. or will the code also work in vbulletin?

  5.     
    #4
    Member
    i use it on vbulletn

  6.     
    #5
    Member
    Website's:
    WareztheDDL.com GTFO.ws
    you put that <script></script> in the header include template,
    then add
    <a href="#" onclick="selectCode(this); return false;">Select All</a>
    where you want it.


  7.     
    #6
    Member
    So, I put all that in my Header? ..Sorry, but I didn't understand

  8.     
    #7
    Member
    create a new file something_select_all.js >paste all the code> upload to your server
    edit header_include template and call that js
    Coding Horror Fan
    I don't read PM's frequently .

  9.     
    #8
    Member
    Website's:
    google.ba
    You can call it from SHOWTHREAD template.
    Dont need it on index, etc.

  10.     
    #9
    Member
    Website's:
    CysForum.com 3tivi.com CysForum.info
    Does this actually work?
    In the shadows of the warez scene since 2007...



  11.     
    #10
    Member
    The code above didn't worked for me:
    I used this:

    Put this in your notepad and save it as selectall.js
    Code: 
    function selectCode(a) 
    { 
       var e = a.parentNode.parentNode.getElementsByTagName('PRE')[0]; 
       if (window.getSelection) 
       { 
          var s = window.getSelection(); 
           if (s.setBaseAndExtent) 
          { 
             s.setBaseAndExtent(e, 0, e, e.innerText.length - 1); 
          } 
          else 
          { 
             var r = document.createRange(); 
             r.selectNodeContents(e); 
             s.removeAllRanges(); 
             s.addRange(r); 
          } 
       } 
       else if (document.getSelection) 
       { 
          var s = document.getSelection(); 
          var r = document.createRange(); 
          r.selectNodeContents(e); 
          s.removeAllRanges(); 
          s.addRange(r); 
       } 
       else if (document.selection) 
       { 
          var r = document.body.createTextRange(); 
          r.moveToElementText(e); 
          r.select(); 
       }
    - Upload selectall.js to /clientscripts


    Template Edits
    ================================================== ====
    Edit:headerinclude:

    Add:
    Code: 
    <script type="text/javascript" src="clientscript/selectall.js"></script>
    ================================================== ====
    Edit: bbcode_code

    After:
    PHP Code: 
    $vbphrase[code]: 
    Add:
    Code: 
    <a href="#" onclick="selectCode(this); return false;">Select All</a>
    ================================================== ====
    Edit: bbcode_html

    After:
    PHP Code: 
    $vbphrase[code]: 
    Add:
    Code: 
    <a href="#" onclick="selectCode(this); return false;">Select All</a>
    ================================================== ====
    Edit: bbcode_php

    After:
    PHP Code: 
    $vbphrase[code]: 
    Add:
    Code: 
    <a href="#" onclick="selectCode(this); return false;">Select All</a>
    Replace:
    Code: 
    $code
    With:
    Code: 
    <pre>$code</pre>
    ================================================== ====

    Hope it was helpfull!

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 3rd Apr 2012, 09:50 AM
  2. Someone has tried to hack me. ;D
    By M.D.House in forum General Discussion
    Replies: 12
    Last Post: 16th Oct 2011, 02:06 PM
  3. Replies: 1
    Last Post: 27th Aug 2011, 01:45 PM
  4. is it hack??? pls help...
    By subha86 in forum Webmaster Discussion
    Replies: 13
    Last Post: 30th Nov 2010, 01:36 AM
  5. [vBulletin BB Code] Moderated Message: (Like W-BB's Staff BB Code!)
    By Ghost Dog 13 in forum Webmaster Resources
    Replies: 13
    Last Post: 26th Sep 2009, 06:19 PM

Tags for this Thread

BE SOCIAL