{"version":3,"sources":["keditor-component-vimeo.js"],"names":["$","KEditor","keditor","flog","log","components","init","contentArea","container","component","iframe","find","wrapper","parent","initIframeCover","settingEnabled","settingTitle","initSettingForm","form","append","btnEdit","on","e","preventDefault","inputData","prompt","vimeoRegex","match","getSettingComponent","attr","alert","btn169","removeClass","addClass","btn43","chkAutoplay","embedItem","currentUrl","newUrl","replace","is","showSettingForm","src","prop","indexOf","jQuery"],"mappings":"CAAA,SAAWA,GACP,GAAIC,GAAUD,EAAEE,QACZC,EAAOF,EAAQG,GAEnBH,GAAQI,WAAkB,OACtBC,KAAM,SAAUC,EAAaC,EAAWC,EAAWP,GAC/CC,EAAK,yBAA0BM,EAE/B,IAAIC,GAASD,EAAUE,KAAK,UACxBC,EAAUF,EAAOG,QACrBX,GAAQY,gBAAgBJ,EAAQE,IAGpCG,gBAAgB,EAEhBC,aAAc,iBAEdC,gBAAiB,SAAUC,EAAMhB,GAC7BC,EAAK,qCAELe,EAAKC,OACD,4sBAsBJ,IAAIC,GAAUF,EAAKP,KAAK,kBACxBS,GAAQC,GAAG,QAAS,SAAUC,GAC1BA,EAAEC,gBAEF,IAAIC,GAAYC,OAAO,mCACnBC,EAAa,8IACbC,EAAQH,EAAUG,MAAMD,EACxBC,IAASA,EAAM,GACfzB,EAAQ0B,sBAAsBjB,KAAK,0BAA0BkB,KAAK,MAAO,kCAAoCF,EAAM,GAAK,gCAExHG,MAAM,+BAId,IAAIC,GAASb,EAAKP,KAAK,iBACvBoB,GAAOV,GAAG,QAAS,SAAUC,GACzBA,EAAEC,iBAEFrB,EAAQ0B,sBAAsBjB,KAAK,qBAAqBqB,YAAY,yBAAyBC,SAAS,2BAG1G,IAAIC,GAAQhB,EAAKP,KAAK,gBACtBuB,GAAMb,GAAG,QAAS,SAAUC,GACxBA,EAAEC,iBAEFrB,EAAQ0B,sBAAsBjB,KAAK,qBAAqBqB,YAAY,0BAA0BC,SAAS,0BAG3G,IAAIE,GAAcjB,EAAKP,KAAK,kBAC5BwB,GAAYd,GAAG,QAAS,WACpB,GAAIe,GAAYlC,EAAQ0B,sBAAsBjB,KAAK,0BAC/C0B,EAAaD,EAAUP,KAAK,OAC5BS,EAAUD,EAAWE,QAAQ,UAAW,IAAO,0CAA4CJ,EAAYK,GAAG,YAAc,EAAI,EAEhIrC,GAAK,gBAAkBkC,EAAY,YAAcC,GACjDF,EAAUP,KAAK,MAAOS,MAI9BG,gBAAiB,SAAUvB,EAAMT,EAAWP,GACxCC,EAAK,oCAAqCM,EAE1C,IAAI2B,GAAY3B,EAAUE,KAAK,0BAC3BwB,EAAcjB,EAAKP,KAAK,mBACxB+B,EAAMN,EAAUP,KAAK,MAEzBM,GAAYQ,KAAK,UAAWD,EAAIE,QAAQ,uBAIjDC","file":"keditor-component-vimeo.min.js","sourcesContent":["(function ($) {\r\n var KEditor = $.keditor;\r\n var flog = KEditor.log;\r\n\r\n KEditor.components['vimeo'] = {\r\n init: function (contentArea, container, component, keditor) {\r\n flog('init \"vimeo\" component', component);\r\n\r\n var iframe = component.find('iframe');\r\n var wrapper = iframe.parent();\r\n keditor.initIframeCover(iframe, wrapper);\r\n },\r\n\r\n settingEnabled: true,\r\n\r\n settingTitle: 'Vimeo Settings',\r\n\r\n initSettingForm: function (form, keditor) {\r\n flog('initSettingForm \"vimeo\" component');\r\n\r\n form.append(\r\n '
'\r\n );\r\n\r\n var btnEdit = form.find('.btn-vimeo-edit');\r\n btnEdit.on('click', function (e) {\r\n e.preventDefault();\r\n\r\n var inputData = prompt('Please enter Vimeo URL in here:');\r\n var vimeoRegex = /https?:\\/\\/(?:www\\.|player\\.)?vimeo.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/([^\\/]*)\\/videos\\/|album\\/(\\d+)\\/video\\/|video\\/|)(\\d+)(?:$|\\/|\\?)/;\r\n var match = inputData.match(vimeoRegex);\r\n if (match && match[1]) {\r\n keditor.getSettingComponent().find('.embed-responsive-item').attr('src', 'https://player.vimeo.com/video/' + match[1] + '?byline=0&portrait=0&badge=0');\r\n } else {\r\n alert('Your Vimeo URL is invalid!');\r\n }\r\n });\r\n\r\n var btn169 = form.find('.btn-vimeo-169');\r\n btn169.on('click', function (e) {\r\n e.preventDefault();\r\n\r\n keditor.getSettingComponent().find('.embed-responsive').removeClass('embed-responsive-4by3').addClass('embed-responsive-16by9');\r\n });\r\n\r\n var btn43 = form.find('.btn-vimeo-43');\r\n btn43.on('click', function (e) {\r\n e.preventDefault();\r\n\r\n keditor.getSettingComponent().find('.embed-responsive').removeClass('embed-responsive-16by9').addClass('embed-responsive-4by3');\r\n });\r\n\r\n var chkAutoplay = form.find('#vimeo-autoplay');\r\n chkAutoplay.on('click', function () {\r\n var embedItem = keditor.getSettingComponent().find('.embed-responsive-item');\r\n var currentUrl = embedItem.attr('src');\r\n var newUrl = (currentUrl.replace(/(\\?.+)+/, '')) + '?byline=0&portrait=0&badge=0&autoplay=' + (chkAutoplay.is(':checked') ? 1 : 0);\r\n\r\n flog('Current url: ' + currentUrl, 'New url: ' + newUrl);\r\n embedItem.attr('src', newUrl);\r\n });\r\n },\r\n\r\n showSettingForm: function (form, component, keditor) {\r\n flog('showSettingForm \"vimeo\" component', component);\r\n\r\n var embedItem = component.find('.embed-responsive-item');\r\n var chkAutoplay = form.find('#vimeo-autoplay');\r\n var src = embedItem.attr('src');\r\n\r\n chkAutoplay.prop('checked', src.indexOf('autoplay=1') !== -1);\r\n }\r\n };\r\n\r\n})(jQuery);\r\n"]}