diff --git a/web/libraries/jqueryinstagramfeed/.gitattributes b/web/libraries/jqueryinstagramfeed/.gitattributes new file mode 100755 index 0000000000000000000000000000000000000000..5876c3813c2da186ce0f87483735aa059c6aeac0 --- /dev/null +++ b/web/libraries/jqueryinstagramfeed/.gitattributes @@ -0,0 +1 @@ +*.html linguist-vendored \ No newline at end of file diff --git a/web/libraries/jqueryinstagramfeed/.github/FUNDING.yml b/web/libraries/jqueryinstagramfeed/.github/FUNDING.yml new file mode 100755 index 0000000000000000000000000000000000000000..c769252f4e0e0ef845726fb2c73c6f8b5b50b8e7 --- /dev/null +++ b/web/libraries/jqueryinstagramfeed/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# 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'] diff --git a/web/libraries/jqueryinstagramfeed/.github/workflows/nodejs.yml b/web/libraries/jqueryinstagramfeed/.github/workflows/nodejs.yml new file mode 100755 index 0000000000000000000000000000000000000000..32ca0b4d692e97ce85e4850c90b5753f160b9d5c --- /dev/null +++ b/web/libraries/jqueryinstagramfeed/.github/workflows/nodejs.yml @@ -0,0 +1,31 @@ +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 diff --git a/web/libraries/jqueryinstagramfeed/.gitignore b/web/libraries/jqueryinstagramfeed/.gitignore new file mode 100755 index 0000000000000000000000000000000000000000..099ae14717d3c10d7f9b58d63aafe310cef0aade --- /dev/null +++ b/web/libraries/jqueryinstagramfeed/.gitignore @@ -0,0 +1,3 @@ +node_modules +package-lock.json + diff --git a/web/libraries/jqueryinstagramfeed/.travis.yml b/web/libraries/jqueryinstagramfeed/.travis.yml new file mode 100755 index 0000000000000000000000000000000000000000..45555037ee11931d2b338a3f2d39649732c224a8 --- /dev/null +++ b/web/libraries/jqueryinstagramfeed/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "10" diff --git a/web/libraries/jqueryinstagramfeed/CONTRIBUTING.md b/web/libraries/jqueryinstagramfeed/CONTRIBUTING.md new file mode 100755 index 0000000000000000000000000000000000000000..1aca6fb38fce81b024d92ffa2a0325a7a5606daa --- /dev/null +++ b/web/libraries/jqueryinstagramfeed/CONTRIBUTING.md @@ -0,0 +1,17 @@ +# 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 diff --git a/web/libraries/jqueryinstagramfeed/Gruntfile.js b/web/libraries/jqueryinstagramfeed/Gruntfile.js new file mode 100755 index 0000000000000000000000000000000000000000..3ec29796b03d47b1e5ddf6bdb9a0d098156bcc38 --- /dev/null +++ b/web/libraries/jqueryinstagramfeed/Gruntfile.js @@ -0,0 +1,36 @@ +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']); +}; diff --git a/web/libraries/jqueryinstagramfeed/LICENSE b/web/libraries/jqueryinstagramfeed/LICENSE new file mode 100755 index 0000000000000000000000000000000000000000..5e5dc17d4971ccbab1def8edf0ac4b8701a403a4 --- /dev/null +++ b/web/libraries/jqueryinstagramfeed/LICENSE @@ -0,0 +1,21 @@ +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. diff --git a/web/libraries/jqueryinstagramfeed/README.md b/web/libraries/jqueryinstagramfeed/README.md new file mode 100755 index 0000000000000000000000000000000000000000..ceebd9e8dd13354a44acd4270d352b967487227f --- /dev/null +++ b/web/libraries/jqueryinstagramfeed/README.md @@ -0,0 +1,12 @@ +# jquery.instagramFeed [](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 diff --git a/web/libraries/jqueryinstagramfeed/index.html b/web/libraries/jqueryinstagramfeed/index.html new file mode 100755 index 0000000000000000000000000000000000000000..1ff9ba5a8a3c9d98592e38a3f2670a5c0aade1bc --- /dev/null +++ b/web/libraries/jqueryinstagramfeed/index.html @@ -0,0 +1,712 @@ +<!DOCTYPE HTML> +<html xmlns="http://www.w3.org/1999/xhtml"> + +<head> + <meta charset="utf-8"> + <title>jquery.instagramFeed</title> + + <!-- jquery.instagramFeed HAS NO DEPENDENCIES (but jquery). You don't need any of those, it's just for documentation!! --> + <!-- jquery.instagramFeed HAS NO DEPENDENCIES (but jquery). You don't need any of those, it's just for documentation!! --> + <!-- jquery.instagramFeed HAS NO DEPENDENCIES (but jquery). You don't need any of those, it's just for documentation!! --> + <link rel="stylesheet" + href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" + integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" + crossorigin="anonymous"> + + <script + src="https://code.jquery.com/jquery-3.4.1.min.js" + integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" + crossorigin="anonymous"></script> + <script + src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" + integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" + crossorigin="anonymous"></script> + <script + src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" + integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" + crossorigin="anonymous"></script> + + <script src="https://www.sowecms.com/demos/statics/prism.js"></script> + <link rel="stylesheet" type="text/css" href="https://www.sowecms.com/demos/statics/prism.css"> + <!-- jquery.instagramFeed HAS NO DEPENDENCIES (but jquery). You don't need any of those, it's just for documentation!! --> + <!-- jquery.instagramFeed HAS NO DEPENDENCIES (but jquery). You don't need any of those, it's just for documentation!! --> + <!-- jquery.instagramFeed HAS NO DEPENDENCIES (but jquery). You don't need any of those, it's just for documentation!! --> + + <style> + + .bg-primary-2 { + background-color: #3779B3; + } + + .bg-secondary-2 { + background: #cbdbe8; + } + + .text-underline { + text-decoration: underline; + } + + .text-bold { + font-weight: 700; + } + + .text-italic { + font-style: italic; + } + + .text-small { + font-size: 0.8em; + } + + .flex-grow-1 { + flex-grow: 1; + } + + #btn-top { + position: fixed; + z-index: 999; + bottom: 1em; + top: auto; + left: auto; + right: 1em; + margin-left: -1.9rem; + opacity: .66; + display: none; + } + + .instagram_feed { + overflow:hidden; + } + + #jsonHere { + max-height: 60vh; + overflow: auto; + } + </style> +</head> + +<body> + + <header id="header" class="bg-primary-2"> + <div class="container py-4"> + <div class="row"> + <div class="col-xs-12 col-md-8"> + <h1 class="text-white m-0"> Documentation jquery.instagramFeed </h1> + <p class="text-white m-0">Instagram Feed without access token. We like Instagram but hate his API</p> + <ul class="list-inline menu-navigation pt-3"> + <li class="list-inline-item"><a class="text-white" href="#options">Options</a></li> + <li class="list-inline-item"><a class="text-white" href="#examples">Examples</a></li> + </ul> + </div> + <div class="col-xs-12 col-md-4"> + <ul class="list-unstyled text-md-right"> + <li> + <a class="text-white text-underline d-flex align-items-center" target="_blank" rel="noopener" + href="https://github.com/jsanahuja/jquery.instagramFeed"> + + <span class="mr-2 flex-grow-1">Visit our repository</span> + <svg class="octicon octicon-mark-github v-align-middle" fill="white" height="32" viewBox="0 0 16 16" version="1.1" width="32" aria-hidden="true"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg> + </a> + </li> + <li class="pt-2"> + <a class="text-white text-underline d-flex align-items-center" target="_blank" rel="noopener" + href="https://www.paypal.me/JavierSL"> + + <span class="mr-2 flex-grow-1">Support us</span> + <svg class="octicon v-align-middle" fill="white" height="32" width="32" viewBox="0 0 32 32"><path d="M29.41 11.535c.215 1 .192 2.215-.07 3.645-1.035 5.285-4.399 7.925-10.09 7.925h-.785a1.17 1.17 0 0 0-.785.297 1.29 1.29 0 0 0-.43.758l-.07.34-.985 6.18-.035.265a1.27 1.27 0 0 1-.437.762c-.23.195-.496.293-.793.293h-4.485a.715.715 0 0 1-.59-.27.806.806 0 0 1-.16-.64c.11-.668.266-1.668.473-3 .21-1.332.367-2.332.477-3 .105-.668.265-1.664.48-2.992.215-1.328.375-2.325.48-2.993.063-.437.317-.66.77-.66h2.34c1.582.024 2.988-.101 4.215-.375 2.082-.465 3.789-1.32 5.125-2.57 1.215-1.133 2.136-2.594 2.765-4.395.285-.832.496-1.625.625-2.375.012-.07.028-.113.047-.132a.06.06 0 0 1 .063-.016.263.263 0 0 1 .105.063c.942.699 1.524 1.664 1.75 2.89zM26.34 6.5c0 1.273-.274 2.68-.82 4.215-.954 2.773-2.75 4.648-5.395 5.625-1.344.476-2.844.726-4.5.75 0 .012-.535.015-1.605.015l-1.61-.015c-1.191 0-1.89.57-2.105 1.715-.024.093-.532 3.25-1.52 9.465-.012.117-.082.175-.215.175H3.305a.833.833 0 0 1-.653-.293.831.831 0 0 1-.207-.687L6.59 1.195c.058-.343.223-.629.492-.855C7.348.113 7.656 0 8 0h10.68c.402 0 .984.078 1.738.23.758.157 1.422.348 1.992.575 1.274.488 2.246 1.218 2.922 2.195.672.977 1.008 2.145 1.008 3.5zm0 0" /></svg> + </a> + </li> + <li class="pt-3"> + <a class="text-white text-right" target="_blank" rel="noopener" + href="https://travis-ci.com/jsanahuja/jquery.instagramFeed"> + <img src="https://travis-ci.com/jsanahuja/jquery.instagramFeed.svg?branch=master" alt="Build Status" /> + </a> + </li> + </ul> + </div> + </div> + </div> + </header> + + + <section id="options"> + <div class="bg-secondary-2 py-3"> + <div class="container"> + <h3>Options</h3> + </div> + </div> + + <div class="container py-3"> + + <table class="table table-striped"> + <thead class="thead-light"> + <tr> + <th>Attribute</th> + <th>Type</th> + <th>Default</th> + <th style="width: 40%">Description</th> + </tr> + </thead> + <tbody> + <tr> + <td class="d-flex flex-wrap"> + <code class="text-bold flex-grow-1">username</code> + <span class="text-danger text-small text-italic">Required / Optional</span> + </td> + <td><em>String</em></td> + <td><code>null</code></td> + <td>Instagram username from where to retrieve the feed. Required if <span class="text-small text-italic">tag</span> is not defined.</td> + </tr> + <tr> + <td class="d-flex flex-wrap"> + <code class="text-bold flex-grow-1">tag</code> + <span class="text-danger text-small text-italic">Required / Optional</span> + </td> + <td><em>String</em></td> + <td><code>null</code></td> + <td>Instagram tag from where to retrieve the feed. Required if <span class="text-small text-italic">username</span> is not defined.</td> + </tr> + <tr> + <td class="d-flex flex-wrap"> + <code class="text-bold flex-grow-1">container</code> + <span class="text-danger text-small text-italic">Required / Optional</span> + </td> + <td><em>String</em></td> + <td><code>null</code></td> + <td>Selector where to place the feed. Required if callback is not defined.</td> + </tr> + <tr> + <td class="d-flex flex-wrap"> + <code class="text-bold flex-grow-1">callback</code> + <span class="text-danger text-small text-italic">Required / Optional</span> + </td> + <td><em>function(data)</em></td> + <td><code>null</code></td> + <td>Callback function with all the data fetched from instagram. Required if container is not defined.</td> + </tr> + <tr> + <td class="d-flex flex-wrap"> + <code class="text-bold flex-grow-1">display_profile</code> + </td> + <td><em>Boolean</em></td> + <td><code>true</code></td> + <td>Enables displaying the profile</td> + </tr> + <tr> + <td class="d-flex flex-wrap"> + <code class="text-bold flex-grow-1">display_biography</code> + </td> + <td><em>Boolean</em></td> + <td><code>true</code></td> + <td>Enables displaying the biography. Not compatible when loading a <span class="text-small text-italic">tag</span> feed</td> + </tr> + <tr> + <td class="d-flex flex-wrap"> + <code class="text-bold flex-grow-1">display_gallery</code> + </td> + <td><em>Boolean</em></td> + <td><code>true</code></td> + <td>Enables displaying the gallery</td> + </tr> + <tr> + <td class="d-flex flex-wrap"> + <code class="text-bold flex-grow-1">display_captions</code> + </td> + <td><em>Boolean</em></td> + <td><code>false</code></td> + <td>Enables displaying captions for each post as overlay on hover</td> + </tr> + <tr> + <td class="d-flex flex-wrap"> + <code class="text-bold flex-grow-1">display_igtv</code> + </td> + <td><em>Boolean</em></td> + <td><code>false</code></td> + <td>Enables displaying the IGTV feed if available. Only for users</td> + </tr> + <tr> + <td class="d-flex flex-wrap"> + <code class="text-bold flex-grow-1">styling</code> + </td> + <td><em>Boolean</em></td> + <td><code>true</code></td> + <td>Enables default inline CSS styles</td> + </tr> + <tr> + <td class="d-flex flex-wrap"> + <code class="text-bold flex-grow-1">items</code> + </td> + <td><em>number [Int]</em></td> + <td><code>8</code></td> + <td>Number of items to display. Up to 12 for users, up to 72 for tags</td> + </tr> + <tr> + <td class="d-flex flex-wrap"> + <code class="text-bold flex-grow-1">items_per_row</code> + </td> + <td><em>number [Int]</em></td> + <td><code>4</code></td> + <td>Number of items that will be displayed for each row</td> + </tr> + <tr> + <td class="d-flex flex-wrap"> + <code class="text-bold flex-grow-1">lazy_load</code> + </td> + <td><em>Boolean</em></td> + <td><code>false</code></td> + <td>Enable lazy load of images using native web attribute loading="lazy" on img elements</td> + </tr> + <tr> + <td class="d-flex flex-wrap"> + <code class="text-bold flex-grow-1">margin</code> + </td> + <td><em>number [Float]</em></td> + <td><code>0.5</code></td> + <td>Margin (percentage) between items in gallery/igtv</td> + </tr> + <tr> + <td class="d-flex flex-wrap"> + <code class="text-bold flex-grow-1">image_size</code> + </td> + <td><em>number [Int]</em></td> + <td><code>640</code></td> + <td>Native resolution of the images that will be displayed in the gallery. Accepted values [150, 240, 320, 480, 640]. Does not apply to video previews.</td> + </tr> + <tr> + <td class="d-flex flex-wrap"> + <code class="text-bold flex-grow-1">host</code> + </td> + <td><em>String [url]</em></td> + <td><code>https://www.instagram.com/</code></td> + <td>URL where to fetch the data. Useful if instagram changes CORS policy</td> + </tr> + <tr> + <td class="d-flex flex-wrap"> + <code class="text-bold flex-grow-1">cache_time</code> + </td> + <td><em>number [Int]</em></td> + <td><code>360</code></td> + <td>Instagram response cache expiry time in minutes. <strong>Increase this if you get banned too often</strong>.</td> + </tr> + <tr> + <td class="d-flex flex-wrap"> + <code class="text-bold flex-grow-1">on_error</code> + </td> + <td><em>function(error_description, error_code)</em></td> + <td><code>console.error</code></td> + <td><p class="mb-0">Function that will be triggered when an error ocurs. Error codes:</p> + <p class="mb-0"><span class="text-danger text-small text-italic">1</span>: No username nor tag defined</p> + <p class="mb-0"><span class="text-danger text-small text-italic">2</span>: No container nor callback defined</p> + <p class="mb-0"><span class="text-danger text-small text-italic">3</span>: Profile is age restricted</p> + <p class="mb-0"><span class="text-danger text-small text-italic">4</span>: Network banned</p> + <p class="mb-0"><span class="text-danger text-small text-italic">5</span>: Request error</p> + </td> + </tr> + </tbody> + </table> + </div> + </section> + + <section id="examples"> + <div class="bg-secondary-2 py-3"> + <div class="container"> + <h3>Examples</h3> + <ul class="pt-3 nav nav-tabs" id="tabExamples" role="tablist"> + <li class="nav-item"> + <a class="nav-link active" id="example1-tab" + href="#example1" role="tab" + aria-controls="example1" aria-selected="true" + data-toggle="tab">Example 1</a> + </li> + <li class="nav-item"> + <a class="nav-link" id="example2-tab" + href="#example2" role="tab" + aria-controls="example2" aria-selected="false" + data-toggle="tab">Example 2</a> + </li> + <li class="nav-item"> + <a class="nav-link" id="example3-tab" + href="#example3" role="tab" + aria-controls="example3" aria-selected="false" + data-toggle="tab">Example 3</a> + </li> + <li class="nav-item"> + <a class="nav-link" id="example4-tab" + href="#example4" role="tab" + aria-controls="example4" aria-selected="false" + data-toggle="tab">Example 4</a> + </li> + <li class="nav-item"> + <a class="nav-link" id="example5-tab" + href="#example5" role="tab" + aria-controls="example5" aria-selected="false" + data-toggle="tab">Example 5</a> + </li> + <li class="nav-item"> + <a class="nav-link" id="example6-tab" + href="#example6" role="tab" + aria-controls="example6" aria-selected="false" + data-toggle="tab">Example 6</a> + </li> + <li class="nav-item"> + <a class="nav-link" id="example7-tab" + href="#example7" role="tab" + aria-controls="example7" aria-selected="false" + data-toggle="tab">Example 7</a> + </li> + </ul> + </div> + </div> + <div class="container pt-3"> + <div class="tab-content" id="tabContentExamples"> + + <div class="tab-pane fade show active" id="example1" + role="tabpanel" aria-labelledby="example1-tab"> + <h3>Example 1: Default feed styling</h3> + <p>Don't like it? Check other examples!</p> + <div id="instagram-feed1" class="instagram_feed"></div> + <div class="section_code py-3"> + <div>Code:</div> +<pre><code class="language-html"><script src="jquery.instagramFeed.min.js"></script> +<script> + (function($){ + $(window).on('load', function(){ + $.instagramFeed({ + 'username': 'instagram', + 'container': "#instagram-feed1", + 'display_profile': true, + 'display_biography': true, + 'display_gallery': true, + 'display_captions': true, + 'callback': null, + 'styling': true, + 'items': 8, + 'items_per_row': 4, + 'margin': 1, + 'lazy_load': true, + 'on_error': console.error + }); + }); + })(jQuery); +</script> +</code></pre> + </div> + </div> + + <div class="tab-pane fade" id="example2" + role="tabpanel" aria-labelledby="example2-tab"> + <h3>Example 2: Only want images?</h3> + <p>Disable <i>display_profile</i> and <i>display_biography</i></p> + <div id="instagram-feed2" class="instagram_feed"></div> + <div class="section_code py-3"> + <div>Code:</div> +<pre><code class="language-html"><script src="jquery.instagramFeed.min.js"></script> +<script> + (function($){ + $(window).on('load', function(){ + $.instagramFeed({ + 'username': 'github', + 'container': "#instagram-feed2", + 'display_profile': false, + 'display_biography': false, + 'display_gallery': true, + 'display_captions': false, + 'callback': null, + 'styling': true, + 'items': 8, + 'items_per_row': 4, + 'margin': 1 + }); + }); + })(jQuery); +</script> +</code></pre> + </div> + </div> + + <div class="tab-pane fade" id="example3" + role="tabpanel" aria-labelledby="example3-tab"> + <h3>Example 3: Want to load more or change the display?</h3> + <p>Change <i>items</i>, <i>items_per_row</i> and <i>margin</i></p> + <div id="instagram-feed3" class="instagram_feed"></div> + <div class="section_code py-3"> + <div>Code:</div> +<pre><code class="language-html"><script src="jquery.instagramFeed.min.js"></script> +<script> + (function($){ + $(window).on('load', function(){ + $.instagramFeed({ + 'username': 'zara', + 'container': "#instagram-feed3", + 'display_profile': false, + 'display_biography': false, + 'display_gallery': true, + 'display_captions': false, + 'callback': null, + 'styling': true, + 'items': 12, + 'items_per_row': 6, + 'margin': 0.25 + }); + }); + })(jQuery); +</script> +</code></pre> + </div> + </div> + + <div class="tab-pane fade" id="example4" + role="tabpanel" aria-labelledby="example4-tab"> + <h3>Example 4: Want to fetch a TAG?</h3> + <p>Use <i>tag</i> instead of <i>username</i>.</p> + <div id="instagram-feed4" class="instagram_feed"></div> + <div class="section_code py-3"> + <div>Code:</div> +<pre><code class="language-html"><script src="jquery.instagramFeed.min.js"></script> +<script > + (function($){ + $(window).on('load', function(){ + $.instagramFeed({ + 'tag': 'paradise', + 'container': "#instagram-feed4", + 'display_profile': true, + 'display_gallery': true, + 'display_captions': true, + 'items': 100, + 'items_per_row': 5, + 'margin': 0.5 + }); + }); + })(jQuery); +</script> +</code></pre> + </div> + </div> + + <div class="tab-pane fade" id="example5" + role="tabpanel" aria-labelledby="example5-tab"> + <h3>Example 5: Want to display IGTV?</h3> + <p>Enable <i>display_igtv</i>. <a href="https://help.instagram.com/381435875695118" target="_blank" rel="noopener">What is IGTV?</a></p> + <div id="instagram-feed5" class="instagram_feed"></div> + <div class="section_code py-3"> + <div>Code:</div> +<pre><code class="language-html"><script src="jquery.instagramFeed.min.js"></script> +<script > + (function($){ + $(window).on('load', function(){ + $.instagramFeed({ + 'username': 'fcbarcelona', + 'container': "#instagram-feed5", + 'display_profile': false, + 'display_biography': false, + 'display_gallery': false, + 'display_captions': false, + 'display_igtv': true, + 'callback': null, + 'styling': true, + 'items': 8, + 'items_per_row': 4, + 'margin': 1 + }); + }); + })(jQuery); +</script> +</code></pre> + </div> + </div> + + <div class="tab-pane fade" id="example6" + role="tabpanel" aria-labelledby="example6-tab"> + <h3>Example 6: Don't like our styles at all?</h3> + <p>Make your owns disabling <i>styling</i></p> + <div class="instagram_feed info"> + <p>This is the html you will have (Note we have enabled profile and biography in this case).</p> +<pre><code class="language-html"><div class="<strong>instagram_profile</strong>"> + <img class="<strong>instagram_profile_image</strong>" src="..." alt="Instagram profile pic"> + <p class="<strong>instagram_username</strong>">@Instagram (<a href="...">@instagram</a>)</p> + <p class="<strong>instagram_biography</strong>">....</p> +</div> +<div class="<strong>instagram_gallery</strong>"> + <a href="https://www.instagram.com/p/Bh-P3IoDxyB" rel="noopener" target="_blank"> + <img src="..." alt="instagram instagram image 0" /> + </a> + ... +</div> +<div class="<strong>instagram_igtv</strong>"> + <a href="https://www.instagram.com/p/Bh-P3IoDxyB" rel="noopener" target="_blank"> + <img src="..." alt="instagram instagram image 0" /> + </a> + ... +</div> +</code></pre> + </div> + <div class="section_code py-3"> + <div>Code:</div> +<pre><code class="language-html"><script src="jquery.instagramFeed.min.js"></script> +<script> + (function($){ + $(window).on('load', function(){ + $.instagramFeed({ + 'username': 'instagram', + 'container': "#instagram-feed3", + 'display_profile': true, + 'display_biography': true, + 'display_gallery': true, + 'display_captions': false, + 'display_igtv': true, + 'callback': null, + <strong>'styling': false,</strong> + 'items': 12, + }); + }); + })(jQuery); +</script> +</code></pre> + </div> + </div> + + <div class="tab-pane fade" id="example7" + role="tabpanel" aria-labelledby="example7-tab"> + <h3>Example 7: Don't either like our template?</h3> + <p>Define a <i>callback</i> and do not define a <i>container</i></p> + <div class="instagram_feed info"> + <p>This is the format you will get.</p> +<pre id="jsonHere"><code class="language-json"> +</code></pre> + </div> + <div class="section_code py-3"> + <div>Code:</div> +<pre><code class="language-html"><script type="text/javascript" src="jquery.instagramFeed.min.js"></script> +<script type="text/javascript"> + (function($){ + $(window).on('load', function(){ + $.instagramFeed({ + 'username': 'instagram', + 'callback': function(data){ + $('#jsonHere').html(JSON.stringify(data, null, 2)); + } + }); + }); + })(jQuery); +</script> +</code></pre> + </div> + </div> + + </div> + </div> + </section> + + + <footer id="footer" class="bg-dark"> + <div class="container text-center py-4"> + <h3 class="text-white">Still not enough?</h3> + + <a class="h3 mb-3 text-primary text-underline" target="_blank" rel="noopener" + href="https://github.com/jsanahuja/jquery.instagramFeed"> + Open an issue or send a pull request! + </a> + + </div> + <a href="#header" id="btn-top" class="bg-primary px-2 py-1" title="Go top"> + <span class="text-white" aria-hidden="true">^</span> + </a> + </footer> + + <script src="jquery.instagramFeed.min.js"></script> + <script> + (function($){ + $(window).on('load', function(){ + $.instagramFeed({ + 'username': 'instagram', + 'container': "#instagram-feed1", + 'display_profile': true, + 'display_biography': true, + 'display_gallery': true, + 'display_captions': true, + 'callback': null, + 'styling': true, + 'items': 8, + 'items_per_row': 4, + 'margin': 1, + 'lazy_load': true, + 'on_error': console.error + }); + + $.instagramFeed({ + 'username': 'github', + 'container': "#instagram-feed2", + 'display_profile': false, + 'display_biography': false, + 'display_gallery': true, + 'display_captions': false, + 'callback': null, + 'styling': true, + 'items': 8, + 'items_per_row': 4, + 'margin': 1 + }); + $.instagramFeed({ + 'username': 'zara', + 'container': "#instagram-feed3", + 'display_profile': false, + 'display_biography': false, + 'display_gallery': true, + 'display_captions': false, + 'callback': null, + 'styling': true, + 'items': 12, + 'items_per_row': 6, + 'margin': 0.25 + }); + $.instagramFeed({ + 'tag': 'paradise', + 'container': "#instagram-feed4", + 'display_profile': true, + 'display_gallery': true, + 'display_captions': true, + 'items': 100, + 'items_per_row': 5, + 'margin': 0.5 + }); + $.instagramFeed({ + 'username': 'fcbarcelona', + 'container': "#instagram-feed5", + 'display_profile': false, + 'display_biography': false, + 'display_gallery': false, + 'display_captions': false, + 'display_igtv': true, + 'callback': null, + 'styling': true, + 'items': 8, + 'items_per_row': 4, + 'margin': 1 + }); + + //example 7 + $.instagramFeed({ + 'username': 'instagram', + 'callback': function(data){ + $('#jsonHere').html(JSON.stringify(data, null, 2)); + } + }); + + // Show back to top button if distance from top > 0 + $(window).scroll(function(){ + var viewportTop = $(window).scrollTop() + $(window).height(); + + if($(window).scrollTop() > 10){ + $('#btn-top').addClass('d-block'); + $('#btn-top').removeClass('d-none'); + }else{ + $('#btn-top').addClass('d-none'); + $('#btn-top').removeClass('d-block'); + } + }); + + }); + })(jQuery); + </script> +</body> +</html> diff --git a/web/libraries/jqueryinstagramfeed/jquery.instagramFeed.js b/web/libraries/jqueryinstagramfeed/jquery.instagramFeed.js new file mode 100755 index 0000000000000000000000000000000000000000..32f3f2b06a82f2aa867ff44ace436aaef7c369b9 --- /dev/null +++ b/web/libraries/jqueryinstagramfeed/jquery.instagramFeed.js @@ -0,0 +1,274 @@ +/*! + * 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 = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '/': '/', + '`': '`', + '=': '=' + }; + 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); diff --git a/web/libraries/jqueryinstagramfeed/jquery.instagramFeed.min.js b/web/libraries/jqueryinstagramfeed/jquery.instagramFeed.min.js new file mode 100755 index 0000000000000000000000000000000000000000..601689fcc8f40ced751ee109f0443394e3ff40c6 --- /dev/null +++ b/web/libraries/jqueryinstagramfeed/jquery.instagramFeed.min.js @@ -0,0 +1 @@ +(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={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};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); diff --git a/web/libraries/jqueryinstagramfeed/package.json b/web/libraries/jqueryinstagramfeed/package.json new file mode 100755 index 0000000000000000000000000000000000000000..94a9f9b41a8d50c1b920a0f2902eadd979504630 --- /dev/null +++ b/web/libraries/jqueryinstagramfeed/package.json @@ -0,0 +1,41 @@ +{ + "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 diff --git a/web/libraries/jqueryinstagramfeed/test.html b/web/libraries/jqueryinstagramfeed/test.html new file mode 100755 index 0000000000000000000000000000000000000000..7704ed5ab2bcf221262057eaffbffbbac9274dc4 --- /dev/null +++ b/web/libraries/jqueryinstagramfeed/test.html @@ -0,0 +1,165 @@ +<!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>