define(["require","exports","../shared/MotionInitiatorShow"],function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),new(function(){function e(){new MotionInitiatorShow;var e=$(".motionTextHolder .paragraph");e.find(".comment .shower").click(this.showComment.bind(this)),e.find(".comment .hider").click(this.hideComment.bind(this)),e.filter(".commentsOpened").find(".comment .shower").click(),e.filter(":not(.commentsOpened)").find(".comment .hider").click(),e.each(this.initParagraph.bind(this)),$(".tagAdderHolder").click(function(e){e.preventDefault(),$(this).addClass("hidden"),$("#tagAdderForm").removeClass("hidden")});var t=location.hash.split("#comm");2==t.length&&$("#comment"+t[1]).scrollintoview({top_offset:-100}),$("form.delLink").submit(this.delSubmit.bind(this)),$(".share_buttons a").click(this.shareLinkClicked.bind(this)),this.markMovedParagraphs()}return e.prototype.markMovedParagraphs=function(){$(".motionTextHolder .moved .moved").removeClass("moved"),$(".motionTextHolder .moved").each(function(){var e,t=$(this),n=t.data("moving-partner-paragraph"),i=t.parents(".paragraph").first().attr("id").split("_")[1],r=$("#section_"+i+"_"+n).find(".lineNumber").first().data("line-number");e=(e=t.hasClass("inserted")?__t("std","moved_paragraph_from_line"):__t("std","moved_paragraph_to_line")).replace(/##LINE##/,r).replace(/##PARA##/,n+1),"LI"===t[0].nodeName&&(t=t.parent());var a=$('<div class="movedParagraphHint"></div>');a.text(e),a.insertBefore(t)})},e.prototype.delSubmit=function(e){e.preventDefault();var t=e.target;bootbox.confirm(__t("std","del_confirm"),function(e){e&&t.submit()})},e.prototype.shareLinkClicked=function(e){var t=$(e.currentTarget).attr("href");window.open(t,"_blank","width=600,height=460")&&e.preventDefault()},e.prototype.showComment=function(e){e.preventDefault();var t=$(e.currentTarget),n=t.parents(".paragraph").first().find(".commentHolder");t.addClass("hidden"),t.parent().find(".hider").removeClass("hidden"),n.removeClass("hidden"),n.isOnScreen(.1,.1)||n.scrollintoview({top_offset:-100})},e.prototype.hideComment=function(e){var t=$(e.currentTarget);t.addClass("hidden"),t.parent().find(".shower").removeClass("hidden"),t.parents(".paragraph").first().find(".commentHolder").addClass("hidden"),e.preventDefault()},e.prototype.initParagraph=function(e,t){var n=$(t),i=n.find(".lineNumber").first(),r=i.height(),a=n.find(".bookmarks > .amendment");a=a.sort(function(e,t){return $(e).data("first-line")-$(t).data("first-line")}),n.find(".bookmarks").append(a),n.find("ul.bookmarks li.amendment").each(function(){var e=$(this),t=(e.data("first-line")-i.data("line-number"))*r;e.prevAll().each(function(){var e=$(this);t-=e.height(),t-=parseInt(e.css("margin-top")),t-=7}),t<0&&(t=0),e.css("margin-top",t+"px"),e.mouseover(function(){n.find("> .textOrig").addClass("hidden"),n.find("> .textAmendment").addClass("hidden"),n.find("> .textAmendment.amendment"+e.find("a").data("id")).removeClass("hidden")}).mouseout(function(){n.find("> .textOrig").removeClass("hidden"),n.find("> .textAmendment").addClass("hidden")})})},e}())});
//# sourceMappingURL=MotionShow.js.map
