Advertisement
Guest User

Untitled

a guest
Aug 27th, 2014
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. // START OF SCRIPT
  3. //
  4. function opt_loadUsiFbtPopup() {
  5.     (function($) {
  6.         this.opt_addToCartPopup = (function() {
  7.             function opt_addToCartPopup() {}
  8.             opt_addToCartPopup.getPopupHtml = function(id, isFsa) {
  9.                 var iconClass;
  10.                 iconClass = isFsa ? 'atcFsa' : 'atcRx';
  11.                 return "<style type='text/css'> .opt_addToCartButton { display: inline-block; } .opt_buttonContainer { margin: 20px 0; text-align: center; } #USI_DIV1 { width: 528px; height: 200px; margin-left: auto; margin-right: auto; } </style> <div> <h2>Are you sure?</h2> <div class='opt_buttonContainer'> <a href='#'' class='opt_addToCartButton' elementaction='100' alt='' data-id='" + id + "'> <div class='atc " + iconClass + " icnSpr'></div> <div class='atcTxt hdrSpr'>Add to Cart</div> </a> </div> <div>OR</div> <div id='USI_DIV1'>" + usi_wholeThing + "</div> </div>";
  12.             };
  13.             opt_addToCartPopup.attachRealAddToCartEventHandler = function() {
  14.                 return $('.opt_addToCartButton').click(function() {
  15.                     var button;
  16.                     button = $(this);
  17.                     window.basket.AddToCart(button, button.data('id'));
  18.                     return $('.ui-widget-overlay').click();
  19.                 });
  20.             };
  21.             opt_addToCartPopup.attachFakeAddToCartEventHandler = function() {
  22.                 var self;
  23.                 self = this;
  24.                 return $('a.AddToCartLink_JS, a.ATC_Car, .PRD_AddToCart').off('click').click(function(e) {
  25.                     var button, id, isFsa;
  26.                     e.preventDefault();
  27.                     button = $(this);
  28.                     id = button.attr('pid');
  29.                     isFsa = button.find('.atc').hasClass('atcFsa');
  30.                     self.showDialog(id, isFsa);
  31.                     return false;
  32.                 });
  33.             };
  34.             opt_addToCartPopup.showDialog = function(id, isFsa) {
  35.                 $.showDialog({
  36.                     width: 600,
  37.                     minHeight: 300,
  38.                     hideTitle: true,
  39.                     html: this.getPopupHtml(id, isFsa),
  40.                     clickToClose: true
  41.                 });
  42.                 return this.attachRealAddToCartEventHandler();
  43.             };
  44.             return opt_addToCartPopup;
  45.         })();
  46.         return $(function() {
  47.             return opt_addToCartPopup.attachFakeAddToCartEventHandler();
  48.         });
  49.     })(jQuery);
  50. }
  51.  
  52. function usi_attemptModalPlacement() {
  53.     if (typeof usi_wholeThing == "undefined" || usi_wholeThing == "") {
  54.         setTimeout(usi_attemptModalPlacement, 2000);
  55.     } else {
  56.         opt_loadUsiFbtPopup();
  57.     }
  58. }
  59. usi_attemptModalPlacement();
  60. //
  61. // END OF SCRIPT
  62. //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement