define(["require","exports","../shared/MotionInitiatorShow"],function(e,t){"use strict";var n=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))}return 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(),d=n.find(".bookmarks > .amendment");d=d.sort(function(e,t){return $(e).data("first-line")-$(t).data("first-line")}),n.find(".bookmarks").append(d),n.find("ul.bookmarks li.amendment").each(function(){var e=$(this),t=e.data("first-line"),d=(t-i.data("line-number"))*r,o=e.prevAll(),a=d;o.each(function(){var e=$(this);a-=e.height(),a-=parseInt(e.css("margin-top")),a-=7}),a<0&&(a=0),e.css("margin-top",a+"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}();new n});
//# sourceMappingURL=MotionShow.js.map
