Commit 58722fde authored by Patrick's avatar Patrick

Responsive video iframe from youtube and vimeo

parent 6223db9d
/*! fluidvids.js v2.4.1 | (c) 2014 @toddmotto | https://github.com/toddmotto/fluidvids */
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(factory);
} else if (typeof exports === 'object') {
module.exports = factory;
} else {
root.fluidvids = factory();
}
})(this, function () {
'use strict';
var fluidvids = {
selector: ['iframe'],
players: ['www.youtube.com', 'player.vimeo.com']
};
var head = document.head || document.getElementsByTagName('head')[0];
function matches (src) {
return new RegExp('^(https?:)?\/\/(?:' + fluidvids.players.join('|') + ').*$', 'i').test(src);
}
function fluid (elem) {
if (!matches(elem.src) && !matches(elem.data) || !!elem.getAttribute('data-fluidvids')) return;
var wrap = document.createElement('div');
elem.parentNode.insertBefore(wrap, elem);
elem.className += (elem.className ? ' ' : '') + 'embed-responsive-item';
elem.setAttribute('data-fluidvids', 'loaded');
wrap.className += 'embed-responsive embed-responsive-16by9';
wrap.appendChild(elem);
}
fluidvids.render = function () {
var nodes = document.querySelectorAll(fluidvids.selector.join());
var i = nodes.length;
while (i--) {
fluid(nodes[i]);
}
};
fluidvids.init = function (obj) {
for (var key in obj) {
fluidvids[key] = obj[key];
}
fluidvids.render();
};
return fluidvids;
});
......@@ -100,6 +100,7 @@
</div>
{% render_block "jsuncompressed" %}
{% render_block "js" %}
<script src="{{ STATIC_URL}}fluidvids/fluidvids.js"></script>
{% render_block "lastjs" %}
</body>
</html>
\ No newline at end of file
......@@ -35,13 +35,10 @@
<script type="text/javascript">
// ensuring django namespace is set correctly
window.django = window.django || undefined;
// ensuring jQuery namespace is set correctly
window.jQuery = (django && django.jQuery) ? django.jQuery : window.jQuery || undefined;
// ensuring Class namespace is set correctly
window.Class = window.Class || undefined;
// ensuring CMS namespace is set correctly
var CMS = {
'$': (typeof jQuery === 'function') ? jQuery : undefined,
......@@ -90,17 +87,13 @@
id="my_basket"></span> &euro; <span class="glyphicon glyphicon-shopping-cart"></span></a>
</li>
{% endif %}
{# {% if languages %}#}
{# {% if languages|length > 1 %}#}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans "Language" %} <b class="caret"></b></a>
<ul class="dropdown-menu">
{% language_chooser "native" %}
</ul>
</li>
{# {% endif %}#}
{# {% endif %}#}
</ul>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
......@@ -121,6 +114,7 @@
</div>
{% render_block "jsuncompressed" %}
{% render_block "js" %}
<script src="{{ STATIC_URL}}fluidvids/fluidvids.js"></script>
{% render_block "lastjs" %}
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment