Skip to content

Commit

Permalink
quick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DDKnoll committed May 24, 2014
1 parent fa08cb8 commit 1d87717
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
26 changes: 6 additions & 20 deletions js/instagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,11 @@ var instagramFeed = Ractive.extend({
else {
this.set('loading', true);
}
switch(method){
case 'replace':
callback = instagramReceiverReplace;
break;
case 'before':
callback = instagramReceiverFrontAppend;
break;
case 'after':
callback = instagramReceiverRearAppend;
break;
default:
console.log('Unknown load method');
return false;
}
console.log('calling IG API');

var tag = document.createElement('script');
tag.id = 'instagram-script-loader';
tag.onerror = function(){console.log('erroer');};
tag.onerror = function(){console.log('unable to reach IG API');};
tag.src = this.makeQuery(method);
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
Expand Down Expand Up @@ -187,7 +173,7 @@ var instagramFeed = Ractive.extend({

//Replace data.
this.replaceData = function(newData){
console.log(newData);
//console.log(newData);
if(newData.data == undefined){
this.set('message', 'Sorry no results for #'+this.data.search+" :[");
} else{
Expand All @@ -208,7 +194,7 @@ var instagramFeed = Ractive.extend({

//Append data to front of array and update data structure.
this.frontAppend = function(newData){
console.log(newData);
//console.log(newData);
if(newData.data.length==0){
console.log('Nothing to append');
} else{
Expand All @@ -221,15 +207,15 @@ var instagramFeed = Ractive.extend({
window.instagramReceiverFrontAppend = (function(obj){
return function (data) {
if(obj.validateData(data)){
obj.replaceData(data);
obj.frontAppend(data);
}
}
})(this);

//Append data to rear and update data structure.
this.rearAppend = function(newData){
console.log('rear Append');
console.log(newData);
//console.log(newData);
this.set('instagramData.data', this.data.instagramData.data.concat(newData.data));
//Set the pagination
if(newData.pagination.next_max_tag_id === undefined){
Expand All @@ -242,7 +228,7 @@ var instagramFeed = Ractive.extend({
window.instagramReceiverRearAppend = (function(obj){
return function (data) {
if(obj.validateData(data)){
obj.replaceData(data);
obj.rearAppend(data);
}
}
})(this);
Expand Down
4 changes: 2 additions & 2 deletions js/instagram.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1d87717

Please sign in to comment.