1 2(function($){ 3 $.fn.DOPWallGridGallery = function(options){ 4 var Data = {'ID': 1, 5 'SettingsDataType': 'JSON', 6 'SettingsFilePath': 'DOPWallGridGallery/json/settings.json', 7 'ContentDataType': 'JSON', 8 'ContentFilePath':'DOPWallGridGallery/json/content.json', 9 'Reinitialize': false}, 10 11 Container = this, 12 ID = '', 13 14 Width = 900, 15 Height = 0, 16 BgColor = 'ffffff', 17 BgAlpha = 100, 18 NoLines = 3, 19 NoColumns = 4, 20 ImagesOrder = 'normal', 21 ResponsiveEnabled = 'true', 22 23 ThumbnailsSpacing = 15, 24 ThumbnailsPaddingTop = 0, 25 ThumbnailsPaddingRight = 0, 26 ThumbnailsPaddingBottom = 0, 27 ThumbnailsPaddingLeft = 0, 28 ThumbnailsNavigation = 'mouse', 29 ThumbnailsScrollScrubColor = '777777', 30 ThumbnailsScrollBarColor = 'e0e0e0', 31 ThumbnailsInfo = 'none', 32 33 ThumbnailLoader = 'DOPWallGridGallery/assets/gui/images/ThumbnailLoader.gif', 34 ThumbnailWidth = 200, 35 ThumbnailHeight = 100, 36 ThumbnailWidthDesktop = 200, 37 ThumbnailHeightDesktop = 100, 38 ThumbnailWidthMobile = 100, 39 ThumbnailHeightMobile = 50, 40 ThumbnailAlpha = 80, 41 ThumbnailAlphaHover = 100, 42 ThumbnailBgColor = 'cccccc', 43 ThumbnailBgColorHover = '000000', 44 ThumbnailBorderSize = 0, 45 ThumbnailBorderColor = 'cccccc', 46 ThumbnailBorderColorHover = '000000', 47 ThumbnailPaddingTop = 3, 48 ThumbnailPaddingRight = 3, 49 ThumbnailPaddingBottom = 3, 50 ThumbnailPaddingLeft = 3, 51 52 LightboxPosition = 'document', 53 LightboxWindowColor = '000000', 54 LightboxWindowAlpha = 80, 55 LightboxLoader = 'DOPWallGridGallery/assets/gui/images/LightboxLoader.gif', 56 LightboxBgColor = '000000', 57 LightboxBgAlpha = 100, 58 LightboxMarginTop = 70, 59 LightboxMarginRight = 70, 60 LightboxMarginBottom = 70, 61 LightboxMarginLeft = 70, 62 LightboxPaddingTop = 10, 63 LightboxPaddingRight = 10, 64 LightboxPaddingBottom = 10, 65 LightboxPaddingLeft = 10, 66 67 LightboxNavigationPrev = 'DOPWallGridGallery/assets/gui/images/LightboxPrev.png', 68 LightboxNavigationPrevHover = 'DOPWallGridGallery/assets/gui/images/LightboxPrevHover.png', 69 LightboxNavigationNext = 'DOPWallGridGallery/assets/gui/images/LightboxNext.png', 70 LightboxNavigationNextHover = 'DOPWallGridGallery/assets/gui/images/LightboxNextHover.png', 71 LightboxNavigationClose = 'DOPWallGridGallery/assets/gui/images/LightboxClose.png', 72 LightboxNavigationCloseHover = 'DOPWallGridGallery/assets/gui/images/LightboxCloseHover.png', 73 74 CaptionHeight = 75, 75 CaptionTitleColor = 'eeeeee', 76 CaptionTextColor = 'dddddd', 77 CaptionScrollScrubColor = '777777', 78 CaptionScrollBgColor = 'e0e0e0', 79 80 SocialShareEnabled = 'true', 81 SocialShareLightbox = 'DOPWallGridGallery/assets/gui/images/SocialShareLightbox.png', 82 83 TooltipBgColor = 'ffffff', 84 TooltipStrokeColor = '000000', 85 TooltipTextColor = '000000', 86 87 LabelPosition = 'bottom', 88 LabelTextColor = '000000', 89 LabelTextColorHover = 'ffffff', 90 91 Images = new Array(), 92 Thumbs = new Array(), 93 ThumbsWidth = new Array(), 94 ThumbsHeight = new Array(), 95 ThumbsLoaded = new Array(), 96 ThumbsFirstPosX = new Array(), 97 ThumbsFirstPosY = new Array(), 98 CaptionTitle = new Array(), 99 CaptionText = new Array(), 100 Media = new Array(), 101 Links = new Array(), 102 LinksTarget = new Array(), 103 noItems = 0, 104 105 startGalleryID = 0, 106 startWith = 0, 107 108 initialWidth = Width, 109 110 currentItem = 0,
111 itemLoaded = false, 112 ImageWidth = 0, 113 ImageHeight = 0, 114 LightboxDisplayTime = 600, 115 LightboxNavigationDisplayTime = 600, 116 117 socialShareInterval, 118 119 methods = { 120 init:function( ){// Init Plugin. 121 return this.each(function(){ 122 if (options){ 123 $.extend(Data, options); 124 } 125 126 if (!$(Container).hasClass('dopwgg-initialized') || Data['Reinitialize']){ 127 $(Container).addClass('dopwgg-initialized'); 128 129 ID = Data['ID']; 130 131 if (Data['SettingsDataType'] == 'XML'){ 132 methods.parseXMLSettings(); 133 } 134 else if (Data['SettingsDataType'] == 'JSON'){ 135 methods.parseJSONSettings(); 136 } 137 else{ 138 methods.parseHTMLSettings(); 139 } 140 $(window).bind('resize.DOPWallGridGallery', methods.initRP); 141 $(window).bind('scroll.DOPWallGridGallery', methods.initRPScroll); 142 } 143 }); 144 }, 145 146 parseJSONSettings:function(){// Parse Settings. 147 $.getJSON(prototypes.acaoBuster(Data['SettingsFilePath']), {}, function(data){ 148 Width = parseInt(data['Width']); 149 Height = parseInt(data['Height']); 150 BgColor = data['BgColor'] || 'ffffff'; 151 BgAlpha = parseInt(data['BgAlpha']); 152 NoLines = parseInt(data['NoLines']); 153 NoColumns = parseInt(data['NoColumns']); 154 ImagesOrder = data['ImagesOrder'] || 'normal'; 155 ResponsiveEnabled = data['ResponsiveEnabled'] || 'true'; 156 157 ThumbnailsSpacing = parseInt(data['ThumbnailsSpacing']); 158 ThumbnailsPaddingTop = parseInt(data['ThumbnailsPaddingTop']); 159 ThumbnailsPaddingRight = parseInt(data['ThumbnailsPaddingRight']); 160 ThumbnailsPaddingBottom = parseInt(data['ThumbnailsPaddingBottom']); 161 ThumbnailsPaddingLeft = parseInt(data['ThumbnailsPaddingLeft']); 162 ThumbnailsNavigation = data['ThumbnailsNavigation'] || 'mouse'; 163 ThumbnailsScrollScrubColor = data['ThumbnailsScrollScrubColor'] || '777777'; 164 ThumbnailsScrollBarColor = data['ThumbnailsScrollBarColor'] || 'e0e0e0'; 165 ThumbnailsInfo = data['ThumbnailsInfo'] || 'none'; 166 167 ThumbnailLoader = data['ThumbnailLoader'] || 'DOPWallGridGallery/assets/gui/images/ThumbnailLoader.gif'; 168 ThumbnailWidth = parseInt(data['ThumbnailWidth']); 169 ThumbnailHeight = parseInt(data['ThumbnailHeight']); 170 ThumbnailWidthDesktop = parseInt(data['ThumbnailWidth']); 171 ThumbnailHeightDesktop = parseInt(data['ThumbnailHeight']); 172 ThumbnailWidthMobile = parseInt(data['ThumbnailWidthMobile']); 173 ThumbnailHeightMobile = parseInt(data['ThumbnailHeightMobile']); 174 ThumbnailAlpha = parseInt(data['ThumbnailAlpha']); 175 ThumbnailAlphaHover = parseInt(data['ThumbnailAlphaHover']); 176 ThumbnailBgColor = data['ThumbnailBgColor'] || 'cccccc'; 177 ThumbnailBgColorHover = data['ThumbnailBgColorHover'] || '000000'; 178 ThumbnailBorderSize = parseInt(data['ThumbnailBorderSize']); 179 ThumbnailBorderColor = data['ThumbnailBorderColor'] || 'cccccc'; 180 ThumbnailBorderColorHover = data['ThumbnailBorderColorHover'] || '000000'; 181 ThumbnailPaddingTop = parseInt(data['ThumbnailPaddingTop']); 182 ThumbnailPaddingRight = parseInt(data['ThumbnailPaddingRight']); 183 ThumbnailPaddingBottom = parseInt(data['ThumbnailPaddingBottom']); 184 ThumbnailPaddingLeft = parseInt(data['ThumbnailPaddingLeft']); 185 186 LightboxPosition = data['LightboxPosition'] || 'document'; 187 LightboxWindowColor = data['LightboxWindowColor'] || '000000'; 188 LightboxWindowAlpha = parseInt(data['LightboxWindowAlpha']); 189 LightboxLoader = data['LightboxLoader'] || 'DOPWallGridGallery/assets/gui/images/LightboxLoader.gif'; 190 LightboxBgColor = data['LightboxBgColor'] || '000000'; 191 LightboxBgAlpha = parseInt(data['LightboxBgAlpha']); 192 LightboxMarginTop = parseInt(data['LightboxMarginTop']); 193 LightboxMarginRight = parseInt(data['LightboxMarginRight']); 194 LightboxMarginBottom = parseInt(data['LightboxMarginBottom']); 195 LightboxMarginLeft = parseInt(data['LightboxMarginLeft']); 196 LightboxPaddingTop = parseInt(data['LightboxPaddingTop']); 197 LightboxPaddingRight = parseInt(data['LightboxPaddingRight']); 198 LightboxPaddingBottom = parseInt(data['LightboxPaddingBottom']); 199 LightboxPaddingLeft = parseInt(data['LightboxPaddingLeft']); 200 201 LightboxNavigationPrev = data['LightboxNavigationPrev'] || 'DOPWallGridGallery/assets/gui/images/LightboxPrev.png'; 202 LightboxNavigationPrevHover = data['LightboxNavigationPrevHover'] || 'DOPWallGridGallery/assets/gui/images/LightboxPrevHover.png'; 203 LightboxNavigationNext = data['LightboxNavigationNext'] || 'DOPWallGridGallery/assets/gui/images/LightboxNext.png'; 204 LightboxNavigationNextHover = data['LightboxNavigationNextHover'] || 'DOPWallGridGallery/assets/gui/images/LightboxNextHover.png'; 205 LightboxNavigationClose = data['LightboxNavigationClose'] || 'DOPWallGridGallery/assets/gui/images/LightboxClose.png'; 206 LightboxNavigationCloseHover = data['LightboxNavigationCloseHover'] || 'DOPWallGridGallery/assets/gui/images/LightboxCloseHover.png'; 207 208 CaptionHeight = parseInt(data['CaptionHeight']); 209 CaptionTitleColor = data['CaptionTitleColor'] || 'eeeeee'; 210 CaptionTextColor = data['CaptionTextColor'] || 'dddd
210dd'; 211 CaptionScrollScrubColor = data['CaptionScrollScrubColor'] || '777777'; 212 CaptionScrollBgColor = data['CaptionScrollBgColor'] || 'e0e0e0'; 213 214 SocialShareEnabled = data['SocialShareEnabled'] || 'true'; 215 SocialShareLightbox = data['SocialShareLightbox'] || 'DOPWallGridGallery/assets/gui/images/SocialShareLightbox.png'; 216 217 TooltipBgColor = data['TooltipBgColor'] || 'ffffff'; 218 TooltipStrokeColor = data['TooltipStrokeColor'] || '000000'; 219 TooltipTextColor = data['TooltipTextColor'] || '000000'; 220 221 LabelPosition = data['LabelPosition'] || 'bottom'; 222 LabelTextColor = data['LabelTextColor'] || '000000'; 223 LabelTextColorHover = data['LabelTextColorHover'] || 'ffffff'; 224 225 if (Data['ContentDataType'] == 'XML'){ 226 methods.parseXMLContent(); 227 } 228 else if (Data['ContentDataType'] == 'JSON'){ 229 methods.parseJSONContent(); 230 } 231 else{ 232 methods.parseHTMLContent(); 233 } 234 }); 235 }, 236 parseXMLSettings:function(){// Parse the Settings XML. 237 $.ajax({type:"GET", url:prototypes.acaoBuster(Data['SettingsFilePath']), dataType:"xml", success:function(xml){ 238 var $xml = $(xml); 239 240 Width = parseInt($xml.find('Width').text()); 241 Height = parseInt($xml.find('Height').text()); 242 BgColor = $xml.find('BgColor').text() || 'ffffff'; 243 BgAlpha = parseInt($xml.find('BgAlpha').text()); 244 NoLines = parseInt($xml.find('NoLines').text()); 245 NoColumns = parseInt($xml.find('NoColumns').text()); 246 ImagesOrder = $xml.find('ImagesOrder').text() || 'normal'; 247 ResponsiveEnabled = $xml.find('ResponsiveEnabled').text() || 'true'; 248 249 ThumbnailsSpacing = parseInt($xml.find('ThumbnailsSpacing').text()); 250 ThumbnailsPaddingTop = parseInt($xml.find('ThumbnailsPaddingTop').text()); 251 ThumbnailsPaddingRight = parseInt($xml.find('ThumbnailsPaddingRight').text()); 252 ThumbnailsPaddingBottom = parseInt($xml.find('ThumbnailsPaddingBottom').text()); 253 ThumbnailsPaddingLeft = parseInt($xml.find('ThumbnailsPaddingLeft').text()); 254 ThumbnailsNavigation = $xml.find('ThumbnailsNavigation').text() || 'mouse'; 255 ThumbnailsScrollScrubColor = $xml.find('ThumbnailsScrollScrubColor').text() || '777777'; 256 ThumbnailsScrollBarColor = $xml.find('ThumbnailsScrollBarColor').text() || 'e0e0e0'; 257 ThumbnailsInfo = $xml.find('ThumbnailsInfo').text() || 'none'; 258 259 ThumbnailLoader = $xml.find('ThumbnailLoader').text() || 'DOPWallGridGallery/assets/gui/images/ThumbnailLoader.gif'; 260 ThumbnailWidth = parseInt($xml.find('ThumbnailWidth').text()); 261 ThumbnailHeight = parseInt($xml.find('ThumbnailHeight').text()); 262 ThumbnailWidthDesktop = parseInt($xml.find('ThumbnailWidth').text()); 263 ThumbnailHeightDesktop = parseInt($xml.find('ThumbnailHeight').text()); 264 ThumbnailWidthMobile = parseInt($xml.find('ThumbnailWidthMobile').text()); 265 ThumbnailHeightMobile = parseInt($xml.find('ThumbnailHeightMobile').text()); 266 ThumbnailAlpha = parseInt($xml.find('ThumbnailAlpha').text()); 267 ThumbnailAlphaHover = parseInt($xml.find('ThumbnailAlphaHover').text()); 268 ThumbnailBgColor = $xml.find('ThumbnailBgColor').text() || 'cccccc'; 269 ThumbnailBgColorHover = $xml.find('ThumbnailBgColorHover').text() || '000000'; 270 ThumbnailBorderSize = parseInt($xml.find('ThumbnailBorderSize').text()); 271 ThumbnailBorderColor = $xml.find('ThumbnailBorderColor').text() || 'cccccc'; 272 ThumbnailBorderColorHover = $xml.find('ThumbnailBorderColorHover').text() || '000000'; 273 ThumbnailPaddingTop = parseInt($xml.find('ThumbnailPaddingTop').text()); 274 ThumbnailPaddingRight = parseInt($xml.find('ThumbnailPaddingRight').text()); 275 ThumbnailPaddingBottom = parseInt($xml.find('ThumbnailPaddingBottom').text()); 276 ThumbnailPaddingLeft = parseInt($xml.find('ThumbnailPaddingLeft').text()); 277 278 LightboxPosition = $xml.find('LightboxPosition').text() || 'document'; 279 LightboxWindowColor = $xml.find('LightboxWindowColor').text() || '000000'; 280 LightboxWindowAlpha = parseInt($xml.find('LightboxWindowAlpha').text()); 281 LightboxLoader = $xml.find('LightboxLoader').text() || 'DOPWallGridGallery/assets/gui/images/LightboxLoader.gif'; 282 LightboxBgColor = $xml.find('LightboxBgColor').text() || '000000'; 283 LightboxBgAlpha = parseInt($xml.find('LightboxBgAlpha').text()); 284 LightboxMarginTop = parseInt($xml.find('LightboxMarginTop').text()); 285 LightboxMarginRight = parseInt($xml.find('LightboxMarginRight').text()); 286 LightboxMarginBottom = parseInt($xml.find('LightboxMarginBottom').text()); 287 LightboxMarginLeft = parseInt($xml.find('LightboxMarginLeft').text()); 288 LightboxPaddingTop = parseInt($xml.find('LightboxPaddingTop').text()); 289 LightboxPaddingRight = parseInt($xml.find('LightboxPaddingRight').text()); 290 LightboxPaddingBottom = parseInt($xml.find('LightboxPaddingBottom').text()); 291 LightboxPaddingLeft = parseInt($xml.find('LightboxPaddingLeft').text()); 292 293 LightboxNavigationPrev = $xml.find('LightboxNavigationPrev').text() || 'DOPWallGridGallery/assets/gui/images/LightboxPrev.png'; 294 LightboxNavigationPrevHover = $xml.find('LightboxNavigationPrevHover').text() || 'DOPWallGridGallery/assets/gui/images/LightboxPrevHover.png'; 295 LightboxNavigationNext = $xml.find('LightboxNavigationNext').text() || 'DOPWallGridGallery/assets/gui/images/LightboxNext.png'; 296 LightboxNavigationNextHover = $xml.find('LightboxNavigationNextHover').text() || 'DOPWallGridGallery/assets/gui/images/LightboxNextHover.png'; 297 LightboxNavigationClose = $xml.find('LightboxNavigationClose').text() || 'DOPWallGridGallery/assets/gui/images/LightboxClose.png'; 298 LightboxNavigationCloseHover = $xml.find('LightboxNavigationCloseHover').text() || 'DOPWallGridGallery/assets/gui/images/LightboxCloseHover.png'; 299 300 CaptionHeight = parseInt($xml.find('CaptionHeight').text()); 301 CaptionTitleColor = $xml.find('CaptionTitleColor').text() || 'eeeeee'; 302 CaptionTextColor = $xml.find('CaptionTextColor').text() || 'dddd
302dd'; 303 CaptionScrollScrubColor = $xml.find('CaptionScrollScrubColor').text() || '777777'; 304 CaptionScrollBgColor = $xml.find('CaptionScrollBgColor').text() || 'e0e0e0'; 305 306 SocialShareEnabled = $xml.find('SocialShareEnabled').text() || 'true'; 307 SocialShareLightbox = $xml.find('SocialShareLightbox').text() || 'DOPWallGridGallery/assets/gui/images/SocialShareLightbox.png'; 308 309 TooltipBgColor = $xml.find('TooltipBgColor').text() || 'ffffff'; 310 TooltipStrokeColor = $xml.find('TooltipStrokeColor').text() || '000000'; 311 TooltipTextColor = $xml.find('TooltipTextColor').text() || '000000'; 312 313 LabelPosition = $xml.find('LabelPosition').text() || 'bottom'; 314 LabelTextColor = $xml.find('LabelTextColor').text() || '000000'; 315 LabelTextColorHover = $xml.find('LabelTextColorHover').text() || 'ffffff'; 316 317 if (Data['ContentDataType'] == 'XML'){ 318 methods.parseXMLContent(); 319 } 320 else if (Data['ContentDataType'] == 'JSON'){ 321 methods.parseJSONContent(); 322 } 323 else{ 324 methods.parseHTMLContent(); 325 } 326 }}); 327 }, 328 parseHTMLSettings:function(){// Parse Settings. 329 Width = parseInt($('.Settings li.Width', Container).html()); 330 Height = parseInt($('.Settings li.Height', Container).html()); 331 BgColor = $('.Settings li.BgColor', Container).html() || 'ffffff'; 332 BgAlpha = parseInt($('.Settings li.BgAlpha', Container).html()); 333 NoLines = parseInt($('.Settings li.NoLines', Container).html()); 334 NoColumns = parseInt($('.Settings li.NoColumns', Container).html()); 335 ImagesOrder = $('.Settings li.ImagesOrder', Container).html() || 'normal'; 336 ResponsiveEnabled = $('.Settings li.ResponsiveEnabled', Container).html() || 'true'; 337 338 ThumbnailsSpacing = parseInt($('.Settings li.ThumbnailsSpacing', Container).html()); 339 ThumbnailsPaddingTop = parseInt($('.Settings li.ThumbnailsPaddingTop', Container).html()); 340 ThumbnailsPaddingRight = parseInt($('.Settings li.ThumbnailsPaddingRight', Container).html()); 341 ThumbnailsPaddingBottom = parseInt($('.Settings li.ThumbnailsPaddingBottom', Container).html()); 342 ThumbnailsPaddingLeft = parseInt($('.Settings li.ThumbnailsPaddingLeft', Container).html()); 343 ThumbnailsNavigation = $('.Settings li.ThumbnailsNavigation', Container).html() || 'mouse'; 344 ThumbnailsScrollScrubColor = $('.Settings li.ThumbnailsScrollScrubColor', Container).html() || '777777'; 345 ThumbnailsScrollBarColor = $('.Settings li.ThumbnailsScrollBarColor', Container).html() || 'e0e0e0'; 346 ThumbnailsInfo = $('.Settings li.ThumbnailsInfo', Container).html() || 'none'; 347 348 ThumbnailLoader = $('.Settings li.ThumbnailLoader', Container).html() || 'DOPWallGridGallery/assets/gui/images/ThumbnailLoader.gif'; 349 ThumbnailWidth = parseInt($('.Settings li.ThumbnailWidth', Container).html()); 350 ThumbnailHeight = parseInt($('.Settings li.ThumbnailHeight', Container).html()); 351 ThumbnailWidthDesktop = parseInt($('.Settings li.ThumbnailWidth', Container).html()); 352 ThumbnailHeightDesktop = parseInt($('.Settings li.ThumbnailHeight', Container).html()); 353 ThumbnailWidthMobile = parseInt($('.Settings li.ThumbnailWidthMobile', Container).html()); 354 ThumbnailHeightMobile = parseInt($('.Settings li.ThumbnailHeightMobile', Container).html()); 355 ThumbnailAlpha = parseInt($('.Settings li.ThumbnailAlpha', Container).html()); 356 ThumbnailAlphaHover = parseInt($('.Settings li.ThumbnailAlphaHover', Container).html()); 357 ThumbnailBgColor = $('.Settings li.ThumbnailBgColor', Container).html() || 'cccccc'; 358 ThumbnailBgColorHover = $('.Settings li.ThumbnailBgColorHover', Container).html() || '000000'; 359 ThumbnailBorderSize = parseInt($('.Settings li.ThumbnailBorderSize', Container).html()); 360 ThumbnailBorderColor = $('.Settings li.ThumbnailBorderColor', Container).html() || 'cccccc'; 361 ThumbnailBorderColorHover = $('.Settings li.ThumbnailBorderColorHover', Container).html() || '000000'; 362 ThumbnailPaddingTop = parseInt($('.Settings li.ThumbnailPaddingTop', Container).html()); 363 ThumbnailPaddingRight = parseInt($('.Settings li.ThumbnailPaddingRight', Container).html()); 364 ThumbnailPaddingBottom = parseInt($('.Settings li.ThumbnailPaddingBottom', Container).html()); 365 ThumbnailPaddingLeft = parseInt($('.Settings li.ThumbnailPaddingLeft', Container).html()); 366 367 LightboxPosition = $('.Settings li.LightboxPosition', Container).html() || 'document'; 368 LightboxWindowColor = $('.Settings li.LightboxWindowColor', Container).html() || '000000'; 369 LightboxWindowAlpha = parseInt($('.Settings li.LightboxWindowAlpha', Container).html()); 370 LightboxLoader = $('.Settings li.LightboxLoader', Container).html() || 'DOPWallGridGallery/assets/gui/images/LightboxLoader.gif'; 371 LightboxBgColor = $('.Settings li.LightboxBgColor', Container).html() || '000000'; 372 LightboxBgAlpha = parseInt($('.Settings li.LightboxBgAlpha', Container).html()); 373 LightboxMarginTop = parseInt($('.Settings li.LightboxMarginTop', Container).html()); 374 LightboxMarginRight = parseInt($('.Settings li.LightboxMarginRight', Container).html()); 375 LightboxMarginBottom = parseInt($('.Settings li.LightboxMarginBottom', Container).html()); 376 LightboxMarginLeft = parseInt($('.Settings li.LightboxMarginLeft', Container).html()); 377 LightboxPaddingTop = parseInt($('.Settings li.LightboxPaddingTop', Container).html()); 378 LightboxPaddingRight = parseInt($('.Settings li.LightboxPaddingRight', Container).html()); 379 LightboxPaddingBottom = parseInt($('.Settings li.LightboxPaddingBottom', Container).html()); 380 LightboxPaddingLeft = parseInt($('.Settings li.LightboxPaddingLeft', Container).html()); 381 382 LightboxNavigationPrev = $('.Settings li.LightboxNavigationPrev', Container).html() || 'DOPWallGridGallery/assets/gui/images/LightboxPrev.png'; 383 LightboxNavigationPrevHover = $('.Settings li.LightboxNavigationPrevHover', Container).html() || 'DOPWallGridGallery/assets/gui/images/LightboxPrevHover.png'; 384 LightboxNavigationNext = $('.Settings li.LightboxNavigationNext', Container).html() || 'DOPWallGridGallery/assets/gui/images/LightboxNext.png'; 385 LightboxNavigationNextHover = $('.Settings li.LightboxNavigationNextHover', Container).html() || 'DOPWallGridGallery/assets/gui/images/LightboxNextHover.png'; 386 LightboxNavigationClose = $('.Settings li.LightboxNavigationClose', Container).html() || 'DOPWallGridGallery/assets/gui/images/LightboxClose.png'; 387 LightboxNavigationCloseHover = $('.Settings li.LightboxNavigationCloseHover', Container).html() || 'DOPWallGridGallery/assets/gui/images/LightboxCloseHover.png'; 388 389 CaptionHeight = parseInt($('.Settings li.CaptionHeight', Container).html()); 390 CaptionTitleColor = $('.Settings li.CaptionTitleColor', Container).html() || 'eeeeee'; 391 CaptionTextColor = $('.Settings li.CaptionTextColor', Container).html() || 'dddd
391dd'; 392 CaptionScrollScrubColor = $('.Settings li.CaptionScrollScrubColor', Container).html() || '777777'; 393 CaptionScrollBgColor = $('.Settings li.CaptionScrollBgColor', Container).html() || 'e0e0e0'; 394 395 SocialShareEnabled = $('.Settings li.SocialShareEnabled', Container).html() || 'true'; 396 SocialShareLightbox = $('.Settings li.SocialShareLightbox', Container).html() || 'DOPWallGridGallery/assets/gui/images/SocialShareLightbox.png'; 397 398 TooltipBgColor = $('.Settings li.TooltipBgColor', Container).html() || 'ffffff'; 399 TooltipStrokeColor = $('.Settings li.TooltipStrokeColor', Container).html() || '000000'; 400 TooltipTextColor = $('.Settings li.TooltipTextColor', Container).html() || '000000'; 401 402 LabelPosition = $('.Settings li.LabelPosition', Container).html() || 'bottom'; 403 LabelTextColor = $('.Settings li.LabelTextColor', Container).html() || '000000'; 404 LabelTextColorHover = $('.Settings li.LabelTextColorHover', Container).html() || 'ffffff'; 405 406 if (Data['ContentDataType'] == 'XML'){ 407 methods.parseXMLContent(); 408 } 409 else if (Data['ContentDataType'] == 'JSON'){ 410 methods.parseJSONContent(); 411 } 412 else{ 413 methods.parseHTMLContent(); 414 } 415 }, 416 parseJSONContent:function(){// Parse Content. 417 $.getJSON(prototypes.acaoBuster(Data['ContentFilePath']), {}, function(data){ 418 $.each(data, function(index){ 419 $.each(data[index], function(key){ 420 switch (key){ 421 case 'Image': 422 Images.push(prototypes.acaoBuster(data[index][key])); break; 423 case 'Thumb': 424 Thumbs.push(prototypes.acaoBuster(data[index][key])); break; 425 case 'CaptionTitle': 426 CaptionTitle.push(data[index][key]);break; 427 case 'CaptionText': 428 CaptionText.push(data[index][key]);break; 429 case 'Media': 430 Media.push(data[index][key]);break; 431 case 'Link': 432 Links.push(data[index][key]);break; 433 case 'LinkTarget': 434 LinksTarget.push(data[index][key]);break; 435 } 436 }); 437 }); 438 439 noItems = Images.length; 440 441 if (ImagesOrder == 'random'){ 442 methods.randomizeItems(); 443 } 444 445 initialWidth = Width; 446 447 if (ResponsiveEnabled == 'true'){ 448 methods.rpResponsive(); 449 } 450 451 methods.initGallery(); 452 }); 453 }, 454 parseXMLContent:function(){// Parse the Content XML. 455 $.ajax({type:"GET", url:prototypes.acaoBuster(Data['ContentFilePath']), dataType:"xml", success:function(xml){ 456 $(xml).find('Image').each(function(){ 457 Images.push(prototypes.acaoBuster($(this).text())); 458 }); 459 $(xml).find('Thumb').each(function(){ 460 Thumbs.push(prototypes.acaoBuster($(this).text())); 461 }); 462 $(xml).find('CaptionTitle').each(function(){ 463 CaptionTitle.push($(this).text()); 464 }); 465 $(xml).find('CaptionText').each(function(){ 466 CaptionText.push($(this).text()); 467 }); 468 $(xml).find('Media').each(function(){ 469 Media.push($(this).text()); 470 }); 471 $(xml).find('Link').each(function(){ 472 Links.push($(this).text()); 473 }); 474 $(xml).find('LinkTarget').each(function(){ 475 LinksTarget.push($(this).text()); 476 }); 477 478 noItems = Images.length; 479 480 if (ImagesOrder == 'random'){ 481 methods.randomizeItems();
482 } 483 484 initialWidth = Width; 485 486 if (ResponsiveEnabled == 'true'){ 487 methods.rpResponsive(); 488 } 489 490 methods.initGallery(); 491 }}); 492 }, 493 parseHTMLContent:function(){// Parse Content. 494 $('.Content li', Container).each(function(){ 495 Images.push(prototypes.acaoBuster($('.Image', this).attr('src'))); 496 Thumbs.push(prototypes.acaoBuster($('.Thumb', this).attr('src'))); 497 CaptionTitle.push($('.CaptionTitle', this).html()); 498 CaptionText.push($('.CaptionText', this).html()); 499 Media.push($('.Media', this).html()); 500 Links.push($('.Link', this).html()); 501 LinksTarget.push($('.Target', this).html()); 502 }); 503 504 noItems = Images.length; 505 506 if (ImagesOrder == 'random'){ 507 methods.randomizeItems(); 508 } 509 510 initialWidth = Width; 511 512 if (ResponsiveEnabled == 'true'){ 513 methods.rpResponsive(); 514 } 515 516 methods.initGallery(); 517 }, 518 519 randomizeItems:function(){ 520 var indexes = new Array(), i, 521 auxImages = new Array(), 522 auxThumbs = new Array(), 523 auxCaptionTitle = new Array(), 524 auxCaptionText = new Array(), 525 auxMedia = new Array(), 526 auxLinks = new Array(), 527 auxLinksTarget = new Array(); 528 529 for (i=0; i<noItems; i++){ 530 indexes[i] = i; 531 auxImages[i] = Images[i]; 532 auxThumbs[i] = Thumbs[i]; 533 auxCaptionTitle[i] = CaptionTitle[i]; 534 auxCaptionText[i] = CaptionText[i]; 535 auxMedia[i] = Media[i]; 536 auxLinks[i] = Links[i]; 537 auxLinksTarget[i] = LinksTarget[i]; 538 } 539 540 indexes = prototypes.randomize(indexes); 541 542 for (i=0; i<noItems; i++){ 543 Images[i] = auxImages[indexes[i]]; 544 Thumbs[i] = auxThumbs[indexes[i]]; 545 CaptionTitle[i] = auxCaptionTitle[indexes[i]]; 546 CaptionText[i] = auxCaptionText[indexes[i]]; 547 Media[i] = auxMedia[indexes[i]]; 548 Links[i] = auxLinks[indexes[i]]; 549 LinksTarget[i] = auxLinksTarget[indexes[i]]; 550 } 551 }, 552 initGallery:function(){// Init the Gallery 553 var LightboxHTML = new Array(), 554 HTML = new Array(); 555 556 LightboxHTML.push(' <div class="DOP_WallGridGallery_LightboxWrapper" id="DOP_WallGridGallery_LightboxWrapper_'+ID+'">'); 557 LightboxHTML.push(' <div class="DOP_WallGridGallery_LightboxWindow"></div>'); 558 LightboxHTML.push(' <div class="DOP_WallGridGallery_LightboxLoader"><img src="'+LightboxLoader+'" alt="" /></div>'); 559 LightboxHTML.push(' <div class="DOP_WallGridGallery_LightboxContainer">'); 560 LightboxHTML.push(' <div class="DOP_WallGridGallery_LightboxBg"></div>'); 561 LightboxHTML.push(' <div class="DOP_WallGridGallery_Lightbox"></div>'); 562 LightboxHTML.push(' <div class="DOP_WallGridGallery_LightboxNavigation">'); 563 LightboxHTML.push(' <div class="DOP_WallGridGallery_LightboxNavigationExtraButtons">'); 564 LightboxHTML.push(' <div class="DOP_WallGridGallery_LightboxNavigation_CloseBtn">'); 565 LightboxHTML.push(' <img src="'+LightboxNavigationClose+'" class="normal" alt="" />'); 566 LightboxHTML.push(' <img src="'+LightboxNavigationCloseHover+'"
566class="hover" alt="" />'); 567 LightboxHTML.push(' </div>'); 568 if (SocialShareEnabled == 'true'){ 569 LightboxHTML.push(' <div class="DOP_WallGridGallery_LightboxSocialShare"></div>'); 570 } 571 LightboxHTML.push(' <br class="DOP_WallGridGallery_Clear" />'); 572 LightboxHTML.push(' </div>'); 573 LightboxHTML.push(' <div class="DOP_WallGridGallery_LightboxNavigationButtons">'); 574 LightboxHTML.push(' <div class="DOP_WallGridGallery_LightboxNavigation_PrevBtn">'); 575 LightboxHTML.push(' <img src="'+LightboxNavigationPrev+'" class="normal" alt="" />'); 576 LightboxHTML.push(' <img src="'+LightboxNavigationPrevHover+'" class="hover" alt="" />'); 577 LightboxHTML.push(' </div>'); 578 LightboxHTML.push(' <div class="DOP_WallGridGallery_LightboxNavigation_NextBtn">'); 579 LightboxHTML.push(' <img src="'+LightboxNavigationNext+'" class="normal" alt="" />'); 580 LightboxHTML.push(' <img src="'+LightboxNavigationNextHover+'" class="hover" alt="" />'); 581 LightboxHTML.push(' </div>'); 582 LightboxHTML.push(' <br class="DOP_WallGridGallery_Clear" />'); 583 LightboxHTML.push(' </div>'); 584 LightboxHTML.push(' </div>'); 585 LightboxHTML.push(' <div class="DOP_WallGridGallery_Caption">'); 586 LightboxHTML.push(' <div class="DOP_WallGridGallery_CaptionTextWrapper">'); 587 LightboxHTML.push(' <div class="DOP_WallGridGallery_CaptionTitle">'); 588 LightboxHTML.push(' <div class="title"></div>'); 589 LightboxHTML.push(' <div class="count"><span id="DOP_WallGridGallery_ItemCount_'+ID+'"></span> / '+noItems+'</div>'); 590 LightboxHTML.push(' <br style="clear:both;" />'); 591 LightboxHTML.push(' </div>'); 592 LightboxHTML.push(' <div class="DOP_WallGridGallery_CaptionTextContainer">'); 593 LightboxHTML.push(' <div class="DOP_WallGridGallery_CaptionText"></div>'); 594 LightboxHTML.push(' </div>'); 595 LightboxHTML.push(' </div>'); 596 LightboxHTML.push(' </div>'); 597 LightboxHTML.push(' </div>'); 598 LightboxHTML.push(' </div>'); 599 600 HTML.push('<div class="DOP_WallGridGallery_Container">'); 601 HTML.push(' <div class="DOP_WallGridGallery_Background"></div>'); 602 HTML.push(' <div class="DOP_WallGridGallery_ThumbnailsWrapper">'); 603 HTML.push(' <div class="DOP_WallGridGallery_Thumbnails"></div>'); 604 HTML.push(' </div>'); 605 606 if (ThumbnailsInfo == 'tooltip' && !prototypes.isTouchDevice()){ 607 HTML.push('<div class="DOP_WallGridGallery_Tooltip"></div>'); 608 } 609 610 if (LightboxPosition != 'document'){ 611 HTML.push(LightboxHTML.join('')); 612 } 613 HTML.push('</div>'); 614 615 Container.html(HTML.join(''));
616 617 if (LightboxPosition == 'document'){ 618 $('body').append(LightboxHTML.join('')); 619 } 620 methods.initSettings(); 621 }, 622 initSettings:function(){// Init Settings 623 methods.initContainer(); 624 methods.initBackground(); 625 methods.initThumbnails(); 626 627 if (ThumbnailsInfo == 'tooltip' && !prototypes.isTouchDevice()){ 628 methods.initTooltip(); 629 } 630 methods.initLightbox(); 631 methods.initCaption(); 632 633 if (SocialShareEnabled == 'true'){ 634 methods.initSocialShare(); 635 } 636 }, 637 initRP:function(){// Init Resize & Positioning 638 if (ResponsiveEnabled == 'true'){ 639 methods.rpResponsive(); 640 methods.rpContainer(); 641 methods.rpBackground(); 642 methods.rpThumbnails(); 643 644 if (itemLoaded){ 645 if (Media[currentItem-1] == ''){ 646 methods.rpLightboxImage(); 647 } 648 else{ 649 methods.rpLightboxMedia(); 650 } 651 } 652 } 653 }, 654 initRPScroll:function(){// Init Resize & Positioning 655 if (ResponsiveEnabled == 'true'){ 656 methods.rpResponsive(); 657 methods.rpContainer(); 658 methods.rpBackground(); 659 660 if (itemLoaded){ 661 if (Media[currentItem-1] == ''){ 662 methods.rpLightboxImage(); 663 } 664 else{ 665 methods.rpLightboxMedia(); 666 } 667 } 668 } 669 }, 670 rpResponsive:function(){ 671 var hiddenBustedItems = prototypes.doHideBuster($(Container)); 672 673 if ($(Container).width() < initialWidth){ 674 Width = $(Container).width(); 675 } 676 else{ 677 Width = initialWidth; 678 } 679 680 if ($(window).width() <= 640){ 681 ThumbnailWidth = ThumbnailWidthMobile; 682 ThumbnailHeight = ThumbnailHeightMobile; 683 } 684 else{ 685 ThumbnailWidth = ThumbnailWidthDesktop; 686 ThumbnailHeight = ThumbnailHeightDesktop; 687 } 688 689 prototypes.undoHideBuster(hiddenBustedItems); 690 }, 691 692 initContainer:function(){// Init Container 693 $('.DOP_WallGridGallery_Container', Container).css('display', 'block'); 694 695 if (Height == 0){ 696 $('.DOP_WallGridGallery_Container', Container).css('overflow', 'visible'); 697 } 698 methods.rpContainer(); 699 }, 700 rpContainer:function(){// Resize & Position Container 701 $('.DOP_WallGridGallery_Container', Container).width(Width); 702 703 if (Height != 0){ 704 $('.DOP_WallGridGallery_Container', Container).height(Height); 705 } 706 else{ 707 $('.DOP_WallGridGallery_Container', Container).css('height', 'auto'); 708 $('.DOP_WallGridGallery_ThumbnailsWrapper', Container).css('height', 'auto'); 709 } 710 }, 711
712 initBackground:function(){// Init Background 713 $('.DOP_WallGridGallery_Background', Container).css('background-color', '#'+BgColor); 714 $('.DOP_WallGridGallery_Background', Container).css('opacity', parseInt(BgAlpha)/100); 715 716 methods.rpBackground(); 717 }, 718 rpBackground:function(){// Resize & Position Background 719 $('.DOP_WallGridGallery_Background', Container).width(Width); 720 721 if (Height != 0){ 722 $('.DOP_WallGridGallery_Background', Container).height(Height); 723 } 724 else{ 725 $('.DOP_WallGridGallery_Background', Container).height($('.DOP_WallGridGallery_ThumbnailsWrapper', Container).height()); 726 } 727 }, 728 729 initThumbnails:function(){//Init Thumbnails 730 if (Height == 0){ 731 $('.DOP_WallGridGallery_ThumbnailsWrapper', Container).css({'overflow': 'visible', 732 'position': 'relative'}); 733 } 734 735 for (var i=1; i<=noItems; i++){ 736 methods.loadThumb(i); 737 } 738 739 if (Height != 0){ 740 if (prototypes.isTouchDevice()){ 741 prototypes.touchNavigation($('.DOP_WallGridGallery_ThumbnailsWrapper', Container), $('.DOP_WallGridGallery_Thumbnails', Container)); 742 } 743 else if (ThumbnailsNavigation == 'mouse'){ 744 $('.DOP_WallGridGallery_Thumbnails', Container).css('position', 'absolute'); 745 methods.moveThumbnails(); 746 } 747 else if (ThumbnailsNavigation == 'scroll'){ 748 methods.initThumbnailsScroll(); 749 } 750 } 751 752 methods.rpThumbnails(); 753 }, 754 loadThumb:function(no){// Load a thumbnail 755 methods.initThumb(no); 756 var img = new Image(); 757 758 $(img).load(function(){ 759 $('.DOP_WallGridGallery_Thumb', '#DOP_WallGridGallery_ThumbContainer_'+ID+'_'+no, Container).html(this); 760 $('.DOP_WallGridGallery_Thumb img', '#DOP_WallGridGallery_ThumbContainer_'+ID+'_'+no, Container).attr('alt', CaptionTitle[no-1]); 761 762 var hiddenBustedItems = prototypes.doHideBuster($(Container)); 763 ThumbsWidth[no-1] = $(this).width(); 764 ThumbsHeight[no-1] = $(this).height(); 765 prototypes.undoHideBuster(hiddenBustedItems); 766 767 methods.loadCompleteThumb(no); 768 }).attr('src', Thumbs[no-1]); 769 }, 770 initThumb:function(no){// Init thumbnail before loading 771 var ThumbHTML = new Array(), 772 labelHeight = ThumbnailsInfo == 'label' ? $('.DOP_WallGridGallery_ThumbLabel', Container).height()+parseFloat($('.DOP_WallGridGallery_ThumbLabel', Container).css('padding-top'))+parseFloat($('.DOP_WallGridGallery_ThumbLabel', Container).css('padding-bottom')):0; 773 774 ThumbHTML.push('<div class="DOP_WallGridGallery_ThumbContainer" id="DOP_WallGridGallery_ThumbContainer_'+ID+'_'+no+'">'); 775 776 if (LabelPosition == 'top' && ThumbnailsInfo == 'label'){ 777 if (CaptionTitle[no-1] != ''){ 778 ThumbHTML.push(' <div class="DOP_WallGridGallery_ThumbLabel">'+CaptionTitle[no-1]+'</div>'); 779 } 780 else{ 781 ThumbHTML.push(' <div class="DOP_WallGridGallery_ThumbLabel"> </div>'); 782 } 783 } 784 785 ThumbHTML.push(' <div class="DOP_WallGridGallery_Thumb"></div>'); 786 787 if (LabelPosition == 'bottom' && ThumbnailsInfo == 'label'){ 788 if (CaptionTitle[no-1] != ''){ 789 ThumbHTML.push(' <div class="DOP_WallGridGallery_ThumbLabel">'+CaptionTitle[no-1]+'</div>'); 790 } 791 else{ 792 ThumbHTML.push(' <div class="DOP_WallGridGallery_ThumbLabel"> </div>'); 793 } 794 } 795 796 if (no == noItems){ 797 ThumbHTML.push('</div><br style="clear:both;" />'); 798 } 799 else{ 800 ThumbHTML.push('</div>'); 801 } 802 803 $('.DOP_WallGridGallery_Thumbnails', Container).append(ThumbHTML.join("")); 804 805 if (!prototypes.isTouchDevice()){ 806 $('#DOP_WallGridGallery_ThumbContainer_'+ID+'_'+no).css('opacity', parseInt(ThumbnailAlpha)/100); 807 } 808 809 ThumbsLoaded[no-1] = false; 810 811 if (LabelPosition == 'top' && ThumbnailsInfo == 'label'){ 812 $('.DOP_WallGridGallery_Thumb', Container).css('margin-top', Thumbn
812ailPaddingTop+labelHeight); 813 } 814 else{ 815 $('.DOP_WallGridGallery_Thumb', '#DOP_WallGridGallery_ThumbContainer_'+ID+'_'+no).css('margin-top', ThumbnailPaddingTop); 816 } 817 $('.DOP_WallGridGallery_Thumb', '#DOP_WallGridGallery_ThumbContainer_'+ID+'_'+no).css('margin-left', ThumbnailPaddingLeft); 818 $('.DOP_WallGridGallery_Thumb', '#DOP_WallGridGallery_ThumbContainer_'+ID+'_'+no).css('margin-bottom', ThumbnailPaddingBottom); 819 $('.DOP_WallGridGallery_Thumb', '#DOP_WallGridGallery_ThumbContainer_'+ID+'_'+no).css('margin-right', ThumbnailPaddingRight); 820 821 $('#DOP_WallGridGallery_ThumbContainer_'+ID+'_'+no).css('background-color', '#'+ThumbnailBgColor); 822 $('#DOP_WallGridGallery_ThumbContainer_'+ID+'_'+no).css('border-width', ThumbnailBorderSize); 823 $('#DOP_WallGridGallery_ThumbContainer_'+ID+'_'+no).css('border-color', '#'+ThumbnailBorderColor); 824 825 $('#DOP_WallGridGallery_ThumbContainer_'+ID+'_'+no).addClass('DOP_WallGridGallery_ThumbLoader'); 826 $('#DOP_WallGridGallery_ThumbContainer_'+ID+'_'+no+'.DOP_WallGridGallery_ThumbLoader').css('background-image', 'url('+ThumbnailLoader+')'); 827 828 if (ThumbnailsInfo == 'label'){ 829 $('.DOP_WallGridGallery_ThumbLabel', Container).css('color', '#'+LabelTextColor); 830 } 831 832 methods.rpThumbnails(); 833 }, 834 loadCompleteThumb:function(no){// Resize, Position & Edit a thumbnmail after loading 835 $('#DOP_WallGridGallery_ThumbContainer_'+ID+'_'+no+'.DOP_WallGridGallery_ThumbLoader').css('background-image', 'none'); 836 $('#DOP_WallGridGallery_ThumbContainer_'+ID+'_'+no).removeClass('DOP_WallGridGallery_ThumbLoader'); 837 ThumbsLoaded[no-1] = true; 838 839 methods.rpThumbnails(); 840 841 $('.DOP_WallGridGallery_Thumb', '#DOP_WallGridGallery_ThumbContainer_'+ID+'_'+no).css('opacity', 0); 842 $('.DOP_WallGridGallery_Thumb', '#DOP_WallGridGallery_ThumbContainer_'+ID+'_'+no).stop(true, true).animate({'opacity':'1'}, 600); 843 844 if (!prototypes.isTouchDevice()){ 845 $('#DOP_WallGridGallery_ThumbContainer_'+ID+'_'+no).hover(function(){ 846 $(this).stop(true, true).animate({'opacity': ThumbnailAlphaHover/100}, 600); 847 $(this).css('background-color', '#'+ThumbnailBgColorHover); 848 $(this).css('border-color', '#'+ThumbnailBorderColorHover); 849 850 if (ThumbnailsInfo == 'tooltip' && !prototypes.isTouchDevice()){ 851 methods.showTooltip(no-1); 852 } 853 854 if (ThumbnailsInfo == 'label'){ 855 $('.DOP_WallGridGallery_ThumbLabel', this).css('color', '#'+LabelTextColorHover); 856 } 857 }, 858 function(){ 859 $(this).stop(true, true).animate({'opacity':parseInt(ThumbnailAlpha)/100}, 600); 860 $(this).css('background-color', '#'+ThumbnailBgColor); 861 $(this).css('border-color', '#'+ThumbnailBorderColor); 862 863 if (ThumbnailsInfo == 'tooltip' && !prototypes.isTouchDevice()){ 864 $('.DOP_WallGridGallery_Tooltip', Container).css('display', 'none'); 865 } 866 867 if (ThumbnailsInfo == 'label'){ 868 $('.DOP_WallGridGallery_ThumbLabel', this).css('color', '#'+LabelTextColor); 869 } 870 }); 871 } 872 873 $('#DOP_WallGridGallery_ThumbContainer_'+ID+'_'+no, Container).click(function(){ 874 if (Links[no-1] != ''){ 875 prototypes.openLink(Links[no-1], LinksTarget[no-1]); 876 } 877 else{ 878 methods.showLightbox(no); 879 } 880 }); 881 }, 882 rpThumbnails:function(){// Resize & Position Thumbnails 883 var labelHeight = ThumbnailsInfo == 'label' ? $('.DOP_WallGridGallery_ThumbLabel', Container).height()+parseFloat($('.DOP_WallGridGallery_ThumbLabel', Container).css('padding-top'))+parseFloat($('.DOP_WallGridGallery_ThumbLabel', Container).css('padding-bottom')):0, 884 thumbnailWidth = ThumbnailWidth+ThumbnailPaddingRight+ThumbnailPaddingLeft+2*ThumbnailBorderSize, 885 no = 0, 886 hiddenBustedItems = prototypes.doHideBuster($(Container));
887 888 if (Height == 0){ 889 NoColumns = parseInt((Width-ThumbnailsPaddingRight-ThumbnailsPaddingLeft+ThumbnailsSpacing)/(thumbnailWidth+ThumbnailsSpacing)); 890 NoLines = parseInt(noItems/NoColumns); 891 892 if (NoColumns == 0){ 893 NoColumns = 1; 894 } 895 896 if (NoLines*NoColumns < noItems){ 897 NoLines++; 898 } 899 } 900 else{ 901 if (NoLines*NoColumns < noItems){ 902 if (noItems%NoColumns != 0){ 903 NoLines = parseInt(noItems/NoColumns)+1; 904 } 905 else{ 906 NoLines = noItems/NoColumns; 907 } 908 } 909 } 910 911 $('.DOP_WallGridGallery_ThumbContainer', Container).css({'height': ThumbnailHeight+ThumbnailPaddingTop+ThumbnailPaddingBottom+labelHeight, 912 'margin-top': 0, 913 'margin-right': 0, 914 'margin-bottom': 0, 915 'margin-left': 0, 916 'width': ThumbnailWidth+ThumbnailPaddingRight+ThumbnailPaddingLeft}); 917 $('.DOP_WallGridGallery_Thumb', Container).width(ThumbnailWidth); 918 $('.DOP_WallGridGallery_Thumb', Container).height(ThumbnailHeight); 919 920 $('.DOP_WallGridGallery_ThumbContainer', Container).each(function(){ 921 no++; 922 923 if (no > NoColumns){ 924 $(this).css('margin-top', ThumbnailsSpacing); 925 } 926 927 if (no%NoColumns != 1 && NoColumns != 1){ 928 $(this).css('margin-left', ThumbnailsSpacing); 929 } 930 931 if (no <= NoColumns){ 932 $(this).css('margin-top', ThumbnailsPaddingTop); 933 } 934 935 if (no%NoColumns == 0 && NoColumns != 1){ 936 $(this).css('margin-right', ThumbnailsPaddingRight); 937 } 938 939 if (no > NoColumns*(NoLines-1)){ 940 $(this).css('margin-bottom', ThumbnailsPaddingBottom); 941 } 942 943 if (no%NoColumns == 1 && NoColumns != 1){ 944 $(this).css('margin-left', ThumbnailsPaddingLeft); 945 } 946 947 if (ThumbsLoaded[no-1]){ 948 if ($('img', this).width() == 0){ 949 prototypes.resizeItem2($('.DOP_WallGridGallery_Thumb', this), $('img', this), ThumbnailWidth, ThumbnailHeight, $('.DOP_WallGridGallery_Thumb', this).width(), $('.DOP_WallGridGallery_Thumb', this).height(), 'center'); 950 } 951 else{ 952 prototypes.resizeItem2($('.DOP_WallGridGallery_Thumb', this), $('img', this), ThumbnailWidth, ThumbnailHeight, ThumbsWidth[no-1], ThumbsHeight[no-1], 'center'); 953 } 954 955 if (ThumbsFirstPosX[no-1] == undefined){ 956 ThumbsFirstPosX[no-1] = parseInt($('img', this).css('margin-left')); 957 } 958 else{ 959 if (Math.abs(ThumbsFirstPosX[no-1]-parseInt($('img', this).css('margin-left'))) < 5){ 960 $('img', this).css('margin-left', ThumbsFirstPosX[no-1]); 961 } 962 } 963 964 if (ThumbsFirstPosY[no-1] == undefined){ 965 ThumbsFirstPosY[no-1] = parseInt($('img', this).css('margin-top')); 966 } 967 else{ 968 if (Math.abs(ThumbsFirstPosY[no-1]-parseInt($('img', this).css('margin-top'))) < 5){ 969 $('img', this).css('margin-top', ThumbsFirstPosY[no-1]); 970 } 971 } 972 } 973 }); 974 975 $('.DOP_WallGridGallery_Thumbnails', Container).width(ThumbnailsPaddingRight+ThumbnailsPaddingLeft+thumbnailWidth*NoColumns+(NoColumns-1)*ThumbnailsSpacing); 976 977 if ($('.DOP_WallGridGallery_Thumbnails', Container).width() <= $('.DOP_WallGridGallery_Container', Container).width()){ 978 $('.DOP_WallGridGallery_ThumbnailsWrapper', Container).width($('.DOP_WallGridGallery_Thumbnails', Container).width()); 979 } 980 else{ 981 $('.DOP_WallGridGallery_ThumbnailsWrapper', Container).width($('.DOP_WallGridGallery_Container', Container).width()); 982 } 983 984 if ($('.DOP_WallGridGallery_Thumbnails', Container).height() <= $('.DOP_WallGridGallery_Container', Container).height()){ 985 $('.DOP_WallGridGallery_ThumbnailsWrapper', Container).height($('.DOP_WallGridGallery_Thumbnails', Container).height()); 986 } 987 else{ 988 $('.DOP_WallGridGallery_ThumbnailsWrapper', Container).height($('.DOP_WallGridGallery_Container', Container).height()); 989 } 990 991 prototypes.centerItem($('.DOP_WallGridGallery_Container', Container), $('.DOP_WallGridGallery_ThumbnailsWrapper', Container), $('.DOP_WallGridGallery_Container', Container).width(), $('.DOP_WallGridGallery_Container', Container).height()); 992 993 if (parseInt($('.DOP_WallGridGallery_Thumbnails', Container).css('margin-left')) < (-1)*($('.DOP_WallGridGallery_Thumbnails', Container).width()-$('.DOP_WallGridGallery_ThumbnailsWrapper', Container).width())){ 994 $('.DOP_WallGridGallery_Thumbnails', Container).css('margin-left', (-1)
994*($('.DOP_WallGridGallery_Thumbnails', Container).width()-$('.DOP_WallGridGallery_ThumbnailsWrapper', Container).width())); 995 } 996 if (parseInt($('.DOP_WallGridGallery_Thumbnails', Container).css('margin-left')) > 0){ 997 $('.DOP_WallGridGallery_Thumbnails', Container).css('margin-left', 0); 998 } 999 if (parseInt($('.DOP_WallGridGallery_Thumbnails', Container).css('margin-top')) < (-1)*($('.DOP_WallGridGallery_Thumbnails', Container).height()-$('.DOP_WallGridGallery_ThumbnailsWrapper', Container).height())){ 1000 $('.DOP_WallGridGallery_Thumbnails', Container).css('margin-top', (-1)*($('.DOP_WallGridGallery_Thumbnails', Container).height()-$('.DOP_WallGridGallery_ThumbnailsWrapper', Container).height())); 1001 } 1002 if (parseInt($('.DOP_WallGridGallery_Thumbnails', Container).css('margin-top')) > 0){ 1003 $('.DOP_WallGridGallery_Thumbnails', Container).css('margin-top', 0); 1004 } 1005 1006 $('.DOP_WallGridGallery_ThumbnailsWrapper .jspContainer', Container).width($('.DOP_WallGridGallery_ThumbnailsWrapper', Container).width()); 1007 $('.jspDrag', '.DOP_WallGridGallery_ThumbnailsWrapper', Container).css('background', '#'+ThumbnailsScrollScrubColor); 1008 $('.jspTrack', '.DOP_WallGridGallery_ThumbnailsWrapper', Container).css('background', '#'+ThumbnailsScrollBarColor); 1009 1010 methods.rpContainer(); 1011 methods.rpBackground(); 1012 1013 prototypes.undoHideBuster(hiddenBustedItems); 1014 }, 1015 moveThumbnails:function(){// Init thumbnails move 1016 $('.DOP_WallGridGallery_ThumbnailsWrapper', Container).mousemove(function(e){ 1017 var thumbnailWidth, thumbnailHeight, mousePosition, thumbnailsPosition; 1018 1019 if ($('.DOP_WallGridGallery_Thumbnails', Container).width() > $('.DOP_WallGridGallery_ThumbnailsWrapper', Container).width()){ 1020 thumbnailWidth = ThumbnailWidth+ThumbnailPaddingRight+ThumbnailPaddingLeft+2*ThumbnailBorderSize; 1021 mousePosition = e.clientX-$(this).offset().left+parseInt($(this).css('margin-left'))+$(document).scrollLeft(); 1022 thumbnailsPosition = 0-(mousePosition-thumbnailWidth)*($('.DOP_WallGridGallery_Thumbnails', Container).width()-$('.DOP_WallGridGallery_ThumbnailsWrapper', Container).width())/($('.DOP_WallGridGallery_ThumbnailsWrapper', Container).width()-2*thumbnailWidth); 1023 if (thumbnailsPosition < (-1)*($('.DOP_WallGridGallery_Thumbnails', Container).width()-$('.DOP_WallGridGallery_ThumbnailsWrapper', Container).width())){ 1024 thumbnailsPosition = (-1)*($('.DOP_WallGridGallery_Thumbnails', Container).width()-$('.DOP_WallGridGallery_ThumbnailsWrapper', Container).width()); 1025 } 1026 if (thumbnailsPosition > 0){ 1027 thumbnailsPosition = 0; 1028 } 1029 $('.DOP_WallGridGallery_Thumbnails', Container).css('margin-left', thumbnailsPosition); 1030 } 1031 1032 if ($('.DOP_WallGridGallery_Thumbnails', Container).height() > $('.DOP_WallGridGallery_ThumbnailsWrapper', Container).height()){ 1033 thumbnailHeight = ThumbnailHeight+ThumbnailPaddingTop+ThumbnailPaddingBottom+2*ThumbnailBorderSize; 1034 mousePosition = e.clientY-$(this).offset().top+parseInt($(this).css('margin-top'))+$(document).scrollTop(); 1035 thumbnailsPosition = 0-(mousePosition-thumbnailHeight)*($('.DOP_WallGridGallery_Thumbnails', Container).height()-$('.DOP_WallGridGallery_ThumbnailsWrapper', Container).height())/($('.DOP_WallGridGallery_ThumbnailsWrapper', Container).height()-2*thumbn
1035ailHeight); 1036 if (thumbnailsPosition < (-1)*($('.DOP_WallGridGallery_Thumbnails', Container).height()-$('.DOP_WallGridGallery_ThumbnailsWrapper', Container).height())){ 1037 thumbnailsPosition = (-1)*($('.DOP_WallGridGallery_Thumbnails', Container).height()-$('.DOP_WallGridGallery_ThumbnailsWrapper', Container).height()); 1038 } 1039 if (thumbnailsPosition > 0){ 1040 thumbnailsPosition = 0; 1041 } 1042 $('.DOP_WallGridGallery_Thumbnails', Container).css('margin-top', thumbnailsPosition); 1043 } 1044 }); 1045 }, 1046 initThumbnailsScroll:function(){//Init Thumbnails Scroll 1047 setTimeout(function(){ 1048 $('.DOP_WallGridGallery_ThumbnailsWrapper', Container).jScrollPane({autoReinitialise: true}); 1049 $('.jspDrag', '.DOP_WallGridGallery_ThumbnailsWrapper', Container).css('background', '#'+ThumbnailsScrollScrubColor); 1050 $('.jspTrack', '.DOP_WallGridGallery_ThumbnailsWrapper', Container).css('background', '#'+ThumbnailsScrollBarColor); 1051 }, 10); 1052 }, 1053 1054 initLightbox:function(){// Init Lightbox 1055 startGalleryID = prototypes.$_GET('dop_wall_grid_gallery_id') != undefined ? parseInt(prototypes.$_GET('dop_wall_grid_gallery_id')):0; 1056 startWith = prototypes.$_GET('dop_wall_grid_gallery_share') != undefined && startGalleryID == ID ? parseInt(prototypes.$_GET('dop_wall_grid_gallery_share')):0; 1057 1058 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxWindow').css({'background-color': '#'+LightboxWindowColor, 1059 'opacity': LightboxWindowAlpha/100}); 1060 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxBg').css({'background-color': '#'+LightboxBgColor, 1061 'opacity': LightboxBgAlpha/100}); 1062 1063 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').hover(function(){ 1064 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxNavigation').stop(true, true).animate({'opacity': 1}, LightboxNavigationDisplayTime); 1065 }, function(){ 1066 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxNavigation').stop(true, true).animate({'opacity': 0}, LightboxNavigationDisplayTime); 1067 }); 1068 1069 if (!prototypes.isTouchDevice()){ 1070 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxNavigation_PrevBtn').hover(function(){ 1071 $('.normal', this).css('display', 'none'); 1072 $('.hover', this).css('display', 'block'); 1073 }, function(){ 1074 $('.normal', this).css('display', 'block'); 1075 $('.hover', this).css('display', 'none'); 1076 }); 1077 1078 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxNavigation_NextBtn').hover(function(){ 1079 $('.normal', this).css('display', 'none'); 1080 $('.hover', this).css('display', 'block'); 1081 }, function(){ 1082 $('.normal', this).css('display', 'block'); 1083 $('.hover', this).css('display', 'none'); 1084 }); 1085 1086 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxNavigation_CloseBtn').hover(function(){ 1087 $('.normal', this).css('display', 'none'); 1088 $('.hover', this).css('display', 'block'); 1089 }, function(){ 1090 $('.normal', this).css('display', 'block'); 1091 $('.hover', this).css('display', 'none'); 1092 }); 1093 } 1094 else{ 1095 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxNavigation').css('opacity', 1); 1096 methods.lightboxNavigationSwipe(); 1097 } 1098 1099 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxNavigation_PrevBtn').click(function(){ 1100 methods.previousLightbox(); 1101 }); 1102 1103 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxNavigation_NextBtn').click(function(){ 1104 methods.nextLightbox(); 1105 }); 1106 1107 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxSocialShare').hover(function(){ 1108 setTimeout(function(){ 1109 $('#at15s').css('position', 'fixed'); 1110 1111 $('#at15s').hover(function(){ 1112 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxNavigation').stop(true, true).animate({'opacity': 1}, 0); 1113 }, function(){ 1114 }); 1115 }, 10); 1116 }, function(){}); 1117 1118 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxNavigation_CloseBtn').click(function(){ 1119 methods.hideLightbox(); 1120 }); 1121 1122 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxWindow').click(function(){ 1123 methods.hideLightbox(); 1124 }); 1125 1126 $(document).keydown(function(e){
1127 if (itemLoaded){ 1128 switch (e.keyCode){ 1129 case 27: 1130 methods.hideLightbox(); 1131 break; 1132 case 37: 1133 methods.previousLightbox(); 1134 break; 1135 case 39: 1136 methods.nextLightbox(); 1137 break; 1138 } 1139 } 1140 }); 1141 1142 if (startGalleryID == ID){ 1143 var href = window.location.href, 1144 variables = 'dop_wall_grid_gallery_id='+startGalleryID+'&dop_wall_grid_gallery_share='+startWith; 1145 1146 if (href.indexOf('?'+variables) != -1){ 1147 variables = '?'+variables; 1148 } 1149 else{ 1150 variables = '&'+variables; 1151 } 1152 1153 window.location = '#DOPWallGridGallery'+ID; 1154 1155 try{ 1156 window.history.pushState({'html':'', 'pageTitle':document.title}, '', href.split(variables)[0]); 1157 }catch(e){ 1158 //console.log(e); 1159 } 1160 } 1161 1162 if (startWith != 0){ 1163 methods.showLightbox(startWith); 1164 startWith = 0; 1165 } 1166 }, 1167 showLightbox:function(no){// Show Lightbox 1168 var documentW, documentH, windowW, windowH, maxWidth, maxHeight, currW, currH; 1169 1170 if (LightboxPosition == 'document'){ 1171 documentW = $(document).width(); 1172 documentH = $(document).height(); 1173 windowW = $(window).width(); 1174 windowH = $(window).height(); 1175 } 1176 else{ 1177 documentW = Width; 1178 documentH = Height; 1179 windowW = Width; 1180 windowH = Height; 1181 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').css('position', 'absolute'); 1182 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').css('position', 'absolute'); 1183 } 1184 1185 $('#DOP_WallGridGallery_LightboxWrapper_'+ID).width(documentW); 1186 $('#DOP_WallGridGallery_LightboxWrapper_'+ID).height(documentH); 1187 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxWindow').width(documentW); 1188 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxWindow').height(documentH); 1189 1190 $('#DOP_WallGridGallery_LightboxWrapper_'+ID).css('display', 'block'); 1191 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').css('display', 'block'); 1192 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').css({'margin-top': (windowH-$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').height())/2, 1193 'margin-left': (windowW-$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').width())/2}); 1194 1195 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').css('display', 'none'); 1196 $('#DOP_WallGridGallery_LightboxWrapper_'+ID).css('display', 'none'); 1197 1198 $('#DOP_WallGridGallery_LightboxWrapper_'+ID).fadeIn(LightboxDisplayTime, function(){ 1199 if (Media[no-1] != ''){ 1200 methods.loadLightboxMedia(no); 1201 } 1202 else{ 1203 methods.loadLightboxImage(no); 1204 } 1205 }); 1206 }, 1207 hideLightbox:function(){// Hide Lightbox 1208 if (itemLoaded){ 1209 $('#DOP_WallGridGallery_LightboxWrapper_'+ID).fadeOut(LightboxDisplayTime, function(){ 1210 currentItem = 0;
1211 itemLoaded = false; 1212 clearInterval(socialShareInterval); 1213 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').css('opacity', 0); 1214 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').html(''); 1215 }); 1216 } 1217 }, 1218 loadLightboxImage:function(no){// Load Lightbox Image 1219 var img = new Image(); 1220 1221 currentItem = no; 1222 $('#DOP_WallGridGallery_ItemCount_'+ID).html(currentItem); 1223 1224 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').css('display', 'block'); 1225 1226 $(img).load(function(){ 1227 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').css('display', 'none'); 1228 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').html(this); 1229 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox img').attr('alt', CaptionTitle[no-1]); 1230 1231 if (SocialShareEnabled == 'true'){ 1232 methods.showSocialShare(); 1233 } 1234 $('#DOP_WallGridGallery_LightboxWrapper_'+ID).css('display', 'block'); 1235 ImageWidth = $(this).width(); 1236 ImageHeight = $(this).height(); 1237 $('#DOP_WallGridGallery_LightboxWrapper_'+ID).css('display', 'none'); 1238 1239 itemLoaded = true; 1240 methods.showCaption(no); 1241 methods.rpLightboxImage(); 1242 1243 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').stop(true, true).animate({'opacity': 1}, LightboxDisplayTime, function(){ 1244 if (prototypes.isIEBrowser() && CaptionText[no-1] != ''){ 1245 methods.rpLightboxImage(); 1246 } 1247 }); 1248 }).attr('src', Images[no-1]); 1249 }, 1250 loadLightboxMedia:function(no){// Load Lightbox Media 1251 currentItem = no; 1252 $('#DOP_WallGridGallery_ItemCount_'+ID).html(currentItem); 1253 1254 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').css('display', 'none'); 1255 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').html(Media[no-1]); 1256 1257 if (SocialShareEnabled == 'true'){ 1258 methods.showSocialShare(); 1259 } 1260 1261 var iframeSRC = $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').children().attr('src'); 1262 1263 if (iframeSRC != null){ 1264 if (iframeSRC.indexOf('?') != -1){ 1265 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').children().attr('src', iframeSRC+'&wmode=transparent'); 1266 } 1267 else{ 1268 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').children().attr('src', iframeSRC+'?wmode=transparent'); 1269 } 1270 } 1271 1272 if ($('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').children().prop("tagName").toUpperCase() == 'IFRAME'){ 1273 ImageWidth = parseFloat($('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').children().attr('width')); 1274 ImageHeight = parseFloat($('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').children().attr('height')); 1275 } 1276 else{ 1277 ImageWidth = 0; 1278 ImageHeight = 0; 1279 } 1280
1281 itemLoaded = true; 1282 methods.showCaption(no); 1283 methods.rpLightboxMedia(); 1284 1285 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').stop(true, true).animate({'opacity': 1}, LightboxDisplayTime); 1286 }, 1287 previousLightbox:function(){ 1288 var previousItem = currentItem-1; 1289 1290 if (currentItem == 1){ 1291 previousItem = noItems; 1292 } 1293 1294 if (Links[previousItem-1] == ''){ 1295 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').stop(true, true).animate({'opacity': 0}, LightboxDisplayTime, function(){ 1296 if (Media[previousItem-1] != ''){ 1297 methods.loadLightboxMedia(previousItem); 1298 } 1299 else{ 1300 methods.loadLightboxImage(previousItem); 1301 } 1302 }); 1303 } 1304 else{ 1305 currentItem = previousItem; 1306 methods.previousLightbox(); 1307 } 1308 }, 1309 nextLightbox:function(){ 1310 var nextItem = currentItem+1; 1311 1312 if (currentItem == noItems){ 1313 nextItem = 1; 1314 } 1315 1316 if (Links[nextItem-1] == ''){ 1317 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').stop(true, true).animate({'opacity': 0}, LightboxDisplayTime, function(){ 1318 if (Media[nextItem-1] != ''){ 1319 methods.loadLightboxMedia(nextItem); 1320 } 1321 else{ 1322 methods.loadLightboxImage(nextItem); 1323 } 1324 }); 1325 } 1326 else{ 1327 currentItem = nextItem; 1328 methods.nextLightbox(); 1329 } 1330 }, 1331 rpLightboxImage:function(){// Resize & Position Lightbox Image 1332 var documentW, documentH, windowW, windowH, maxWidth, maxHeight, currW, currH; 1333 1334 $('#DOP_WallGridGallery_LightboxWrapper_'+ID).css('display', 'none'); 1335 1336 if (LightboxPosition == 'document'){ 1337 documentW = $(document).width(); 1338 documentH = $(document).height(); 1339 windowW = $(window).width(); 1340 windowH = $(window).height(); 1341 } 1342 else{ 1343 documentW = $(Container).width(); 1344 documentH = $(Container).height(); 1345 windowW = $(Container).width(); 1346 windowH = $(Container).height(); 1347 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').css('position', 'absolute'); 1348 } 1349 1350 $('#DOP_WallGridGallery_LightboxWrapper_'+ID).css('display', 'block'); 1351 maxWidth = windowW-($(window).width() <= 640 ? 1:LightboxMarginRight)-($(window).width() <= 640 ? 1:LightboxMarginLeft)-LightboxPaddingRight-LightboxPaddingLeft; 1352 maxHeight = windowH-($(window).width() <= 640 ? 1:LightboxMarginTop)-($(window).width() <= 640 ? 1:LightboxMarginBottom)-LightboxPaddingTop-LightboxPaddingBottom-CaptionHeight; 1353 1354 $('#DOP_WallGridGallery_LightboxWrapper_'+ID).width(documentW); 1355 $('#DOP_WallGridGallery_LightboxWrapper_'+ID).height(documentH); 1356 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxWindow').width(documentW); 1357 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxWindow').height(documentH); 1358 1359 $('#DOP_WallGridGallery_LightboxWrapper_'+ID).css('display', 'block'); 1360 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').css('display', 'block'); 1361 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').css({'margin-top': (windowH-$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').height())/2, 1362 'margin-left': (windowW-$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').width())/2}); 1363 1364 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').css('display', 'none'); 1365 1366 if (itemLoaded){ 1367 if (ImageWidth <= maxWidth && ImageHeight <= maxHeight){ 1368 currW = ImageWidth; 1369 currH = ImageHeight; 1370 } 1371 else{ 1372 currH = maxHeight; 1373 currW = (ImageWidth*maxHeight)/ImageHeight; 1374 1375 if (currW > maxWidth){ 1376 currW = maxWidth; 1377 currH = (ImageHeight*maxWidth)/ImageWidth; 1378 } 1379 } 1380 1381 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox img').width(currW); 1382 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox img').height(currH); 1383 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox img').css({'margin-top': LightboxPaddingTop, 1384 'margin-left': LightboxPaddingLeft}); 1385 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').css({'height': $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').children().height(), 1386 'width': $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').children().width()}); 1387 methods.rpCaption(); 1388 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').width(currW+LightboxPaddingRight+LightboxPaddingLeft); 1389 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').height(currH+LightboxPaddingTop+LightboxPaddingBottom+$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Caption').height()); 1390 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxBg').width(currW+LightboxPaddingRight+LightboxPaddingLeft); 1391 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxBg').height(currH+LightboxPaddingTop+LightboxPaddingBottom+$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Caption').height()); 1392 1393 if (LightboxPosition == 'document'){ 1394 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').css({'margin-top': (windowH-$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').height())/2+$(window).scrollTop(), 1395 'margin-left': (windowW-$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').width())/2+$(window).scrollLeft()}); 1396 } 1397 else{ 1398 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').css({'margin-top': (windowH-$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').height())/2, 1399 'margin-left': (windowW-$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').width())/2}); 1400 } 1401 methods.rpLightboxNavigation(); 1402 } 1403 }, 1404 rpLightboxMedia:function(){// Resize & Position Lightbox Media 1405 var documentW, documentH, windowW, windowH, maxWidth, maxHeight, currW, currH; 1406 1407 $('#DOP_WallGridGallery_LightboxWrapper_'+ID).css('display', 'none'); 1408 1409 if (LightboxPosition == 'document'){ 1410 documentW = $(document).width(); 1411 documentH = $(document).height(); 1412 windowW = $(window).width(); 1413 windowH = $(window).height(); 1414 } 1415 else{ 1416 documentW = $(Container).width(); 1417 documentH = $(Container).height(); 1418 windowW = $(Container).width(); 1419 windowH = $(Container).height(); 1420 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').css('position', 'absolute'); 1421 } 1422 1423 $('#DOP_WallGridGallery_LightboxWrapper_'+ID).css('display', 'block'); 1424 maxWidth = windowW-($(window).width() <= 640 ? 0:LightboxMarginRight)-($(window).width() <= 640 ? 0:LightboxMarginLeft)-LightboxPaddingRight-LightboxPaddingLeft; 1425 maxHeight = windowH-($(window).width() <= 640 ? 0:LightboxMarginTop)-($(window).width() <= 640 ? 0:LightboxMarginBottom)-LightboxPaddingTop-LightboxPaddingBottom-CaptionHeight; 1426 1427 $('#DOP_WallGridGallery_LightboxWrapper_'+ID).width(documentW); 1428 $('#DOP_WallGridGallery_LightboxWrapper_'+ID).height(documentH); 1429 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxWindow').width(documentW); 1430 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxWindow').height(documentH); 1431 1432 $('#DOP_WallGridGallery_LightboxWrapper_'+ID).css('display', 'block'); 1433 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').css('display', 'block'); 1434 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').css({'margin-top': (windowH-$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').height())/2, 1435 'margin-left': (windowW-$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').width())/2}); 1436 1437 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxLoader').css('display', 'none'); 1438 1439 if (ImageWidth <= maxWidth && ImageHeight <= maxHeight){ 1440 currW = ImageWidth; 1441 currH = ImageHeight; 1442 1443 if (ImageWidth == 0 && ImageHeight == 0){ 1444 currW = $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').children().width(); 1445 currH = $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').children().height(); 1446 } 1447 } 1448 else{ 1449 currH = maxHeight; 1450 currW = (ImageWidth*maxHeight)/ImageHeight; 1451 1452 if (currW > maxWidth){ 1453 currW = maxWidth; 1454 currH = (ImageHeight*maxWidth)/ImageWidth; 1455 } 1456 } 1457 1458 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').children().width(currW); 1459 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').children().height(currH); 1460 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').children().css({'margin-top': LightboxPaddingTop, 1461 'margin-left': LightboxPaddingLeft}); 1462 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').css({'height': currH, 1463 'width': currW}); 1464 1465 methods.rpCaption(); 1466 1467 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').width(currW+LightboxPaddingRight+LightboxPaddingLeft); 1468 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').height(currH+LightboxPaddingTop+LightboxPaddingBottom+$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Caption').height()); 1469 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxBg').width(currW+LightboxPaddingRight+LightboxPaddingLeft); 1470 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxBg').height(currH+LightboxPaddingTop+LightboxPaddingBottom+$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Caption').height()); 1471 1472 if (LightboxPosition == 'document'){ 1473 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').css({'margin-top': (windowH-$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').height())/2+$(window).scrollTop(), 1474 'margin-
1474left': (windowW-$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').width())/2+$(window).scrollLeft()}); 1475 } 1476 else{ 1477 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').css({'margin-top': (windowH-$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').height())/2, 1478 'margin-left': (windowW-$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').width())/2}); 1479 } 1480 methods.rpLightboxNavigation(); 1481 }, 1482 rpLightboxNavigation:function(){// Resize & Position Lightbox Navigation 1483 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxNavigationButtons').css({'margin-top': ($('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').height()-$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxNavigationButtons').children().height())/2+LightboxPaddingTop, 1484 'margin-left': LightboxPaddingLeft, 1485 'width': $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').width()}); 1486 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxNavigationExtraButtons').css({'margin-top': LightboxPaddingTop, 1487 'margin-left': LightboxPaddingLeft, 1488 'width': $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').width()}); 1489 }, 1490 lightboxNavigationSwipe:function(){ 1491 var prev, curr, touch, initial, positionX; 1492 1493 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').bind('touchstart', function(e){ 1494 touch = e.originalEvent.touches[0]; 1495 prev = touch.clientX; 1496 initial = parseFloat($('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').css('margin-left')); 1497 }); 1498 1499 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').bind('touchmove', function(e){ 1500 e.preventDefault(); 1501 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxNavigation').css('opacity', 0); 1502 1503 touch = e.originalEvent.touches[0], 1504 curr = touch.clientX, 1505 positionX = curr>prev ? parseInt($('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').css('margin-left'))+(curr-prev):parseInt($('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').css('margin-left'))-(prev-curr); 1506 1507 prev = curr; 1508 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').css('margin-left', positionX); 1509 }); 1510 1511 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').bind('touchend', function(e){
1512 if (!prototypes.isChromeMobileBrowser()){ 1513 e.preventDefault(); 1514 } 1515 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxNavigation').css('opacity', 1); 1516 1517 if (parseFloat($('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').css('margin-left')) < 0){ 1518 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').css({'margin-left': initial, 'opacity': 0}); 1519 methods.nextLightbox(); 1520 } 1521 else if (parseFloat($('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').css('margin-left'))+$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').width() > $(window).width()){ 1522 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').css({'margin-left': initial, 'opacity': 0}); 1523 methods.previousLightbox(); 1524 } 1525 else{ 1526 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxContainer').css('margin-left', initial); 1527 } 1528 }); 1529 }, 1530 1531 initCaption:function(){// Init Caption 1532 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Caption').css({'margin-left': LightboxPaddingLeft, 1533 'bottom': LightboxPaddingBottom}); 1534 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_CaptionTitle').css('color', '#'+CaptionTitleColor); 1535 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_CaptionText').css('color', '#'+CaptionTextColor); 1536 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_CaptionTextContainer').jScrollPane(); 1537 }, 1538 showCaption:function(no){// Show Caption 1539 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_CaptionTitle .title').html(CaptionTitle[no-1]); 1540 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_CaptionText').html(CaptionText[no-1]); 1541 1542 if (CaptionText[no-1] == ''){ 1543 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_CaptionTextContainer').css('display', 'none'); 1544 } 1545 else{ 1546 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_CaptionTextContainer').css('display', 'block'); 1547 } 1548 }, 1549 rpCaption:function(){// Resize & Position Caption 1550 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_CaptionTextContainer').height($('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_CaptionText').height()); 1551 var textHeight = CaptionHeight-$('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_CaptionTitle').height()-parseFloat($('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_CaptionTitle').css('margin-top'))-parseFloat($('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_CaptionTextContainer').css('margin-top')); 1552 1553 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Caption').width($('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_Lightbox').children().width()); 1554 1555 if ($('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_CaptionTextContainer').height() > textHeight){ 1556 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_CaptionTextContainer').height(textHeight); 1557 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_CaptionTextContainer').jScrollPane(); 1558 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .jspDrag').css('background-color', '#'+CaptionScrollScrubColor); 1559 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .jspTrack').css('background-color', '#'+CaptionScrollBgColor); 1560 } 1561 1562 setTimeout(function(){ 1563 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_CaptionTextContainer').jScrollPane(); 1564 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .jspDrag').css('background-color', '#'+CaptionScrollScrubColor); 1565 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .jspTrack').css('background-color', '#'+CaptionScrollBgColor); 1566 }, 100); 1567 }, 1568 1569 initSocialShare:function(){ 1570 var HTML = new Array(); 1571 1572 if ($('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxSocialShare').html() == ''){ 1573 HTML.push(' <div class="addthis_toolbox addthis_default_style">'); 1574 HTML.push(' <a class="addthis_button" addthis:url="" addthis:title="">'); 1575 HTML.push(' <img src="'+SocialShareLightbox+'" alt="" />'); 1576 HTML.push(' </a>'); 1577 HTML.push(' </div>'); 1578 1579 $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxSocialShare').html(HTML.join(''));
1580 } 1581 }, 1582 showSocialShare:function(){ 1583 var URL = window.location.href+(window.location.href.indexOf('?') != -1 ? '&':'?')+'dop_wall_grid_gallery_id='+ID+'&dop_wall_grid_gallery_share='+currentItem; 1584 1585 if (window.addthis == undefined){ 1586 $.getScript( 'http://s7.addthis.com/js/250/addthis_widget.js' , function(){ 1587 if (window.addthis){ 1588 window.addthis.ost = 0; 1589 window.addthis.init(); 1590 1591 setTimeout(function(){ 1592 window.addthis.update('share', 'url', URL); 1593 window.addthis.update('share', 'title', CaptionTitle[currentItem-1]); 1594 }, 100); 1595 1596 $('#at15s').css('top', parseFloat($('#at15s').css('top'))-$(window).scrollTop()); 1597 } 1598 }); 1599 } 1600 else{ 1601 setTimeout(function(){ 1602 window.addthis.update('share', 'url', URL); 1603 window.addthis.update('share', 'title', CaptionTitle[currentItem-1]); 1604 }, 100); 1605 } 1606 1607 clearInterval(socialShareInterval); 1608 socialShareInterval = setInterval(methods.rpSocialShare, 100); 1609 }, 1610 rpSocialShare:function(){ 1611 $('#at15s').css('top', $('#DOP_WallGridGallery_LightboxWrapper_'+ID+' .DOP_WallGridGallery_LightboxSocialShare').offset().top-$(window).scrollTop()); 1612 }, 1613 1614 initTooltip:function(){// Init Tooltip 1615 var mousePositionX, mousePositionY, scrolledX = null, scrolledY = null; 1616 1617 $('.DOP_WallGridGallery_ThumbnailsWrapper', Container).bind('mousemove', function(e){ 1618 mousePositionX = e.clientX-$(this).offset().left+parseInt($(this).css('margin-left'))+$(document).scrollLeft(); 1619 mousePositionY = e.clientY-$(this).offset().top+parseInt($(this).css('margin-top'))+$(document).scrollTop(); 1620 1621 $('.DOP_WallGridGallery_Tooltip', Container).css('margin-left', mousePositionX-10); 1622 $('.DOP_WallGridGallery_Tooltip', Container).css('top', mousePositionY-$('.DOP_WallGridGallery_Tooltip', Container).height()-15); 1623 }); 1624 1625 $(window).scroll(function(){ 1626 if(scrolledX != $(document).scrollLeft()){ 1627 mousePositionX -= scrolledX; 1628 scrolledX = $(document).scrollLeft(); 1629 mousePositionX += scrolledX; 1630 } 1631 1632 if(scrolledY != $(document).scrollTop()){ 1633 mousePositionY -= scrolledY; 1634 scrolledY = $(document).scrollTop(); 1635 mousePositionY += scrolledY; 1636 } 1637 1638 $('.DOP_WallGridGallery_Tooltip', Container).css('margin-left', mousePositionX-10); 1639 $('.DOP_WallGridGallery_Tooltip', Container).css('top', mousePositionY-$('.DOP_WallGridGallery_Tooltip', Container).height()-15); 1640 }); 1641 }, 1642 showTooltip:function(no){// Resize, Position & Display the Tooltip 1643 var HTML = new Array(); 1644 HTML.push(CaptionTitle[no]); 1645 HTML.push('<div class="DOP_WallGridGallery_Tooltip_ArrowBorder"></div>'); 1646 HTML.push('<div class="DOP_WallGridGallery_Tooltip_Arrow"></div>'); 1647 $('.DOP_WallGridGallery_Tooltip', Container).html(HTML.join("")); 1648 1649 if (TooltipBgColor != 'css'){ 1650 $('.DOP_WallGridGallery_Tooltip', Container).css('background-color', '#'+TooltipBgColor); 1651 $('.DOP_WallGridGallery_Tooltip_Arrow', Container).css('border-top-color', '#'+TooltipBgColor); 1652 } 1653 if (TooltipStrokeColor != 'css'){ 1654 $('.DOP_WallGridGallery_Tooltip', Container).css('border-color', '#'+TooltipStrokeColor); 1655 $('.DOP_WallGridGallery_Tooltip_ArrowBorder', Container).css('border-top-color', '#'+TooltipStrokeColor); 1656 } 1657 if (TooltipTextColor != 'css'){ 1658 $('.DOP_WallGridGallery_Tooltip', Container).css('color', '#'+TooltipTextColor); 1659 } 1660 if (CaptionTitle[no] != ''){ 1661 $('.DOP_WallGridGallery_Tooltip', Container).css('display', 'block'); 1662 } 1663 } 1664 }, 1665 1666 prototypes = { 1667 resizeItem:function(parent, child, cw, ch, dw, dh, pos){// Resize & Position an item (the item is 100% visible) 1668 var currW = 0, currH = 0; 1669 1670 if (dw <= cw && dh <= ch){ 1671 currW = dw; 1672 currH = dh; 1673 } 1674 else{ 1675 currH = ch; 1676 currW = (dw*ch)/dh; 1677 1678 if (currW > cw){ 1679 currW = cw; 1680 currH = (dh*cw)/dw; 1681 } 1682 } 1683 1684 child.width(currW); 1685 child.height(currH); 1686 switch(pos.toLowerCase()){ 1687 case 'top': 1688 prototypes.topItem(parent, child, ch); 1689 break; 1690 case 'bottom': 1691 prototypes.bottomItem(parent, child, ch); 1692 break; 1693 case 'left': 1694 prototypes.leftItem(parent, child, cw); 1695 break; 1696 case 'right': 1697 prototypes.rightItem(parent, child, cw); 1698 break; 1699 case 'horizontal-center': 1700 prototypes.hCenterItem(parent, child, cw); 1701 break; 1702 case 'vertical-center': 1703 prototypes.vCenterItem(parent, child, ch); 1704 break; 1705 case 'center': 1706 prototypes.centerItem(parent, child, cw, ch); 1707 break; 1708 case 'top-left': 1709 prototypes.tlItem(parent, child, cw, ch); 1710 break; 1711 case 'top-center': 1712 prototypes.tcItem(parent, child, cw, ch); 1713 break; 1714 case 'top-right': 1715 prototypes.trItem(parent, child, cw, ch); 1716 break; 1717 case 'middle-left': 1718 prototypes.mlItem(parent, child, cw, ch); 1719 break; 1720 case 'middle-right': 1721 prototypes.mrItem(parent, child, cw, ch); 1722 break; 1723 case 'bottom-left': 1724 prototypes.blItem(parent, child, cw, ch); 1725 break; 1726 case 'bottom-center': 1727 prototypes.bcItem(parent, child, cw, ch); 1728 break; 1729 case 'bottom-right': 1730 prototypes.brItem(parent, child, cw, ch); 1731 break; 1732 } 1733 }, 1734 resizeItem2:function(parent, child, cw, ch, dw, dh, pos){// Resize & Position an item (the item covers all the container) 1735 var currW = 0, currH = 0; 1736 1737 currH = ch; 1738 currW = (dw*ch)/dh; 1739 1740 if (currW < cw){ 1741 currW = cw; 1742 currH = (dh*cw)/dw; 1743 } 1744 1745 child.width(currW); 1746 child.height(currH); 1747 1748 switch(pos.toLowerCase()){ 1749 case 'top': 1750 prototypes.topItem(parent, child, ch); 1751 break; 1752 case 'bottom': 1753 prototypes.bottomItem(parent, child, ch); 1754 break; 1755 case 'left': 1756 prototypes.leftItem(parent, child, cw); 1757 break; 1758 case 'right': 1759 prototypes.rightItem(parent, child, cw); 1760 break; 1761 case 'horizontal-center': 1762 prototypes.hCenterItem(parent, child, cw); 1763 break; 1764 case 'vertical-center': 1765 prototypes.vCenterItem(parent, child, ch); 1766 break; 1767 case 'center': 1768 prototypes.centerItem(parent, child, cw, ch); 1769 break; 1770 case 'top-left': 1771 prototypes.tlItem(parent, child, cw, ch); 1772 break; 1773 case 'top-center': 1774 prototypes.tcItem(parent, child, cw, ch); 1775 break; 1776 case 'top-right': 1777 prototypes.trItem(parent, child, cw, ch); 1778 break; 1779 case 'middle-left': 1780 prototypes.mlItem(parent, child, cw, ch); 1781 break; 1782 case 'middle-right': 1783 prototypes.mrItem(parent, child, cw, ch); 1784 break; 1785 case 'bottom-left': 1786 prototypes.blItem(parent, child, cw, ch); 1787 break; 1788 case 'bottom-center': 1789 prototypes.bcItem(parent, child, cw, ch); 1790 break; 1791 case 'bottom-right': 1792 prototypes.brItem(parent, child, cw, ch); 1793 break; 1794 } 1795 }, 1796 1797 topItem:function(parent, child, ch){// Position item on Top 1798 parent.height(ch); 1799 child.css('margin-top', 0); 1800 }, 1801 bottomItem:function(parent, child, ch){// Position item on Bottom 1802 parent.height(ch); 1803 child.css('margin-top', ch-child.height()); 1804 }, 1805 leftItem:function(parent, child, cw){// Position item on Left 1806 parent.width(cw);
1807 child.css('margin-left', 0); 1808 }, 1809 rightItem:function(parent, child, cw){// Position item on Right 1810 parent.width(cw); 1811 child.css('margin-left', parent.width()-child.width()); 1812 }, 1813 hCenterItem:function(parent, child, cw){// Position item on Horizontal Center 1814 parent.width(cw); 1815 child.css('margin-left', (cw-child.width())/2); 1816 }, 1817 vCenterItem:function(parent, child, ch){// Position item on Vertical Center 1818 parent.height(ch); 1819 child.css('margin-top', (ch-child.height())/2); 1820 }, 1821 centerItem:function(parent, child, cw, ch){// Position item on Center 1822 prototypes.hCenterItem(parent, child, cw); 1823 prototypes.vCenterItem(parent, child, ch); 1824 }, 1825 tlItem:function(parent, child, cw, ch){// Position item on Top-Left 1826 prototypes.topItem(parent, child, ch); 1827 prototypes.leftItem(parent, child, cw); 1828 }, 1829 tcItem:function(parent, child, cw, ch){// Position item on Top-Center 1830 prototypes.topItem(parent, child, ch); 1831 prototypes.hCenterItem(parent, child, cw); 1832 }, 1833 trItem:function(parent, child, cw, ch){// Position item on Top-Right 1834 prototypes.topItem(parent, child, ch); 1835 prototypes.rightItem(parent, child, cw); 1836 }, 1837 mlItem:function(parent, child, cw, ch){// Position item on Middle-Left 1838 prototypes.vCenterItem(parent, child, ch); 1839 prototypes.leftItem(parent, child, cw); 1840 }, 1841 mrItem:function(parent, child, cw, ch){// Position item on Middle-Right 1842 prototypes.vCenterItem(parent, child, ch); 1843 prototypes.rightItem(parent, child, cw); 1844 }, 1845 blItem:function(parent, child, cw, ch){// Position item on Bottom-Left 1846 prototypes.bottomItem(parent, child, ch); 1847 prototypes.leftItem(parent, child, cw); 1848 }, 1849 bcItem:function(parent, child, cw, ch){// Position item on Bottom-Center 1850 prototypes.bottomItem(parent, child, ch); 1851 prototypes.hCenterItem(parent, child, cw); 1852 }, 1853 brItem:function(parent, child, cw, ch){// Position item on Bottom-Right 1854 prototypes.bottomItem(parent, child, ch); 1855 prototypes.rightItem(parent, child, cw); 1856 }, 1857 1858 touchNavigation:function(parent, child){// One finger navigation for touchscreen devices 1859 var prevX, prevY, currX, currY, touch, childX, childY; 1860 1861 parent.bind('touchstart', function(e){ 1862 touch = e.originalEvent.touches[0]; 1863 prevX = touch.clientX; 1864 prevY = touch.clientY; 1865 }); 1866 1867 parent.bind('touchmove', function(e){ 1868 touch = e.originalEvent.touches[0]; 1869 currX = touch.clientX; 1870 currY = touch.clientY; 1871 childX = currX>prevX ? parseInt(child.css('margin-left'))+(currX-prevX):parseInt(child.css('margin-left'))-(prevX-currX); 1872 childY = currY>prevY ? parseInt(child.css('margin-top'))+(currY-prevY):parseInt(child.css('margin-top'))-(prevY-currY); 1873 1874 if (childX < (-1)*(child.width()-parent.width())){ 1875 childX = (-1)*(child.width()-parent.width()); 1876 } 1877 else if (childX > 0){ 1878 childX = 0; 1879 } 1880 else{ 1881 e.preventDefault(); 1882 } 1883 1884 if (childY < (-1)*(child.height()-parent.height())){ 1885 childY = (-1)*(child.height()-parent.height()); 1886 } 1887 else if (childY > 0){ 1888 childY = 0; 1889 } 1890 else{ 1891 e.preventDefault(); 1892 } 1893 1894 prevX = currX; 1895 prevY = currY; 1896 1897 if (parent.width() < child.width()){ 1898 child.css('margin-left', childX); 1899 } 1900 1901 if (parent.height() < child.height()){ 1902 child.css('margin-top', childY); 1903 } 1904 }); 1905 1906 parent.bind('touchend', function(e){
1907 if (!prototypes.isChromeMobileBrowser()){ 1908 e.preventDefault(); 1909 } 1910 }); 1911 }, 1912 1913 rgb2hex:function(rgb){// Convert RGB color to HEX 1914 var hexDigits = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'); 1915 1916 rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); 1917 1918 return (isNaN(rgb[1]) ? '00':hexDigits[(rgb[1]-rgb[1]%16)/16]+hexDigits[rgb[1]%16])+ 1919 (isNaN(rgb[2]) ? '00':hexDigits[(rgb[2]-rgb[2]%16)/16]+hexDigits[rgb[2]%16])+ 1920 (isNaN(rgb[3]) ? '00':hexDigits[(rgb[3]-rgb[3]%16)/16]+hexDigits[rgb[3]%16]); 1921 }, 1922 1923 dateDiference:function(date1, date2){// Diference between 2 dates 1924 var time1 = date1.getTime(), 1925 time2 = date2.getTime(), 1926 diff = Math.abs(time1-time2), 1927 one_day = 1000*60*60*24; 1928 1929 return parseInt(diff/(one_day))+1; 1930 }, 1931 noDays:function(date1, date2){// Returns no of days between 2 days 1932 var time1 = date1.getTime(), 1933 time2 = date2.getTime(), 1934 diff = Math.abs(time1-time2), 1935 one_day = 1000*60*60*24; 1936 1937 return Math.round(diff/(one_day))+1; 1938 }, 1939 timeLongItem:function(item){// Return day/month with 0 in front if smaller then 10 1940 if (item < 10){ 1941 return '0'+item; 1942 } 1943 else{ 1944 return item; 1945 } 1946 }, 1947 timeToAMPM:function(item){// Returns time in AM/PM format 1948 var hour = parseInt(item.split(':')[0], 10), 1949 minutes = item.split(':')[1], 1950 result = ''; 1951 1952 if (hour == 0){ 1953 result = '12'; 1954 } 1955 else if (hour > 12){ 1956 result = prototypes.timeLongItem(hour-12); 1957 } 1958 else{ 1959 result = prototypes.timeLongItem(hour); 1960 } 1961 1962 result += ':'+minutes+' '+(hour < 12 ? 'AM':'PM'); 1963 1964 return result; 1965 }, 1966 1967 stripslashes:function(str){// Remove slashes from string 1968 return (str + '').replace(/\\(.?)/g, function (s, n1) { 1969 switch (n1){ 1970 case '\\': 1971 return '\\'; 1972 case '0': 1973 return '\u0000'; 1974 case '': 1975 return ''; 1976 default: 1977 return n1; 1978 } 1979 }); 1980 }, 1981 1982 randomize:function(theArray){// Randomize the items of an array 1983 theArray.sort(function(){ 1984 return 0.5-Math.random(); 1985 }); 1986 return theArray; 1987 }, 1988 randomString:function(string_length){// Create a string with random elements 1989 var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz", 1990 random_string = ''; 1991 1992 for (var i=0; i<string_length; i++){ 1993 var rnum = Math.floor(Math.random()*chars.length); 1994 random_string += chars.substring(rnum,rnum+1); 1995 } 1996 return random_string; 1997 }, 1998 1999 isIE8Browser:function(){// Detect the browser IE8 2000 var isIE8 = false, 2001 agent = navigator.userAgent.toLowerCase(); 2002 2003 if (agent.indexOf('msie 8') != -1){ 2004 isIE8 = true; 2005 } 2006 return isIE8; 2007 }, 2008 isIEBrowser:function(){// Detect the browser IE 2009 var isIE = false, 2010 agent = navigator.userAgent.toLowerCase(); 2011 2012 if (agent.indexOf('msie') != -1){ 2013 isIE = true; 2014 } 2015 return isIE; 2016 }, 2017 isChromeMobileBrowser:function(){// Detect the browser Mobile Chrome 2018 var isChromeMobile = false, 2019 agent = navigator.userAgent.toLowerCase(); 2020 2021 if ((agent.indexOf('chrome') != -1 || agent.indexOf('crios') != -1) && prototypes.isTouchDevice()){ 2022 isChromeMobile = true; 2023 } 2024 return isChromeMobile; 2025 }, 2026 isAndroid:function(){// Detect the browser Mobile Chrome 2027 var isAndroid = false, 2028 agent = navigator.userAgent.toLowerCase(); 2029 2030 if (agent.indexOf('android') != -1){ 2031 isAndroid = true; 2032 } 2033 return isAndroid; 2034 }, 2035 isTouchDevice:function(){// Detect touchscreen devices 2036 var os = navigator.platform; 2037 2038 if (os.toLowerCase().indexOf('win') != -1){ 2039 return window.navigator.msMaxTouchPoints; 2040 } 2041 else { 2042 return 'ontouchstart' in document; 2043 } 2044 }, 2045 2046 openLink:function(url, target){// Open a link 2047 switch (target.toLowerCase()){ 2048 case '_blank': 2049 window.open(url); 2050 break; 2051 case '_top': 2052 top.location.href = url; 2053 break; 2054 case '_parent': 2055 parent.location.href = url; 2056 break; 2057 default: 2058 window.location = url; 2059 } 2060 }, 2061 2062 validateCharacters:function(str, allowedCharacters){// Verify if a string contains allowed characters 2063 var characters = str.split(''), i;
2064 2065 for (i=0; i<characters.length; i++){ 2066 if (allowedCharacters.indexOf(characters[i]) == -1){ 2067 return false; 2068 } 2069 } 2070 return true; 2071 }, 2072 cleanInput:function(input, allowedCharacters, firstNotAllowed, min){// Remove characters that aren't allowed from a string 2073 var characters = $(input).val().split(''), 2074 returnStr = '', i, startIndex = 0; 2075 2076 if (characters.length > 1 && characters[0] == firstNotAllowed){ 2077 startIndex = 1; 2078 } 2079 2080 for (i=startIndex; i<characters.length; i++){ 2081 if (allowedCharacters.indexOf(characters[i]) != -1){ 2082 returnStr += characters[i]; 2083 } 2084 } 2085 2086 if (min > returnStr){ 2087 returnStr = min; 2088 } 2089 2090 $(input).val(returnStr); 2091 }, 2092 validEmail:function(email){// Validate email 2093 var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; 2094 2095 if (filter.test(email)){ 2096 return true; 2097 } 2098 return false; 2099 }, 2100 2101 $_GET:function(variable){// Parse $_GET variables 2102 var url = window.location.href.split('?')[1], 2103 variables = url != undefined ? url.split('&'):[], 2104 i; 2105 2106 for (i=0; i<variables.length; i++){ 2107 if (variables[i].indexOf(variable) != -1){ 2108 return variables[i].split('=')[1]; 2109 break; 2110 } 2111 } 2112 2113 return undefined; 2114 }, 2115 acaoBuster:function(dataURL){// Access-Control-Allow-Origin buster 2116 var topURL = window.location.href, 2117 pathPiece1 = '', pathPiece2 = ''; 2118 2119 if (dataURL.indexOf('https') != -1 || dataURL.indexOf('http') != -1){ 2120 if (topURL.indexOf('http://www.') != -1){ 2121 pathPiece1 = 'http://www.'; 2122 } 2123 else if (topURL.indexOf('http://') != -1){ 2124 pathPiece1 = 'http://'; 2125 } 2126 else if (topURL.indexOf('https://www.') != -1){ 2127 pathPiece1 = 'https://www.'; 2128 } 2129 else if (topURL.indexOf('https://') != -1){ 2130 pathPiece1 = 'https://'; 2131 } 2132 2133 if (dataURL.indexOf('http://www.') != -1){ 2134 pathPiece2 = dataURL.split('http://www.')[1]; 2135 } 2136 else if (dataURL.indexOf('http://') != -1){ 2137 pathPiece2 = dataURL.split('http://')[1]; 2138 } 2139 else if (dataURL.indexOf('https://www.') != -1){ 2140 pathPiece2 = dataURL.split('https://www.')[1]; 2141 } 2142 else if (dataURL.indexOf('https://') != -1){ 2143 pathPiece2 = dataURL.split('https://')[1]; 2144 } 2145 2146 return pathPiece1+pathPiece2; 2147 } 2148 else{ 2149 return dataURL; 2150 } 2151 }, 2152 2153 doHideBuster:function(item){// Make all parents & current item visible 2154 var parent = item.parent(), 2155 items = new Array(); 2156 2157 if (item.prop('tagName') != undefined && item.prop('tagName').toLowerCase() != 'body'){ 2158 items = prototypes.doHideBuster(parent); 2159 } 2160 2161 if (item.css('display') == 'none'){ 2162 item.css('display', 'block'); 2163 items.push(item); 2164 } 2165 2166 return items; 2167 }, 2168 undoHideBuster:function(items){// Hide items in the array 2169 var i; 2170 2171 for (i=0; i<items.length; i++){ 2172 items[i].css('display', 'none'); 2173 } 2174 }, 2175
2176 setCookie:function(c_name, value, expiredays){// Set cookie (name, value, expire in no days) 2177 var exdate = new Date(); 2178 exdate.setDate(exdate.getDate()+expiredays); 2179 2180 document.cookie = c_name+"="+escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toUTCString())+";javahere=yes;path=/"; 2181 }, 2182 readCookie:function(name){// Read cookie (name) 2183 var nameEQ = name+"=", 2184 ca = document.cookie.split(";"); 2185 2186 for (var i=0; i<ca.length; i++){ 2187 var c = ca[i]; 2188 2189 while (c.charAt(0)==" "){ 2190 c = c.substring(1,c.length); 2191 } 2192 2193 if (c.indexOf(nameEQ) == 0){ 2194 return unescape(c.substring(nameEQ.length, c.length)); 2195 } 2196 } 2197 return null; 2198 }, 2199 deleteCookie:function(c_name, path, domain){// Delete cookie (name, path, domain) 2200 if (readCookie(c_name)){ 2201 document.cookie = c_name+"="+((path) ? ";path="+path:"")+((domain) ? ";domain="+domain:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT"; 2202 } 2203 } 2204 }; 2205 2206 return methods.init.apply(this); 2207 } 2208})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.