PageSourceSearch

https://www.diorama-world.com/epages/92074467.sf?ViewAction=UnityViewEP6Script

js diorama-world.com collected 2026-10-06 20:13:29 UTC 13,250 bytes, 398 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.diorama-world.com/epages/92074467.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('{"110782189":{"SE":1,"IE":1,"IT":1},"110782684":{"IS":1,"GB":1,"AL":1,"CH":1,"LI":1,"ME":1,"NO":1,"UA":1,"RS":1},"110780174":{"DE":1},"110785314":{"PH":1,"AU":1,"HK":1,"KP":1,"RU":1,"KR":1,"ZA":1,"TR":1,"JP":1,"CA":1,"CN":1,"AR":1,"SG":1,"BR":1,"VN":1,"AE":1,"BA":1,"US":1,"TH":1,"IL":1,"NZ":1},"110781664":{"NL":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        ];
101
102        FUNDING_SOURCES.forEach(function(fundingSource) {
103            var button = paypal.Buttons({
104              style: {
105                layout: 'vertical',
106                color: fundingSource === paypal.FUNDING.PAYPAL || fundingSource === paypal.FUNDING.PAYLATER ? 'gold' : 'white',
107                shape: 'rect',
108                label: 'checkout',
109                height: 55,
110              },
111              fundingSource: fundingSource,
112              createOrder: function (data, actions) {
113                return xhrRequest();
114              },
115              onApprove: function (data, actions) {
116                xhrRequestApprove(fundingSource);
117              },
118              onCancel: function (data, actions) {
119                console.log("Customer cancelled the PayPal Checkout Flow");
120              },
121              onError: function () {
122                console.log("An Error occurred as part of the PayPal JS SDK");
123              },
124              onShippingChange: function(data, actions) {
125                var selectedShippingOptionId,
126                    shippingAddressCountryCode;
127
128                try {
129                  selectedShippingOptionId = data.selected_shipping_option.id;
130                  shippingAddressCountryCode = data.shipping_address.country_code;
131                } catch (ex) {
132                  return actions.resolve();
133                }
134
135                if ( paymentMethodRegionRestrictions && ! paymentMethodRegionRestrictions.includes(shippingAddressCountryCode) ) {
136                  return actions.reject();
137                }
138
139                if ( shippingMethodLandRestrictions && shippingMethodLandRestrictions[selectedShippingOptionId] ) {
140                  if ( ! shippingMethodLandRestrictions[selectedShippingOptionId][shippingAddressCountryCode] ) {
141                    return actions.reject();
142                  }
143                }
144
145                return actions.resolve();
146              }
147            });
148
149            if ( button.isEligible() ) {
150              button.render(buttonContainer);
151            }
152        });
153
154        /*  */
155        
156        if ( cart ) {
157            var elem = document.querySelector(buttonContainer);
158            if ( elem ) {
159              elem.setAttribute('data-pp-amount', cart.grandTotal.amount);
160            }
161            paypal.Messages({
162              style: {
163                layout: 'text',
164                logo: {
165                  type: 'primary'
166                },
167                text: {
168                  align: 'center'
169                }
170              },
171            }).render(buttonContainer);
172        }
173        
174
175      } catch (e) {
176        isOk = 0;
177        console.log(e);
178      }
179    } else {
180      isOk = 0;
181    }
182
183    if ( typeof initPayPalIntID == 'number' ) {
184      clearInterval(initPayPalIntID);
185    }
186  },
187
188  xhrRequest = function() {
189    return new Promise(function(resolve, reject) {
190      if (XMLHttpRequest && cart) {
191        var xhr = new XMLHttpRequest(),
192          targetUrl = 'https://www.diorama-world.com/epages/92074467.sf?ViewAction=JSONViewResponse&ChangeAction=JSONCreatePayPalPPCPOrder',
193          data = {
194            'BasketGUID': cart.cartId,
195          };
196
197        xhr.open('POST', targetUrl, true);
198        xhr.setRequestHeader('Content-Type', 'application/json');
199
200        xhr.addEventListener('load', function () {
201          if (xhr.status < 200 || xhr.status >= 300) {
202            reject(new Error(xhr.responseText + xhr.statusText));
203          } else {
204            try {
205              var response = JSON.parse(xhr.responseText);
206
207              if (response.success) {
208                resolve(response.orderID);
209              } else {
210                reject(new Error(xhr.responseText + xhr.statusText));
211              }
212            } catch (e) {
213              reject(e);
214            }
215          }
216        });
217
218        xhr.send(JSON.stringify(data));
219      }
220    })
221  },
222
223  xhrRequestApprove = function(fundingSource) {
224    if (XMLHttpRequest && cart) {
225      var xhr = new XMLHttpRequest(),
226        targetUrl = 'https://www.diorama-world.com/epages/92074467.sf?ViewAction=JSONViewResponse&ChangeAction=JSONApprovePayPalPPCPOrder',
227        data = {
228          'PickupToken': 'MWFmMDUwYmM2ZjI5MjAxMTM3ZGI4ODdlMDRhNjEyN2EzYTY5Y2Q1Y2NjMGU0MDExNmVhYjczNjIyOTcwMjY2Nl8xNzkxMzE3NjA5',
229          'BasketGUID': cart.cartId,
230          'FundingSource': fundingSource,
231        };
232
233      xhr.open('POST', targetUrl, true);
234      xhr.setRequestHeader('Content-Type', 'application/json');
235
236      xhr.addEventListener('load', function () {
237        if (xhr.status < 200 || xhr.status >= 300) {
238          console.warn(new Error(xhr.responseText + xhr.statusText));
239        } else {
240          try {
241            var response = JSON.parse(xhr.responseText);
242
243            if (response.success) {
244              window.location = response.redirect;
245            } else {
246              console.warn(new Error(xhr.responseText + xhr.statusText));
247            }
248          } catch (e) {
249            console.log(e);
250          }
251        }
252      });
253
254      xhr.send(JSON.stringify(data));
255    }
256  };
257
258    var cart,
259        script;
260
261    
262    
263      script = document.createElement('script');
264      script.src = 'https://www.paypal.com/sdk/js?integration-date=2022-03-24&client-id=BAARQ2qiZh3iRxzpghPtHZdIoZbuI0K44qwCO2koGN6_Ll9OyDF7PUwI8geZk17g9VAWLVeH6wn4iGGVa8&currency=EUR&intent=capture&components=buttons,funding-eligibility,messages&enable-funding=paylater&commit=false';
265      script.setAttribute("defer", true);
266      script.setAttribute('data-partner-attribution-id', 'ePages_Strato_PPCP');
267      document.body.appendChild(script);
268
269      var ppcpUpdateCart = function (e) {
270            var container = document.querySelector(buttonContainer),
271                timeout = 500,
272                compatibleWithCurrentShipping = 1;
273
274            if ( container && typeof paypal !== 'undefined' ) {
275              timeout = 0;
276            }
277
278            /*  */
279            setTimeout(function(){
280
281              if ( ! container ) {
282                  container = document.querySelector(buttonContainer);
283              }
284              var cartHasItems = typeof cart.productLineItems === 'object' && cart.productLineItems.length > 0 ? true : false;
285
286              if ( container && cartHasItems ) {
287                /*  */
288                var cartCurrencyId = cart.grandTotal.currency;
289
290                container.setAttribute('data-pp-amount', cart.grandTotal.amount);
291
292                /*  */
293                if ( cart.shippingLineItem.shippingMethod.name ) {
294                    try {
295                      var shippingNameEncoded = btoa(encodeURIComponent(cart.shippingLineItem.shippingMethod.name));
296                      if ( inCompatibleShippingMethods[shippingNameEncoded] ) {
297                        compatibleWithCurrentShipping = 0;
298                      }
299                    } catch (ex) {
300                    }
301                }
302
303                var regionCompatible = 1;
304                
305
306                if ( ! compatibleWithCurrentShipping ) {
307                  container.style.display = 'none';
308                } else if ( typeof minMaxAllowed === 'object' && minMaxAllowed[cartCurrencyId]['MinPriceValue'] && cart.grandTotal.amount < minMaxAllowed[cartCurrencyId]['MinPriceValue'] ) {
309                  container.style.display = 'none';
310                } else if ( typeof minMaxAllowed === 'object' && minMaxAllowed[cartCurrencyId]['MaxPriceValue'] && cart.grandTotal.amount > minMaxAllowed[cartCurrencyId]['MaxPriceValue'] ) {
311                  container.style.display = 'none';
312                } else if ( ! regionCompatible ) {
313                  container.style.display = 'none';
314                } else {
315                  container.style.display = '';
316                }
317
318                if (window.paypal && e.type === 'cart:view') {
319                  initPayPal();
320                }
321              }
322
323            }, timeout);
324          };
325
326      /*  */
327      
328        window.eComEventTarget && document.head.insertAdjacentHTML('beforeend', '<style>div.product-button-container span[id*="zoid-paypal-message"]{margin-top:20px;width:100%;}</style>');
329        window.eComEventTarget && window.eComEventTarget.addEventListener('product:view', function(event) {
330          var product = event.detail.product,
331              productSelector = 'div.product-button-container',
332              container = document.querySelector(productSelector),
333              timeout = 500;
334
335          if ( container && typeof paypal !== 'undefined' ) {
336            timeout = 0;
337          }
338
339          /*  */
340          setTimeout(function(){
341              if ( ! container ) {
342                container = document.querySelector(productSelector);
343              }
344
345              if ( container ) {
346                container.setAttribute('data-pp-amount', product.price.amount);
347
348                paypal.Messages({
349                    style: {
350                      layout: 'text',
351                      logo: {
352                        type: 'primary'
353                      }
354                    },
355                }).render(productSelector);
356              }
357
358          }, timeout);
359        });
360      
361
362      window.eComEventTarget && window.eComEventTarget.addEventListener('cart:view', function(event) {
363        cart = event.detail.cart;
364
365        ppcpUpdateCart(event);
366      });
367
368      window.eComEventTarget && window.eComEventTarget.addEventListener('cart:update', function(event) {
369        cart = event.detail.cart;
370
371        ppcpUpdateCart(event);
372      });
373
374      /*  */
375      window.eComEventTarget && document.head.insertAdjacentHTML('beforeend', '<style>div#paypal-button-container span[id*="zoid-paypal-message"]{display: block;}</style>');
376    
377
378    
379    
380
381})();
382} catch (ex) {
383  console.log(ex);
384}
385
386 
387
388  
389
390
391
392
393
394
395
396
397
398

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.