PageSourceSearch

https://www.rack-magic.com/epages/10067278.sf?ViewAction=UnityViewEP6Script

js rack-magic.com collected 2026-09-25 21:59:28 UTC 13,787 bytes, 401 lines download raw bytes

1
2  try {
3  if (window.eComEventTarget) {
4    window.eComEventTarget.addEventListener('cart:add', function (event) {
5      if (XMLHttpRequest) {
6        var xhr = new XMLHttpRequest(),
7          registerUrl = event.detail.cart.registerSessionUrl;
8        xhr.open('GET', registerUrl, true);
9
10        xhr.addEventListener('load', function () {
11          if (xhr.status > 200 || xhr.status >= 300) {
12            console.warn(xhr.statusText, xhr.responseText);
13          }
14        });
15
16        xhr.send();
17      }
18    })
19  }
20} catch (ex) {
21  console.log(ex);
22}
23
24  try {
25  if (window.eComEventTarget) {
26    window.eComEventTarget.addEventListener('wishlist:add', function (event) {
27      if (XMLHttpRequest) {
28        var xhr = new XMLHttpRequest(),
29          product = event.detail.product,
30          targetUrl = 'https://www.rack-magic.com/epages/10067278.sf' + '?ViewAction=JSONViewResponse&ChangeAction=JSONAddItemToShoppingList',
31          data = {
32            'ProductGUID': product.productId,
33            'Quantity': product.quantity,
34            'LineItemGUID': event.detail.lineItemId,
35            'CustomizedText': product.customizedText,
36            'LocaleID': event.detail.locale
37          };
38
39        xhr.open('POST', targetUrl, true);
40        xhr.setRequestHeader('Content-Type', 'application/json')
41
42        xhr.addEventListener('load', function () {
43          if (xhr.status < 200 || xhr.status >= 300) {
44            console.warn(xhr.statusText, xhr.responseText);
45          } else {
46            var response = JSON.parse(xhr.responseText)
47            
48
49            if (response.success) {
50              window.eComEventTarget.dispatchEvent(new CustomEvent('wishlist:success-' + response.productId, { 'detail': response }));
51              window.eComEventTarget.dispatchEvent(new CustomEvent('wishlist:success-' + response.lineItemId, { 'detail': response }));
52            } else if (response.reason === 'nouser') {
53              window.eComEventTarget.dispatchEvent(new CustomEvent('wishlist:nouser-' + response.productId, { 'detail': response }));
54              window.eComEventTarget.dispatchEvent(new CustomEvent('wishlist:nouser-' + response.lineItemId, { 'detail': response }));
55            } else {
56              console.warn(xhr.statusText, xhr.responseText);
57            }
58
59            
60          }
61        });
62        xhr.send(JSON.stringify(data));
63      }
64    })
65  }
66} catch (ex) {
67  console.log(ex);
68}
69
70  
71
72try {
73(function () {
74  var initPayPalIntID,
75      minMaxAllowed,
76      inCompatibleShippingMethods,
77      shippingMethodLandRestrictions,
78      paymentMethodRegionRestrictions,
79      buttonContainer = 'div#paypal-button-container';
80      
81
82      try {
83        minMaxAllowed = JSON.parse('{"EUR":{"MaxPriceValue":null,"MinPriceValue":null}}');
84      } catch (ex) {
85      }
86      try {
87        inCompatibleShippingMethods = JSON.parse('{}');
88        shippingMethodLandRestrictions = JSON.parse('{"836527":{"SE":1,"GR":1,"FI":1,"LU":1,"NL":1,"BE":1,"AT":1,"RO":1,"HR":1,"DK":1,"CZ":1,"PT":1,"FR":1},"3786296":{"DE":1},"836513":{"GR":1,"CY":1,"SI":1,"IE":1,"MT":1,"LT":1,"EE":1,"LV":1,"PL":1,"IT":1,"ES":1,"SK":1,"HU":1},"836752":{"DE":1},"1739699":{"DE":1},"248297645":{"DE":1},"836607":{"GR":1,"CY":1,"SI":1,"IE":1,"MT":1,"LT":1,"EE":1,"LV":1,"PL":1,"IT":1,"ES":1,"SK":1,"HU":1},"858166":{"DE":1},"836835":{"DE":1},"858171":{"SE":1,"GR":1,"FI":1,"LU":1,"NL":1,"BE":1,"AT":1,"RO":1,"HR":1,"DK":1,"CZ":1,"PT":1,"FR":1},"835078":{"SE":1,"GR":1,"FI":1,"LU":1,"NL":1,"BE":1,"AT":1,"RO":1,"HR":1,"DK":1,"CZ":1,"PT":1,"FR":1},"245738055":{"NO":1,"RS":1,"CH":1,"LI":1},"85186650":{"GB":1},"3433329":{"SE":1,"GR":1,"FI":1,"LU":1,"NL":1,"BE":1,"AT":1,"RO":1,"HR":1,"DK":1,"CZ":1,"PT":1,"FR":1}}');
89        
90      } catch (ex) {
91      }
92
93  var initPayPal = function() {
94    var isOk = 1;
95
96    if (window.paypal) {
97      try {
98        var FUNDING_SOURCES = [
99          
100            paypal.FUNDING.PAYPAL,
101            paypal.FUNDING.PAYLATER
102          
103        ];
104
105        FUNDING_SOURCES.forEach(function(fundingSource) {
106            var button = paypal.Buttons({
107              style: {
108                layout: 'vertical',
109                color: fundingSource === paypal.FUNDING.PAYPAL || fundingSource === paypal.FUNDING.PAYLATER ? 'gold' : 'white',
110                shape: 'rect',
111                label: 'checkout',
112                height: 55,
113              },
114              fundingSource: fundingSource,
115              createOrder: function (data, actions) {
116                return xhrRequest();
117              },
118              onApprove: function (data, actions) {
119                xhrRequestApprove(fundingSource);
120              },
121              onCancel: function (data, actions) {
122                console.log("Customer cancelled the PayPal Checkout Flow");
123              },
124              onError: function () {
125                console.log("An Error occurred as part of the PayPal JS SDK");
126              },
127              onShippingChange: function(data, actions) {
128                var selectedShippingOptionId,
129                    shippingAddressCountryCode;
130
131                try {
132                  selectedShippingOptionId = data.selected_shipping_option.id;
133                  shippingAddressCountryCode = data.shipping_address.country_code;
134                } catch (ex) {
135                  return actions.resolve();
136                }
137
138                if ( paymentMethodRegionRestrictions && ! paymentMethodRegionRestrictions.includes(shippingAddressCountryCode) ) {
139                  return actions.reject();
140                }
141
142                if ( shippingMethodLandRestrictions && shippingMethodLandRestrictions[selectedShippingOptionId] ) {
143                  if ( ! shippingMethodLandRestrictions[selectedShippingOptionId][shippingAddressCountryCode] ) {
144                    return actions.reject();
145                  }
146                }
147
148                return actions.resolve();
149              }
150            });
151
152            if ( button.isEligible() ) {
153              button.render(buttonContainer);
154            }
155        });
156
157        /*  */
158        
159        if ( cart ) {
160            var elem = document.querySelector(buttonContainer);
161            if ( elem ) {
162              elem.setAttribute('data-pp-amount', cart.grandTotal.amount);
163            }
164            paypal.Messages({
165              style: {
166                layout: 'text',
167                logo: {
168                  type: 'primary'
169                },
170                text: {
171                  align: 'center'
172                }
173              },
174            }).render(buttonContainer);
175        }
176        
177
178      } catch (e) {
179        isOk = 0;
180        console.log(e);
181      }
182    } else {
183      isOk = 0;
184    }
185
186    if ( typeof initPayPalIntID == 'number' ) {
187      clearInterval(initPayPalIntID);
188    }
189  },
190
191  xhrRequest = function() {
192    return new Promise(function(resolve, reject) {
193      if (XMLHttpRequest && cart) {
194        var xhr = new XMLHttpRequest(),
195          targetUrl = 'https://www.rack-magic.com/epages/10067278.sf?ViewAction=JSONViewResponse&ChangeAction=JSONCreatePayPalPPCPOrder',
196          data = {
197            'BasketGUID': cart.cartId,
198          };
199
200        xhr.open('POST', targetUrl, true);
201        xhr.setRequestHeader('Content-Type', 'application/json');
202
203        xhr.addEventListener('load', function () {
204          if (xhr.status < 200 || xhr.status >= 300) {
205            reject(new Error(xhr.responseText + xhr.statusText));
206          } else {
207            try {
208              var response = JSON.parse(xhr.responseText);
209
210              if (response.success) {
211                resolve(response.orderID);
212              } else {
213                reject(new Error(xhr.responseText + xhr.statusText));
214              }
215            } catch (e) {
216              reject(e);
217            }
218          }
219        });
220
221        xhr.send(JSON.stringify(data));
222      }
223    })
224  },
225
226  xhrRequestApprove = function(fundingSource) {
227    if (XMLHttpRequest && cart) {
228      var xhr = new XMLHttpRequest(),
229        targetUrl = 'https://www.rack-magic.com/epages/10067278.sf?ViewAction=JSONViewResponse&ChangeAction=JSONApprovePayPalPPCPOrder',
230        data = {
231          'PickupToken': 'MDZjOGM2YWYyNjZhZjQxY2YwMTIxM2YxODVjODZjY2YxYmViMjYxNjRmZWYxMTA4OGE5NjQ1YjU2NzU2ODQyM18xNzkwMzczNTY4',
232          'BasketGUID': cart.cartId,
233          'FundingSource': fundingSource,
234        };
235
236      xhr.open('POST', targetUrl, true);
237      xhr.setRequestHeader('Content-Type', 'application/json');
238
239      xhr.addEventListener('load', function () {
240        if (xhr.status < 200 || xhr.status >= 300) {
241          console.warn(new Error(xhr.responseText + xhr.statusText));
242        } else {
243          try {
244            var response = JSON.parse(xhr.responseText);
245
246            if (response.success) {
247              window.location = response.redirect;
248            } else {
249              console.warn(new Error(xhr.responseText + xhr.statusText));
250            }
251          } catch (e) {
252            console.log(e);
253          }
254        }
255      });
256
257      xhr.send(JSON.stringify(data));
258    }
259  };
260
261    var cart,
262        script;
263
264    
265    
266      script = document.createElement('script');
267      script.src = 'https://www.paypal.com/sdk/js?integration-date=2022-03-24&client-id=AWP-VEcNsP7PQeZjM8cFxdfAvUTt8XCUAJlvFpibmcRRZc60bGEgq0Q2BagthDiMW6e6p1gYDnSiJfHW&currency=EUR&intent=capture&components=buttons,funding-eligibility,messages&enable-funding=paylater&commit=false';
268      script.setAttribute("defer", true);
269      script.setAttribute('data-partner-attribution-id', 'ePages_Strato_PPCP');
270      document.body.appendChild(script);
271
272      var ppcpUpdateCart = function (e) {
273            var container = document.querySelector(buttonContainer),
274                timeout = 500,
275                compatibleWithCurrentShipping = 1;
276
277            if ( container && typeof paypal !== 'undefined' ) {
278              timeout = 0;
279            }
280
281            /*  */
282            setTimeout(function(){
283
284              if ( ! container ) {
285                  container = document.querySelector(buttonContainer);
286              }
287              var cartHasItems = typeof cart.productLineItems === 'object' && cart.productLineItems.length > 0 ? true : false;
288
289              if ( container && cartHasItems ) {
290                /*  */
291                var cartCurrencyId = cart.grandTotal.currency;
292
293                container.setAttribute('data-pp-amount', cart.grandTotal.amount);
294
295                /*  */
296                if ( cart.shippingLineItem.shippingMethod.name ) {
297                    try {
298                      var shippingNameEncoded = btoa(encodeURIComponent(cart.shippingLineItem.shippingMethod.name));
299                      if ( inCompatibleShippingMethods[shippingNameEncoded] ) {
300                        compatibleWithCurrentShipping = 0;
301                      }
302                    } catch (ex) {
303                    }
304                }
305
306                var regionCompatible = 1;
307                
308
309                if ( ! compatibleWithCurrentShipping ) {
310                  container.style.display = 'none';
311                } else if ( typeof minMaxAllowed === 'object' && minMaxAllowed[cartCurrencyId]['MinPriceValue'] && cart.grandTotal.amount < minMaxAllowed[cartCurrencyId]['MinPriceValue'] ) {
312                  container.style.display = 'none';
313                } else if ( typeof minMaxAllowed === 'object' && minMaxAllowed[cartCurrencyId]['MaxPriceValue'] && cart.grandTotal.amount > minMaxAllowed[cartCurrencyId]['MaxPriceValue'] ) {
314                  container.style.display = 'none';
315                } else if ( ! regionCompatible ) {
316                  container.style.display = 'none';
317                } else {
318                  container.style.display = '';
319                }
320
321                if (window.paypal && e.type === 'cart:view') {
322                  initPayPal();
323                }
324              }
325
326            }, timeout);
327          };
328
329      /*  */
330      
331        window.eComEventTarget && document.head.insertAdjacentHTML('beforeend', '<style>div.product-button-container span[id*="zoid-paypal-message"]{margin-top:20px;width:100%;}</style>');
332        window.eComEventTarget && window.eComEventTarget.addEventListener('product:view', function(event) {
333          var product = event.detail.product,
334              productSelector = 'div.product-button-container',
335              container = document.querySelector(productSelector),
336              timeout = 500;
337
338          if ( container && typeof paypal !== 'undefined' ) {
339            timeout = 0;
340          }
341
342          /*  */
343          setTimeout(function(){
344              if ( ! container ) {
345                container = document.querySelector(productSelector);
346              }
347
348              if ( container ) {
349                container.setAttribute('data-pp-amount', product.price.amount);
350
351                paypal.Messages({
352                    style: {
353                      layout: 'text',
354                      logo: {
355                        type: 'primary'
356                      }
357                    },
358                }).render(productSelector);
359              }
360
361          }, timeout);
362        });
363      
364
365      window.eComEventTarget && window.eComEventTarget.addEventListener('cart:view', function(event) {
366        cart = event.detail.cart;
367
368        ppcpUpdateCart(event);
369      });
370
371      window.eComEventTarget && window.eComEventTarget.addEventListener('cart:update', function(event) {
372        cart = event.detail.cart;
373
374        ppcpUpdateCart(event);
375      });
376
377      /*  */
378      window.eComEventTarget && document.head.insertAdjacentHTML('beforeend', '<style>div#paypal-button-container span[id*="zoid-paypal-message"]{display: block;}</style>');
379    
380
381    
382    
383
384})();
385} catch (ex) {
386  console.log(ex);
387}
388
389 
390
391  
392
393
394
395
396
397
398
399
400
401

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.