PageSourceSearch

https://www.ajedrezastur.es/wp-content/plugins/wpi-designer-button…/inc/front_script.js?t=878&ver=3.0.2

js ajedrezastur.es collected 2026-09-24 10:04:15 UTC 8,576 bytes, 240 lines download raw bytes

1;(function($){
2	$(document).ready(function(){
3							   
4		$.fn.smartButtons=function(args){
5			function SmartButtons(args){
6				this.$el=args.el;
7				this.init();
8			}
9			SmartButtons.prototype.init=function(){
10				var self=this;
11				this.MenuLinks=this.$el.find(".wpi_menu_links");	
12				this.Button=this.$el.find(".wpi_designer_button");
13				this.align();
14				$(window).resize(function(){
15					self.align();			  
16				});
17				this.Button.click(function(event){
18					event.preventDefault();
19					if(self.MenuLinks.hasClass("wpi_open")){
20						self.MenuLinks.removeClass("wpi_open").addClass("wpi_close");	
21					}else{
22						self.MenuLinks.removeClass("wpi_close").addClass("wpi_open");	
23					}
24				});
25			}
26			SmartButtons.prototype.align=function(){
27				var smb_w=this.$el.width();
28				var ml_w=this.MenuLinks.width();
29				var left=0;
30				var right="auto";
31				var align=this.$el.css("text-align");
32				if(align=="right"){
33					left="auto";
34					right=0;
35				}else if(align=="center"){
36					left=(smb_w/2)-(ml_w/2);					
37				}							
38				this.MenuLinks.css({"left":left, "right":right});
39			}
40			return this.each(function(){
41				var defaults={el:$(this)};
42				var args=$.extend(defaults,args);     
43				new SmartButtons(args);
44			});
45		}
46		$.fn.wpiPopup=function(args){
47			function WPiPopup(options){      
48			  this.init(options);
49			};
50			WPiPopup.prototype.init=function(options){
51			  var self=this;      
52			  this.el=options['element'];
53			  this.popup_ID=this.el.attr("href");
54			  this.popup_base=$(this.popup_ID);
55			  this.popup_type="";
56			  this.backup=$(".wpi_popup_backup");  
57			  this.wrapper=$(".wpi_popup_wrapper");  
58			  this.overlay=$(".wpi_popup_overlay");
59			  this.content=$(".wpi_popup_content");
60			  this.close=$(".wpi_popup_close"); 
61			  this.backup.append(this.popup_base);
62			  
63			  this.CF7data={};
64			  this.processCF7data(); //with if condition for (popup with cf7 data exists)
65			  if(this.popup_base.data("popup_button_type")){
66				this.popup_type="popup_button_type_"+this.popup_base.data("popup_button_type");							
67			  }
68			  this.el.on("click",function(event){
69				self.scrollTop=$("body").scrollTop();			  	
70				event.preventDefault();
71				self.content.append(self.popup_base);
72				self.wrapper.addClass("active"); 
73				self.wrapper.addClass(self.popup_type);	
74				self.overlay.addClass("active"); 
75				$('html').addClass("wpi_popup_active"); 
76				self.setPopup();				
77			  }); 
78			  this.close.on("click",function(){        
79				self.closePopup();
80			  }); 
81			  $(document).keyup(function(e) {
82					if (e.keyCode == 27) { // escape key
83						self.closePopup();
84					}
85				});
86			  this.overlay.on("mousedown",function(e){        
87				$(this).addClass("click");         
88			  });
89			  this.overlay.on("mouseup",function(e){ 
90				$(this).removeClass("click");
91			  }); 
92			  this.overlay.on("click",function(e){         
93				self.closePopup();
94			  }); 
95			  this.content.on("mouseup",function(e){
96				e.stopPropagation();       
97			  }); 
98			  $(window).resize(function(){        
99				self.setPopup();
100			  }).trigger("resize");
101			};
102			WPiPopup.prototype.closePopup=function(){             
103			   this.wrapper.removeClass("active"); 
104			   this.wrapper.removeClass(this.popup_type);	
105			   this.overlay.removeClass("active");
106			   $('html').removeClass("wpi_popup_active"); 			  		   
107			   this.backup.append(this.popup_base);
108			    $("body").scrollTop(this.scrollTop); 
109			};
110			WPiPopup.prototype.setPopup=function(){			 
111			  this.w_width=$(window).width(); 
112			  this.w_height=$(window).height(); 
113			  this.c_width=this.wrapper.innerWidth();
114			  this.c_height=this.wrapper.innerHeight();       
115			  if(this.w_width< 600+60){
116				this.wrapper.css({"width":this.w_width-60} );
117				this.wrapper.css({"margin-left":"30px"} );
118				this.wrapper.css({"left":"0px"} );
119			  }else{
120				this.wrapper.css({"width":"600px"} );
121				this.wrapper.css({"margin-left":"50%"} );
122				this.wrapper.css({"left":-(this.c_width/2)} );
123			  }   
124			  if(this.w_height< 500 || this.c_height+100>this.w_height){        
125				this.wrapper.css({"margin-top":"20px", "margin-bottom":"20px"} );
126			  }else{
127				this.wrapper.css({"margin-top":"50px", "margin-bottom":"50px"} );
128			  }      
129			}; 
130			WPiPopup.prototype.processCF7data=function(){
131				var data={};
132				if(!$(this.popup_ID).find(".wpi_popup_base_cf7_data").length) return;
133				
134				this.CF7data.holder=$(this.popup_ID).find(".wpi_popup_base_cf7_data");				
135				this.CF7data.custom_fields=[]; 
136				this.CF7data.custom_fields_data=[];
137				
138				if(this.CF7data.holder.find(".wpi_popup_custom_field_1").length){
139					this.CF7data.custom_fields.push(this.CF7data.holder.find(".wpi_popup_custom_field_1").text());
140					this.CF7data.custom_fields_data.push(this.CF7data.holder.find(".wpi_popup_custom_field_1_data").text());
141				}
142				if(this.CF7data.holder.find(".wpi_popup_custom_field_2").length){
143					this.CF7data.custom_fields.push(this.CF7data.holder.find(".wpi_popup_custom_field_2").text());
144					this.CF7data.custom_fields_data.push(this.CF7data.holder.find(".wpi_popup_custom_field_2_data").text());
145				}
146				if(this.CF7data.holder.find(".wpi_popup_custom_field_3").length){
147					this.CF7data.custom_fields.push(this.CF7data.holder.find(".wpi_popup_custom_field_3").text());
148					this.CF7data.custom_fields_data.push(this.CF7data.holder.find(".wpi_popup_custom_field_3_data").text());
149				}
150				if($(this.popup_ID).find(".wpcf7").length){
151					var self=this;
152					this.CF7data.form=$(this.popup_ID).find(".wpcf7");						
153					$.each( this.CF7data.custom_fields, function( index, value ){
154						if(self.CF7data.form.find('input[name="'+value+'"]').length){
155							var field=self.CF7data.form.find('input[name="'+value+'"]');
156							var val=self.CF7data.custom_fields_data[index];
157							field.val(val);							
158						}						
159					});
160				}
161						
162				
163			};
164			 if($(".wpi_popup_button").length){         
165				var popup_wrapper=$('<div class="wpi_popup_wrapper"></div>');
166				var popup_close=$('<div class="wpi_popup_close"><i class="fa fa-times"></i></div>');
167				var popup_content=$('<div class="wpi_popup_content"></div>');
168				var popup_overlay=$('<div class="wpi_popup_overlay"></div>');
169				var popup_backup=$('<div class="wpi_popup_backup"></div>');
170				popup_wrapper.append(popup_close);
171				popup_wrapper.append(popup_content);        
172				$("body").append(popup_overlay).append(popup_wrapper).append(popup_backup);            
173			 }
174			 return this.each(function(){      
175			   var defaults={element:$(this), wrapper:"wpi_popup_wrapper"};
176			   var options=$.extend(defaults, args);
177			   new WPiPopup(options);
178			 });
179		};
180		  
181		
182		if ($(".wpi_popup_button").length) {
183			$(".wpi_popup_button").wpiPopup();		
184		}
185		if ($(".wpi_slide_heading").length) {
186			var headingTicker=$(".wpi_slide_heading").wpiTicker({animate:"play"});			
187		}
188		if ($(".wpi_share_buttons").length) {
189			$(".wpi_share_buttons").each(function(){
190				$(this).find("a").each(function(){
191					$(this).click(function(){
192						var href=$(this).attr("href");	
193						window.open(href, "_blank", "toolbar=yes, scrollbars=yes, resizable=yes, top=200, left=200, width=400, height=400");
194					});
195				});				
196			});		 
197		}
198		if ($(".wpi_smart_buttons").length) {
199			$(".wpi_smart_buttons").smartButtons({});
200		}
201		if($(".wpi_button_menu_container").length){
202			$(".wpi_button_menu_container").each(function(){
203				var el=$(this);
204				var a={
205					init:function(){	
206						var self=this;
207						if(el.find(".menu").length){	
208							this.menu=el.find(".menu");												
209						}						
210						this.button=el.find(".wpi_button_menu");											
211						this.button.on("click",function(e){							
212							e.preventDefault();
213							if(el.hasClass("wpi_button_menu_container_open")){
214								el.removeClass("wpi_button_menu_container_open");
215								self.setMenu(0);							
216							}else{
217								el.addClass("wpi_button_menu_container_open");	
218								self.setMenu(1);						
219							}							
220												
221						});	
222										
223					},
224					setMenu:function(a){
225						if(this.menu){
226							if(a==1){
227								this.menu.css("width", this.menu.outerWidth()+5);	
228							}else{
229								this.menu.css("width", "auto");	
230							}														
231							this.menu.css("margin-bottom",this.button.outerHeight()+10);
232						}
233					},
234				};
235				a.init();				
236			});			
237		}	
238		
239	});
240})(jQuery);

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.