{"name":"Video Lightbox (widget)","key":"videolightbox_w","version":"1.0.3","instructions":"This template will show an image thumbnail of a Youtube/Vimeo video. When the thumbnail is clicked the  video will open in a light box.","showatto":"1","showplayers":"0","requirecss":"//cdnjs.cloudflare.com/ajax/libs/fancybox/3.3.5/jquery.fancybox.min.css","requirejs":"","shim":"","defaults":"linktext=\"Click to show\", video_url=\"https://vimeo.com/369326084\",thumbwidth=\"240\",start=\"0\"","amd":"1","body":"<div id=\"@@AUTOID@@_content\" class=\"hide\">\n\n</div>\n<a class=\"videobox_item\" id=\"@@AUTOID@@\" data-fancybox data-src=\"#@@AUTOID@@_content\" data-width=\"800\" data-height=\"450\" href=\"javascript:;\" style=\"margin: 5px;\">\n  <div id=\"@@AUTOID@@_vbox\"></div>\n  <span id=\"@@AUTOID@@_vboxtitle\"></span>\n</a>","bodyend":"","script":"var iframetemplate =   '<iframe src=\"@videourl@\"  frameborder=\"0\" allow=\"autoplay; fullscreen; picture-in-picture\" style=\"position:absolute;top:0;left:0;width:100%;height:100%;padding: 15px\"   title=\"Video Fullscreen\"></iframe>';\n\nfunction parseVideoURL(url) {\n\n        var retVal = {};\n        var matches;\n        var success = false;\n\n        if ( url.match('http(s)?://(www.)?youtube|youtu\\.be') ) {\n          if (url.match('embed')) { retVal.id = url.split(/embed\\//)[1].split('\"')[0]; }\n          else if (url.match('shorts')) { retVal.id = url.split(/shorts\\//)[1].split('\"')[0]; }\n            else { retVal.id = url.split(/v\\/|v=|youtu\\.be\\//)[1].split(/[?&]/)[0]; }\n            retVal.provider = \"youtube\";\n            retVal.params = \"?rel=0&start=\" + @@start@@;\n            retVal.videoURL = '//www.youtube.com/embed/' + retVal.id;\n            retVal.success = true;\n        } else if (matches = url.match(/vimeo.com\\/(\\d+)/)) {\n            retVal.provider = \"vimeo\";\n            retVal.params = \"?h=874d9d7ec4&color=F5975F&title=0&byline=0&portrait=0#t=\" + @@start@@ + \"s\";\n            retVal.id = matches[1];\n            retVal.videoURL = '//player.vimeo.com/video/' + retVal.id;\n            retVal.success = true;\n        }\n        return retVal;\n}\n\nif(!$.fn.fancybox){ \n$.getScript('https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.3.5/jquery.fancybox.min.js', function(){});\n}\n\nvar videodetails = parseVideoURL(@@video_url@@);\nvar theurl = videodetails.videoURL + videodetails.params;\nvar iframe = iframetemplate.replace('@videourl@',theurl);\ndocument.getElementById(@@AUTOID@@ + '_content').innerHTML=iframe;\n\nconsole.log(videodetails);\n\nswitch(videodetails.provider){\n   case 'youtube':\n        $('#' + @@AUTOID@@ + '_vbox').append('<div class=\"filter_poodll_ytl\"><img  style=\"width: ' + @@thumbwidth@@ + 'px\" src=\"https://img.youtube.com/vi/' + videodetails.id + '/mqdefault.jpg\"/></div>');\n       break;\n\n   case 'vimeo':\n      var vimeoapiurl = 'https://vimeo.com/api/oembed.json?url=https://vimeo.com/' +videodetails.id;\n      $.ajax({\n            url: vimeoapiurl,\n            crossDomain: true,\n            type: 'GET',\n            error: function(xhr, status, error) {\n                console.log(theurl);\n                console.log(error);\n            },\n            success: function(data) {\n                $('#' + @@AUTOID@@ + '_vbox').append('<img  style=\"width: ' + @@thumbwidth@@ + 'px\" src=\"' + data.thumbnail_url_with_play_button + '\"/>');\n             //   $('#' + @@AUTOID@@ + '_vboxtitle').text( data.title);\n            }\n     });\n    break;\n}\n\n\n","style":".filter_poodll_ytl img{display: block;}\n\t\t\t\t\t.filter_poodll_ytl { \n\t\t\t\t\tposition: relative; \n\t\t\t\t\tdisplay: inline-block;\n\t\t\t\t\t}\n\t\t\t\t\t.filter_poodll_ytl:after {\n\t\t\t\t\tcontent: \">\";\n\t\t\t\t\t  font-size: 20px;\n\t\t\t\t\t  line-height: 30px;\n\t\t\t\t\t  color: #FFFFFF;\n\t\t\t\t\t  text-align: center;\n\t\t\t\t\t  position: absolute;\n\t\t\t\t\t  top: 40%;\n\t\t\t\t\t  left: 40%;\n\t\t\t\t\t  width: 20%;\n\t\t\t\t\t  height: 32px;\n\t\t\t\t\t  z-index: 2;\n\t\t\t\t\t  background: #FF0000;\n\t\t\t\t\t  border-radius: 8px;\n\t\t\t\t\t  pointer-events: none;\n\t\t\t\t\t}","dataset":"","datasetvars":"","alternate":"","alternateend":""}