1/* 2** nopCommerce custom js functions 3*/ 4 5 6 7function OpenWindow(query, w, h, scroll) { 8 var l = (screen.width - w) / 2; 9 var t = (screen.height - h) / 2; 10 11 winprops = 'resizable=0, height=' + h + ',width=' + w + ',top=' + t + ',left=' + l + 'w'; 12 if (scroll) winprops += ',scrollbars=1'; 13 var f = window.open(query, "_blank", winprops); 14} 15 16function setLocation(url) { 17 window.location.href = url; 18} 19 20function displayAjaxLoading(display) { 21 if (display) { 22 $('.ajax-loading-block-window').show(); 23 } 24 else { 25 $('.ajax-loading-block-window').hide('slow'); 26 } 27} 28 29function displayPopupNotification(message, messagetype, modal) { 30 //types: success, error, warning 31 var container; 32 if (messagetype == 'success') { 33 //success 34 container = $('#dialog-notifications-success'); 35 } 36 else if (messagetype == 'error') { 37 //error 38 container = $('#dialog-notifications-error'); 39 } 40 else if (messagetype == 'warning') { 41 //warning 42 container = $('#dialog-notifications-warning'); 43 } 44 else { 45 //other 46 container = $('#dialog-notifications-success'); 47 } 48 49 //we do not encode displayed message 50 var htmlcode = ''; 51 if ((typeof message) == 'string') { 52 htmlcode = '<p>' + message + '</p>'; 53 } else { 54 for (var i = 0; i < message.length; i++) { 55 htmlcode = htmlcode + '<p>' + message[i] + '</p>'; 56 } 57 } 58 59 container.html(htmlcode); 60 61 var isModal = (modal ? true : false); 62 container.dialog({ 63 modal: isModal, 64 width: 350 65 }); 66} 67function displayPopupContentFromUrl(url, title, modal, width) { 68 var isModal = (modal ? true : false); 69 var targetWidth = (width ? width : 550); 70 var maxHeight = $(window).height() - 20; 71 72 $('<div></div>').load(url) 73 .dialog({ 74 modal: isModal, 75 position: ['center', 20], 76 width: targetWidth, 77 maxHeight: maxHeight, 78 title: title, 79 close: function(event, ui) { 80 $(this).dialog('destroy').remove(); 81 } 82 }); 83} 84 85var barNotificationTimeout; 86function displayBarNotification(message, messagetype, timeout) { 87 clearTimeout(barNotificationTimeout); 88 89 //types: success, error, warning 90 var cssclass = 'success'; 91 if (messagetype == 'success') { 92 cssclass = 'success'; 93 } 94 else if (messagetype == 'error') { 95 cssclass = 'error'; 96 } 97 else if (messagetype == 'warning') { 98 cssclass = 'warning'; 99 } 100 //remove previous CSS classes and notifications 101 $('#bar-notification') 102 .removeClass('success') 103 .removeClass('error') 104 .removeClass('warning'); 105 $('#bar-notification .content').remove(); 106 107 //we do not encode displayed message 108 109 //add new notifications 110 var htmlcode = ''; 111 if ((typeof message) == 'string') { 112 htmlcode = '<p class="content">' + message + '</p>'; 113 } else { 114 for (var i = 0; i < message.length; i++) { 115 htmlcode = htmlcode + '<p class="content">' + message[i] + '</p>'; 116 } 117 } 118 $('#bar-notification').append(htmlcode) 119 .addClass(cssclass) 120 .fadeIn('slow') 121 .mouseenter(function () 122 { 123 clearTimeout(barNotificationTimeout); 124 }); 125 126 $('#bar-notification .close').unbind('click').click(function () { 127 $('#bar-notification').fadeOut('slow'); 128 }); 129 130 //timeout (if set) 131 if (timeout > 0) { 132 barNotificationTimeout = setTimeout(function () { 133 $('#bar-notification').fadeOut('slow'); 134 }, timeout); 135 } 136} 137function htmlEncode(value) { 138 return $('<div/>').text(value).html(); 139} 140 141function htmlDecode(value) { 142 return $('<div/>').html(value).text(); 143} 144 145 146// CSRF (XSRF) security 147function addAntiForgeryToken(data) { 148 //if the object is undefined, create a new one. 149 if (!data) { 150 data = {}; 151 } 152 //add token 153 var tokenInput = $('input[name=__RequestVerificationToken]'); 154 if (tokenInput.length) { 155 data.__RequestVerificationToken = tokenInput.val(); 156 } 157 return data; 158};
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.