1;(function ($) { 2 "use strict"; 3 var timer = null, 4 submit = function () { 5 var $button = $(this), 6 course_id = $button.attr('data-id'), 7 nonce = $button.attr('data-nonce'), 8 text = $button.data('text'); 9 if ($button.hasClass('ajaxload_wishlist')) { 10 return; 11 } 12 $button.addClass('ajaxload_wishlist').prop('disabled', true); 13 if (text) { 14 $button.html(text); 15 } 16 $.ajax({ 17 url : window.location.href, 18 type : 'post', 19 dataType: 'html', 20 data : { 21 //action : 'learn_press_toggle_course_wishlist', 22 'lp-ajax': 'toggle_course_wishlist', 23 course_id: course_id, 24 nonce : nonce 25 }, 26 success : function (response) { 27 response = LP.parseJSON(response); 28 var $b = $('.learn-press-course-wishlist-button-' + response.course_id), 29 $p = $b.closest('[data-context="tab-wishlist"]'); 30 if ($p.length) { 31 $p.fadeOut(function () { 32 var $siblings = $p.siblings(), 33 $parent = $p.closest('#learn-press-profile-tab-course-wishlist'); 34 $p.remove(); 35 if ($siblings.length == 0) { 36 $parent.removeClass('has-courses'); 37 } 38 }); 39 } else { 40 $b.removeClass('ajaxload_wishlist') 41 .toggleClass('on', response.state == 'on') 42 .prop('title', response.title) 43 .html(response.button_text); 44 } 45 $b.prop('disabled', false) 46 } 47 }); 48 }; 49 $(document).on('click', '.course-wishlist', function () { 50 timer && clearTimeout(timer); 51 timer = setTimeout($.proxy(submit, this), 50); 52 }); 53})(jQuery);
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.