"use strict"; /* * jQuery plugin to show images and pdf files on preview * https://github.com/guillermodiazga/EZView * * Copyright 2017, Guillermo Diaz * * Licensed under the MIT license: * https://opensource.org/licenses/MIT */ /** * Check if jQuery is loaded */ if (!window.jQuery) { throw Error('jQuery is required'); } /** * Plugin Definition * @param {string} collectionName [This galery name in use to create a set of images and navigate through them] * * Viewer will create inside the body a container by each collection of images * <.EZView #EZView[auto-numeric-collection]> * <.image-collection> * * * * * e.g. * *
* <.EZView #EZView0> * <.image-collection> * * * * * * <.EZView #EZView1> * <.image-collection> * * * * * * */ $.fn.EZView = function(collectionName) { var self = this; if (!$(self).length) { throw Error('No jQuery elements found'); } /** * Initial actions * @return void */ self.constructor = function() { var $thumbnails = $(this); self.$EZView = null; self.arContent = []; self.index = []; self.icons = { 'next': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAWCAYAAAAfD8YZAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA+5pVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4b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A3MjA2ODExODA4M0U3NkRBMDNEMDVDMSIvPiA8ZGM6dGl0bGU+IDxyZGY6QWx0PiA8cmRmOmxpIHhtbDpsYW5nPSJ4LWRlZmF1bHQiPmdseXBoaWNvbnM8L3JkZjpsaT4gPC9yZGY6QWx0PiA8L2RjOnRpdGxlPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PshQd58AAAB+SURBVHjarJTdCcAgDIRDJ3AU95+io7hBmkAsFuWSwgn3oudnflRRVbHRTcN0m5rPIbknvL6nx9wL0RCELZDpH8H4QCDsAFlhx4UNBiDTmxpayVM8LY1aiqHnqReLmTZDfnQGdvQS1qCnRik2pf20C8l8IrRHy/lGWB/bI8AA4oOVMKhFFb8AAAAASUVORK5CYII=', }; // If we have a collection set it otherwise set an default name collectionName = collectionName || 'EZView' + (parseInt($('.EZView').length)); // Create container by collection self.createContainer(); /** * index is the current image showing by collection * @type {Array} */ self.index[collectionName] = 0; /** * arContent allow to have all the images information to be show by collection * @type {Array} */ self.arContent[collectionName] = []; // Iterate each element and set the click event $thumbnails.each(function(i, thumbnail) { let $thumbnail = $(thumbnail); // Check if the element exists if (!$thumbnail.length) { return; } try { // Set all the data requiered to navigate through elements self.arContent[collectionName][i] = []; self.arContent[collectionName][i].href = $thumbnail.attr('href') || $thumbnail.attr('src'); self.arContent[collectionName][i].name = $thumbnail.attr('title') ? $thumbnail.attr('title').substring(0, 30) : ''; self.arContent[collectionName][i].isRender = false; self.arContent[collectionName][i].isImg = true; } catch (e) { console.error(e); console.error(el); } // Set $thumbnail properties $thumbnail // Set index as data property on each $thumbnail element .data('index', i) // Add cursor pointer .css({ cursor: 'pointer' }) // Add events to each element .off().click(function(e) { e.preventDefault(); e.stopPropagation(); self.runEZView(e); }); }); } /** * Methods Definition: */ /** * Return image to original measures * @param {int} index [description] * @return void */ self.returnImageToOriginalMeasures = function(index) { if (!self.isImg(index)) { return; } var $img = $('[index-content=' + collectionName + index + ']', self.$EZView), hasOriginalSizes = self.arContent[collectionName][index]['original-height']; if (hasOriginalSizes) { $img.animate({ 'height': self.arContent[collectionName][index]['original-height'] + 'px', 'width': self.arContent[collectionName][index]['original-width'] + 'px' }, 200); // Center img over container $img.css({ top: 'auto', left: 'auto' }); } }; /** * Create the collection container * @return void */ self.createContainer = function() { if (!$('#EZView' + collectionName).length) { var tools = '', container = '' + '' + '' + tools, template = '