Extending tribe-events-week.js?

Home Forums Calendar Products Events Calendar PRO Extending tribe-events-week.js?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1347744
    Brian Walters
    Participant

    I have events that start at :15 and :45 minutes of the hour. This isn’t a problem unless there is another event right after it.

    With a 15 minute event, the space allocated to it should only be 15px (they are using 1px per minute in the code… Nice but that means a 15 minute event will get padded to a div element of 36px after it increases the title to 20px and adds the padding of 16px.

    I’ve followed the Themer’s Guide down to the week/tooltip.php template. That’s when I determined the output of the file was then being processed by the javascript funtion tribe_display_week_view() in events-calendar-pro/src/resources/js/tribe-events-week.js

    Is there a way to replace/extend that js function without completely overwriting the file. Essentially, I need to adjust it’s calculations from 1px per minute to 2px per hour so I can fit 15 minute events in correctly.

    BTW: I’ve already figured out the CSS adjustments to the week view

    // set 30 minute marks to 2px per minute
    .tribe-week-grid-block div{
      height:60px;
    }
    
    // set 60 minute marks to 2px per minute
    .tribe-events-grid .column.first div, .tribe-week-grid-hours div, .tribe-week-grid-block {
      height:120px;
    }

    Hopefully you can point me in some direction other than your list of custom developers.

    • This topic was modified 6 years, 8 months ago by Brian Walters.
    • This topic was modified 6 years, 8 months ago by Andras.
    #1348597
    Andras
    Keymaster

    Hi Brian,

    Thanks for reaching out!

    Currently the only way would be dequeuing that js file and replace it with an edited copy.

    Though we are limited in doing customizations, I should be able to give you some guidance and pointers if needed. Let me know.

    Cheers,
    Andras

    #1348639
    Brian Walters
    Participant

    Thanks Andras. I thought that might be the only option. Could you suggest the best way to “dequeue” that JS file? Editing the JS file is the easier part, IMHO. 🙂

    #1349137
    Andras
    Keymaster

    Hey Brian,

    This snippet should do that:

    /**
    * An example for how to dequeue a script
    *
    * Obtain the handle of your script by searching through the code, and then
    * add a wp_deregister_script() function call for that handle.
    */
    function tribe_dequeue_script_example() {
    wp_deregister_script( 'tribe-events-jquery-resize' );
    }
    add_action( 'wp_enqueue_scripts', 'tribe_dequeue_script_example', PHP_INT_MAX );
    add_action( 'admin_enqueue_scripts', 'tribe_dequeue_script_example', PHP_INT_MAX );

    Just change the function call.

    Let me know if that helps.

    Cheers,
    Andras

    #1360388
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Extending tribe-events-week.js?’ is closed to new replies.