Mercurial > defr > drupal > popups
comparison skins/facebook/facebook.js @ 0:76f9b43738f2
Popups 2.0-alpha5
author | Franck Deroche <franck@defr.org> |
---|---|
date | Fri, 31 Dec 2010 13:41:08 +0100 |
parents | |
children | 4215c43e74eb c076d54409cb |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:76f9b43738f2 |
---|---|
1 | |
2 /** | |
3 * Custom theming for the popupsLoading. | |
4 */ | |
5 Drupal.theme.popupLoading = function() { | |
6 console.log("Drupal.theme.popupLoading: Facebook"); | |
7 var loading; | |
8 loading += '<div id="popups-loading">'; | |
9 loading += ' <table>'; | |
10 loading += ' <tr>'; | |
11 loading += ' <td class="popups-tl popups-border"></td>'; | |
12 loading += ' <td class="popups-t popups-border"></td>'; | |
13 loading += ' <td class="popups-tr popups-border" id="popups-tr"></td>'; | |
14 loading += ' </tr>'; | |
15 loading += ' <tr>'; | |
16 loading += ' <td class="popups-cl popups-border"></td>'; | |
17 loading += ' <td class="popups-c">'; | |
18 loading += ' <span class="popups-loading-message">Loading...</span>'; | |
19 loading += ' </td>'; | |
20 loading += ' <td class="popups-cr popups-border"></td>'; | |
21 loading += ' </tr>'; | |
22 loading += ' <tr>'; | |
23 loading += ' <td class="popups-bl popups-border"></td>'; | |
24 loading += ' <td class="popups-b popups-border"></td>'; | |
25 loading += ' <td class="popups-br popups-border"></td>'; | |
26 loading += ' </tr>'; | |
27 loading += ' </table>'; | |
28 loading += '</div>'; | |
29 return loading; | |
30 }; | |
31 | |
32 Drupal.theme.popupTemplate = function (popupId) { | |
33 console.log("Drupal.theme.popupTemplate: Facebook"); | |
34 var template; | |
35 template += '<div id="' + popupId + '" class ="popups-box">'; | |
36 template += ' <table>'; | |
37 template += ' <tr>'; | |
38 template += ' <td class="popups-tl popups-border"></td>'; | |
39 template += ' <td class="popups-t popups-border"></td>'; | |
40 template += ' <td class="popups-tr popups-border"></td>'; | |
41 template += ' </tr>'; | |
42 template += ' <tr>'; | |
43 template += ' <td class="popups-cl popups-border"></td>'; | |
44 template += ' <td class="popups-c">'; | |
45 template += ' <div class="popups-container">'; | |
46 template += ' <div class="popups-title">'; | |
47 template += ' <div class="popups-close"><a href="#">' + Drupal.t('Close') + '</a></div>'; | |
48 template += ' <div class="title">%title</div>'; | |
49 template += ' <div class="clear-block"></div>'; | |
50 template += ' </div>'; | |
51 template += ' <div class="popups-body">%body</div>'; | |
52 template += ' <div class="popups-buttons">%buttons</div>'; | |
53 template += ' <div class="popups-footer"></div>'; | |
54 template += ' </div>'; | |
55 template += ' </td>'; | |
56 template += ' <td class="popups-cr popups-border"></td>'; | |
57 template += ' </tr>'; | |
58 template += ' <tr>'; | |
59 template += ' <td class="popups-bl popups-border"></td>'; | |
60 template += ' <td class="popups-b popups-border"></td>'; | |
61 template += ' <td class="popups-br popups-border"></td>'; | |
62 template += ' </tr>'; | |
63 template += ' </table>'; | |
64 template += '</div>'; | |
65 return template; | |
66 }; | |
67 | |
68 /** | |
69 * We need to resize the popups-container as well as the popups if it scrolls | |
70 */ | |
71 Drupal.behaviors.resizePopupsContainer = function() { | |
72 var popup = Popups.activePopup(); | |
73 if (popup) { | |
74 var $popupsContainer = $('#' + popup.id + ' .popups-container'); | |
75 if ($popupsContainer.length) { | |
76 var popupHeight = $popupsContainer.height(); | |
77 var windowHeight = $(window).height(); | |
78 if (popupHeight > (0.9 * windowHeight) ) { // Must fit in 90% of window. | |
79 // we make this slightly smaller than popups so that it fits inside | |
80 popupHeight = 0.85 * windowHeight; | |
81 $popupsContainer.height(popupHeight); | |
82 } | |
83 // needs an extra 20px as the bottom dropshadow looks cutoff | |
84 var $popup = popup.$popup(); | |
85 $popup.height($popup.height() + 20); | |
86 } | |
87 } | |
88 }; |