|
1
|
|
|
/** |
|
2
|
|
|
* Default slideshow theme, based on: |
|
3
|
|
|
* |
|
4
|
|
|
* @preserve Galleria Classic Theme 2011-08-01 |
|
5
|
|
|
* http://galleria.aino.se |
|
6
|
|
|
* |
|
7
|
|
|
* Copyright (c) 2011, Aino |
|
8
|
|
|
* Licensed under the MIT license. |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
(function($) { |
|
12
|
|
|
|
|
13
|
|
|
/*global jQuery, Galleria */ |
|
14
|
|
|
|
|
15
|
|
|
Galleria.addTheme({ |
|
16
|
|
|
name: 'default', |
|
17
|
|
|
author: 'OpenPSA', |
|
18
|
|
|
css: 'galleria.default.css', |
|
19
|
|
|
defaults: { |
|
20
|
|
|
transition: 'slide', |
|
21
|
|
|
thumbCrop: 'height', |
|
22
|
|
|
|
|
23
|
|
|
// set this to false if you want to show the caption all the time: |
|
24
|
|
|
_toggleInfo: true |
|
25
|
|
|
}, |
|
26
|
|
|
init: function(options) { |
|
27
|
|
|
|
|
28
|
|
|
Galleria.requires(1.28, 'This version of Classic theme requires Galleria 1.2.8 or later'); |
|
29
|
|
|
var keys = { |
|
30
|
|
|
left: this.prev, |
|
31
|
|
|
right: this.next, |
|
32
|
|
|
up: function() { |
|
33
|
|
|
if (this.getIndex() !== 0) |
|
34
|
|
|
{ |
|
35
|
|
|
this.show(0); |
|
36
|
|
|
} |
|
37
|
|
|
}, |
|
38
|
|
|
down: function() { |
|
39
|
|
|
var last = this.$('total').text() - 1; |
|
40
|
|
|
if (this.getIndex() !== last) |
|
41
|
|
|
{ |
|
42
|
|
|
this.show(last); |
|
43
|
|
|
} |
|
44
|
|
|
}, |
|
45
|
|
|
return: function() { |
|
46
|
|
|
this.playToggle(); |
|
47
|
|
|
}, |
|
48
|
|
|
escape: function() { |
|
49
|
|
|
this.pause(); |
|
50
|
|
|
} |
|
51
|
|
|
}; |
|
52
|
|
|
|
|
53
|
|
|
// add some elements |
|
54
|
|
|
this.addElement('info-link','info-close'); |
|
55
|
|
|
this.append({ |
|
56
|
|
|
'info' : ['info-link','info-close'] |
|
57
|
|
|
}); |
|
58
|
|
|
|
|
59
|
|
|
// cache some stuff |
|
60
|
|
|
var info = this.$('info-link,info-close,info-text'), |
|
61
|
|
|
touch = Galleria.TOUCH, |
|
62
|
|
|
click = touch ? 'touchstart' : 'click'; |
|
63
|
|
|
|
|
64
|
|
|
// show loader & counter with opacity |
|
65
|
|
|
this.$('loader,counter').show().css('opacity', 0.4); |
|
66
|
|
|
|
|
67
|
|
|
// some stuff for non-touch browsers |
|
68
|
|
|
if (! touch ) { |
|
69
|
|
|
this.addIdleState( this.get('image-nav-left'), { left:-50 }); |
|
70
|
|
|
this.addIdleState( this.get('image-nav-right'), { right:-50 }); |
|
71
|
|
|
this.addIdleState( this.get('counter'), { opacity:0 }); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
// toggle info |
|
75
|
|
|
if ( options._toggleInfo === true ) { |
|
76
|
|
|
info.bind( click, function() { |
|
77
|
|
|
info.toggle(); |
|
78
|
|
|
}); |
|
79
|
|
|
} else { |
|
80
|
|
|
info.show(); |
|
81
|
|
|
this.$('info-link, info-close').hide(); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
// bind some stuff |
|
85
|
|
|
this.bind('thumbnail', function(e) { |
|
86
|
|
|
|
|
87
|
|
|
if (! touch ) { |
|
88
|
|
|
// fade thumbnails |
|
89
|
|
|
$(e.thumbTarget).css('opacity', 0.6).parent().hover(function() { |
|
90
|
|
|
$(this).not('.active').children().stop().fadeTo(100, 1); |
|
91
|
|
|
}, function() { |
|
92
|
|
|
$(this).not('.active').children().stop().fadeTo(400, 0.6); |
|
93
|
|
|
}); |
|
94
|
|
|
|
|
95
|
|
|
if ( e.index === this.getIndex() ) { |
|
96
|
|
|
$(e.thumbTarget).css('opacity',1); |
|
97
|
|
|
} |
|
98
|
|
|
} else { |
|
99
|
|
|
$(e.thumbTarget).css('opacity', this.getIndex() ? 1 : 0.6); |
|
100
|
|
|
} |
|
101
|
|
|
}); |
|
102
|
|
|
|
|
103
|
|
|
this.bind('loadstart', function(e) { |
|
104
|
|
|
if (!e.cached) { |
|
105
|
|
|
this.$('loader').show().fadeTo(200, 0.4); |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
this.$('info').toggle( this.hasInfo() ); |
|
109
|
|
|
|
|
110
|
|
|
$(e.thumbTarget).css('opacity',1).parent().siblings().children().css('opacity', 0.6); |
|
111
|
|
|
}); |
|
112
|
|
|
|
|
113
|
|
|
this.bind('loadfinish', function(e) { |
|
114
|
|
|
this.$('loader').fadeOut(200); |
|
115
|
|
|
}); |
|
116
|
|
|
|
|
117
|
|
|
this.attachKeyboard(keys); |
|
118
|
|
|
} |
|
119
|
|
|
}); |
|
120
|
|
|
|
|
121
|
|
|
}(jQuery)); |
|
122
|
|
|
|