alula-themes 0.4.8 → 0.4.11a
Sign up to get free protection for your applications and to get access to all the features.
- data/{LICENSE → MIT-LICENSE} +0 -0
- data/lib/alula/themes/version.rb +9 -2
- metadata +29 -187
- data/.gitignore +0 -19
- data/Gemfile +0 -4
- data/README.md +0 -29
- data/Rakefile +0 -6
- data/VERSION +0 -1
- data/alula-themes.gemspec +0 -22
- data/themes/focused/assets/images/Lato-Bla-webfont.eot +0 -0
- data/themes/focused/assets/images/Lato-Bla-webfont.svg +0 -311
- data/themes/focused/assets/images/Lato-Bla-webfont.ttf +0 -0
- data/themes/focused/assets/images/Lato-Bla-webfont.woff +0 -0
- data/themes/focused/assets/images/Lato-BlaIta-webfont.eot +0 -0
- data/themes/focused/assets/images/Lato-BlaIta-webfont.svg +0 -295
- data/themes/focused/assets/images/Lato-BlaIta-webfont.ttf +0 -0
- data/themes/focused/assets/images/Lato-BlaIta-webfont.woff +0 -0
- data/themes/focused/assets/images/Lato-Bol-webfont.eot +0 -0
- data/themes/focused/assets/images/Lato-Bol-webfont.svg +0 -311
- data/themes/focused/assets/images/Lato-Bol-webfont.ttf +0 -0
- data/themes/focused/assets/images/Lato-Bol-webfont.woff +0 -0
- data/themes/focused/assets/images/Lato-BolIta-webfont.eot +0 -0
- data/themes/focused/assets/images/Lato-BolIta-webfont.svg +0 -295
- data/themes/focused/assets/images/Lato-BolIta-webfont.ttf +0 -0
- data/themes/focused/assets/images/Lato-BolIta-webfont.woff +0 -0
- data/themes/focused/assets/images/Lato-Hai-webfont.eot +0 -0
- data/themes/focused/assets/images/Lato-Hai-webfont.svg +0 -311
- data/themes/focused/assets/images/Lato-Hai-webfont.ttf +0 -0
- data/themes/focused/assets/images/Lato-Hai-webfont.woff +0 -0
- data/themes/focused/assets/images/Lato-HaiIta-webfont.eot +0 -0
- data/themes/focused/assets/images/Lato-HaiIta-webfont.svg +0 -295
- data/themes/focused/assets/images/Lato-HaiIta-webfont.ttf +0 -0
- data/themes/focused/assets/images/Lato-HaiIta-webfont.woff +0 -0
- data/themes/focused/assets/images/Lato-Lig-webfont.eot +0 -0
- data/themes/focused/assets/images/Lato-Lig-webfont.svg +0 -311
- data/themes/focused/assets/images/Lato-Lig-webfont.ttf +0 -0
- data/themes/focused/assets/images/Lato-Lig-webfont.woff +0 -0
- data/themes/focused/assets/images/Lato-LigIta-webfont.eot +0 -0
- data/themes/focused/assets/images/Lato-LigIta-webfont.svg +0 -295
- data/themes/focused/assets/images/Lato-LigIta-webfont.ttf +0 -0
- data/themes/focused/assets/images/Lato-LigIta-webfont.woff +0 -0
- data/themes/focused/assets/images/Lato-Reg-webfont.eot +0 -0
- data/themes/focused/assets/images/Lato-Reg-webfont.svg +0 -311
- data/themes/focused/assets/images/Lato-Reg-webfont.ttf +0 -0
- data/themes/focused/assets/images/Lato-Reg-webfont.woff +0 -0
- data/themes/focused/assets/images/Lato-RegIta-webfont.eot +0 -0
- data/themes/focused/assets/images/Lato-RegIta-webfont.svg +0 -295
- data/themes/focused/assets/images/Lato-RegIta-webfont.ttf +0 -0
- data/themes/focused/assets/images/Lato-RegIta-webfont.woff +0 -0
- data/themes/focused/assets/images/smilies/angel.png +0 -0
- data/themes/focused/assets/images/smilies/angry.png +0 -0
- data/themes/focused/assets/images/smilies/cool.png +0 -0
- data/themes/focused/assets/images/smilies/crying.png +0 -0
- data/themes/focused/assets/images/smilies/devilish.png +0 -0
- data/themes/focused/assets/images/smilies/embarrassed.png +0 -0
- data/themes/focused/assets/images/smilies/exclaim.png +0 -0
- data/themes/focused/assets/images/smilies/idea.png +0 -0
- data/themes/focused/assets/images/smilies/kiss.png +0 -0
- data/themes/focused/assets/images/smilies/laugh.png +0 -0
- data/themes/focused/assets/images/smilies/monkey.png +0 -0
- data/themes/focused/assets/images/smilies/plain.png +0 -0
- data/themes/focused/assets/images/smilies/question.png +0 -0
- data/themes/focused/assets/images/smilies/raspberry.png +0 -0
- data/themes/focused/assets/images/smilies/sad.png +0 -0
- data/themes/focused/assets/images/smilies/smile-big.png +0 -0
- data/themes/focused/assets/images/smilies/smile.png +0 -0
- data/themes/focused/assets/images/smilies/smirk.png +0 -0
- data/themes/focused/assets/images/smilies/stock_right.png +0 -0
- data/themes/focused/assets/images/smilies/surprise.png +0 -0
- data/themes/focused/assets/images/smilies/uncertain.png +0 -0
- data/themes/focused/assets/images/smilies/wink.png +0 -0
- data/themes/focused/assets/images/smilies/worried.png +0 -0
- data/themes/focused/assets/images/smilies.png +0 -0
- data/themes/focused/assets/javascripts/focused.js.coffee +0 -7
- data/themes/focused/assets/javascripts/jquery.masonry.js +0 -500
- data/themes/focused/assets/javascripts/jquery.wookmark.js +0 -170
- data/themes/focused/assets/stylesheets/1140.css +0 -126
- data/themes/focused/assets/stylesheets/focused.css.scss +0 -66
- data/themes/focused/assets/stylesheets/ie.css +0 -43
- data/themes/focused/assets/stylesheets/lato.css.erb +0 -134
- data/themes/focused/assets/stylesheets/reset.css +0 -31
- data/themes/focused/assets/stylesheets/smilies.css.erb +0 -46
- data/themes/focused/assets/stylesheets/styles.css +0 -34
- data/themes/focused/layouts/default.html.haml +0 -44
- data/themes/focused/views/archive.html.haml +0 -2
- data/themes/focused/views/page.html.haml +0 -3
- data/themes/focused/views/paginate.html.haml +0 -13
- data/themes/focused/views/post.html.haml +0 -20
- data/themes/minimal/assets/images/Lato-Bla-webfont.eot +0 -0
- data/themes/minimal/assets/images/Lato-Bla-webfont.svg +0 -311
- data/themes/minimal/assets/images/Lato-Bla-webfont.ttf +0 -0
- data/themes/minimal/assets/images/Lato-Bla-webfont.woff +0 -0
- data/themes/minimal/assets/images/Lato-BlaIta-webfont.eot +0 -0
- data/themes/minimal/assets/images/Lato-BlaIta-webfont.svg +0 -295
- data/themes/minimal/assets/images/Lato-BlaIta-webfont.ttf +0 -0
- data/themes/minimal/assets/images/Lato-BlaIta-webfont.woff +0 -0
- data/themes/minimal/assets/images/Lato-Bol-webfont.eot +0 -0
- data/themes/minimal/assets/images/Lato-Bol-webfont.svg +0 -311
- data/themes/minimal/assets/images/Lato-Bol-webfont.ttf +0 -0
- data/themes/minimal/assets/images/Lato-Bol-webfont.woff +0 -0
- data/themes/minimal/assets/images/Lato-BolIta-webfont.eot +0 -0
- data/themes/minimal/assets/images/Lato-BolIta-webfont.svg +0 -295
- data/themes/minimal/assets/images/Lato-BolIta-webfont.ttf +0 -0
- data/themes/minimal/assets/images/Lato-BolIta-webfont.woff +0 -0
- data/themes/minimal/assets/images/Lato-Hai-webfont.eot +0 -0
- data/themes/minimal/assets/images/Lato-Hai-webfont.svg +0 -311
- data/themes/minimal/assets/images/Lato-Hai-webfont.ttf +0 -0
- data/themes/minimal/assets/images/Lato-Hai-webfont.woff +0 -0
- data/themes/minimal/assets/images/Lato-HaiIta-webfont.eot +0 -0
- data/themes/minimal/assets/images/Lato-HaiIta-webfont.svg +0 -295
- data/themes/minimal/assets/images/Lato-HaiIta-webfont.ttf +0 -0
- data/themes/minimal/assets/images/Lato-HaiIta-webfont.woff +0 -0
- data/themes/minimal/assets/images/Lato-Lig-webfont.eot +0 -0
- data/themes/minimal/assets/images/Lato-Lig-webfont.svg +0 -311
- data/themes/minimal/assets/images/Lato-Lig-webfont.ttf +0 -0
- data/themes/minimal/assets/images/Lato-Lig-webfont.woff +0 -0
- data/themes/minimal/assets/images/Lato-LigIta-webfont.eot +0 -0
- data/themes/minimal/assets/images/Lato-LigIta-webfont.svg +0 -295
- data/themes/minimal/assets/images/Lato-LigIta-webfont.ttf +0 -0
- data/themes/minimal/assets/images/Lato-LigIta-webfont.woff +0 -0
- data/themes/minimal/assets/images/Lato-Reg-webfont.eot +0 -0
- data/themes/minimal/assets/images/Lato-Reg-webfont.svg +0 -311
- data/themes/minimal/assets/images/Lato-Reg-webfont.ttf +0 -0
- data/themes/minimal/assets/images/Lato-Reg-webfont.woff +0 -0
- data/themes/minimal/assets/images/Lato-RegIta-webfont.eot +0 -0
- data/themes/minimal/assets/images/Lato-RegIta-webfont.svg +0 -295
- data/themes/minimal/assets/images/Lato-RegIta-webfont.ttf +0 -0
- data/themes/minimal/assets/images/Lato-RegIta-webfont.woff +0 -0
- data/themes/minimal/assets/images/smilies/angel.png +0 -0
- data/themes/minimal/assets/images/smilies/angry.png +0 -0
- data/themes/minimal/assets/images/smilies/cool.png +0 -0
- data/themes/minimal/assets/images/smilies/crying.png +0 -0
- data/themes/minimal/assets/images/smilies/devilish.png +0 -0
- data/themes/minimal/assets/images/smilies/embarrassed.png +0 -0
- data/themes/minimal/assets/images/smilies/exclaim.png +0 -0
- data/themes/minimal/assets/images/smilies/idea.png +0 -0
- data/themes/minimal/assets/images/smilies/kiss.png +0 -0
- data/themes/minimal/assets/images/smilies/laugh.png +0 -0
- data/themes/minimal/assets/images/smilies/monkey.png +0 -0
- data/themes/minimal/assets/images/smilies/plain.png +0 -0
- data/themes/minimal/assets/images/smilies/question.png +0 -0
- data/themes/minimal/assets/images/smilies/raspberry.png +0 -0
- data/themes/minimal/assets/images/smilies/sad.png +0 -0
- data/themes/minimal/assets/images/smilies/smile-big.png +0 -0
- data/themes/minimal/assets/images/smilies/smile.png +0 -0
- data/themes/minimal/assets/images/smilies/smirk.png +0 -0
- data/themes/minimal/assets/images/smilies/stock_right.png +0 -0
- data/themes/minimal/assets/images/smilies/surprise.png +0 -0
- data/themes/minimal/assets/images/smilies/uncertain.png +0 -0
- data/themes/minimal/assets/images/smilies/wink.png +0 -0
- data/themes/minimal/assets/images/smilies/worried.png +0 -0
- data/themes/minimal/assets/images/smilies.png +0 -0
- data/themes/minimal/assets/javascripts/html5shiv.js +0 -220
- data/themes/minimal/assets/javascripts/minimal.js.coffee +0 -17
- data/themes/minimal/assets/stylesheets/lato.css.erb +0 -134
- data/themes/minimal/assets/stylesheets/minimal.css.scss +0 -229
- data/themes/minimal/assets/stylesheets/smilies.css.erb +0 -46
- data/themes/minimal/layouts/default.html.haml +0 -39
- data/themes/minimal/views/archive.html.haml +0 -2
- data/themes/minimal/views/page.html.haml +0 -3
- data/themes/minimal/views/paginate.html.haml +0 -17
- data/themes/minimal/views/post.html.haml +0 -20
@@ -1,500 +0,0 @@
|
|
1
|
-
//=require jquery
|
2
|
-
/**
|
3
|
-
* jQuery Masonry v2.1.05
|
4
|
-
* A dynamic layout plugin for jQuery
|
5
|
-
* The flip-side of CSS Floats
|
6
|
-
* http://masonry.desandro.com
|
7
|
-
*
|
8
|
-
* Licensed under the MIT license.
|
9
|
-
* Copyright 2012 David DeSandro
|
10
|
-
*/
|
11
|
-
|
12
|
-
/*jshint browser: true, curly: true, eqeqeq: true, forin: false, immed: false, newcap: true, noempty: true, strict: true, undef: true */
|
13
|
-
/*global jQuery: false */
|
14
|
-
|
15
|
-
(function( window, $, undefined ){
|
16
|
-
|
17
|
-
'use strict';
|
18
|
-
|
19
|
-
/*
|
20
|
-
* smartresize: debounced resize event for jQuery
|
21
|
-
*
|
22
|
-
* latest version and complete README available on Github:
|
23
|
-
* https://github.com/louisremi/jquery.smartresize.js
|
24
|
-
*
|
25
|
-
* Copyright 2011 @louis_remi
|
26
|
-
* Licensed under the MIT license.
|
27
|
-
*/
|
28
|
-
|
29
|
-
var $event = $.event,
|
30
|
-
resizeTimeout;
|
31
|
-
|
32
|
-
$event.special.smartresize = {
|
33
|
-
setup: function() {
|
34
|
-
$(this).bind( "resize", $event.special.smartresize.handler );
|
35
|
-
},
|
36
|
-
teardown: function() {
|
37
|
-
$(this).unbind( "resize", $event.special.smartresize.handler );
|
38
|
-
},
|
39
|
-
handler: function( event, execAsap ) {
|
40
|
-
// Save the context
|
41
|
-
var context = this,
|
42
|
-
args = arguments;
|
43
|
-
|
44
|
-
// set correct event type
|
45
|
-
event.type = "smartresize";
|
46
|
-
|
47
|
-
if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
|
48
|
-
resizeTimeout = setTimeout(function() {
|
49
|
-
$.event.handle.apply( context, args );
|
50
|
-
}, execAsap === "execAsap"? 0 : 100 );
|
51
|
-
}
|
52
|
-
};
|
53
|
-
|
54
|
-
$.fn.smartresize = function( fn ) {
|
55
|
-
return fn ? this.bind( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] );
|
56
|
-
};
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
// ========================= Masonry ===============================
|
61
|
-
|
62
|
-
|
63
|
-
// our "Widget" object constructor
|
64
|
-
$.Mason = function( options, element ){
|
65
|
-
this.element = $( element );
|
66
|
-
|
67
|
-
this._create( options );
|
68
|
-
this._init();
|
69
|
-
};
|
70
|
-
|
71
|
-
$.Mason.settings = {
|
72
|
-
isResizable: true,
|
73
|
-
isAnimated: false,
|
74
|
-
animationOptions: {
|
75
|
-
queue: false,
|
76
|
-
duration: 500
|
77
|
-
},
|
78
|
-
gutterWidth: 0,
|
79
|
-
isRTL: false,
|
80
|
-
isFitWidth: false,
|
81
|
-
containerStyle: {
|
82
|
-
position: 'relative'
|
83
|
-
}
|
84
|
-
};
|
85
|
-
|
86
|
-
$.Mason.prototype = {
|
87
|
-
|
88
|
-
_filterFindBricks: function( $elems ) {
|
89
|
-
var selector = this.options.itemSelector;
|
90
|
-
// if there is a selector
|
91
|
-
// filter/find appropriate item elements
|
92
|
-
return !selector ? $elems : $elems.filter( selector ).add( $elems.find( selector ) );
|
93
|
-
},
|
94
|
-
|
95
|
-
_getBricks: function( $elems ) {
|
96
|
-
var $bricks = this._filterFindBricks( $elems )
|
97
|
-
.css({ position: 'absolute' })
|
98
|
-
.addClass('masonry-brick');
|
99
|
-
return $bricks;
|
100
|
-
},
|
101
|
-
|
102
|
-
// sets up widget
|
103
|
-
_create : function( options ) {
|
104
|
-
|
105
|
-
this.options = $.extend( true, {}, $.Mason.settings, options );
|
106
|
-
this.styleQueue = [];
|
107
|
-
|
108
|
-
// get original styles in case we re-apply them in .destroy()
|
109
|
-
var elemStyle = this.element[0].style;
|
110
|
-
this.originalStyle = {
|
111
|
-
// get height
|
112
|
-
height: elemStyle.height || ''
|
113
|
-
};
|
114
|
-
// get other styles that will be overwritten
|
115
|
-
var containerStyle = this.options.containerStyle;
|
116
|
-
for ( var prop in containerStyle ) {
|
117
|
-
this.originalStyle[ prop ] = elemStyle[ prop ] || '';
|
118
|
-
}
|
119
|
-
|
120
|
-
this.element.css( containerStyle );
|
121
|
-
|
122
|
-
this.horizontalDirection = this.options.isRTL ? 'right' : 'left';
|
123
|
-
|
124
|
-
this.offset = {
|
125
|
-
x: parseInt( this.element.css( 'padding-' + this.horizontalDirection ), 10 ),
|
126
|
-
y: parseInt( this.element.css( 'padding-top' ), 10 )
|
127
|
-
};
|
128
|
-
|
129
|
-
this.isFluid = this.options.columnWidth && typeof this.options.columnWidth === 'function';
|
130
|
-
|
131
|
-
// add masonry class first time around
|
132
|
-
var instance = this;
|
133
|
-
setTimeout( function() {
|
134
|
-
instance.element.addClass('masonry');
|
135
|
-
}, 0 );
|
136
|
-
|
137
|
-
// bind resize method
|
138
|
-
if ( this.options.isResizable ) {
|
139
|
-
$(window).bind( 'smartresize.masonry', function() {
|
140
|
-
instance.resize();
|
141
|
-
});
|
142
|
-
}
|
143
|
-
|
144
|
-
|
145
|
-
// need to get bricks
|
146
|
-
this.reloadItems();
|
147
|
-
|
148
|
-
},
|
149
|
-
|
150
|
-
// _init fires when instance is first created
|
151
|
-
// and when instance is triggered again -> $el.masonry();
|
152
|
-
_init : function( callback ) {
|
153
|
-
this._getColumns();
|
154
|
-
this._reLayout( callback );
|
155
|
-
},
|
156
|
-
|
157
|
-
option: function( key, value ){
|
158
|
-
// set options AFTER initialization:
|
159
|
-
// signature: $('#foo').bar({ cool:false });
|
160
|
-
if ( $.isPlainObject( key ) ){
|
161
|
-
this.options = $.extend(true, this.options, key);
|
162
|
-
}
|
163
|
-
},
|
164
|
-
|
165
|
-
// ====================== General Layout ======================
|
166
|
-
|
167
|
-
// used on collection of atoms (should be filtered, and sorted before )
|
168
|
-
// accepts atoms-to-be-laid-out to start with
|
169
|
-
layout : function( $bricks, callback ) {
|
170
|
-
|
171
|
-
// place each brick
|
172
|
-
for (var i=0, len = $bricks.length; i < len; i++) {
|
173
|
-
this._placeBrick( $bricks[i] );
|
174
|
-
}
|
175
|
-
|
176
|
-
// set the size of the container
|
177
|
-
var containerSize = {};
|
178
|
-
containerSize.height = Math.max.apply( Math, this.colYs );
|
179
|
-
if ( this.options.isFitWidth ) {
|
180
|
-
var unusedCols = 0;
|
181
|
-
i = this.cols;
|
182
|
-
// count unused columns
|
183
|
-
while ( --i ) {
|
184
|
-
if ( this.colYs[i] !== 0 ) {
|
185
|
-
break;
|
186
|
-
}
|
187
|
-
unusedCols++;
|
188
|
-
}
|
189
|
-
// fit container to columns that have been used;
|
190
|
-
containerSize.width = (this.cols - unusedCols) * this.columnWidth - this.options.gutterWidth;
|
191
|
-
}
|
192
|
-
this.styleQueue.push({ $el: this.element, style: containerSize });
|
193
|
-
|
194
|
-
// are we animating the layout arrangement?
|
195
|
-
// use plugin-ish syntax for css or animate
|
196
|
-
var styleFn = !this.isLaidOut ? 'css' : (
|
197
|
-
this.options.isAnimated ? 'animate' : 'css'
|
198
|
-
),
|
199
|
-
animOpts = this.options.animationOptions;
|
200
|
-
|
201
|
-
// process styleQueue
|
202
|
-
var obj;
|
203
|
-
for (i=0, len = this.styleQueue.length; i < len; i++) {
|
204
|
-
obj = this.styleQueue[i];
|
205
|
-
obj.$el[ styleFn ]( obj.style, animOpts );
|
206
|
-
}
|
207
|
-
|
208
|
-
// clear out queue for next time
|
209
|
-
this.styleQueue = [];
|
210
|
-
|
211
|
-
// provide $elems as context for the callback
|
212
|
-
if ( callback ) {
|
213
|
-
callback.call( $bricks );
|
214
|
-
}
|
215
|
-
|
216
|
-
this.isLaidOut = true;
|
217
|
-
},
|
218
|
-
|
219
|
-
// calculates number of columns
|
220
|
-
// i.e. this.columnWidth = 200
|
221
|
-
_getColumns : function() {
|
222
|
-
var container = this.options.isFitWidth ? this.element.parent() : this.element,
|
223
|
-
containerWidth = container.width();
|
224
|
-
|
225
|
-
// use fluid columnWidth function if there
|
226
|
-
this.columnWidth = this.isFluid ? this.options.columnWidth( containerWidth ) :
|
227
|
-
// if not, how about the explicitly set option?
|
228
|
-
this.options.columnWidth ||
|
229
|
-
// or use the size of the first item
|
230
|
-
this.$bricks.outerWidth(true) ||
|
231
|
-
// if there's no items, use size of container
|
232
|
-
containerWidth;
|
233
|
-
|
234
|
-
this.columnWidth += this.options.gutterWidth;
|
235
|
-
|
236
|
-
this.cols = Math.floor( ( containerWidth + this.options.gutterWidth ) / this.columnWidth );
|
237
|
-
this.cols = Math.max( this.cols, 1 );
|
238
|
-
|
239
|
-
},
|
240
|
-
|
241
|
-
// layout logic
|
242
|
-
_placeBrick: function( brick ) {
|
243
|
-
var $brick = $(brick),
|
244
|
-
colSpan, groupCount, groupY, groupColY, j;
|
245
|
-
|
246
|
-
//how many columns does this brick span
|
247
|
-
colSpan = Math.ceil( $brick.outerWidth(true) / this.columnWidth );
|
248
|
-
colSpan = Math.min( colSpan, this.cols );
|
249
|
-
|
250
|
-
if ( colSpan === 1 ) {
|
251
|
-
// if brick spans only one column, just like singleMode
|
252
|
-
groupY = this.colYs;
|
253
|
-
} else {
|
254
|
-
// brick spans more than one column
|
255
|
-
// how many different places could this brick fit horizontally
|
256
|
-
groupCount = this.cols + 1 - colSpan;
|
257
|
-
groupY = [];
|
258
|
-
|
259
|
-
// for each group potential horizontal position
|
260
|
-
for ( j=0; j < groupCount; j++ ) {
|
261
|
-
// make an array of colY values for that one group
|
262
|
-
groupColY = this.colYs.slice( j, j+colSpan );
|
263
|
-
// and get the max value of the array
|
264
|
-
groupY[j] = Math.max.apply( Math, groupColY );
|
265
|
-
}
|
266
|
-
|
267
|
-
}
|
268
|
-
|
269
|
-
// get the minimum Y value from the columns
|
270
|
-
var minimumY = Math.min.apply( Math, groupY ),
|
271
|
-
shortCol = 0;
|
272
|
-
|
273
|
-
// Find index of short column, the first from the left
|
274
|
-
for (var i=0, len = groupY.length; i < len; i++) {
|
275
|
-
if ( groupY[i] === minimumY ) {
|
276
|
-
shortCol = i;
|
277
|
-
break;
|
278
|
-
}
|
279
|
-
}
|
280
|
-
|
281
|
-
// position the brick
|
282
|
-
var position = {
|
283
|
-
top: minimumY + this.offset.y
|
284
|
-
};
|
285
|
-
// position.left or position.right
|
286
|
-
position[ this.horizontalDirection ] = this.columnWidth * shortCol + this.offset.x;
|
287
|
-
this.styleQueue.push({ $el: $brick, style: position });
|
288
|
-
|
289
|
-
// apply setHeight to necessary columns
|
290
|
-
var setHeight = minimumY + $brick.outerHeight(true),
|
291
|
-
setSpan = this.cols + 1 - len;
|
292
|
-
for ( i=0; i < setSpan; i++ ) {
|
293
|
-
this.colYs[ shortCol + i ] = setHeight;
|
294
|
-
}
|
295
|
-
|
296
|
-
},
|
297
|
-
|
298
|
-
|
299
|
-
resize: function() {
|
300
|
-
var prevColCount = this.cols;
|
301
|
-
// get updated colCount
|
302
|
-
this._getColumns();
|
303
|
-
if ( this.isFluid || this.cols !== prevColCount ) {
|
304
|
-
// if column count has changed, trigger new layout
|
305
|
-
this._reLayout();
|
306
|
-
}
|
307
|
-
},
|
308
|
-
|
309
|
-
|
310
|
-
_reLayout : function( callback ) {
|
311
|
-
// reset columns
|
312
|
-
var i = this.cols;
|
313
|
-
this.colYs = [];
|
314
|
-
while (i--) {
|
315
|
-
this.colYs.push( 0 );
|
316
|
-
}
|
317
|
-
// apply layout logic to all bricks
|
318
|
-
this.layout( this.$bricks, callback );
|
319
|
-
},
|
320
|
-
|
321
|
-
// ====================== Convenience methods ======================
|
322
|
-
|
323
|
-
// goes through all children again and gets bricks in proper order
|
324
|
-
reloadItems : function() {
|
325
|
-
this.$bricks = this._getBricks( this.element.children() );
|
326
|
-
},
|
327
|
-
|
328
|
-
|
329
|
-
reload : function( callback ) {
|
330
|
-
this.reloadItems();
|
331
|
-
this._init( callback );
|
332
|
-
},
|
333
|
-
|
334
|
-
|
335
|
-
// convienence method for working with Infinite Scroll
|
336
|
-
appended : function( $content, isAnimatedFromBottom, callback ) {
|
337
|
-
if ( isAnimatedFromBottom ) {
|
338
|
-
// set new stuff to the bottom
|
339
|
-
this._filterFindBricks( $content ).css({ top: this.element.height() });
|
340
|
-
var instance = this;
|
341
|
-
setTimeout( function(){
|
342
|
-
instance._appended( $content, callback );
|
343
|
-
}, 1 );
|
344
|
-
} else {
|
345
|
-
this._appended( $content, callback );
|
346
|
-
}
|
347
|
-
},
|
348
|
-
|
349
|
-
_appended : function( $content, callback ) {
|
350
|
-
var $newBricks = this._getBricks( $content );
|
351
|
-
// add new bricks to brick pool
|
352
|
-
this.$bricks = this.$bricks.add( $newBricks );
|
353
|
-
this.layout( $newBricks, callback );
|
354
|
-
},
|
355
|
-
|
356
|
-
// removes elements from Masonry widget
|
357
|
-
remove : function( $content ) {
|
358
|
-
this.$bricks = this.$bricks.not( $content );
|
359
|
-
$content.remove();
|
360
|
-
},
|
361
|
-
|
362
|
-
// destroys widget, returns elements and container back (close) to original style
|
363
|
-
destroy : function() {
|
364
|
-
|
365
|
-
this.$bricks
|
366
|
-
.removeClass('masonry-brick')
|
367
|
-
.each(function(){
|
368
|
-
this.style.position = '';
|
369
|
-
this.style.top = '';
|
370
|
-
this.style.left = '';
|
371
|
-
});
|
372
|
-
|
373
|
-
// re-apply saved container styles
|
374
|
-
var elemStyle = this.element[0].style;
|
375
|
-
for ( var prop in this.originalStyle ) {
|
376
|
-
elemStyle[ prop ] = this.originalStyle[ prop ];
|
377
|
-
}
|
378
|
-
|
379
|
-
this.element
|
380
|
-
.unbind('.masonry')
|
381
|
-
.removeClass('masonry')
|
382
|
-
.removeData('masonry');
|
383
|
-
|
384
|
-
$(window).unbind('.masonry');
|
385
|
-
|
386
|
-
}
|
387
|
-
|
388
|
-
};
|
389
|
-
|
390
|
-
|
391
|
-
// ======================= imagesLoaded Plugin ===============================
|
392
|
-
/*!
|
393
|
-
* jQuery imagesLoaded plugin v1.1.0
|
394
|
-
* http://github.com/desandro/imagesloaded
|
395
|
-
*
|
396
|
-
* MIT License. by Paul Irish et al.
|
397
|
-
*/
|
398
|
-
|
399
|
-
|
400
|
-
// $('#my-container').imagesLoaded(myFunction)
|
401
|
-
// or
|
402
|
-
// $('img').imagesLoaded(myFunction)
|
403
|
-
|
404
|
-
// execute a callback when all images have loaded.
|
405
|
-
// needed because .load() doesn't work on cached images
|
406
|
-
|
407
|
-
// callback function gets image collection as argument
|
408
|
-
// `this` is the container
|
409
|
-
|
410
|
-
$.fn.imagesLoaded = function( callback ) {
|
411
|
-
var $this = this,
|
412
|
-
$images = $this.find('img').add( $this.filter('img') ),
|
413
|
-
len = $images.length,
|
414
|
-
blank = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==',
|
415
|
-
loaded = [];
|
416
|
-
|
417
|
-
function triggerCallback() {
|
418
|
-
callback.call( $this, $images );
|
419
|
-
}
|
420
|
-
|
421
|
-
function imgLoaded( event ) {
|
422
|
-
var img = event.target;
|
423
|
-
if ( img.src !== blank && $.inArray( img, loaded ) === -1 ){
|
424
|
-
loaded.push( img );
|
425
|
-
if ( --len <= 0 ){
|
426
|
-
setTimeout( triggerCallback );
|
427
|
-
$images.unbind( '.imagesLoaded', imgLoaded );
|
428
|
-
}
|
429
|
-
}
|
430
|
-
}
|
431
|
-
|
432
|
-
// if no images, trigger immediately
|
433
|
-
if ( !len ) {
|
434
|
-
triggerCallback();
|
435
|
-
}
|
436
|
-
|
437
|
-
$images.bind( 'load.imagesLoaded error.imagesLoaded', imgLoaded ).each( function() {
|
438
|
-
// cached images don't fire load sometimes, so we reset src.
|
439
|
-
var src = this.src;
|
440
|
-
// webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
|
441
|
-
// data uri bypasses webkit log warning (thx doug jones)
|
442
|
-
this.src = blank;
|
443
|
-
this.src = src;
|
444
|
-
});
|
445
|
-
|
446
|
-
return $this;
|
447
|
-
};
|
448
|
-
|
449
|
-
|
450
|
-
// helper function for logging errors
|
451
|
-
// $.error breaks jQuery chaining
|
452
|
-
var logError = function( message ) {
|
453
|
-
if ( window.console ) {
|
454
|
-
window.console.error( message );
|
455
|
-
}
|
456
|
-
};
|
457
|
-
|
458
|
-
// ======================= Plugin bridge ===============================
|
459
|
-
// leverages data method to either create or return $.Mason constructor
|
460
|
-
// A bit from jQuery UI
|
461
|
-
// https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js
|
462
|
-
// A bit from jcarousel
|
463
|
-
// https://github.com/jsor/jcarousel/blob/master/lib/jquery.jcarousel.js
|
464
|
-
|
465
|
-
$.fn.masonry = function( options ) {
|
466
|
-
if ( typeof options === 'string' ) {
|
467
|
-
// call method
|
468
|
-
var args = Array.prototype.slice.call( arguments, 1 );
|
469
|
-
|
470
|
-
this.each(function(){
|
471
|
-
var instance = $.data( this, 'masonry' );
|
472
|
-
if ( !instance ) {
|
473
|
-
logError( "cannot call methods on masonry prior to initialization; " +
|
474
|
-
"attempted to call method '" + options + "'" );
|
475
|
-
return;
|
476
|
-
}
|
477
|
-
if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
|
478
|
-
logError( "no such method '" + options + "' for masonry instance" );
|
479
|
-
return;
|
480
|
-
}
|
481
|
-
// apply method
|
482
|
-
instance[ options ].apply( instance, args );
|
483
|
-
});
|
484
|
-
} else {
|
485
|
-
this.each(function() {
|
486
|
-
var instance = $.data( this, 'masonry' );
|
487
|
-
if ( instance ) {
|
488
|
-
// apply options & init
|
489
|
-
instance.option( options || {} );
|
490
|
-
instance._init();
|
491
|
-
} else {
|
492
|
-
// initialize new instance
|
493
|
-
$.data( this, 'masonry', new $.Mason( options, this ) );
|
494
|
-
}
|
495
|
-
});
|
496
|
-
}
|
497
|
-
return this;
|
498
|
-
};
|
499
|
-
|
500
|
-
})( window, jQuery );
|
@@ -1,170 +0,0 @@
|
|
1
|
-
//=require jquery
|
2
|
-
/*!
|
3
|
-
jQuery Wookmark plugin 0.5
|
4
|
-
@name jquery.wookmark.js
|
5
|
-
@author Christoph Ono (chri@sto.ph or @gbks)
|
6
|
-
@version 0.5
|
7
|
-
@date 3/19/2012
|
8
|
-
@category jQuery plugin
|
9
|
-
@copyright (c) 2009-2012 Christoph Ono (www.wookmark.com)
|
10
|
-
@license Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
|
11
|
-
*/
|
12
|
-
$.fn.wookmark = function(options) {
|
13
|
-
|
14
|
-
if(!this.wookmarkOptions) {
|
15
|
-
this.wookmarkOptions = $.extend( {
|
16
|
-
container: $('body'),
|
17
|
-
offset: 2,
|
18
|
-
autoResize: false,
|
19
|
-
itemWidth: $(this[0]).outerWidth(),
|
20
|
-
resizeDelay: 50
|
21
|
-
}, options);
|
22
|
-
} else if(options) {
|
23
|
-
this.wookmarkOptions = $.extend(this.wookmarkOptions, options);
|
24
|
-
}
|
25
|
-
|
26
|
-
// Layout variables.
|
27
|
-
if(!this.wookmarkColumns) {
|
28
|
-
this.wookmarkColumns = null;
|
29
|
-
this.wookmarkContainerWidth = null;
|
30
|
-
}
|
31
|
-
|
32
|
-
// Main layout function.
|
33
|
-
this.wookmarkLayout = function() {
|
34
|
-
// Calculate basic layout parameters.
|
35
|
-
var columnWidth = this.wookmarkOptions.itemWidth + this.wookmarkOptions.offset;
|
36
|
-
var containerWidth = this.wookmarkOptions.container.width();
|
37
|
-
var columns = Math.floor((containerWidth+this.wookmarkOptions.offset)/columnWidth);
|
38
|
-
var offset = Math.round((containerWidth - (columns*columnWidth-this.wookmarkOptions.offset))/2);
|
39
|
-
|
40
|
-
// If container and column count hasn't changed, we can only update the columns.
|
41
|
-
var bottom = 0;
|
42
|
-
if(this.wookmarkColumns != null && this.wookmarkColumns.length == columns) {
|
43
|
-
bottom = this.wookmarkLayoutColumns(columnWidth, offset);
|
44
|
-
} else {
|
45
|
-
bottom = this.wookmarkLayoutFull(columnWidth, columns, offset);
|
46
|
-
}
|
47
|
-
|
48
|
-
// Set container height to height of the grid.
|
49
|
-
this.wookmarkOptions.container.css('height', bottom+'px');
|
50
|
-
};
|
51
|
-
|
52
|
-
/**
|
53
|
-
* Perform a full layout update.
|
54
|
-
*/
|
55
|
-
this.wookmarkLayoutFull = function(columnWidth, columns, offset) {
|
56
|
-
// Prepare Array to store height of columns.
|
57
|
-
var heights = [];
|
58
|
-
while(heights.length < columns) {
|
59
|
-
heights.push(0);
|
60
|
-
}
|
61
|
-
|
62
|
-
// Store column data.
|
63
|
-
this.wookmarkColumns = [];
|
64
|
-
while(this.wookmarkColumns.length < columns) {
|
65
|
-
this.wookmarkColumns.push([]);
|
66
|
-
}
|
67
|
-
|
68
|
-
// Loop over items.
|
69
|
-
var item, top, left, i=0, k=0, length=this.length, shortest=null, shortestIndex=null, bottom = 0;
|
70
|
-
for(; i<length; i++ ) {
|
71
|
-
item = $(this[i]);
|
72
|
-
|
73
|
-
// Find the shortest column.
|
74
|
-
shortest = null;
|
75
|
-
shortestIndex = 0;
|
76
|
-
for(k=0; k<columns; k++) {
|
77
|
-
if(shortest == null || heights[k] < shortest) {
|
78
|
-
shortest = heights[k];
|
79
|
-
shortestIndex = k;
|
80
|
-
}
|
81
|
-
}
|
82
|
-
|
83
|
-
// Postion the item.
|
84
|
-
item.css({
|
85
|
-
position: 'absolute',
|
86
|
-
top: shortest+'px',
|
87
|
-
left: (shortestIndex*columnWidth + offset)+'px'
|
88
|
-
});
|
89
|
-
|
90
|
-
// Update column height.
|
91
|
-
heights[shortestIndex] = shortest + item.outerHeight() + this.wookmarkOptions.offset;
|
92
|
-
bottom = Math.max(bottom, heights[shortestIndex]);
|
93
|
-
|
94
|
-
this.wookmarkColumns[shortestIndex].push(item);
|
95
|
-
}
|
96
|
-
|
97
|
-
return bottom;
|
98
|
-
};
|
99
|
-
|
100
|
-
/**
|
101
|
-
* This layout function only updates the vertical position of the
|
102
|
-
* existing column assignments.
|
103
|
-
*/
|
104
|
-
this.wookmarkLayoutColumns = function(columnWidth, offset) {
|
105
|
-
var heights = [];
|
106
|
-
while(heights.length < this.wookmarkColumns.length) {
|
107
|
-
heights.push(0);
|
108
|
-
}
|
109
|
-
|
110
|
-
var i=0, length = this.wookmarkColumns.length, column;
|
111
|
-
var k=0, kLength, item;
|
112
|
-
var bottom = 0;
|
113
|
-
for(; i<length; i++) {
|
114
|
-
column = this.wookmarkColumns[i];
|
115
|
-
kLength = column.length;
|
116
|
-
for(k=0; k<kLength; k++) {
|
117
|
-
item = column[k];
|
118
|
-
item.css({
|
119
|
-
left: (i*columnWidth + offset)+'px',
|
120
|
-
top: heights[i]+'px'
|
121
|
-
});
|
122
|
-
heights[i] += item.outerHeight() + this.wookmarkOptions.offset;
|
123
|
-
|
124
|
-
bottom = Math.max(bottom, heights[i]);
|
125
|
-
}
|
126
|
-
}
|
127
|
-
|
128
|
-
return bottom;
|
129
|
-
};
|
130
|
-
|
131
|
-
// Listen to resize event if requested.
|
132
|
-
this.wookmarkResizeTimer = null;
|
133
|
-
if(!this.wookmarkResizeMethod) {
|
134
|
-
this.wookmarkResizeMethod = null;
|
135
|
-
}
|
136
|
-
if(this.wookmarkOptions.autoResize) {
|
137
|
-
// This timer ensures that layout is not continuously called as window is being dragged.
|
138
|
-
this.wookmarkOnResize = function(event) {
|
139
|
-
if(this.wookmarkResizeTimer) {
|
140
|
-
clearTimeout(this.wookmarkResizeTimer);
|
141
|
-
}
|
142
|
-
this.wookmarkResizeTimer = setTimeout($.proxy(this.wookmarkLayout, this), this.wookmarkOptions.resizeDelay)
|
143
|
-
};
|
144
|
-
|
145
|
-
// Bind event listener.
|
146
|
-
if(!this.wookmarkResizeMethod) {
|
147
|
-
this.wookmarkResizeMethod = $.proxy(this.wookmarkOnResize, this);
|
148
|
-
}
|
149
|
-
$(window).resize(this.wookmarkResizeMethod);
|
150
|
-
};
|
151
|
-
|
152
|
-
/**
|
153
|
-
* Clear event listeners and time outs.
|
154
|
-
*/
|
155
|
-
this.wookmarkClear = function() {
|
156
|
-
if(this.wookmarkResizeTimer) {
|
157
|
-
clearTimeout(this.wookmarkResizeTimer);
|
158
|
-
this.wookmarkResizeTimer = null;
|
159
|
-
}
|
160
|
-
if(this.wookmarkResizeMethod) {
|
161
|
-
$(window).unbind('resize', this.wookmarkResizeMethod);
|
162
|
-
}
|
163
|
-
};
|
164
|
-
|
165
|
-
// Apply layout
|
166
|
-
this.wookmarkLayout();
|
167
|
-
|
168
|
-
// Display items (if hidden).
|
169
|
-
this.show();
|
170
|
-
};
|