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