Search for Resources and Solutions

How to use in the best way the JS code in user's themes

Several years ago i've invented the php/js pagination used in Midrub and until now i'm using it because it's simply and works well on all resolutions. To make the JS code more clean, i've added the pagination code in the user's theme and it is used in more Midrub's apps. If you want to create another kind of pagination, please edit the existing because the apps will stop to work.

 But the pagination is only one of the global method used in the user's themes. If you look in the main.js from the Blue's Theme you will see these methods:

  • Main.popup_fon - displays alerts.
  • Main.show_pagination - displpays pagination.
  • show_year - replaces years with words.
  • Main.show_calendar - shows the calendar(show_year is used here and is optional).
  • Main.calculate_time - calculates the time.

Please remember, more apps uses the methods above.

Also you will see these actions:

Close the calendar.

     * Detect any click
    $( 'body' ).click(function(e) {
        if ( $('.midrub-planner').length > 0 ) {

            var midrub_planner = $( '.midrub-planner' );

            if ( ! && midrub_planner.has( === 0 ) {

                // Hide calendar



Opens the Midrub's planner.

$[removed]('click', '.open-midrub-planner', function(e) {

Detect date selection in the calendar.

$[removed]('click', '.midrub-calendar td a', function (e) {

Detects the time selection.

$[removed]('change', '.midrub-calendar-time-hour,.midrub-calendar-time-minutes,.midrub-calendar-time-period', function (e) {

Pagination in the calendar.

$('.midrub-calendar .go-back').click(function (e) {

$('.midrub-calendar .go-next').click(function (e) {

You can custom this code as you want, just don't change the name.

Was this article helpful?