Added favicon. Added description and image to each page for open graph and twitter cards.

Renamed some shuffle methods for more consistency
pull/56/head
Glen Cheney 11 years ago
parent 3c42d0bf39
commit ded96737e3

@ -7,6 +7,12 @@ exclude: ['./_scss/*.*']
permalink: /:title
url: http://localhost:4000
defaultTitle: 'Shuffle.js'
defaultDescription: 'Categorize, sort, and filter a responsive grid of items'
defaultImage: '/img/hero.png'
demos:
- url: 'demos/2013-05-01-basic'
slug: basic

@ -6,21 +6,35 @@
<head>
<meta charset="utf-8" />
<title>{{ page.title }}</title>
{% capture description %}{% if page.description %}{{ page.description }}{% else %}{{ site.defaultDescription }}{% endif %}{% endcapture %}
{% capture image %}{% if page.image %}{{ page.image }}{% else %}{{ site.defaultImage }}{% endif %}{% endcapture %}
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta property="og:title" content="{{ page.title }}" />
<meta property="og:description" content="Shuffle, categorize, sort, and filter a grid of items" />
<meta property="og:description" content="{{ description }}" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://vestride.github.com/Shuffle/" />
<meta property="og:image" content="http://vestride.github.com/Shuffle/img/hero.png" />
<meta property="og:site_name" content="jQuery Shuffle Plugin" />
<meta property="og:url" content="{{ site.url }}{{ page.url }}" />
<meta property="og:image" content="{{ site.url }}{{ image }}" />
<meta property="og:site_name" content="" />
<meta property="fb:admins" content="771347349" />
<meta name="author" content="https://plus.google.com/u/0/100210640453700033824" />
<meta name="twitter:card" content="summary">
<meta name="twitter:creator" content="@Vestride">
<meta name="twitter:title" content="{{ page.title }}">
<meta name="twitter:description" content="{{ description }}">
<meta name="twitter:image" content="{{ site.url }}{{ image }}">
<link href="https://plus.google.com/u/0/100210640453700033824" rel="author" />
<link rel="stylesheet" href="{{ site.url }}/css/prism.css" />
<link rel="icon" type="image/png" href="favicon.png" >
<!-- Prefetch DNS for external assets -->
<link rel="dns-prefetch" href="//fonts.googleapis.com">
<link rel="dns-prefetch" href="//www.google-analytics.com">
<link rel="dns-prefetch" href="//ajax.googleapis.com">
{% if page.prism %}<link rel="stylesheet" href="{{ site.url }}/css/prism.css" />{% endif %}
<link rel="stylesheet" href="{{ site.url }}/css/style.css" />
<link rel="stylesheet" href="{{ site.url }}/css/shuffle-styles.css" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Ubuntu:300,400,700">

@ -5,7 +5,7 @@
<div class="row-fluid">
<div class="span7">
<h1>Shuffle</h1>
<p>Categorize, sort, and filter a responsive grid of items</p>
<p>{{ site.defaultDescription }}</p>
<p>By <a href="https://twitter.com/Vestride" target="_blank">@Vestride</a></p>
</div>
</div>

@ -1,6 +1,8 @@
---
layout: default
title: Basic Shuffle Demo
description: A basic demo using shuffle with a masonry layout. This example also uses a sizer element
image: /demos/basic.jpg
bodyClass: basic
extraJS: [ "demos/homepage.js" ]
---

@ -1,7 +1,8 @@
---
layout: default
title: Shuffle Adaptive Demo
bodyClass: null
description: A responsive demo using the adaptive Twitter Bootstrap grid with compound filtering
image: /demos/adaptive.jpg
extraJS: [ "demos/gallery.js" ]
extraCSS: [ "/css/gallery.css" ]
---

@ -1,6 +1,8 @@
---
layout: default
title: Using images with imagesloaded.js
description: A Shuffle.js demo using Desandro's imagesLoaded plugin. This comes in very handy when using shuffle with images affect the layout of shuffle items
image: /demos/images.jpg
extraJS: [ "imagesloaded.pkgd.js", "demos/images.js"]
prism: true
---

@ -1,7 +1,8 @@
---
layout: default
title: Shuffle Adding and Removing Elements Demo
bodyClass: null
description: This demo of shuffle shows how to add and removing items.
image: /demos/adding-removing.jpg
extraJS: [ "demos/adding-removing.js" ]
---
<style>
@ -23,7 +24,7 @@ extraJS: [ "demos/adding-removing.js" ]
}
.box::before {
content: counter(boxes);
content: 'DOM order: ' counter(boxes);
position: absolute;
color: white;
top: .5em;

@ -1,7 +1,7 @@
---
layout: default
title: I need a doctor
bodyClass: null
title: Mobile Grid Layout Test
description: Testing out the mobile grid for this site
---
<div class="container-fluid">

@ -1,6 +1,7 @@
---
layout: default
title: Image based items
description: A demo of how NOT to use images with shuffle
extraJS: [ "demos/images-broken.js"]
---

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

@ -1,6 +1,6 @@
---
layout: default
title: jQuery Shuffle Plugin
title: Shuffle.js
bodyClass: home
extraJS: [ "demos/homepage.js" ]
includeHeader: true

@ -1,6 +1,8 @@
window.Manipulator = (function($) {
'use strict';
var hasConsole = window.console && typeof window.console.log === 'function';
var Manipulator = function( element ) {
var self = this;
@ -42,6 +44,17 @@ window.Manipulator = (function($) {
$('#add').on('click', $.proxy( self.onAddClick, self ));
$('#randomize').on('click', $.proxy( self.onRandomize, self ));
$('#remove').on('click', $.proxy( self.onRemoveClick, self ));
// Show off some shuffle events
self.$el.on('removed.shuffle', function( evt, $collection, shuffle ) {
// Make sure logs work
if ( !hasConsole ) {
return;
}
console.log( this, evt, $collection, shuffle );
});
};
Manipulator.prototype.onAddClick = function() {

@ -27,7 +27,7 @@
* Licensed under the MIT license.
* @author Glen Cheney (http://glencheney.com)
* @version 1.6.6
* @date 06/14/13
* @date 06/28/13
*/
(function($, Modernizr, undefined) {
@ -131,9 +131,9 @@ var Shuffle = function( $container, options ) {
self.$window = $(window);
self.unique = 'shuffle_' + id++;
self.fire('loading');
self._fire('loading');
self._init();
self.fire('done');
self._fire('done');
};
Shuffle.prototype = {
@ -261,7 +261,7 @@ Shuffle.prototype = {
category = category || self.lastFilter;
self.fire('filter');
self._fire('filter');
// Loop through each item and use provided function to determine
// whether to hide it or not.
@ -391,7 +391,7 @@ Shuffle.prototype = {
return this.$container.children( this.itemSelector );
},
getPreciseDimension : function( element, style ) {
_getPreciseDimension : function( element, style ) {
var dimension;
if ( window.getComputedStyle ) {
dimension = window.getComputedStyle( element, null )[ style ];
@ -409,14 +409,14 @@ Shuffle.prototype = {
gutter = typeof self.gutterWidth === 'function' ?
self.gutterWidth( containerWidth ) :
self.useSizer ?
self.getPreciseDimension( self.sizer, 'marginLeft' ) :
self._getPreciseDimension( self.sizer, 'marginLeft' ) :
self.gutterWidth,
calculatedColumns;
// use fluid columnWidth function if there
self.colWidth = self.isFluid ? self.columnWidth( containerWidth ) :
// columnWidth option isn't a function, are they using a sizing element?
self.useSizer ? self.getPreciseDimension( self.sizer, 'width' ) :
self.useSizer ? self._getPreciseDimension( self.sizer, 'width' ) :
// if not, how about the explicitly set option?
self.columnWidth ||
// or use the size of the first item
@ -460,7 +460,7 @@ Shuffle.prototype = {
/**
* Fire events with .shuffle namespace
*/
fire : function( name, args ) {
_fire : function( name, args ) {
this.$container.trigger( name + '.shuffle', args && args.length ? args : [ this ] );
},
@ -508,7 +508,7 @@ Shuffle.prototype = {
}
});
// `_layout` always happens after `shrink`, so it's safe to process the style
// `_layout` always happens after `_shrink`, so it's safe to process the style
// queue here with styles from the shrink method
self._processStyleQueue();
@ -596,7 +596,7 @@ Shuffle.prototype = {
/**
* Hides the elements that don't match our filter
*/
shrink : function( $collection, fn ) {
_shrink : function( $collection, fn ) {
var self = this,
$concealed = $collection || self.$items.filter('.concealed'),
transitionObj = {},
@ -607,7 +607,7 @@ Shuffle.prototype = {
return;
}
self.fire('shrink');
self._fire('shrink');
self.shrinkTransitionEnded = false;
$concealed.each(function() {
@ -656,8 +656,8 @@ Shuffle.prototype = {
* @param {string} prop the property to set (e.g. 'transition')
* @param {string} value the value of the prop
*/
setPrefixedCss : function($el, prop, value) {
$el.css(this.prefixed(prop), value);
setPrefixedCss : function( $el, prop, value ) {
$el.css( this.prefixed( prop ), value );
},
@ -667,8 +667,8 @@ Shuffle.prototype = {
* @param {string} property to be prefixed.
* @return {string} the prefixed css property
*/
getPrefixed : function(prop) {
var styleName = this.prefixed(prop);
getPrefixed : function( prop ) {
var styleName = this.prefixed( prop );
return styleName ? styleName.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-') : styleName;
},
@ -692,12 +692,12 @@ Shuffle.prototype = {
transform,
// Only fire callback once per collection's transition
complete = function() {
if (!self.layoutTransitionEnded && opts.from === 'layout') {
self.fire('layout');
opts.callback.call(self);
if ( !self.layoutTransitionEnded && opts.from === 'layout' ) {
self._fire('layout');
opts.callback.call( self );
self.layoutTransitionEnded = true;
} else if (!self.shrinkTransitionEnded && opts.from === 'shrink') {
opts.callback.call(self);
} else if ( !self.shrinkTransitionEnded && opts.from === 'shrink' ) {
opts.callback.call( self );
self.shrinkTransitionEnded = true;
}
};
@ -737,7 +737,7 @@ Shuffle.prototype = {
};
// Use jQuery to animate left/top
opts.$this.stop( true, true ).animate( cssObj, self.speed, 'swing', complete);
opts.$this.stop( true ).animate( cssObj, self.speed, 'swing', complete);
}
},
@ -761,15 +761,15 @@ Shuffle.prototype = {
},
shrinkEnd: function() {
this.fire('shrunk');
this._fire('shrunk');
},
filterEnd: function() {
this.fire('filtered');
this._fire('filtered');
},
sortEnd: function() {
this.fire('sorted');
this._fire('sorted');
},
/**
@ -881,7 +881,7 @@ Shuffle.prototype = {
self._resetCols();
// Shrink each concealed item
self.shrink();
self._shrink();
// If given a valid sort object, save it so that _reLayout() will sort the items
if ( sortObj ) {
@ -990,21 +990,28 @@ Shuffle.prototype = {
var self = this;
function remove() {
// Hide collection first
self._shrink( $collection, function() {
var shuffle = this;
// Remove the collection in the callback
$collection.remove();
$collection = null;
// Update the items, layout, count and fire off `removed` event
setTimeout(function() {
shuffle.$items = shuffle._getItems();
shuffle.layout();
shuffle._updateItemCount();
shuffle.fire( 'removed', [ $collection, shuffle ] );
shuffle._fire( 'removed', [ $collection, shuffle ] );
// Let it get garbage collected
$collection = null;
}, 0);
}
});
self.shrink( $collection, remove );
// Process changes
self._processStyleQueue();
return self;
},
@ -1030,7 +1037,7 @@ Shuffle.options = {
speed : 250, // Transition/animation speed (milliseconds)
easing : 'ease-out', // css easing function to use
itemSelector: '', // e.g. '.gallery-item'
sizer: null,
sizer: null, // sizer element. Can be anything columnWidth is
gutterWidth : 0, // a static number or function that tells the plugin how wide the gutters between columns are (in pixels)
columnWidth : 0,// a static number or function that returns a number which tells the plugin how wide the columns are (in pixels)
showInitialTransition : false, // If set to false, the shuffle-items will only have a transition applied to them after the first layout

@ -3,7 +3,9 @@
* Debounce plugin is included in shuffle
*/
var Support = (function() {
var Modules = {};
Modules.Support = (function() {
'use strict';
var self = {},
@ -42,7 +44,7 @@ var Support = (function() {
}());
var Polyfill = (function( $, Support ) {
Modules.Polyfill = (function( $, Support ) {
'use strict';
var init = function() {
@ -60,10 +62,10 @@ var Polyfill = (function( $, Support ) {
return {
init: init
};
}( jQuery, Support ));
}( jQuery, Modules.Support ));
var NAV = (function( $ ) {
Modules.Nav = (function( $ ) {
'use strict';
function NavTray( element ) {
@ -172,7 +174,38 @@ var NAV = (function( $ ) {
}( jQuery ));
// Analytics
var _gaq = [ ['_setAccount', 'UA-39355642-1'], ['_trackPageview'] ];
(function(doc, script) {
'use strict';
var js,
fjs = doc.scripts[0],
frag = doc.createDocumentFragment(),
add = function(url, id) {
if (doc.getElementById(id)) {return;}
js = doc.createElement(script);
js.src = url;
if ( id ) { js.id = id; }
frag.appendChild( js );
};
// Twitter SDK
// add('//platform.twitter.com/widgets.js', 'twitter-wjs');
// Load GA over http, we know it won't be over ssl
add('//www.google-analytics.com/ga.js');
fjs.parentNode.insertBefore(frag, fjs);
}(document, 'script'));
$(document).ready(function() {
NAV.init();
Polyfill.init();
'use strict';
Modules.Nav.init();
Modules.Polyfill.init();
});
Loading…
Cancel
Save