Jump to content

Appearing by time


Recommended Posts

13 hours ago, gbligh said:

Forgot to copy in the usual contributors! :) 

@ADT @pconkie @Graham Quince

I had a play with this years ago....  well with the help of @Graham Quince if i remember!


/// you will need the data-content-uuid of the widget you want to show/hide
// get this from the inspector (right click - - inspect)
var widget_to_hide = "42140000200287F6954DBF1CEB29FA0C24F4607C6376CF04";

    // attach click functions to buttons
    $( ".showme" ).click(function() {
     $( ".hideme" ).click(function() {
    // automatically by time of day?
    var format = 'hh:mm:ss';
    // var time = moment() gives you current time. no format required.
    var time = moment();
    var beforeTime = moment('10:30:00', format);
    var afterTime = moment('15:30:00', format);

    if (time.isBetween(beforeTime, afterTime)) {
        console.log('is between');
    } else {
        console.log('is not between');

<button class="showme" type="button">Show</button>
<button class="hideme" type="button">Hide</button>

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

  • 1 month later...

Just had a thought about this:  

If someone were to take the Set Keyword and Email widget's code as a roadmap, and use the bit that adds a key word, instead of having it be a button push, the function which adds the keyword and refreshes the site could occur when the time matches the settings.  Any widgets on the site with a Keyword Rule would then respond accordingly.

Not sure what would happen to a dashboard of course.  That might not work in the same way.

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...