Mercurial > repos > brasset_jensen > srnapipe
annotate lib/sRNAPipe/js/jquery.galleriffic.js @ 64:967512924317 draft
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
| author | brasset_jensen | 
|---|---|
| date | Mon, 28 Jan 2019 11:57:15 -0500 | 
| parents | |
| children | 
| rev | line source | 
|---|---|
| 64 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 1 /** | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 2 * jQuery Galleriffic plugin | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 3 * | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 4 * Copyright (c) 2008 Trent Foley (http://trentacular.com) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 5 * Licensed under the MIT License: | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 6 * http://www.opensource.org/licenses/mit-license.php | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 7 * | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 8 * Much thanks to primary contributer Ponticlaro (http://www.ponticlaro.com) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 9 */ | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 10 ;(function($) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 11 // Globally keep track of all images by their unique hash. Each item is an image data object. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 12 var allImages = {}; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 13 var imageCounter = 0; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 14 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 15 // Galleriffic static class | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 16 $.galleriffic = { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 17 version: '2.0.1', | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 18 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 19 // Strips invalid characters and any leading # characters | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 20 normalizeHash: function(hash) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 21 return hash.replace(/^.*#/, '').replace(/\?.*$/, ''); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 22 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 23 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 24 getImage: function(hash) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 25 if (!hash) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 26 return undefined; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 27 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 28 hash = $.galleriffic.normalizeHash(hash); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 29 return allImages[hash]; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 30 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 31 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 32 // Global function that looks up an image by its hash and displays the image. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 33 // Returns false when an image is not found for the specified hash. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 34 // @param {String} hash This is the unique hash value assigned to an image. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 35 gotoImage: function(hash) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 36 var imageData = $.galleriffic.getImage(hash); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 37 if (!imageData) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 38 return false; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 39 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 40 var gallery = imageData.gallery; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 41 gallery.gotoImage(imageData); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 42 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 43 return true; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 44 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 45 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 46 // Removes an image from its respective gallery by its hash. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 47 // Returns false when an image is not found for the specified hash or the | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 48 // specified owner gallery does match the located images gallery. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 49 // @param {String} hash This is the unique hash value assigned to an image. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 50 // @param {Object} ownerGallery (Optional) When supplied, the located images | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 51 // gallery is verified to be the same as the specified owning gallery before | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 52 // performing the remove operation. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 53 removeImageByHash: function(hash, ownerGallery) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 54 var imageData = $.galleriffic.getImage(hash); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 55 if (!imageData) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 56 return false; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 57 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 58 var gallery = imageData.gallery; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 59 if (ownerGallery && ownerGallery != gallery) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 60 return false; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 61 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 62 return gallery.removeImageByIndex(imageData.index); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 63 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 64 }; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 65 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 66 var defaults = { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 67 delay: 3000, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 68 numThumbs: 20, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 69 preloadAhead: 40, // Set to -1 to preload all images | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 70 enableTopPager: false, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 71 enableBottomPager: true, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 72 maxPagesToShow: 7, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 73 imageContainerSel: '', | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 74 captionContainerSel: '', | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 75 controlsContainerSel: '', | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 76 loadingContainerSel: '', | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 77 renderSSControls: true, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 78 renderNavControls: true, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 79 playLinkText: 'Play', | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 80 pauseLinkText: 'Pause', | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 81 prevLinkText: 'Previous', | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 82 nextLinkText: 'Next', | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 83 nextPageLinkText: 'Next ›', | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 84 prevPageLinkText: '‹ Prev', | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 85 enableHistory: false, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 86 enableKeyboardNavigation: true, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 87 autoStart: false, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 88 syncTransitions: false, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 89 defaultTransitionDuration: 1000, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 90 onSlideChange: undefined, // accepts a delegate like such: function(prevIndex, nextIndex) { ... } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 91 onTransitionOut: undefined, // accepts a delegate like such: function(slide, caption, isSync, callback) { ... } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 92 onTransitionIn: undefined, // accepts a delegate like such: function(slide, caption, isSync) { ... } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 93 onPageTransitionOut: undefined, // accepts a delegate like such: function(callback) { ... } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 94 onPageTransitionIn: undefined, // accepts a delegate like such: function() { ... } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 95 onImageAdded: undefined, // accepts a delegate like such: function(imageData, $li) { ... } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 96 onImageRemoved: undefined // accepts a delegate like such: function(imageData, $li) { ... } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 97 }; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 98 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 99 // Primary Galleriffic initialization function that should be called on the thumbnail container. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 100 $.fn.galleriffic = function(settings) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 101 // Extend Gallery Object | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 102 $.extend(this, { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 103 // Returns the version of the script | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 104 version: $.galleriffic.version, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 105 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 106 // Current state of the slideshow | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 107 isSlideshowRunning: false, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 108 slideshowTimeout: undefined, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 109 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 110 // This function is attached to the click event of generated hyperlinks within the gallery | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 111 clickHandler: function(e, link) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 112 this.pause(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 113 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 114 if (!this.enableHistory) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 115 // The href attribute holds the unique hash for an image | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 116 var hash = $.galleriffic.normalizeHash($(link).attr('href')); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 117 $.galleriffic.gotoImage(hash); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 118 e.preventDefault(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 119 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 120 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 121 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 122 // Appends an image to the end of the set of images. Argument listItem can be either a jQuery DOM element or arbitrary html. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 123 // @param listItem Either a jQuery object or a string of html of the list item that is to be added to the gallery. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 124 appendImage: function(listItem) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 125 this.addImage(listItem, false, false); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 126 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 127 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 128 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 129 // Inserts an image into the set of images. Argument listItem can be either a jQuery DOM element or arbitrary html. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 130 // @param listItem Either a jQuery object or a string of html of the list item that is to be added to the gallery. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 131 // @param {Integer} position The index within the gallery where the item shouold be added. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 132 insertImage: function(listItem, position) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 133 this.addImage(listItem, false, true, position); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 134 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 135 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 136 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 137 // Adds an image to the gallery and optionally inserts/appends it to the DOM (thumbExists) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 138 // @param listItem Either a jQuery object or a string of html of the list item that is to be added to the gallery. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 139 // @param {Boolean} thumbExists Specifies whether the thumbnail already exists in the DOM or if it needs to be added. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 140 // @param {Boolean} insert Specifies whether the the image is appended to the end or inserted into the gallery. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 141 // @param {Integer} position The index within the gallery where the item shouold be added. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 142 addImage: function(listItem, thumbExists, insert, position) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 143 var $li = ( typeof listItem === "string" ) ? $(listItem) : listItem; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 144 var $aThumb = $li.find('a.thumb'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 145 var slideUrl = $aThumb.attr('href'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 146 var title = $aThumb.attr('title'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 147 var $caption = $li.find('.caption').remove(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 148 var hash = $aThumb.attr('name'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 149 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 150 // Increment the image counter | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 151 imageCounter++; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 152 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 153 // Autogenerate a hash value if none is present or if it is a duplicate | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 154 if (!hash || allImages[''+hash]) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 155 hash = imageCounter; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 156 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 157 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 158 // Set position to end when not specified | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 159 if (!insert) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 160 position = this.data.length; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 161 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 162 var imageData = { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 163 title:title, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 164 slideUrl:slideUrl, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 165 caption:$caption, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 166 hash:hash, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 167 gallery:this, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 168 index:position | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 169 }; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 170 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 171 // Add the imageData to this gallery's array of images | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 172 if (insert) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 173 this.data.splice(position, 0, imageData); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 174 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 175 // Reset index value on all imageData objects | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 176 this.updateIndices(position); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 177 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 178 else { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 179 this.data.push(imageData); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 180 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 181 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 182 var gallery = this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 183 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 184 // Add the element to the DOM | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 185 if (!thumbExists) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 186 // Update thumbs passing in addition post transition out handler | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 187 this.updateThumbs(function() { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 188 var $thumbsUl = gallery.find('ul.thumbs'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 189 if (insert) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 190 $thumbsUl.children(':eq('+position+')').before($li); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 191 else | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 192 $thumbsUl.append($li); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 193 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 194 if (gallery.onImageAdded) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 195 gallery.onImageAdded(imageData, $li); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 196 }); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 197 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 198 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 199 // Register the image globally | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 200 allImages[''+hash] = imageData; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 201 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 202 // Setup attributes and click handler | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 203 $aThumb.attr('rel', 'history') | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 204 .attr('href', '#'+hash) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 205 .removeAttr('name') | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 206 .click(function(e) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 207 gallery.clickHandler(e, this); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 208 }); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 209 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 210 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 211 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 212 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 213 // Removes an image from the gallery based on its index. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 214 // Returns false when the index is out of range. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 215 removeImageByIndex: function(index) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 216 if (index < 0 || index >= this.data.length) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 217 return false; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 218 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 219 var imageData = this.data[index]; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 220 if (!imageData) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 221 return false; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 222 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 223 this.removeImage(imageData); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 224 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 225 return true; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 226 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 227 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 228 // Convenience method that simply calls the global removeImageByHash method. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 229 removeImageByHash: function(hash) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 230 return $.galleriffic.removeImageByHash(hash, this); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 231 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 232 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 233 // Removes an image from the gallery. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 234 removeImage: function(imageData) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 235 var index = imageData.index; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 236 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 237 // Remove the image from the gallery data array | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 238 this.data.splice(index, 1); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 239 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 240 // Remove the global registration | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 241 delete allImages[''+imageData.hash]; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 242 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 243 // Remove the image's list item from the DOM | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 244 this.updateThumbs(function() { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 245 var $li = gallery.find('ul.thumbs') | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 246 .children(':eq('+index+')') | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 247 .remove(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 248 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 249 if (gallery.onImageRemoved) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 250 gallery.onImageRemoved(imageData, $li); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 251 }); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 252 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 253 // Update each image objects index value | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 254 this.updateIndices(index); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 255 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 256 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 257 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 258 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 259 // Updates the index values of the each of the images in the gallery after the specified index | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 260 updateIndices: function(startIndex) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 261 for (i = startIndex; i < this.data.length; i++) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 262 this.data[i].index = i; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 263 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 264 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 265 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 266 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 267 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 268 // Scraped the thumbnail container for thumbs and adds each to the gallery | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 269 initializeThumbs: function() { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 270 this.data = []; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 271 var gallery = this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 272 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 273 this.find('ul.thumbs > li').each(function(i) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 274 gallery.addImage($(this), true, false); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 275 }); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 276 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 277 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 278 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 279 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 280 isPreloadComplete: false, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 281 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 282 // Initalizes the image preloader | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 283 preloadInit: function() { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 284 if (this.preloadAhead == 0) return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 285 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 286 this.preloadStartIndex = this.currentImage.index; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 287 var nextIndex = this.getNextIndex(this.preloadStartIndex); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 288 return this.preloadRecursive(this.preloadStartIndex, nextIndex); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 289 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 290 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 291 // Changes the location in the gallery the preloader should work | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 292 // @param {Integer} index The index of the image where the preloader should restart at. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 293 preloadRelocate: function(index) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 294 // By changing this startIndex, the current preload script will restart | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 295 this.preloadStartIndex = index; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 296 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 297 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 298 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 299 // Recursive function that performs the image preloading | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 300 // @param {Integer} startIndex The index of the first image the current preloader started on. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 301 // @param {Integer} currentIndex The index of the current image to preload. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 302 preloadRecursive: function(startIndex, currentIndex) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 303 // Check if startIndex has been relocated | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 304 if (startIndex != this.preloadStartIndex) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 305 var nextIndex = this.getNextIndex(this.preloadStartIndex); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 306 return this.preloadRecursive(this.preloadStartIndex, nextIndex); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 307 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 308 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 309 var gallery = this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 310 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 311 // Now check for preloadAhead count | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 312 var preloadCount = currentIndex - startIndex; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 313 if (preloadCount < 0) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 314 preloadCount = this.data.length-1-startIndex+currentIndex; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 315 if (this.preloadAhead >= 0 && preloadCount > this.preloadAhead) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 316 // Do this in order to keep checking for relocated start index | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 317 setTimeout(function() { gallery.preloadRecursive(startIndex, currentIndex); }, 500); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 318 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 319 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 320 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 321 var imageData = this.data[currentIndex]; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 322 if (!imageData) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 323 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 324 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 325 // If already loaded, continue | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 326 if (imageData.image) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 327 return this.preloadNext(startIndex, currentIndex); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 328 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 329 // Preload the image | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 330 var image = new Image(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 331 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 332 image.onload = function() { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 333 imageData.image = this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 334 gallery.preloadNext(startIndex, currentIndex); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 335 }; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 336 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 337 image.alt = imageData.title; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 338 image.src = imageData.slideUrl; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 339 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 340 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 341 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 342 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 343 // Called by preloadRecursive in order to preload the next image after the previous has loaded. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 344 // @param {Integer} startIndex The index of the first image the current preloader started on. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 345 // @param {Integer} currentIndex The index of the current image to preload. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 346 preloadNext: function(startIndex, currentIndex) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 347 var nextIndex = this.getNextIndex(currentIndex); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 348 if (nextIndex == startIndex) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 349 this.isPreloadComplete = true; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 350 } else { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 351 // Use setTimeout to free up thread | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 352 var gallery = this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 353 setTimeout(function() { gallery.preloadRecursive(startIndex, nextIndex); }, 100); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 354 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 355 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 356 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 357 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 358 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 359 // Safe way to get the next image index relative to the current image. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 360 // If the current image is the last, returns 0 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 361 getNextIndex: function(index) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 362 var nextIndex = index+1; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 363 if (nextIndex >= this.data.length) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 364 nextIndex = 0; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 365 return nextIndex; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 366 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 367 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 368 // Safe way to get the previous image index relative to the current image. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 369 // If the current image is the first, return the index of the last image in the gallery. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 370 getPrevIndex: function(index) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 371 var prevIndex = index-1; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 372 if (prevIndex < 0) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 373 prevIndex = this.data.length-1; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 374 return prevIndex; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 375 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 376 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 377 // Pauses the slideshow | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 378 pause: function() { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 379 this.isSlideshowRunning = false; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 380 if (this.slideshowTimeout) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 381 clearTimeout(this.slideshowTimeout); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 382 this.slideshowTimeout = undefined; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 383 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 384 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 385 if (this.$controlsContainer) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 386 this.$controlsContainer | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 387 .find('div.ss-controls a').removeClass().addClass('play') | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 388 .attr('title', this.playLinkText) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 389 .attr('href', '#play') | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 390 .html(this.playLinkText); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 391 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 392 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 393 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 394 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 395 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 396 // Plays the slideshow | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 397 play: function() { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 398 this.isSlideshowRunning = true; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 399 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 400 if (this.$controlsContainer) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 401 this.$controlsContainer | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 402 .find('div.ss-controls a').removeClass().addClass('pause') | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 403 .attr('title', this.pauseLinkText) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 404 .attr('href', '#pause') | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 405 .html(this.pauseLinkText); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 406 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 407 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 408 if (!this.slideshowTimeout) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 409 var gallery = this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 410 this.slideshowTimeout = setTimeout(function() { gallery.ssAdvance(); }, this.delay); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 411 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 412 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 413 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 414 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 415 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 416 // Toggles the state of the slideshow (playing/paused) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 417 toggleSlideshow: function() { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 418 if (this.isSlideshowRunning) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 419 this.pause(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 420 else | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 421 this.play(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 422 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 423 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 424 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 425 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 426 // Advances the slideshow to the next image and delegates navigation to the | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 427 // history plugin when history is enabled | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 428 // enableHistory is true | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 429 ssAdvance: function() { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 430 if (this.isSlideshowRunning) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 431 this.next(true); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 432 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 433 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 434 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 435 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 436 // Advances the gallery to the next image. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 437 // @param {Boolean} dontPause Specifies whether to pause the slideshow. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 438 // @param {Boolean} bypassHistory Specifies whether to delegate navigation to the history plugin when history is enabled. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 439 next: function(dontPause, bypassHistory) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 440 this.gotoIndex(this.getNextIndex(this.currentImage.index), dontPause, bypassHistory); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 441 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 442 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 443 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 444 // Navigates to the previous image in the gallery. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 445 // @param {Boolean} dontPause Specifies whether to pause the slideshow. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 446 // @param {Boolean} bypassHistory Specifies whether to delegate navigation to the history plugin when history is enabled. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 447 previous: function(dontPause, bypassHistory) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 448 this.gotoIndex(this.getPrevIndex(this.currentImage.index), dontPause, bypassHistory); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 449 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 450 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 451 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 452 // Navigates to the next page in the gallery. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 453 // @param {Boolean} dontPause Specifies whether to pause the slideshow. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 454 // @param {Boolean} bypassHistory Specifies whether to delegate navigation to the history plugin when history is enabled. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 455 nextPage: function(dontPause, bypassHistory) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 456 var page = this.getCurrentPage(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 457 var lastPage = this.getNumPages() - 1; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 458 if (page < lastPage) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 459 var startIndex = page * this.numThumbs; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 460 var nextPage = startIndex + this.numThumbs; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 461 this.gotoIndex(nextPage, dontPause, bypassHistory); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 462 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 463 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 464 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 465 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 466 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 467 // Navigates to the previous page in the gallery. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 468 // @param {Boolean} dontPause Specifies whether to pause the slideshow. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 469 // @param {Boolean} bypassHistory Specifies whether to delegate navigation to the history plugin when history is enabled. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 470 previousPage: function(dontPause, bypassHistory) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 471 var page = this.getCurrentPage(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 472 if (page > 0) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 473 var startIndex = page * this.numThumbs; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 474 var prevPage = startIndex - this.numThumbs; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 475 this.gotoIndex(prevPage, dontPause, bypassHistory); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 476 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 477 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 478 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 479 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 480 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 481 // Navigates to the image at the specified index in the gallery | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 482 // @param {Integer} index The index of the image in the gallery to display. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 483 // @param {Boolean} dontPause Specifies whether to pause the slideshow. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 484 // @param {Boolean} bypassHistory Specifies whether to delegate navigation to the history plugin when history is enabled. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 485 gotoIndex: function(index, dontPause, bypassHistory) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 486 if (!dontPause) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 487 this.pause(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 488 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 489 if (index < 0) index = 0; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 490 else if (index >= this.data.length) index = this.data.length-1; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 491 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 492 var imageData = this.data[index]; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 493 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 494 if (!bypassHistory && this.enableHistory) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 495 $.historyLoad(String(imageData.hash)); // At the moment, historyLoad only accepts string arguments | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 496 else | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 497 this.gotoImage(imageData); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 498 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 499 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 500 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 501 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 502 // This function is garaunteed to be called anytime a gallery slide changes. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 503 // @param {Object} imageData An object holding the image metadata of the image to navigate to. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 504 gotoImage: function(imageData) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 505 var index = imageData.index; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 506 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 507 if (this.onSlideChange) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 508 this.onSlideChange(this.currentImage.index, index); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 509 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 510 this.currentImage = imageData; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 511 this.preloadRelocate(index); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 512 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 513 this.refresh(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 514 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 515 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 516 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 517 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 518 // Returns the default transition duration value. The value is halved when not | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 519 // performing a synchronized transition. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 520 // @param {Boolean} isSync Specifies whether the transitions are synchronized. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 521 getDefaultTransitionDuration: function(isSync) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 522 if (isSync) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 523 return this.defaultTransitionDuration; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 524 return this.defaultTransitionDuration / 2; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 525 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 526 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 527 // Rebuilds the slideshow image and controls and performs transitions | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 528 refresh: function() { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 529 var imageData = this.currentImage; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 530 if (!imageData) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 531 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 532 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 533 var index = imageData.index; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 534 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 535 // Update Controls | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 536 if (this.$controlsContainer) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 537 this.$controlsContainer | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 538 .find('div.nav-controls a.prev').attr('href', '#'+this.data[this.getPrevIndex(index)].hash).end() | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 539 .find('div.nav-controls a.next').attr('href', '#'+this.data[this.getNextIndex(index)].hash); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 540 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 541 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 542 var previousSlide = this.$imageContainer.find('span.current').addClass('previous').removeClass('current'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 543 var previousCaption = 0; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 544 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 545 if (this.$captionContainer) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 546 previousCaption = this.$captionContainer.find('span.current').addClass('previous').removeClass('current'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 547 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 548 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 549 // Perform transitions simultaneously if syncTransitions is true and the next image is already preloaded | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 550 var isSync = this.syncTransitions && imageData.image; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 551 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 552 // Flag we are transitioning | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 553 var isTransitioning = true; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 554 var gallery = this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 555 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 556 var transitionOutCallback = function() { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 557 // Flag that the transition has completed | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 558 isTransitioning = false; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 559 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 560 // Remove the old slide | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 561 previousSlide.remove(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 562 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 563 // Remove old caption | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 564 if (previousCaption) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 565 previousCaption.remove(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 566 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 567 if (!isSync) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 568 if (imageData.image && imageData.hash == gallery.data[gallery.currentImage.index].hash) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 569 gallery.buildImage(imageData, isSync); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 570 } else { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 571 // Show loading container | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 572 if (gallery.$loadingContainer) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 573 gallery.$loadingContainer.show(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 574 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 575 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 576 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 577 }; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 578 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 579 if (previousSlide.length == 0) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 580 // For the first slide, the previous slide will be empty, so we will call the callback immediately | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 581 transitionOutCallback(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 582 } else { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 583 if (this.onTransitionOut) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 584 this.onTransitionOut(previousSlide, previousCaption, isSync, transitionOutCallback); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 585 } else { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 586 previousSlide.fadeTo(this.getDefaultTransitionDuration(isSync), 0.0, transitionOutCallback); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 587 if (previousCaption) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 588 previousCaption.fadeTo(this.getDefaultTransitionDuration(isSync), 0.0); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 589 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 590 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 591 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 592 // Go ahead and begin transitioning in of next image | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 593 if (isSync) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 594 this.buildImage(imageData, isSync); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 595 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 596 if (!imageData.image) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 597 var image = new Image(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 598 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 599 // Wire up mainImage onload event | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 600 image.onload = function() { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 601 imageData.image = this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 602 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 603 // Only build image if the out transition has completed and we are still on the same image hash | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 604 if (!isTransitioning && imageData.hash == gallery.data[gallery.currentImage.index].hash) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 605 gallery.buildImage(imageData, isSync); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 606 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 607 }; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 608 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 609 // set alt and src | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 610 image.alt = imageData.title; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 611 image.src = imageData.slideUrl; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 612 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 613 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 614 // This causes the preloader (if still running) to relocate out from the currentIndex | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 615 this.relocatePreload = true; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 616 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 617 return this.syncThumbs(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 618 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 619 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 620 // Called by the refresh method after the previous image has been transitioned out or at the same time | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 621 // as the out transition when performing a synchronous transition. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 622 // @param {Object} imageData An object holding the image metadata of the image to build. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 623 // @param {Boolean} isSync Specifies whether the transitions are synchronized. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 624 buildImage: function(imageData, isSync) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 625 var gallery = this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 626 var nextIndex = this.getNextIndex(imageData.index); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 627 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 628 // Construct new hidden span for the image | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 629 var newSlide = this.$imageContainer | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 630 .append('<span class="image-wrapper current"><a class="advance-link" rel="history" href="#'+this.data[nextIndex].hash+'" title="'+imageData.title+'"> </a></span>') | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 631 .find('span.current').css('opacity', '0'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 632 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 633 newSlide.find('a') | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 634 .append(imageData.image) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 635 .click(function(e) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 636 gallery.clickHandler(e, this); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 637 }); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 638 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 639 var newCaption = 0; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 640 if (this.$captionContainer) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 641 // Construct new hidden caption for the image | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 642 newCaption = this.$captionContainer | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 643 .append('<span class="image-caption current"></span>') | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 644 .find('span.current').css('opacity', '0') | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 645 .append(imageData.caption); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 646 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 647 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 648 // Hide the loading conatiner | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 649 if (this.$loadingContainer) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 650 this.$loadingContainer.hide(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 651 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 652 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 653 // Transition in the new image | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 654 if (this.onTransitionIn) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 655 this.onTransitionIn(newSlide, newCaption, isSync); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 656 } else { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 657 newSlide.fadeTo(this.getDefaultTransitionDuration(isSync), 1.0); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 658 if (newCaption) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 659 newCaption.fadeTo(this.getDefaultTransitionDuration(isSync), 1.0); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 660 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 661 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 662 if (this.isSlideshowRunning) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 663 if (this.slideshowTimeout) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 664 clearTimeout(this.slideshowTimeout); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 665 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 666 this.slideshowTimeout = setTimeout(function() { gallery.ssAdvance(); }, this.delay); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 667 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 668 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 669 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 670 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 671 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 672 // Returns the current page index that should be shown for the currentImage | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 673 getCurrentPage: function() { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 674 return Math.floor(this.currentImage.index / this.numThumbs); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 675 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 676 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 677 // Applies the selected class to the current image's corresponding thumbnail. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 678 // Also checks if the current page has changed and updates the displayed page of thumbnails if necessary. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 679 syncThumbs: function() { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 680 var page = this.getCurrentPage(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 681 if (page != this.displayedPage) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 682 this.updateThumbs(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 683 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 684 // Remove existing selected class and add selected class to new thumb | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 685 var $thumbs = this.find('ul.thumbs').children(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 686 $thumbs.filter('.selected').removeClass('selected'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 687 $thumbs.eq(this.currentImage.index).addClass('selected'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 688 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 689 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 690 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 691 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 692 // Performs transitions on the thumbnails container and updates the set of | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 693 // thumbnails that are to be displayed and the navigation controls. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 694 // @param {Delegate} postTransitionOutHandler An optional delegate that is called after | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 695 // the thumbnails container has transitioned out and before the thumbnails are rebuilt. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 696 updateThumbs: function(postTransitionOutHandler) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 697 var gallery = this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 698 var transitionOutCallback = function() { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 699 // Call the Post-transition Out Handler | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 700 if (postTransitionOutHandler) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 701 postTransitionOutHandler(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 702 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 703 gallery.rebuildThumbs(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 704 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 705 // Transition In the thumbsContainer | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 706 if (gallery.onPageTransitionIn) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 707 gallery.onPageTransitionIn(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 708 else | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 709 gallery.show(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 710 }; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 711 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 712 // Transition Out the thumbsContainer | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 713 if (this.onPageTransitionOut) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 714 this.onPageTransitionOut(transitionOutCallback); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 715 } else { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 716 this.hide(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 717 transitionOutCallback(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 718 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 719 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 720 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 721 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 722 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 723 // Updates the set of thumbnails that are to be displayed and the navigation controls. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 724 rebuildThumbs: function() { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 725 var needsPagination = this.data.length > this.numThumbs; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 726 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 727 // Rebuild top pager | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 728 if (this.enableTopPager) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 729 var $topPager = this.find('div.top'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 730 if ($topPager.length == 0) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 731 $topPager = this.prepend('<div class="top pagination"></div>').find('div.top'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 732 else | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 733 $topPager.empty(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 734 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 735 if (needsPagination) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 736 this.buildPager($topPager); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 737 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 738 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 739 // Rebuild bottom pager | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 740 if (this.enableBottomPager) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 741 var $bottomPager = this.find('div.bottom'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 742 if ($bottomPager.length == 0) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 743 $bottomPager = this.append('<div class="bottom pagination"></div>').find('div.bottom'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 744 else | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 745 $bottomPager.empty(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 746 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 747 if (needsPagination) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 748 this.buildPager($bottomPager); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 749 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 750 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 751 var page = this.getCurrentPage(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 752 var startIndex = page*this.numThumbs; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 753 var stopIndex = startIndex+this.numThumbs-1; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 754 if (stopIndex >= this.data.length) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 755 stopIndex = this.data.length-1; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 756 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 757 // Show/Hide thumbs | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 758 var $thumbsUl = this.find('ul.thumbs'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 759 $thumbsUl.find('li').each(function(i) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 760 var $li = $(this); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 761 if (i >= startIndex && i <= stopIndex) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 762 $li.show(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 763 } else { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 764 $li.hide(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 765 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 766 }); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 767 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 768 this.displayedPage = page; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 769 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 770 // Remove the noscript class from the thumbs container ul | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 771 $thumbsUl.removeClass('noscript'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 772 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 773 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 774 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 775 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 776 // Returns the total number of pages required to display all the thumbnails. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 777 getNumPages: function() { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 778 return Math.ceil(this.data.length/this.numThumbs); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 779 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 780 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 781 // Rebuilds the pager control in the specified matched element. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 782 // @param {jQuery} pager A jQuery element set matching the particular pager to be rebuilt. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 783 buildPager: function(pager) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 784 var gallery = this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 785 var numPages = this.getNumPages(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 786 var page = this.getCurrentPage(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 787 var startIndex = page * this.numThumbs; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 788 var pagesRemaining = this.maxPagesToShow - 1; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 789 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 790 var pageNum = page - Math.floor((this.maxPagesToShow - 1) / 2) + 1; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 791 if (pageNum > 0) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 792 var remainingPageCount = numPages - pageNum; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 793 if (remainingPageCount < pagesRemaining) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 794 pageNum = pageNum - (pagesRemaining - remainingPageCount); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 795 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 796 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 797 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 798 if (pageNum < 0) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 799 pageNum = 0; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 800 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 801 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 802 // Prev Page Link | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 803 if (page > 0) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 804 var prevPage = startIndex - this.numThumbs; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 805 pager.append('<a rel="history" href="#'+this.data[prevPage].hash+'" title="'+this.prevPageLinkText+'">'+this.prevPageLinkText+'</a>'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 806 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 807 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 808 // Create First Page link if needed | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 809 if (pageNum > 0) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 810 this.buildPageLink(pager, 0, numPages); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 811 if (pageNum > 1) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 812 pager.append('<span class="ellipsis">…</span>'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 813 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 814 pagesRemaining--; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 815 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 816 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 817 // Page Index Links | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 818 while (pagesRemaining > 0) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 819 this.buildPageLink(pager, pageNum, numPages); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 820 pagesRemaining--; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 821 pageNum++; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 822 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 823 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 824 // Create Last Page link if needed | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 825 if (pageNum < numPages) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 826 var lastPageNum = numPages - 1; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 827 if (pageNum < lastPageNum) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 828 pager.append('<span class="ellipsis">…</span>'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 829 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 830 this.buildPageLink(pager, lastPageNum, numPages); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 831 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 832 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 833 // Next Page Link | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 834 var nextPage = startIndex + this.numThumbs; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 835 if (nextPage < this.data.length) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 836 pager.append('<a rel="history" href="#'+this.data[nextPage].hash+'" title="'+this.nextPageLinkText+'">'+this.nextPageLinkText+'</a>'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 837 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 838 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 839 pager.find('a').click(function(e) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 840 gallery.clickHandler(e, this); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 841 }); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 842 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 843 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 844 }, | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 845 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 846 // Builds a single page link within a pager. This function is called by buildPager | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 847 // @param {jQuery} pager A jQuery element set matching the particular pager to be rebuilt. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 848 // @param {Integer} pageNum The page number of the page link to build. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 849 // @param {Integer} numPages The total number of pages required to display all thumbnails. | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 850 buildPageLink: function(pager, pageNum, numPages) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 851 var pageLabel = pageNum + 1; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 852 var currentPage = this.getCurrentPage(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 853 if (pageNum == currentPage) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 854 pager.append('<span class="current">'+pageLabel+'</span>'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 855 else if (pageNum < numPages) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 856 var imageIndex = pageNum*this.numThumbs; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 857 pager.append('<a rel="history" href="#'+this.data[imageIndex].hash+'" title="'+pageLabel+'">'+pageLabel+'</a>'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 858 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 859 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 860 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 861 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 862 }); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 863 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 864 // Now initialize the gallery | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 865 $.extend(this, defaults, settings); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 866 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 867 // Verify the history plugin is available | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 868 if (this.enableHistory && !$.historyInit) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 869 this.enableHistory = false; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 870 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 871 // Select containers | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 872 if (this.imageContainerSel) this.$imageContainer = $(this.imageContainerSel); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 873 if (this.captionContainerSel) this.$captionContainer = $(this.captionContainerSel); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 874 if (this.loadingContainerSel) this.$loadingContainer = $(this.loadingContainerSel); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 875 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 876 // Initialize the thumbails | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 877 this.initializeThumbs(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 878 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 879 if (this.maxPagesToShow < 3) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 880 this.maxPagesToShow = 3; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 881 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 882 this.displayedPage = -1; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 883 this.currentImage = this.data[0]; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 884 var gallery = this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 885 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 886 // Hide the loadingContainer | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 887 if (this.$loadingContainer) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 888 this.$loadingContainer.hide(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 889 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 890 // Setup controls | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 891 if (this.controlsContainerSel) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 892 this.$controlsContainer = $(this.controlsContainerSel).empty(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 893 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 894 if (this.renderSSControls) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 895 if (this.autoStart) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 896 this.$controlsContainer | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 897 .append('<div class="ss-controls"><a href="#pause" class="pause" title="'+this.pauseLinkText+'">'+this.pauseLinkText+'</a></div>'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 898 } else { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 899 this.$controlsContainer | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 900 .append('<div class="ss-controls"><a href="#play" class="play" title="'+this.playLinkText+'">'+this.playLinkText+'</a></div>'); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 901 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 902 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 903 this.$controlsContainer.find('div.ss-controls a') | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 904 .click(function(e) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 905 gallery.toggleSlideshow(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 906 e.preventDefault(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 907 return false; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 908 }); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 909 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 910 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 911 if (this.renderNavControls) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 912 this.$controlsContainer | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 913 .append('<div class="nav-controls"><a class="prev" rel="history" title="'+this.prevLinkText+'">'+this.prevLinkText+'</a><a class="next" rel="history" title="'+this.nextLinkText+'">'+this.nextLinkText+'</a></div>') | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 914 .find('div.nav-controls a') | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 915 .click(function(e) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 916 gallery.clickHandler(e, this); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 917 }); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 918 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 919 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 920 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 921 var initFirstImage = !this.enableHistory || !location.hash; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 922 if (this.enableHistory && location.hash) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 923 var hash = $.galleriffic.normalizeHash(location.hash); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 924 var imageData = allImages[hash]; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 925 if (!imageData) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 926 initFirstImage = true; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 927 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 928 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 929 // Setup gallery to show the first image | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 930 if (initFirstImage) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 931 this.gotoIndex(0, false, true); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 932 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 933 // Setup Keyboard Navigation | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 934 if (this.enableKeyboardNavigation) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 935 $(document).keydown(function(e) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 936 var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 937 switch(key) { | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 938 case 32: // space | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 939 gallery.next(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 940 e.preventDefault(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 941 break; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 942 case 33: // Page Up | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 943 gallery.previousPage(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 944 e.preventDefault(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 945 break; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 946 case 34: // Page Down | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 947 gallery.nextPage(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 948 e.preventDefault(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 949 break; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 950 case 35: // End | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 951 gallery.gotoIndex(gallery.data.length-1); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 952 e.preventDefault(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 953 break; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 954 case 36: // Home | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 955 gallery.gotoIndex(0); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 956 e.preventDefault(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 957 break; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 958 case 37: // left arrow | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 959 gallery.previous(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 960 e.preventDefault(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 961 break; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 962 case 39: // right arrow | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 963 gallery.next(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 964 e.preventDefault(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 965 break; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 966 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 967 }); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 968 } | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 969 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 970 // Auto start the slideshow | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 971 if (this.autoStart) | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 972 this.play(); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 973 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 974 // Kickoff Image Preloader after 1 second | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 975 setTimeout(function() { gallery.preloadInit(); }, 1000); | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 976 | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 977 return this; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 978 }; | 
| 
967512924317
planemo upload for repository https://github.com/GReD-Clermont/sRNAPipe/ commit 410509088292be0687b8da3ea3bb75e72866a87d
 brasset_jensen parents: diff
changeset | 979 })(jQuery); | 
