1 | /* ----------------------------------------------------------------------------- |
---|
2 | GALLY-GRAPHITE |
---|
3 | Template for Piwigo |
---|
4 | ------------------------------------------------------------------------------ |
---|
5 | file: gally/gallyjs-tcp.js |
---|
6 | file release: 1.0.0 |
---|
7 | theme release: 1.5.0 |
---|
8 | ------------------------------------------------------------------------------ |
---|
9 | author: grum at piwigo.org |
---|
10 | << May the Little SpaceFrog be with you >> |
---|
11 | ------------------------------------------------------------------------------ |
---|
12 | Specific JS for the theme |
---|
13 | |
---|
14 | see the release_notes.txt file for more informations |
---|
15 | ----------------------------------------------------------------------------- */ |
---|
16 | |
---|
17 | var gallyGraphite=null; |
---|
18 | |
---|
19 | $(document).ready( |
---|
20 | function() |
---|
21 | { |
---|
22 | gallyGraphite=new GallyGraphite(); |
---|
23 | } |
---|
24 | ); |
---|
25 | |
---|
26 | |
---|
27 | function GallyGraphite () |
---|
28 | { |
---|
29 | function init() |
---|
30 | { |
---|
31 | // apply specific actions for categories pages |
---|
32 | if($('#theCategoryPage').length>0) |
---|
33 | { |
---|
34 | setCatThumbHeight(); |
---|
35 | setTipPosition_Category(); |
---|
36 | } |
---|
37 | // apply specific actions for picture pages |
---|
38 | else if($('#thePicturePage').length>0) |
---|
39 | { |
---|
40 | setTipPosition_Picture(); |
---|
41 | setDerivativeBoxPosition_Picture(); |
---|
42 | } |
---|
43 | else |
---|
44 | { |
---|
45 | $('ul.categoryActions a.button').addClass('sTipOnLeft').removeClass('sTipOnRight'); |
---|
46 | } |
---|
47 | setTipPosition_Menu(); |
---|
48 | } |
---|
49 | |
---|
50 | |
---|
51 | /** |
---|
52 | * change the parent of the derivative box on the picture page |
---|
53 | * (don't want to create a specific template just for this) |
---|
54 | */ |
---|
55 | function setDerivativeBoxPosition_Picture() |
---|
56 | { |
---|
57 | $('#derivativeSwitchBox').prependTo($('#content')); |
---|
58 | } |
---|
59 | |
---|
60 | /** |
---|
61 | * set the same height for all category block |
---|
62 | */ |
---|
63 | function setCatThumbHeight() |
---|
64 | { |
---|
65 | var maxH=0; |
---|
66 | |
---|
67 | $('div ul.thumbnailCategories li div.thumbnailCategory').each( |
---|
68 | function (index) |
---|
69 | { |
---|
70 | height=$(this).height(); |
---|
71 | if(height>maxH) maxH=height; |
---|
72 | } |
---|
73 | ); |
---|
74 | |
---|
75 | $('div ul.thumbnailCategories li div.thumbnailCategory').height(maxH); |
---|
76 | } |
---|
77 | |
---|
78 | function setTipPosition_Category() |
---|
79 | { |
---|
80 | $('#categoryActionsID a.button').addClass('sTipOnLeft'); |
---|
81 | $('div ul.thumbnailCategories li div.thumbnailCategory').addClass('sTipOnTop'); |
---|
82 | |
---|
83 | //move title from <span> container to <img> (rendering is better for this theme) |
---|
84 | $('span.wrap2').each( |
---|
85 | function(index) |
---|
86 | { |
---|
87 | title=$(this).attr('title'); |
---|
88 | $(this).find('img').addClass('sTipOnTop').attr('title', title); |
---|
89 | $(this).removeAttr('title').removeClass('sTipOnTop'); |
---|
90 | } |
---|
91 | ); |
---|
92 | } |
---|
93 | |
---|
94 | function setTipPosition_Picture() |
---|
95 | { |
---|
96 | $('#imageToolBar div.navButtons a.navButton').addClass('sTipOnLeft').removeClass('sTipOnTop'); |
---|
97 | $('#imageToolBar div.randomButtons a.button').addClass('sTipOnRight').removeClass('sTipOnTop'); |
---|
98 | } |
---|
99 | |
---|
100 | function setTipPosition_Menu() |
---|
101 | { |
---|
102 | $('#menubar span').removeClass('sTipOnTop'); |
---|
103 | $('#menuTagCloud a').removeClass('sTipOnTop').addClass('sTipOnRight'); |
---|
104 | } |
---|
105 | |
---|
106 | init(); |
---|
107 | } |
---|