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