Sha256: 02da2f4d68ccc059c6b13f9b954ea4217fe2df7d10c12be9bfbfed3f30bc1c0e

Contents?: true

Size: 1.44 KB

Versions: 50

Compression:

Stored size: 1.44 KB

Contents

var AJAX_NS = 'ajax',
	_ajaxCur,
	_removeAjaxCursor = function() {
		if(_ajaxCur) {
			_body.removeClass(_ajaxCur);
		}
	},
	_destroyAjaxRequest = function() {
		_removeAjaxCursor();
		if(mfp.req) {
			mfp.req.abort();
		}
	};

$.magnificPopup.registerModule(AJAX_NS, {

	options: {
		settings: null,
		cursor: 'mfp-ajax-cur',
		tError: '<a href="%url%">The content</a> could not be loaded.'
	},

	proto: {
		initAjax: function() {
			mfp.types.push(AJAX_NS);
			_ajaxCur = mfp.st.ajax.cursor;

			_mfpOn(CLOSE_EVENT+'.'+AJAX_NS, _destroyAjaxRequest);
			_mfpOn('BeforeChange.' + AJAX_NS, _destroyAjaxRequest);
		},
		getAjax: function(item) {

			if(_ajaxCur)
				_body.addClass(_ajaxCur);

			mfp.updateStatus('loading');

			var opts = $.extend({
				url: item.src,
				success: function(data, textStatus, jqXHR) {
					var temp = {
						data:data,
						xhr:jqXHR
					};

					_mfpTrigger('ParseAjax', temp);

					mfp.appendContent( $(temp.data), AJAX_NS );

					item.finished = true;

					_removeAjaxCursor();

					mfp._setFocus();

					setTimeout(function() {
						mfp.wrap.addClass(READY_CLASS);
					}, 16);

					mfp.updateStatus('ready');

					_mfpTrigger('AjaxContentAdded');
				},
				error: function() {
					_removeAjaxCursor();
					item.finished = item.loadError = true;
					mfp.updateStatus('error', mfp.st.ajax.tError.replace('%url%', item.src));
				}
			}, mfp.st.ajax.settings);

			mfp.req = $.ajax(opts);

			return '';
		}
	}
});





	

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
wrgem-0.0.55 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js
wrgem-0.0.54 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js
wrgem-0.0.53 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js
wrgem-0.0.52 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js
wrgem-0.0.51 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js
wrgem-0.0.50 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js
wrgem-0.0.49 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js
wrgem-0.0.48 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js
wrgem-0.0.47 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js
wrgem-0.0.46 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js
wrgem-0.0.45 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js
wrgem-0.0.44 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js
wrgem-0.0.43 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js
wrgem-0.0.42 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js
wrgem-0.0.41 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js
wrgem-0.0.40 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js
wrgem-0.0.39 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js
wrgem-0.0.38 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js
wrgem-0.0.37 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js
wrgem-0.0.35 lib/generators/wrstart/template/vendor/assets/components/magnific-popup/src/js/ajax.js