PageSourceSearch

https://js.drexcode.com/js/scalapay/scalapay.js?version=3.5.73

js drexcode.com collected 2026-10-05 22:59:18 UTC 5,365 bytes, 179 lines download raw bytes

1
2  // This function will contain all our code
3 function scalapayLibrary(){
4  var _scalapayObj = {};
5
6		// This variable will be inaccessible to the user, only can be visible in the scope of your library.
7		var config = {
8		installmentTextProduct: 'oppure in 3 rate da soli <b>[price]</b> con [logo] <u>Vedi info ></u>',
9		installmentTextCart: 'oppure in 3 rate da soli <b>[price]</b> con [logo] <u>Vedi info ></u>',
10		installmentTextCheckout: '[logo] - 3 rate da soli [price]',
11		eventName: null,
12		eComPlatform: null,
13		storeName: null,
14		productName: null,
15		productSku: null,
16		currentPrice: null,
17		installmentCopyDescriptionPlain: null,
18		scalapayProductPrice: null,
19		isInstock: null,
20		isScalapayDisplayed: null,
21		numberOfPayments: null,
22		cartTotal: null,
23		productInCart: null,
24		checkoutTotal: null,
25		paymentMethod: null,
26		scalapayPopupContent: null
27		
28		
29		};
30
31	// Set default configurations
32    _scalapayObj.setConfigVal = function(key,val){
33		
34         config[key] = val;
35         return key;
36    };
37  
38	// Get default configurations
39    _scalapayObj.getConfigVal = function(key){
40
41         return config[key];
42    };
43	
44	// Replace product page scalapay placeholders
45    _scalapayObj.installmentTextProductReplace = function(val,placholder){
46		
47         var str =this.getConfigVal('installmentTextProduct');
48		 var res=str.replace(val,placholder);
49		 this.setConfigVal('installmentTextProduct',res); 
50    };
51	
52	
53	// Replace cart page scalapay placeholders
54    _scalapayObj.installmentTextCartReplace = function(val,placholder){
55		
56         var str =this.getConfigVal('installmentTextCart');
57		 var res=str.replace(val,placholder);
58		 this.setConfigVal('installmentTextCart',res); 
59    };
60	
61	
62	// Replace cart checkout scalapay placeholders
63    _scalapayObj.installmentTextCheckoutReplace = function(val,placholder){
64		
65         var str =this.getConfigVal('installmentTextCheckout');
66		 var res=str.replace(val,placholder);
67		 this.setConfigVal('installmentTextCheckout',res); 
68    };
69	
70
71	//Magento 1.x fix for configurable products
72	//intilize popup on product view page	
73	_scalapayObj.intPopUp = function(){
74
75		var modal = document.querySelector(".scalapayModal");
76		var closeButton = document.querySelector(".scalapay-close-button");
77
78		function closePopup() {
79			modal.classList.remove("scalapay-show-modal");
80		}
81
82		function windowOnClick(event) {
83			if (event.target === modal) {
84				closePopup();
85			}
86		}
87
88		closeButton.addEventListener("click", closePopup);
89		closeButton.addEventListener("touchstart", closePopup);
90		window.addEventListener("click", windowOnClick);
91		window.addEventListener("touchstart", windowOnClick);
92	}
93
94	//Magento 1.x fix for configurable products
95	//intilize popup on product view page	
96	_scalapayObj.showPopup = function(url) {
97		if (url != "") {
98			document.getElementById("process-scalapay").style.display = 'block';
99			var modal = document.querySelector(".scalapayModal");
100
101			if (modal.classList.contains("scalapay-show-modal")) {
102				//showing
103				modal.classList.remove("scalapay-show-modal");
104			} else {
105
106				if (config.scalapayPopupContent != null) {
107					document.getElementById('popupContents').innerHTML = config.scalapayPopupContent;
108			    	setTimeout(function(){
109				        modal.classList.add("scalapay-show-modal");
110			     		document.getElementById("process-scalapay").style.display = 'none';
111				    }, 700);
112				} else {
113					//hidden
114					var xmlhttp;
115
116					if (window.XMLHttpRequest) {
117					   // code for modern browsers
118					   xmlhttp = new XMLHttpRequest();
119					 } else {
120					   // code for old IE browsers
121					   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
122					}
123
124					xmlhttp.onreadystatechange = function() {
125					    if (this.readyState == 4 && this.status == 200 ) {
126					    	config.scalapayPopupContent = this.responseText;
127					    	document.getElementById('popupContents').innerHTML = config.scalapayPopupContent;
128					    	setTimeout(function(){
129						        modal.classList.add("scalapay-show-modal");
130					     		document.getElementById("process-scalapay").style.display = 'none';
131						    }, 700);
132					    } else if ([404, 500 , 503, 504 ].indexOf(this.status) > -1 ) {
133					    	document.getElementById("process-scalapay").style.display = 'none';
134					    	return;
135					    }
136
137					};
138
139					xmlhttp.onerror = function(e) {
140						document.getElementById("process-scalapay").style.display = 'none';
141				        return;
142				    };
143				    
144					try {
145						xmlhttp.open("GET", url, true);
146						xmlhttp.send();
147					} catch (e) {
148						return;
149					}
150					
151				}
152				
153			}
154		}
155		
156	}
157	
158	//intilize scalapay product text
159	_scalapayObj.intScalapayProductText = function(elemSelector,divToShow){
160		var referenceNode = document.querySelector(elemSelector);
161		referenceNode.parentNode.appendChild(document.getElementById(divToShow));
162	}
163	
164	//intilize scalapay cart text before
165	_scalapayObj.intScalapayCartText = function(source, destination){
166		
167		var sourceNode = document.querySelector(source);
168		var destinationNode = document.getElementById(destination);
169		sourceNode.parentNode.insertBefore(destinationNode, sourceNode);
170	}
171	
172  return _scalapayObj;
173 }
174
175var windowScalapay = null;
176// We need that our library is globally accesible, then we save in the window
177if(typeof(windowScalapay) === 'undefined' || windowScalapay==null){
178	windowScalapay = scalapayLibrary();
179}

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.