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['voucher'] = window['voucher'] || {}; 359 360window['voucher'].remove = function(key) { 361 $.ajax({ 362 url: 'index.php?route=checkout/cart/remove', 363 type: 'post', 364 data: 'key=' + key, 365 dataType: 'json', 366 beforeSend: function () { 367 $('#cart > button').button('loading'); 368 }, 369 complete: function () { 370 $('#cart > button').button('reset'); 371 }, 372 success: function (json) { 373 // Need to set timeout otherwise it wont update the total 374 setTimeout(function () { 375 $('#cart-total').html(json['total']); 376 $('#cart-items,.cart-badge').html(json['items_count']); 377 378 if (json['items_count']) { 379 $('#cart-items,.cart-badge').removeClass('count-zero'); 380 } else { 381 $('#cart-items,.cart-badge').addClass('count-zero'); 382 } 383 }, 100); 384 385 if ($('html').hasClass('route-checkout-cart') || $('html').hasClass('route-checkout-checkout')) { 386 location = 'index.php?route=checkout/cart'; 387 } else { 388 $('.cart-content ul').load('index.php?route=common/cart/info ul li'); 389 } 390 }, 391 error: function (xhr, ajaxOptions, thrownError) { 392 alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText); 393 } 394 }); 395}; 396 397window['quickview'] = function (product_id) { 398 product_id = parseInt(product_id, 10); 399 400 // hide tooltip 401 $('[data-toggle="tooltip"]').tooltip('hide'); 402 403 var html = ''; 404 405 html += '<div class="popup-wrapper popup-quickview">'; 406 html += ' <div class="popup-container">'; 407 html += ' <button class="btn popup-close"></button>'; 408 html += ' <div class="popup-body">'; 409 html += ' <div class="popup-inner-body">'; 410 html += ' <div class="journal-loading"><i class="fa fa-spinner fa-spin"></i></div>'; 411 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>';
412 html += ' </div>'; 413 html += ' </div>'; 414 html += ' </div>'; 415 html += ' <div class="popup-bg popup-bg-closable"></div>'; 416 html += '</div>'; 417 418 // show modal 419 $('.popup-wrapper').remove(); 420 421 $('body').append(html); 422 423 setTimeout(function () { 424 $('html').addClass('popup-open popup-center'); 425 }, 10); 426}; 427 428window['open_popup'] = function (module_id) { 429 if ($('html').hasClass('iphone') || $('html').hasClass('ipad')) { 430 iNoBounce.enable(); 431 } 432 433 module_id = parseInt(module_id, 10); 434 435 var html = ''; 436 437 html += '<div class="popup-wrapper popup-module">'; 438 html += ' <div class="popup-container">'; 439 html += ' <button class="btn popup-close"></button>'; 440 html += ' <div class="popup-body">'; 441 html += ' <div class="popup-inner-body">'; 442 html += ' </div>'; 443 html += ' </div>'; 444 html += ' </div>'; 445 html += ' <div class="popup-bg popup-bg-closable"></div>'; 446 html += '</div>'; 447 448 // show modal 449 $('.popup-wrapper').remove(); 450 451 $('body').append(html); 452 453 setTimeout(function () { 454 $('html').addClass('popup-open popup-center'); 455 }, 10); 456 457 $('.popup-container').css('visibility', 'hidden'); 458 459 $.ajax({ 460 url: 'index.php?route=journal3/popup/get&module_id=' + module_id + '&popup=module', 461 success: function (html) { 462 var $html = $(html); 463 var $popup = $html.siblings('.module-popup'); 464 var $style = $html.siblings('style'); 465 var $content = $popup.find('.popup-container'); 466 467 $('#popup-style-' + module_id).remove(); 468 $('head').append($style.attr('id', 'popup-style-' + module_id)); 469 $('.popup-wrapper').attr('class', $popup.attr('class')); 470 $('.popup-container').html($content.html()); 471 472 $('.popup-container').css('visibility', 'visible'); 473 }, 474 error: function (xhr, ajaxOptions, thrownError) { 475 alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText); 476 } 477 }); 478}; 479 480window['open_login_popup'] = function () { 481 if ($('html').hasClass('iphone') || $('html').hasClass('ipad')) { 482 iNoBounce.enable(); 483 } 484 485 var html = ''; 486 487 html += '<div class="popup-wrapper popup-login">'; 488 html += ' <div class="popup-container">'; 489 html += ' <button class="btn popup-close"></button>'; 490 html += ' <div class="popup-body">'; 491 html += ' <div class="popup-inner-body">'; 492 html += ' <div class="journal-loading"><i class="fa fa-spinner fa-spin"></i></div>'; 493 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>'; 494 html += ' </div>'; 495 html += ' </div>'; 496 html += ' </div>'; 497 html += ' <div class="popup-bg popup-bg-closable"></div>'; 498 html += '</div>'; 499 500 // show modal 501 $('.popup-wrapper').remove(); 502 503 $('body').append(html); 504 505 setTimeout(function () { 506 $('html').addClass('popup-open popup-center'); 507 }, 10); 508}; 509 510window['open_register_popup'] = function () { 511 if ($('html').hasClass('iphone') || $('html').hasClass('ipad')) { 512 iNoBounce.enable(); 513 } 514 515 var html = ''; 516 517 html += '<div class="popup-wrapper popup-register">'; 518 html += ' <div class="popup-container">'; 519 html += ' <button class="btn popup-close"></button>'; 520 html += ' <div class="popup-body">'; 521 html += ' <div class="popup-inner-body">'; 522 html += ' <div class="journal-loading"><i class="fa fa-spinner fa-spin"></i></div>'; 523 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>'; 524 html += ' </div>'; 525 html += ' </div>'; 526 html += ' </div>'; 527 html += ' <div class="popup-bg popup-bg-closable"></div>'; 528 html += '</div>'; 529 530 // show modal 531 $('.popup-wrapper').remove(); 532 533 $('body').append(html); 534 535 setTimeout(function () { 536 $('html').addClass('popup-open popup-center'); 537 }, 10); 538}; 539 540window['show_notification'] = function (opts) { 541 opts = $.extend({ 542 position: 'center', 543 className: '', 544 title: '', 545 image: '', 546 message: '', 547 buttons: [], 548 timeout: Journal.notificationHideAfter 549 }, opts); 550 551 if ($('.notification-wrapper-' + opts.position).length === 0) { 552 $('body').append('<div class="notification-wrapper notification-wrapper-' + opts.position + '"></div>'); 553 } 554 555 var html = ''; 556 557 var buttons = $.map(opts.buttons, function (button) { 558 return '<a class="' + button.className + '" href="' + button.href + '">' + button.name + '</a>'; 559 }); 560 561 html += '<div class="notification ' + opts.className + '">'; 562 html += ' <button class="btn notification-close"></button>'; 563 html += ' <div class="notification-content">'; 564 565 if (opts.image) { 566 html += ' <img src="' + opts.image + '" srcset="' + opts.image + ' 1x, ' + opts.image2x + ' 2x">'; 567 } 568 569 html += ' <div>'; 570 html += ' <div class="notification-title">' + opts.title + '</div>'; 571 html += ' <div class="notification-text">' + opts.message + '</div>'; 572 html += ' </div>'; 573 html += ' </div>'; 574 575 if (buttons && buttons.length) { 576 html += '<div class="notification-buttons">' + buttons.join('\n') + '</div>'; 577 } 578 579 html += '</div>'; 580 581 var $notification = $(html); 582 583 $('.notification-wrapper-' + opts.position).append($notification); 584 585 if (opts.timeout) { 586 setTimeout(function () { 587 $notification.find('.notification-close').trigger('click'); 588 }, opts.timeout); 589 } 590 591 return $notification; 592}; 593 594window['loader'] = function (el, status) { 595 var $el = $(el); 596 597 if (status) { 598 $el.attr('style', 'position: relative'); 599 $el.append('<div class="journal-loading-overlay"><div class="journal-loading"><i class="fa fa-spinner fa-spin"></i></div></div>'); 600 } else { 601 $el.attr('style', ''); 602 $el.find('.journal-loading-overlay').remove(); 603 } 604}; 605 606window['resize_iframe'] = function (module_id, height) { 607 $('.module-popup-' + module_id + ' iframe').height(height); 608};
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.