This file contains 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 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