commit
2a95df721f
3 changed files with 3 additions and 2053 deletions
|
@ -1,82 +1 @@
|
||||||
/*jshint browser:true */
|
!function(d){"use strict";d.fn.fitVids=function(t){var i={customSelector:null,ignore:null};if(!document.getElementById("fit-vids-style")){var e=document.head||document.getElementsByTagName("head")[0],r=document.createElement("div");r.innerHTML='<p>x</p><style id="fit-vids-style">.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}</style>',e.appendChild(r.childNodes[1])}return t&&d.extend(i,t),this.each(function(){var t=['iframe[src*="player.vimeo.com"]','iframe[src*="youtube.com"]','iframe[src*="youtube-nocookie.com"]','iframe[src*="kickstarter.com"][src*="video.html"]',"object","embed"];i.customSelector&&t.push(i.customSelector);var a=".fitvidsignore";i.ignore&&(a=a+", "+i.ignore);var e=d(this).find(t.join(","));(e=(e=e.not("object object")).not(a)).each(function(t){var e=d(this);if(!(0<e.parents(a).length||"embed"===this.tagName.toLowerCase()&&e.parent("object").length||e.parent(".fluid-width-video-wrapper").length)){e.css("height")||e.css("width")||!isNaN(e.attr("height"))&&!isNaN(e.attr("width"))||(e.attr("height",9),e.attr("width",16));var i=("object"===this.tagName.toLowerCase()||e.attr("height")&&!isNaN(parseInt(e.attr("height"),10))?parseInt(e.attr("height"),10):e.height())/(isNaN(parseInt(e.attr("width"),10))?e.width():parseInt(e.attr("width"),10));if(!e.attr("id")){var r="fitvid"+t;e.attr("id",r)}e.wrap('<div class="fluid-width-video-wrapper"></div>').parent(".fluid-width-video-wrapper").css("padding-top",100*i+"%"),e.removeAttr("height").removeAttr("width")}})})}}(window.jQuery||window.Zepto);
|
||||||
/*!
|
|
||||||
* FitVids 1.1
|
|
||||||
*
|
|
||||||
* Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
|
|
||||||
* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
|
|
||||||
* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
;(function( $ ){
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
$.fn.fitVids = function( options ) {
|
|
||||||
var settings = {
|
|
||||||
customSelector: null,
|
|
||||||
ignore: null
|
|
||||||
};
|
|
||||||
|
|
||||||
if(!document.getElementById('fit-vids-style')) {
|
|
||||||
// appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js
|
|
||||||
var head = document.head || document.getElementsByTagName('head')[0];
|
|
||||||
var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}';
|
|
||||||
var div = document.createElement("div");
|
|
||||||
div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>';
|
|
||||||
head.appendChild(div.childNodes[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( options ) {
|
|
||||||
$.extend( settings, options );
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.each(function(){
|
|
||||||
var selectors = [
|
|
||||||
'iframe[src*="player.vimeo.com"]',
|
|
||||||
'iframe[src*="youtube.com"]',
|
|
||||||
'iframe[src*="youtube-nocookie.com"]',
|
|
||||||
'iframe[src*="kickstarter.com"][src*="video.html"]',
|
|
||||||
'object',
|
|
||||||
'embed'
|
|
||||||
];
|
|
||||||
|
|
||||||
if (settings.customSelector) {
|
|
||||||
selectors.push(settings.customSelector);
|
|
||||||
}
|
|
||||||
|
|
||||||
var ignoreList = '.fitvidsignore';
|
|
||||||
|
|
||||||
if(settings.ignore) {
|
|
||||||
ignoreList = ignoreList + ', ' + settings.ignore;
|
|
||||||
}
|
|
||||||
|
|
||||||
var $allVideos = $(this).find(selectors.join(','));
|
|
||||||
$allVideos = $allVideos.not('object object'); // SwfObj conflict patch
|
|
||||||
$allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video.
|
|
||||||
|
|
||||||
$allVideos.each(function(count){
|
|
||||||
var $this = $(this);
|
|
||||||
if($this.parents(ignoreList).length > 0) {
|
|
||||||
return; // Disable FitVids on this video.
|
|
||||||
}
|
|
||||||
if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
|
|
||||||
if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width'))))
|
|
||||||
{
|
|
||||||
$this.attr('height', 9);
|
|
||||||
$this.attr('width', 16);
|
|
||||||
}
|
|
||||||
var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
|
|
||||||
width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
|
|
||||||
aspectRatio = height / width;
|
|
||||||
if(!$this.attr('id')){
|
|
||||||
var videoID = 'fitvid' + count;
|
|
||||||
$this.attr('id', videoID);
|
|
||||||
}
|
|
||||||
$this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%');
|
|
||||||
$this.removeAttr('height').removeAttr('width');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
// Works with either jQuery or Zepto
|
|
||||||
})( window.jQuery || window.Zepto );
|
|
||||||
|
|
|
@ -1,111 +1 @@
|
||||||
/*
|
$(document).ready(function(){var e,n,s,d,i,o=$("nav.greedy-nav button.navsel"),a=$("nav.greedy-nav button.langsel"),l=$("nav.greedy-nav .visible-links"),t=$("nav.greedy-nav .hidden-links.links-menu"),c=$("nav.greedy-nav .hidden-links.lang-menu"),r=0,u=0,v=[];function h(){e=l.width()-10,n=l.children().length,s=v[n-1],e<s?(l.children().last().prependTo(t),n-=1,h()):e>v[n]&&(t.children().first().appendTo(l),n+=1,h()),o.attr("count",r-n),n===r?o.addClass("hidden"):o.removeClass("hidden")}l.children().outerWidth(function(e,n){u+=n,r+=1,v.push(u)}),$(window).resize(function(){h()}),o.on("click",function(){t.is(":visible")?(t.addClass("hidden"),$(this).removeClass("close")):(t.removeClass("hidden"),$(this).addClass("close"),c.addClass("hidden"),a.removeClass("close"),clearTimeout(i))}),t.on("mouseleave",function(){d=setTimeout(function(){t.addClass("hidden"),o.removeClass("close")},1e3)}).on("mouseenter",function(){clearTimeout(d)}),a.on("click",function(){c.is(":visible")?(c.addClass("hidden"),$(this).removeClass("close")):(c.removeClass("hidden"),$(this).addClass("close"),t.addClass("hidden"),o.removeClass("close"),clearTimeout(d))}),c.on("mouseleave",function(){i=setTimeout(function(){c.addClass("hidden"),a.removeClass("close")},1e3)}).on("mouseenter",function(){clearTimeout(i)}),h()});
|
||||||
GreedyNav.js - https://github.com/lukejacksonn/GreedyNav
|
|
||||||
Licensed under the MIT license - http://opensource.org/licenses/MIT
|
|
||||||
Copyright (c) 2015 Luke Jackson
|
|
||||||
*/
|
|
||||||
|
|
||||||
$(document).ready(function(){
|
|
||||||
|
|
||||||
var $btn1 = $('nav.greedy-nav button.navsel');
|
|
||||||
var $btn2 = $('nav.greedy-nav button.langsel');
|
|
||||||
var $vlinks = $('nav.greedy-nav .visible-links');
|
|
||||||
var $hlinks1 = $('nav.greedy-nav .hidden-links.links-menu');
|
|
||||||
var $hlinks2 = $('nav.greedy-nav .hidden-links.lang-menu');
|
|
||||||
|
|
||||||
var numOfItems = 0;
|
|
||||||
var totalSpace = 0;
|
|
||||||
var closingTime = 1000;
|
|
||||||
var breakWidths = [];
|
|
||||||
|
|
||||||
// Get initial state
|
|
||||||
$vlinks.children().outerWidth(function(i, w) {
|
|
||||||
totalSpace += w;
|
|
||||||
numOfItems += 1;
|
|
||||||
breakWidths.push(totalSpace);
|
|
||||||
});
|
|
||||||
|
|
||||||
var availableSpace, numOfVisibleItems, requiredSpace, timer1, timer2;
|
|
||||||
|
|
||||||
function check() {
|
|
||||||
|
|
||||||
// Get instant state
|
|
||||||
availableSpace = $vlinks.width() - 10;
|
|
||||||
numOfVisibleItems = $vlinks.children().length;
|
|
||||||
requiredSpace = breakWidths[numOfVisibleItems - 1];
|
|
||||||
|
|
||||||
// There is not enough space
|
|
||||||
if (requiredSpace > availableSpace) {
|
|
||||||
$vlinks.children().last().prependTo($hlinks1);
|
|
||||||
numOfVisibleItems -= 1;
|
|
||||||
check();
|
|
||||||
// There is more than enough space
|
|
||||||
} else if (availableSpace > breakWidths[numOfVisibleItems]) {
|
|
||||||
$hlinks1.children().first().appendTo($vlinks);
|
|
||||||
numOfVisibleItems += 1;
|
|
||||||
check();
|
|
||||||
}
|
|
||||||
// Update the button accordingly
|
|
||||||
$btn1.attr("count", numOfItems - numOfVisibleItems);
|
|
||||||
if (numOfVisibleItems === numOfItems) {
|
|
||||||
$btn1.addClass('hidden');
|
|
||||||
} else {
|
|
||||||
$btn1.removeClass('hidden');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Window listeners
|
|
||||||
$(window).resize(function() {
|
|
||||||
check();
|
|
||||||
});
|
|
||||||
|
|
||||||
$btn1.on('click', function() {
|
|
||||||
if($hlinks1.is(":visible")){
|
|
||||||
$hlinks1.addClass('hidden');
|
|
||||||
$(this).removeClass('close');
|
|
||||||
} else {
|
|
||||||
$hlinks1.removeClass('hidden');
|
|
||||||
$(this).addClass('close');
|
|
||||||
$hlinks2.addClass('hidden');
|
|
||||||
$btn2.removeClass('close');
|
|
||||||
clearTimeout(timer2);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$hlinks1.on('mouseleave', function() {
|
|
||||||
// Mouse has left, start the timer1
|
|
||||||
timer1 = setTimeout(function() {
|
|
||||||
$hlinks1.addClass('hidden');
|
|
||||||
$btn1.removeClass('close');
|
|
||||||
}, closingTime);
|
|
||||||
}).on('mouseenter', function() {
|
|
||||||
// Mouse is back, cancel the timer1
|
|
||||||
clearTimeout(timer1);
|
|
||||||
})
|
|
||||||
|
|
||||||
$btn2.on('click', function() {
|
|
||||||
if($hlinks2.is(":visible")){
|
|
||||||
$hlinks2.addClass('hidden');
|
|
||||||
$(this).removeClass('close');
|
|
||||||
} else {
|
|
||||||
$hlinks2.removeClass('hidden');
|
|
||||||
$(this).addClass('close');
|
|
||||||
$hlinks1.addClass('hidden');
|
|
||||||
$btn1.removeClass('close');
|
|
||||||
clearTimeout(timer1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$hlinks2.on('mouseleave', function() {
|
|
||||||
// Mouse has left, start the timer2
|
|
||||||
timer2 = setTimeout(function() {
|
|
||||||
$hlinks2.addClass('hidden');
|
|
||||||
$btn2.removeClass('close');
|
|
||||||
}, closingTime);
|
|
||||||
}).on('mouseenter', function() {
|
|
||||||
// Mouse is back, cancel the timer2
|
|
||||||
clearTimeout(timer2);
|
|
||||||
})
|
|
||||||
|
|
||||||
check();
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue