This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| # Vimeo | |
| vimeo_url = 'https://vimeo.com/56282283' | |
| # Regex to strip id from video string | |
| match_pattern = r'^(?:https?:)?(?:\/\/)?(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)' | |
| response = re.search(match_pattern, url).group(3) | |
| if response: | |
| print (response) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Vue.filter('videoUrl', function (url) { | |
| //youtube | |
| if (url.includes('youtube') || url.includes('youtu.be')) { | |
| //Get id | |
| url = url.split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/); | |
| let id = (url[2] !== undefined) ? url[2].split(/[^0-9a-z_\-]/i)[0] : url[0]; | |
| return 'https://www.youtube.com/embed/' + id | |
| } else if (url.includes('vimeo')) { | |
| var url = url.match(/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^\/]*)\/videos\/|album\/(?:\d+)\/video\/|video\/|)(\d+)(?:[a-zA-Z0-9_\-]+)?/i); | |
| return 'https://player.vimeo.com/video/' + url[1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Call the function on scroll | |
| $(window).scroll(numberCounter); | |
| //Check if in viewport function | |
| function inViewport(el, val) { | |
| var docViewTop = $(window).scrollTop(); | |
| var docViewBottom = docViewTop + $(window).height(); | |
| var elTop = $(el).offset().top; | |
| var elBottom = elTop + $(el).height(); |
NewerOlder