j1-template 2021.0.6 → 2021.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/procedures/global/attributes_loader.proc +2 -2
  3. data/assets/data/menu.html +4 -4
  4. data/assets/themes/j1/adapter/js/fam.js +59 -27
  5. data/assets/themes/j1/adapter/js/j1.js +3 -2
  6. data/assets/themes/j1/adapter/js/themer.js +47 -23
  7. data/assets/themes/j1/adapter/js/toccer.js +97 -18
  8. data/assets/themes/j1/core/css/icon-fonts/fontawesome.css +299 -12
  9. data/assets/themes/j1/core/css/icon-fonts/fontawesome.min.css +1 -1
  10. data/assets/themes/j1/core/css/themes/uno-light/bootstrap.css +92 -81
  11. data/assets/themes/j1/core/css/themes/uno-light/bootstrap.min.css +1 -1
  12. data/assets/themes/j1/core/fonts/fontawesome_5/fonts/eot/fa-brands-400.eot +0 -0
  13. data/assets/themes/j1/core/fonts/fontawesome_5/fonts/eot/fa-regular-400.eot +0 -0
  14. data/assets/themes/j1/core/fonts/fontawesome_5/fonts/eot/fa-solid-900.eot +0 -0
  15. data/assets/themes/j1/core/fonts/fontawesome_5/fonts/fa-brands-400.woff +0 -0
  16. data/assets/themes/j1/core/fonts/fontawesome_5/fonts/fa-brands-400.woff2 +0 -0
  17. data/assets/themes/j1/core/fonts/fontawesome_5/fonts/fa-regular-400.woff +0 -0
  18. data/assets/themes/j1/core/fonts/fontawesome_5/fonts/fa-regular-400.woff2 +0 -0
  19. data/assets/themes/j1/core/fonts/fontawesome_5/fonts/fa-solid-900.woff +0 -0
  20. data/assets/themes/j1/core/fonts/fontawesome_5/fonts/fa-solid-900.woff2 +0 -0
  21. data/assets/themes/j1/core/fonts/fontawesome_5/fonts/svg/fa-brands-400.svg +855 -597
  22. data/assets/themes/j1/core/fonts/fontawesome_5/fonts/svg/fa-regular-400.svg +94 -96
  23. data/assets/themes/j1/core/fonts/fontawesome_5/fonts/svg/fa-solid-900.svg +1272 -771
  24. data/assets/themes/j1/core/fonts/fontawesome_5/fonts/ttf/fa-brands-400.ttf +0 -0
  25. data/assets/themes/j1/core/fonts/fontawesome_5/fonts/ttf/fa-regular-400.ttf +0 -0
  26. data/assets/themes/j1/core/fonts/fontawesome_5/fonts/ttf/fa-solid-900.ttf +0 -0
  27. data/assets/themes/j1/modules/justifiedGallery/LICENSE +1 -1
  28. data/assets/themes/j1/modules/justifiedGallery/README.md +5 -3
  29. data/assets/themes/j1/modules/justifiedGallery/_versions/v3.8.0/js/{jquery.justifiedGallery.js → justifiedGallery.js} +145 -145
  30. data/assets/themes/j1/modules/justifiedGallery/_versions/v3.8.0/js/{jquery.justifiedGallery.min.js → justifiedGallery.min.js} +1 -2
  31. data/assets/themes/j1/modules/justifiedGallery/js/justifiedGallery.js +69 -53
  32. data/assets/themes/j1/modules/justifiedGallery/js/justifiedGallery.min.js +2 -2
  33. data/lib/j1/commands/generate.rb +5 -4
  34. data/lib/j1/version.rb +1 -1
  35. data/lib/j1_app/j1_auth_manager/auth_manager.rb +15 -0
  36. data/lib/starter_web/Gemfile +1 -1
  37. data/lib/starter_web/_config.yml +8 -6
  38. data/lib/starter_web/_data/apps/justified_gallery.yml +41 -13
  39. data/lib/starter_web/_data/asciidoc2pdf/themes/j1-theme.yml +225 -188
  40. data/lib/starter_web/_data/blocks/banner.yml +19 -7
  41. data/lib/starter_web/_data/blocks/panel.yml +1 -1
  42. data/lib/starter_web/_data/modules/defaults/navigator.yml +1 -1
  43. data/lib/starter_web/_data/modules/defaults/toccer.yml +3 -3
  44. data/lib/starter_web/_data/modules/fam.yml +8 -0
  45. data/lib/starter_web/_data/modules/navigator_menu.yml +28 -10
  46. data/lib/starter_web/_includes/attributes.asciidoc +43 -13
  47. data/lib/starter_web/_plugins/asciidoctor-extensions/fab-icon-inline.rb +1 -1
  48. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  49. data/lib/starter_web/assets/images/collections/blog/featured/markus-spiske-2.jpg +0 -0
  50. data/lib/starter_web/assets/images/collections/blog/featured/staticgen.jpg +0 -0
  51. data/lib/starter_web/assets/images/modules/attics/florian-olivo-1920x1280.jpg +0 -0
  52. data/lib/starter_web/assets/images/modules/attics/joel-filipe-1920x1280.jpg +0 -0
  53. data/lib/starter_web/assets/images/modules/attics/markus-spiske3-1920x1280.jpg +0 -0
  54. data/lib/starter_web/assets/images/modules/attics/nicola-styles-1920x1280.jpg +0 -0
  55. data/lib/starter_web/assets/images/modules/attics/{runner-1920x1200-bw.jpg → runner-1920x1200.jpg} +0 -0
  56. data/lib/starter_web/assets/images/modules/attics/{the-place-1920x1280-bw.jpg → the-place-1920x1280.jpg} +0 -0
  57. data/lib/starter_web/assets/images/modules/gallery/old_times/colored/image_01.jpg +0 -0
  58. data/lib/starter_web/assets/images/modules/gallery/old_times/image_01.jpg +0 -0
  59. data/lib/starter_web/assets/images/modules/gallery/old_times/image_02.jpg +0 -0
  60. data/lib/starter_web/assets/images/modules/gallery/old_times/image_03.jpg +0 -0
  61. data/lib/starter_web/assets/images/modules/gallery/old_times/image_04.jpg +0 -0
  62. data/lib/starter_web/assets/images/modules/icons/d1/scalable/d1.svg +1 -1
  63. data/lib/starter_web/assets/images/pages/panels/florian-olivo-1920x800.jpg +0 -0
  64. data/lib/starter_web/assets/images/pages/panels/responsive-text-1920x800.jpg +0 -0
  65. data/lib/starter_web/assets/images/pages/skeleton/annie-spratt-1920x1280.jpg +0 -0
  66. data/lib/starter_web/assets/images/pages/skeleton/antonino-visalli-1920x1280.jpg +0 -0
  67. data/lib/starter_web/assets/images/pages/skeleton/humble-lamb-1920x1280.jpg +0 -0
  68. data/lib/starter_web/assets/images/pages/skeleton/library-1920x1280.jpg +0 -0
  69. data/lib/starter_web/assets/images/pages/skeleton/romain-vignes-1920x1280.jpg +0 -0
  70. data/lib/starter_web/assets/images/pages/skeleton/sigmund-1920x1280.jpg +0 -0
  71. data/lib/starter_web/assets/images/pages/writers_guide/1280px-PDCA_Process.png +0 -0
  72. data/lib/starter_web/assets/images/pages/writers_guide/annie-spratt-1920x1280.jpg +0 -0
  73. data/lib/starter_web/assets/images/pages/writers_guide/deming-cycle.png +0 -0
  74. data/lib/starter_web/assets/images/pages/writers_guide/humble-lamb-1920x1280.jpg +0 -0
  75. data/lib/starter_web/assets/images/pages/writers_guide/john-schnobrich-1920x1280.jpg +0 -0
  76. data/lib/starter_web/assets/images/pages/writers_guide/sigmund-1920x1280.jpg +0 -0
  77. data/lib/starter_web/collections/posts/public/featured/_posts/{0000-00-00-welcome-to-j1-template.adoc.erb → 0000-00-00-welcome-to-j1.adoc.erb} +29 -13
  78. data/lib/starter_web/collections/posts/public/featured/_posts/{2020-05-01-top-open-source-static-site-generators.adoc → 2020-05-01-top-site-generators.adoc} +10 -15
  79. data/lib/starter_web/collections/posts/public/featured/_posts/2020-06-01-about-cookies.adoc +58 -54
  80. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-01-post-test-series.adoc +1 -1
  81. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-02-post-test-series.adoc +1 -1
  82. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-03-post-test-series.adoc +1 -1
  83. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-04-post-test-series.adoc +1 -1
  84. data/lib/starter_web/dot.gitignore +2 -3
  85. data/lib/starter_web/index.html +10 -12
  86. data/lib/starter_web/package.json +1 -1
  87. data/lib/starter_web/pages/public/about/about_site.adoc +15 -1811
  88. data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/asciidoc-extensions/blindtext.asciidoc +11 -0
  89. data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/asciidoc-extensions/font_icons.asciidoc +23 -0
  90. data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/asciidoc-extensions/gallery.asciidoc +5 -0
  91. data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/asciidoc-extensions/lightbox.asciidoc +7 -0
  92. data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/documents/chapter_document.asciidoc +9 -0
  93. data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/documents/entry_document.asciidoc +3 -0
  94. data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/images/image.asciidoc +6 -0
  95. data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/tables/table_2_column.asciidoc +12 -0
  96. data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/tables/table_2_column_options.asciidoc +30 -0
  97. data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/tables/table_3_column.asciidoc +16 -0
  98. data/lib/starter_web/pages/public/asciidoc_skeletons/_templates/tables/table_4_column.asciidoc +25 -0
  99. data/lib/starter_web/pages/public/asciidoc_skeletons/book/000_intro.adoc +61 -0
  100. data/lib/starter_web/pages/public/asciidoc_skeletons/book/100_chapter.adoc +58 -0
  101. data/lib/starter_web/pages/public/asciidoc_skeletons/book/200_chapter.adoc +59 -0
  102. data/lib/starter_web/pages/public/asciidoc_skeletons/book/900_references.adoc +68 -0
  103. data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/attributes.asciidoc +68 -0
  104. data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/000_intro.asciidoc +33 -0
  105. data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/100_chapter.asciidoc +7 -0
  106. data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/100_chapter/100_chapter_document.asciidoc +21 -0
  107. data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/100_chapter/110_chapter_document.asciidoc +36 -0
  108. data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/200_chapter.asciidoc +5 -0
  109. data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/200_chapter/200_chapter_document.asciidoc +53 -0
  110. data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/900_references.asciidoc +23 -0
  111. data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/900_references/000_intro.asciidoc +23 -0
  112. data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/900_references/100_chapter_document.asciidoc +33 -0
  113. data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/900_references/200_chapter_document.asciidoc +26 -0
  114. data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/900_references/900_sources.asciidoc +81 -0
  115. data/lib/starter_web/pages/public/asciidoc_skeletons/book/_includes/documents/tables/110_material_design_icons.asciidoc +102 -0
  116. data/lib/starter_web/pages/public/asciidoc_skeletons/book/a2p.bat +28 -0
  117. data/lib/starter_web/pages/public/asciidoc_skeletons/book/a2p.sh +26 -0
  118. data/lib/starter_web/pages/public/asciidoc_skeletons/book/book.a2p +114 -0
  119. data/lib/starter_web/pages/public/asciidoc_skeletons/book/book.adoc +128 -0
  120. data/lib/starter_web/pages/public/asciidoc_skeletons/book/book.pdf +5440 -0
  121. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/100_chapter.asciidoc +60 -0
  122. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/200_chapter.asciidoc +59 -0
  123. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/_includes/attributes.asciidoc +63 -0
  124. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/_includes/documents/100_chapter.asciidoc +53 -0
  125. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/_includes/documents/200_chapter.asciidoc +53 -0
  126. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/_includes/documents/tables/110_material_design_icons.asciidoc +102 -0
  127. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/multi.adoc +84 -0
  128. data/lib/starter_web/pages/public/asciidoc_skeletons/simple-document/simple.adoc +236 -0
  129. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.adoc +5 -6
  130. data/lib/starter_web/pages/public/learn/roundtrip/100_present_videos.adoc +1 -1
  131. data/lib/starter_web/pages/public/learn/roundtrip/200_typography.adoc +1 -269
  132. data/lib/starter_web/pages/public/learn/roundtrip/300_icon_fonts.adoc +205 -90
  133. data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +5 -15
  134. data/lib/starter_web/pages/public/learn/roundtrip/410_bs_modals_extentions.adoc +4 -5
  135. data/lib/starter_web/pages/public/learn/roundtrip/420_responsive_tables_extensions.adoc +1 -54
  136. data/lib/starter_web/pages/public/learn/roundtrip/500_themes.adoc +47 -39
  137. data/lib/starter_web/pages/public/learn/roundtrip/600_quicksearch.adoc +17 -1
  138. data/lib/starter_web/pages/public/learn/roundtrip/_includes/attributes.asciidoc +1 -1
  139. data/lib/starter_web/pages/public/learn/roundtrip/_includes/documents/{410_table_3_column.asciidoc → 410_table_bs_modal_examples.asciidoc} +0 -0
  140. data/lib/starter_web/pages/public/learn/roundtrip/_includes/documents/tables/bs_modal_examples.asciidoc +47 -0
  141. data/lib/starter_web/pages/public/learn/where_to_go.adoc +25 -50
  142. data/lib/starter_web/pages/public/panels/intro_panel/panel.adoc +67 -36
  143. data/lib/starter_web/pages/public/previewer/_includes/tables/rouge/200_rouge_attributes.asciidoc +1 -1
  144. data/lib/starter_web/pages/public/previewer/bootstrap_theme.adoc +15 -15
  145. data/lib/starter_web/pages/public/previewer/mdi_icons_preview.adoc +1 -1
  146. data/lib/starter_web/pages/public/previewer/rouge.adoc +33 -24
  147. data/lib/starter_web/pages/public/previewer/twitter_emoji_preview.adoc +1 -1
  148. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  149. data/lib/starter_web/utilsrv/package.json +1 -1
  150. metadata +75 -39
  151. data/assets/themes/j1/modules/justifiedGallery/_versions/v3.8.0/justifiedGallery.min.zip +0 -0
  152. data/assets/themes/j1/modules/justifiedGallery/_versions/v3.8.0/justifiedGallery.zip +0 -0
  153. data/assets/themes/j1/modules/justifiedGallery/_versions/v4.0.0/css/justifiedGallery.css +0 -110
  154. data/assets/themes/j1/modules/justifiedGallery/_versions/v4.0.0/css/justifiedGallery.min.css +0 -110
  155. data/assets/themes/j1/modules/justifiedGallery/_versions/v4.0.0/css/theme/uno.css +0 -23
  156. data/assets/themes/j1/modules/justifiedGallery/_versions/v4.0.0/js/jquery.justifiedGallery.js +0 -1229
  157. data/assets/themes/j1/modules/justifiedGallery/_versions/v4.0.0/js/jquery.justifiedGallery.min.js +0 -8
  158. data/assets/themes/j1/modules/twemoji/js/LICENSE +0 -21
  159. data/lib/j1/templates/posts/0000-00-00-welcome-to-j1-template.adoc.erb +0 -72
  160. data/lib/starter_web/collections/posts/public/featured/_posts/2020-04-01-confusion-about-base-url.adoc +0 -118
  161. data/lib/starter_web/pages/public/about/become_a_patron.adoc +0 -71
  162. data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/100_meet_and_greet_jekyll.adoc +0 -79
  163. data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/200_preparations.adoc +0 -77
  164. data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/300_first_awesome_web.adoc +0 -75
  165. data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/_includes/attributes.asciidoc +0 -176
  166. data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/_includes/documents/100_meet_and_greet_jekyll.asciidoc +0 -31
  167. data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/_includes/documents/200_preparations.asciidoc +0 -14
  168. data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/_includes/documents/300_first_awesome_web.asciidoc +0 -11
  169. data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/_includes/parts.asciidoc +0 -193
  170. data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/_includes/tables/debug_variables.asciidoc +0 -47
  171. data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/_includes/tables/readme +0 -1
  172. data/lib/starter_web/pages/public/learn/roundtrip/610_fam.adoc +0 -294
  173. data/lib/starter_web/pages/public/learn/roundtrip/_includes/tables/readme +0 -0
  174. data/lib/starter_web/pages/public/legal/de/100_impress.adoc +0 -98
  175. data/lib/starter_web/pages/public/legal/de/200_terms_of_use.adoc +0 -55
  176. data/lib/starter_web/pages/public/legal/de/300_privacy.adoc +0 -295
  177. data/lib/starter_web/pages/public/legal/de/400_license_agreement.adoc +0 -395
  178. data/lib/starter_web/pages/public/legal/de/500_support.adoc +0 -20
  179. data/lib/starter_web/pages/public/legal/en/400_license_agreement.adoc +0 -441
  180. data/lib/starter_web/pages/public/legal/en/500_support.adoc +0 -27
@@ -1,4 +1,4 @@
1
- Copyright (c) 2019 Miro Mannino
1
+ Copyright (c) 2020 Miro Mannino
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person
4
4
  obtaining a copy of this software and associated documentation
@@ -1,9 +1,11 @@
1
1
  ## Release History
2
2
 
3
- ### 4.0.0-alpha
3
+ ### 3.8.0
4
4
 
5
+ * Added maxRowCount parameter
5
6
  * Added support for SVG images
6
7
  * .entry-visible renamed to .jg-entry-visible to avoid too generic css classes
8
+ * .caption renamed to jg-caption
7
9
  * Various fixes
8
10
 
9
11
  ### 3.7
@@ -22,7 +24,7 @@
22
24
 
23
25
  ### 3.6.4
24
26
 
25
- * semplified the possibility to have a gallery of `<figure>`.
27
+ * semplified the possibility to have a gallery of `<figure>`.
26
28
 
27
29
  ### 3.6.3
28
30
 
@@ -91,7 +93,7 @@
91
93
 
92
94
  <details>
93
95
  <summary>Older versions</summary>
94
-
96
+
95
97
  ### 3.5.4
96
98
 
97
99
  * Added the border option
@@ -40,10 +40,10 @@
40
40
  * @constructor
41
41
  */
42
42
  var JustifiedGallery = function ($gallery, settings) {
43
-
43
+
44
44
  this.settings = settings;
45
45
  this.checkSettings();
46
-
46
+
47
47
  this.imgAnalyzerTimeout = null;
48
48
  this.entries = null;
49
49
  this.buildingRow = {
@@ -73,9 +73,9 @@
73
73
  this.checkWidthIntervalId = null;
74
74
  this.galleryWidth = $gallery.width();
75
75
  this.$gallery = $gallery;
76
-
76
+
77
77
  };
78
-
78
+
79
79
  /** @returns {String} the best suffix given the width and the height */
80
80
  JustifiedGallery.prototype.getSuffix = function (width, height) {
81
81
  var longestSide, i;
@@ -87,7 +87,7 @@
87
87
  }
88
88
  return this.settings.sizeRangeSuffixes[this.suffixRanges[i - 1]];
89
89
  };
90
-
90
+
91
91
  /**
92
92
  * Remove the suffix from the string
93
93
  *
@@ -96,14 +96,14 @@
96
96
  JustifiedGallery.prototype.removeSuffix = function (str, suffix) {
97
97
  return str.substring(0, str.length - suffix.length);
98
98
  };
99
-
99
+
100
100
  /**
101
101
  * @returns {boolean} a boolean to say if the suffix is contained in the str or not
102
102
  */
103
103
  JustifiedGallery.prototype.endsWith = function (str, suffix) {
104
104
  return str.indexOf(suffix, str.length - suffix.length) !== -1;
105
105
  };
106
-
106
+
107
107
  /**
108
108
  * Get the used suffix of a particular url
109
109
  *
@@ -119,7 +119,7 @@
119
119
  }
120
120
  return '';
121
121
  };
122
-
122
+
123
123
  /**
124
124
  * Given an image src, with the width and the height, returns the new image src with the
125
125
  * best suffix to show the best quality thumbnail.
@@ -128,7 +128,7 @@
128
128
  */
129
129
  JustifiedGallery.prototype.newSrc = function (imageSrc, imgWidth, imgHeight, image) {
130
130
  var newImageSrc;
131
-
131
+
132
132
  if (this.settings.thumbnailPath) {
133
133
  newImageSrc = this.settings.thumbnailPath(imageSrc, imgWidth, imgHeight, image);
134
134
  } else {
@@ -138,10 +138,10 @@
138
138
  newImageSrc = this.removeSuffix(newImageSrc, this.getUsedSuffix(newImageSrc));
139
139
  newImageSrc += this.getSuffix(imgWidth, imgHeight) + ext;
140
140
  }
141
-
141
+
142
142
  return newImageSrc;
143
143
  };
144
-
144
+
145
145
  /**
146
146
  * Shows the images that is in the given entry
147
147
  *
@@ -157,7 +157,7 @@
157
157
  $entry.find(this.settings.imgSelector).stop().fadeTo(this.settings.imagesAnimationDuration, 1.0, callback);
158
158
  }
159
159
  };
160
-
160
+
161
161
  /**
162
162
  * Extract the image src form the image, looking from the 'safe-src', and if it can't be found, from the
163
163
  * 'src' attribute. It saves in the image data the 'jg.originalSrc' field, with the extracted src.
@@ -177,19 +177,19 @@
177
177
  $image.data('jg.originalSrcLoc', imageSrcLoc); // this is saved for the destroy method
178
178
  return imageSrc;
179
179
  };
180
-
180
+
181
181
  /** @returns {jQuery} the image in the given entry */
182
182
  JustifiedGallery.prototype.imgFromEntry = function ($entry) {
183
183
  var $img = $entry.find(this.settings.imgSelector);
184
184
  return $img.length === 0 ? null : $img;
185
185
  };
186
-
186
+
187
187
  /** @returns {jQuery} the caption in the given entry */
188
188
  JustifiedGallery.prototype.captionFromEntry = function ($entry) {
189
189
  var $caption = $entry.find('> .jg-caption');
190
190
  return $caption.length === 0 ? null : $caption;
191
191
  };
192
-
192
+
193
193
  /**
194
194
  * Display the entry
195
195
  *
@@ -205,29 +205,29 @@
205
205
  $entry.height(rowHeight);
206
206
  $entry.css('top', y);
207
207
  $entry.css('left', x);
208
-
208
+
209
209
  var $image = this.imgFromEntry($entry);
210
210
  if ($image !== null) {
211
211
  $image.css('width', imgWidth);
212
212
  $image.css('height', imgHeight);
213
213
  $image.css('margin-left', - Math.round(imgWidth / 2));
214
214
  $image.css('margin-top', - Math.round(imgHeight / 2));
215
-
215
+
216
216
  // Image reloading for an high quality of thumbnails
217
217
  var imageSrc = $image.data('jg.src');
218
218
  if (imageSrc) {
219
219
  imageSrc = this.newSrc(imageSrc, imgWidth, imgHeight, $image[0]);
220
-
220
+
221
221
  $image.one('error', function () {
222
222
  this.resetImgSrc($image); //revert to the original thumbnail
223
223
  });
224
-
224
+
225
225
  var loadNewImage = function () {
226
- // if (imageSrc !== newImageSrc) {
226
+ // if (imageSrc !== newImageSrc) {
227
227
  $image.attr('src', imageSrc);
228
228
  // }
229
229
  };
230
-
230
+
231
231
  if ($entry.data('jg.loaded') === 'skipped' && imageSrc) {
232
232
  this.onImageEvent(imageSrc, (function() {
233
233
  this.showImg($entry, loadNewImage); //load the new image after the fadeIn
@@ -236,16 +236,16 @@
236
236
  } else {
237
237
  this.showImg($entry, loadNewImage); //load the new image after the fadeIn
238
238
  }
239
-
239
+
240
240
  }
241
-
241
+
242
242
  } else {
243
243
  this.showImg($entry);
244
244
  }
245
-
245
+
246
246
  this.displayEntryCaption($entry);
247
247
  };
248
-
248
+
249
249
  /**
250
250
  * Display the entry caption. If the caption element doesn't exists, it creates the caption using the 'alt'
251
251
  * or the 'title' attributes.
@@ -256,7 +256,7 @@
256
256
  var $image = this.imgFromEntry($entry);
257
257
  if ($image !== null && this.settings.captions) {
258
258
  var $imgCaption = this.captionFromEntry($entry);
259
-
259
+
260
260
  // Create it if it doesn't exists
261
261
  if ($imgCaption === null) {
262
262
  var caption = $image.attr('alt');
@@ -267,7 +267,7 @@
267
267
  $entry.data('jg.createdCaption', true);
268
268
  }
269
269
  }
270
-
270
+
271
271
  // Create events (we check again the $imgCaption because it can be still inexistent)
272
272
  if ($imgCaption !== null) {
273
273
  if (!this.settings.cssAnimation) $imgCaption.stop().fadeTo(0, this.settings.captionSettings.nonVisibleOpacity);
@@ -277,7 +277,7 @@
277
277
  this.removeCaptionEventsHandlers($entry);
278
278
  }
279
279
  };
280
-
280
+
281
281
  /**
282
282
  * Validates the caption
283
283
  *
@@ -287,7 +287,7 @@
287
287
  JustifiedGallery.prototype.isValidCaption = function (caption) {
288
288
  return (typeof caption !== 'undefined' && caption.length > 0);
289
289
  };
290
-
290
+
291
291
  /**
292
292
  * The callback for the event 'mouseenter'. It assumes that the event currentTarget is an entry.
293
293
  * It shows the caption using jQuery (or using CSS if it is configured so)
@@ -303,7 +303,7 @@
303
303
  this.settings.captionSettings.visibleOpacity);
304
304
  }
305
305
  };
306
-
306
+
307
307
  /**
308
308
  * The callback for the event 'mouseleave'. It assumes that the event currentTarget is an entry.
309
309
  * It hides the caption using jQuery (or using CSS if it is configured so)
@@ -319,7 +319,7 @@
319
319
  this.settings.captionSettings.nonVisibleOpacity);
320
320
  }
321
321
  };
322
-
322
+
323
323
  /**
324
324
  * Add the handlers of the entry for the caption
325
325
  *
@@ -337,7 +337,7 @@
337
337
  $entry.data('jg.captionMouseEvents', captionMouseEvents);
338
338
  }
339
339
  };
340
-
340
+
341
341
  /**
342
342
  * Remove the handlers of the entry for the caption
343
343
  *
@@ -351,7 +351,7 @@
351
351
  $entry.removeData('jg.captionMouseEvents');
352
352
  }
353
353
  };
354
-
354
+
355
355
  /**
356
356
  * Clear the building row data to be used for a new row
357
357
  */
@@ -360,7 +360,7 @@
360
360
  this.buildingRow.aspectRatio = 0;
361
361
  this.buildingRow.width = 0;
362
362
  };
363
-
363
+
364
364
  /**
365
365
  * Justify the building row, preparing it to
366
366
  *
@@ -376,7 +376,7 @@
376
376
  var rowHeight = availableWidth / this.buildingRow.aspectRatio;
377
377
  var defaultRowHeight = this.settings.rowHeight;
378
378
  var justifiable = this.buildingRow.width / availableWidth > this.settings.justifyThreshold;
379
-
379
+
380
380
  //Skip the last row if we can't justify it and the lastRow == 'hide'
381
381
  if (hiddenRow || (isLastRow && this.settings.lastRow === 'hide' && !justifiable)) {
382
382
  for (i = 0; i < this.buildingRow.entriesBuff.length; i++) {
@@ -390,21 +390,21 @@
390
390
  }
391
391
  return -1;
392
392
  }
393
-
393
+
394
394
  // With lastRow = nojustify, justify if is justificable (the images will not become too big)
395
395
  if (isLastRow && !justifiable && this.settings.lastRow !== 'justify' && this.settings.lastRow !== 'hide') {
396
396
  justify = false;
397
-
397
+
398
398
  if (this.rows > 0) {
399
399
  defaultRowHeight = (this.offY - this.border - this.settings.margins * this.rows) / this.rows;
400
400
  justify = defaultRowHeight * this.buildingRow.aspectRatio / availableWidth > this.settings.justifyThreshold;
401
401
  }
402
402
  }
403
-
403
+
404
404
  for (i = 0; i < this.buildingRow.entriesBuff.length; i++) {
405
405
  $entry = this.buildingRow.entriesBuff[i];
406
406
  imgAspectRatio = $entry.data('jg.width') / $entry.data('jg.height');
407
-
407
+
408
408
  if (justify) {
409
409
  newImgW = (i === this.buildingRow.entriesBuff.length - 1) ? availableWidth : rowHeight * imgAspectRatio;
410
410
  newImgH = rowHeight;
@@ -412,17 +412,17 @@
412
412
  newImgW = defaultRowHeight * imgAspectRatio;
413
413
  newImgH = defaultRowHeight;
414
414
  }
415
-
415
+
416
416
  availableWidth -= Math.round(newImgW);
417
417
  $entry.data('jg.jwidth', Math.round(newImgW));
418
418
  $entry.data('jg.jheight', Math.ceil(newImgH));
419
419
  if (i === 0 || minHeight > newImgH) minHeight = newImgH;
420
420
  }
421
-
421
+
422
422
  this.buildingRow.height = minHeight;
423
423
  return justify;
424
424
  };
425
-
425
+
426
426
  /**
427
427
  * Flush a row: justify it, modify the gallery height accordingly to the row height
428
428
  *
@@ -432,43 +432,43 @@
432
432
  JustifiedGallery.prototype.flushRow = function (isLastRow, hiddenRow) {
433
433
  var settings = this.settings;
434
434
  var $entry, buildingRowRes, offX = this.border, i;
435
-
435
+
436
436
  buildingRowRes = this.prepareBuildingRow(isLastRow, hiddenRow);
437
437
  if (hiddenRow || (isLastRow && settings.lastRow === 'hide' && buildingRowRes === -1)) {
438
438
  this.clearBuildingRow();
439
439
  return;
440
440
  }
441
-
441
+
442
442
  if (this.maxRowHeight) {
443
443
  if (this.maxRowHeight < this.buildingRow.height) this.buildingRow.height = this.maxRowHeight;
444
444
  }
445
-
445
+
446
446
  //Align last (unjustified) row
447
447
  if (isLastRow && (settings.lastRow === 'center' || settings.lastRow === 'right')) {
448
448
  var availableWidth = this.galleryWidth - 2 * this.border - (this.buildingRow.entriesBuff.length - 1) * settings.margins;
449
-
449
+
450
450
  for (i = 0; i < this.buildingRow.entriesBuff.length; i++) {
451
451
  $entry = this.buildingRow.entriesBuff[i];
452
452
  availableWidth -= $entry.data('jg.jwidth');
453
453
  }
454
-
454
+
455
455
  if (settings.lastRow === 'center')
456
456
  offX += Math.round(availableWidth / 2);
457
457
  else if (settings.lastRow === 'right')
458
458
  offX += availableWidth;
459
459
  }
460
-
460
+
461
461
  var lastEntryIdx = this.buildingRow.entriesBuff.length - 1;
462
462
  for (i = 0; i <= lastEntryIdx; i++) {
463
463
  $entry = this.buildingRow.entriesBuff[this.settings.rtl ? lastEntryIdx - i : i];
464
464
  this.displayEntry($entry, offX, this.offY, $entry.data('jg.jwidth'), $entry.data('jg.jheight'), this.buildingRow.height);
465
465
  offX += $entry.data('jg.jwidth') + settings.margins;
466
466
  }
467
-
467
+
468
468
  //Gallery Height
469
469
  this.galleryHeightToSet = this.offY + this.buildingRow.height + this.border;
470
470
  this.setGalleryTempHeight(this.galleryHeightToSet + this.getSpinnerHeight());
471
-
471
+
472
472
  if (!isLastRow || (this.buildingRow.height <= settings.rowHeight && buildingRowRes)) {
473
473
  //Ready for a new row
474
474
  this.offY += this.buildingRow.height + settings.margins;
@@ -477,63 +477,63 @@
477
477
  this.settings.triggerEvent.call(this, 'jg.rowflush');
478
478
  }
479
479
  };
480
-
481
-
480
+
481
+
482
482
  // Scroll position not restoring: https://github.com/miromannino/Justified-Gallery/issues/221
483
483
  var galleryPrevStaticHeight = 0;
484
-
484
+
485
485
  JustifiedGallery.prototype.rememberGalleryHeight = function () {
486
486
  galleryPrevStaticHeight = this.$gallery.height();
487
487
  this.$gallery.height(galleryPrevStaticHeight);
488
488
  };
489
-
489
+
490
490
  // grow only
491
491
  JustifiedGallery.prototype.setGalleryTempHeight = function (height) {
492
492
  galleryPrevStaticHeight = Math.max(height, galleryPrevStaticHeight);
493
493
  this.$gallery.height(galleryPrevStaticHeight);
494
494
  };
495
-
495
+
496
496
  JustifiedGallery.prototype.setGalleryFinalHeight = function (height) {
497
497
  galleryPrevStaticHeight = height;
498
498
  this.$gallery.height(height);
499
499
  };
500
-
500
+
501
501
  /**
502
502
  * Checks the width of the gallery container, to know if a new justification is needed
503
503
  */
504
504
  JustifiedGallery.prototype.checkWidth = function () {
505
505
  this.checkWidthIntervalId = setInterval($.proxy(function () {
506
-
506
+
507
507
  // if the gallery is not currently visible, abort.
508
508
  if (!this.$gallery.is(":visible")) return;
509
-
509
+
510
510
  var galleryWidth = parseFloat(this.$gallery.width());
511
511
  if (Math.abs(galleryWidth - this.galleryWidth) > this.settings.refreshSensitivity) {
512
512
  this.galleryWidth = galleryWidth;
513
513
  this.rewind();
514
-
514
+
515
515
  this.rememberGalleryHeight();
516
-
516
+
517
517
  // Restart to analyze
518
518
  this.startImgAnalyzer(true);
519
519
  }
520
520
  }, this), this.settings.refreshTime);
521
521
  };
522
-
522
+
523
523
  /**
524
524
  * @returns {boolean} a boolean saying if the spinner is active or not
525
525
  */
526
526
  JustifiedGallery.prototype.isSpinnerActive = function () {
527
527
  return this.spinner.intervalId !== null;
528
528
  };
529
-
529
+
530
530
  /**
531
531
  * @returns {int} the spinner height
532
532
  */
533
533
  JustifiedGallery.prototype.getSpinnerHeight = function () {
534
534
  return this.spinner.$el.innerHeight();
535
535
  };
536
-
536
+
537
537
  /**
538
538
  * Stops the spinner animation and modify the gallery height to exclude the spinner
539
539
  */
@@ -543,7 +543,7 @@
543
543
  this.setGalleryTempHeight(this.$gallery.height() - this.getSpinnerHeight());
544
544
  this.spinner.$el.detach();
545
545
  };
546
-
546
+
547
547
  /**
548
548
  * Starts the spinner animation
549
549
  */
@@ -562,7 +562,7 @@
562
562
  spinnerContext.phase = (spinnerContext.phase + 1) % ($spinnerPoints.length * 2);
563
563
  }, spinnerContext.timeSlot);
564
564
  };
565
-
565
+
566
566
  /**
567
567
  * Rewind the image analysis to start from the first entry.
568
568
  */
@@ -573,14 +573,14 @@
573
573
  this.rows = 0;
574
574
  this.clearBuildingRow();
575
575
  };
576
-
576
+
577
577
  /**
578
578
  * @returns {String} `settings.selector` rejecting spinner element
579
579
  */
580
580
  JustifiedGallery.prototype.getSelectorWithoutSpinner = function () {
581
581
  return this.settings.selector + ', div:not(.jg-spinner)';
582
582
  };
583
-
583
+
584
584
  /**
585
585
  * @returns {Array} all entries matched by `settings.selector`
586
586
  */
@@ -588,7 +588,7 @@
588
588
  var selector = this.getSelectorWithoutSpinner();
589
589
  return this.$gallery.children(selector).toArray();
590
590
  };
591
-
591
+
592
592
  /**
593
593
  * Update the entries searching it from the justified gallery HTML element
594
594
  *
@@ -597,7 +597,7 @@
597
597
  */
598
598
  JustifiedGallery.prototype.updateEntries = function (norewind) {
599
599
  var newEntries;
600
-
600
+
601
601
  if (norewind && this.lastFetchedEntry != null) {
602
602
  var selector = this.getSelectorWithoutSpinner();
603
603
  newEntries = $(this.lastFetchedEntry).nextAll(selector).toArray();
@@ -605,9 +605,9 @@
605
605
  this.entries = [];
606
606
  newEntries = this.getAllEntries();
607
607
  }
608
-
608
+
609
609
  if (newEntries.length > 0) {
610
-
610
+
611
611
  // Sort or randomize
612
612
  if ($.isFunction(this.settings.sort)) {
613
613
  newEntries = this.sortArray(newEntries);
@@ -615,20 +615,20 @@
615
615
  newEntries = this.shuffleArray(newEntries);
616
616
  }
617
617
  this.lastFetchedEntry = newEntries[newEntries.length - 1];
618
-
618
+
619
619
  // Filter
620
620
  if (this.settings.filter) {
621
621
  newEntries = this.filterArray(newEntries);
622
622
  } else {
623
623
  this.resetFilters(newEntries);
624
624
  }
625
-
625
+
626
626
  }
627
-
627
+
628
628
  this.entries = this.entries.concat(newEntries);
629
629
  return true;
630
630
  };
631
-
631
+
632
632
  /**
633
633
  * Apply the entries order to the DOM, iterating the entries and appending the images
634
634
  *
@@ -640,7 +640,7 @@
640
640
  $(this).appendTo(that.$gallery);
641
641
  });
642
642
  };
643
-
643
+
644
644
  /**
645
645
  * Shuffle the array using the Fisher-Yates shuffle algorithm
646
646
  *
@@ -658,7 +658,7 @@
658
658
  this.insertToGallery(a);
659
659
  return a;
660
660
  };
661
-
661
+
662
662
  /**
663
663
  * Sort the array using settings.comparator as comparator
664
664
  *
@@ -670,7 +670,7 @@
670
670
  this.insertToGallery(a);
671
671
  return a;
672
672
  };
673
-
673
+
674
674
  /**
675
675
  * Reset the filters removing the 'jg-filtered' class from all the entries
676
676
  *
@@ -679,7 +679,7 @@
679
679
  JustifiedGallery.prototype.resetFilters = function (a) {
680
680
  for (var i = 0; i < a.length; i++) $(a[i]).removeClass('jg-filtered');
681
681
  };
682
-
682
+
683
683
  /**
684
684
  * Filter the entries considering theirs classes (if a string has been passed) or using a function for filtering.
685
685
  *
@@ -713,7 +713,7 @@
713
713
  return filteredArr;
714
714
  }
715
715
  };
716
-
716
+
717
717
  /**
718
718
  * Revert the image src to the default value.
719
719
  */
@@ -724,7 +724,7 @@
724
724
  $img.attr('src', '');
725
725
  }
726
726
  };
727
-
727
+
728
728
  /**
729
729
  * Destroy the Justified Gallery instance.
730
730
  *
@@ -737,11 +737,11 @@
737
737
  JustifiedGallery.prototype.destroy = function () {
738
738
  clearInterval(this.checkWidthIntervalId);
739
739
  this.stopImgAnalyzerStarter();
740
-
740
+
741
741
  // Get fresh entries list since filtered entries are absent in `this.entries`
742
742
  $.each(this.getAllEntries(), $.proxy(function (_, entry) {
743
743
  var $entry = $(entry);
744
-
744
+
745
745
  // Reset entry style
746
746
  $entry.css('width', '');
747
747
  $entry.css('height', '');
@@ -749,7 +749,7 @@
749
749
  $entry.css('left', '');
750
750
  $entry.data('jg.loaded', undefined);
751
751
  $entry.removeClass('jg-entry jg-filtered jg-entry-visible');
752
-
752
+
753
753
  // Reset image style
754
754
  var $img = this.imgFromEntry($entry);
755
755
  if ($img) {
@@ -762,7 +762,7 @@
762
762
  $img.data('jg.originalSrcLoc', undefined);
763
763
  $img.data('jg.src', undefined);
764
764
  }
765
-
765
+
766
766
  // Remove caption
767
767
  this.removeCaptionEventsHandlers($entry);
768
768
  var $caption = this.captionFromEntry($entry);
@@ -773,15 +773,15 @@
773
773
  } else {
774
774
  if ($caption !== null) $caption.fadeTo(0, 1);
775
775
  }
776
-
776
+
777
777
  }, this));
778
-
778
+
779
779
  this.$gallery.css('height', '');
780
780
  this.$gallery.removeClass('justified-gallery');
781
781
  this.$gallery.data('jg.controller', undefined);
782
782
  this.settings.triggerEvent.call(this, 'jg.destroy');
783
783
  };
784
-
784
+
785
785
  /**
786
786
  * Analyze the images and builds the rows. It returns if it found an image that is not loaded.
787
787
  *
@@ -794,15 +794,15 @@
794
794
  var availableWidth = this.galleryWidth - 2 * this.border - (
795
795
  (this.buildingRow.entriesBuff.length - 1) * this.settings.margins);
796
796
  var imgAspectRatio = $entry.data('jg.width') / $entry.data('jg.height');
797
-
797
+
798
798
  this.buildingRow.entriesBuff.push($entry);
799
799
  this.buildingRow.aspectRatio += imgAspectRatio;
800
800
  this.buildingRow.width += imgAspectRatio * this.settings.rowHeight;
801
801
  this.lastAnalyzedIndex = i;
802
-
802
+
803
803
  if (availableWidth / (this.buildingRow.aspectRatio + imgAspectRatio) < this.settings.rowHeight) {
804
804
  this.flushRow(false, this.settings.maxRowsCount > 0 && this.rows === this.settings.maxRowsCount);
805
-
805
+
806
806
  if (++this.yield.flushed >= this.yield.every) {
807
807
  this.startImgAnalyzer(isForResize);
808
808
  return;
@@ -812,28 +812,28 @@
812
812
  return;
813
813
  }
814
814
  }
815
-
815
+
816
816
  // Last row flush (the row is not full)
817
817
  if (this.buildingRow.entriesBuff.length > 0) {
818
818
  this.flushRow(true, this.settings.maxRowsCount > 0 && this.rows === this.settings.maxRowsCount);
819
819
  }
820
-
820
+
821
821
  if (this.isSpinnerActive()) {
822
822
  this.stopLoadingSpinnerAnimation();
823
823
  }
824
-
824
+
825
825
  /* Stop, if there is, the timeout to start the analyzeImages.
826
826
  This is because an image can be set loaded, and the timeout can be set,
827
827
  but this image can be analyzed yet.
828
828
  */
829
829
  this.stopImgAnalyzerStarter();
830
-
830
+
831
831
  this.setGalleryFinalHeight(this.galleryHeightToSet);
832
-
832
+
833
833
  //On complete callback
834
834
  this.settings.triggerEvent.call(this, isForResize ? 'jg.resize' : 'jg.complete');
835
835
  };
836
-
836
+
837
837
  /**
838
838
  * Stops any ImgAnalyzer starter (that has an assigned timeout)
839
839
  */
@@ -844,7 +844,7 @@
844
844
  this.imgAnalyzerTimeout = null;
845
845
  }
846
846
  };
847
-
847
+
848
848
  /**
849
849
  * Starts the image analyzer. It is not immediately called to let the browser to update the view
850
850
  *
@@ -857,7 +857,7 @@
857
857
  that.analyzeImages(isForResize);
858
858
  }, 0.001); // we can't start it immediately due to a IE different behaviour
859
859
  };
860
-
860
+
861
861
  /**
862
862
  * Checks if the image is loaded or not using another image object. We cannot use the 'complete' image property,
863
863
  * because some browsers, with a 404 set complete = true.
@@ -868,7 +868,7 @@
868
868
  */
869
869
  JustifiedGallery.prototype.onImageEvent = function (imageSrc, onLoad, onError) {
870
870
  if (!onLoad && !onError) return;
871
-
871
+
872
872
  var memImage = new Image();
873
873
  var $memImage = $(memImage);
874
874
  if (onLoad) {
@@ -885,7 +885,7 @@
885
885
  }
886
886
  memImage.src = imageSrc;
887
887
  };
888
-
888
+
889
889
  /**
890
890
  * Init of Justified Gallery controlled
891
891
  * It analyzes all the entries starting theirs loading and calling the image analyzer (that works with loaded images)
@@ -895,23 +895,23 @@
895
895
  $.each(this.entries, function (index, entry) {
896
896
  var $entry = $(entry);
897
897
  var $image = that.imgFromEntry($entry);
898
-
898
+
899
899
  $entry.addClass('jg-entry');
900
-
900
+
901
901
  if ($entry.data('jg.loaded') !== true && $entry.data('jg.loaded') !== 'skipped') {
902
-
902
+
903
903
  // Link Rel global overwrite
904
904
  if (that.settings.rel !== null) $entry.attr('rel', that.settings.rel);
905
-
905
+
906
906
  // Link Target global overwrite
907
907
  if (that.settings.target !== null) $entry.attr('target', that.settings.target);
908
-
908
+
909
909
  if ($image !== null) {
910
-
910
+
911
911
  // Image src
912
912
  var imageSrc = that.extractImgSrcFromImage($image);
913
-
914
- /* If we have the height and the width, we don't wait that the image is loaded,
913
+
914
+ /* If we have the height and the width, we don't wait that the image is loaded,
915
915
  but we start directly with the justification */
916
916
  if (that.settings.waitThumbnailsLoad === false || !imageSrc) {
917
917
  var width = parseFloat($image.attr('width'));
@@ -929,13 +929,13 @@
929
929
  return true; // continue
930
930
  }
931
931
  }
932
-
932
+
933
933
  $entry.data('jg.loaded', false);
934
934
  imagesToLoad = true;
935
-
935
+
936
936
  // Spinner start
937
937
  if (!that.isSpinnerActive()) that.startLoadingSpinnerAnimation();
938
-
938
+
939
939
  that.onImageEvent(imageSrc, function (loadImg) { // image loaded
940
940
  $entry.data('jg.width', loadImg.width);
941
941
  $entry.data('jg.height', loadImg.height);
@@ -945,21 +945,21 @@
945
945
  $entry.data('jg.loaded', 'error');
946
946
  that.startImgAnalyzer(false);
947
947
  });
948
-
948
+
949
949
  } else {
950
950
  $entry.data('jg.loaded', true);
951
951
  $entry.data('jg.width', $entry.width() | parseFloat($entry.css('width')) | 1);
952
952
  $entry.data('jg.height', $entry.height() | parseFloat($entry.css('height')) | 1);
953
953
  }
954
-
954
+
955
955
  }
956
-
956
+
957
957
  });
958
-
958
+
959
959
  if (!imagesToLoad && !skippedImages) this.startImgAnalyzer(false);
960
960
  this.checkWidth();
961
961
  };
962
-
962
+
963
963
  /**
964
964
  * Checks that it is a valid number. If a string is passed it is converted to a number
965
965
  *
@@ -970,14 +970,14 @@
970
970
  if ($.type(settingContainer[settingName]) === 'string') {
971
971
  settingContainer[settingName] = parseFloat(settingContainer[settingName]);
972
972
  }
973
-
973
+
974
974
  if ($.type(settingContainer[settingName]) === 'number') {
975
975
  if (isNaN(settingContainer[settingName])) throw 'invalid number for ' + settingName;
976
976
  } else {
977
977
  throw settingName + ' must be a number';
978
978
  }
979
979
  };
980
-
980
+
981
981
  /**
982
982
  * Checks the sizeRangeSuffixes and, if necessary, converts
983
983
  * its keys from string (e.g. old settings with 'lt100') to int.
@@ -986,12 +986,12 @@
986
986
  if ($.type(this.settings.sizeRangeSuffixes) !== 'object') {
987
987
  throw 'sizeRangeSuffixes must be defined and must be an object';
988
988
  }
989
-
989
+
990
990
  var suffixRanges = [];
991
991
  for (var rangeIdx in this.settings.sizeRangeSuffixes) {
992
992
  if (this.settings.sizeRangeSuffixes.hasOwnProperty(rangeIdx)) suffixRanges.push(rangeIdx);
993
993
  }
994
-
994
+
995
995
  var newSizeRngSuffixes = { 0: '' };
996
996
  for (var i = 0; i < suffixRanges.length; i++) {
997
997
  if ($.type(suffixRanges[i]) === 'string') {
@@ -1005,10 +1005,10 @@
1005
1005
  newSizeRngSuffixes[suffixRanges[i]] = this.settings.sizeRangeSuffixes[suffixRanges[i]];
1006
1006
  }
1007
1007
  }
1008
-
1008
+
1009
1009
  this.settings.sizeRangeSuffixes = newSizeRngSuffixes;
1010
1010
  };
1011
-
1011
+
1012
1012
  /**
1013
1013
  * check and convert the maxRowHeight setting
1014
1014
  * requires rowHeight to be already set
@@ -1018,7 +1018,7 @@
1018
1018
  JustifiedGallery.prototype.retrieveMaxRowHeight = function () {
1019
1019
  var newMaxRowHeight = null;
1020
1020
  var rowHeight = this.settings.rowHeight;
1021
-
1021
+
1022
1022
  if ($.type(this.settings.maxRowHeight) === 'string') {
1023
1023
  if (this.settings.maxRowHeight.match(/^[0-9]+%$/)) {
1024
1024
  newMaxRowHeight = rowHeight * parseFloat(this.settings.maxRowHeight.match(/^([0-9]+)%$/)[1]) / 100;
@@ -1032,27 +1032,27 @@
1032
1032
  } else {
1033
1033
  throw 'maxRowHeight must be a number or a percentage';
1034
1034
  }
1035
-
1035
+
1036
1036
  // check if the converted value is not a number
1037
1037
  if (isNaN(newMaxRowHeight)) throw 'invalid number for maxRowHeight';
1038
-
1038
+
1039
1039
  // check values, maxRowHeight must be >= rowHeight
1040
1040
  if (newMaxRowHeight < rowHeight) newMaxRowHeight = rowHeight;
1041
-
1041
+
1042
1042
  return newMaxRowHeight;
1043
1043
  };
1044
-
1044
+
1045
1045
  /**
1046
1046
  * Checks the settings
1047
1047
  */
1048
1048
  JustifiedGallery.prototype.checkSettings = function () {
1049
1049
  this.checkSizeRangesSuffixes();
1050
-
1050
+
1051
1051
  this.checkOrConvertNumber(this.settings, 'rowHeight');
1052
1052
  this.checkOrConvertNumber(this.settings, 'margins');
1053
1053
  this.checkOrConvertNumber(this.settings, 'border');
1054
1054
  this.checkOrConvertNumber(this.settings, 'maxRowsCount');
1055
-
1055
+
1056
1056
  var lastRowModes = [
1057
1057
  'justify',
1058
1058
  'nojustify',
@@ -1064,7 +1064,7 @@
1064
1064
  if (lastRowModes.indexOf(this.settings.lastRow) === -1) {
1065
1065
  throw 'lastRow must be one of: ' + lastRowModes.join(', ');
1066
1066
  }
1067
-
1067
+
1068
1068
  this.checkOrConvertNumber(this.settings, 'justifyThreshold');
1069
1069
  if (this.settings.justifyThreshold < 0 || this.settings.justifyThreshold > 1) {
1070
1070
  throw 'justifyThreshold must be in the interval [0,1]';
@@ -1072,38 +1072,38 @@
1072
1072
  if ($.type(this.settings.cssAnimation) !== 'boolean') {
1073
1073
  throw 'cssAnimation must be a boolean';
1074
1074
  }
1075
-
1075
+
1076
1076
  if ($.type(this.settings.captions) !== 'boolean') throw 'captions must be a boolean';
1077
1077
  this.checkOrConvertNumber(this.settings.captionSettings, 'animationDuration');
1078
-
1078
+
1079
1079
  this.checkOrConvertNumber(this.settings.captionSettings, 'visibleOpacity');
1080
1080
  if (this.settings.captionSettings.visibleOpacity < 0 ||
1081
1081
  this.settings.captionSettings.visibleOpacity > 1) {
1082
1082
  throw 'captionSettings.visibleOpacity must be in the interval [0, 1]';
1083
1083
  }
1084
-
1084
+
1085
1085
  this.checkOrConvertNumber(this.settings.captionSettings, 'nonVisibleOpacity');
1086
1086
  if (this.settings.captionSettings.nonVisibleOpacity < 0 ||
1087
1087
  this.settings.captionSettings.nonVisibleOpacity > 1) {
1088
1088
  throw 'captionSettings.nonVisibleOpacity must be in the interval [0, 1]';
1089
1089
  }
1090
-
1090
+
1091
1091
  this.checkOrConvertNumber(this.settings, 'imagesAnimationDuration');
1092
1092
  this.checkOrConvertNumber(this.settings, 'refreshTime');
1093
1093
  this.checkOrConvertNumber(this.settings, 'refreshSensitivity');
1094
1094
  if ($.type(this.settings.randomize) !== 'boolean') throw 'randomize must be a boolean';
1095
1095
  if ($.type(this.settings.selector) !== 'string') throw 'selector must be a string';
1096
-
1096
+
1097
1097
  if (this.settings.sort !== false && !$.isFunction(this.settings.sort)) {
1098
1098
  throw 'sort must be false or a comparison function';
1099
1099
  }
1100
-
1100
+
1101
1101
  if (this.settings.filter !== false && !$.isFunction(this.settings.filter) &&
1102
1102
  $.type(this.settings.filter) !== 'string') {
1103
1103
  throw 'filter must be false, a string or a filter function';
1104
1104
  }
1105
1105
  };
1106
-
1106
+
1107
1107
  /**
1108
1108
  * It brings all the indexes from the sizeRangeSuffixes and it orders them. They are then sorted and returned.
1109
1109
  * @returns {Array} sorted suffix ranges
@@ -1116,7 +1116,7 @@
1116
1116
  suffixRanges.sort(function (a, b) { return a > b ? 1 : a < b ? -1 : 0; });
1117
1117
  return suffixRanges;
1118
1118
  };
1119
-
1119
+
1120
1120
  /**
1121
1121
  * Update the existing settings only changing some of them
1122
1122
  *
@@ -1126,14 +1126,14 @@
1126
1126
  // In this case Justified Gallery has been called again changing only some options
1127
1127
  this.settings = $.extend({}, this.settings, newSettings);
1128
1128
  this.checkSettings();
1129
-
1129
+
1130
1130
  // As reported in the settings: negative value = same as margins, 0 = disabled
1131
1131
  this.border = this.settings.border >= 0 ? this.settings.border : this.settings.margins;
1132
-
1132
+
1133
1133
  this.maxRowHeight = this.retrieveMaxRowHeight();
1134
1134
  this.suffixRanges = this.retrieveSuffixRanges();
1135
1135
  };
1136
-
1136
+
1137
1137
  JustifiedGallery.prototype.defaults = {
1138
1138
  sizeRangeSuffixes: {}, /* e.g. Flickr configuration
1139
1139
  {
@@ -1155,9 +1155,9 @@
1155
1155
  maxRowsCount: 0, // maximum number of rows to be displayed (0 = disabled)
1156
1156
  margins: 1,
1157
1157
  border: -1, // negative value = same as margins, 0 = disabled, any other value to set the border
1158
-
1158
+
1159
1159
  lastRow: 'nojustify', // … which is the same as 'left', or can be 'justify', 'center', 'right' or 'hide'
1160
-
1160
+
1161
1161
  justifyThreshold: 0.90, /* if row width / available space > 0.90 it will be always justified
1162
1162
  * (i.e. lastRow setting is not considered) */
1163
1163
  waitThumbnailsLoad: true,
@@ -1193,7 +1193,7 @@
1193
1193
  this.$gallery.trigger(event); // Consider that 'this' is this set to the JustifiedGallery object, so it can
1194
1194
  } // access to fields such as $gallery, useful to trigger events with jQuery.
1195
1195
  };
1196
-
1196
+
1197
1197
 
1198
1198
  /**
1199
1199
  * Justified Gallery plugin for jQuery