annotate static/js/tiny_mce/plugins/fullscreen/editor_plugin_src.js @ 348:d1b11096595b

Fix #168; when nailing a spammer, clear their profile text fields. Guard against topics and forums that don't exist when deleting posts in the signal handler. Make the forum stats template tag only display the latest active users.
author Brian Neal <bgneal@gmail.com>
date Wed, 02 Mar 2011 02:18:28 +0000
parents 88b2b9cb8c1f
children 6c182ceb7147
rev   line source
bgneal@312 1 /**
bgneal@312 2 * editor_plugin_src.js
bgneal@312 3 *
bgneal@312 4 * Copyright 2009, Moxiecode Systems AB
bgneal@312 5 * Released under LGPL License.
bgneal@312 6 *
bgneal@312 7 * License: http://tinymce.moxiecode.com/license
bgneal@312 8 * Contributing: http://tinymce.moxiecode.com/contributing
bgneal@312 9 */
bgneal@312 10
bgneal@312 11 (function() {
bgneal@312 12 var DOM = tinymce.DOM;
bgneal@312 13
bgneal@312 14 tinymce.create('tinymce.plugins.FullScreenPlugin', {
bgneal@312 15 init : function(ed, url) {
bgneal@312 16 var t = this, s = {}, vp;
bgneal@312 17
bgneal@312 18 t.editor = ed;
bgneal@312 19
bgneal@312 20 // Register commands
bgneal@312 21 ed.addCommand('mceFullScreen', function() {
bgneal@312 22 var win, de = DOM.doc.documentElement;
bgneal@312 23
bgneal@312 24 if (ed.getParam('fullscreen_is_enabled')) {
bgneal@312 25 if (ed.getParam('fullscreen_new_window'))
bgneal@312 26 closeFullscreen(); // Call to close in new window
bgneal@312 27 else {
bgneal@312 28 DOM.win.setTimeout(function() {
bgneal@312 29 tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc);
bgneal@312 30 tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format : 'raw'}), {format : 'raw'});
bgneal@312 31 tinyMCE.remove(ed);
bgneal@312 32 DOM.remove('mce_fullscreen_container');
bgneal@312 33 de.style.overflow = ed.getParam('fullscreen_html_overflow');
bgneal@312 34 DOM.setStyle(DOM.doc.body, 'overflow', ed.getParam('fullscreen_overflow'));
bgneal@312 35 DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'), ed.getParam('fullscreen_scrolly'));
bgneal@312 36 tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings
bgneal@312 37 }, 10);
bgneal@312 38 }
bgneal@312 39
bgneal@312 40 return;
bgneal@312 41 }
bgneal@312 42
bgneal@312 43 if (ed.getParam('fullscreen_new_window')) {
bgneal@312 44 win = DOM.win.open(url + "/fullscreen.htm", "mceFullScreenPopup", "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width=" + screen.availWidth + ",height=" + screen.availHeight);
bgneal@312 45 try {
bgneal@312 46 win.resizeTo(screen.availWidth, screen.availHeight);
bgneal@312 47 } catch (e) {
bgneal@312 48 // Ignore
bgneal@312 49 }
bgneal@312 50 } else {
bgneal@312 51 tinyMCE.oldSettings = tinyMCE.settings; // Store old settings
bgneal@312 52 s.fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto';
bgneal@312 53 s.fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1);
bgneal@312 54 vp = DOM.getViewPort();
bgneal@312 55 s.fullscreen_scrollx = vp.x;
bgneal@312 56 s.fullscreen_scrolly = vp.y;
bgneal@312 57
bgneal@312 58 // Fixes an Opera bug where the scrollbars doesn't reappear
bgneal@312 59 if (tinymce.isOpera && s.fullscreen_overflow == 'visible')
bgneal@312 60 s.fullscreen_overflow = 'auto';
bgneal@312 61
bgneal@312 62 // Fixes an IE bug where horizontal scrollbars would appear
bgneal@312 63 if (tinymce.isIE && s.fullscreen_overflow == 'scroll')
bgneal@312 64 s.fullscreen_overflow = 'auto';
bgneal@312 65
bgneal@312 66 // Fixes an IE bug where the scrollbars doesn't reappear
bgneal@312 67 if (tinymce.isIE && (s.fullscreen_html_overflow == 'visible' || s.fullscreen_html_overflow == 'scroll'))
bgneal@312 68 s.fullscreen_html_overflow = 'auto';
bgneal@312 69
bgneal@312 70 if (s.fullscreen_overflow == '0px')
bgneal@312 71 s.fullscreen_overflow = '';
bgneal@312 72
bgneal@312 73 DOM.setStyle(DOM.doc.body, 'overflow', 'hidden');
bgneal@312 74 de.style.overflow = 'hidden'; //Fix for IE6/7
bgneal@312 75 vp = DOM.getViewPort();
bgneal@312 76 DOM.win.scrollTo(0, 0);
bgneal@312 77
bgneal@312 78 if (tinymce.isIE)
bgneal@312 79 vp.h -= 1;
bgneal@312 80
bgneal@312 81 n = DOM.add(DOM.doc.body, 'div', {id : 'mce_fullscreen_container', style : 'position:' + (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel) ? 'absolute' : 'fixed') + ';top:0;left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'});
bgneal@312 82 DOM.add(n, 'div', {id : 'mce_fullscreen'});
bgneal@312 83
bgneal@312 84 tinymce.each(ed.settings, function(v, n) {
bgneal@312 85 s[n] = v;
bgneal@312 86 });
bgneal@312 87
bgneal@312 88 s.id = 'mce_fullscreen';
bgneal@312 89 s.width = n.clientWidth;
bgneal@312 90 s.height = n.clientHeight - 15;
bgneal@312 91 s.fullscreen_is_enabled = true;
bgneal@312 92 s.fullscreen_editor_id = ed.id;
bgneal@312 93 s.theme_advanced_resizing = false;
bgneal@312 94 s.save_onsavecallback = function() {
bgneal@312 95 ed.setContent(tinyMCE.get(s.id).getContent({format : 'raw'}), {format : 'raw'});
bgneal@312 96 ed.execCommand('mceSave');
bgneal@312 97 };
bgneal@312 98
bgneal@312 99 tinymce.each(ed.getParam('fullscreen_settings'), function(v, k) {
bgneal@312 100 s[k] = v;
bgneal@312 101 });
bgneal@312 102
bgneal@312 103 if (s.theme_advanced_toolbar_location === 'external')
bgneal@312 104 s.theme_advanced_toolbar_location = 'top';
bgneal@312 105
bgneal@312 106 t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s);
bgneal@312 107 t.fullscreenEditor.onInit.add(function() {
bgneal@312 108 t.fullscreenEditor.setContent(ed.getContent());
bgneal@312 109 t.fullscreenEditor.focus();
bgneal@312 110 });
bgneal@312 111
bgneal@312 112 t.fullscreenEditor.render();
bgneal@312 113
bgneal@312 114 t.fullscreenElement = new tinymce.dom.Element('mce_fullscreen_container');
bgneal@312 115 t.fullscreenElement.update();
bgneal@312 116 //document.body.overflow = 'hidden';
bgneal@312 117
bgneal@312 118 t.resizeFunc = tinymce.dom.Event.add(DOM.win, 'resize', function() {
bgneal@312 119 var vp = tinymce.DOM.getViewPort(), fed = t.fullscreenEditor, outerSize, innerSize;
bgneal@312 120
bgneal@312 121 // Get outer/inner size to get a delta size that can be used to calc the new iframe size
bgneal@312 122 outerSize = fed.dom.getSize(fed.getContainer().firstChild);
bgneal@312 123 innerSize = fed.dom.getSize(fed.getContainer().getElementsByTagName('iframe')[0]);
bgneal@312 124
bgneal@312 125 fed.theme.resizeTo(vp.w - outerSize.w + innerSize.w, vp.h - outerSize.h + innerSize.h);
bgneal@312 126 });
bgneal@312 127 }
bgneal@312 128 });
bgneal@312 129
bgneal@312 130 // Register buttons
bgneal@312 131 ed.addButton('fullscreen', {title : 'fullscreen.desc', cmd : 'mceFullScreen'});
bgneal@312 132
bgneal@312 133 ed.onNodeChange.add(function(ed, cm) {
bgneal@312 134 cm.setActive('fullscreen', ed.getParam('fullscreen_is_enabled'));
bgneal@312 135 });
bgneal@312 136 },
bgneal@312 137
bgneal@312 138 getInfo : function() {
bgneal@312 139 return {
bgneal@312 140 longname : 'Fullscreen',
bgneal@312 141 author : 'Moxiecode Systems AB',
bgneal@312 142 authorurl : 'http://tinymce.moxiecode.com',
bgneal@312 143 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',
bgneal@312 144 version : tinymce.majorVersion + "." + tinymce.minorVersion
bgneal@312 145 };
bgneal@312 146 }
bgneal@312 147 });
bgneal@312 148
bgneal@312 149 // Register plugin
bgneal@312 150 tinymce.PluginManager.add('fullscreen', tinymce.plugins.FullScreenPlugin);
bgneal@312 151 })();