PageSourceSearch

https://atmlive.pl/wp-content/themes/sensetheme/plugins/login-with-ajax/login-with-ajax.js?ver=4.5.1

js atmlive.pl collected 2026-10-04 00:59:05 UTC 8,920 bytes, 272 lines download raw bytes

1/* Customize from here downwards */
2jQuery(document).ready( function($) {
3	//TODO some backwards compatability here -
4	if( $('#LoginWithAjax').length > 0 ){
5		$('#LoginWithAjax').addClass('lwa');
6		$('#LoginWithAjax_Status').addClass('lwa-status');
7		$('#LoginWithAjax_Register').addClass('lwa-register');
8		$('#LoginWithAjax_Remember').addClass('lwa-remember');
9		$('#LoginWithAjax_Links_Remember').addClass('lwa-links-remember');
10		$('#LoginWithAjax_Links_Remember_Cancel').addClass('lwa-links-remember-cancel');
11		$('#LoginWithAjax_Form').addClass('lwa-form');
12	}
13	/*
14	 * links
15	 * add action input htmls
16	 */
17	//Remember and register form AJAX
18 	$('form.bk-lwa-form, form.bk-lwa-remember, div.lwa-register form').submit(function(event){
19		//Stop event, add loading pic...
20 		event.preventDefault();
21 		var form = $(this);
22 		var statusElement = form.find('.lwa-status');
23 		if( statusElement.length == 0 ){
24 			statusElement = $('<span class="lwa-status"></span>');
25 			form.prepend(statusElement);
26 		}
27 		var ajaxFlag = form.find('.lwa-ajax');
28 		if( ajaxFlag.length == 0 ){
29 			ajaxFlag = $('<input class="lwa-ajax" name="lwa" type="hidden" value="1" />');
30 			form.prepend(ajaxFlag);
31 		}
32		$('<div class="lwa-loading"></div>').prependTo(form);
33		//Make Ajax Call
34		$.ajax({
35			type : 'POST',
36			url : form.attr('action'),
37			data : form.serialize(),
38			success : function(data){
39				lwaAjax( data, statusElement );
40				$(document).trigger('lwa_' + data.action, [data, form]);
41			},
42			error : function(){ lwaAjax({}, statusElement); },
43			dataType : 'jsonp'
44		});
45		//trigger event
46	});
47 	
48 	//Catch login actions
49 	$(document).on('lwa_login', function(event, data, form){
50		if(data.result === true){
51			//Login Successful - Extra stuff to do
52			if( data.widget != null ){
53				$.get( data.widget, function(widget_result) {
54					var newWidget = $(widget_result); 
55					form.parent('.lwa').replaceWith(newWidget);
56					var lwaSub = newWidget.find('.').show();
57					var lwaOrg = newWidget.parent().find('.lwa-title');
58					lwaOrg.replaceWith(lwaSub);
59				});
60			}else{
61				if(data.redirect == null){
62					window.location.reload();
63				}else{
64					window.location = data.redirect;
65				}
66			}
67		}
68 	});
69 	
70	//Registration overlay
71 	$('.lwa-modal').each( function(i,e){
72 		var modal = $(e);
73 		modal.parents('.lwa').data('modal', modal);
74 		$('body').append($('<div class="lwa"></div>').append(modal));
75 	});
76	$(document).on('click', ".lwa-links-modal",  function(e){
77		e.preventDefault();
78		target = $(this).parents('.lwa').data('modal');
79        console.log($(this).parents('.lwa'));
80		target.reveal({
81			 modalbgclass: 'lwa-modal-bg bk-modal-bg',
82		     dismissmodalclass: 'lwa-modal-close'    //the class of a button or element that will close an open modal
83		});
84	});	
85	
86	//Handle a AJAX call for Login, RememberMe or Registration
87	function lwaAjax( data, statusElement ){
88		$('.lwa-loading').remove();
89		statusElement = $(statusElement);
90        console.log(data);
91		if(data.result === true){
92			//Login Successful
93			statusElement.attr('class','lwa-status lwa-status-confirm').html(data.message); //modify status content
94		}else if( data.result === false ){
95			//Login Failed
96			statusElement.attr('class','lwa-status lwa-status-invalid').html(data.error); //modify status content
97			//We assume a link in the status message is for a forgotten password
98			statusElement.find('a').click(function(event){
99				event.preventDefault();
100				$(this).parents('.lwa').find('form.lwa-remember').show('slow');
101			});
102		}else{	
103			//If there already is an error element, replace text contents, otherwise create a new one and insert it
104			statusElement.attr('class','lwa-status lwa-status-invalid').html('An error has occured. Please try again.'); //modify status content
105		}
106	}
107
108});
109
110/* http://zurb.com/playground/reveal-modal-plugin */
111/*
112 * jQuery Reveal Plugin 1.0
113 * www.ZURB.com
114 * Copyright 2010, ZURB
115 * Free to use under the MIT license.
116 * http://www.opensource.org/licenses/mit-license.php
117*/
118
119(function($) {
120
121/*---------------------------
122 Defaults for Reveal
123----------------------------*/
124	 
125/*---------------------------
126 Listener for data-reveal-id attributes
127----------------------------*/
128
129	$('a[data-reveal-id]').on('click', function(e) {
130		e.preventDefault();
131		var modalLocation = $(this).attr('data-reveal-id');
132		$('#'+modalLocation).reveal($(this).data());
133	});
134
135/*---------------------------
136 Extend and Execute
137----------------------------*/
138
139    $.fn.reveal = function(options) {
140        
141        
142        var defaults = {  
143	    	animation: 'fadeAndPop', //fade, fadeAndPop, none
144		    animationspeed: 300, //how fast animtions are
145		    closeonbackgroundclick: true, //if you click background will modal close?
146		    dismissmodalclass: 'close-reveal-modal', //the class of a button or element that will close an open modal
147		    modalbgclass : 'reveal-modal-bg'
148    	}; 
149    	
150        //Extend dem' options
151        var options = $.extend({}, defaults, options); 
152	
153        return this.each(function() {
154        
155/*---------------------------
156 Global Variables
157----------------------------*/
158        	var modal = $(this),
159        		topMeasure  = parseInt(modal.css('top')),
160				topOffset = modal.height() + topMeasure,
161          		locked = false,
162				modalBG = $('.'+options.modalbgclass);
163
164/*---------------------------
165 Create Modal BG
166----------------------------*/
167			if(modalBG.length == 0) {
168				modalBG = $('<div class="'+options.modalbgclass+'" />').insertAfter(modal);
169			}
170			if( modal.find('.'+options.dismissmodalclass).length == 0 ){
171				modal.append('<a class="'+options.dismissmodalclass+'">&#215;</a>');
172			}
173     
174/*---------------------------
175 Open & Close Animations
176----------------------------*/
177			//Entrance Animations
178			modal.bind('reveal:open', function () {
179			  modalBG.unbind('click.modalEvent');
180				$('.' + options.dismissmodalclass).unbind('click.modalEvent');
181				if(!locked) {
182					lockModal();
183					if(options.animation == "fadeAndPop") {
184						modal.css({'top': $(document).scrollTop()-topOffset, 'opacity' : 0, 'visibility' : 'visible', 'display':'block'});
185						modalBG.fadeIn(options.animationspeed/2);
186						modal.delay(options.animationspeed/2).animate({
187							"top": $(document).scrollTop()+topMeasure + 'px',
188							"opacity" : 1
189						}, options.animationspeed,unlockModal());					
190					}
191					if(options.animation == "fade") {
192						modal.css({'opacity' : 0, 'visibility' : 'visible', 'top': $(document).scrollTop()+topMeasure, 'display':'block'});
193						modalBG.fadeIn(options.animationspeed/2);
194						modal.delay(options.animationspeed/2).animate({
195							"opacity" : 1
196						}, options.animationspeed,unlockModal());					
197					} 
198					if(options.animation == "none") {
199						modal.css({'visibility' : 'visible', 'top':$(document).scrollTop()+topMeasure, 'display':'block'});
200						modalBG.css({"display":"block"});	
201						unlockModal()				
202					}
203				}
204				modal.unbind('reveal:open');
205			}); 	
206
207			//Closing Animation
208			modal.bind('reveal:close', function () {
209			  if(!locked) {
210					lockModal();
211					if(options.animation == "fadeAndPop") {
212						modalBG.delay(options.animationspeed).fadeOut(options.animationspeed);
213						modal.animate({
214							"top":  $(document).scrollTop()-topOffset + 'px',
215							"opacity" : 0
216						}, options.animationspeed/2, function() {
217							modal.css({'top':topMeasure, 'opacity' : 1, 'visibility' : 'hidden'});
218							unlockModal();
219						});					
220					}  	
221					if(options.animation == "fade") {
222						modalBG.delay(options.animationspeed).fadeOut(options.animationspeed);
223						modal.animate({
224							"opacity" : 0
225						}, options.animationspeed, function() {
226							modal.css({'opacity' : 1, 'visibility' : 'hidden', 'top' : topMeasure});
227							unlockModal();
228						});					
229					}  	
230					if(options.animation == "none") {
231						modal.css({'visibility' : 'hidden', 'top' : topMeasure});
232						modalBG.css({'display' : 'none'});	
233					}		
234				}
235				modal.unbind('reveal:close');
236			});     
237   	
238/*---------------------------
239 Open and add Closing Listeners
240----------------------------*/
241        	//Open Modal Immediately
242    	modal.trigger('reveal:open')
243			
244			//Close Modal Listeners
245			var closeButton = $('.' + options.dismissmodalclass).bind('click.modalEvent', function () {
246			  modal.trigger('reveal:close')
247			});
248			
249			if(options.closeonbackgroundclick) {
250				modalBG.css({"cursor":"pointer"})
251				modalBG.bind('click.modalEvent', function () {
252				  modal.trigger('reveal:close')
253				});
254			}
255			$('body').keyup(function(e) {
256        		if(e.which===27){ modal.trigger('reveal:close'); } // 27 is the keycode for the Escape key
257			});
258			
259			
260/*---------------------------
261 Animations Locks
262----------------------------*/
263			function unlockModal() { 
264				locked = false;
265			}
266			function lockModal() {
267				locked = true;
268			}	
269			
270        });//each call
271    }//orbit plugin call
272})(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.