var EnjoyHint ;
( function ( $ ) {
EnjoyHint = function ( _options ) {
var $event _element ;
var that = this ;
var defaults = {
onStart : function ( ) {
} ,
onEnd : function ( ) {
} ,
onSkip : function ( ) {
} ,
onNext : function ( ) {
}
} ;
var options = $ . extend ( defaults , _options ) ;
var data = [ ] ;
var current _step = 0 ;
$body = $ ( 'body' ) ;
/********************* PRIVATE METHODS ***************************************/
var init = function ( ) {
if ( $ ( '.enjoyhint' ) ) {
$ ( '.enjoyhint' ) . remove ( ) ;
}
$body . css ( { 'overflow' : 'hidden' } ) ;
$body . addClass ( 'enjoyhint-tutorial' ) ;
$ ( document ) . on ( "touchmove" , lockTouch ) ;
$body . enjoyhint ( {
onNextClick : function ( ) {
if ( data [ current _step ] . onNext && typeof data [ current _step ] . onNext === 'function' ) {
data [ current _step ] . onNext ( ) ;
}
nextStep ( ) ;
} ,
onSkipClick : function ( ) {
options . onSkip ( ) ;
skipAll ( ) ;
}
} ) ;
} ;
var lockTouch = function ( e ) {
e . preventDefault ( ) ;
} ;
var destroyEnjoy = function ( ) {
$ ( '.enjoyhint' ) . remove ( ) ;
$body . css ( { 'overflow' : 'auto' } ) ;
$body . removeClass ( 'enjoyhint-tutorial' ) ;
$ ( document ) . off ( "touchmove" , lockTouch ) ;
} ;
that . clear = function ( ) {
var $nextBtn = $ ( '.enjoyhint_next_btn' ) ;
var $skipBtn = $ ( '.enjoyhint_skip_btn' ) ;
$nextBtn . removeClass ( that . nextUserClass ) ;
$nextBtn . text ( "Next" ) ;
$skipBtn . removeClass ( that . skipUserClass ) ;
$skipBtn . text ( "Skip" ) ;
} ;
var stepAction = function ( ) {
if ( ! ( data && data [ current _step ] ) ) {
$body . enjoyhint ( 'hide' ) ;
options . onEnd ( ) ;
destroyEnjoy ( ) ;
return ;
}
options . onNext ( ) ;
var $enjoyhint = $ ( '.enjoyhint' ) ;
var step _data = data [ current _step ] ;
// Remove all classes
$enjoyhint . removeClass ( ) ;
$enjoyhint . addClass ( "enjoyhint enjoyhint-step-" + ( current _step + 1 ) ) ;
if ( step _data . clickable ) $enjoyhint . addClass ( '-clickable' ) ;
if ( step _data . containerClass ) $enjoyhint . addClass ( step _data . containerClass ) ;
if ( step _data . onBeforeStart && typeof step _data . onBeforeStart === 'function' ) {
step _data . onBeforeStart ( ) ;
}
// Allow a wait function in as timout parameter
if ( step _data . timeout && typeof step _data . timeout === 'function' ) {
step _data . timeout ( ) . then ( function ( ) {
toggleNext ( ) ;
} )
} else {
var timeout = step _data . timeout || 0 ;
setTimeout ( function ( ) {
toggleNext ( ) ;
} , timeout ) ;
}
function toggleNext ( ) {
if ( ! step _data . selector ) {
for ( var prop in step _data ) {
if ( step _data . hasOwnProperty ( prop ) && prop . split ( " " ) [ 1 ] ) {
step _data . selector = prop . split ( " " ) [ 1 ] ;
step _data . event = prop . split ( " " ) [ 0 ] ;
if ( prop . split ( " " ) [ 0 ] == 'next' || prop . split ( " " ) [ 0 ] == 'auto' || prop . split ( " " ) [ 0 ] == 'custom' ) {
step _data . event _type = prop . split ( " " ) [ 0 ] ;
}
step _data . description = step _data [ prop ] ;
}
}
}
setTimeout ( function ( ) {
that . clear ( ) ;
} , 250 ) ;
$ ( document . body ) . scrollTop ( step _data . selector , step _data . scrollAnimationSpeed || 250 , { offset : - 100 } ) ;
setTimeout ( function ( ) {
var $element = $ ( step _data . selector ) ;
var event = makeEventName ( step _data . event ) ;
$body . enjoyhint ( 'show' ) ;
$body . enjoyhint ( 'hide_next' ) ;
$event _element = $element ;
if ( step _data . event _selector ) {
$event _element = $ ( step _data . event _selector ) ;
}
if ( ! step _data . event _type && step _data . event == "key" ) {
$element . keydown ( function ( event ) {
if ( event . which == step _data . keyCode ) {
current _step ++ ;
stepAction ( ) ;
}
} ) ;
}
if ( step _data . showNext == true ) {
$body . enjoyhint ( 'show_next' ) ;
}
if ( step _data . showSkip == false ) {
$body . enjoyhint ( 'hide_skip' ) ;
} else {
$body . enjoyhint ( 'show_skip' ) ;
}
if ( step _data . showSkip == true ) {
}
if ( step _data . nextButton ) {
var $nextBtn = $ ( '.enjoyhint_next_btn' ) ;
$nextBtn . addClass ( step _data . nextButton . className || "" ) ;
$nextBtn . text ( step _data . nextButton . text || "Next" ) ;
that . nextUserClass = step _data . nextButton . className ;
}
if ( step _data . skipButton ) {
var $skipBtn = $ ( '.enjoyhint_skip_btn' ) ;
$skipBtn . addClass ( step _data . skipButton . className || "" ) ;
$skipBtn . text ( step _data . skipButton . text || "Skip" ) ;
that . skipUserClass = step _data . skipButton . className ;
}
if ( step _data . event _type ) {
switch ( step _data . event _type ) {
case 'auto' :
$element [ step _data . event ] ( ) ;
switch ( step _data . event ) {
case 'click' :
break ;
}
current _step ++ ;
stepAction ( ) ;
return ;
break ;
case 'custom' :
on ( step _data . event , function ( ) {
current _step ++ ;
off ( step _data . event ) ;
stepAction ( ) ;
} ) ;
break ;
case 'next' :
$body . enjoyhint ( 'show_next' ) ;
break ;
}
} else {
$event _element . on ( event , function ( e ) {
if ( step _data . keyCode && e . keyCode != step _data . keyCode ) {
return ;
}
current _step ++ ;
$ ( this ) . off ( event ) ;
stepAction ( ) ; // clicked
} ) ;
}
var max _habarites = Math . max ( $element . outerWidth ( ) , $element . outerHeight ( ) ) ;
var radius = step _data . radius || Math . round ( max _habarites / 2 ) + 5 ;
var offset = $element . offset ( ) ;
var w = $element . outerWidth ( ) ;
var h = $element . outerHeight ( ) ;
var shape _margin = ( step _data . margin !== undefined ) ? step _data . margin : 10 ;
var coords = {
x : offset . left + Math . round ( w / 2 ) ,
y : offset . top + Math . round ( h / 2 ) - $ ( document ) . scrollTop ( )
} ;
var shape _data = {
enjoyHintElementSelector : step _data . selector ,
center _x : coords . x ,
center _y : coords . y ,
text : step _data . description ,
top : step _data . top ,
bottom : step _data . bottom ,
left : step _data . left ,
right : step _data . right ,
margin : step _data . margin ,
scroll : step _data . scroll
} ;
if ( step _data . shape && step _data . shape == 'circle' ) {
shape _data . shape = 'circle' ;
shape _data . radius = radius ;
} else {
shape _data . radius = 0 ;
shape _data . width = w + shape _margin ;
shape _data . height = h + shape _margin ;
}
$body . enjoyhint ( 'render_label_with_shape' , shape _data , that . stop ) ;
} , step _data . scrollAnimationSpeed + 20 || 270 ) ;
}
} ;
var nextStep = function ( ) {
current _step ++ ;
stepAction ( ) ;
} ;
var skipAll = function ( ) {
var step _data = data [ current _step ] ;
var $element = $ ( step _data . selector ) ;
off ( step _data . event ) ;
$element . off ( makeEventName ( step _data . event ) ) ;
destroyEnjoy ( ) ;
} ;
var makeEventName = function ( name , is _custom ) {
return name + ( is _custom ? 'custom' : '' ) + '.enjoy_hint' ;
} ;
var on = function ( event _name , callback ) {
$body . on ( makeEventName ( event _name , true ) , callback ) ;
} ;
var off = function ( event _name ) {
$body . off ( makeEventName ( event _name , true ) ) ;
} ;
/********************* PUBLIC METHODS ***************************************/
window . addEventListener ( 'resize' , function ( ) {
if ( $event _element != null ) {
$body . enjoyhint ( 'redo_events_near_rect' , $event _element [ 0 ] . getBoundingClientRect ( ) ) ;
}
} ) ;
that . stop = function ( ) {
skipAll ( ) ;
} ;
that . reRunScript = function ( cs ) {
current _step = cs ;
stepAction ( ) ;
} ;
that . runScript = function ( ) {
current _step = 0 ;
options . onStart ( ) ;
stepAction ( ) ;
} ;
that . resumeScript = function ( ) {
stepAction ( ) ;
} ;
that . setCurrentStep = function ( cs ) {
current _step = cs ;
} ;
that . getCurrentStep = function ( ) {
return current _step ;
} ;
that . trigger = function ( event _name ) {
switch ( event _name ) {
case 'next' :
nextStep ( ) ;
break ;
case 'skip' :
skipAll ( ) ;
break ;
}
} ;
that . setScript = function ( _data ) {
if ( _data ) {
data = _data ;
}
} ;
//support deprecated API methods
that . set = function ( _data ) {
that . setScript ( _data ) ;
} ;
that . setSteps = function ( _data ) {
that . setScript ( _data ) ;
} ;
that . run = function ( ) {
that . runScript ( ) ;
} ;
that . resume = function ( ) {
that . resumeScript ( ) ;
} ;
init ( ) ;
} ; ; CanvasRenderingContext2D . prototype . roundRect = function ( x , y , w , h , r ) {
if ( w < 2 * r ) r = w / 2 ;
if ( h < 2 * r ) r = h / 2 ;
this . beginPath ( ) ;
this . moveTo ( x + r , y ) ;
this . arcTo ( x + w , y , x + w , y + h , r ) ;
this . arcTo ( x + w , y + h , x , y + h , r ) ;
this . arcTo ( x , y + h , x , y , r ) ;
this . arcTo ( x , y , x + w , y , r ) ;
this . closePath ( ) ;
return this ;
} ;
( function ( $ ) {
var that ;
var originalLabelLeft , originalLabelTop ;
var originalArrowLeft , originalArrowTop ;
var originalCenterX , originalCenterY ;
var originalSkipbuttonLeft , originalSkipbuttonTop ;
var prevWindowWidth , prevWindowHeight ;
var originalWidth = window . innerWidth , originalHeight = window . innerHeight ;
var methods = {
init : function ( options ) {
return this . each ( function ( ) {
var defaults = {
onNextClick : function ( ) {
} ,
onSkipClick : function ( ) {
} ,
animation _time : 800
} ;
this . enjoyhint _obj = { } ;
that = this . enjoyhint _obj ;
that . resetComponentStuff = function ( ) {
originalLabelLeft = null ;
originalLabelTop = null ;
originalArrowLeft = null ;
originalArrowTop = null ;
originalCenterX = null ;
originalCenterY = null ;
originalSkipbuttonLeft = null ;
originalSkipbuttonTop = null ;
prevWindowWidth = null ;
prevWindowHeight = null ;
originalWidth = window . innerWidth ;
originalHeight = window . innerHeight ;
} ;
var $that = $ ( this ) ;
that . options = jQuery . extend ( defaults , options ) ;
//general classes
that . gcl = {
chooser : 'enjoyhint'
} ;
// classes
that . cl = {
enjoy _hint : 'enjoyhint' ,
hide : 'enjoyhint_hide' ,
disable _events _element : 'enjoyhint_disable_events' ,
btn : 'enjoyhint_btn' ,
skip _btn : 'enjoyhint_skip_btn' ,
close _btn : 'enjoyhint_close_btn' ,
next _btn : 'enjoyhint_next_btn' ,
main _canvas : 'enjoyhint_canvas' ,
main _svg : 'enjoyhint_svg' ,
svg _wrapper : 'enjoyhint_svg_wrapper' ,
svg _transparent : 'enjoyhint_svg_transparent' ,
kinetic _container : 'kinetic_container'
} ;
function makeSVG ( tag , attrs ) {
var el = document . createElementNS ( 'http://www.w3.org/2000/svg' , tag ) ;
for ( var k in attrs ) {
el . setAttribute ( k , attrs [ k ] ) ;
}
return el ;
}
// =======================================================================
// ========================---- enjoyhint ----==============================
// =======================================================================
that . canvas _size = {
w : $ ( window ) . width ( ) * 1.4 ,
h : $ ( window ) . height ( ) * 1.4
} ;
var canvas _id = "enj_canvas" ;
that . enjoyhint = $ ( '<div>' , { 'class' : that . cl . enjoy _hint + ' ' + that . cl . svg _transparent } ) . appendTo ( $that ) ;
that . enjoyhint _svg _wrapper = $ ( '<div>' , { 'class' : that . cl . svg _wrapper + ' ' + that . cl . svg _transparent } ) . appendTo ( that . enjoyhint ) ;
that . $stage _container = $ ( '<div id="' + that . cl . kinetic _container + '">' ) . appendTo ( that . enjoyhint ) ;
that . $canvas = $ ( '<canvas id="' + canvas _id + '" width="' + that . canvas _size . w + '" height="' + that . canvas _size . h + '" class="' + that . cl . main _canvas + '">' ) . appendTo ( that . enjoyhint ) ;
that . $svg = $ ( '<svg width="' + that . canvas _size . w + '" height="' + that . canvas _size . h + '" class="' + that . cl . main _canvas + ' ' + that . cl . main _svg + '">' ) . appendTo ( that . enjoyhint _svg _wrapper ) ;
var defs = $ ( makeSVG ( 'defs' ) ) ;
var marker = $ ( makeSVG ( 'marker' , { id : "arrowMarker" , viewBox : "0 0 36 21" , refX : "21" , refY : "10" , markerUnits : "strokeWidth" , orient : "auto" , markerWidth : "16" , markerHeight : "12" } ) ) ;
var polilyne = $ ( makeSVG ( 'path' , { style : "fill:none; stroke:rgb(255,255,255); stroke-width:2" , d : "M0,0 c30,11 30,9 0,20" } ) ) ;
defs . append ( marker . append ( polilyne ) ) . appendTo ( that . $svg ) ;
that . kinetic _stage = new Kinetic . Stage ( {
container : that . cl . kinetic _container ,
width : that . canvas _size . w ,
height : that . canvas _size . h ,
scaleX : 1
} ) ;
that . layer = new Kinetic . Layer ( ) ;
that . rect = new Kinetic . Rect ( {
fill : 'rgba(0,0,0,0.6)' ,
width : that . canvas _size . w ,
height : that . canvas _size . h
} ) ;
var $top _dis _events = $ ( '<div>' , { 'class' : that . cl . disable _events _element } ) . appendTo ( that . enjoyhint ) ;
var $bottom _dis _events = $top _dis _events . clone ( ) . appendTo ( that . enjoyhint ) ;
var $left _dis _events = $top _dis _events . clone ( ) . appendTo ( that . enjoyhint ) ;
var $right _dis _events = $top _dis _events . clone ( ) . appendTo ( that . enjoyhint ) ;
var stopPropagation = function ( e ) {
e . stopImmediatePropagation ( ) ;
} ;
$ ( "button" ) . focusout ( stopPropagation ) ;
$top _dis _events . click ( stopPropagation ) ;
$bottom _dis _events . click ( stopPropagation ) ;
$left _dis _events . click ( stopPropagation ) ;
$right _dis _events . click ( stopPropagation ) ;
that . $skip _btn = $ ( '<div>' , { 'class' : that . cl . skip _btn } ) . appendTo ( that . enjoyhint ) . html ( 'Skip' ) . click ( function ( e ) {
that . hide ( ) ;
that . options . onSkipClick ( ) ;
} ) ;
that . $next _btn = $ ( '<div>' , { 'class' : that . cl . next _btn } ) . appendTo ( that . enjoyhint ) . html ( 'Next' ) . click ( function ( e ) {
that . options . onNextClick ( ) ;
} ) ;
that . $close _btn = $ ( '<div>' , { 'class' : that . cl . close _btn } ) . appendTo ( that . enjoyhint ) . html ( '' ) . click ( function ( e ) {
that . hide ( ) ;
that . options . onSkipClick ( ) ;
} ) ;
that . $canvas . mousedown ( function ( e ) {
$ ( 'canvas' ) . css ( { left : '4000px' } ) ;
try {
var BottomElement = document . elementFromPoint ( e . clientX , e . clientY ) ;
$ ( 'canvas' ) . css ( { left : '0px' } ) ;
$ ( BottomElement ) . click ( ) ;
} catch ( e ) {
console . error ( "Failed to click on element from point. " + e ) ;
}
return false ;
} ) ;
var circle _r = 0 ;
var shape _init _shift = 130 ;
that . shape = new Kinetic . Shape ( {
radius : circle _r ,
center _x : - shape _init _shift ,
center _y : - shape _init _shift ,
width : 0 ,
height : 0 ,
sceneFunc : function ( context ) {
var ctx = this . getContext ( "2d" ) . _context ;
var pos = this . pos ;
var def _comp = ctx . globalCompositeOperation ;
ctx . globalCompositeOperation = 'destination-out' ;
ctx . beginPath ( ) ;
var x = this . attrs . center _x - Math . round ( this . attrs . width / 2 ) ;
var y = this . attrs . center _y - Math . round ( this . attrs . height / 2 ) ;
ctx . roundRect ( x , y , this . attrs . width , this . attrs . height , this . attrs . radius ) ;
ctx . fillStyle = "red" ;
ctx . fill ( ) ;
ctx . globalCompositeOperation = def _comp ;
}
} ) ;
that . shape . radius = circle _r ;
that . layer . add ( that . rect ) ;
that . layer . add ( that . shape ) ;
that . kinetic _stage . add ( that . layer ) ;
$ ( window ) . on ( 'resize' , function ( ) {
if ( ! ( $ ( that . stepData . enjoyHintElementSelector ) . is ( ":visible" ) ) ) {
that . stopFunction ( ) ;
$ ( window ) . off ( 'resize' ) ;
return ;
}
prevWindowWidth = window . innerWidth ;
prevWindowHeight = window . innerHeight ;
var boundingClientRect = $ ( that . stepData . enjoyHintElementSelector ) [ 0 ] . getBoundingClientRect ( ) ;
that . shape . attrs . center _x = Math . round ( boundingClientRect . left + boundingClientRect . width / 2 ) ;
that . shape . attrs . center _y = Math . round ( boundingClientRect . top + boundingClientRect . height / 2 ) ;
that . shape . attrs . width = boundingClientRect . width + 11 ;
that . shape . attrs . height = boundingClientRect . height + 11 ;
var newWidth = window . innerWidth ;
var newHeight = window . innerHeight ;
var scaleX = newWidth / originalWidth ;
var scaleY = newHeight / originalHeight ;
that . kinetic _stage . setAttr ( 'width' , originalWidth * scaleX ) ;
that . kinetic _stage . setAttr ( 'height' , originalHeight * scaleY ) ;
if ( that . stepData != null ) {
prevWindowWidth = window . innerWidth ;
prevWindowHeight = window . innerHeight ;
/* Init */
if ( ! originalCenterX ) {
originalCenterX = that . shape . attrs . center _x ;
originalCenterY = that . shape . attrs . center _y ;
}
if ( ! originalArrowLeft ) {
originalArrowLeft = [ ] ;
var attr = $ ( '#enjoyhint_arrpw_line' ) . attr ( 'd' ) ;
originalArrowLeft . push ( attr . substr ( 1 ) . split ( ',' ) [ 0 ] ) ;
originalArrowLeft . push ( attr . substr ( attr . indexOf ( 'Q' ) + 1 ) . split ( ',' ) [ 0 ] ) ;
originalArrowLeft . push ( attr . split ( ' ' ) [ 2 ] . split ( ',' ) [ 0 ] ) ;
originalArrowTop = [ ] ;
originalArrowTop . push ( attr . split ( ',' ) [ 1 ] . split ( ' ' ) [ 0 ] ) ;
originalArrowTop . push ( attr . split ( ',' ) [ 2 ] . split ( ' ' ) [ 0 ] ) ;
originalArrowTop . push ( attr . split ( ',' ) [ 3 ] ) ;
}
var labelElement = $ ( '.enjoy_hint_label' ) ;
if ( ! originalLabelLeft ) {
originalLabelLeft = labelElement [ 0 ] . getBoundingClientRect ( ) . left ;
originalLabelTop = labelElement [ 0 ] . getBoundingClientRect ( ) . top ;
}
var skipButton = $ ( '.enjoyhint_skip_btn' ) ;
if ( ! originalSkipbuttonLeft ) {
originalSkipbuttonLeft = skipButton [ 0 ] . getBoundingClientRect ( ) . left ;
originalSkipbuttonTop = skipButton [ 0 ] . getBoundingClientRect ( ) . top ;
}
/* Resizing label */
labelElement . css ( 'left' , window . innerWidth / 2 - labelElement . outerWidth ( ) / 2 ) ;
/* Resizing arrow */
var labelRect = labelElement [ 0 ] . getBoundingClientRect ( ) ;
if ( window . innerWidth < 640 ) {
$ ( '#enjoyhint_arrpw_line' ) . hide ( ) ;
labelElement . css ( 'top' , window . innerHeight / 2 - labelElement . outerHeight ( ) / 2 ) ;
} else {
$ ( '#enjoyhint_arrpw_line' ) . show ( ) ;
labelElement . css ( 'top' , originalLabelTop ) ;
var x1 , x2 , y1 , y2 ;
var labelLeftOfShape = labelRect . left + labelRect . width / 2 < that . shape . attrs . center _x ;
var labelAboveShape = labelRect . top + labelRect . height / 2 < that . shape . attrs . center _y ;
if ( window . innerWidth < 900 ) {
x1 = Math . round ( labelRect . left + ( labelRect . width / 2 + 15 ) * ( labelRect . left + labelRect . width / 2 < that . shape . attrs . center _x ? 1 : - 1 ) ) ;
y1 = Math . round ( labelRect . top + labelRect . height * ( labelRect . top + labelRect . height / 2 < that . shape . attrs . center _y ? 1 : - 1 ) ) ;
x2 = Math . round ( that . shape . attrs . center _x + ( that . shape . attrs . radius + 15 ) * ( labelLeftOfShape ? - 1 : 1 ) ) ;
y2 = Math . round ( that . shape . attrs . center _y ) ;
} else {
x1 = Math . round ( ( labelRect . left + ( labelRect . width / 2 ) ) + ( ( labelRect . width / 2 + 15 ) * ( labelLeftOfShape ? 1 : - 1 ) ) ) ;
y1 = Math . round ( labelRect . top + labelRect . height / 2 ) ;
x2 = Math . round ( that . shape . attrs . center _x ) ;
y2 = Math . round ( that . shape . attrs . center _y + ( ( ( that . shape . attrs . height / 2 ) + 15 ) * ( labelAboveShape ? - 1 : 1 ) ) ) ;
}
var midX = x1 + ( x2 - x1 ) / 2 ;
var midY = y1 + ( y2 - y1 ) / 2 ;
var bezX = x1 < x2 ? x2 : x1 ;
var bezY = y1 < y2 ? y1 : y2 ;
if ( Math . abs ( labelRect . left + labelRect . width / 2 - that . shape . attrs . center _x ) < 200 ) {
x1 = x2 = labelRect . left + labelRect . width / 2 ;
y1 = labelRect . top ;
bezX = x1 ;
bezY = y1 ;
console . log ( "ok" ) ;
}
if ( window . innerWidth < 900 ) {
bezX = x1 < x2 ? x1 : x2 ;
bezY = y1 < y2 ? y2 : y1 ;
}
var newCoordsLine = "M%d1,%d2 Q%d3,%d4 %d5,%d6"
. replace ( "%d1" , x1 ) . replace ( "%d2" , y1 )
. replace ( "%d3" , bezX ) . replace ( "%d4" , bezY )
. replace ( "%d5" , x2 ) . replace ( "%d6" , y2 ) ;
$ ( '#enjoyhint_arrpw_line' ) [ 0 ] . setAttribute ( 'd' , newCoordsLine ) ;
}
/* Resizing skip button */
var newSkipbuttonLeft = + originalSkipbuttonLeft + ( that . shape . attrs . center _x - originalCenterX ) / 2 ;
skipButton . css ( 'left' , newSkipbuttonLeft < 15 ? 15 : newSkipbuttonLeft ) ;
skipButton . css ( 'top' , labelRect . top + labelRect . height + 20 ) ;
}
that . rect = new Kinetic . Rect ( {
fill : 'rgba(0,0,0,0.6)' ,
width : window . innerWidth ,
height : window . innerHeight
} ) ;
that . layer . removeChildren ( ) ;
that . layer . add ( that . rect ) ;
that . layer . add ( that . shape ) ;
that . layer . draw ( ) ;
that . kinetic _stage . draw ( ) ;
} ) ;
var enjoyhint _elements = [
that . enjoyhint ,
$top _dis _events ,
$bottom _dis _events ,
$left _dis _events ,
$right _dis _events
] ;
that . show = function ( ) {
that . enjoyhint . removeClass ( that . cl . hide ) ;
} ;
that . hide = function ( ) {
that . enjoyhint . addClass ( that . cl . hide ) ;
var tween = new Kinetic . Tween ( {
node : that . shape ,
duration : 0.002 ,
center _x : - shape _init _shift ,
center _y : - shape _init _shift
} ) ;
tween . play ( ) ;
} ;
that . hide ( ) ;
that . hideNextBtn = function ( ) {
that . $next _btn . addClass ( that . cl . hide ) ;
that . nextBtn = "hide" ;
} ;
that . showNextBtn = function ( ) {
that . $next _btn . removeClass ( that . cl . hide ) ;
that . nextBtn = "show" ;
} ;
that . hideSkipBtn = function ( ) {
that . $skip _btn . addClass ( that . cl . hide ) ;
} ;
that . showSkipBtn = function ( ) {
that . $skip _btn . removeClass ( that . cl . hide ) ;
} ;
that . renderCircle = function ( data ) {
var r = data . r || 0 ;
var x = data . x || 0 ;
var y = data . y || 0 ;
var tween = new Kinetic . Tween ( {
node : that . shape ,
duration : 0.2 ,
center _x : x ,
center _y : y ,
width : r * 2 ,
height : r * 2 ,
radius : r
} ) ;
tween . play ( ) ;
var left = x - r ;
var right = x + r ;
var top = y - r ;
var bottom = y + r ;
var margin = 20 ;
return {
x : x ,
y : y ,
left : left ,
right : right ,
top : top ,
bottom : bottom ,
conn : {
left : {
x : left - margin ,
y : y
} ,
right : {
x : right + margin ,
y : y
} ,
top : {
x : x ,
y : top - margin
} ,
bottom : {
x : x ,
y : bottom + margin
}
}
} ;
} ;
that . renderRect = function ( data , timeout ) {
var r = data . r || 0 ;
var x = data . x || 0 ;
var y = data . y || 0 ;
var w = data . w || 0 ;
var h = data . h || 0 ;
var margin = 20 ;
var tween = new Kinetic . Tween ( {
node : that . shape ,
duration : timeout ,
center _x : x ,
center _y : y ,
width : w ,
height : h ,
radius : r
} ) ;
tween . play ( ) ;
var half _w = Math . round ( w / 2 ) ;
var half _h = Math . round ( h / 2 ) ;
var left = x - half _w ;
var right = x + half _w ;
var top = y - half _h ;
var bottom = y + half _h ;
return {
x : x ,
y : y ,
left : left ,
right : right ,
top : top ,
bottom : bottom ,
conn : {
left : {
x : left - margin ,
y : y
} ,
right : {
x : right + margin ,
y : y
} ,
top : {
x : x ,
y : top - margin
} ,
bottom : {
x : x ,
y : bottom + margin
}
}
} ;
} ;
that . renderLabel = function ( data ) {
var x = data . x || 0 ;
that . originalElementX = x ;
var y = data . y || 0 ;
var text = data . text || 0 ;
var label = that . getLabelElement ( {
x : x ,
y : y ,
text : data . text
} ) ;
var label _w = label . width ( ) ;
var label _h = label . height ( ) ;
var label _left = label . offset ( ) . left ;
var label _right = label . offset ( ) . left + label _w ;
var label _top = label . offset ( ) . top - $ ( document ) . scrollTop ( ) ;
var label _bottom = label . offset ( ) . top + label _h ;
var margin = 10 ;
var conn _left = {
x : label _left - margin ,
y : label _top + Math . round ( label _h / 2 )
} ;
var conn _right = {
x : label _right + margin ,
y : label _top + Math . round ( label _h / 2 )
} ;
var conn _top = {
x : label _left + Math . round ( label _w / 2 ) ,
y : label _top - margin
} ;
var conn _bottom = {
x : label _left + Math . round ( label _w / 2 ) ,
y : label _bottom + margin
} ;
label . detach ( ) ;
setTimeout ( function ( ) {
$ ( '#enjoyhint_label' ) . remove ( ) ;
label . appendTo ( that . enjoyhint ) ;
} , that . options . animation _time / 2 ) ;
return {
label : label ,
left : label _left ,
right : label _right ,
top : label _top ,
bottom : label _bottom ,
conn : {
left : conn _left ,
right : conn _right ,
top : conn _top ,
bottom : conn _bottom
}
} ;
} ;
that . renderArrow = function ( data ) {
if ( window . innerWidth >= 640 ) {
var x _from = data . x _from || 0 ;
var y _from = data . y _from || 0 ;
var x _to = data . x _to || 0 ;
var y _to = data . y _to || 0 ;
var by _top _side = data . by _top _side ;
var control _point _x = 0 ;
var control _point _y = 0 ;
if ( by _top _side ) {
if ( y _from >= y _to ) {
control _point _y = y _to ;
control _point _x = x _from ;
} else {
control _point _y = y _from ;
control _point _x = x _to ;
}
} else {
if ( y _from >= y _to ) {
control _point _y = y _from ;
control _point _x = x _to ;
} else {
control _point _y = y _to ;
control _point _x = x _from ;
}
}
}
var text = data . text || '' ;
that . enjoyhint . addClass ( that . cl . svg _transparent ) ;
setTimeout ( function ( ) {
$ ( '#enjoyhint_arrpw_line' ) . remove ( ) ;
var d = 'M' + x _from + ',' + y _from + ' Q' + control _point _x + ',' + control _point _y + ' ' + x _to + ',' + y _to ;
that . $svg . append ( makeSVG ( 'path' , { style : "fill:none; stroke:rgb(255,255,255); stroke-width:3" , 'marker-end' : "url(" + location . href + "#arrowMarker)" , d : d , id : 'enjoyhint_arrpw_line' } ) ) ;
that . enjoyhint . removeClass ( that . cl . svg _transparent ) ;
} , that . options . animation _time / 2 ) ;
} ;
that . getLabelElement = function ( data ) {
return $ ( '<div>' , { "class" : 'enjoy_hint_label' , id : 'enjoyhint_label' } )
. css ( {
'top' : data . y + 'px' ,
'left' : data . x + 'px'
} )
. html ( data . text ) . appendTo ( that . enjoyhint ) ;
} ;
that . disableEventsNearRect = function ( rect ) {
$top _dis _events . css ( {
top : '0' ,
left : '0'
} ) . height ( rect . top ) ;
$bottom _dis _events . css ( {
top : rect . bottom + 'px' ,
left : '0'
} ) ;
$left _dis _events . css ( {
top : '0' ,
left : 0 + 'px'
} ) . width ( rect . left ) ;
$right _dis _events . css ( {
top : '0' ,
left : rect . right + 'px'
} ) ;
} ;
( function ( $ ) {
$ . event . special . destroyed = {
remove : function ( o ) {
if ( o . handler ) {
o . handler ( )
}
}
}
} ) ( jQuery ) ;
that . renderLabelWithShape = function ( data ) {
that . stepData = data ;
function findParentDialog ( element ) {
if ( element . tagName === "MD-DIALOG" ) {
return element ;
} else if ( typeof element . tagName == "undefined" ) {
return null ;
} else {
return findParentDialog ( $ ( element ) . parent ( ) [ 0 ] ) ;
}
}
var dialog = findParentDialog ( $ ( that . stepData . enjoyHintElementSelector ) [ 0 ] ) ;
if ( dialog != null ) {
$ ( dialog ) . on ( 'dialogClosing' , function ( ) {
that . stopFunction ( ) ;
return ;
} ) ;
}
that . resetComponentStuff ( ) ;
var shape _type = data . shape || 'rect' ;
var shape _data = { } ;
var half _w = 0 ;
var half _h = 0 ;
var shape _offsets = {
top : data . top || 0 ,
bottom : data . bottom || 0 ,
left : data . left || 0 ,
right : data . right || 0
} ;
switch ( shape _type ) {
case 'circle' :
half _w = half _h = data . radius ;
var sides _pos = {
top : data . center _y - half _h + shape _offsets . top ,
bottom : data . center _y + half _h - shape _offsets . bottom ,
left : data . center _x - half _w + shape _offsets . left ,
right : data . center _x + half _w - shape _offsets . right
} ;
var width = sides _pos . right - sides _pos . left ;
var height = sides _pos . bottom - sides _pos . top ;
data . radius = Math . round ( Math . min ( width , height ) / 2 ) ;
//new half habarites
half _w = half _h = Math . round ( data . radius / 2 ) ;
var new _half _w = Math . round ( width / 2 ) ;
var new _half _h = Math . round ( height / 2 ) ;
//new center_x and center_y
data . center _x = sides _pos . left + new _half _w ;
data . center _y = sides _pos . top + new _half _h ;
shape _data = that . renderCircle ( {
x : data . center _x ,
y : data . center _y ,
r : data . radius
} ) ;
break ;
case 'rect' :
half _w = Math . round ( data . width / 2 ) ;
half _h = Math . round ( data . height / 2 ) ;
var sides _pos = {
top : data . center _y - half _h + shape _offsets . top ,
bottom : data . center _y + half _h - shape _offsets . bottom ,
left : data . center _x - half _w + shape _offsets . left ,
right : data . center _x + half _w - shape _offsets . right
} ;
data . width = sides _pos . right - sides _pos . left ;
data . height = sides _pos . bottom - sides _pos . top ;
half _w = Math . round ( data . width / 2 ) ;
half _h = Math . round ( data . height / 2 ) ;
//new center_x and center_y
data . center _x = sides _pos . left + half _w ;
data . center _y = sides _pos . top + half _h ;
shape _data = that . renderRect ( {
x : data . center _x ,
y : data . center _y ,
w : data . width ,
h : data . height ,
r : data . radius
} , 0.2 ) ;
break ;
}
var body _size = {
w : that . enjoyhint . width ( ) ,
h : that . enjoyhint . height ( )
} ;
var label = that . getLabelElement ( {
x : 0 ,
y : 0 ,
text : data . text
} ) ;
var label _width = label . outerWidth ( ) ;
var label _height = label . outerHeight ( ) ;
label . remove ( ) ;
var top _offset = data . center _y - half _h ;
var bottom _offset = body _size . h - ( data . center _y + half _h ) ;
var left _offset = data . center _x - half _w ;
var right _offset = body _size . w - ( data . center _x + half _w ) ;
var label _hor _side = ( body _size . w - data . center _x ) < data . center _x ? 'left' : 'right' ;
var label _ver _side = ( body _size . h - data . center _y ) < data . center _y ? 'top' : 'bottom' ;
var label _shift = 150 ;
var label _margin = 40 ;
var label _shift _with _label _width = label _shift + label _width + label _margin ;
var label _shift _with _label _height = label _shift + label _height + label _margin ;
var label _hor _offset = half _w + label _shift ;
var label _ver _offset = half _h + label _shift ;
//original: var label_x = (label_hor_side == 'left') ? data.center_x - label_hor_offset - label_width : data.center_x + label_hor_offset;
var label _y = ( label _ver _side == 'top' ) ? data . center _y - label _ver _offset - label _height : data . center _y + label _ver _offset ;
var label _x = window . innerWidth / 2 - label _width / 2 ;
if ( top _offset < label _shift _with _label _height && bottom _offset < label _shift _with _label _height ) {
label _y = data . center _y + label _margin ;
}
if ( window . innerWidth <= 640 ) {
}
var label _data = that . renderLabel ( {
x : label _x ,
y : label _y ,
text : data . text
} ) ;
var next _btn _x = window . innerWidth / 2 - that . $next _btn . width ( ) / 2 ;
that . $next _btn . css ( {
left : next _btn _x ,
top : label _y + label _height + 20
} ) ;
var left _skip = next _btn _x + that . $next _btn . width ( ) + 30 ;
if ( that . nextBtn == "hide" ) {
left _skip = label _x ;
}
that . $skip _btn . css ( {
left : left _skip ,
top : label _y + label _height + 20
} ) ;
that . $close _btn . css ( {
right : 10 ,
top : 10
} ) ;
that . disableEventsNearRect ( {
top : shape _data . top ,
bottom : shape _data . bottom ,
left : shape _data . left ,
right : shape _data . right
} ) ;
var x _to = 0 ;
var y _to = 0 ;
var arrow _side = false ;
var conn _label _side = 'left' ;
var conn _circle _side = 'left' ;
var is _center = ( label _data . left <= shape _data . x && label _data . right >= shape _data . x ) ;
var is _left = ( label _data . right < shape _data . x ) ;
var is _right = ( label _data . left > shape _data . x ) ;
var is _abs _left = ( label _data . right < shape _data . left ) ;
var is _abs _right = ( label _data . left > shape _data . right ) ;
var is _top = ( label _data . bottom < shape _data . top ) ;
var is _bottom = ( label _data . top > shape _data . bottom ) ;
var is _mid = ( label _data . bottom >= shape _data . y && label _data . top <= shape _data . y ) ;
var is _mid _top = ( label _data . bottom <= shape _data . y && ! is _top ) ;
var is _mid _bottom = ( label _data . top >= shape _data . y && ! is _bottom ) ;
function setArrowData ( l _s , c _s , a _s ) {
conn _label _side = l _s ;
conn _circle _side = c _s ;
arrow _side = a _s ;
}
function sideStatements ( top _s , mid _top _s , mid _s , mid _bottom _s , bottom _s ) {
var statement = [ ] ;
if ( is _top ) {
statement = top _s ;
} else if ( is _mid _top ) {
statement = mid _top _s ;
} else if ( is _mid ) {
statement = mid _s ;
} else if ( is _mid _bottom ) {
statement = mid _bottom _s ;
} else { //bottom
statement = bottom _s ;
}
if ( ! statement ) {
return ;
} else {
setArrowData ( statement [ 0 ] , statement [ 1 ] , statement [ 2 ] ) ;
}
}
if ( is _center ) {
if ( is _top ) {
setArrowData ( 'bottom' , 'top' , 'top' ) ;
} else if ( is _bottom ) {
setArrowData ( 'top' , 'bottom' , 'bottom' ) ;
} else {
return ;
}
} else if ( is _left ) {
sideStatements (
[ 'right' , 'top' , 'top' ] , //top
[ 'bottom' , 'left' , 'bottom' ] , //mid_top
[ 'right' , 'left' , 'top' ] , //mid
[ 'top' , 'left' , 'top' ] , //mid_bot
[ 'right' , 'bottom' , 'bottom' ] //bot
) ;
} else { //right
sideStatements (
[ 'left' , 'top' , 'top' ] , //top
[ 'bottom' , 'right' , 'bottom' ] , //mid_top
[ 'left' , 'right' , 'top' ] , //mid
[ 'top' , 'right' , 'top' ] , //mid_bot
[ 'left' , 'bottom' , 'bottom' ] //bot
) ;
}
var label _conn _coordinates = label _data . conn [ conn _label _side ] ;
var circle _conn _coordinates = shape _data . conn [ conn _circle _side ] ;
var by _top _side = ( arrow _side == 'top' ) ;
that . renderArrow ( {
x _from : label _conn _coordinates . x ,
y _from : label _conn _coordinates . y ,
x _to : window . innerWidth < 640 ? shape _data . left + ( shape _data . left > 0 ) : circle _conn _coordinates . x ,
y _to : window . innerWidth < 640 ? shape _data . conn . left . y : circle _conn _coordinates . y ,
by _top _side : by _top _side
} ) ;
} ;
that . clear = function ( ) {
that . ctx . clearRect ( 0 , 0 , 3000 , 2000 ) ;
} ;
return this ;
} ) ;
} ,
set : function ( val ) {
this . each ( function ( ) {
this . enjoyhint _obj . setValue ( val ) ;
} ) ;
return this ;
} ,
show : function ( ) {
this . each ( function ( ) {
this . enjoyhint _obj . show ( ) ;
} ) ;
return this ;
} ,
hide : function ( ) {
this . each ( function ( ) {
this . enjoyhint _obj . hide ( ) ;
} ) ;
return this ;
} ,
hide _next : function ( ) {
this . each ( function ( ) {
this . enjoyhint _obj . hideNextBtn ( ) ;
} ) ;
return this ;
} ,
show _next : function ( ) {
this . each ( function ( ) {
this . enjoyhint _obj . showNextBtn ( ) ;
} ) ;
return this ;
} ,
hide _skip : function ( ) {
this . each ( function ( ) {
this . enjoyhint _obj . hideSkipBtn ( ) ;
} ) ;
return this ;
} ,
show _skip : function ( ) {
this . each ( function ( ) {
this . enjoyhint _obj . showSkipBtn ( ) ;
} ) ;
return this ;
} ,
render _circle : function ( x , y , r ) {
this . each ( function ( ) {
this . enjoyhint _obj . renderCircle ( x , y , r ) ;
} ) ;
return this ;
} ,
render _label : function ( x , y , r ) {
this . each ( function ( ) {
this . enjoyhint _obj . renderLabel ( x , y , r ) ;
} ) ;
return this ;
} ,
render _label _with _shape : function ( data , stopFunction ) {
this . each ( function ( ) {
that . stopFunction = stopFunction ;
this . enjoyhint _obj . renderLabelWithShape ( data ) ;
} ) ;
return this ;
} ,
redo _events _near _rect : function ( rect ) {
that . disableEventsNearRect ( {
top : rect . top ,
bottom : rect . bottom ,
left : rect . left ,
right : rect . right
} ) ;
} ,
clear : function ( ) {
this . each ( function ( ) {
this . enjoyhint _obj . clear ( ) ;
} ) ;
return this ;
} ,
close : function ( val ) {
this . each ( function ( ) {
this . enjoyhint _obj . closePopdown ( ) ;
} ) ;
return this ;
}
} ;
$ . fn . enjoyhint = function ( method ) {
if ( methods [ method ] ) {
return methods [ method ] . apply ( this , Array . prototype . slice . call ( arguments , 1 ) ) ;
} else if ( typeof method === 'object' || ! method ) {
return methods . init . apply ( this , arguments ) ;
} else {
$ . error ( 'Method ' + method + ' does not exist on $.numinput' ) ;
}
return this ;
} ;
} ) ( window . jQuery ) ; ; /*! KineticJS v5.2.0 2015-01-22 http://lavrton.github.io/KineticJS/ by Eric Rowell @ericdrowell, Anton Lavrenov @lavrton - MIT License https://github.com/lavrton/KineticJS/wiki/License*/
var Kinetic = { } ; ! function ( a ) { var b = Math . PI / 180 ; Kinetic = { version : "5.2.0" , stages : [ ] , idCounter : 0 , ids : { } , names : { } , shapes : { } , listenClickTap : ! 1 , inDblClickWindow : ! 1 , enableTrace : ! 1 , traceArrMax : 100 , dblClickWindow : 400 , pixelRatio : void 0 , dragDistance : 0 , angleDeg : ! 0 , showWarnings : ! 0 , Filters : { } , Node : function ( a ) { this . _init ( a ) } , Shape : function ( a ) { this . _ _init ( a ) } , Container : function ( a ) { this . _ _init ( a ) } , Stage : function ( a ) { this . _ _ _init ( a ) } , BaseLayer : function ( a ) { this . _ _ _init ( a ) } , Layer : function ( a ) { this . _ _ _ _init ( a ) } , FastLayer : function ( a ) { this . _ _ _ _init ( a ) } , Group : function ( a ) { this . _ _ _init ( a ) } , isDragging : function ( ) { var a = Kinetic . DD ; return a ? a . isDragging : ! 1 } , isDragReady : function ( ) { var a = Kinetic . DD ; return a ? ! ! a . node : ! 1 } , _addId : function ( a , b ) { void 0 !== b && ( this . ids [ b ] = a ) } , _removeId : function ( a ) { void 0 !== a && delete this . ids [ a ] } , _addName : function ( a , b ) { if ( void 0 !== b ) for ( var c = b . split ( /\s/g ) , d = 0 ; d < c . length ; d ++ ) { var e = c [ d ] ; e && ( void 0 === this . names [ e ] && ( this . names [ e ] = [ ] ) , this . names [ e ] . push ( a ) ) } } , _removeName : function ( a , b ) { if ( void 0 !== a ) { var c = this . names [ a ] ; if ( void 0 !== c ) { for ( var d = 0 ; d < c . length ; d ++ ) { var e = c [ d ] ; e . _id === b && c . splice ( d , 1 ) } 0 === c . length && delete this . names [ a ] } } } , getAngle : function ( a ) { return this . angleDeg ? a * b : a } , _parseUA : function ( a ) { var b = a . toLowerCase ( ) , c = /(chrome)[ \/]([\w.]+)/ . exec ( b ) || /(webkit)[ \/]([\w.]+)/ . exec ( b ) || /(opera)(?:.*version|)[ \/]([\w.]+)/ . exec ( b ) || /(msie) ([\w.]+)/ . exec ( b ) || b . indexOf ( "compatible" ) < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/ . exec ( b ) || [ ] , d = ! ! a . match ( /Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i ) , e = ! ! a . match ( /IEMobile/i ) ; return { browser : c [ 1 ] || "" , version : c [ 2 ] || "0" , mobile : d , ieMobile : e } } , UA : void 0 } , Kinetic . UA = Kinetic . _parseUA ( a . navigator && a . navigator . userAgent || "" ) } ( this ) , function ( a , b ) { if ( "object" == typeof exports ) { var c = b ( ) ; if ( global . window === global ) Kinetic . document = global . document , Kinetic . window = global ; else { var d = require ( "canvas" ) , e = require ( "jsdom" ) . jsdom ; Kinetic . document = e ( "<!DOCTYPE html><html><head></head><body></body></html>" ) , Kinetic . window = Kinetic . document . createWindow ( ) , Kinetic . window . Image = d . Image , Kinetic . _nodeCanvas = d } return Kinetic . root = a , void ( module . exports = c ) } "function" == typeof define && define . amd && define ( b ) , Kinetic . document = document , Kinetic . window = window , Kinetic . root = a } ( this , function ( ) { return Kinetic } ) , function ( ) { Kinetic . Collection = function ( ) { var a = [ ] . slice . call ( arguments ) , b = a . length , c = 0 ; for ( this . length = b ; b > c ; c ++ ) this [ c ] = a [ c ] ; return this } , Kinetic . Collection . prototype = [ ] , Kinetic . Collection . prototype . each = function ( a ) { for ( var b = 0 ; b < this . length ; b ++ ) a ( this [ b ] , b ) } , Kinetic . Collection . prototype . toArray = function ( ) { var a , b = [ ] , c = this . length ; for ( a = 0 ; c > a ; a ++ ) b . push ( this [ a ] ) ; return b } , Kinetic . Collection . toCollection = function ( a ) { var b , c = new Kinetic . Collection , d = a . length ; for ( b = 0 ; d > b ; b ++ ) c . push ( a [ b ] ) ; return c } , Kinetic . Collection . _mapMethod = function ( a ) { Kinetic . Collection . prototype [ a ] = function ( ) { var b , c = this . length , d = [ ] . slice . call ( arguments ) ; for ( b = 0 ; c > b ; b ++ ) this [ b ] [ a ] . apply ( this [ b ] , d ) ; return this } } , Kinetic . Collection . mapMethods = function ( a ) { var b = a . prototype ; for ( var c in b ) Kinetic . Collection . _mapMethod ( c ) } , Kinetic . Transform = function ( a ) { this . m = a && a . slice ( ) || [ 1 , 0 , 0 , 1 , 0 , 0 ] } , Kinetic . Transform . prototype = { copy : function ( ) { return new Kinetic . Transform ( this . m ) } , point : function ( a ) { var b = this . m ; return { x : b [ 0 ] * a . x + b [ 2 ] * a . y + b [ 4 ] , y : b [ 1 ] * a . x + b [ 3 ] * a . y + b [ 5 ] } } , translate : function ( a , b ) { return this . m [ 4 ] += this . m [ 0 ] * a + this . m [ 2 ] * b , this . m [ 5 ] += this . m [ 1 ] * a + this . m [ 3 ] * b , this } , scale : function ( a , b ) { return this . m [ 0 ] *= a , this . m [ 1 ] *= a , this . m [ 2 ] *= b , this . m [ 3 ] *= b , this } , rotate : function ( a ) { var b = Math . cos ( a ) , c = Math . sin ( a ) , d = this . m [ 0 ] * b + this . m [ 2 ] * c , e = this . m [ 1 ] * b + this . m [ 3 ] * c , f = this . m [ 0 ] * - c + this . m [ 2 ] * b , g = this . m [ 1 ] * - c + this . m [ 3 ] * b ; return this . m [ 0 ] = d , this . m [ 1 ] = e , this . m [ 2 ] = f , this . m [ 3 ] = g , this } , getTranslation : function ( ) { return { x : this . m [ 4 ] , y : this . m [ 5 ] } } , skew : function ( a , b ) { var c = this . m [ 0 ] + this . m [ 2 ] * b , d = this . m [ 1 ] + this . m [ 3 ] * b , e = this . m [ 2 ] + this . m [ 0 ] * a , f = this . m [ 3 ] + this . m [ 1 ] * a ; return this . m [ 0 ] = c , this . m [ 1 ] = d , this . m [ 2 ] = e , this . m [ 3 ] = f , this } , multiply : function ( a ) { var b = this . m [ 0 ] * a . m [ 0 ] + this . m [ 2 ] * a . m [ 1 ] , c = this . m [ 1 ] * a . m [ 0 ] + this . m [ 3 ] * a . m [ 1 ] , d = this . m [ 0 ] * a . m [ 2 ] + this . m [ 2 ] * a . m [ 3 ] , e = this . m [ 1 ] * a . m [ 2 ] + this
} , _get : function ( a ) { return this . className === a || this . nodeType === a ? [ this ] : [ ] } , _off : function ( a , b ) { var c , d , e = this . eventListeners [ a ] ; for ( c = 0 ; c < e . length ; c ++ ) if ( d = e [ c ] . name , ! ( "kinetic" === d && "kinetic" !== b || b && d !== b ) ) { if ( e . splice ( c , 1 ) , 0 === e . length ) { delete this . eventListeners [ a ] ; break } c -- } } , _fireChangeEvent : function ( a , b , d ) { this . _fire ( a + c , { oldVal : b , newVal : d } ) } , setId : function ( a ) { var b = this . getId ( ) ; return Kinetic . _removeId ( b ) , Kinetic . _addId ( this , a ) , this . _setAttr ( h , a ) , this } , setName : function ( a ) { var b = this . getName ( ) ; return Kinetic . _removeName ( b , this . _id ) , Kinetic . _addName ( this , a ) , this . _setAttr ( m , a ) , this } , setAttr : function ( a , b ) { var c = n + Kinetic . Util . _capitalize ( a ) , d = this [ c ] ; return Kinetic . Util . _isFunction ( d ) ? d . call ( this , b ) : this . _setAttr ( a , b ) , this } , _setAttr : function ( a , b ) { var c ; void 0 !== b && ( c = this . attrs [ a ] , this . attrs [ a ] = b , this . _fireChangeEvent ( a , c , b ) ) } , _setComponentAttr : function ( a , b , c ) { var d ; void 0 !== c && ( d = this . attrs [ a ] , d || ( this . attrs [ a ] = this . getAttr ( a ) ) , this . attrs [ a ] [ b ] = c , this . _fireChangeEvent ( a , d , c ) ) } , _fireAndBubble : function ( a , b , c ) { var d = ! 0 ; if ( b && this . nodeType === o && ( b . target = this ) , a === k && c && ( this . _id === c . _id || this . isAncestorOf && this . isAncestorOf ( c ) ) ? d = ! 1 : a === l && c && ( this . _id === c . _id || this . isAncestorOf && this . isAncestorOf ( c ) ) && ( d = ! 1 ) , d ) { this . _fire ( a , b ) ; var e = ( a === k || a === l ) && ( c && c . isAncestorOf && c . isAncestorOf ( this ) || ! ( ! c || ! c . isAncestorOf ) ) ; b && ! b . cancelBubble && this . parent && this . parent . isListening ( ) && ! e && ( c && c . parent ? this . _fireAndBubble . call ( this . parent , a , b , c . parent ) : this . _fireAndBubble . call ( this . parent , a , b ) ) } } , _fire : function ( a , b ) { var c , d = this . eventListeners [ a ] ; if ( b . type = a , d ) for ( c = 0 ; c < d . length ; c ++ ) d [ c ] . handler . call ( this , b ) } , draw : function ( ) { return this . drawScene ( ) , this . drawHit ( ) , this } } ) , Kinetic . Node . create = function ( a , b ) { return this . _createNode ( JSON . parse ( a ) , b ) } , Kinetic . Node . _createNode = function ( a , b ) { var c , d , e , f = Kinetic . Node . prototype . getClassName . call ( a ) , g = a . children ; if ( b && ( a . attrs . container = b ) , c = new Kinetic [ f ] ( a . attrs ) , g ) for ( d = g . length , e = 0 ; d > e ; e ++ ) c . add ( this . _createNode ( g [ e ] ) ) ; return c } , Kinetic . Factory . addOverloadedGetterSetter ( Kinetic . Node , "position" ) , Kinetic . Factory . addGetterSetter ( Kinetic . Node , "x" , 0 ) , Kinetic . Factory . addGetterSetter ( Kinetic . Node , "y" , 0 ) , Kinetic . Factory . addGetterSetter ( Kinetic . Node , "opacity" , 1 ) , Kinetic . Factory . addGetter ( Kinetic . Node , "name" ) , Kinetic . Factory . addOverloadedGetterSetter ( Kinetic . Node , "name" ) , Kinetic . Factory . addGetter ( Kinetic . Node , "id" ) , Kinetic . Factory . addOverloadedGetterSetter ( Kinetic . Node , "id" ) , Kinetic . Factory . addGetterSetter ( Kinetic . Node , "rotation" , 0 ) , Kinetic . Factory . addComponentsGetterSetter ( Kinetic . Node , "scale" , [ "x" , "y" ] ) , Kinetic . Factory . addGetterSetter ( Kinetic . Node , "scaleX" , 1 ) , Kinetic . Factory . addGetterSetter ( Kinetic . Node , "scaleY" , 1 ) , Kinetic . Factory . addComponentsGetterSetter ( Kinetic . Node , "skew" , [ "x" , "y" ] ) , Kinetic . Factory . addGetterSetter ( Kinetic . Node , "skewX" , 0 ) , Kinetic . Factory . addGetterSetter ( Kinetic . Node , "skewY" , 0 ) , Kinetic . Factory . addComponentsGetterSetter ( Kinetic . Node , "offset" , [ "x" , "y" ] ) , Kinetic . Factory . addGetterSetter ( Kinetic . Node , "offsetX" , 0 ) , Kinetic . Factory . addGetterSetter ( Kinetic . Node , "offsetY" , 0 ) , Kinetic . Factory . addSetter ( Kinetic . Node , "dragDistance" ) , Kinetic . Factory . addOverloadedGetterSetter ( Kinetic . Node , "dragDistance" ) , Kinetic . Factory . addSetter ( Kinetic . Node , "width" , 0 ) , Kinetic . Factory . addOverloadedGetterSetter ( Kinetic . Node , "width" ) , Kinetic . Factory . addSetter ( Kinetic . Node , "height" , 0 ) , Kinetic . Factory . addOverloadedGetterSetter ( Kinetic . Node , "height" ) , Kinetic . Factory . addGetterSetter ( Kinetic . Node , "listening" , "inherit" ) , Kinetic . Factory . addGetterSetter ( Kinetic . Node , "filters" , void 0 , function ( a ) { return this . _filterUpToDate = ! 1 , a } ) , Kinetic . Factory . addGetterSetter ( Kinetic . Node , "visible" , "inherit" ) , Kinetic . Factory . addGetterSetter ( Kinetic . Node , "transformsEnabled" , "all" ) , Kinetic . Factory . addOverloadedGetterSetter ( Kinetic . Node , "size" ) , Kinetic . Factory . backCompat ( Kinetic . Node , { rotateDeg : "rotate" , setRotationDeg : "setRotation" , getRotationDeg : "getRotation" } ) , Kinetic . Collection . mapMethods ( Kinetic . Node ) } ( ) , function ( ) { Kinetic . Filters . Grayscale = function ( a ) { var b , c , d = a . data , e = d . length ; for ( b = 0 ; e > b ; b += 4 ) c = . 34 * d [ b ] + . 5 * d [ b + 1 ] + . 16 * d [ b + 2 ] , d
a . children = [ ] ; for ( var b = this . getChildren ( ) , c = b . length , d = 0 ; c > d ; d ++ ) { var e = b [ d ] ; a . children . push ( e . toObject ( ) ) } return a } , _getDescendants : function ( a ) { for ( var b = [ ] , c = a . length , d = 0 ; c > d ; d ++ ) { var e = a [ d ] ; this . isAncestorOf ( e ) && b . push ( e ) } return b } , isAncestorOf : function ( a ) { for ( var b = a . getParent ( ) ; b ; ) { if ( b . _id === this . _id ) return ! 0 ; b = b . getParent ( ) } return ! 1 } , clone : function ( a ) { var b = Kinetic . Node . prototype . clone . call ( this , a ) ; return this . getChildren ( ) . each ( function ( a ) { b . add ( a . clone ( ) ) } ) , b } , getAllIntersections : function ( a ) { var b = [ ] ; return this . find ( "Shape" ) . each ( function ( c ) { c . isVisible ( ) && c . intersects ( a ) && b . push ( c ) } ) , b } , _setChildrenIndices : function ( ) { this . children . each ( function ( a , b ) { a . index = b } ) } , drawScene : function ( a , b ) { var c = this . getLayer ( ) , d = a || c && c . getCanvas ( ) , e = d && d . getContext ( ) , f = this . _cache . canvas , g = f && f . scene ; return this . isVisible ( ) && ( g ? this . _drawCachedSceneCanvas ( e ) : this . _drawChildren ( d , "drawScene" , b ) ) , this } , drawHit : function ( a , b ) { var c = this . getLayer ( ) , d = a || c && c . hitCanvas , e = d && d . getContext ( ) , f = this . _cache . canvas , g = f && f . hit ; return this . shouldDrawHit ( d ) && ( c && c . clearHitCache ( ) , g ? this . _drawCachedHitCanvas ( e ) : this . _drawChildren ( d , "drawHit" , b ) ) , this } , _drawChildren : function ( a , b , c ) { var d , e , f = this . getLayer ( ) , g = a && a . getContext ( ) , h = this . getClipWidth ( ) , i = this . getClipHeight ( ) , j = h && i ; j && f && ( d = this . getClipX ( ) , e = this . getClipY ( ) , g . save ( ) , f . _applyTransform ( this , g ) , g . beginPath ( ) , g . rect ( d , e , h , i ) , g . clip ( ) , g . reset ( ) ) , this . children . each ( function ( d ) { d [ b ] ( a , c ) } ) , j && g . restore ( ) } , shouldDrawHit : function ( a ) { var b = this . getLayer ( ) , c = Kinetic . DD , d = c && Kinetic . isDragging ( ) && - 1 !== Kinetic . DD . anim . getLayers ( ) . indexOf ( b ) ; return a && a . isCache || b && b . hitGraphEnabled ( ) && this . isVisible ( ) && ! d } } ) , Kinetic . Util . extend ( Kinetic . Container , Kinetic . Node ) , Kinetic . Container . prototype . get = Kinetic . Container . prototype . find , Kinetic . Factory . addComponentsGetterSetter ( Kinetic . Container , "clip" , [ "x" , "y" , "width" , "height" ] ) , Kinetic . Factory . addGetterSetter ( Kinetic . Container , "clipX" ) , Kinetic . Factory . addGetterSetter ( Kinetic . Container , "clipY" ) , Kinetic . Factory . addGetterSetter ( Kinetic . Container , "clipWidth" ) , Kinetic . Factory . addGetterSetter ( Kinetic . Container , "clipHeight" ) , Kinetic . Collection . mapMethods ( Kinetic . Container ) } ( ) , function ( ) { function a ( a ) { a . fill ( ) } function b ( a ) { a . stroke ( ) } function c ( a ) { a . fill ( ) } function d ( a ) { a . stroke ( ) } function e ( ) { this . _clearCache ( f ) } var f = "hasShadow" ; Kinetic . Util . addMethods ( Kinetic . Shape , { _ _init : function ( f ) { this . nodeType = "Shape" , this . _fillFunc = a , this . _strokeFunc = b , this . _fillFuncHit = c , this . _strokeFuncHit = d ; for ( var g , h = Kinetic . shapes ; ; ) if ( g = Kinetic . Util . getRandomColor ( ) , g && ! ( g in h ) ) break ; this . colorKey = g , h [ g ] = this , Kinetic . Node . call ( this , f ) , this . on ( "shadowColorChange.kinetic shadowBlurChange.kinetic shadowOffsetChange.kinetic shadowOpacityChange.kinetic shadowEnabledChange.kinetic" , e ) } , hasChildren : function ( ) { return ! 1 } , getChildren : function ( ) { return [ ] } , getContext : function ( ) { return this . getLayer ( ) . getContext ( ) } , getCanvas : function ( ) { return this . getLayer ( ) . getCanvas ( ) } , hasShadow : function ( ) { return this . _getCache ( f , this . _hasShadow ) } , _hasShadow : function ( ) { return this . getShadowEnabled ( ) && 0 !== this . getShadowOpacity ( ) && ! ! ( this . getShadowColor ( ) || this . getShadowBlur ( ) || this . getShadowOffsetX ( ) || this . getShadowOffsetY ( ) ) } , hasFill : function ( ) { return ! ! ( this . getFill ( ) || this . getFillPatternImage ( ) || this . getFillLinearGradientColorStops ( ) || this . getFillRadialGradientColorStops ( ) ) } , hasStroke : function ( ) { return ! ! ( this . stroke ( ) || this . strokeRed ( ) || this . strokeGreen ( ) || this . strokeBlue ( ) ) } , intersects : function ( a ) { var b , c = this . getStage ( ) , d = c . bufferHitCanvas ; return d . getContext ( ) . clear ( ) , this . drawScene ( d ) , b = d . context . getImageData ( Math . round ( a . x ) , Math . round ( a . y ) , 1 , 1 ) . data , b [ 3 ] > 0 } , destroy : function ( ) { Kinetic . Node . prototype . destroy . call ( this ) , delete Kinetic . shapes [ this . colorKey ] } , _useBufferCanvas : function ( ) { return ( this . hasShadow ( ) || 1 !== this . getAbsoluteOpacity ( ) ) && this . hasFill ( ) && this . hasStroke ( ) && this . getStage ( ) } , drawScene : function ( a , b ) { var c , d , e , f = this . getLayer ( ) , g = a || f . getCanvas ( ) , h = g . getContext ( ) , i = this . _cache . canvas , j = this . sceneFunc ( ) , k = this . hasShadow ( ) ; if ( this . isVisible ( ) ) if ( i ) this . _drawCachedSceneCanvas ( h ) ; else
} , _hitFunc : function ( a ) { var b = this . getWidth ( ) , c = this . getHeight ( ) ; a . beginPath ( ) , a . rect ( 0 , 0 , b , c ) , a . closePath ( ) , a . fillStrokeShape ( this ) } , getWidth : function ( ) { var a = this . getImage ( ) ; return this . attrs . width || ( a ? a . width : 0 ) } , getHeight : function ( ) { var a = this . getImage ( ) ; return this . attrs . height || ( a ? a . height : 0 ) } } , Kinetic . Util . extend ( Kinetic . Image , Kinetic . Shape ) , Kinetic . Factory . addGetterSetter ( Kinetic . Image , "image" ) , Kinetic . Factory . addComponentsGetterSetter ( Kinetic . Image , "crop" , [ "x" , "y" , "width" , "height" ] ) , Kinetic . Factory . addGetterSetter ( Kinetic . Image , "cropX" , 0 ) , Kinetic . Factory . addGetterSetter ( Kinetic . Image , "cropY" , 0 ) , Kinetic . Factory . addGetterSetter ( Kinetic . Image , "cropWidth" , 0 ) , Kinetic . Factory . addGetterSetter ( Kinetic . Image , "cropHeight" , 0 ) , Kinetic . Collection . mapMethods ( Kinetic . Image ) } ( ) , function ( ) { function a ( a ) { a . fillText ( this . partialText , 0 , 0 ) } function b ( a ) { a . strokeText ( this . partialText , 0 , 0 ) } var c = "auto" , d = "center" , e = "Change.kinetic" , f = "2d" , g = "-" , h = "" , i = "left" , j = "text" , k = "Text" , l = "middle" , m = "normal" , n = "px " , o = " " , p = "right" , q = "word" , r = "char" , s = "none" , t = [ "fontFamily" , "fontSize" , "fontStyle" , "fontVariant" , "padding" , "align" , "lineHeight" , "text" , "width" , "height" , "wrap" ] , u = t . length , v = Kinetic . Util . createCanvasElement ( ) . getContext ( f ) ; Kinetic . Text = function ( a ) { this . _ _ _init ( a ) } , Kinetic . Text . prototype = { _ _ _init : function ( d ) { d = d || { } , d . fill = d . fill || "black" , void 0 === d . width && ( d . width = c ) , void 0 === d . height && ( d . height = c ) , Kinetic . Shape . call ( this , d ) , this . _fillFunc = a , this . _strokeFunc = b , this . className = k ; for ( var f = 0 ; u > f ; f ++ ) this . on ( t [ f ] + e , this . _setTextData ) ; this . _setTextData ( ) , this . sceneFunc ( this . _sceneFunc ) , this . hitFunc ( this . _hitFunc ) } , _sceneFunc : function ( a ) { var b , c = this . getPadding ( ) , e = this . getTextHeight ( ) , f = this . getLineHeight ( ) * e , g = this . textArr , h = g . length , j = this . getWidth ( ) ; for ( a . setAttr ( "font" , this . _getContextFont ( ) ) , a . setAttr ( "textBaseline" , l ) , a . setAttr ( "textAlign" , i ) , a . save ( ) , a . translate ( c , 0 ) , a . translate ( 0 , c + e / 2 ) , b = 0 ; h > b ; b ++ ) { var k = g [ b ] , m = k . text , n = k . width ; a . save ( ) , this . getAlign ( ) === p ? a . translate ( j - n - 2 * c , 0 ) : this . getAlign ( ) === d && a . translate ( ( j - n - 2 * c ) / 2 , 0 ) , this . partialText = m , a . fillStrokeShape ( this ) , a . restore ( ) , a . translate ( 0 , f ) } a . restore ( ) } , _hitFunc : function ( a ) { var b = this . getWidth ( ) , c = this . getHeight ( ) ; a . beginPath ( ) , a . rect ( 0 , 0 , b , c ) , a . closePath ( ) , a . fillStrokeShape ( this ) } , setText : function ( a ) { var b = Kinetic . Util . _isString ( a ) ? a : a . toString ( ) ; return this . _setAttr ( j , b ) , this } , getWidth : function ( ) { return this . attrs . width === c ? this . getTextWidth ( ) + 2 * this . getPadding ( ) : this . attrs . width } , getHeight : function ( ) { return this . attrs . height === c ? this . getTextHeight ( ) * this . textArr . length * this . getLineHeight ( ) + 2 * this . getPadding ( ) : this . attrs . height } , getTextWidth : function ( ) { return this . textWidth } , getTextHeight : function ( ) { return this . textHeight } , _getTextSize : function ( a ) { var b , c = v , d = this . getFontSize ( ) ; return c . save ( ) , c . font = this . _getContextFont ( ) , b = c . measureText ( a ) , c . restore ( ) , { width : b . width , height : parseInt ( d , 10 ) } } , _getContextFont : function ( ) { return this . getFontStyle ( ) + o + this . getFontVariant ( ) + o + this . getFontSize ( ) + n + this . getFontFamily ( ) } , _addTextLine : function ( a , b ) { return this . textArr . push ( { text : a , width : b } ) } , _getTextWidth : function ( a ) { return v . measureText ( a ) . width } , _setTextData : function ( ) { var a = this . getText ( ) . split ( "\n" ) , b = + this . getFontSize ( ) , d = 0 , e = this . getLineHeight ( ) * b , f = this . attrs . width , h = this . attrs . height , i = f !== c , j = h !== c , k = this . getPadding ( ) , l = f - 2 * k , m = h - 2 * k , n = 0 , p = this . getWrap ( ) , q = p !== s , t = p !== r && q ; this . textArr = [ ] , v . save ( ) , v . font = this . _getContextFont ( ) ; for ( var u = 0 , w = a . length ; w > u ; ++ u ) { var x = a [ u ] , y = this . _getTextWidth ( x ) ; if ( i && y > l ) for ( ; x . length > 0 ; ) { for ( var z = 0 , A = x . length , B = "" , C = 0 ; A > z ; ) { var D = z + A >>> 1 , E = x . slice ( 0 , D + 1 ) , F = this . _getTextWidth ( E ) ; l >= F ? ( z = D + 1 , B = E , C = F ) : A = D } if ( ! B ) break ; if ( t ) { var G = Math . max ( B . lastIndexOf ( o ) , B . lastIndexOf ( g ) ) + 1 ; G > 0 && ( z = G , B = B . slice ( 0 , z ) , C = this . _getTextWidth ( B ) ) } if ( this . _addTextLine ( B , C ) , d = Math . max ( d , C ) , n += e , ! q || j && n + e > m ) break ; if ( x = x . slice ( z ) , x . length > 0 && ( y = this . _getTextWidth ( x ) , l >= y ) ) { this . _addTextLine ( x , y ) , n += e , d = Math . max ( d , y ) ; break } } else this . _addTextLine ( x , y ) , n += e , d = Math . max ( d , y ) ; if ( j && n + e > m ) break } v . restore ( ) , this . textHeight = b , this . textWidth = d } } , Kinetic . Util . extend ( Kinetic . Te
* Copyright ( c ) 2007 - 2015 Ariel Flesler - aflesler < a > gmail < d > com | http : //flesler.blogspot.com
* Licensed under MIT
* @ author Ariel Flesler
* @ version 2.1 . 2
* /
; ( function ( f ) { "use strict" ; "function" === typeof define && define . amd ? define ( [ "jquery" ] , f ) : "undefined" !== typeof module && module . exports ? module . exports = f ( require ( "jquery" ) ) : f ( jQuery ) } ) ( function ( $ ) { "use strict" ; function n ( a ) { return ! a . nodeName || - 1 !== $ . inArray ( a . nodeName . toLowerCase ( ) , [ "iframe" , "#document" , "html" , "body" ] ) } function h ( a ) { return $ . isFunction ( a ) || $ . isPlainObject ( a ) ? a : { top : a , left : a } } var p = $ . scrollTo = function ( a , d , b ) { return $ ( window ) . scrollTo ( a , d , b ) } ; p . defaults = { axis : "xy" , duration : 0 , limit : ! 0 } ; $ . fn . scrollTo = function ( a , d , b ) { "object" === typeof d && ( b = d , d = 0 ) ; "function" === typeof b && ( b = { onAfter : b } ) ; "max" === a && ( a = 9E9 ) ; b = $ . extend ( { } , p . defaults , b ) ; d = d || b . duration ; var u = b . queue && 1 < b . axis . length ; u && ( d /= 2 ) ; b . offset = h ( b . offset ) ; b . over = h ( b . over ) ; return this . each ( function ( ) { function k ( a ) { var k = $ . extend ( { } , b , { queue : ! 0 , duration : d , complete : a && function ( ) { a . call ( q , e , b ) } } ) ; r . animate ( f , k ) } if ( null !== a ) { var l = n ( this ) , q = l ? this . contentWindow || window : this , r = $ ( q ) , e = a , f = { } , t ; switch ( typeof e ) { case "number" : case "string" : if ( /^([+-]=?)?\d+(\.\d+)?(px|%)?$/ . test ( e ) ) { e = h ( e ) ; break } e = l ? $ ( e ) : $ ( e , q ) ; case "object" : if ( e . length === 0 ) return ; if ( e . is || e . style ) t = ( e = $ ( e ) ) . offset ( ) } var v = $ . isFunction ( b . offset ) && b . offset ( q , e ) || b . offset ; $ . each ( b . axis . split ( "" ) , function ( a , c ) { var d = "x" === c ? "Left" : "Top" , m = d . toLowerCase ( ) , g = "scroll" + d , h = r [ g ] ( ) , n = p . max ( q , c ) ; t ? ( f [ g ] = t [ m ] + ( l ? 0 : h - r . offset ( ) [ m ] ) , b . margin && ( f [ g ] -= parseInt ( e . css ( "margin" + d ) , 10 ) || 0 , f [ g ] -= parseInt ( e . css ( "border" + d + "Width" ) , 10 ) || 0 ) , f [ g ] += v [ m ] || 0 , b . over [ m ] && ( f [ g ] += e [ "x" === c ? "width" : "height" ] ( ) * b . over [ m ] ) ) : ( d = e [ m ] , f [ g ] = d . slice && "%" === d . slice ( - 1 ) ? parseFloat ( d ) / 100 * n : d ) ; b . limit && /^\d+$/ . test ( f [ g ] ) && ( f [ g ] = 0 >= f [ g ] ? 0 : Math . min ( f [ g ] , n ) ) ; ! a && 1 < b . axis . length && ( h === f [ g ] ? f = { } : u && ( k ( b . onAfterFirst ) , f = { } ) ) } ) ; k ( b . onAfter ) } } ) } ; p . max = function ( a , d ) { var b = "x" === d ? "Width" : "Height" , h = "scroll" + b ; if ( ! n ( a ) ) return a [ h ] - $ ( a ) [ b . toLowerCase ( ) ] ( ) ; var b = "client" + b , k = a . ownerDocument || a . document , l = k . documentElement , k = k . body ; return Math . max ( l [ h ] , k [ h ] ) - Math . min ( l [ b ] , k [ b ] ) } ; $ . Tween . propHooks . scrollLeft = $ . Tween . propHooks . scrollTop = { get : function ( a ) { return $ ( a . elem ) [ a . prop ] ( ) } , set : function ( a ) { var d = this . get ( a ) ; if ( a . options . interrupt && a . _last && a . _last !== d ) return $ ( a . elem ) . stop ( ) ; var b = Math . round ( a . now ) ; d !== b && ( $ ( a . elem ) [ a . prop ] ( b ) , a . _last = this . get ( a ) ) } } ; return p } ) ;
} ( jQuery ) ) ;