Changeset 656
- Timestamp:
- 04/11/10 17:22:47 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wymeditor/plugins/fullscreen/jquery.wymeditor.fullscreen.js
r632 r656 14 14 * File Authors: 15 15 * Luis Santos (luis.santos a-t openquest dotpt) 16 * Jonatan Lundin (jonatan.lundin a-t gmail dotcom) 17 * Gerd Riesselmann (gerd a-t gyro-php dot org) : Fixed issue with new skin layout 16 18 */ 17 19 18 20 //Extend WYMeditor 19 21 WYMeditor.editor.prototype.fullscreen = function() { 20 var wym = this; 22 var wym = this, 23 $box = jQuery(this._box), 24 $iframe = jQuery(this._iframe), 25 $overlay = null, 26 $window = jQuery(window), 27 28 uiHeight = 0, // Calculated automatically 29 editorMargin = 15, // Margin from window (without padding) 30 editorPadding = 0; // Calculated automatically 21 31 22 //construct the button's html 23 var html = "<li class='wym_tools_fullscreen'>" 24 + "<a name='Fullscreen' href='#'" 25 + " style='background-image:" 26 + " url(" + wym._options.basePath +"plugins/fullscreen/icon_fullscreen.gif)'>" 27 + "Fullscreen" 28 + "</a></li>"; 32 33 //construct the button's html 34 var html = "<li class='wym_tools_fullscreen'>" 35 + "<a name='Fullscreen' href='#'" 36 + " style='background-image:" 37 + " url(" + wym._options.basePath +"plugins/fullscreen/icon_fullscreen.gif)'>" 38 + "Fullscreen" 39 + "</a></li>"; 29 40 30 //add the button to the tools box 31 jQuery(wym._box) 32 .find(wym._options.toolsSelector + wym._options.toolsListSelector) 33 .append(html); 41 //add the button to the tools box 42 $box.find(wym._options.toolsSelector + wym._options.toolsListSelector) 43 .append(html); 44 45 function resize () { 46 var screenHeight = $window.height(), 47 iframeHeight = (screenHeight 48 - uiHeight 49 - (editorMargin * 2)) + 'px', 50 51 screenWidth = $window.width(), 52 boxWidth = (screenWidth 53 - editorPadding 54 - (editorMargin * 2)) + 'px'; 55 56 $box.css('width', boxWidth); 57 $iframe.css('height', iframeHeight); 58 $overlay.css({ 59 'height': screenHeight + 'px', 60 'width': screenWidth + 'px' 61 }); 62 }; 34 63 35 //handle click event 36 jQuery(wym._box).find('li.wym_tools_fullscreen a').click(function() { 37 if (jQuery(wym._box).css('position') != 'fixed') { 38 jQuery('body').append('<div id="loader"></div>'); 39 jQuery('#loader').css({'position' : 'fixed', 'background-color': 'rgb(0, 0, 0)', 'opacity': '0.8', 'z-index': '98', 'width': '100%', 'height': '100%', 'top': '0px', 'left': '0px'}); 40 jQuery(wym._box).css({'position' : 'fixed', 'z-index' : '99', 'top': '5%', 'left': '5%', 'width': '90%', 'height': '90%'}); 41 } else { 42 jQuery('#loader').remove(); 43 jQuery(wym._box).css({'position' : 'static', 'z-index' : '99', 'height' : '100%', 'width' : '100%', 'top': '0px', 'left': '0px'}); 44 } 64 //handle click event 65 $box.find('li.wym_tools_fullscreen a').click(function() { 66 if ($box.css('position') != 'fixed') { 67 // Calculate margins 68 uiHeight = $box.outerHeight(true) - $iframe.outerHeight(true); 69 editorPadding = $box.outerWidth() - $box.width(); 70 71 // Create overlay 72 $overlay = jQuery('<div id="wym-fullscreen-overlay"></div>') 73 .appendTo('body').css({ 74 'position': 'fixed', 75 'background-color': 'rgb(0, 0, 0)', 76 'opacity': '0.75', 77 'z-index': '98', 78 'top': '0px', 79 'left': '0px' 80 }); 81 82 // Possition the editor 83 $box.css({ 84 'position': 'fixed', 85 'z-index': '99', 86 'top': editorMargin + 'px', 87 'left': editorMargin + 'px' 88 }); 89 90 // Listen to resize on window 91 $window.bind('resize', resize); 92 93 // Force resize 94 resize(); 95 } else { 96 // Stop listening to resize on window 97 $window.unbind('resize', resize); 98 99 // Remove inline styles 100 $box.css({ 101 'position': 'static', 102 'z-index': '', 103 'width': '', 104 'top': '', 105 'left': '' 106 }); 107 $iframe.css('height', ''); 45 108 46 return(false); 47 }); 109 // Remove overlay 110 $overlay.remove(); 111 $overlay = null; 112 } 113 114 return false; 115 }); 48 116 };
Note: See TracChangeset
for help on using the changeset viewer.