Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

FOP2 Community Forum

  1. Home
  2. Support
  3. Hide Buttons when a user is logged out

Hide Buttons when a user is logged out

Scheduled Pinned Locked Moved Support
2 Posts 1 Posters 158 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    M
    Moscou123
    wrote on last edited by
    #1

    Hello,
    Is there a way to have the buttons of offline users (phone registered but not logged in to FOP2) be css set to display:none; ?

    Thanks,

    MC

    1 Reply Last reply
    0
    • M
      M
      Moscou123
      wrote on last edited by
      #2

      This is a simple Javascript that modifies the css if the buttons are set to OUT. I am not the best scripter so I am sure there are more efficient ways to optimise this code. But hey, it works... It was added to a seperate file ( in the /var/www/html/fop2/ directory) with a javascript including it (script type="text/javascript" src="thisfile.js") in index.html.

      I DO NOT THINK IT SURVIVES A VERSION UPGRADE.

      @Nicolas, it would be nice that in index.html, you include by default a "custom.js" file in a "custom" directory that is preserved in upgrades to allow us to customise as required if need be and survive upgrades.

      //STARTS HERE
      //Maximum buttons used (in doubt, make this higher than need to be but not too high to waste browser speed looking for things that do not exist)
      var max_boton = 25;

      //What is the tag when agent is not in
      OUTname = "OUT";

      //Wait 10 seconds after document is ready to launch function to perpetuity
      $( document ).ready(function(){
      setTimeout(function() { do_hide_boton(); }, 10000);
      }
      );

      //This is the function that shows or hide the buttons
      function do_hide_boton()
      {

      //Loop thru all botons up to max_boton
      for (boton_num = 1; boton_num < max_boton; boton_num++)
      {
      // check if boton exists
      if(document.getElementById("presence"+ boton_num) !== null)
      {
      //If user is logged out OR extension is notregistered hide the button
      if(document.getElementById("presence"+ boton_num).getAttribute("data-original-title") == OUTname || document.getElementById("boton"+ boton_num).classList.contains('notregistered'))
      {
      document.getElementById("boton"+ boton_num).style.display = "none";
      }
      else
      {
      document.getElementById("boton"+ boton_num).style.display = "";
      }
      }

      } // for (boton_num = 1; boton_num <= max_boton; boton_num++)

      //Recall itself every 5000 miliseconds
      setTimeout(arguments.callee, 5000);

      }

      1 Reply Last reply
      0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      Powered by NodeBB Contributors
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups