1// Array includes polyfill 2if (!Array.prototype.includes) { 3 Object.defineProperty(Array.prototype, 'includes', { 4 value: function (searchElement, fromIndex) { 5 6 if (this == null) { 7 throw new TypeError('"this" is null or not defined'); 8 } 9 10 // 1. Let O be ? ToObject(this value). 11 var o = Object(this); 12 13 // 2. Let len be ? ToLength(? Get(O, "length")). 14 var len = o.length >>> 0; 15 16 // 3. If len is 0, return false. 17 if (len === 0) { 18 return false; 19 } 20 21 // 4. Let n be ? ToInteger(fromIndex). 22 // (If fromIndex is undefined, this step produces the value 0.) 23 var n = fromIndex | 0; 24 25 // 5. If n ⥠0, then 26 // a. Let k be n. 27 // 6. Else n < 0, 28 // a. Let k be len + n. 29 // b. If k < 0, let k be 0. 30 var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); 31 32 function sameValueZero(x, y) { 33 return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y)); 34 } 35 36 // 7. Repeat, while k < len 37 while (k < len) { 38 // a. Let elementK be the result of ? Get(O, ! ToString(k)). 39 // b. If SameValueZero(searchElement, elementK) is true, return true. 40 if (sameValueZero(o[k], searchElement)) { 41 return true; 42 } 43 // c. Increase k by 1. 44 k++; 45 } 46 47 // 8. Return false 48 return false; 49 } 50 }); 51} 52 53$(function () { 54 // Currency 55 $('#form-currency .currency-select').unbind().on('click', function (e) { 56 e.preventDefault(); 57 58 $('#form-currency input[name=\'code\']').val($(this).data('name')); 59 60 $('#form-currency').submit(); 61 }); 62 63 // Language 64 $('#form-language .language-select').unbind().on('click', function (e) { 65 e.preventDefault(); 66 67 $('#form-language input[name=\'code\']').val($(this).data('name')); 68 69 $('#form-language').submit(); 70 }); 71}); 72 73window['cart'] = window['cart'] || {}; 74 75window['cart'].add = function (product_id, quantity, quick_buy) { 76 quantity = quantity || 1; 77 78 $.ajax({ 79 url: 'index.php?route=checkout/cart/add', 80 type: 'post', 81 data: 'product_id=' + product_id + '&quantity=' + quantity, 82 dataType: 'json', 83 beforeSend: function () { 84 $('[data-toggle="tooltip"]').tooltip('hide'); 85 $('[onclick*="cart.add(\'' + product_id + '\'"]').button('loading'); 86 }, 87 complete: function () { 88 $('[onclick*="cart.add(\'' + product_id + '\'"]').button('reset'); 89 }, 90 success: function (json) { 91 $('.alert, .text-danger').remove(); 92 93 if (json['redirect']) { 94 if (json['options_popup']) { 95 if ($('html').hasClass('iphone') || $('html').hasClass('ipad')) { 96 iNoBounce.enable(); 97 } 98 99 var html = ''; 100 101 html += '<div class="popup-wrapper popup-options">'; 102 html += ' <div class="popup-container">'; 103 html += ' <button class="btn popup-close"></button>'; 104 html += ' <div class="popup-body">'; 105 html += ' <div class="popup-inner-body">'; 106 html += ' <div class="journal-loading"><i class="fa fa-spinner fa-spin"></i></div>'; 107 html += ' <iframe src="index.php?route=journal3/product&product_id=' + product_id + '&popup=options&product_quantity=' + quantity + '&' + (quick_buy ? 'quick_buy=true' : '') + '" width="100%" height="100%" frameborder="0" onload="this.height = this.contentWindow.document.body.offsetHeight; $(this).prev(\'.journal-loading\').fadeOut();"></iframe>'; 108 html += ' </div>'; 109 html += ' </div>'; 110 html += ' </div>'; 111 html += ' <div class="popup-bg popup-bg-closable"></div>'; 112 html += '</div>'; 113 114 // show modal 115 $('.popup-wrapper').remove(); 116 117 $('body').append(html); 118 119 setTimeout(function () { 120 $('html').addClass('popup-open popup-center'); 121 }, 10); 122 } else { 123 location = json['redirect']; 124 } 125 } 126 127 if (json['success']) { 128 if (json['options_popup']) { 129 if ($('html').hasClass('iphone') || $('html').hasClass('ipad')) { 130 iNoBounce.enable(); 131 } 132 133 var html = ''; 134 135 html += '<div class="popup-wrapper popup-options">'; 136 html += ' <div class="popup-container">'; 137 html += ' <button class="btn popup-close"></button>'; 138 html += ' <div class="popup-body">'; 139 html += ' <div class="popup-inner-body">'; 140 html += ' <div class="journal-loading"><i class="fa fa-spinner fa-spin"></i></div>'; 141 html += ' <iframe src="index.php?route=journal3/product&product_id=' + product_id + '&popup=options&' + (quick_buy ? 'quick_buy=true' : '') + '" width="100%" height="100%" frameborder="0" onload="this.height = this.contentWindow.document.body.offsetHeight; $(this).prev(\'.journal-loading\').fadeOut();"></iframe>'; 142 html += ' </div>'; 143 html += ' </div>'; 144 html += ' </div>'; 145 html += ' <div class="popup-bg popup-bg-closable"></div>'; 146 html += '</div>'; 147 148 // show modal 149 $('.popup-wrapper').remove(); 150 151 $('body').append(html); 152 153 setTimeout(function () { 154 $('html').addClass('popup-open popup-center'); 155 }, 10); 156 } else { 157 if (json['notification']) { 158 show_notification(json['notification']); 159 160 if (quick_buy) { 161 location = Journal['checkoutUrl']; 162 } 163 } else { 164 $('header').after('<div class="alert alert-success"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">×</button></div>'); 165 } 166 } 167 168 // Need to set timeout otherwise it wont update the total 169 setTimeout(function () { 170 $('#cart-total').html(json['total']); 171 $('#cart-items,.cart-badge').html(json['items_count']); 172 173 if (json['items_count']) { 174 $('#cart-items,.cart-badge').removeClass('count-zero'); 175 } else { 176 $('#cart-items,.cart-badge').addClass('count-zero'); 177 } 178 }, 100); 179 180 if (Journal['scrollToTop']) { 181 $('html, body').animate({ scrollTop: 0 }, 'slow'); 182 } 183 184 $('.cart-content ul').load('index.php?route=common/cart/info ul li'); 185 186 if (parent.window['_QuickCheckout']) { 187 parent.window['_QuickCheckout'].save(); 188 } else if ($('html').hasClass('route-checkout-cart') || $('html').hasClass('route-checkout-checkout')) { 189 parent.location.reload(); 190 } 191 } 192 }, 193 error: function (xhr, ajaxOptions, thrownError) { 194 alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText); 195 } 196 }); 197}; 198 199window['cart'].remove = function (key) { 200 $.ajax({ 201 url: 'index.php?route=checkout/cart/remove', 202 type: 'post', 203 data: 'key=' + key, 204 dataType: 'json', 205 beforeSend: function () { 206 $('#cart > button').button('loading'); 207 }, 208 complete: function () { 209 $('#cart > button').button('reset'); 210 }, 211 success: function (json) { 212 // Need to set timeout otherwise it wont update the total 213 setTimeout(function () { 214 $('#cart-total').html(json['total']); 215 $('#cart-items,.cart-badge').html(json['items_count']); 216 217 if (json['items_count']) { 218 $('#cart-items,.cart-badge').removeClass('count-zero'); 219 } else { 220 $('#cart-items,.cart-badge').addClass('count-zero'); 221 } 222 }, 100); 223 224 if ($('html').hasClass('route-checkout-cart') || $('html').hasClass('route-checkout-checkout')) { 225 location = 'index.php?route=checkout/cart'; 226 } else { 227 $('.cart-content ul').load('index.php?route=common/cart/info ul li'); 228 } 229 }, 230 error: function (xhr, ajaxOptions, thrownError) { 231 alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText); 232 } 233 }); 234}; 235 236window['cart'].update = function (key, quantity) { 237 $.ajax({ 238 url: 'index.php?route=checkout/cart/edit', 239 type: 'post', 240 data: 'key=' + key + '&quantity=' + (typeof(quantity) != 'undefined' ? quantity : 1), 241 dataType: 'json', 242 beforeSend: function () { 243 $('#cart > button').button('loading'); 244 }, 245 complete: function () { 246 $('#cart > button').button('reset'); 247 }, 248 success: function (json) { 249 // Need to set timeout otherwise it wont update the total 250 setTimeout(function () { 251 $('#cart-total').html(json['total']); 252 $('#cart-items,.cart-badge').html(json['items_count']); 253 254 if (json['items_count']) { 255 $('#cart-items,.cart-badge').removeClass('count-zero'); 256 } else { 257 $('#cart-items,.cart-badge').addClass('count-zero'); 258 } 259 }, 100); 260 261 if ($('html').hasClass('route-checkout-cart') || $('html').hasClass('route-checkout-checkout')) { 262 location = 'index.php?route=checkout/cart'; 263 } else { 264 $('.cart-content ul').load('index.php?route=common/cart/info ul li'); 265 } 266 }, 267 error: function (xhr, ajaxOptions, thrownError) { 268 alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText); 269 } 270 }); 271}; 272 273window['wishlist'] = window['wishlist'] || {}; 274 275window['wishlist'].add = function (product_id) { 276 $.ajax({ 277 url: 'index.php?route=account/wishlist/add', 278 type: 'post', 279 data: 'product_id=' + product_id, 280 dataType: 'json', 281 success: function (json) { 282 $('.alert').remove(); 283 284 if (json['redirect']) { 285 location = json['redirect']; 286 } 287 288 if (json['success']) { 289 $('[data-toggle="tooltip"]').tooltip('hide'); 290 291 if (json['notification']) { 292 show_notification(json['notification']); 293 } else { 294 $('header').after('<div class="alert alert-success"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">×</button></div>'); 295 } 296 } 297 298 $('#wishlist-total span').html(json['total']); 299 $('#wishlist-total').attr('title', json['total']); 300 $('.wishlist-badge').text(json['count']); 301 302 if (json['count']) { 303 $('.wishlist-badge').removeClass('count-zero'); 304 } else { 305 $('.wishlist-badge').addClass('count-zero'); 306 } 307 308 if (Journal['scrollToTop']) { 309 $('html, body').animate({ scrollTop: 0 }, 'slow'); 310 } 311 }, 312 error: function (xhr, ajaxOptions, thrownError) { 313 alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText); 314 } 315 }); 316}; 317 318window['compare'] = window['compare'] || {}; 319 320window['compare'].add = function (product_id) { 321 $.ajax({ 322 url: 'index.php?route=product/compare/add', 323 type: 'post', 324 data: 'product_id=' + product_id, 325 dataType: 'json', 326 success: function (json) { 327 $('.alert').remove(); 328 329 if (json['success']) { 330 $('[data-toggle="tooltip"]').tooltip('hide'); 331 332 if (json['notification']) { 333 show_notification(json['notification']); 334 } else { 335 $('header').after('<div class="alert alert-success"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">×</button></div>'); 336 } 337 338 $('#compare-total').html(json['total']); 339 $('.compare-badge').text(json['count']); 340 341 if (json['count']) { 342 $('.compare-badge').removeClass('count-zero'); 343 } else { 344 $('.compare-badge').addClass('count-zero'); 345 } 346 347 if (Journal['scrollToTop']) { 348 $('html, body').animate({ scrollTop: 0 }, 'slow'); 349 } 350 } 351 }, 352 error: function (xhr, ajaxOptions, thrownError) { 353 alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText); 354 } 355 }); 356}; 357 358window['quickview'] = function (product_id) { 359 product_id = parseInt(product_id, 10); 360 361 // hide tooltip 362 $('[data-toggle="tooltip"]').tooltip('hide'); 363 364 var html = ''; 365 366 html += '<div class="popup-wrapper popup-quickview">'; 367 html += ' <div class="popup-container">'; 368 html += ' <button class="btn popup-close"></button>'; 369 html += ' <div class="popup-body">'; 370 html += ' <div class="popup-inner-body">'; 371 html += ' <div class="journal-loading"><i class="fa fa-spinner fa-spin"></i></div>'; 372 html += ' <iframe src="index.php?route=journal3/product&product_id=' + product_id + '&popup=quickview" width="100%" height="100%" frameborder="0" onload="this.height = this.contentWindow.document.body.offsetHeight; $(this).prev(\'.journal-loading\').hide();"></iframe>';
373 html += ' </div>'; 374 html += ' </div>'; 375 html += ' </div>'; 376 html += ' <div class="popup-bg popup-bg-closable"></div>'; 377 html += '</div>'; 378 379 // show modal 380 $('.popup-wrapper').remove(); 381 382 $('body').append(html); 383 384 setTimeout(function () { 385 $('html').addClass('popup-open popup-center'); 386 }, 10); 387}; 388 389window['open_popup'] = function (module_id) { 390 if ($('html').hasClass('iphone') || $('html').hasClass('ipad')) { 391 iNoBounce.enable(); 392 } 393 394 module_id = parseInt(module_id, 10); 395 396 var html = ''; 397 398 html += '<div class="popup-wrapper popup-module">'; 399 html += ' <div class="popup-container">'; 400 html += ' <button class="btn popup-close"></button>'; 401 html += ' <div class="popup-body">'; 402 html += ' <div class="popup-inner-body">'; 403 html += ' </div>'; 404 html += ' </div>'; 405 html += ' </div>'; 406 html += ' <div class="popup-bg popup-bg-closable"></div>'; 407 html += '</div>'; 408 409 // show modal 410 $('.popup-wrapper').remove(); 411 412 $('body').append(html); 413 414 setTimeout(function () { 415 $('html').addClass('popup-open popup-center'); 416 }, 10); 417 418 $('.popup-container').css('visibility', 'hidden'); 419 420 $.ajax({ 421 url: 'index.php?route=journal3/popup/get&module_id=' + module_id + '&popup=module', 422 success: function (html) { 423 var $html = $(html); 424 var $popup = $html.siblings('.module-popup'); 425 var $style = $html.siblings('style'); 426 var $content = $popup.find('.popup-container'); 427 428 $('#popup-style-' + module_id).remove(); 429 $('head').append($style.attr('id', 'popup-style-' + module_id)); 430 $('.popup-wrapper').attr('class', $popup.attr('class')); 431 $('.popup-container').html($content.html()); 432 433 $('.popup-container').css('visibility', 'visible'); 434 }, 435 error: function (xhr, ajaxOptions, thrownError) { 436 alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText); 437 } 438 }); 439}; 440 441window['open_login_popup'] = function () { 442 if ($('html').hasClass('iphone') || $('html').hasClass('ipad')) { 443 iNoBounce.enable(); 444 } 445 446 var html = ''; 447 448 html += '<div class="popup-wrapper popup-login">'; 449 html += ' <div class="popup-container">'; 450 html += ' <button class="btn popup-close"></button>'; 451 html += ' <div class="popup-body">'; 452 html += ' <div class="popup-inner-body">'; 453 html += ' <div class="journal-loading"><i class="fa fa-spinner fa-spin"></i></div>'; 454 html += ' <iframe src="index.php?route=account/login&popup=login" width="100%" height="100%" frameborder="0" onload="this.height = this.contentWindow.document.body.offsetHeight; $(this).prev(\'.journal-loading\').fadeOut();"></iframe>'; 455 html += ' </div>'; 456 html += ' </div>'; 457 html += ' </div>'; 458 html += ' <div class="popup-bg popup-bg-closable"></div>'; 459 html += '</div>'; 460 461 // show modal 462 $('.popup-wrapper').remove(); 463 464 $('body').append(html); 465 466 setTimeout(function () { 467 $('html').addClass('popup-open popup-center'); 468 }, 10); 469}; 470 471window['open_register_popup'] = function () { 472 if ($('html').hasClass('iphone') || $('html').hasClass('ipad')) { 473 iNoBounce.enable(); 474 } 475 476 var html = ''; 477 478 html += '<div class="popup-wrapper popup-register">'; 479 html += ' <div class="popup-container">'; 480 html += ' <button class="btn popup-close"></button>'; 481 html += ' <div class="popup-body">'; 482 html += ' <div class="popup-inner-body">'; 483 html += ' <div class="journal-loading"><i class="fa fa-spinner fa-spin"></i></div>'; 484 html += ' <iframe src="index.php?route=account/register&popup=register" width="100%" height="100%" frameborder="0" onload="this.height = this.contentWindow.document.body.offsetHeight; $(this).prev(\'.journal-loading\').fadeOut();"></iframe>'; 485 html += ' </div>'; 486 html += ' </div>'; 487 html += ' </div>'; 488 html += ' <div class="popup-bg popup-bg-closable"></div>'; 489 html += '</div>'; 490 491 // show modal 492 $('.popup-wrapper').remove(); 493 494 $('body').append(html); 495 496 setTimeout(function () { 497 $('html').addClass('popup-open popup-center'); 498 }, 10); 499}; 500 501window['show_notification'] = function (opts) { 502 opts = $.extend({ 503 position: 'center', 504 className: '', 505 title: '', 506 image: '', 507 message: '', 508 buttons: [], 509 timeout: Journal.notificationHideAfter 510 }, opts); 511 512 if ($('.notification-wrapper-' + opts.position).length === 0) { 513 $('body').append('<div class="notification-wrapper notification-wrapper-' + opts.position + '"></div>'); 514 } 515 516 var html = ''; 517 518 var buttons = $.map(opts.buttons, function (button) { 519 return '<a class="' + button.className + '" href="' + button.href + '">' + button.name + '</a>'; 520 }); 521 522 html += '<div class="notification ' + opts.className + '">'; 523 html += ' <button class="btn notification-close"></button>'; 524 html += ' <div class="notification-content">'; 525 526 if (opts.image) { 527 html += ' <img src="' + opts.image + '" srcset="' + opts.image + ' 1x, ' + opts.image2x + ' 2x">'; 528 } 529 530 html += ' <div>'; 531 html += ' <div class="notification-title">' + opts.title + '</div>'; 532 html += ' <div class="notification-text">' + opts.message + '</div>'; 533 html += ' </div>'; 534 html += ' </div>'; 535 536 if (buttons && buttons.length) { 537 html += '<div class="notification-buttons">' + buttons.join('\n') + '</div>'; 538 } 539 540 html += '</div>'; 541 542 var $notification = $(html); 543 544 $('.notification-wrapper-' + opts.position).append($notification); 545 546 if (opts.timeout) { 547 setTimeout(function () { 548 $notification.find('.notification-close').trigger('click'); 549 }, opts.timeout); 550 } 551 552 return $notification; 553}; 554 555window['loader'] = function (el, status) { 556 var $el = $(el); 557 558 if (status) { 559 $el.attr('style', 'position: relative'); 560 $el.append('<div class="journal-loading-overlay"><div class="journal-loading"><i class="fa fa-spinner fa-spin"></i></div></div>'); 561 } else { 562 $el.attr('style', ''); 563 $el.find('.journal-loading-overlay').remove(); 564 } 565}; 566 567window['resize_iframe'] = function (module_id, height) { 568 $('.module-popup-' + module_id + ' iframe').height(height); 569};
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.