Last active
August 9, 2017 08:34
-
-
Save jonathanheilmann/5cf63a9b92eb63d602b6be0525d2181d to your computer and use it in GitHub Desktop.
Add some more youtube patterns to EXT:jh_mangificpopup
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
page.jsFooterInline.10910 = TEXT | |
page.jsFooterInline.10910.value ( | |
;(function($){ | |
$(document).ready(function(){ | |
$.extend(true, $.magnificPopup.defaults, { | |
iframe: { | |
patterns: { | |
youtube: { | |
index: 'youtube.com/', | |
id: function(embedSrc) { | |
var id; | |
if (embedSrc.indexOf('v=') !== -1) { | |
id = 'v='; | |
embedSrc = embedSrc.substr(embedSrc.lastIndexOf(id)+id.length, embedSrc.length).replace('&', '?'); | |
embedSrc += (embedSrc.indexOf('?') !== -1 ? '&' : '?') + 'autoplay=1'; | |
} else if (embedSrc.indexOf('/embed/') !== -1) { | |
id = '/embed/'; | |
embedSrc = embedSrc.substr(embedSrc.lastIndexOf(id)+id.length, embedSrc.length); | |
embedSrc += (embedSrc.indexOf('?') !== -1 ? '&' : '?') + 'autoplay=1'; | |
} | |
return embedSrc; | |
}, | |
src: '//www.youtube.com/embed/%id%' | |
}, | |
youtu_be: { | |
index: 'youtu.be/', | |
id: function(embedSrc) { | |
embedSrc = embedSrc.substr(embedSrc.lastIndexOf('/')+1, embedSrc.length); | |
embedSrc += (embedSrc.indexOf('?') !== -1 ? '&' : '?') + 'autoplay=1'; | |
return embedSrc; | |
}, | |
src: '//www.youtube.com/embed/%id%' | |
} | |
} | |
} | |
}); | |
}); | |
})(window.jQuery || window.Zepto); | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment