PluginProbe ʕ •ᴥ•ʔ
Gallery : FooGallery / 3.2.6
Gallery : FooGallery v3.2.6
3.3.2 3.3.3 3.3.0 3.1.31 3.1.32 3.1.34 3.1.36 3.2.0 3.2.6 trunk 1.10.3 2.0.24 2.1.34 2.2.44 2.3.3 2.4.32 3.0.6 3.1.11 3.1.12 3.1.13 3.1.20 3.1.25 3.1.26 3.1.26.1 3.1.26.2
foogallery / extensions / default-templates / default / js / admin-gallery-default.js
foogallery / extensions / default-templates / default / js Last commit date
admin-gallery-default.js 1 month ago
admin-gallery-default.js
89 lines
1 (function (FOOGALLERY_DEF_TEMPLATE, $, undefined) {
2
3 FOOGALLERY_DEF_TEMPLATE.setPreviewClasses = function() {
4
5 var $previewImage = $('.foogallery-default-preview'),
6 border_style = $('input[name="foogallery_settings[default_border-style]"]:checked').val(),
7 hover_effect = $('input[name="foogallery_settings[default_hover-effect]"]:checked').val(),
8 hover_effect_type = $('input[name="foogallery_settings[default_hover-effect-type]"]:checked').val(),
9 caption_effect_type = $('input[name="foogallery_settings[default_caption-hover-effect]"]:checked').val(),
10 classNames = 'foogallery-default-preview foogallery-container foogallery-default ' + border_style + ' ' + hover_effect_type;
11
12 var $hoverEffectrow = $('.gallery_template_field-default-hover-effect'),
13 $captionHoverRow = $('.gallery_template_field-default-caption-hover-effect'),
14 $captionContentRow = $('.gallery_template_field-default-caption-content');
15
16 if ( hover_effect_type === '' ) {
17 //icon hover effect type
18 $hoverEffectrow.show();
19 $captionHoverRow.hide();
20 $captionContentRow.hide();
21 classNames += ' ' + hover_effect;
22 } else if ( hover_effect_type === 'hover-effect-caption' ) {
23 //caption hover effect type
24 $hoverEffectrow.hide();
25 $captionHoverRow.show();
26 $captionContentRow.show();
27 classNames += ' ' + caption_effect_type;
28 } else {
29 //no hover effect type
30 $hoverEffectrow.hide();
31 $captionHoverRow.hide();
32 $captionContentRow.hide();
33 }
34
35 $previewImage.attr('class' , classNames);
36 };
37
38 FOOGALLERY_DEF_TEMPLATE.showHideCaptionContent = function(){
39 var $previewImage = $('.foogallery-default-preview'),
40 $caption = $previewImage.find('.foogallery-caption'),
41 $title = $previewImage.find('.foogallery-caption-title'),
42 $desc = $previewImage.find('.foogallery-caption-desc'),
43 caption_content = $('input[name="foogallery_settings[default_caption-content]"]:checked').val();
44
45 $caption.add($title).add($desc).show();
46 switch(caption_content){
47 case 'title':
48 $desc.hide();
49 break;
50 case 'desc':
51 $title.hide();
52 break;
53 case 'none':
54 $caption.hide();
55 break;
56 }
57 };
58
59 FOOGALLERY_DEF_TEMPLATE.adminReady = function () {
60 $('body').on('foogallery-gallery-template-changed-default', function() {
61 FOOGALLERY_DEF_TEMPLATE.setPreviewClasses();
62 FOOGALLERY_DEF_TEMPLATE.showHideCaptionContent();
63 });
64
65 $('input[name="foogallery_settings[default_border-style]"], ' +
66 'input[name="foogallery_settings[default_hover-effect]"], ' +
67 'input[name="foogallery_settings[default_hover-effect-type]"], ' +
68 'input[name="foogallery_settings[default_caption-hover-effect]"]').change(function() {
69 FOOGALLERY_DEF_TEMPLATE.setPreviewClasses();
70 });
71
72 $('input[name="foogallery_settings[default_caption-content]"]').change(function() {
73 FOOGALLERY_DEF_TEMPLATE.showHideCaptionContent();
74 });
75
76 $('.foogallery-thumbnail-preview').on('click', function(e) {
77 e.preventDefault();
78 });
79
80 //run when the page load for the first time too!
81 FOOGALLERY_DEF_TEMPLATE.setPreviewClasses();
82 FOOGALLERY_DEF_TEMPLATE.showHideCaptionContent();
83 };
84
85 }(window.FOOGALLERY_DEF_TEMPLATE = window.FOOGALLERY_DEF_TEMPLATE || {}, jQuery));
86
87 jQuery(function () {
88 FOOGALLERY_DEF_TEMPLATE.adminReady();
89 });