{"version":3,"file":"/pc/all/libs/lightbox/transition.js.map","sources":["/pc/all/libs/lightbox/transition.js"],"sourcesContent":["/* global define */\r\n\r\n(function(factory) {\r\n if (typeof define === \"function\" && define.amd) {\r\n define([\r\n \"jquery\",\r\n \"./core\"\r\n ], factory);\r\n } else {\r\n factory(jQuery, Formstone);\r\n }\r\n }(function($, Formstone) {\r\n\r\n \"use strict\";\r\n\r\n /**\r\n * @method private\r\n * @name construct\r\n * @description Builds instance.\r\n * @param data [object] \"Instance Data\"\r\n * @param callback [object] \"Function to call\"\r\n */\r\n\r\n function construct(data, callback) {\r\n if (callback) {\r\n // Target child element, for event delegation\r\n\r\n data.$target = this.find(data.target);\r\n data.$check = data.target ? data.$target : this;\r\n data.callback = callback;\r\n data.styles = getStyles(data.$check);\r\n data.timer = null;\r\n\r\n var duration = data.$check.css(Formstone.transition + \"-duration\"),\r\n durationValue = parseFloat(duration);\r\n\r\n if (Formstone.support.transition && duration && durationValue) {\r\n // If transitions supported and active\r\n\r\n this.on(Events.transitionEnd, data, onTranistionEnd);\r\n } else {\r\n data.timer = Functions.startTimer(data.timer, 50, function() {\r\n checkStyles(data);\r\n }, true);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @method private\r\n * @name destruct\r\n * @description Tears down instance.\r\n * @param data [object] \"Instance data\"\r\n */\r\n\r\n function destruct(data) {\r\n Functions.clearTimer(data.timer, true);\r\n\r\n this.off(Events.namespace);\r\n }\r\n\r\n /**\r\n * @method private\r\n * @name onTransitionEnd\r\n * @description Handles transition end events.\r\n * @param e [object] \"Event data\"\r\n */\r\n\r\n function onTranistionEnd(e) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n\r\n var data = e.data,\r\n oe = e.originalEvent,\r\n $target = data.target ? data.$target : data.$el;\r\n\r\n // Check property and target\r\n if ((!data.property || oe.propertyName === data.property) && $(oe.target).is($target)) {\r\n resolve(data);\r\n }\r\n }\r\n\r\n /**\r\n * @method private\r\n * @name resolve\r\n * @description Resolves transition end events.\r\n * @param e [object] \"Event data\"\r\n */\r\n /**\r\n * @method\r\n * @name resolve\r\n * @description Resolves current transition end events.\r\n * @example $(\".target\").transition(\"resolve\");\r\n */\r\n\r\n function resolve(data) {\r\n if (!data.always) {\r\n // Unbind events, clear timers, similiar to .one()\r\n\r\n data.$el[Plugin.namespaceClean](\"destroy\"); // clean up old data?\r\n }\r\n\r\n // fire callback\r\n\r\n data.callback.apply(data.$el);\r\n }\r\n\r\n /**\r\n * @method private\r\n * @name checkStyles\r\n * @description Compares current CSS to previous styles.\r\n * @param data [object] \"Instance data\"\r\n */\r\n\r\n function checkStyles(data) {\r\n var styles = getStyles(data.$check);\r\n\r\n if (!isEqual(data.styles, styles)) {\r\n resolve(data);\r\n }\r\n\r\n data.styles = styles;\r\n }\r\n\r\n /**\r\n * @method private\r\n * @name getStyles\r\n * @description Returns element's styles.\r\n * @param el [DOM] \"Element to check\"\r\n */\r\n\r\n function getStyles(el) {\r\n var computed,\r\n styles = {},\r\n prop,\r\n val;\r\n\r\n if (el instanceof $) {\r\n el = el[0];\r\n }\r\n\r\n if (Window.getComputedStyle) {\r\n // FireFox, Chrome, Safari\r\n\r\n computed = Window.getComputedStyle(el, null);\r\n\r\n for (var i = 0, count = computed.length; i < count; i++) {\r\n prop = computed[i];\r\n val = computed.getPropertyValue(prop);\r\n\r\n styles[prop] = val;\r\n }\r\n } else if (el.currentStyle) {\r\n // IE, Opera\r\n\r\n computed = el.currentStyle;\r\n\r\n for (prop in computed) {\r\n styles[prop] = computed[prop];\r\n }\r\n }\r\n\r\n return styles;\r\n }\r\n\r\n /**\r\n * @method private\r\n * @name isEqual\r\n * @description Compares two obejcts.\r\n * @param a [object] \"Object to compare\"\r\n * @param b [object] \"Object to compare\"\r\n */\r\n\r\n function isEqual(a, b) {\r\n if ($.type(a) !== $.type(b)) {\r\n return false;\r\n }\r\n\r\n for (var i in a) {\r\n\r\n if (a.hasOwnProperty(i)) {\r\n if (!(a.hasOwnProperty(i) && b.hasOwnProperty(i) && a[i] === b[i])) {\r\n return false;\r\n }\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @plugin\r\n * @name Transition\r\n * @description A jQuery plugin for CSS transition events.\r\n * @type widget\r\n * @main transition.js\r\n * @dependency jQuery\r\n * @dependency core.js\r\n */\r\n\r\n var Plugin = Formstone.Plugin(\"transition\", {\r\n widget: true,\r\n\r\n /**\r\n * @options\r\n * @param always [boolean] \"Flag to always react to transition end (.on vs .one)\"\r\n * @param property [string] \"Property to react to\"\r\n * @param target [string] \"Target child selector\"\r\n */\r\n\r\n defaults: {\r\n always: false,\r\n property: null,\r\n target: null\r\n },\r\n\r\n methods: {\r\n _construct: construct,\r\n _destruct: destruct,\r\n resolve: resolve\r\n }\r\n }),\r\n\r\n // Localize References\r\n\r\n Events = Plugin.events,\r\n Functions = Plugin.functions,\r\n\r\n Window = Formstone.window;\r\n\r\n })\r\n\r\n);\r\n"],"names":["factory","define","amd","jQuery","Formstone","$","construct","data","callback","$target","this","find","target","$check","styles","getStyles","timer","duration","css","transition","durationValue","parseFloat","support","on","Events","transitionEnd","onTranistionEnd","Functions","startTimer","checkStyles","destruct","clearTimer","off","namespace","e","stopPropagation","preventDefault","oe","originalEvent","$el","property","propertyName","is","resolve","always","Plugin","namespaceClean","apply","isEqual","el","computed","prop","val","Window","getComputedStyle","i","count","length","getPropertyValue","currentStyle","a","b","type","hasOwnProperty","widget","defaults","methods","_construct","_destruct","events","functions","window"],"mappings":"CAEC,SAASA,GACgB,kBAAXC,SAAyBA,OAAOC,IACzCD,QACE,SACA,UACCD,GAEHA,EAAQG,OAAQC,YAElB,SAASC,EAAGD,GAEZ,YAUA,SAASE,GAAUC,EAAMC,GACvB,GAAIA,EAAU,CAGZD,EAAKE,QAAUC,KAAKC,KAAKJ,EAAKK,QAC9BL,EAAKM,OAASN,EAAKK,OAASL,EAAKE,QAAUC,KAC3CH,EAAKC,SAAWA,EAChBD,EAAKO,OAASC,EAAU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