Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions _templates/collection.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@
{{!-- </div> --}}
</div>

{{!-- TODO Obviously, move this. --}}
<script src="https://rawgit.com/rogie/Dug.js/master/dug.js"></script>
<script src="/js/instagram.js"></script>

<script async defer src="/js/instagram.js"></script>

{{> footer }}
14 changes: 11 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
"bourbon-neat": "1.7.2",
"browser-sync": "2.7.13",
"browserify": "11.0.1",
"browserify-shim": "3.8.10",
"cheerio": "0.19.0",
"dug.js": "kennethormandy/dug.js",
"fg-loadcss": "0.1.6",
"fg-loadjs": "0.2.0",
"figment": "git://github.com/kennethormandy/figment.git#v0.6.2",
Expand Down Expand Up @@ -57,6 +59,12 @@
"travis-ci": "2.0.3",
"typogr": "kennethormandy/typogr.js#ko-wrapWidont"
},
"browserify": {
"transform": [ "browserify-shim" ]
},
"browserify-shim": {
"./node_modules/dug/dug.js": { "exports": "dug" }
},
"standard": {
"global": [
"loadCSS",
Expand All @@ -68,17 +76,17 @@
]
},
"scripts": {
"postinstall": "cp ./node_modules/normalize.css/normalize.css ./node_modules/normalize.css/normalize.scss && cp ./node_modules/losttype-contributors/index.json ./src/authors.json",
"postinstall": "napa && cp ./node_modules/normalize.css/normalize.css ./node_modules/normalize.css/normalize.scss && cp ./node_modules/losttype-contributors/index.json ./src/authors.json",
"lint": "standard src/js/*.js",
"test": "echo \"Error: no test specified…yet! Pull requests on https://github.com/losttype/blog.losttype.com are greatly appreciated.\" && exit 0",
"posttest": "npm run lint",
"build-html": "node_modules/metalsmith/bin/metalsmith",
"build-css": "node-sass src/css/index.scss | autoprefixer > build/css/index.css",
"build-js": "browserify src/js/index.js -o build/js/index.js",
"build-js": "browserify src/js/index.js -o build/js/index.js && browserify src/js/instagram.js -o build/js/instagram.js",
"build": "npm run build-html && npm run build-css && npm run build-js",
"watch-html": "onchange './_templates/*.hbs' './_includes/*.hbs' 'src/**/*.md' 'src/**/*.html' -- npm run build-html",
"watch-css": "onchange './src/**/*.scss' -- npm run build-css",
"watch-js": "onchange './src/**/*.js' -- npm run build-js -- -dv",
"watch-js": "onchange './src/js/*' -- npm run build-js -- -dv",
"sync": "browser-sync start --files './build/css/*.css' --server \"build\" --no-open",
"start": "npm run build && npm run watch-html & npm run watch-css & npm run watch-js & npm run sync",
"styleguide": "kss-node --source ./src/css --destination ./build/styleguide --css /css/index.css --placeholder=\"\" --homepage README.md",
Expand Down
48 changes: 26 additions & 22 deletions src/js/instagram.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
var instaId = 'js-instagram'
var instaEl = document.getElementById(instaId)
var instaHashtag = instaEl.getAttribute('data-hashtag') || 'losttypecoop'
require('../../node_modules/dug.js/dug')

dug({
target: instaId,
cacheExpire: '3600000',
endpoint: 'https://api.instagram.com/v1/tags/' + instaHashtag + '/media/recent?client_id=fad5f6d6043a4c9b9e456c7b0e0b359e',
beforeRender: function (feed) {
// feed.data.forEach(function (gram, i) {
// if(gram.user.username = 'rileycran' || (gram.location && gram.location.name === 'The Main') || (typeof gram.location === 'undefined' && gram.tags.length <= 3)) {
// } else {
// feed.data.splice(i, 1)
// }
// })
// return feed
},
template: '' +
'{{#data}}' +
'<li>' +
'<a href="{{link}}" class="photo" data-content="{{caption.text}}">' +
'<img src="{{images.low_resolution.url}}" alt="">' +
'</a>' +
'</li>' +
'{{/data}}'
})
console.log(dug())


// dug({
// target: instaId,
// cacheExpire: '3600000',
// endpoint: 'https://api.instagram.com/v1/tags/' + instaHashtag + '/media/recent?client_id=fad5f6d6043a4c9b9e456c7b0e0b359e',
// beforeRender: function (feed) {
// // feed.data.forEach(function (gram, i) {
// // if(gram.user.username = 'rileycran' || (gram.location && gram.location.name === 'The Main') || (typeof gram.location === 'undefined' && gram.tags.length <= 3)) {
// // } else {
// // feed.data.splice(i, 1)
// // }
// // })
// // return feed
// },
// template: '' +
// '{{#data}}' +
// '<li>' +
// '<a href="{{link}}" class="photo" data-content="{{caption.text}}">' +
// '<img src="{{images.low_resolution.url}}" alt="">' +
// '</a>' +
// '</li>' +
// '{{/data}}'
// })