Be Excellent To Each Other
https://www.beexcellenttoeachother.com/forum/

Chrome question
https://www.beexcellenttoeachother.com/forum/viewtopic.php?f=3&t=11037
Page 1 of 1

Author:  Sir Taxalot [ Thu Aug 03, 2017 2:27 ]
Post subject:  Chrome question

Hello chums,

My workplace is using a load of Atlassian platforms now (I quite like them actually) and I've set my mac to open chrome on log in, with a couple of tabs (dashboards, calendars, whatever).

However, Chrome opens before the computer has properly connected to the network and done the authentication thingies, so I get a window with 4 blank tabs showing the 'reload' message.

Can I either make Chrome refresh all tabs at once? (edit - I found an extension that does that, I sometimes forget about Chrome Extensions...) ... Or even better, wait for a bit before loading?

I realise that I could stop Chrome opening at startup and manually click on the icon in the dock, but where's the fun in that?

Author:  Mr Russell [ Thu Aug 03, 2017 8:10 ]
Post subject:  Re: Chrome question

Sir Taxalot wrote:
Hello chums,

My workplace is using a load of Atlassian platforms now (I quite like them actually) and I've set my mac to open chrome on log in, with a couple of tabs (dashboards, calendars, whatever).

However, Chrome opens before the computer has properly connected to the network and done the authentication thingies, so I get a window with 4 blank tabs showing the 'reload' message.

Can I either make Chrome refresh all tabs at once? (edit - I found an extension that does that, I sometimes forget about Chrome Extensions...) ... Or even better, wait for a bit before loading?

I realise that I could stop Chrome opening at startup and manually click on the icon in the dock, but where's the fun in that?

However you're setting Chrome to open on startup, can you not add a delay to that of a few seconds to allow the network to initialise, same as a delay in a batch file on Windows?

Author:  Grim... [ Thu Aug 03, 2017 11:07 ]
Post subject:  Re: Chrome question

Bear with.

Author:  Warhead [ Thu Aug 03, 2017 11:13 ]
Post subject:  Re: Chrome question

I haven't set Chrome to open at logon, but a couple of weeks ago it just started doing so, with no intervention from me. I've tried to disable it, but it just keeps re-enabling itself.

I suspect sabotage.

Author:  Grim... [ Thu Aug 03, 2017 11:32 ]
Post subject:  Re: Chrome question

Okay, save this html file somewhere onto your computer, and set it as your homepage.

Code:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Wait!</title>

    <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>

    <style>
        body {
            font-family: 'Open Sans', sans-serif;
            padding: 20px;
            color: #444;
        }

        textarea {
            width: 50%;
            height: 100px;
        }

        input {
            width: 100px;
        }

        .hide {
            opacity: 0;
            transition: all 2s;
        }

        .hide.show {
            opacity: 1;
        }

        .warning {
            border: 1px solid rgba(85, 0, 0, 0.5);
            background: rgba(85, 0, 0, 0.3);
            padding: 20px;
            display: inline-block;
            border-radius: 5px;
            box-shadow: 5px 5px 20px -5px rgba(0, 0, 0, 0.5);
        }

    </style>

</head>

<body>
<h1 id="title">Wait!</h1>
<p>Off you go in <span id="secs-holder">999</span> seconds...</p>

<div id="warning" class="warning hide">Oh noes! Allow this site to open new windows!</div>

<h3>Settings</h3>
Pages to open (one per line):<br/>
<textarea id="pages"></textarea><br/><br/>

Seconds to wait:<br/>
<input type="number" id="secs"><br/><br/>
<button type="button" id="save" onclick="save()">Save changes</button>

<script>
   document.getCookie = function (sName) {
      sName = sName.toLowerCase();
      var oCrumbles = document.cookie.split(';');
      for (var i = 0; i < oCrumbles.length; i++) {
         var oPair = oCrumbles[i].split('=');
         var sKey = decodeURIComponent(oPair[0].trim().toLowerCase());
         var sValue = oPair.length > 1 ? oPair[1] : '';
         if (sKey == sName) {
            return decodeURIComponent(sValue);
         }
      }
      return '';
   };

   document.setCookie = function (sName, sValue) {
      var oDate = new Date();
      oDate.setYear(oDate.getFullYear() + 1);
      var sCookie = encodeURIComponent(sName) + '=' + encodeURIComponent(sValue) + ';expires=' + oDate.toGMTString() + ';path=/';
      document.cookie = sCookie;
   };


   var secs = document.getCookie('secs');
   var pages = document.getCookie('pages');

   if (secs) {
      document.getElementById('secs-holder').innerHTML = secs;
      document.getElementById('secs').value = secs;
   }

   if (pages) {
      document.getElementById('pages').value = pages;
   }

   if (secs && pages) {
      setTimeout(function () {
         hitTicker(secs);
      }, 1000);
   }

   function save() {
      document.setCookie('secs', document.getElementById('secs').value);
      document.setCookie('pages', document.getElementById('pages').value);
      location.reload();
   }

   function hitTicker(s) {
      s--;
      document.getElementById('secs-holder').innerHTML = s;
      if (!s) {
         go();
         return;
      }

      setTimeout(function () {
         hitTicker(s);
      }, 1000);
   }

   function go() {
      document.getElementById('title').innerHTML = "Go!";
      var page_array = pages.split("\n");
      var first = page_array.shift();
      var good = false;
      page_array.forEach(function (p) {
         var h = window.open(p, '_blank');
         if (h) {
            good = true;
         }
      });
      if (good) {
         window.location = first;
      } else {
         document.getElementById('warning').className += ' show';
      }

   }
</script>


Example here: http://www.mosttriumphant.co.uk/random/wait.htm

Author:  Grim... [ Thu Aug 03, 2017 11:34 ]
Post subject:  Re: Chrome question

Oh, the font styling won't work, d'uh. Never mind.

It could automatically open the pages when you've got an internet connection, actually. That would be much more sensible.

Author:  Grim... [ Thu Aug 03, 2017 11:52 ]
Post subject:  Re: Chrome question

Here you go - you've got two seconds to click inside the box (once you set it up) if you want to change it. I also stopped using cookies because we live in the future now.

Code:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Wait!</title>

    <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>

    <style>
        body {
            font-family: 'Open Sans', sans-serif;
            padding: 20px;
            color: #444;
        }

        textarea {
            width: 50%;
            height: 100px;
        }

        .hide {
            opacity: 0;
            transition: all 2s;
        }

        .hide.show {
            opacity: 1;
        }

        .warning {
            border: 1px solid rgba(85, 0, 0, 0.5);
            background: rgba(85, 0, 0, 0.3);
            padding: 20px;
            display: inline-block;
            border-radius: 5px;
            box-shadow: 5px 5px 20px -5px rgba(0, 0, 0, 0.5);
        }
    </style>
</head>

<body>
<h1 id="title">Wait!</h1>

<div id="warning" class="warning hide">Oh noes! Allow this site to open new windows!</div>

<h3>Settings</h3>
Pages to open (one per line):<br/>
<textarea id="pages" onfocus="te_focus()" onblur="te_blur()"></textarea><br/><br/>

<button type="button" id="save" onclick="save()">Save changes</button>

<script>
   var pages = localStorage.getItem('pages');
   var hit_timeout = -1;

   if (pages) {
      document.getElementById('pages').value = pages;
      hit_timeout = setTimeout(function () {
         hitTicker();
      }, 2000);
   }

   function save() {
      localStorage.setItem('pages', document.getElementById('pages').value);
      location.reload();
   }

   function hitTicker() {
      if (navigator.onLine) {
         go();
         return;
      }

      hit_timeout = setTimeout(function () {
         hitTicker();
      }, 1000);
   }

   function go() {
      document.getElementById('title').innerHTML = "Go!";
      var page_array = pages.split("\n");
      var first = page_array.shift();
      var good = false;
      page_array.forEach(function (p) {
         if (p) {
            var h = window.open(p, '_blank');
            if (h) {
               good = true;
            }
         }
      });
      if (good) {
         window.location = first;
      } else {
         document.getElementById('warning').className += ' show';
      }
   }

   function te_focus() {
      clearTimeout(hit_timeout);
   }

   function te_blur() {
      hit_timeout = setTimeout(function () {
         hitTicker();
      }, 3000);
   }
</script>
</body>
</html>


Example here: http://www.mosttriumphant.co.uk/random/wait_auto.htm

Author:  Sir Taxalot [ Thu Aug 03, 2017 12:43 ]
Post subject:  Re: Chrome question

I shall try that tomorrow. I have basically no idea how you've done that, but I appreciate it :)

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/