Return to main startup screen after no activity on the screen

Discussion in 'C-Bus Automation Controllers' started by impact, Jul 8, 2019.

  1. impact

    impact

    Joined:
    Feb 10, 2008
    Messages:
    117
    Likes Received:
    13
    I missed this functionality from my touch screen.... So disappointed that I could not do this with the SHAC....

    Well - thanks to the user saintjerome who posted this thread https://www.cbusforums.com/threads/is-this-the-5500nac-shac-manufacturer.9612/ I have spent hours going through the forums where there are thousands of posts and a very helpful admin...

    Forum is at; https://forum.logicmachine.net/

    And guess what I found a script written by the admins - that gives you the missing functionality to return you back to the first screen (startup screen) - and it works, and its so simple to implement....

    Copy this code;
    Code:
    $(function() {
      
      // Back to Start after x seconds (in miliseconds)
      var SE_Timeout = 90000; // adjust this timer value if needed (90 seconds in miliseconds)
      var SE_Startpage = currentPlanId; // First page that is loaded
      var eventlist = 'vclick vmouseout click blur keypress keyup touchstart touchend touchcancel touchleave touchmove';
      
      // Timer function no usage detected
      function No_Usage_Detected(callback, timeout, _this) {
        var timer;
        return function(e) {
            var _that = this;
            if (timer)
                clearTimeout(timer);
            timer = setTimeout(function() { 
                callback.call(_this || _that, e);
            }, timeout);
        }
      }
      // Back to start function when timer elapsed
        var SE_Goto_Startpage = No_Usage_Detected(function(e) {
        if ( currentPlanId != SE_Startpage ) {
        showPlan(SE_Startpage);
        }
      }, SE_Timeout);
      
      // Add event listener to document to detect user input
      $(document)
      .on(eventlist, function() {
        SE_Goto_Startpage();
      });
     
      // Add event listener to all iframes to detect user input inside iframes
      $('iframe').load(function() {
        var iframe = $('iframe').contents().find('html');
        iframe.on(eventlist, function(event) {
         SE_Goto_Startpage();
        });
      });
    });
    
    into the JavaScript editor - found in Scripting / Tools / Edit Custom Java Script
    Just simply Paste it - change the value near the start if you want longer than 90 seconds...

    And its done - give it a try... Works for me.

    What I have learned this week - the power of the SHAC is JavaScript, you can do absolutely anything - anything you can do in a web browser....

    BIG THANKYOU to saintjerome for the original post on finding VERY useful info...
     
    impact, Jul 8, 2019
    #1
    jboer, MarkB and Mr Mark like this.
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.