Y-SLD/assets/plugins/revolution/revolution-addons/whiteboard/js/revolution.addon.whiteboard...

7 lines
9.7 KiB
JavaScript
Raw Permalink Normal View History

2024-03-01 11:23:55 +00:00
/********************************************
* REVOLUTION 5.0+ EXTENSION - WHITEBOARD
* @version: 2.0 (20.10.2016)
* @requires jquery.themepunch.revolution.js
* @author ThemePunch
*********************************************/
!function(a){var b=jQuery.fn;jQuery.extend(!0,b,{rsWhiteBoard:function(a){return this.each(function(){var a=this.opt;jQuery(this).on("revolution.slide.onloaded",function(){c(a)})})}});var c=function(a){if(o=a.whiteboard,void 0===o)return!1;var b="position:absolute;z-index:1000;top:0px;left:0px;",c="position:absolute;z-index:1000;top:0px;left:0px;",d="position:absolute;z-index:1000;top:0px;left:0px;",f="position:absolute; top:0px;left:0px;background-size:contain;background-repeat:no-repeat;background-position:center center;";void 0!=o.movehand&&(o.movehand.markup='<div class="wb-move-hand wb-thehand" style="'+b+'"><div class="wb-hand-inner" style="'+c+";width:"+o.movehand.width+"px;height:"+o.movehand.height+'px"><div class="wb-hand-scale" ><div class="wb-hand-image" style="'+f+"width:"+o.movehand.width+"px;height:"+o.movehand.height+"px;background-image:url("+o.movehand.src+');"></div></div></div>'),void 0!=o.writehand&&(o.writehand.markup='<div class="wb-draw-hand wb-thehand" style="'+b+'"><div class="wb-hand-inner" style="'+c+'"><div class="wb-hand-scale" style="'+d+'"><div class="wb-hand-image" style="'+f+"width:"+o.writehand.width+"px;height:"+o.writehand.height+"px;background-image:url("+o.writehand.src+');"></div></div></div>'),jQuery(window).resize(function(){clearTimeout(a.whiteboard_resize_timer),a.whiteboard_resize_timer=setTimeout(function(){jQuery(".wb-thehand").each(function(){var b=jQuery(this).find(".wb-hand-scale");punchgs.TweenLite.set(b,{scale:a.bw})})},50)}),a.c.on("revolution.slide.onbeforeswap",function(b,c){a.c.find(".wb-thehand").remove()}),a.c.on("revolution.layeraction",function(b,c){var d=c.layersettings.whiteboard;if(void 0!=d){1!=d.configured&&("write"!=d.hand_function&&"draw"!=d.hand_function||(d.jitter_distance=void 0!=d.jitter_distance?parseInt(d.jitter_distance,0)/100:parseInt(o.writehand.jittering.distance,0)/100,d.jitter_distance_horizontal=void 0!=d.jitter_distance_horizontal?parseInt(d.jitter_distance_horizontal,0)/100:parseInt(o.writehand.jittering.distance_horizontal,0)/100,d.jitter_offset=void 0!=d.jitter_offset?parseInt(d.jitter_offset,0)/100:parseInt(o.writehand.jittering.offset,0)/100,d.jitter_offset_horizontal=void 0!=d.jitter_offset_horizontal?parseInt(d.jitter_offset_horizontal,0)/100:parseInt(o.writehand.jittering.offset_horizontal,0)/100,d.hand_type=d.hand_type||o.writehand.handtype),"move"==d.hand_function&&(d.hand_type=d.hand_type||o.movehand.handtype),d.configured=!0);var f=c.layer.data(),g=jQuery(f._pw).find(".wb-thehand");if(g.length>0)var k=g.data("wb");else var k=jQuery.extend(!0,{},c.layersettings.whiteboard);if("enterstage"==c.eventtype){if(jQuery(c.layer).is(":visible")===!1)return;c.layer.hasClass("handadded")||(c.layer.addClass("handadded"),c.layersettings.handEffect="on",1!=k.handadded&&h(a,c,k),i(c,k))}"enteredstage"==c.eventtype&&c.layer.hasClass("handadded")&&!c.layer.hasClass("handremoved")&&(c.layer.addClass("handremoved"),c.layersettings.handEffect="off",0==e(a,c,k)&&j(a,c,k)),"leavestage"==c.eventtype&&(c.layer.removeClass("handadded"),c.layer.removeClass("handremoved"))}})},d=function(a){var b={},c=a.layer.data();return b.obj="",b.startat=9999999,jQuery(c._li).find(".tp-caption").each(function(){var a=jQuery(this),c=a.data();1!=c.active&&void 0!=c.whiteboard&&"move"!=c.whiteboard.hand_function&&parseInt(c.frames[0].delay,0)<b.startat&&(b.obj=a,b.startat=parseInt(c.frames[0].delay,0))}),b},e=function(a,b,c){var e=!1,f=b.layer.data(),g=jQuery(f._pw).find(".wb-thehand");if("on"===f.whiteboard.goto_next_layer&&"move"!=f.whiteboard.hand_function&&0==a.c.find(".wb-between-stations").length){var h=d(b);if(void 0!=h&&h.obj.length>0){var i=g.find(".wb-hand-inner"),j=void 0!=f.timeline&&void 0!=f.timeline._labels&&void 0!=f.timeline._labels.frame_0_end?f.timeline._labels.frame_0_end:0,k=h.startat/1e3-j,l=jQuery(f._pw).position(),m=h.obj.data("_pw").position(),n=g.closest(".tp-static-layers").length>0;g.appendTo(a.ul),g.addClass("wb-between-stations"),n?g.css({zIndex:200}):g.css({zIndex:100}),c.handEffect="off",punchgs.TweenLite.fromTo(g,k,{top:l.top,left:l.left},