1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-11-22 09:56:51 +01:00

handle js libs with bower, remove socialite, comment out masonry stuff

This commit is contained in:
Matthias Kretschmann 2013-11-25 22:00:15 +01:00
parent b51096a9a8
commit 567eae6d55
12 changed files with 70 additions and 135 deletions

4
.gitignore vendored
View File

@ -1,3 +1,3 @@
node_modules node_modules
_site bower_components
_src/_media/gen _site

View File

@ -77,18 +77,23 @@ module.exports = function(grunt){
// Concatenate and minify js // Concatenate and minify js
uglify: { uglify: {
production: { options: {
options: { report: 'min'
report: 'min' },
}, jquery: {
files: { files: {
'<%= config.site %>/<%= config.assets.js %>/lib/picturefill.min.js': [ '<%= config.site %>/<%= config.assets.js %>/jquery.min.js': 'bower_components/jquery/jquery.js'
'<%= config.site %>/<%= config.assets.js %>/lib/picturefill.js' }
},
production: {
files: {
'<%= config.site %>/<%= config.assets.js %>/picturefill.min.js': [
'bower_components/picturefill/picturefill.js'
], ],
'<%= config.site %>/<%= config.assets.js %>/kremalicious3.min.js': [ '<%= config.site %>/<%= config.assets.js %>/kremalicious3.min.js': [
'<%= config.src %>/<%= config.assets.js %>/lib/infinitescroll/jquery.infinitescroll.js', 'bower_components/infinitescroll/index.js',
'<%= config.src %>/<%= config.assets.js %>/lib/socialite/socialite.js', //'bower_components/masonry/masonry.js',
'<%= config.src %>/<%= config.assets.js %>/plugins.js', //'bower_components/imagesloaded/imagesloaded.js',
'<%= config.src %>/<%= config.assets.js %>/app.js' '<%= config.src %>/<%= config.assets.js %>/app.js'
] ]
} }

View File

@ -24,6 +24,6 @@
</footer> </footer>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/assets/js/lib/jquery.min.js"><\/script>')</script> <script>window.jQuery || document.write('<script src="/assets/js/jquery.min.js"><\/script>')</script>
<script src="/assets/js/kremalicious3.min.js"></script> <script src="/assets/js/kremalicious3.min.js"></script>

View File

@ -57,7 +57,7 @@
<link rel="stylesheet" href="/assets/css/{{ page.style }}"> <link rel="stylesheet" href="/assets/css/{{ page.style }}">
{% endif %} {% endif %}
<script src="/assets/js/lib/picturefill.min.js" async></script> <script src="/assets/js/picturefill.min.js" async></script>
<script data-cfasync="false" src="//use.typekit.com/msu4qap.js"></script> <script data-cfasync="false" src="//use.typekit.com/msu4qap.js"></script>
<script data-cfasync="false">try{Typekit.load();}catch(e){}</script> <script data-cfasync="false">try{Typekit.load();}catch(e){}</script>

View File

@ -15,49 +15,43 @@
$(ASAP = function(){ $(ASAP = function(){
photoGrid.init(); //photoGrid.init();
}); });
$(window).load( AfterLoad = function() { $(window).load( AfterLoad = function() {
siteEffects.init(); //siteEffects.init();
infiniteScroll.init(); infiniteScroll.init();
}); });
var photoGrid = { // var photoGrid = {
//
masonryLayout: function() { // masonryLayout: function() {
var $container = $('#main .masonry'); // var $container = $('#main .masonry');
//
$container.imagesLoaded( function(){ // $container.imagesLoaded( function(){
$container.masonry({ // $container.masonry({
itemSelector : 'article', // itemSelector : 'article',
columnWidth : '.grid-sizer' // columnWidth : '.grid-sizer'
}); // });
}); // });
}, // },
//
init: function(){ // init: function(){
// only fire when photo post present and screen bigger than 480px // // only fire when photo post present and screen bigger than 480px
if ( $('#photos').length > 0 ) { // if ( $('#photos').length > 0 ) {
this.masonryLayout(); // //this.masonryLayout();
} // }
} // }
//
} // }
var siteEffects = { var siteEffects = {
socialiteButtons: function() {
$('#tweetsWrap').one('mouseenter', function() {
Socialite.load($(this)[0]);
});
},
init: function(){ init: function(){
this.socialiteButtons();
} }
} }
@ -83,7 +77,7 @@ var infiniteScroll = {
// run picturefill over retrieved items // run picturefill over retrieved items
picturefill(); picturefill();
// run the photogrid over retrieved items // run the photogrid over retrieved items
photoGrid.init(); //photoGrid.init();
}); });
}, },

@ -1 +0,0 @@
Subproject commit 0c1e76f0b51bd420907875968465bdc6035be71d

File diff suppressed because one or more lines are too long

View File

@ -1,67 +0,0 @@
/*! Picturefill - Responsive Images that work today. (and mimic the proposed Picture element with span elements). Author: Scott Jehl, Filament Group, 2012 | License: MIT/GPLv2 */
(function( w ){
// Enable strict mode
"use strict";
w.picturefill = function() {
var ps = w.document.getElementsByTagName( "span" );
// Loop the pictures
for( var i = 0, il = ps.length; i < il; i++ ){
if( ps[ i ].getAttribute( "data-picture" ) !== null ){
var sources = ps[ i ].getElementsByTagName( "span" ),
matches = [];
// See if which sources match
for( var j = 0, jl = sources.length; j < jl; j++ ){
var media = sources[ j ].getAttribute( "data-media" );
// if there's no media specified, OR w.matchMedia is supported
if( !media || ( w.matchMedia && w.matchMedia( media ).matches ) ){
matches.push( sources[ j ] );
}
}
// Find any existing img element in the picture element
var picImg = ps[ i ].getElementsByTagName( "img" )[ 0 ];
if( matches.length ){
var matchedEl = matches.pop();
if( !picImg || picImg.parentNode.nodeName === "NOSCRIPT" ){
picImg = w.document.createElement( "img" );
picImg.alt = ps[ i ].getAttribute( "data-alt" );
}
else if( matchedEl === picImg.parentNode ){
// Skip further actions if the correct image is already in place
continue;
}
picImg.src = matchedEl.getAttribute( "data-src" );
matchedEl.appendChild( picImg );
picImg.removeAttribute("width");
picImg.removeAttribute("height");
}
else if( picImg ){
picImg.parentNode.removeChild( picImg );
}
}
}
};
// Run on resize and domready (w.load as a fallback)
if( w.addEventListener ){
w.addEventListener( "resize", w.picturefill, false );
w.addEventListener( "DOMContentLoaded", function(){
w.picturefill();
// Run once only
w.removeEventListener( "load", w.picturefill, false );
}, false );
w.addEventListener( "load", w.picturefill, false );
}
else if( w.attachEvent ){
w.attachEvent( "onload", w.picturefill );
}
}( this ));

@ -1 +0,0 @@
Subproject commit fb04be59c2f5bf010439b4c21f631be0028faa2d

File diff suppressed because one or more lines are too long

27
bower.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "kremalicious3",
"version": "1.0.0",
"homepage": "http://mkretschmann.com",
"authors": [
"Matthias Kretschmann <m@kretschmann.io>"
],
"description": "Blog of Matthias Kretschmann",
"license": "MIT",
"private": true,
"dependencies": {
"jquery": "~2.0.3",
"picturefill": "~1.2.1",
"masonry": "~3.1.2",
"imagesloaded": "~3.0.4",
"infinitescroll": "https://raw.github.com/paulirish/infinite-scroll/master/jquery.infinitescroll.js"
},
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}