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 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 { 41 //other 42 container = $('#dialog-notifications-success'); 43 } 44 45 //we do not encode displayed message 46 var htmlcode = ''; 47 if ((typeof message) == 'string') { 48 htmlcode = '<p>' + message + '</p>'; 49 } else { 50 for (var i = 0; i < message.length; i++) { 51 htmlcode = htmlcode + '<p>' + message[i] + '</p>'; 52 } 53 } 54 55 container.html(htmlcode); 56 57 var isModal = (modal ? true : false); 58 container.dialog({ 59 modal: isModal, 60 width: 350 61 }); 62} 63function displayPopupContentFromUrl(url, title, modal, width) { 64 var isModal = (modal ? true : false); 65 var targetWidth = (width ? width : 550); 66 67 $('<div></div>').load(url) 68 .dialog({ 69 modal: isModal, 70 width: targetWidth, 71 title: title, 72 close: function(event, ui) { 73 $(this).dialog('destroy').remove(); 74 } 75 }); 76} 77 78var barNotificationTimeout; 79function displayBarNotification(message, messagetype, timeout) { 80 clearTimeout(barNotificationTimeout); 81 82 //types: success, error 83 var cssclass = 'success'; 84 if (messagetype == 'success') { 85 cssclass = 'success'; 86 } 87 else if (messagetype == 'error') { 88 cssclass = 'error'; 89 } 90 //remove previous CSS classes and notifications 91 $('#bar-notification') 92 .removeClass('success') 93 .removeClass('error'); 94 $('#bar-notification .content').remove(); 95 96 //we do not encode displayed message 97 98 //add new notifications 99 var htmlcode = ''; 100 if ((typeof message) == 'string') { 101 htmlcode = '<p class="content">' + message + '</p>'; 102 } else { 103 for (var i = 0; i < message.length; i++) { 104 htmlcode = htmlcode + '<p class="content">' + message[i] + '</p>'; 105 } 106 } 107 $('#bar-notification').append(htmlcode) 108 .addClass(cssclass) 109 .fadeIn('slow') 110 .mouseenter(function () 111 { 112 clearTimeout(barNotificationTimeout); 113 }); 114 115 $('#bar-notification .close').unbind('click').click(function () { 116 $('#bar-notification').fadeOut('slow'); 117 }); 118 119 //timeout (if set) 120 if (timeout > 0) { 121 barNotificationTimeout = setTimeout(function () { 122 $('#bar-notification').fadeOut('slow'); 123 }, timeout); 124 } 125} 126 127function htmlEncode(value) { 128 return $('<div/>').text(value).html(); 129} 130 131function htmlDecode(value) { 132 return $('<div/>').html(value).text(); 133} 134 135 136// CSRF (XSRF) security 137function addAntiForgeryToken(data) { 138 //if the object is undefined, create a new one. 139 if (!data) { 140 data = {}; 141 } 142 //add token 143 var tokenInput = $('input[name=__RequestVerificationToken]'); 144 if (tokenInput.length) { 145 data.__RequestVerificationToken = tokenInput.val(); 146 } 147 return data; 148};
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.