Adding bower_components to _site, they wont be gitignored
This commit is contained in:
parent
8038a31de7
commit
2824ba5aaf
274 changed files with 46334 additions and 3 deletions
161
_site/bower_components/picbookjs/js/picbook.js
vendored
Normal file
161
_site/bower_components/picbookjs/js/picbook.js
vendored
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
/* picbookJs 0.3.0 | Copyright (C) 2014 Henrique Alves, http://henriquea.github.io/picbookjs */
|
||||
var _picbookOptions = null;
|
||||
|
||||
var picbookJs = (function(document){
|
||||
|
||||
'use strict';
|
||||
|
||||
function picbookJs(options) {
|
||||
|
||||
/*jslint validthis: true */
|
||||
this.options = this.extend(this._options, options);
|
||||
this.init();
|
||||
_picbookOptions = this.options;
|
||||
|
||||
}
|
||||
|
||||
picbookJs.prototype = {
|
||||
|
||||
count: 0,
|
||||
|
||||
loaded: false,
|
||||
|
||||
dom: {},
|
||||
|
||||
_options: {
|
||||
graph: 'https://graph.facebook.com/',
|
||||
limit: 10,
|
||||
},
|
||||
|
||||
init: function() {
|
||||
|
||||
this.loaded = false;
|
||||
this.getAlbum({
|
||||
callback: 'picbookJs.prototype.albumComplete'
|
||||
});
|
||||
|
||||
// Setup DOM
|
||||
this.dom.wrapper = document.querySelector('.picbook');
|
||||
this.dom.title = document.createElement('h3');
|
||||
this.dom.title.classList.add('album-title');
|
||||
this.dom.photos = document.createElement('ul');
|
||||
this.dom.photos.classList.add('photo-list');
|
||||
this.dom.wrapper.appendChild(this.dom.title);
|
||||
this.dom.wrapper.appendChild(this.dom.photos);
|
||||
|
||||
},
|
||||
|
||||
getAlbum: function(params) {
|
||||
|
||||
var js = document.createElement('script'),
|
||||
options = _picbookOptions || this.options,
|
||||
url = options.graph + options.albumId,
|
||||
s;
|
||||
|
||||
js.type = 'text/javascript';
|
||||
js.async = true;
|
||||
js.src = url + '?callback=' + params.callback;
|
||||
|
||||
s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(js, s.nextSibling);
|
||||
|
||||
},
|
||||
|
||||
// TODO: adpated the method for paging the data
|
||||
getPhotos: function(params) {
|
||||
|
||||
var js = document.createElement('script'),
|
||||
options = _picbookOptions || this.options,
|
||||
url = options.graph + options.albumId + '/photos',
|
||||
s;
|
||||
|
||||
js.type = 'text/javascript';
|
||||
js.async = true;
|
||||
js.src = url + '?limit=' + options.limit + '&callback=' + params.callback;
|
||||
|
||||
s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(js, s.nextSibling);
|
||||
|
||||
},
|
||||
|
||||
// https://developers.facebook.com/docs/reference/api/album
|
||||
albumComplete: function(response) {
|
||||
|
||||
var options = _picbookOptions || this.options;
|
||||
|
||||
this.album = response;
|
||||
this.count = response.count;
|
||||
this.getPhotos({
|
||||
callback: 'picbookJs.prototype.photosComplete'
|
||||
});
|
||||
|
||||
if (typeof options.albumLoaded === 'function') {
|
||||
options.albumLoaded();
|
||||
}
|
||||
|
||||
this.dom.title.innerHTML = response.name;
|
||||
|
||||
},
|
||||
|
||||
// https://developers.facebook.com/docs/graph-api/reference/photo
|
||||
photosComplete: function(response) {
|
||||
|
||||
var options = _picbookOptions || this.options;
|
||||
|
||||
this.photos = response.data;
|
||||
this.loaded = true;
|
||||
this.createPhotos();
|
||||
|
||||
if (typeof options.photosLoaded === 'function') {
|
||||
options.photosLoaded();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
createPhotos: function() {
|
||||
|
||||
var arrUrl = [], imgSrc, i, len, image, li, a, link;
|
||||
|
||||
for (i=0, len = this.photos.length; i < len; i++) {
|
||||
|
||||
image = this.photos[i].images[0];
|
||||
|
||||
// Check if photo has public permission
|
||||
if (!image.source.match(/oh=/)) {
|
||||
|
||||
link = this.photos[i].link.replace(/graph.facebook/gi, 'www.facebook');
|
||||
li = document.createElement('li');
|
||||
a = document.createElement('a');
|
||||
li.classList.add('photo-list-item');
|
||||
this.dom.photos.appendChild(li);
|
||||
li.appendChild(a);
|
||||
a.classList.add('item-thumb');
|
||||
|
||||
arrUrl = image.source.split('/').splice(0);
|
||||
arrUrl.splice(5,0,'p206x206');
|
||||
imgSrc = arrUrl.join('/');
|
||||
|
||||
a.setAttribute('href', link);
|
||||
a.setAttribute('style', 'background-image: url('+ imgSrc +')');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
extend: function(a, b) {
|
||||
|
||||
for (var key in b) {
|
||||
if (b.hasOwnProperty(key)) {
|
||||
a[key] = b[key];
|
||||
}
|
||||
}
|
||||
return a;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return picbookJs;
|
||||
|
||||
})(document);
|
||||
2
_site/bower_components/picbookjs/js/picbook.min.js
vendored
Normal file
2
_site/bower_components/picbookjs/js/picbook.min.js
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
/*! picbookJs 0.3.0 Copyright (C) 2014 Henrique Alves, http://henriquea.github.io/picbookjs */
|
||||
var _picbookOptions=null,picbookJs=function(a){"use strict";function b(a){this.options=this.extend(this._options,a),this.init(),_picbookOptions=this.options}return b.prototype={count:0,loaded:!1,dom:{},_options:{graph:"https://graph.facebook.com/",limit:10},init:function(){this.loaded=!1,this.getAlbum({callback:"picbookJs.prototype.albumComplete"}),this.dom.wrapper=a.querySelector(".picbook"),this.dom.title=a.createElement("h3"),this.dom.title.classList.add("album-title"),this.dom.photos=a.createElement("ul"),this.dom.photos.classList.add("photo-list"),this.dom.wrapper.appendChild(this.dom.title),this.dom.wrapper.appendChild(this.dom.photos)},getAlbum:function(b){var c,d=a.createElement("script"),e=_picbookOptions||this.options,f=e.graph+e.albumId;d.type="text/javascript",d.async=!0,d.src=f+"?callback="+b.callback,c=a.getElementsByTagName("script")[0],c.parentNode.insertBefore(d,c.nextSibling)},getPhotos:function(b){var c,d=a.createElement("script"),e=_picbookOptions||this.options,f=e.graph+e.albumId+"/photos";d.type="text/javascript",d.async=!0,d.src=f+"?limit="+e.limit+"&callback="+b.callback,c=a.getElementsByTagName("script")[0],c.parentNode.insertBefore(d,c.nextSibling)},albumComplete:function(a){var b=_picbookOptions||this.options;this.album=a,this.count=a.count,this.getPhotos({callback:"picbookJs.prototype.photosComplete"}),"function"==typeof b.albumLoaded&&b.albumLoaded(),this.dom.title.innerHTML=a.name},photosComplete:function(a){var b=_picbookOptions||this.options;this.photos=a.data,this.loaded=!0,this.createPhotos(),"function"==typeof b.photosLoaded&&b.photosLoaded()},createPhotos:function(){var b,c,d,e,f,g,h,i=[];for(c=0,d=this.photos.length;d>c;c++)e=this.photos[c].images[0],e.source.match(/oh=/)||(h=this.photos[c].link.replace(/graph.facebook/gi,"www.facebook"),f=a.createElement("li"),g=a.createElement("a"),f.classList.add("photo-list-item"),this.dom.photos.appendChild(f),f.appendChild(g),g.classList.add("item-thumb"),i=e.source.split("/").splice(0),i.splice(5,0,"p206x206"),b=i.join("/"),g.setAttribute("href",h),g.setAttribute("style","background-image: url("+b+")"))},extend:function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}},b}(document);
|
||||
Loading…
Add table
Add a link
Reference in a new issue