All Downloads are FREE. Search and download functionalities are using the official Maven repository.

js.viewissue.js Maven / Gradle / Ivy

jQuery.fn.stalker=function(){var $win=jQuery(window),$doc=jQuery(document),$stalker,$transitionElems,offsetY,placeholder,lastScrollPosY,stalkerHeight,isInitialized,selector=this.selector;function isSupported(){if(jQuery.browser.msie&&jQuery.browser.version<7||(!jQuery.os.mac&&jQuery.browser.mozilla&&getBrowserVersionAsInt()<191)){return false}return true}function getInactiveProperties(){if(jQuery.os.windows||jQuery.os.linux){return{position:"absolute",top:offsetY}}else{return{position:"fixed",top:offsetY-$win.scrollTop()}}}function getBrowserVersionAsInt(){return parseInt(jQuery.browser.version.replace(/\.*/g,"").substring(0,3),10)}function needToApplyFlickerFix(){var browserVersion=jQuery.browser.version.replace(/\.*/g,"").substring(0,3);return jQuery.browser.mozilla&&browserVersion<192}function initialize(){$stalker=jQuery(selector);if($stalker.length===0){return}offsetY=$stalker.offset().top;$transitionElems=$stalker.prevAll(":visible");function setStalkerHeight(){$stalker.css("overflow","hidden");stalkerHeight=$stalker.height();$stalker.css("overflow","")}function createPlaceholder(){placeholder=jQuery("
").addClass("stalker-placeholder").css({display:"none", visibility:"hidden",height:stalkerHeight}).insertBefore($stalker)}function setPlaceholderHeight(){if(!$stalker.hasClass("detached")){placeholder.height($stalker.height())}else{placeholder.height($stalker.removeClass("detached").height());$stalker.addClass("detached")}}setStalkerHeight();createPlaceholder();setPlaceholderHeight();$stalker.css(getInactiveProperties());$stalker.bind("stalkerHeightUpdated",setPlaceholderHeight);$stalker.bind("positionChanged",setStalkerPosition);if(needToApplyFlickerFix()){$stalker.addClass("fix-ff35-flicker")}isInitialized=true}function offsetPageScrolling(){function setScrollPostion(scrollTarget){var docHeight=jQuery.getDocHeight(),scrollPos;if(scrollTarget>=0&&scrollTarget<=docHeight){scrollPos=scrollTarget}else{if(scrollTarget>=$win.scrollTop()){scrollPos=docHeight}else{if(scrollTarget<0){scrollPos=0}}}$win.scrollTop(scrollPos)}function pageUp(){if(!isInitialized){initialize()}var scrollTarget=jQuery(window).scrollTop()-jQuery(window).height();setScrollPostion(scrollTarget+stalkerHeight)}function pageDown(){if(!isInitialized){initialize()}var scrollTarget=jQuery(window).scrollTop()+jQuery(window).height();setScrollPostion(scrollTarget-stalkerHeight)}$doc.bind("keydown",function(event){if(jQuery(event.target).is("input,select,textarea,button")){return}var handler;switch(event.keyCode){case AJS.$.ui.keyCode.SPACE:handler=(event.shiftKey)?pageUp:pageDown;break;case AJS.$.ui.keyCode.PAGE_UP:handler=pageUp;break;case AJS.$.ui.keyCode.PAGE_DOWN:handler=pageDown;break;default:return}if(jQuery("body").css("overflow")!=="hidden"){handler()}event.preventDefault()})}function containDropdownsInWindow(){$doc.bind("showLayer",function(e,type,obj){var stalkerOffset,targetHeight;if(!isInitialized){initialize()}if(type==="dropdown"&&obj.$.parents(selector).length!==-1){stalkerOffset=($stalker.hasClass("detached")||!$stalker.offset()?0:$stalker.offset().top);targetHeight=jQuery(window).height()-$stalker.height()-stalkerOffset;if(targetHeight<=parseInt(obj.$.attr("scrollHeight"),10)){AJS.containDropdown.containHeight(obj,targetHeight)}else{AJS.containDropdown.releaseContainment(obj)}obj.reset();if(needToApplyFlickerFix()){$stalker.height($stalker.attr("scrollHeight"))}}}).bind("hideLayer",function(){if(needToApplyFlickerFix()){$stalker.height("")}})}if(!isSupported()){return}if(jQuery.browser.msie){jQuery(setup);jQuery(setStalkerPosition)}else{setup()}function setup(){offsetPageScrolling();containDropdownsInWindow();$doc.click(function(e){if(jQuery(e.target).parents(selector).length!==0&&!isInitialized){initialize()}});$doc.bind("showLayer",function(e,type){if($transitionElems){$transitionElems.css("opacity","")}if(jQuery.browser.mozilla&&type==="popup"){setStalkerPosition()}});$win.scroll(setStalkerPosition);$win.resize(function(){if($stalker){$stalker.trigger("stalkerHeightUpdated")}});$doc.mouseup(function(){if(lastScrollPosY&&$win.scrollTop()===lastScrollPosY){if($transitionElems){$transitionElems.css("opacity"," ")}}})}function setStalkerPosition(){function getOpacitySetting(){var opacityTarget=1-$win.scrollTop()/offsetY;if(opacityTarget>1){return""}else{if(opacityTarget<0){return 0}else{return opacityTarget}}}if(!isInitialized){initialize()}if($transitionElems){$transitionElems.css("opacity",getOpacitySetting())}if(offsetY<=$win.scrollTop()){if(!$stalker.hasClass("detached")){$stalker.css({top:0,position:"fixed"}).addClass("detached")}}else{$stalker.css(getInactiveProperties()).removeClass("detached")}lastScrollPosY=$win.scrollTop()}return this}; AJS.OffsetAnchors=Class.extend({WEBKIT_SCROLL_DELAY:100,BUFFER:20,init:function(offsetElemSelector){this.offsetElemSelector=offsetElemSelector;this.listen()},offsetElement:function(){if(!this.$offsetElement){this.$offsetElement=AJS.$(this.offsetElemSelector)}return this.$offsetElement},targetElement:function(){var anchor=this.anchor();if(anchor){var targetElement=AJS.$("#"+anchor+",a[name="+anchor+"]").filter(":visible");if(targetElement.length!==0){return targetElement.eq(0)}}},_bottomOfOffsetElement:function(){return this.offsetElement().outerHeight()+this.offsetElement().offset().top},offsettedScrollPosition:function(targetElement){return targetElement.offset().top-this.BUFFER-this.offsetElement().outerHeight()},offset:function(){var targetElement,scrollPosition;targetElement=this.targetElement();this.scrolled=true;if(targetElement){scrollPosition=this.offsettedScrollPosition(targetElement);if(AJS.$.browser.safari){this._delayScrollForWebkit(scrollPosition)}else{AJS.$(window).scrollTop(scrollPosition)}}},_delayScrollForWebkit:function(scrollTarget){window.setTimeout(function(){AJS.$(window).scrollTop(scrollTarget)},this.WEBKIT_SCROLL_DELAY)},anchor:function(){return AJS.parseUri(window.location.href).anchor},listen:function(){var instance=this;AJS.$(window).one("scroll",function(){if(!instance.scrolled){instance.offset()}})}}); jira.app.viewissue=function(){var modules=function(){function headerDropdowns(){AJS.DropDown.create({trigger:AJS.$(".mod-header .aui-dropdown-trigger")})}return{domReady:function(){headerDropdowns()}}}();var subtasks=function(){function setFocusConfiguration(){if(AJS.parseUri(window.location.href).anchor!=="summary"){var triggerConfig=new jira.setFocus.FocusConfiguration();triggerConfig.excludeParentSelector="#"+FORM_ID+",.dont-default-focus";jira.setFocus.pushConfiguration(triggerConfig)}}var FORM_ID="stqcform";return{domReady:function(){setFocusConfiguration()}}}();var stalker=function(){var STALKER_SELECTOR="#stalker.stalker";return{init:function(){new AJS.OffsetAnchors(STALKER_SELECTOR+", .stalker-placeholder");AJS.$(STALKER_SELECTOR).stalker()}}}();return{init:function(){stalker.init()},domReady:function(){modules.domReady();subtasks.domReady()}}}();jira.app.viewissue.init();AJS.$(jira.app.viewissue.domReady);jQuery(function(){var STALKER_COMMENT_SELECTOR="textarea#comment";var FOOTER_COMMENT_SELECTOR="#addcomment textarea";var openInNewWindow=function(e){e.preventDefault();e.stopPropagation();var $this=jQuery(this);jQuery(document).click();jira.app.attachments.screenshot.openWindow($this.attr("href"))};var resetCommentFormDirtyState=function(){var $commentForm=AJS.$("form#issue-comment-add");$commentForm.data(AJS.DIRTY_FORM_VALUE,$commentForm.find(":input[name!=atl_token]").serialize())};var cancelCommentInput=function($commentButton,textAreaSelector){$commentButton.click();setTimeout(function(){AJS.$(textAreaSelector).val("")},100);AJS.$("#comment-preview_link.selected").click();resetCommentFormDirtyState()};jQuery(document).bind(jira.keyboard.SpecialKey.eventType(),function(e){if(jira.keyboard.specialKeyEntered(e)===jira.keyboard.SpecialKey.ESC&&!AJS.InlineLayer.current){if(jQuery("#comment-issue.active").length>0){resetCommentFormDirtyState();jQuery("#comment-issue.active").click()}}});function setCaretAtEndOfCommentField(){var $field=AJS.$("#comment"),field=$field[0],length;if($field.length){length=$field.val().length;$field.scrollTop($field.attr("scrollHeight"));if(field.setSelectionRange&&length>0){field.setSelectionRange(length,length)}}}AJS.$("#comment-issue").click(function(e){var elem=jQuery(this);if(elem.hasClass("active")){elem.removeClass("active");jQuery("#stalker").removeClass("action");jQuery("form#issue-comment-add").appendTo("#addcomment .mod-content")}else{if(AJS.$("#addcomment").hasClass("active")){AJS.$("#footer-comment-button").click()}elem.addClass("active");jQuery("#stalker").addClass("action");jQuery("form#issue-comment-add").appendTo(".ops-cont");AJS.$("#comment").focus().trigger("keyup");setCaretAtEndOfCommentField()}jQuery("#stalker").trigger("stalkerHeightUpdated");e.preventDefault()});AJS.$("#footer-comment-button").click(function(e){var elem=jQuery("#addcomment");if(elem.hasClass("active")){elem.removeClass("active")}else{if(AJS.$("#comment-issue").hasClass("active")){AJS.$("#comment-issue").click()}elem.addClass("active");jQuery("form#issue-comment-add").appendTo("#addcomment .mod-content");AJS.$("#comment").trigger("keyup").focus();setCaretAtEndOfCommentField()}e.preventDefault()});jQuery(document).bind("showWikiInput",function(e,previewElem){var $commentField=jQuery("#comment:visible:enabled");jQuery("#stalker").trigger("stalkerHeightUpdated");if($commentField.length>0){$commentField.focus()}return arguments.callee}());jQuery(document).bind("showWikiInput",function(){setCaretAtEndOfCommentField()});jQuery(document).bind("showWikiPreview",function(){jQuery("#stalker").trigger("stalkerHeightUpdated")});jQuery("#issue-comment-add-cancel").click(function(e){var $stalkerCommentButton=AJS.$("#comment-issue"),$footerCommentModule=AJS.$("#addcomment");if($stalkerCommentButton.hasClass("active")){cancelCommentInput($stalkerCommentButton,STALKER_COMMENT_SELECTOR)}else{if($footerCommentModule.hasClass("active")){var $footerCommentButton=AJS.$("#footer-comment-button");cancelCommentInput($footerCommentButton,FOOTER_COMMENT_SELECTOR)}}e.preventDefault()});AJS.$("#commentDiv input[type='submit']").click(function(e){if(AJS.$("#comment").val()===""){e.preventDefault();AJS.$("#emptyCommentErrMsg").show()}});AJS.$("#attach-screenshot").click(openInNewWindow);AJS.$("#tt_include_subtasks input").click(function(e){if(AJS.$(this).is(":checked")){AJS.$("#tt_info_single").hide();AJS.$("#tt_info_aggregate").show()}else{AJS.$("#tt_info_aggregate").hide();AJS.$("#tt_info_single").show()}});if(jQuery.browser.mozilla&&/^1\.9\.1/.test(jQuery.browser.version)&&!jQuery.os.mac){var stalker=jQuery("#stalker");stalker.addClass("fix-ff35-flicker");var setStalkerWidth=function(){var contentWidth=jQuery("#main-content").outerWidth();if(contentWidth<1000){stalker.width(contentWidth)}else{stalker.css("width","")}};jQuery(window).resize(setStalkerWidth);setStalkerWidth();stalker.trigger("stalkerHeightUpdated")}var toggleVotingAndWatching=function(trigger,className,resultContainer,issueOpTrigger,i18n){var classNameOn=className+"-on",classNameOff=className+"-off",icon=trigger.find(".icon"),method="POST";if(icon.hasClass(classNameOn)){method="DELETE"}var restPath="/voters";if(className.indexOf("watch")!==-1){restPath="/watchers"}icon.removeClass(classNameOn).removeClass(classNameOff);AJS.$(jira.ajax.makeRequest({url:contextPath+"/rest/api/1.0/issues/"+trigger.attr("rel")+restPath,type:method,dataType:"json",contentType:"application/json",data:{dummy:true},complete:function(xhr,textStatus,smartAjaxResult){if(smartAjaxResult.successful){if(method==="POST"){icon.addClass(classNameOn);trigger.attr("title",i18n.titleOn).find(".action-text").text(i18n.actionTextOn);issueOpTrigger.attr("title",i18n.titleOn).text(i18n.textOn)}else{icon.addClass(classNameOff);trigger.attr("title",i18n.titleOff).find(".action-text").text(i18n.actionTextOff);issueOpTrigger.attr("title",i18n.titleOff).text(i18n.textOff)}resultContainer.text(smartAjaxResult.data.count)}else{alert(jira.ajax.buildSimpleErrorContent(smartAjaxResult));if(method==="POST"){icon.addClass(classNameOff);trigger.attr("title",i18n.titleOff).find(".action-text").text(i18n.actionTextOff);issueOpTrigger.attr("title",i18n.titleOff).text(i18n.textOff)}else{icon.addClass(classNameOn);trigger.attr("title",i18n.titleOn).find(".action-text").text(i18n.actionTextOn);issueOpTrigger.attr("title",i18n.titleOn).text(i18n.textOn)}}}})).throbber({target:icon})};AJS.$("#toggle-vote-issue").click(function(e){e.preventDefault();AJS.$("#vote-toggle").click()});AJS.$("#toggle-watch-issue").click(function(e){e.preventDefault();AJS.$("#watching-toggle").click()});var addI18nErrorCodes=function(i18n){AJS.$("input[type=hidden][id|=error]").each(function(index,elem){var i18n_id=elem.id.replace("error-","");i18n[i18n_id]=elem.value})};AJS.$("#vote-toggle").click(function(e){e.preventDefault();var i18n={titleOn:AJS.params.issueOpTitleUnvote,titleOff:AJS.params.issueOpTitleVote,textOn:AJS.params.issueOpUnvote,textOff:AJS.params.issueOpVote,actionTextOff:AJS.params.i18nVote,actionTextOn:AJS.params.i18nVoted};addI18nErrorCodes(i18n);toggleVotingAndWatching(AJS.$(this),"icon-vote",AJS.$("#vote-data"),AJS.$("#toggle-vote-issue"),i18n)});AJS.$("#watching-toggle").click(function(e){e.preventDefault();var i18n={titleOn:AJS.params.issueOpTitleUnwatch,titleOff:AJS.params.issueOpTitleWatch,textOn:AJS.params.issueOpUnwatch,textOff:AJS.params.issueOpWatch,actionTextOff:AJS.params.i18nWatch,actionTextOn:AJS.params.i18nWatching};addI18nErrorCodes(i18n);toggleVotingAndWatching(AJS.$(this),"icon-watch",AJS.$("#watcher-data"),AJS.$("#toggle-watch-issue"),i18n)});if(AJS.$.browser.mozilla&&AJS.$.browser.version.indexOf("1.9.0")===0){AJS.$("#peoplemodule .shorten").removeClass("shorten")}AJS.$(".shorten").shorten();AJS.moveInProgress=false;AJS.$(document).bind("moveToStarted",function(){AJS.moveInProgress=true}).bind("moveToFinished",function(){AJS.moveInProgress=false});AJS.$(".issue-data-block").mouseover(function(){if(!AJS.moveInProgress){AJS.$(".issue-data-block.focused").removeClass("focused");AJS.$(this).addClass("focused")}});AJS.$(".issuePanelContainer").mouseout(function(){if(!AJS.moveInProgress){AJS.$(".issue-data-block.focused").removeClass("focused")}});if(jQuery.browser.msie&&parseInt(jQuery.browser.version,10)===7){jQuery("a.twixi").bind("focus",function(e){e.preventDefault()})}else{jQuery(document).bind("moveToFinished",function(event,target){jQuery("a.twixi:visible",target).focus()})}});jQuery(function(){if(jQuery.browser.msie&&jQuery.browser.version<7){return}var initFancyBoxForClass=function(aClassName){var closeFancyBox=function(){jQuery(aClassName).fancybox.close()};var isFireFoxLinux=function(){return jQuery.os.linux&&jQuery.browser.mozilla};var useOverlay=true;if(isFireFoxLinux()){useOverlay=false}var fancyBoxOptions={"imageScale":true,"centerOnScroll":false,"overlayShow":useOverlay,callbackOnStart:function(){jQuery("#header").css("zIndex","-1");if(useOverlay){jQuery("body").addClass("fancybox-show")}},"callbackOnShow":function(){jQuery(document).click(function(){closeFancyBox()})},"onComplete":function(){var title=AJS.$("#fancybox-title");var mainWidth=AJS.$("#fancybox-title-main").outerWidth();var leftWidth=AJS.$("#fancybox-title-left").outerWidth();var rightWidth=AJS.$("#fancybox-title-right").outerWidth();title.width(mainWidth+leftWidth+rightWidth+5);var imageDivWidth=AJS.$("#fancybox-inner").width();title.css("marginLeft",-(title.width()/2)+(imageDivWidth/2));title.css("bottom",title.outerHeight(true)*-1)},"callbackOnClose":function(){jQuery("#header").css("zIndex","");if(useOverlay){jQuery("body").removeClass("fancybox-show")}jQuery(document).unbind("click",closeFancyBox);if(jQuery.browser.safari){var top=AJS.$(window).scrollTop();AJS.$(window).scrollTop(10+5*(top==10)).scrollTop(top)}}};if(AJS.$.browser.msie){fancyBoxOptions.transitionIn="none";fancyBoxOptions.transitionOut="none"}jQuery(aClassName).fancybox(fancyBoxOptions)};initFancyBoxForClass("a.gallery")});jQuery(function(){AJS.$("#customfield-tabs li a").click(function(e){e.preventDefault();var $this=AJS.$(this);var rel=$this.attr("rel");AJS.$("#customfield-tabs li.active").removeClass("active");AJS.$("#tabCell"+rel).addClass("active");AJS.$("#customfieldmodule ul.property-list:not(hidden)").addClass("hidden");AJS.$("#tabCellPane"+rel).removeClass("hidden")})});jQuery(function(){var toggle=new JIRA.ToggleBlock({blockSelector:".toggle-wrap",triggerSelector:".mod-header h3",cookieCollectionName:"block-states",originalTargetIgnoreSelector:"a"})}); AJS.Shorten=Class.extend({_getDefaultOptions:function(){return{items:"a, span",numRows:1,shortenText:"hide",shortenOnInit:true,persist:true}},init:function(options){var that=this,timer=null;if(typeof options==="string"){options={element:options}}options=options||{};this.options=AJS.$.extend(this._getDefaultOptions(),options);this.$container=AJS.$(this.options.element);this.$container.css({padding:0,display:"block"});if(this.options.persist){AJS.Cookie.read(this.$container.attr("id"),"hidden")}if(this._isShortenedOnLoad()){this.shorten()}else{this.expand()}AJS.$(window).resize(function(){if(!that.expanded&&timer===null){that.timer=setTimeout(function(){that.shorten();that.timer=null},100)}})},_isShortenedOnLoad:function(){var cookieValue=AJS.Cookie.read(this.$container.attr("id"));if(cookieValue==="hidden"){return true}else{if(cookieValue==="shown"){return false}else{if(this.options.shortenOnInit){return true}}}return false},_renders:{ellipsis:function(itemsHidden){return AJS.$("("+(itemsHidden)+")
")},shortenTip:function(removeText){return AJS.$(""+removeText+"")}},_removeEllipsis:function(){if(this.$ellipsis){this.$ellipsis.remove();this.$ellipsis=null}},_hasEllipsisWrapped:function(){return this.$ellipsis.attr("offsetTop")>this.$ellipsis.prev().attr("offsetTop")},_insertEllipsis:function(tryInsertAfter,itemsHidden){var that=this,insertAfterCount=tryInsertAfter;this.$ellipsis=this._renders.ellipsis(itemsHidden).insertAfter(this.$items[insertAfterCount]);if(insertAfterCount!==0&&this._hasEllipsisWrapped()){insertAfterCount--;that._removeEllipsis();that.$ellipsis=that._renders.ellipsis(itemsHidden+1).insertAfter(this.$items[insertAfterCount])}this.$ellipsis.click(function(e){e.preventDefault();that.expand()});return insertAfterCount},shorten:function(moveToShortened){function hasWrapped(){if(ithat.$items[i+1].offsetLeft||that.$items[i].realHeight>that.$items[i+1].realHeight+5}else{return that.$items[i].offsetTop>that.$items[i-1].offsetTop||that.$items[i].offsetLeftthat.$items[i-1].realHeight+5}}var availableRows=this.options.numRows,i=0,rows=0,containerheight=0,ellipseIndex=0,that=this;this._removeEllipsis();if(this.$shortenTip){this.$shortenTip.remove()}this.$items=this.$container.children(this.options.items);this.$items.each(function(){if(this.offsetHeight!==0){this.realHeight=this.offsetHeight}else{this.realHeight=AJS.$(this).children(that.options.items).attr("offsetHeight")||0}});if(this.$items.length<2){return}this.$container.css({overflow:"hidden"});do{if(hasWrapped()){rows++;if(rows===availableRows){if(i===0){ellipseIndex=that._insertEllipsis(0,this.$items.length-1)}else{ellipseIndex=that._insertEllipsis(i-1,this.$items.length-i)}containerheight=(this.$items[ellipseIndex].offsetTop-that.$items[0].offsetTop);containerheight+=this.$items[ellipseIndex].realHeight;if((that.$items[ellipseIndex].offsetTop)=8&&jQuery.browser.version<9){AJS.$("body").addClass("reflow")}delete this.expanded},expand:function(){function canBeShortened(){return that.$items[0].offsetTop1&&canBeShortened()){this.$shortenTip=this._renders.shortenTip(this.options.shortenText);this.$shortenTip.appendTo(this.$container).click(function(e){that.shorten(true);e.preventDefault()})}if(this.options.persist){AJS.Cookie.save(this.$container.attr("id"),"shown")}if(jQuery.browser.msie){AJS.$("body").addClass("reflow")}}});jQuery.fn.shorten=function(options){var res=[];this.each(function(){options=options||{};options.element=this;res.push(new AJS.Shorten(options))});return res};




© 2015 - 2025 Weber Informatics LLC | Privacy Policy