File "jquery.malihu.PageScroll2id-unbind-defer.js"

Full Path: /home/ycoalition/public_html/blog/wp-admin/js/widgets/plugins/page-scroll-to-id/js/jquery.malihu.PageScroll2id-unbind-defer.js
File size: 1.45 KB
MIME-type: text/plain
Charset: utf-8

(function($){
	var _unbindUnrelatedClickEvents=function(evt,s){
			for(var i=evt.click.length-1; i>=0; i--){
				var handler=evt.click[i];
				if(handler && handler.namespace != "mPS2id"){
					if(handler.selector==='a[href*=#]'){
						handler.selector='a[href*=#]:not(._mPS2id-h), a[href*=#]:not(.__mPS2id)';
					}else if(handler.selector==='a[href*="#"]'){
						handler.selector='a[href*="#"]:not(._mPS2id-h), a[href*="#"]:not(.__mPS2id)';
					}else if(handler.selector==='a[href*=#]:not([href=#])'){
						handler.selector='a[href*=#]:not([href=#]):not(._mPS2id-h), a[href*=#]:not([href=#]):not(.__mPS2id)';
					}else if(handler.selector==='a[href*="#"]:not([href="#"])'){
						handler.selector='a[href*="#"]:not([href="#"]):not(._mPS2id-h), a[href*="#"]:not([href="#"]):not(.__mPS2id)';
					}else if(handler.selector && handler.selector.indexOf("mobmenu")!==-1){
						//special cases
						s.off("click");
					}else{
						s.off("click",handler.handler);
					}
				}
			}
		};
	$(window).on("load",function(){ //win load
		var selOpt=mPS2id_unbindScriptParams.unbindSelector,
			sel=$(selOpt);
		if(selOpt && sel.length){
			setTimeout(function(){
				var $events=sel.length ? $._data(sel[0],"events") : null,
					$docEvents=sel.length ? $._data($(document)[0],"events") : null;
				if($events) _unbindUnrelatedClickEvents($events,sel);
				if($docEvents) _unbindUnrelatedClickEvents($docEvents,sel);
			},300);
		}
	});
})(jQuery);