Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Select all in [code] and [php]
#41
I walked, I want the button to the right.
Not only the text
Reply
#42
Not working, just after click on "select all" page scroll top Sad
[MyBB 1.8 Czech translation] [MyBB 1.8 plugins]: Prune old PMs + optimize DB plugin --- Thank you/like system
Reply
#43
(11-02-2017, 08:09 PM)Eldenroot Wrote: Not working, just after click on "select all" page scroll top Sad

<script type="text/javascript">
function selectCode(a) {
   'use strict';

   // Get ID of code block
   var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
   var s, r;

   // Not IE and IE9+
   if (window.getSelection) {
      s = window.getSelection();
      // Safari and Chrome
      if (s.setBaseAndExtent) {
         var l = (e.innerText.length > 1) ? e.innerText.length - 1 : 1;
         try {
            s.setBaseAndExtent(e, 0, e, l);
         } catch (error) {
            r = document.createRange();
            r.selectNodeContents(e);
            s.removeAllRanges();
            s.addRange(r);
         }
      }
      // Firefox and Opera
      else {
         // workaround for bug # 42885
         if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) === '<BR>') {
            e.innerHTML = e.innerHTML + '&nbsp;';
         }

         r = document.createRange();
         r.selectNodeContents(e);
         s.removeAllRanges();
         s.addRange(r);
      }
   }
   // Some older browsers
   else if (document.getSelection) {
      s = document.getSelection();
      r = document.createRange();
      r.selectNodeContents(e);
      s.removeAllRanges();
      s.addRange(r);
   }
   // IE
   else if (document.selection) {
      r = document.body.createTextRange();
      r.moveToElementText(e);
      r.select();
   }
}
</script>
Reply
#44
Thank you, great works fine! Rep added! +1
[MyBB 1.8 Czech translation] [MyBB 1.8 plugins]: Prune old PMs + optimize DB plugin --- Thank you/like system
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)