vendor/javascripts/prez-controller.js.coffee in prez-0.1.0 vs vendor/javascripts/prez-controller.js.coffee in prez-0.1.1

- old
+ new

@@ -85,26 +85,39 @@ $(".prez-slide", @document).hide() $next.show() @slideStarted $next if nextElement == 0 - $next.find(".prez-element").addClass("hidden").removeClass("visible") + $next.find(".prez-element").each (i, e) => + @hideElement $(e) else if @currentElement() > nextElement for i in [@currentElement()..(nextElement + 1)] - $next.find(".prez-element[data-slide-element='#{i}']").addClass("hidden").removeClass("visible") + @hideElement $next.find(".prez-element[data-slide-element='#{i}']") else if @currentElement() < nextElement for i in [(@currentElement() + 1)..nextElement] - $next.find(".prez-element[data-slide-element='#{i}']").removeClass("hidden").addClass("visible") + @showElement $next.find(".prez-element[data-slide-element='#{i}']") # Hack to fix Chrome sometimes not rendering opacity changes, # thanks to http://stackoverflow.com/a/8840703/122 if @options.slideElementStyle == "opacity" $next.hide().show(0) @options.slideChanged? $next, nextValue, nextElement true + hideElement: ($element) -> + if $element.is(".visible[data-element-js]") + @window.elementJs[$element.data("element-js-down")]($) + + $element.addClass("hidden").removeClass("visible") + + showElement: ($element) -> + if $element.is(".hidden[data-element-js]") + @window.elementJs[$element.data("element-js-up")]($) + + $element.removeClass("hidden").addClass("visible") + currentSlide: -> return null if $(".prez-slide:visible", @document).size() == 0 parseInt $(".prez-slide:visible", @document).data("slide"), 10 currentElement: -> @@ -243,10 +256,15 @@ $("#new-window .glyphicon").addClass("glyphicon-new-window").removeClass("glyphicon-unchecked") else $("#new-window #launch-message").text "Launch in this window" $("#new-window .glyphicon").removeClass("glyphicon-new-window").addClass("glyphicon-unchecked") +$(document).on "click", "#launch-after-blocked", (e) -> + e.preventDefault() + $("#new-window-popup-blocked-modal").modal "hide" + $("#launch").click() + $(document).on "click", "#launch", (e) -> e.preventDefault() return if Prez.current useNewWindow = $("#new-window").is(".active") iframe = $("iframe")[0] @@ -259,18 +277,24 @@ else @contentDocument if useNewWindow + newWindow = window.open("", "prez", "width=640,height=480") + + unless newWindow + $("#new-window-popup-blocked-modal").modal "show" + return + iframePrez = new Prez window: iframe.getFrameWindow() useHash: false slideElementStyle: "opacity" Prez.current = new Prez duration: Prez.timeToSeconds($("#prez-duration").val()) - window: window.open("", "prez", "width=640,height=480") + window: newWindow slideChanged: ($slide, slideNumber, elementNumber) -> notes = $slide.find(".prez-notes").html() || "" $("#slide-notes").html notes $(".current-slide-number:not(select)").text $slide.data("slide") $("select.current-slide-number").val $slide.data("slide") @@ -327,5 +351,15 @@ $(window).bind "beforeunload", -> Prez.current?.end() $(document).on "keydown", Prez.handlers.keyDown $.setInterval 50, Prez.handlers.timeChange + +$ -> + launchType = $("html").data("launch-type") + + if launchType == "new_window" + $("#new-window").addClass("active"); + $("#launch").click() + else if launchType == "current_window" + $("#new-window").removeClass("active"); + $("#launch").click()