Select all in [code] and [php]
#1
First of all, you need to add this code into headerinclude template:
<script type="text/javascript">
function selectCode(a)
{
   var e = a.parentNode.parentNode.getElementsByTagName('CODE')[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();
   }
}
</script>

Next you go to ACP > Configuration > Languages > English or the language that your board are using > global.lang.php and find:

Quote: php_code

then add this behind anything that already have in the box:

 <a href="#" onclick="selectCode(this); return false;">(SELECT ALL)</a> 

and do the same way for

Quote: code

=> Save it, then you're done.

Demo online: http://mybbvn.com/forum/thread-126.mybbvn
Reply
#2
He is allowed to put it here, until a mod moves it, that's how it works.
Coming soon..
Reply
#3
yeah, I just followed this thread http://community.mybboard.net/thread-5001.html
Reply
#4
thanks mate! Smile it is good if you can make it as a plugin not just do file edit.. Toungue
<signature too big>
Reply
#5
Amazing. Thank you very much!
Reply
#6
Nice!

Good Suggestion for Include as an Option on Core Smile

In Opera Browser, when I click SELECT ALL it select all the page and not all the Tag Content Huh, this only on the first PHP Code.
vBulletin/Wordpress/Magento/MyBB
Developer and Designer
Reply
#7
(2009-09-29, 06:18 AM)AndrewPH Wrote: thanks mate! Smile it is good if you can make it as a plugin not just do file edit.. Toungue

I were think about that, but this TUT just take some minutes, so I think that's not the big problem to do that. If you really need a plugin , I can make it for you.

(2009-09-29, 12:14 PM)Rafael Wrote: In Opera Browser, when I click SELECT ALL it select all the page and not all the Tag Content Huh, this only on the first PHP Code.

Oh sorry, I don't use Opera, so I didn't see this problem, and by the way, I don't know how to fix the problem. Sad
Reply
#8
maybe i try porting this to a plugin Smile i'll report back in a day Big Grin thanks for the idea
<signature too big>
Reply
#9
(2009-10-03, 11:44 AM)AndrewPH Wrote: maybe i try porting this to a plugin Smile i'll report back in a day Big Grin thanks for the idea

That should be good Big Grin
Reply
#10
(2009-10-03, 04:49 PM)Joey_Pham423 Wrote:
(2009-10-03, 11:44 AM)AndrewPH Wrote: maybe i try porting this to a plugin Smile i'll report back in a day Big Grin thanks for the idea

That should be good Big Grin

plugin attached.

use this in editing language file after "Code:"
<a href="#" onclick="selectCode(this); return false;"><span style="text-transform: uppercase; font-size: 0.8em; font-weight: bold;">[SELECT ALL]</span></a>

i don't know how to do a plugin which change the language file Toungue


Attached Files
.php   codeselect.php (Size: 2.67 KB / Downloads: 432)
<signature too big>
Reply


Forum Jump:


Users browsing this thread: 21 Guest(s)