annotate Blast output page example trimmed_files/jquery_009.js @ 16:db7e4ee3be03

fix validation, reindent
author Jan Kanis <jan.code@jankanis.nl>
date Tue, 13 May 2014 12:22:35 +0200
parents ffe82516a83c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1 document.times=0;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
2 jQuery.widget("ui.ncbipopper",{destTextCallbackCalledCount:0,options:{openMethod:"",openEvent:"mouseover",openAnimation:"slideDown",openAnimationTime:290,closeMethod:"",closeEvent:"mouseout",closeAnimation:"slideUp",closeAnimationTime:150,isEscapeKeyClose:true,isSourceElementCloseClick:false,isTriggerElementCloseClick:true,isTargetElementCloseClick:false,isDestElementCloseClick:false,isDocumentCloseClick:true,addCloseButton:false,adjustFit:"autoAdjust",delayTimeout:300,sourcePosition:"",destPosition:"top left",
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
3 sourceSelector:"",destSelector:"",targetPosition:"",triggerPosition:"bottom right",sourceText:null,destText:null,multipleHandlesSelector:"",openAtTarget:false,hasArrow:false,arrowDirection:"left",groupName:null,width:null,height:null,cssClass:null,excludeBasicCssStyles:false,wrapElement:false,loadingText:"loading...",showLoadingMessage:true,isDestTextCacheable:true,resizable:false,openAtMousePosition:false},_create:function(){this._setUpDestElem();this._addEventHandlers();this._addEscapeListener();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
4 this._addDocumentClickListener();this._addResizeListener();this._addCloseButton();this._addSharingDetails();this._addPopperHover();this.addTriggerAria()},updateTriggers:function(){this._addEventHandlers();this._addDocumentClickListener();this.addTriggerAria()},destroy:function(){jQuery.Widget.prototype.destroy.apply(this,arguments);var a=this.isPopperShared();this._destroyDestAria();this._destroyTriggerAria();this._removeSharingDetails();this._destroyCloseButton(a);this._destroyResizeListener();this._destroyDocumentClickListener();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
5 this._destroyEscapeListener();this._removeEventHandlers();this._destroyDestElem(a)},getDestElement:function(a){var b=this.destElem;if(!this.origDestElem)this.origDestElem=b;if(b){if(a&&this._isWaitingToBeAddedToDom){a=jQuery("div.grid");a=a.length===1?a:jQuery(document.body);b.appendTo(a);this._isWaitingToBeAddedToDom=true;this._getActualText(b)}}else{b=this.options.destSelector||this.options.sourceSelector||this.element.prop("hash");a=this.options.destText||this.options.sourceText;if(b){b=jQuery(b);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
6 if(b.length===0)b=this._createTextHolder()}else if(a)b=this._createTextHolder();else throw"The popper can not find the popper element or text to display";if(this.options.wrapElement){if(!b.parent().hasClass("ui-ncbipopper-wrapper")){b.wrap('<div style="display:none"></div>');b.show()}if(!this.origDestElem)this.origDestElem=b;b=b.parent()}this.destElem=b;this._addDestAria()}if(!this.origDestElem)this.origDestElem=this.destElem;return b},_createTextHolder:function(){var a=jQuery('<div><div class="ui-ncbipopper-content"></div></div>');
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
7 this._isWaitingToBeAddedToDom=true;return a},_getActualText:function(a){if(!this.isFunctionResultCached){var b=this.options.destText||this.options.sourceText,c=this._getFunction(b);if(typeof c==="function")b=this._getText(c);a.css("display","none").attr("generated","true").find(".ui-ncbipopper-content").html(b)}},_getFunction:function(a){var b=null;if(jQuery.ui.jig&&jQuery.ui.jig._getFncFromStr)b=jQuery.ui.jig._getFncFromStr(a);else if(typeof a==="function")b=a;return b},getDestTextCallbackCalledCount:function(){return this.destTextCallbackCalledCount},
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
8 _getText:function(a){if(!(this.options.isDestTextCacheable&&this.getTextCalled||this.callbackInProgress)){this.getTextCalled=true;a||(a=this._getFunction(this.options.destText||this.options.sourceText));var b=this;this.callbackInProgress=true;a=a.call(this.element[0],function(c){b._setHTML(c);b.destTextCallbackCalledCount++;b.callbackInProgress=false})||this.options.loadingText;if(a!==this.options.loadingText)this.isFunctionResultCached=this.options.isDestTextCacheable;return a}},reloadContent:function(){var a=
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
9 this._getText(),b=this.getDestElement().find(".ui-ncbipopper-content");b&&b.html(a);return this.element},_setHTML:function(a){var b=this.getDestElement().find(".ui-ncbipopper-content");if(b){b.html(a);this.isFunctionResultCached=this.options.isDestTextCacheable;!this.options.showLoadingMessage&&!this.isPopperDisplayed&&this._openAnimation()}},_setUpDestElem:function(){var a=this.getDestElement().addClass("ui-ncbipopper-wrapper");this.options.excludeBasicCssStyles||a.addClass("ui-ncbipopper-basic");
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
10 this.options.resizable&&a.resizable();var b=this.options.cssClass;b&&a.addClass(b);this.options.width!==null&&a.width(this.options.width);this.options.height!==null&&a.height(this.options.height);this._resetElementPosition(a);a.removeClass("offscreen_noflow").hide();a.data("isOpen",false)},_setArrowDirection:function(){if(this.options.hasArrow){var a=this.options.arrowDirection;this._arrow&&this._arrow.removeClass("ui-ncbipopper-arrow-top ui-ncbipopper-arrow-bottom ui-ncbipopper-arrow-left ui-ncbipopper-arrow-right").addClass("ui-ncbipopper-arrow-"+
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
11 a)}},_setUpArrow:function(a,b,c){if(this.options.hasArrow){var d=this.options.arrowDirection;if(this._arrow)this._arrow.removeClass("ui-ncbipopper-arrow-top ui-ncbipopper-arrow-bottom ui-ncbipopper-arrow-left ui-ncbipopper-arrow-right").addClass("ui-ncbipopper-arrow-"+d);else this._arrow=jQuery('<div class="ui-ncbipopper-arrow-image ui-ncbipopper-arrow-'+d+'">&nbsp;</div>').appendTo(document.body);a=this._getPositionSettings(a,"arrow",c);this._arrow.show().position({my:a.dest,of:this._activeTrigger||
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
12 a.triggerElement||this.element,at:a.trigger,offset:a.offset,collision:"none"});if(b||this._arrowOverlapsPopper())this._arrow.hide()}},_destroyDestElem:function(a){a||this.getDestElement().removeClass("ui-ncbipopper-wrapper ui-ncbipopper-basic ui-ncbipopper-wrapper-relative-parent").attr("style","").show();this.options.wrapElement&&this.origDestElem.unwrap();this.destElem=null},_addEventHandlers:function(){var a=this,b=this.element,c=this.options.multipleHandlesSelector;if(c&&c.length>0)b=b.add(c);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
13 var d=this.options.openMethod||this.options.openEvent,e=this.options.closeMethod||this.options.closeEvent;if(d===e&&e==="click"){this._openFunction=function(f){a._toggle(f,f.currentTarget);f.preventDefault()};b.on("click",this._openFunction)}else{c={timeout:this.options.delayTimeout};if(d==="mouseover")c.over=function(f){a._isOverTrigger=true;a.open(f,this)};else{c.over=function(){a._isOverTrigger=true};this._openFunction=function(f){if(d==="click")if(a.option.isTriggerElementCloseClick){a._toggle(f,
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
14 this);f.preventDefault()}else{a.isOpen(this)||f.preventDefault();a.open(f,this)}else a.open(f,this)};b.on(d,this._openFunction)}if(e==="mouseout")c.out=function(){a._isOverTrigger=false;a.isOpen(this)&&!a._isOverPopper&&a.close()};else{c.out=function(){};this._closeFunction=function(f){a.close();e==="click"&&f.preventDefault()};b.on(e,this._closeFunction)}if(d==="mouseover"||e==="mouseout")b.hoverIntent(c);if(this.options.isTriggerElementCloseClick&&e!=="click"&&d!=="click"){this._closeFunction2=
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
15 function(f){a.isOpen(b)&&a.close();f.preventDefault()};b.on("click",this._closeFunction2)}}if(this.options.isDestElementCloseClick){this._closeFunctionPopper=function(f){a.isOpen(b)&&a.close();f.preventDefault()};this.getDestElement().on("click",this._closeFunctionPopper)}},_removeEventHandlers:function(){var a=this.element,b=this.getDestElement(),c=this.options.multipleHandlesSelector;if(c&&c.length>0)a=a.add(c);a.off("mouseover mouseout");if(this._openFunction){a.off(this.options.openMethod||this.options.openEvent,
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
16 this._openFunction);this._openFunction=null}if(this._closeFunction){a.off(this.options.closeMethod||this.options.closeEvent,this._closeFunction);this._closeFunction=null}if(this._closeFunction2){a.off("click",this._closeFunction2);this._closeFunction2=null}if(this._closeFunctionPopper){b.off("click",this._closeFunctionPopper);this._closeFunctionPopper=null}},_toggle:function(a,b){this.isOpen(b)?this.close():this.open(a,b);a&&a.preventDefault&&a.preventDefault();return this.element},_arrowOverlapsPopper:function(){var a=
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
17 this.getDestElement(),b=Math.floor(a.position().top),c=Math.floor(a.position().left),d=Math.floor(c+a.outerWidth());a=Math.floor(b+a.height());var e=this._arrow,f=Math.floor(e.position().top),g=Math.floor(e.position().left);Math.floor(g+e.width());var h=Math.floor(f+e.height());c=g>c&&g<d||g+e.css("width")>c&&g+e.css("width")<d;b=f>b&&f<a||f+e.css("height")>b&&h+e.css("height")<a;return c&&b?true:false},_openAnimation:function(a){function b(){var k=d.outerHeight(),l=jQuery(window).height();k>l&&d.css({"max-height":l-
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
18 45+"px",overflow:"auto"});jQuery(window).trigger("resize")}var c=this,d=this.getDestElement().data("isOpening",this.element).stop(true,true),e=this._arrow,f=this.options.openAnimation,g=function(){c._trigger("opencomplete");c.getDestElement().data("isOpening",null);jQuery.browser.msie&&parseInt(jQuery.browser.version,10)<=7&&c._positionPopper(a,false,true);b()},h=function(k){e.fadeTo(0,0);window.setTimeout(function(){e.stop(true,true).show();c._arrowOverlapsPopper()||e.css("opacity",1)},k)};if(f===
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
19 "none"||this.isOpen()){d.show();e&&h(0);g()}else{var j=this.options.openAnimationTime;if(e){var i=0;if(e==="top")i=0;else if(e==="bottom")i=j;else{i=parseInt(e.css("top"),10)-parseInt(d.css("top"),10);var m=d.height()||i;i=i/m*j;if(i>j)i=j}h(i)}d[f](j,g)}},open:function(a,b){if(!b)b=this.element;if(this.options.openAtTarget){if(this._activeTrigger!==b){this.getDestElement().hide();this.getDestElement().data("isOpen",false)}this._activeTrigger=b}else this._activeTrigger=this.element;b=this.getDestElement();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
20 var c=b.data("isOpening");if(c&&c[0]!==this.element[0])(b.data("closeFnc")||function(){})(true);this._handleSharedPoppersOpen();this._handleGroupsOpen();b.data("isOpening",this.element);this._setUpArrow(a,true,true);jQuery.browser.msie&&this._positionPopper(a,true,true);this._setParentsZIndex(11);this._positionPopper(a,true,true);this._trigger("open");this.options.destText&&!this.options.showLoadingMessage&&!this.isFunctionResultCached||this._openAnimation(a);this._setAriaState(true);this.getDestElement().data("isOpen",
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
21 true);return this.element},_handleGroupsOpen:function(){var a=this.options.groupName;if(a){this.closeGroup(a);jQuery.ui.ncbipopper.openGroups[a]=this.element}},_closeAnimation:function(a){var b=this,c=function(){b._setParentsZIndex(1);b._trigger("closecomplete")},d=this.getDestElement().data("isOpening");if(d&&this.element[0]!=d[0])c();else{d=this.getDestElement().stop(true,true);var e=this.options.closeAnimation;if(e==="none"||a){d.hide();this._resetElementPosition(d);c()}else{var f=d;d[e](this.options.closeAnimationTime,
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
22 function(){b._resetElementPosition(f);c()})}}a=this.getDestElement().data("popperTriggers");for(e=0;e<a.length;e++){d=jQuery.ui.jig.getElementWidgets(a[e],"ncbipopper")[0];var g=d._arrow;if(g){g.stop(true,true).hide();d._resetElementPosition(g)}}},close:function(a){if(this.isOpen(this._activeTrigger)){this._handleGroupsClose(a);this._trigger("close");this._activeTrigger=null;this._closeAnimation(a);this._setAriaState(false);this.getDestElement().data("isOpen",false);return this.element}},closeGroup:function(a){if(a=
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
23 a||this.options.groupName)(a=jQuery.ui.ncbipopper.openGroups[a])&&jQuery.ui.jig.getElementWidgets(a,"ncbipopper")[0].close(true);return this.element},_handleGroupsClose:function(a){var b=this.options.groupName;if(!a&&b)jQuery.ui.ncbipopper.openGroups[b]=null},_determineAutoPosition:function(a){var b=jQuery(this._activeTrigger||this.element),c=b.offset(),d=this.getDestElement(true),e=jQuery(window);if(a){a=e.width();d=d.outerWidth();b=b.width();e=e.scrollLeft();if(d+b+c.left<a+e){c="right";b=e="left"}else{c=
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
24 "left";b=e="right"}}else{a=e.height();d=d.outerHeight();b=b.height();e=e.scrollTop();if(d+b+c.top<a+e){c="bottom";b=e="top"}else{c="top";b=e="bottom"}}return{posT:c,posP:e,arrow:b}},_getPositionSettings:function(a,b,c){var d=this.options.sourcePosition||this.options.destPosition,e=this.options.targetPosition||this.options.triggerPosition;d=d.split(/\s/);e=e.split(/\s/);if(d[0]==="middle")d[0]="center";if(d[1]==="middle")d[1]="center";if(e[0]==="middle")e[0]="center";if(e[1]==="middle")e[1]="center";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
25 this.options.sourcePosition=null;this.options.destPosition=d.join(" ");this.options.targetPosition=null;this.options.triggerPosition=e.join(" ");var f;if(d[0]==="auto"){f=this._determineAutoPosition(false);d[0]=f.posP;e[0]=f.posT;this.options.arrowDirection=f.arrow;this._setArrowDirection(f.arrow)}if(d[1]==="auto"){f=this._determineAutoPosition(true);d[1]=f.posP;e[1]=f.posT;this.options.arrowDirection=f.arrow;this._setArrowDirection(f.arrow)}f=d[1]+" "+d[0];var g=e[1]+" "+e[0],h="0px 0px";if(this.options.hasArrow)h=
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
26 b==="popper"?this._getPopperOffsets(d[0],d[1]):this._getArrowOffsets(d[0],d[1]);if(this.options.openAtMousePosition&&c){h.xOffset=a.pageX-jQuery(a.target).offset().left+(h.xOffset-0)+1;h.yOffset=a.pageY-jQuery(a.target).offset().top+(h.yOffset-0)}if(this._isArea===undefined)this._isArea=((this._activeTrigger?this._activeTrigger[0]:false)||this.element[0]).nodeName.toUpperCase()==="AREA";if(this._isArea){a=this._areaElementAdjustment(h,e);triggerElement=a.positionElement;h=a.offset;g="left top"}else triggerElement=
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
27 null;if(this.options.openAtMousePosition&&c)g="left top";return{dest:f,trigger:g,offset:typeof h=="string"?h:h.xOffset+"px "+h.yOffset+"px",triggerElement:triggerElement}},_getArrowOffsets:function(a,b){var c="0",d="0";switch(this.options.arrowDirection){case "left":case "right":switch(a){case "top":d="-13";break;case "center":d="0";break;case "bottom":d="13";break;default:d="0";break}break;case "top":case "bottom":switch(b){case "left":c="-13";break;case "center":c="0";break;case "right":c="13";
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
28 break;default:c="0";break}break;default:throw"Valid arrow directions are top, bottom, left, right";}return{xOffset:c,yOffset:d}},_getPopperOffsets:function(a,b){var c="0",d="0";c=this.options.arrowDirection;switch(c){case "left":case "right":c=c==="left"?"7":"-7";switch(a){case "top":d="-13";break;case "center":d="0";break;case "bottom":d="13";break;default:d="0";break}break;case "top":case "bottom":d=c==="top"?"7":"-7";switch(b){case "left":c="-13";break;case "center":c="0";break;case "right":c=
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
29 "13";break;default:c="0";break}break;default:throw"Valid arrow directions are top, bottom, left, right";}return{xOffset:c,yOffset:d}},_areaElementAdjustment:function(a,b){a=typeof a=="string"?a.split(" "):[a.xOffset,a.yOffset];var c=parseInt(a[0],10);a=parseInt(a[1],10);var d=jQuery(this._activeTrigger||this.element).parent(),e=jQuery(this._activeTrigger||this.element[0])[0];d=jQuery("img[usemap='#"+(d[0].name||d[0].id)+"']");var f=e.shape||"rect";e=(e.coords||"").split(/\s?,\s?/g);d=d;var g=0,h=
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
30 0;if(f==="circle"){if(b[0]=="top")h=parseFloat(e[1])-parseFloat(e[2]);else if(b[0]=="bottom")h=e[3]+parseFloat(e[2]);else if(b[0]=="center")h=parseFloat(e[1]);if(b[1]==="left")g=e[0]-parseFloat(e[2]);else if(b[1]==="right")g=e[2]+parseFloat(e[2]);else if(b[1]==="center")g=parseFloat(e[0])}else{if(b[0]=="top")h=parseFloat(e[1]);else if(b[0]=="bottom")h=parseFloat(e[3]);else if(b[0]=="center")h=(parseFloat(e[1])+parseFloat(e[3]))/2;if(b[1]==="left")g=parseFloat(e[0]);else if(b[1]==="right")g=parseFloat(e[2]);
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
31 else if(b[1]==="center")g=(parseFloat(e[0])+parseFloat(e[2]))/2}g+=c;h+=a;return{positionElement:d,offset:g+"px "+h+"px"}},_getCollisionSetting:function(){var a=this.options.adjustFit;return a=a==="autoAdjust"||a==="slide"?"fit":"none"},_resetElementPosition:function(a){a.css("top","-100px").css("left","-100px")},_positionPopper:function(a,b,c){a=this._getPositionSettings(a,"popper",c);c=this._getCollisionSetting();var d=a.triggerElement||this.options.openAtTarget&&this._activeTrigger||this.element;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
32 a=this.getDestElement(true).stop().show().position({my:a.dest,of:d,at:a.trigger,offset:a.offset,collision:c}).data("attached-to",d);b&&a.hide();document.times++},_addEscapeListener:function(){if(this.options.isEscapeKeyClose){this._registerGlobalEscapeListener();var a=this;this._ncbipopperescapepressedFunction=function(){a.close()};jQuery(document).bind("ncbipopperescapepressed",this._ncbipopperescapepressedFunction)}},_destroyEscapeListener:function(){if(this._ncbipopperescapepressedFunction){jQuery(document).unbind("ncbipopperescapepressed",
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
33 this._ncbipopperescapepressedFunction);this._ncbipopperescapepressedFunction=null}},_registerGlobalEscapeListener:function(){if(!jQuery.ui.ncbipopper.globalEvents.isGlobalEscapeRegistered){jQuery.ui.ncbipopper.globalEvents.isGlobalEscapeRegistered=true;var a=document,b="keypress";if(!jQuery.browser.msie&&!jQuery.browser.mozilla){a=window;b="keydown"}jQuery(a)[b](function(c){c.keyCode===27&&jQuery(document).trigger("ncbipopperescapepressed")})}},_addDocumentClickListener:function(){if(this.options.isDocumentCloseClick){this._registerGlobalClickListener();
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
34 var a=this;this._ncbipopperdocumentclickFunction=function(b,c){a._checkDocumentClick(b,c)};jQuery(document).bind("ncbipopperdocumentclick",this._ncbipopperdocumentclickFunction)}},_destroyDocumentClickListener:function(){this._ncbipopperdocumentclickFunction&&jQuery(document).unbind("ncbipopperdocumentclick",this._ncbipopperdocumentclickFunction)},_registerGlobalClickListener:function(){if(!jQuery.ui.ncbipopper.globalEvents.isGlobalClickRegistered){jQuery.ui.ncbipopper.globalEvents.isGlobalClickRegistered=
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
35 true;jQuery(document).click(function(a){jQuery(document).trigger("ncbipopperdocumentclick",[a.srcElement||a.target])})}},_checkDocumentClick:function(a,b){if(b&&this.isOpen()){b=jQuery(b);if(!(this._isSameElementOrChild(jQuery(this.element),b)||this._isSameElementOrChild(this.getDestElement(),b)))if(!(jQuery.ui.jig.getElementWidgets(jQuery(b),"ncbipopper")[0]&&this.getDestElement()[0]==jQuery.ui.jig.getElementWidgets(jQuery(b),"ncbipopper")[0].getDestElement()[0])){if(a=this.options.multipleHandlesSelector){var c=
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
36 false,d=this;jQuery(a).each(function(){if(d._isSameElementOrChild(jQuery(this),b))c=true});if(c)return}this.close()}}},_isSameElementOrChild:function(a,b){return a[0]==b[0]||jQuery(a).has(b).length===1},_addResizeListener:function(){this._registerGlobalResizeListener();var a=this;this.ncbipopperdocumentresizeFunction=function(b){a._pageResized(b)};jQuery(window).bind("ncbipopperdocumentresize",this.ncbipopperdocumentresizeFunction)},_destroyResizeListener:function(){if(this.ncbipopperdocumentresizeFunction){jQuery(window).unbind("ncbipopperdocumentresize",
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
37 this.ncbipopperdocumentresizeFunction);this.ncbipopperdocumentresizeFunction=null}},_registerGlobalResizeListener:function(){if(!jQuery.ui.ncbipopper.globalEvents.isGlobalResizeRegistered){jQuery.ui.ncbipopper.globalEvents.isGlobalResizeRegistered=true;jQuery(window).on("resize scroll",function(){jQuery(window).trigger("ncbipopperdocumentresize")})}},_pageResized:function(a){if(this.isOpen()){this._positionPopper(a);this._setUpArrow(a)}},_addCloseButton:function(){if(this.options.addCloseButton){var a=
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
38 this.getDestElement(),b=a.find(".ui-ncbipopper-close-button, .ncbipopper-close-button");if(b.length===0){b=jQuery("<button class='ui-ncbipopper-close-button ui-ncbipopper-close-button-generated'>x</button>").attr("generated","true").prependTo(a);b.ncbibutton({color:"blue"})}if(b){var c=this;this._closeButtonFunction=function(d){c.close();d.preventDefault()};b.on("click",this._closeButtonFunction)}}},_destroyCloseButton:function(a){this._closeButtonFunction&&this.getDestElement().find(".ui-ncbipopper-close-button, .ncbipopper-close-button").off("click",
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
39 this._closeButtonFunction).filter(function(){return!a}).filter(".ui-ncbipopper-close-button-generated").ncbibutton("destroy").remove()},isPopperShared:function(){return(this.getDestElement().data("popperTriggers")||[]).length>1},_addSharingDetails:function(){var a=this.getDestElement(),b=a.data("popperTriggers")||[];b.push(this.element);a.data("popperTriggers",b)},_removeSharingDetails:function(){for(var a=this.getDestElement(),b=a.data("popperTriggers"),c=this.element[0],d=0;d<b.length;d++)if(b[d][0]==
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
40 c){b.slice(d,1);break}b.length===0?a.removeData("popperTriggers"):a.data("popperTriggers",b)},_handleSharedPoppersOpen:function(){if(this.isPopperShared())for(var a=this.getDestElement().data("popperTriggers"),b=this.element[0],c=0;c<a.length;c++)if(a[c][0]!=b&&jQuery.ui.jig.getElementWidgets(a[c],"ncbipopper")[0].isOpen()){jQuery.ui.jig.getElementWidgets(a[c],"ncbipopper")[0].close(true);break}},_addPopperHover:function(){if((this.options.closeMethod||this.options.closeEvent)==="mouseout"){var a=
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
41 this.getDestElement();if(this._arrow)a=a.add(this._arrow);var b=this,c={timeout:this.options.delayTimeout,over:function(){},out:function(){b._overPopper(false)}};jQuery(a).hoverIntent(c);jQuery(a).mouseenter(function(){b._overPopper(true);b._lastOver=new Date});jQuery(a).mouseleave(function(){new Date-b._lastOver<b.options.delayTimeout&&b._overPopper(false)}).mouseout(function(d){var e=jQuery(d.target||d.srcElement);if(e.hasClass("ui-ncbipopper-wrapper")||e.hasClass("ui-ncbipopper-arrow-image"))if(e.find(d.relatedTarget).length===
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
42 0){b._isOverPopper=false;b._outTimer=window.setTimeout(function(){b._overPopper(false)},200)}})}},_destroyPopperHover:function(){var a=jQuery(this.getDestElement());a.unbind("mouseenter").unbind("mouseleave");a.removeProp("hoverIntent_t");a.removeProp("hoverIntent_s")},_overPopper:function(a){this._outTimer&&window.clearInterval(this._outTimer);if(a)this._pTimer=new Date;this._isOverPopper=a;if(!a)if(this._isOverTrigger){var b=this;window.setTimeout(function(){!b._isOverPopper&&!b._isOverTrigger&&
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
43 b._overPopper(false)},300)}else this.close()},isOpen:function(a){if(!a)a=this._activeTrigger;a=jQuery(a);var b=jQuery(this._activeTrigger),c=this.getDestElement().data("popperTriggers");a=this.options.openAtTarget||c.length>1?a&&a.length&&b&&b.length&&b[0]===a[0]:true;return this.getDestElement().data("isOpen")&&a?true:false},_setParentsZIndex:function(a){if(jQuery.browser.msie&&parseInt(jQuery.browser.version,10)<=7){var b=this.getDestElement().parents(),c=0;if(b.length>1){b.each(function(e){if(jQuery(this).css("position")===
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
44 "relative"){c=e===0?0:e+1;return false}});b=b.eq(c);var d=b.css("position");b.data("orgPosition")||b.data("orgPosition",d);if(d==="static"||d==="relative"){d=a===1?b.data("orgPosition"):"relative";b.css({position:d,"z-index":a})}}}},addTriggerAria:function(a){var b=a;if(!a){b=this.element;if((a=this.options.multipleHandlesSelector)&&a.length>0)b=b.add(a)}b.attr("role","button").attr("aria-expanded",false).attr("aria-haspopup",true)},_destroyTriggerAria:function(){var a=this.element,b=this.options.multipleHandlesSelector;
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
45 if(b&&b.length>0)a=a.add(b);a.removeAttr("role aria-expanded aria-haspopup")},_addDestAria:function(){this.getDestElement().attr("aria-live","assertive").attr("aria-hidden",true).addClass("ui-helper-reset")},_destroyDestAria:function(){this.getDestElement().removeAttr("aria-live aria-hidden").removeClass("ui-helper-reset")},_setAriaState:function(a,b,c){b=b?b:this.element;c=c?c:this.getDestElement();b.attr("aria-expanded",a);c.attr("aria-hidden",!a)}});jQuery.ui.ncbipopper.openGroups={};
ffe82516a83c add trimmed down html example
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
46 jQuery.ui.ncbipopper.globalEvents={isGlobalEscapeRegistered:false,isGlobalClickRegistered:false,isGlobalResizeRegistered:false};