[FIXED] 'Code: Select All' Does Not Select All

Discussion about the board itself, forums organization and site bugs.

[FIXED] 'Code: Select All' Does Not Select All

Postby barbaz » Sat Jan 06, 2018 6:21 pm

Like the title says.

Code: Select all
Test

Clicking "Select All" above should select the contents of the code block, "Test". But instead, it just opens this page in a new window.

I'm using Waterfox 56.0.1.

mozillaZine thread on the same problem: http://forums.mozillazine.org/viewtopic.php?f=11&t=3028516
*Always* check the changelogs BEFORE updating that important software!
Board search is currently partially broken: viewtopic.php?f=14&t=21752
Workaround: use your favorite search engine, add site:forums.informaction.com to your query
-
barbaz
Senior Member
 
Posts: 8620
Joined: Sat Aug 03, 2013 5:45 pm

Re: 'Code: Select All' Does Not Select All

Postby barbaz » Sat Jan 06, 2018 6:33 pm

This change to the board's selectCode() looks to fix it. Needs testing in multiple browsers to be sure it's a good solution.

Code: Select all
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();
      // Firefox and Opera
      if (document.createRange)
      {
         // 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.setStart(e.firstChild, 0);
                        r.setEnd(e.lastChild, e.lastChild.nodeValue && e.lastChild.nodeValue.length);
         s.removeAllRanges();
         s.addRange(r);
      }
      // Safari
      else if (s.setBaseAndExtent)
      {
         s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);
      }
   }
   // 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();
   }
}
*Always* check the changelogs BEFORE updating that important software!
Board search is currently partially broken: viewtopic.php?f=14&t=21752
Workaround: use your favorite search engine, add site:forums.informaction.com to your query
-
barbaz
Senior Member
 
Posts: 8620
Joined: Sat Aug 03, 2013 5:45 pm

Re: 'Code: Select All' Does Not Select All

Postby fatboy » Sat Jan 06, 2018 7:19 pm

In Fx 57.0 new code works (I have replaced a code in the local file)
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 SM/2.38 NS/2.9.0.12
fatboy
Junior Member
 
Posts: 40
Joined: Fri Jul 25, 2014 6:56 am

Re: 'Code: Select All' Does Not Select All

Postby barbaz » Sat Jan 06, 2018 8:56 pm

Thanks fatboy!

Also works for me on Pale Moon 27.6.2, Chromium 63.0.3239.84, and Opera 31.0.1889.174 (those just happen to be the versions I have on hand).

Still needs to be tested in Microsoft Edge, IE, and Safari. Any Windows or Mac OS users able to help?
*Always* check the changelogs BEFORE updating that important software!
Board search is currently partially broken: viewtopic.php?f=14&t=21752
Workaround: use your favorite search engine, add site:forums.informaction.com to your query
-
barbaz
Senior Member
 
Posts: 8620
Joined: Sat Aug 03, 2013 5:45 pm

Re: 'Code: Select All' Does Not Select All

Postby barbaz » Wed Jan 17, 2018 7:25 am

bump
*Always* check the changelogs BEFORE updating that important software!
Board search is currently partially broken: viewtopic.php?f=14&t=21752
Workaround: use your favorite search engine, add site:forums.informaction.com to your query
-
barbaz
Senior Member
 
Posts: 8620
Joined: Sat Aug 03, 2013 5:45 pm

Re: 'Code: Select All' Does Not Select All

Postby Giorgio Maone » Wed Jan 17, 2018 1:48 pm

Fixed, thanks.
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0
User avatar
Giorgio Maone
Site Admin
 
Posts: 8604
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy

Re: [FIXED] 'Code: Select All' Does Not Select All

Postby barbaz » Wed Jan 17, 2018 3:52 pm

Thanks Giorgio! Image
*Always* check the changelogs BEFORE updating that important software!
Board search is currently partially broken: viewtopic.php?f=14&t=21752
Workaround: use your favorite search engine, add site:forums.informaction.com to your query
-
barbaz
Senior Member
 
Posts: 8620
Joined: Sat Aug 03, 2013 5:45 pm


Return to Metaforum

Who is online

Users browsing this forum: No registered users and 1 guest