PageSourceSearch

https://singletips.dk/wp-content/plugins/masterstudy-lms-learning-…/_core/assets/js/lms.js?ver=50090

js singletips.dk collected 2026-10-02 15:57:45 UTC 7,273 bytes, 229 lines download raw bytes

1"use strict";
2
3(function ($) {
4  $(document).ready(function () {
5    $('body').on('click', '#lesson_settings .mx-datepicker-popup', function (e) {
6      e.preventDefault();
7    });
8    $('.stm_lms_log_in[data-lms-modal]').on('click', function (e) {
9      e.preventDefault();
10      e.stopPropagation();
11      if ($('.stm-lms-wrapper__login').length) {
12        $(this).removeAttr('data-lms-modal');
13        $([document.documentElement, document.body]).animate({
14          scrollTop: $(".stm-lms-wrapper__login").offset().top
15        }, 300);
16      }
17    });
18    $('body').on('click', '.modal-close', function (e) {
19      e.preventDefault();
20      $('.stm-lms-modal-login').modal('toggle');
21    });
22    var modal_body = [];
23    $('[data-lms-modal]').on('click', function (e) {
24      e.preventDefault();
25      var modal_target = $(this).attr('data-target');
26      if (!$(modal_target).length) {
27        var modal = $(this).attr('data-lms-modal');
28        var params = $(this).attr('data-lms-params');
29        $.ajax({
30          url: stm_lms_ajaxurl,
31          dataType: 'json',
32          context: this,
33          data: {
34            action: 'stm_lms_load_modal',
35            modal: modal,
36            nonce: stm_lms_nonces['load_modal'],
37            params: params
38          },
39          beforeSend: function beforeSend() {
40            $(this).addClass('loading');
41          },
42          complete: function complete(data) {
43            var data = data['responseJSON'];
44            $(this).addClass('modal-loaded');
45            $(this).removeClass('loading');
46            modal_body[modal_target] = $(data['modal']).appendTo('body');
47            toggleModal(modal_target);
48          }
49        });
50      } else {
51        toggleModal(modal_target);
52      }
53    });
54    function toggleModal(modal) {
55      $(modal).modal('toggle');
56    }
57    $('[data-buy-course]').on('click', function (e) {
58      var item_id = $(this).attr('data-buy-course');
59      if (typeof item_id === 'undefined') {
60        window.location = $(this).attr('href');
61        return false;
62      }
63      $.ajax({
64        url: stm_lms_ajaxurl,
65        dataType: 'json',
66        context: this,
67        data: {
68          action: 'stm_lms_add_to_cart',
69          nonce: stm_lms_nonces['stm_lms_add_to_cart'],
70          item_id: item_id
71        },
72        beforeSend: function beforeSend() {
73          $(this).addClass('loading');
74        },
75        complete: function complete(data) {
76          var data = data['responseJSON'];
77          $(this).removeClass('loading');
78          $(this).find('span').text(data['text']);
79          if (data['cart_url']) {
80            if (data['redirect']) window.location = data['cart_url'];
81            $(this).attr('href', data['cart_url']).removeAttr('data-buy-course');
82          }
83        }
84      });
85      e.preventDefault();
86    });
87    $('[data-delete-course]').on('click', function (e) {
88      e.preventDefault();
89      var item_id = $(this).data('delete-course');
90      var group_id = $(this).data("delete-enterprise");
91      var guest = $(this).data("delete-guest");
92      var $this = $(this);
93      if (confirm(stm_lms_vars.translate["delete"])) {
94        $.ajax({
95          url: stm_lms_ajaxurl,
96          dataType: 'json',
97          context: $this,
98          data: {
99            action: 'stm_lms_delete_from_cart',
100            nonce: stm_lms_nonces['stm_lms_delete_from_cart'],
101            item_id: item_id,
102            group_id: group_id,
103            guest: guest
104          },
105          beforeSend: function beforeSend() {
106            $this.addClass('loading');
107          },
108          complete: function complete(data) {
109            $this.removeClass('loading');
110            $this.closest('.item_can_hide').slideUp();
111            if (guest) {
112              $.removeCookie('stm_lms_notauth_cart', {
113                path: '/'
114              });
115            }
116            location.reload();
117          }
118        });
119      }
120    });
121    $('.stm_lms_logout').on('click', function (e) {
122      e.preventDefault();
123      $.ajax({
124        url: stm_lms_ajaxurl,
125        dataType: 'json',
126        context: this,
127        data: {
128          action: 'stm_lms_logout',
129          nonce: stm_lms_nonces['stm_lms_logout']
130        },
131        complete: function complete(data) {
132          data = data['responseJSON'];
133          window.location.href = data;
134        }
135      });
136    });
137    pmpro_mmu_checkbox();
138    open_membership();
139  });
140  $(window).on('load', function () {
141    pmpro_mmu_checkbox();
142    $('.pmpro_level-select input').on('change', function () {
143      pmpro_mmu_checkbox();
144    });
145  });
146  function pmpro_mmu_checkbox() {
147    var $levels = $('.pmpro_mmpu_level');
148    if (!$levels.length) return false;
149    $levels.each(function () {
150      $level = $(this);
151      $level_checkbox = $level.find('.pmpro_level-select');
152      if ($level_checkbox.length) {
153        if ($level_checkbox.hasClass('pmpro_level-select-selected')) {
154          $level.addClass('active');
155        } else {
156          $level.removeClass('active');
157        }
158      }
159    });
160  }
161  function open_membership() {
162    var hash = window.location.hash;
163    var $btn = $('[data-target=".stm-lms-use-subscription"]');
164    if (hash === '#membership' && $btn.length) {
165      $('.stm_lms_mixed_button').addClass('active');
166      $btn.click();
167    }
168  }
169  $(document).on('click', '.stm_lms_account_dropdown', function (e) {
170    e.stopPropagation();
171  });
172  $(document).on('click', '.stm_lms_account_dropdown .dropdown-menu > li > a', function (e) {
173    e.stopPropagation();
174    window.location.href = $(this).attr("href");
175  });
176  $(document).mouseup(function (e) {
177    var container = $(e.target).closest(".stm_lms_account_dropdown");
178    if (container.has(e.target).length === 0) {
179      $('.caret').removeClass('rotate');
180    }
181    var dropdownHeight = container.outerHeight();
182    var innerMenu = container.find(".masterstudy-dropdown-menu");
183    if (innerMenu.length > 0) {
184      innerMenu.css("top", dropdownHeight + 5 + "px");
185      var parentOffset = container.offset();
186      var parentWidth = container.outerWidth();
187      var viewportWidth = $(window).width();
188      var parentLeft = parentOffset.left;
189      var parentRight = viewportWidth - (parentLeft + parentWidth);
190      if (parentLeft <= parentRight) {
191        innerMenu.css({
192          left: "0",
193          right: "auto"
194        });
195      } else {
196        innerMenu.css({
197          left: "auto",
198          right: "0"
199        });
200      }
201    }
202  });
203})(jQuery);
204function stm_lms_price_format(price) {
205  price = stm_lms_price_format_number(price);
206  price = stm_lms_vars['position'] === 'left' ? stm_lms_vars['symbol'] + price : price + stm_lms_vars['symbol'];
207  return price;
208}
209function stm_lms_price_format_number(price) {
210  return price.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1' + stm_lms_vars['currency_thousands']);
211}
212function stm_lms_print_message(data) {
213  var message = JSON.stringify(data);
214  try {
215    lmsEvent.postMessage(message);
216  } catch (err) {
217    // console.log(err, message);
218  }
219}
220function stmLmsExternalInitProgress() {
221  var $ = jQuery;
222  var $popup = $('.stm_lms_finish_score_popup');
223  if ($popup.length) {
224    stmLmsInitProgress();
225    setTimeout(function () {
226      $popup.addClass('active');
227    }, 2000);
228  }
229}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.