{"version":3,"sources":["googlemaps-scrollprevent.js","googlemaps-scrollprevent.coffee"],"names":["hasProp","hasOwnProperty","$","fn","extend","scrollprevent","options","Log","applyCss","bindEvents","buttonObject","context","coverObject","defaults","isWrapped","item","itemClass","itemHTML","longPressDown","longPressUp","mapCSS","opts","overlayObject","progress","ref","runTimeout","value","wrapIframe","wrapObject","class","wrap","overlay","button","icon","pressDuration","triggerElm","iconLocked","iconUnloking","iconUnlocked","onMapLock","onMapUnlock","printLog","this","message","dateTime","nowTime","window","console","log","Date","getHours","getMinutes","getSeconds","length","call","replace","split","join","toLowerCase","append","closest","children","each","height","width","css","top","position","left","status","elm","iFrameObject","iconObject","progressObject","find","hide","show","animate","duration","queue","pointer-events","clearTimeout","timeOut","mouseDownTime","mouseUpTime","e","preventDefault","stopPropagation","now","setTimeout","ref1","bind","unbind","start","stop","remove","removeAttr","parent","is","unwrap","jQuery"],"mappings":";;;;;;;;;CAUA,WCVA,GAAAA,MAAAC,gBDaI,SAAUC,GCFX,MAAAA,GAAAC,GAAAC,QAEAC,cACC,SAAAC,GAAA,GAAAC,GAAgBC,EAACC,EAADC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,CAuDd,IAtDAf,GACEgB,SACEC,KAAA,iBAEAC,QAAA,oBAEAR,SAAA,qBAEAS,OAAA,mBAEAC,KAAA,kBAEFC,cAAA,IAEAC,WAAA,SAEAJ,SAEEK,WAAA,oVACEC,aAAA,yXAGFC,aACE,mYAQJC,UAAA,aACAC,YAAY,aAEZC,UAAA,GDOQpB,EAAOnB,EAAEE,QAAO,EAAOS,EAAUP,GCF3CK,EAAAT,EAAAwC,MAGAnC,EAAA,SAAAoC,GACM,GAACC,GAADC,CACJ,OAAAxB,GAAAoB,UAAAK,OAAAC,SAAAD,OAAAC,QAAAC,KACYJ,EAAY,GAAOK,MACZJ,EAA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EAAA,SAAAS,OACAtB,IAIEmB,IACAlB,IACAF,EAAA,qBANkBwC,QAAGC,IAAKrC,EAAM+D,KAAlC,GAAArD,EAAA,SAAAS,OACsBvB,EAAK,sBAQ7BuF,KAAA,WDlEoB,MCmEbvF,GAAA,sBACDL,EAAA,IAAAmB,EAAJ,SAAAU,QAAA,MAAAV,EAAA,SAAAW,QAAA+D,SACWpF,EAAMqF,WAAQ,SACjBjD,QAAWC,IAAnBrC,EAAAsF,SAAAC,GAAA,IAAA7E,EAAA,SAAAS,OACYiB,QAAQC,IAARlC,GACAA,GACZH,EAAAsF,SAAAC,GAAA,IAAA7E,EAAA,SAAAS,OACqBnB,EAAIwF,SD1EA5F,EAAI,qBClMnB,MAAdA,GAAA,0DAzDJ6F,UAbF9C,KAAAZ","file":"googlemaps-scrollprevent.min.js","sourcesContent":["/*!\n * googlemaps-scrollprevent (jQuery Google Maps Scroll Prevent Plugin)\n * Version 0.6.5\n * URL: https://github.com/diazemiliano/googlemaps-scrollprevent\n * Description: googlemaps-scrollprevent is an easy solution to the problem of\n * page scrolling with Google Maps.\n * Author: Emiliano Díaz https://github.com/diazemiliano/\n * Copyright: The MIT License (MIT) Copyright (c) 2016 Emiliano Díaz.\n */\n\n(function() {\n var hasProp = {}.hasOwnProperty;\n\n (function($) {\n return $.fn.extend({\n scrollprevent: function(options) {\n var Log, applyCss, bindEvents, buttonObject, context, coverObject, defaults, isWrapped, item, itemClass, itemHTML, longPressDown, longPressUp, mapCSS, opts, overlayObject, progress, ref, runTimeout, value, wrapIframe, wrapObject;\n defaults = {\n \"class\": {\n\n /* class for map wrap */\n wrap: \"mapscroll-wrap\",\n\n /* class for hover div */\n overlay: \"mapscroll-overlay\",\n\n /* class for progress bar */\n progress: \"mapscroll-progress\",\n\n /* class for the unlock button */\n button: \"mapscroll-button\",\n\n /* class for svg icons */\n icon: \"mapscroll-icon\"\n },\n\n /* Press Duration */\n pressDuration: 650,\n\n /* Unlock Trigger (overlay|button) */\n triggerElm: \"button\",\n\n /* Buton Icons */\n overlay: {\n iconLocked: \" \",\n iconUnloking: \" \",\n iconUnlocked: \" \"\n },\n\n /* Callbaks */\n onMapLock: function() {},\n onMapUnlock: function() {},\n\n /* Print Log Messges */\n printLog: false\n };\n opts = $.extend(false, defaults, options);\n\n /* iframe Map Object */\n context = $(this);\n\n /* Logging Style */\n Log = function(message) {\n var dateTime, nowTime;\n if (opts.printLog) {\n if (window.console && window.console.log) {\n dateTime = new Date();\n nowTime = dateTime.getHours() + \":\" + dateTime.getMinutes() + \":\" + dateTime.getSeconds();\n return console.log(\"mapScrollPrevent [\" + nowTime + \"] : \" + message);\n }\n }\n };\n\n /* Early exit */\n if (!context.length) {\n return Log(\"No Iframes detected. Try changing your \\\"selector.\\\"\");\n } else {\n Log(context.length + \" iFrames detected.\");\n mapCSS = \"/* --- mapScrollPrevent.js CSS Classes --- */ .\" + opts[\"class\"].overlay + \" { position: absolute; overflow:hidden; cursor: pointer; text-align: center; background-color: rgba(0, 0, 0, 0); } .\" + opts[\"class\"].button + \" { text-rendering: optimizeLegibility; font-family: Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; padding-top: 15px; padding-bottom: 15px; width: 55px; position: absolute; right: 43px; bottom: 24px; border-color: rgba(0, 0, 0, 0.3); color: rgba(58, 132, 223, 0); background-color: rgba(255, 255, 255, 1); color: rgb(58, 132, 223); border-top-right-radius: 2px; border-top-left-radius: 2px; box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px; cursor: pointer; z-index: 1; } .\" + opts[\"class\"].icon + \" { display: none; position: relative; z-index: 1; fill: rgba(58, 132, 223, 1); } .\" + opts[\"class\"].icon + \"-locked { display: inline; } .\" + opts[\"class\"].progress + \" { position: absolute; top: 0; bottom: 0; left: 0; width: 0%; display: block; background-color: rgba(58, 132, 223, 0.4); } .\" + opts[\"class\"].wrap + \" { position: relative; text-align: center; display: inline-block; } .\" + opts[\"class\"].wrap + \" iframe { position: relative; top: 0; left: 0; } .\" + opts[\"class\"].overlay + \", .\" + opts[\"class\"].button + \", .\" + opts[\"class\"].icon + \" { transition: all .3s ease-in-out; } .\" + opts[\"class\"].progress + \" { width: 0%; }\";\n\n /*\n Remove and Set the Icon classes\n IE weird version beacouse doesn't support SVG.outerHTML()\n */\n ref = opts.overlay;\n for (item in ref) {\n if (!hasProp.call(ref, item)) continue;\n value = ref[item];\n Log(\"Icons founded... Replacing classes.\");\n value = value.replace('#\\s(id|class)=\"[^\"]+\"#', '');\n itemClass = item.split(\"icon\");\n itemHTML = value.split(\"svg\").join(\"svg class=\\\"\" + opts[\"class\"].icon + \"-\" + (itemClass[1].toLowerCase()) + \" \" + opts[\"class\"].icon + \"\\\"\");\n opts.overlay[item] = itemHTML;\n }\n\n /* Creates overlay object */\n overlayObject = $(\"
\");\n buttonObject = $(\"
\" + opts.overlay.iconLocked + \" \" + opts.overlay.iconUnlocked + \" \" + opts.overlay.iconUnloking + \"
\");\n wrapObject = $(\"
\");\n isWrapped = null;\n\n /* Apply all the css */\n applyCss = function() {\n $(\"head\").append(\"\");\n return Log(\"Plugin css applied.\");\n };\n\n /* Wraps the iframe */\n wrapIframe = function() {\n\n /* Check first if the iframe is already wraped */\n if (context.closest(\".\" + opts[\"class\"].wrap).length) {\n isWrapped = true;\n Log(\"Iframe already wrapped\");\n } else {\n context.wrap(wrapObject);\n isWrapped = false;\n Log(\"Iframe isn't wrapped.\");\n }\n\n /* Update with DOM objects */\n wrapObject = context.closest(\".\" + opts[\"class\"].wrap).append(buttonObject).append(overlayObject);\n overlayObject = wrapObject.children(\".\" + opts[\"class\"].overlay);\n buttonObject = wrapObject.children(\".\" + opts[\"class\"].button);\n coverObject();\n return Log(\"Iframe now wraped.\");\n };\n\n /* Dynamic Adjust */\n coverObject = function() {\n $.each([overlayObject, wrapObject], function() {\n this.height(context.height());\n return this.width(context.width()).css({\n \"top\": context.position().top,\n \"left\": context.position().left\n });\n });\n return Log(\"Overlay positioned.\");\n };\n progress = function(status, elm) {\n var iFrameObject, iconObject, progressObject;\n elm = elm.closest(\".\" + opts[\"class\"].wrap);\n progressObject = elm.find(\".\" + opts[\"class\"].progress);\n iconObject = elm.find(\".\" + opts[\"class\"].icon);\n overlayObject = elm.find(\".\" + opts[\"class\"].overlay);\n iFrameObject = elm.find(\"iframe\");\n iconObject.hide();\n switch (status) {\n case \"enable\":\n elm.find(\".\" + opts[\"class\"].icon + \"-unloking\").show();\n progressObject.animate({\n width: \"100%\"\n }, {\n duration: opts.pressDuration,\n queue: false\n });\n return Log(\"Enabling Map.\");\n case \"disable\":\n iFrameObject.css({\n \"pointer-events\": \"none\"\n });\n elm.find(\".\" + opts[\"class\"].icon + \"-locked\").show();\n progressObject.animate({\n width: \"0%\"\n }, {\n duration: opts.pressDuration,\n queue: false\n });\n overlayObject.show();\n opts.onMapLock();\n return Log(\"Disabling Map.\");\n case \"unlocked\":\n iFrameObject.css({\n \"pointer-events\": \"auto\"\n });\n elm.find(\".\" + opts[\"class\"].icon + \"-unlocked\").show();\n progressObject.css({\n \"width\": \"100%\"\n });\n overlayObject.hide();\n opts.onMapUnlock();\n return Log(\"Map Enabled.\");\n }\n };\n runTimeout = function(elm) {\n progress(\"unlocked\", elm);\n return clearTimeout(this.timeOut);\n };\n this.mouseDownTime = 0;\n this.mouseUpTime = 0;\n\n /* Long Press Down Event */\n longPressDown = function(e) {\n e.preventDefault();\n e.stopPropagation();\n console.log(e);\n this.mouseDownTime = $.now();\n this.timeOut = setTimeout(runTimeout, opts.pressDuration, $(this));\n progress(\"enable\", $(this));\n return Log(\"LongPress Started.\");\n };\n\n /* Long Press Up Event */\n longPressUp = function(e) {\n e.preventDefault();\n e.stopPropagation();\n console.log(e);\n this.mouseUpTime = $.now() - this.mouseDownTime;\n clearTimeout(this.timeOut);\n if (this.mouseUpTime < opts.pressDuration) {\n progress(\"disable\", $(this));\n } else {\n progress(\"unlocked\", $(this));\n }\n return Log((this.mouseUpTime / 1000) + \"s Pressed. \");\n };\n\n /* Bind Events */\n bindEvents = function() {\n var ref1;\n $(window).bind(\"resize\", coverObject);\n context.bind(\"resize\", coverObject);\n\n /* Check valid options for triggerElm */\n if (!((ref1 = opts.triggerElm) === \"area\" || ref1 === \"button\")) {\n opts.triggerElm = defaults.triggerElm;\n }\n switch (opts.triggerElm) {\n case \"button\":\n buttonObject.bind(\"mousedown touchstart\", longPressDown).bind(\"mouseup touchend touchleave touchcancel\", longPressUp).unbind(\"click\");\n break;\n case \"area\":\n wrapObject.bind(\"mousedown touchstart\", longPressDown).bind(\"mouseup touchend touchleave touchcancel\", longPressUp).unbind(\"click\");\n }\n return Log(\"Events bounded.\");\n };\n return {\n\n /* Init wrap and bind events */\n start: function() {\n Log(\"Starting plugin...\");\n if (!context.find(\"\" + opts[\"class\"].wrap)) {\n console.log(context.find(\"\" + opts[\"class\"].wrap));\n return Log(\"Already Started.\");\n } else {\n applyCss();\n wrapIframe();\n bindEvents();\n return Log(\"Plugin Started.\");\n }\n },\n\n /* Removes everything */\n stop: function() {\n Log(\"Stopping plugin...\");\n $(\".\" + opts[\"class\"].overlay + \", .\" + opts[\"class\"].button).remove();\n context.removeAttr(\"style\");\n console.log(context.parent().is(\".\" + opts[\"class\"].wrap));\n console.log(isWrapped);\n if (!isWrapped) {\n if (context.parent().is(\".\" + opts[\"class\"].wrap)) {\n context.unwrap();\n }\n }\n return Log(\"Plugin Stopped.\");\n }\n };\n }\n }\n });\n })(jQuery);\n\n}).call(this);\n","###!\r\n# googlemaps-scrollprevent (jQuery Google Maps Scroll Prevent Plugin)\r\n# Version 0.6.5\r\n# URL: https://github.com/diazemiliano/googlemaps-scrollprevent\r\n# Description: googlemaps-scrollprevent is an easy solution to the problem of\r\n# page scrolling with Google Maps.\r\n# Author: Emiliano Díaz https://github.com/diazemiliano/\r\n# Copyright: The MIT License (MIT) Copyright (c) 2016 Emiliano Díaz.\r\n###\r\n\r\n# Reference jQuery\r\ndo ($ = jQuery) ->\r\n\r\n $.fn.extend\r\n scrollprevent : (options) ->\r\n defaults =\r\n class:\r\n ### class for map wrap ###\r\n wrap: \"mapscroll-wrap\"\r\n ### class for hover div ###\r\n overlay: \"mapscroll-overlay\"\r\n ### class for progress bar ###\r\n progress: \"mapscroll-progress\"\r\n ### class for the unlock button ###\r\n button: \"mapscroll-button\"\r\n ### class for svg icons ###\r\n icon: \"mapscroll-icon\"\r\n ### Press Duration ###\r\n pressDuration: 650\r\n ### Unlock Trigger (overlay|button)###\r\n triggerElm: \"button\"\r\n ### Buton Icons ###\r\n overlay:\r\n iconLocked :\r\n \"\r\n \r\n \"\r\n iconUnloking :\r\n \"\r\n \r\n \"\r\n iconUnlocked :\r\n \"\r\n \r\n \"\r\n\r\n ### Callbaks ###\r\n onMapLock : ->\r\n onMapUnlock : ->\r\n ### Print Log Messges ###\r\n printLog: false\r\n\r\n opts = $.extend false, defaults, options\r\n\r\n ### iframe Map Object ###\r\n context = $(@)\r\n\r\n ### Logging Style ###\r\n Log = (message) ->\r\n if opts.printLog\r\n if window.console and window.console.log\r\n dateTime = new Date()\r\n nowTime =\r\n dateTime.getHours() + \":\" +\r\n dateTime.getMinutes() + \":\" +\r\n dateTime.getSeconds()\r\n\r\n console.log \"mapScrollPrevent [#{nowTime}] : #{message}\"\r\n\r\n ### Early exit ###\r\n unless context.length\r\n return Log \"No Iframes detected. Try changing your \\\"selector.\\\"\"\r\n else\r\n Log \"#{context.length} iFrames detected.\"\r\n mapCSS = \"\r\n /* --- mapScrollPrevent.js CSS Classes --- */\r\n .#{opts.class.overlay} {\r\n position: absolute;\r\n overflow:hidden;\r\n cursor: pointer;\r\n text-align: center;\r\n background-color: rgba(0, 0, 0, 0);\r\n }\r\n .#{opts.class.button} {\r\n text-rendering: optimizeLegibility;\r\n font-family: Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif;\r\n font-size: 13px;\r\n padding-top: 15px;\r\n padding-bottom: 15px;\r\n width: 55px;\r\n position: absolute;\r\n right: 43px;\r\n bottom: 24px;\r\n border-color: rgba(0, 0, 0, 0.3);\r\n color: rgba(58, 132, 223, 0);\r\n background-color: rgba(255, 255, 255, 1);\r\n color: rgb(58, 132, 223);\r\n border-top-right-radius: 2px;\r\n border-top-left-radius: 2px;\r\n box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px;\r\n cursor: pointer;\r\n z-index: 1;\r\n }\r\n .#{opts.class.icon} {\r\n display: none;\r\n position: relative;\r\n z-index: 1;\r\n fill: rgba(58, 132, 223, 1);\r\n }\r\n .#{opts.class.icon}-locked {\r\n display: inline;\r\n }\r\n .#{opts.class.progress} {\r\n position: absolute;\r\n top: 0;\r\n bottom: 0;\r\n left: 0;\r\n width: 0%;\r\n display: block;\r\n background-color: rgba(58, 132, 223, 0.4);\r\n }\r\n .#{opts.class.wrap} {\r\n position: relative;\r\n text-align: center;\r\n display: inline-block;\r\n }\r\n .#{opts.class.wrap} iframe {\r\n position: relative;\r\n top: 0;\r\n left: 0;\r\n }\r\n .#{opts.class.overlay},\r\n .#{opts.class.button},\r\n .#{opts.class.icon} {\r\n transition: all .3s ease-in-out;\r\n }\r\n .#{opts.class.progress} {\r\n width: 0%;\r\n }\r\n \"\r\n\r\n ###\r\n Remove and Set the Icon classes\r\n IE weird version beacouse doesn't support SVG.outerHTML()\r\n ###\r\n for own item, value of opts.overlay\r\n Log \"Icons founded... Replacing classes.\"\r\n value = value.replace '#\\s(id|class)=\"[^\"]+\"#', ''\r\n itemClass = item.split \"icon\"\r\n itemHTML = value\r\n .split(\"svg\")\r\n .join(\"svg class=\\\"#{opts.class.icon}-#{itemClass[1].toLowerCase()} #{opts.class.icon}\\\"\")\r\n\r\n opts.overlay[item] = itemHTML\r\n\r\n ### Creates overlay object ###\r\n overlayObject =\r\n $(\"
\")\r\n\r\n buttonObject =\r\n $(\"\r\n
\r\n
\r\n
\r\n #{opts.overlay.iconLocked}\r\n #{opts.overlay.iconUnlocked}\r\n #{opts.overlay.iconUnloking}\r\n
\r\n \")\r\n\r\n wrapObject =\r\n $(\"
\")\r\n\r\n isWrapped = null\r\n\r\n ### Apply all the css ###\r\n applyCss = ->\r\n $(\"head\").append \"\"\r\n Log \"Plugin css applied.\"\r\n\r\n ### Wraps the iframe ###\r\n wrapIframe = ->\r\n ### Check first if the iframe is already wraped ###\r\n\r\n if context.closest(\".#{opts.class.wrap}\").length\r\n isWrapped = true\r\n Log \"Iframe already wrapped\"\r\n else\r\n context.wrap wrapObject\r\n isWrapped = false\r\n Log \"Iframe isn't wrapped.\"\r\n\r\n ### Update with DOM objects ###\r\n wrapObject =\r\n context\r\n .closest \".#{opts.class.wrap}\"\r\n .append buttonObject\r\n .append overlayObject\r\n\r\n overlayObject =\r\n wrapObject\r\n .children \".#{opts.class.overlay}\"\r\n\r\n buttonObject =\r\n wrapObject\r\n .children \".#{opts.class.button}\"\r\n\r\n coverObject()\r\n Log \"Iframe now wraped.\"\r\n\r\n ### Dynamic Adjust ###\r\n coverObject = ->\r\n $.each [overlayObject, wrapObject], ->\r\n @height context.height()\r\n @width context.width()\r\n .css\r\n \"top\": context.position().top\r\n \"left\": context.position().left\r\n Log \"Overlay positioned.\"\r\n\r\n progress = (status, elm) ->\r\n elm = elm.closest(\".#{opts.class.wrap}\")\r\n progressObject = elm.find \".#{opts.class.progress}\"\r\n iconObject = elm.find \".#{opts.class.icon}\"\r\n overlayObject = elm.find \".#{opts.class.overlay}\"\r\n iFrameObject = elm.find \"iframe\"\r\n\r\n iconObject.hide()\r\n\r\n switch status\r\n when \"enable\"\r\n elm.find(\".#{opts.class.icon}-unloking\").show()\r\n progressObject\r\n .animate {width:\"100%\"},\r\n {\r\n duration : opts.pressDuration\r\n queue : false\r\n }\r\n Log \"Enabling Map.\"\r\n\r\n when \"disable\"\r\n iFrameObject.css {\"pointer-events\":\"none\"}\r\n elm.find(\".#{opts.class.icon}-locked\").show()\r\n progressObject\r\n .animate {width:\"0%\"},\r\n {\r\n duration : opts.pressDuration\r\n queue : false\r\n }\r\n overlayObject.show()\r\n opts.onMapLock()\r\n Log \"Disabling Map.\"\r\n\r\n when \"unlocked\"\r\n iFrameObject.css {\"pointer-events\":\"auto\"}\r\n elm.find(\".#{opts.class.icon}-unlocked\").show()\r\n progressObject.css {\"width\":\"100%\"}\r\n overlayObject.hide()\r\n opts.onMapUnlock()\r\n Log \"Map Enabled.\"\r\n\r\n runTimeout = (elm)->\r\n progress(\"unlocked\", elm)\r\n clearTimeout(@timeOut)\r\n @mouseDownTime=0\r\n @mouseUpTime=0\r\n ### Long Press Down Event ###\r\n longPressDown = (e) ->\r\n e.preventDefault()\r\n e.stopPropagation()\r\n # e.preventDefault()\r\n console.log e\r\n @mouseDownTime = $.now()\r\n @timeOut = setTimeout runTimeout, opts.pressDuration, $(@)\r\n progress(\"enable\", $(@))\r\n Log \"LongPress Started.\"\r\n\r\n ### Long Press Up Event ###\r\n longPressUp = (e) ->\r\n e.preventDefault()\r\n e.stopPropagation()\r\n console.log e\r\n @mouseUpTime = $.now() - @mouseDownTime\r\n clearTimeout(@timeOut)\r\n\r\n if @mouseUpTime < opts.pressDuration\r\n progress(\"disable\", $(@))\r\n else\r\n progress(\"unlocked\", $(@))\r\n\r\n Log \"#{@mouseUpTime / 1000}s Pressed. \"\r\n\r\n ### Bind Events ###\r\n bindEvents = ->\r\n $(window)\r\n .bind \"resize\", coverObject\r\n context\r\n .bind \"resize\", coverObject\r\n\r\n ### Check valid options for triggerElm ###\r\n if !(opts.triggerElm in [\"area\",\"button\"])\r\n opts.triggerElm = defaults.triggerElm\r\n\r\n switch opts.triggerElm\r\n when \"button\"\r\n buttonObject\r\n .bind \"mousedown touchstart\", longPressDown\r\n .bind \"mouseup touchend touchleave touchcancel\", longPressUp\r\n .unbind \"click\"\r\n when \"area\"\r\n wrapObject\r\n .bind \"mousedown touchstart\", longPressDown\r\n .bind \"mouseup touchend touchleave touchcancel\", longPressUp\r\n .unbind \"click\"\r\n\r\n Log \"Events bounded.\"\r\n\r\n ### Init wrap and bind events ###\r\n start : ->\r\n Log \"Starting plugin...\"\r\n unless context.find \"#{opts.class.wrap}\"\r\n console.log context.find \"#{opts.class.wrap}\"\r\n return Log \"Already Started.\"\r\n else\r\n applyCss()\r\n wrapIframe()\r\n bindEvents()\r\n Log \"Plugin Started.\"\r\n\r\n ### Removes everything ###\r\n stop : ->\r\n Log \"Stopping plugin...\"\r\n $(\".#{opts.class.overlay}, .#{opts.class.button}\").remove()\r\n context.removeAttr \"style\"\r\n console.log context.parent().is(\".#{ opts.class.wrap }\")\r\n console.log isWrapped\r\n unless isWrapped\r\n if context.parent().is \".#{ opts.class.wrap }\"\r\n context.unwrap()\r\n Log \"Plugin Stopped.\"\r\n"],"sourceRoot":"/source/"}