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