Skip to content
Snippets Groups Projects
Commit f628b65d authored by Brian Canini's avatar Brian Canini
Browse files

adding library required for simple_instagram_feed

parent 0807e8f4
No related branches found
No related tags found
No related merge requests found
Showing
with 1329 additions and 0 deletions
*.html linguist-vendored
\ No newline at end of file
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['https://www.paypal.me/JavierSL']
name: Actions CI Test
on:
push:
branches:
- master
- dev
pull_request:
branches:
- master
- dev
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [8.x, 10.x, 12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
run: |
npm install
npm test
env:
CI: true
node_modules
package-lock.json
language: node_js
node_js:
- "10"
# Contributing
When contributing to this repository, please **first discuss the change you wish to make via issue**,
email, or any other method with the owners of this repository before making a change.
## Pull Request Process
1. Install all the dependencies using `npm install`
2. Make your changes and test them. Note that depending on your changes you may also have to modify existing tests or create new ones.
3. **Run the tests** using `npm run test`
4. **Build** the minified version using `npm run build`
5. **Update the docs** (index.html) with the changes. If it is a new feature ensure to include it in the first example.
6. **Increase the version numbers in every file** where the version number is present to the new version that this Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
## Optional
Consider making your changes also in [InstagramFeed](https://github.com/jsanahuja/InstagramFeed).
\ No newline at end of file
module.exports = function(grunt) {
grunt.initConfig({
babel: {
options: {
sourceMap: false,
comments: false,
sourceType: "unambiguous",
presets: ['@babel/preset-env', 'minify']
},
dist: {
files: {
'jquery.instagramFeed.min.js': ['jquery.instagramFeed.js']
}
}
},
qunit: {
files: ['test.html'],
options: {
puppeteer: {
ignoreDefaultArgs: true,
args: [
"--headless",
"--disable-web-security",
"--allow-file-access-from-files"
]
},
timeout: 10000
},
}
});
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.registerTask('test', 'qunit');
grunt.loadNpmTasks('grunt-babel');
grunt.registerTask('build', ['babel']);
};
MIT License
Copyright (c) 2018 Javier Sanahuja
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# jquery.instagramFeed [![Build Status](https://travis-ci.com/jsanahuja/jquery.instagramFeed.svg?branch=master)](https://travis-ci.com/jsanahuja/jquery.instagramFeed)
Instagram Feed without using the instagram API
Try [InstagramFeed](https://github.com/jsanahuja/InstagramFeed), the same without jQuery.
## Documentation
[Full documentation and examples here](https://www.sowecms.com/demos/jquery.instagramFeed/index.html "documentation")
## Contributing
Read and follow the [CONTRIBUTING.md](./CONTRIBUTING.md) before sending any pull request.
\ No newline at end of file
This diff is collapsed.
/*!
* jquery.instagramFeed
*
* @version 2.0.1
*
* https://github.com/jsanahuja/jquery.instagramFeed
*
*/
(function ($) {
var defaults = {
'host': "https://www.instagram.com/",
'username': '',
'tag': '',
'container': '',
'display_profile': true,
'display_biography': true,
'display_gallery': true,
'display_captions': false,
'display_igtv': false,
'callback': null,
'styling': true,
'items': 8,
'items_per_row': 4,
'margin': 0.5,
'image_size': 640,
'lazy_load': false,
'cache_time': 360,
'on_error': console.error
};
var image_sizes = {
"150": 0,
"240": 1,
"320": 2,
"480": 3,
"640": 4
};
var escape_map = {
'&': '&',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;',
'/': '&#x2F;',
'`': '&#x60;',
'=': '&#x3D;'
};
function escape_string(str) {
return str.replace(/[&<>"'`=\/]/g, function (char) {
return escape_map[char];
});
}
function parse_caption(igobj, data){
if (
typeof igobj.node.edge_media_to_caption.edges[0] !== "undefined" &&
typeof igobj.node.edge_media_to_caption.edges[0].node !== "undefined" &&
typeof igobj.node.edge_media_to_caption.edges[0].node.text !== "undefined" &&
igobj.node.edge_media_to_caption.edges[0].node.text !== null
) {
return igobj.node.edge_media_to_caption.edges[0].node.text;
}
if (
typeof igobj.node.title !== "undefined" &&
igobj.node.title !== null &&
igobj.node.title.length != 0
) {
return igobj.node.title;
}
if (
typeof igobj.node.accessibility_caption !== "undefined" &&
igobj.node.accessibility_caption !== null &&
igobj.node.accessibility_caption.length != 0
) {
return igobj.node.accessibility_caption;
}
return (this.is_tag ? data.name : data.username) + " image ";
}
$.instagramFeed = function (opts) {
function on_get_insta_data(data) {
if (typeof data === 'string') {
try {
data = data.split("window._sharedData = ")[1].split("<\/script>")[0];
} catch (e) {
options.on_error("Instagram Feed: It looks like the profile you are trying to fetch is age restricted. See https://github.com/jsanahuja/InstagramFeed/issues/26", 3);
return;
}
data = JSON.parse(data.substr(0, data.length - 1));
data = data.entry_data.ProfilePage || data.entry_data.TagPage;
var skipCaching = false;
if (typeof data === "undefined") {
var cache_data_raw = localStorage.getItem(cache_data_key);
if (cache_data_raw !== null) {
data = JSON.parse(cache_data_raw);
skipCaching = true;
}
options.on_error("Instagram Feed: Your network has been temporary banned by Instagram because of too many requests. Consider increasing your 'cache_time'. See https://github.com/jsanahuja/jquery.instagramFeed/issues/25 and https://github.com/jsanahuja/jquery.instagramFeed/issues/101", 4);
if (!data) return;
}
if (!skipCaching && options.cache_time > 0) {
localStorage.setItem(cache_data_key, JSON.stringify(data));
localStorage.setItem(cache_data_key_cached, new Date().getTime());
}
}
data = data[0].graphql.user || data[0].graphql.hashtag;
if (options.container != "") {
var html = "",
styles;
// Setting styles
if (options.styling) {
var width = (100 - options.margin * 2 * options.items_per_row) / options.items_per_row;
styles = {
profile_container: ' style="text-align:center;"',
profile_image: ' style="border-radius:10em;width:15%;max-width:125px;min-width:50px;"',
profile_name: ' style="font-size:1.2em;"',
profile_biography: ' style="font-size:1em;"',
gallery_image: ' style="width:100%;"',
gallery_image_link: ' style="width:' + width + '%; margin:' + options.margin + '%;position:relative; display: inline-block; height: 100%;"'
};
if(options.display_captions){
html += "<style>\
a[data-caption]:hover::after {\
content: attr(data-caption);\
text-align: center;\
font-size: 0.8rem;\
color: black;\
position: absolute;\
left: 0;\
right: 0;\
bottom: 0;\
padding: 1%;\
max-height: 100%;\
overflow-y: auto;\
overflow-x: hidden;\
background-color: hsla(0, 100%, 100%, 0.8);\
}\
</style>";
}
}else{
styles = {
profile_container: "",
profile_image: "",
profile_name: "",
profile_biography: "",
gallery_image: "",
gallery_image_link: ""
};
}
//Displaying profile
if (options.display_profile) {
html += '<div class="instagram_profile"' + styles.profile_container + '>';
html += '<img class="instagram_profile_image" src="' + data.profile_pic_url + '" alt="'+ (is_tag ? data.name + ' tag pic' : data.username + ' profile pic') + '"' + styles.profile_image + (options.lazy_load ? ' loading="lazy"' : '') + ' />';
if (is_tag)
html += '<p class="instagram_tag"' + styles.profile_name + '><a href="https://www.instagram.com/explore/tags/' + options.tag + '" rel="noopener" target="_blank">#' + options.tag + '</a></p>';
else
html += "<p class='instagram_username'" + styles.profile_name + ">@" + data.full_name + " (<a href='https://www.instagram.com/" + options.username + "' rel='noopener' target='_blank'>@" + options.username + "</a>)</p>";
if (!is_tag && options.display_biography)
html += "<p class='instagram_biography'" + styles.profile_biography + ">" + data.biography + "</p>";
html += "</div>";
}
//image size
var image_index = typeof image_sizes[options.image_size] !== "undefined" ? image_sizes[options.image_size] : image_sizes[640];
if (options.display_gallery) {
if (typeof data.is_private !== "undefined" && data.is_private === true) {
html += '<p class="instagram_private"><strong>This profile is private</strong></p>';
} else {
var imgs = (data.edge_owner_to_timeline_media || data.edge_hashtag_to_media).edges;
max = (imgs.length > options.items) ? options.items : imgs.length;
html += "<div class='instagram_gallery'>";
for (var i = 0; i < max; i++) {
var url = "https://www.instagram.com/p/" + imgs[i].node.shortcode,
image, type_resource,
caption = escape_string(parse_caption(imgs[i], data));
switch (imgs[i].node.__typename) {
case "GraphSidecar":
type_resource = "sidecar"
image = imgs[i].node.thumbnail_resources[image_index].src;
break;
case "GraphVideo":
type_resource = "video";
image = imgs[i].node.thumbnail_src
break;
default:
type_resource = "image";
image = imgs[i].node.thumbnail_resources[image_index].src;
}
html += '<a href="' + url + '"' + (options.display_captions ? ' data-caption="' + caption + '"' : '') + ' class="instagram-' + type_resource + '" rel="noopener" target="_blank"' + styles.gallery_image_link + '>';
html += '<img' + (options.lazy_load ? ' loading="lazy"' : '') + ' src="' + image + '" alt="' + caption + '"' + styles.gallery_image + ' />';
html += '</a>';
}
html += '</div>';
}
}
if (options.display_igtv && typeof data.edge_felix_video_timeline !== "undefined") {
var igtv = data.edge_felix_video_timeline.edges,
max = (igtv.length > options.items) ? options.items : igtv.length
if (igtv.length > 0) {
html += '<div class="instagram_igtv">';
for (var i = 0; i < max; i++) {
var url = 'https://www.instagram.com/p/' + igtv[i].node.shortcode,
caption = escape_string(parse_caption(igtv[i], data));
html += '<a href="' + url + '"' + (options.display_captions ? ' data-caption="' + caption + '"' : '') + ' rel="noopener" target="_blank"' + styles.gallery_image_link + '>';
html += '<img' + (options.lazy_load ? ' loading="lazy"' : '') + ' src="' + igtv[i].node.thumbnail_src + '" alt="' + caption + '"' + styles.gallery_image + ' />';
html += '</a>';
}
html += '</div>';
}
}
$(options.container).html(html);
}
if (options.callback != null) {
options.callback(data);
}
}
var options = $.fn.extend({}, defaults, opts);
if (options.username == "" && options.tag == "") {
options.on_error("Instagram Feed: Error, no username nor tag defined.", 1);
return false;
}
if (typeof options.get_data !== "undefined") {
console.warn("Instagram Feed: options.get_data is deprecated, options.callback is always called if defined");
}
if (options.callback == null && options.container == "") {
options.on_error("Instagram Feed: Error, neither container found nor callback defined.", 2);
return false;
}
var is_tag = options.username == "",
url = is_tag ? options.host + "explore/tags/" + options.tag + "/" : options.host + options.username + "/",
cache_data = null,
cache_data_key = 'instagramFeed_' + (is_tag ? 't_' + options.tag : 'u_' + options.username),
cache_data_key_cached = cache_data_key + '_cached';
if (options.cache_time > 0) {
var cached_time = localStorage.getItem(cache_data_key_cached);
if (cached_time !== null && parseInt(cached_time) + 1000 * 60 * options.cache_time > new Date().getTime()) {
var cache_data_raw = localStorage.getItem(cache_data_key);
if(cache_data_raw !== null){
cache_data = JSON.parse(cache_data_raw);
}
}
}
if (cache_data !== null) {
on_get_insta_data(cache_data);
} else {
$.get(url, on_get_insta_data).fail(function (e) {
options.on_error("Instagram Feed: Unable to fetch the given user/tag. Instagram responded with the status code: " + e.status, 5);
});
}
return true;
};
})(jQuery);
(function(a){function b(a){return a.replace(/[&<>"'`=\/]/g,function(a){return f[a]})}function c(a,b){return"undefined"!=typeof a.node.edge_media_to_caption.edges[0]&&"undefined"!=typeof a.node.edge_media_to_caption.edges[0].node&&"undefined"!=typeof a.node.edge_media_to_caption.edges[0].node.text&&null!==a.node.edge_media_to_caption.edges[0].node.text?a.node.edge_media_to_caption.edges[0].node.text:"undefined"!=typeof a.node.title&&null!==a.node.title&&0!=a.node.title.length?a.node.title:"undefined"!=typeof a.node.accessibility_caption&&null!==a.node.accessibility_caption&&0!=a.node.accessibility_caption.length?a.node.accessibility_caption:(this.is_tag?b.name:b.username)+" image "}var d={host:"https://www.instagram.com/",username:"",tag:"",container:"",display_profile:!0,display_biography:!0,display_gallery:!0,display_captions:!1,display_igtv:!1,callback:null,styling:!0,items:8,items_per_row:4,margin:.5,image_size:640,lazy_load:!1,cache_time:360,on_error:console.error},e={150:0,240:1,320:2,480:3,640:4},f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};a.instagramFeed=function(f){function g(d){if("string"==typeof d){try{d=d.split("window._sharedData = ")[1].split("</script>")[0]}catch(a){return void h.on_error("Instagram Feed: It looks like the profile you are trying to fetch is age restricted. See https://github.com/jsanahuja/InstagramFeed/issues/26",3)}d=JSON.parse(d.substr(0,d.length-1)),d=d.entry_data.ProfilePage||d.entry_data.TagPage;var f=!1;if("undefined"==typeof d){var g=localStorage.getItem(m);if(null!==g&&(d=JSON.parse(g),f=!0),h.on_error("Instagram Feed: Your network has been temporary banned by Instagram because of too many requests. Consider increasing your 'cache_time'. See https://github.com/jsanahuja/jquery.instagramFeed/issues/25 and https://github.com/jsanahuja/jquery.instagramFeed/issues/101",4),!d)return}!f&&0<h.cache_time&&(localStorage.setItem(m,JSON.stringify(d)),localStorage.setItem(n,new Date().getTime()))}if(d=d[0].graphql.user||d[0].graphql.hashtag,""!=h.container){var k,l="";if(h.styling){var o=(100-2*h.margin*h.items_per_row)/h.items_per_row;k={profile_container:" style=\"text-align:center;\"",profile_image:" style=\"border-radius:10em;width:15%;max-width:125px;min-width:50px;\"",profile_name:" style=\"font-size:1.2em;\"",profile_biography:" style=\"font-size:1em;\"",gallery_image:" style=\"width:100%;\"",gallery_image_link:" style=\"width:"+o+"%; margin:"+h.margin+"%;position:relative; display: inline-block; height: 100%;\""},h.display_captions&&(l+="<style> a[data-caption]:hover::after { content: attr(data-caption); text-align: center; font-size: 0.8rem; color: black; position: absolute; left: 0; right: 0; bottom: 0; padding: 1%; max-height: 100%; overflow-y: auto; overflow-x: hidden; background-color: hsla(0, 100%, 100%, 0.8); } </style>")}else k={profile_container:"",profile_image:"",profile_name:"",profile_biography:"",gallery_image:"",gallery_image_link:""};h.display_profile&&(l+="<div class=\"instagram_profile\""+k.profile_container+">",l+="<img class=\"instagram_profile_image\" src=\""+d.profile_pic_url+"\" alt=\""+(j?d.name+" tag pic":d.username+" profile pic")+"\""+k.profile_image+(h.lazy_load?" loading=\"lazy\"":"")+" />",l+=j?"<p class=\"instagram_tag\""+k.profile_name+"><a href=\"https://www.instagram.com/explore/tags/"+h.tag+"\" rel=\"noopener\" target=\"_blank\">#"+h.tag+"</a></p>":"<p class='instagram_username'"+k.profile_name+">@"+d.full_name+" (<a href='https://www.instagram.com/"+h.username+"' rel='noopener' target='_blank'>@"+h.username+"</a>)</p>",!j&&h.display_biography&&(l+="<p class='instagram_biography'"+k.profile_biography+">"+d.biography+"</p>"),l+="</div>");var p="undefined"==typeof e[h.image_size]?e[640]:e[h.image_size];if(h.display_gallery)if("undefined"!=typeof d.is_private&&!0===d.is_private)l+="<p class=\"instagram_private\"><strong>This profile is private</strong></p>";else{var q=(d.edge_owner_to_timeline_media||d.edge_hashtag_to_media).edges;x=q.length>h.items?h.items:q.length,l+="<div class='instagram_gallery'>";for(var r=0;r<x;r++){var s,t,u="https://www.instagram.com/p/"+q[r].node.shortcode,v=b(c(q[r],d));switch(q[r].node.__typename){case"GraphSidecar":t="sidecar",s=q[r].node.thumbnail_resources[p].src;break;case"GraphVideo":t="video",s=q[r].node.thumbnail_src;break;default:t="image",s=q[r].node.thumbnail_resources[p].src;}l+="<a href=\""+u+"\""+(h.display_captions?" data-caption=\""+v+"\"":"")+" class=\"instagram-"+t+"\" rel=\"noopener\" target=\"_blank\""+k.gallery_image_link+">",l+="<img"+(h.lazy_load?" loading=\"lazy\"":"")+" src=\""+s+"\" alt=\""+v+"\""+k.gallery_image+" />",l+="</a>"}l+="</div>"}if(h.display_igtv&&"undefined"!=typeof d.edge_felix_video_timeline){var w=d.edge_felix_video_timeline.edges,x=w.length>h.items?h.items:w.length;if(0<w.length){l+="<div class=\"instagram_igtv\">";for(var r=0;r<x;r++){var u="https://www.instagram.com/p/"+w[r].node.shortcode,v=b(c(w[r],d));l+="<a href=\""+u+"\""+(h.display_captions?" data-caption=\""+v+"\"":"")+" rel=\"noopener\" target=\"_blank\""+k.gallery_image_link+">",l+="<img"+(h.lazy_load?" loading=\"lazy\"":"")+" src=\""+w[r].node.thumbnail_src+"\" alt=\""+v+"\""+k.gallery_image+" />",l+="</a>"}l+="</div>"}}a(h.container).html(l)}null!=h.callback&&h.callback(d)}var h=a.fn.extend({},d,f);if(""==h.username&&""==h.tag)return h.on_error("Instagram Feed: Error, no username nor tag defined.",1),!1;if("undefined"!=typeof h.get_data&&console.warn("Instagram Feed: options.get_data is deprecated, options.callback is always called if defined"),null==h.callback&&""==h.container)return h.on_error("Instagram Feed: Error, neither container found nor callback defined.",2),!1;var j=""==h.username,k=j?h.host+"explore/tags/"+h.tag+"/":h.host+h.username+"/",l=null,m="instagramFeed_"+(j?"t_"+h.tag:"u_"+h.username),n=m+"_cached";if(0<h.cache_time){var o=localStorage.getItem(n);if(null!==o&&parseInt(o)+60000*h.cache_time>new Date().getTime()){var p=localStorage.getItem(m);null!==p&&(l=JSON.parse(p))}}return null===l?a.get(k,g).fail(function(a){h.on_error("Instagram Feed: Unable to fetch the given user/tag. Instagram responded with the status code: "+a.status,5)}):g(l),!0}})(jQuery);
{
"name": "jquery.instagramFeed",
"description": "Instagram Feed without access token. Not using the Instagram API",
"homepage": "https://github.com/jsanahuja/jquery.instagramFeed",
"version": "2.0.1",
"keywords": [
"instagram",
"feed",
"instagramfeed",
"without",
"access",
"token"
],
"author": {
"name": "Javier Sanahuja",
"email": "bannss1@gmail.com"
},
"contributors": [
{
"name": "Cristian Sanahuja",
"email": "csanahuja10@gmail.com"
}
],
"repository": {
"type": "git",
"url": "https://github.com/jsanahuja/jquery.instagramFeed.git"
},
"license": "MIT",
"devDependencies": {
"grunt": "^1.1.0",
"grunt-contrib-qunit": "^3.1.0",
"@babel/core": "^7.8.3",
"@babel/preset-env": "^7.8.3",
"babel-preset-minify": "^0.5.1",
"grunt-babel": "^8.0.0"
},
"scripts": {
"test": "grunt test",
"build": "grunt build"
}
}
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>QUnit Example</title>
<link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.9.2.css">
<script src="https://code.jquery.com/qunit/qunit-2.9.2.js"></script>
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div style="display:none" id="instagram-feed1"></div>
<div style="display:none" id="instagram-feed2"></div>
<div style="display:none" id="instagram-feed3"></div>
<div style="display:none" id="instagram-feed4"></div>
<div style="display:none" id="instagram-feed5"></div>
<script src="jquery.instagramFeed.min.js"></script>
<script>
(function($){
$(window).on('load', function(){
QUnit.test("Test1", function( assert ) {
var failed = false;
try{
$.instagramFeed({
'username': 'instagram',
'container': "#instagram-feed1",
'display_profile': true,
'display_biography': true,
'display_gallery': true,
'display_captions': true,
'get_raw_json': false,
'callback': null,
'styling': true,
'items': 8,
'items_per_row': 4,
'margin': 1
});
}catch(e){
failed = true;
}
assert.ok(failed === false, "Passed Test1!");
});
QUnit.test("Test2", function( assert ) {
var failed = false;
try{
$.instagramFeed({
'username': 'github',
'container': "#instagram-feed2",
'display_profile': false,
'display_biography': false,
'display_gallery': true,
'display_captions': false,
'get_raw_json': false,
'callback': null,
'styling': true,
'items': 8,
'items_per_row': 4,
'margin': 1
});
}catch(e){
failed = true;
}
assert.ok(failed === false, "Passed Test2!");
});
QUnit.test("Test3", function( assert ) {
var failed = false;
try{
$.instagramFeed({
'username': 'zara',
'container': "#instagram-feed3",
'display_profile': false,
'display_biography': false,
'display_gallery': true,
'get_raw_json': false,
'callback': null,
'styling': true,
'items': 12,
'items_per_row': 6,
'margin': 0.25
});
}catch(e){
failed = true;
}
assert.ok(failed === false, "Passed Test3!");
});
QUnit.test("Test4", function( assert ) {
var failed = false;
try{
$.instagramFeed({
'username': 'fcbarcelona',
'container': "#instagram-feed4",
'display_profile': false,
'display_biography': false,
'display_gallery': false,
'display_igtv': true,
'get_raw_json': false,
'callback': null,
'styling': true,
'items': 8,
'items_per_row': 4,
'margin': 1
});
}catch(e){
failed = true;
}
assert.ok(failed === false, "Passed Test4!");
});
QUnit.test("Test5", function( assert ) {
var failed = false;
try{
$.instagramFeed({
'username': 'travisci',
'callback': function(json){
$('#instagram-feed5').html(json);
}
});
}catch(e){
failed = true;
}
assert.ok(failed === false, "Passed Test5!");
});
QUnit.test("Test6", function( assert ) {
var failed = false;
try{
$.instagramFeed({
'tag': 'paradise',
'container': "#instagram-feed4",
'display_profile': true,
'display_gallery': true,
'display_captions': true,
'items': 100,
'items_per_row': 5,
'margin': 0.5
});
}catch(e){
failed = true;
}
assert.ok(failed === false, "Passed Test6!");
});
QUnit.test("Test7", function( assert ) {
var status = $.instagramFeed({});
assert.ok(status === false, "Passed Test7 (no username nor tag)!");
});
QUnit.test("Test8", function( assert ) {
var status = $.instagramFeed({
"username": "travisci"
});
assert.ok(status === false, "Passed Test8! (no container nor callback)");
});
});
})(jQuery);
</script>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment