annotate skins/facebook/facebook.js @ 1:4215c43e74eb

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