1; 2(function ($, window, document, my_post_key, undefined) { 3 this.MybbStuff = this.MybbStuff || {}; 4 5 this.MybbStuff.MyAlerts = (function MyAlertsModule(window, $) { 6 var module = function MyAlerts() { 7 $('a.open_modal').click(this.openModal).bind(this); 8 9 $("body").on("click", "#getUnreadAlerts", this.getUnreadAlerts); 10 11 $("body").on("click", ".deleteAlertButton", this.deleteAlert).bind(this); 12 13 if (typeof myalerts_autorefresh !== 'undefined' && myalerts_autorefresh > 0) 14 { 15 window.setInterval(function() { 16 $.get('xmlhttp.php?action=getNewAlerts', function(data) { 17 $('#latestAlertsListing').prepend(data); 18 }); 19 }, myalerts_autorefresh * 1000); 20 } 21 22 if (typeof unreadAlerts !== 'undefined' && unreadAlerts > 0) 23 { 24 document.title = document.title + ' (' + unreadAlerts + ')'; 25 } 26 }; 27 28 module.prototype.openModal = function openModal(event) { 29 event.preventDefault(); 30 31 var originalTarget = $(event.currentTarget), 32 modalSelector = originalTarget.attr('data-selector'); 33 34 $(modalSelector).modal({ 35 fadeDuration: 250, 36 keepelement: true 37 }); 38 39 return false; 40 }; 41 42 module.prototype.getUnreadAlerts = function getUnreadAlerts(event) { 43 event.preventDefault(); 44 $.get('xmlhttp.php?action=getNewAlerts', function(data) { 45 $('#latestAlertsListing').html(data.template); 46 }); 47 }; 48 49 module.prototype.deleteAlert = function deleteAlert(event) { 50 event.preventDefault(); 51 52 var deleteButton = $(event.currentTarget), 53 alertId = deleteButton.attr("id").substring(13); 54 55 $.getJSON('xmlhttp.php?action=myalerts_delete', {accessMethod: 'js', id: alertId, my_post_key: my_post_key}, function(data) { 56 if (data.success) 57 { 58 deleteButton.parents('tr').get(0).remove(); 59 if (data.template) 60 { 61 $('#latestAlertsListing').html(data.template); 62 } 63 } 64 else 65 { 66 for (var i = 0; i < data.errors.length; ++i) { 67 console.log(data.errors[i]); 68 } 69 alert(data.errors[0]); 70 } 71 }); 72 73 return false; 74 }; 75 76 return module; 77 })(window, jQuery); 78 79 $(document).ready(function() { 80 var myalerts = new MybbStuff.MyAlerts(); 81 }); 82})(jQuery, window, document, my_post_key); 83 84 85
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.