1(function ($) { 2 "use strict"; 3 4 $.fn.pi_notification = function (options) { 5 var settings = $.extend( 6 { 7 animation: "fadeIn", 8 closing_animation: "fadeOut", 9 content: { 10 title: "", 11 desc: "", 12 short_desc: "", 13 image: "", 14 link: "javascript:void(0)" 15 }, 16 close: true, 17 close_image: "", 18 dismiss: false, 19 mobile: true, 20 mobile_size: 767, 21 border_radius: 0, 22 link_in_tab: false, 23 audio_alert_enabled: false, 24 audio_url: "", 25 max_notification_count:0 26 }, 27 options 28 ); 29 30 this.maxNotificationReached = function () { 31 var count = parseInt(sessionStorage.getItem('pisol_sn_counter')); 32 if (count == null) { 33 return false; 34 } 35 36 if(settings.max_notification_count == 0 || settings.max_notification_count == undefined) return false; 37 38 if (count >= parseInt(settings.max_notification_count)) { 39 return true; 40 } 41 return false; 42 } 43 44 this.close = function (obj) { 45 $(obj.popup).removeClass(settings.animation); 46 $(obj.popup).addClass(settings.closing_animation); 47 setTimeout(function () { $(obj.popup).remove(); }, 500, obj); 48 } 49 50 this.close_button = function (obj) { 51 var obj = obj; 52 $(document).on("click", ".pi-popup-close", { obj: obj }, function (event) { 53 event.data.obj.close(event.data.obj); 54 }); 55 } 56 57 this.layout = function (obj) { 58 59 if (this.maxNotificationReached()){ 60 console.log('Max Sales Notification Count Reached'); 61 return; 62 } 63 64 var html = 65 '<div class="animated pi-popup ' + 66 settings.animation + 67 ' ">' + 68 (settings.content.image != "" ? '<div class="pi-popup-image">' + 69 (settings.link_image != "" ? '<a' + 70 (settings.link_in_tab ? ' target="_blank" ' : ' ') + 71 'href="' + (settings.content.link != undefined ? settings.content.link : "javascript:void(0)") + '">' : '') + 72 '<img src="' + 73 settings.content.image + 74 '">' + 75 (settings.link_image != "" ? '</a>' : '') + 76 "</div>" : "") + 77 '<div class="pi-popup-content">' + 78 (settings.content.desc != undefined ? settings.content.desc : "") + 79 ((settings.close && settings.close_image != "") ? '<a class="pi-popup-close" href="javascript:void(0)"><img src="' + settings.close_image + '"></a>' : '') + 80 "</div>" + 81 "</div>"; 82 obj.close_button(obj); 83 obj.alert(); 84 if (obj.browser_mobile()) { 85 if (settings.mobile) { 86 obj.incrementCounter(); 87 return $(html).appendTo("body"); 88 } 89 return; 90 } else { 91 obj.incrementCounter(); 92 return $(html).appendTo("body"); 93 } 94 95 } 96 97 this.incrementCounter = function () { 98 var count = sessionStorage.getItem('pisol_sn_counter'); 99 100 if (count == null) { 101 count = 0; 102 } 103 104 count++; 105 sessionStorage.setItem('pisol_sn_counter', count); 106 } 107 108 this.browser_mobile = function () { 109 var width = parseInt($(window).width()); 110 if (width > settings.mobile_size) { 111 return false 112 } else { 113 return true; 114 } 115 } 116 117 this.alert = function () { 118 if (settings.audio_alert_enabled) { 119 120 if (settings.audio_url != "") { 121 $.playSound(settings.audio_url); 122 } 123 124 } 125 } 126 127 this.popup = this.layout(this); 128 129 return this; 130 }; 131 132 jQuery(function ($) { 133 134 /* setTimeout(function () { popup.close(popup); }, 2000);*/ 135 136 137 }); 138 139})(jQuery); 140 141 142(function ($) { 143 $.extend({ 144 playSound: function () { 145 return $( 146 '<audio class="sound-player" autoplay="autoplay" style="display:none;">' 147 + '<source src="' + arguments[0] + '" />' 148 + '<embed src="' + arguments[0] + '" hidden="true" autostart="true" loop="false"/>' 149 + '</audio>' 150 ).appendTo('body'); 151 }, 152 stopSound: function () { 153 $(".sound-player").remove(); 154 } 155 }); 156})(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.