Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -70,7 +70,7 @@ |
71 | 71 | array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ), |
72 | 72 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 6 ), |
73 | 73 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 21 ), |
74 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 29 ), |
| 74 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 30 ), |
75 | 75 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 1 ), |
76 | 76 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 35 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 9 ), |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html |
— | — | @@ -5,7 +5,8 @@ |
6 | 6 | <script src="../../../../js2/js2stopgap.js" type="text/javascript"></script> |
7 | 7 | <script type="text/javascript"> |
8 | 8 | function get( name ) { |
9 | | - var v = ( new RegExp( '[\\?&]' + name.replace( /[\[]/, '\\\[' ).replace( /[\]]/, '\\\]' ) + '=([^&#]*)' ) ) |
| 9 | + // Extracts the value of a given URL parameter from the current window location |
| 10 | + var v = ( new RegExp( '[\\?&]' + name.replace( /\[|\]/g, '\\\$1' ) + '=([^&#]*)' ) ) |
10 | 11 | .exec( window.location.href ); |
11 | 12 | return v == null ? '' : v[1]; |
12 | 13 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -1634,21 +1634,14 @@ |
1635 | 1635 | * Set up the magic iframe |
1636 | 1636 | */ |
1637 | 1637 | 'setup': function() { |
1638 | | - // We need to properly escape any HTML entities like &, < and > so they end up as visible |
1639 | | - // characters rather than actual HTML tags in the code editor container. |
1640 | | - var contentHTML = $( '<div />' ).text( context.$textarea.val() ).html(); |
1641 | | - |
1642 | | - // Setup the iframe with a basic document |
1643 | | - context.$iframe[0].contentWindow.document.open(); |
1644 | | - context.$iframe[0].contentWindow.document.write( |
1645 | | - // FIXME: Break this line |
1646 | | - '<html><head><title>wikiEditor</title><script>var context = window.parent.jQuery.wikiEditor.instances[' + context.instance + '].data( "wikiEditor-context" ); window.parent.jQuery( document ).bind( "keydown keypress keyup mousedown mouseup cut paste", function( event ) { context.fn.trigger( "change", event ) } );</script></head><body style="margin:0;padding:0;width:100%;height:100%;white-space:pre-wrap;font-family:monospace">' + contentHTML + '</body></html>' |
1647 | | - ); |
1648 | | - context.$iframe[0].contentWindow.document.close(); |
1649 | 1638 | // Turn the document's design mode on |
1650 | 1639 | context.$iframe[0].contentWindow.document.designMode = 'on'; |
1651 | 1640 | // Get a reference to the content area of the iframe |
1652 | 1641 | context.$content = $( context.$iframe[0].contentWindow.document.body ); |
| 1642 | + // We need to properly escape any HTML entities like &, < and > so they end up as visible |
| 1643 | + // characters rather than actual HTML tags in the code editor container. |
| 1644 | + context.$content.html( $( '<div />' ).text( context.$textarea.val() ).html() ); |
| 1645 | + // Reflect direction of parent frame into child |
1653 | 1646 | if ( $( 'body' ).is( '.rtl' ) ) { |
1654 | 1647 | context.$content.addClass( 'rtl' ).attr( 'dir', 'rtl' ); |
1655 | 1648 | } |
— | — | @@ -1659,6 +1652,8 @@ |
1660 | 1653 | context.$textarea.attr( 'disabled', true ); |
1661 | 1654 | context.$textarea.hide(); |
1662 | 1655 | context.$iframe.show(); |
| 1656 | + // Let modules know we're ready to start working with the content |
| 1657 | + context.fn.trigger( 'ready' ); |
1663 | 1658 | }, |
1664 | 1659 | /** |
1665 | 1660 | * Checks whether the magic iframe is properly set up |
— | — | @@ -1865,26 +1860,25 @@ |
1866 | 1861 | /* Magic IFRAME Construction */ |
1867 | 1862 | |
1868 | 1863 | // Create an iframe in place of the text area |
| 1864 | + var ts = ( new Date() ).getTime(); |
| 1865 | + var instance = context.instance; |
1869 | 1866 | context.$iframe = $( '<iframe></iframe>' ) |
1870 | | - .attr( 'frameborder', 0 ) |
| 1867 | + .attr( { |
| 1868 | + 'frameborder': 0, |
| 1869 | + 'src': wgScriptPath + '/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html?' + |
| 1870 | + 'instance=' + context.instance + '&ts=' + ts |
| 1871 | + } ) |
1871 | 1872 | .css( { |
1872 | 1873 | 'backgroundColor': 'white', |
1873 | 1874 | 'width': '100%', |
1874 | 1875 | 'height': context.$textarea.height(), |
1875 | 1876 | 'display': 'none', |
1876 | 1877 | 'overflow-y': 'scroll', |
1877 | | - 'overflow-x': 'hidden', |
1878 | | - }) |
1879 | | - .insertAfter( context.$textarea ); |
| 1878 | + 'overflow-x': 'hidden' |
| 1879 | + } ) |
| 1880 | + .insertAfter( context.$textarea ) |
| 1881 | + .load( context.fn.setup ); |
1880 | 1882 | |
1881 | | - /* |
1882 | | - * For whatever strange reason, this code needs to be within a timeout or it doesn't work - it seems to be that |
1883 | | - * the DOM manipulation to add the iframe happens asynchronously and this code that depends on it actually being |
1884 | | - * finished doesn't function on the right reference. |
1885 | | - * FIXME: The fact that this calls a function that's defined below is ugly |
1886 | | - */ |
1887 | | - setTimeout( function() { context.fn.setup(); }, 1 ); |
1888 | | - |
1889 | 1883 | // Attach a submit handler to the form so that when the form is submitted the content of the iframe gets decoded and |
1890 | 1884 | // copied over to the textarea |
1891 | 1885 | context.$textarea.closest( 'form' ).submit( function() { |
— | — | @@ -2227,7 +2221,7 @@ |
2228 | 2222 | context.$preview.find( '.wikiEditor-preview-loading' ).hide(); |
2229 | 2223 | context.$preview.find( '.wikiEditor-preview-contents' ) |
2230 | 2224 | .html( data.parse.text['*'] ) |
2231 | | - .find( 'a:not([href^=#])' ).attr( 'href', '#' ); |
| 2225 | + .find( 'a:not([href^=#])' ).click( function() { return false; } ); |
2232 | 2226 | }, |
2233 | 2227 | 'json' |
2234 | 2228 | ); |
— | — | @@ -2373,12 +2367,6 @@ |
2374 | 2368 | ( function( $ ) { $.wikiEditor.modules.toc = { |
2375 | 2369 | |
2376 | 2370 | /** |
2377 | | - * API accessible functions |
2378 | | - */ |
2379 | | -api: { |
2380 | | - // |
2381 | | -}, |
2382 | | -/** |
2383 | 2371 | * Default width of table of contents |
2384 | 2372 | */ |
2385 | 2373 | defaultWidth: '166px', |
— | — | @@ -2388,6 +2376,38 @@ |
2389 | 2377 | */ |
2390 | 2378 | minimumWidth: '70px', |
2391 | 2379 | /** |
| 2380 | + * API accessible functions |
| 2381 | + */ |
| 2382 | +api: { |
| 2383 | + // |
| 2384 | +}, |
| 2385 | +/** |
| 2386 | + * Event handlers |
| 2387 | + */ |
| 2388 | +evt: { |
| 2389 | + ready: function( context, event ) { |
| 2390 | + // Add the TOC to the document |
| 2391 | + $.wikiEditor.modules.toc.fn.build( context ); |
| 2392 | + context.$content.parent() |
| 2393 | + .delayedBind( 250, 'mouseup scrollToTop keyup change', |
| 2394 | + function() { |
| 2395 | + $(this).eachAsync( { |
| 2396 | + bulk: 0, |
| 2397 | + loop: function() { |
| 2398 | + $.wikiEditor.modules.toc.fn.build( context ); |
| 2399 | + $.wikiEditor.modules.toc.fn.update( context ); |
| 2400 | + } |
| 2401 | + } ); |
| 2402 | + } |
| 2403 | + ) |
| 2404 | + .blur( function( event ) { |
| 2405 | + var context = event.data.context; |
| 2406 | + context.$textarea.delayedBindCancel( 250, 'mouseup scrollToTop keyup change' ); |
| 2407 | + $.wikiEditor.modules.toc.fn.unhighlight( context ); |
| 2408 | + }); |
| 2409 | + } |
| 2410 | +}, |
| 2411 | +/** |
2392 | 2412 | * Internally used functions |
2393 | 2413 | */ |
2394 | 2414 | fn: { |
— | — | @@ -2416,27 +2436,6 @@ |
2417 | 2437 | .css( 'marginRight', "-" + $.wikiEditor.modules.toc.defaultWidth ) |
2418 | 2438 | .children() |
2419 | 2439 | .css( 'marginRight', $.wikiEditor.modules.toc.defaultWidth ); |
2420 | | - |
2421 | | - // Add the TOC to the document |
2422 | | - $.wikiEditor.modules.toc.fn.build( context, config ); |
2423 | | - context.$content.parent() |
2424 | | - .delayedBind( 250, 'mouseup scrollToTop keyup change', |
2425 | | - function() { |
2426 | | - $(this).eachAsync( { |
2427 | | - bulk: 0, |
2428 | | - loop: function() { |
2429 | | - $.wikiEditor.modules.toc.fn.build( context ); |
2430 | | - $.wikiEditor.modules.toc.fn.update( context ); |
2431 | | - } |
2432 | | - } ); |
2433 | | - } |
2434 | | - ) |
2435 | | - .blur( function( event ) { |
2436 | | - var context = event.data.context; |
2437 | | - context.$textarea.delayedBindCancel( 250, 'mouseup scrollToTop keyup change' ); |
2438 | | - $.wikiEditor.modules.toc.fn.unhighlight( context ); |
2439 | | - }); |
2440 | | - |
2441 | 2440 | }, |
2442 | 2441 | |
2443 | 2442 | unhighlight: function( context ) { |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -99,8 +99,8 @@ |
100 | 100 | for(module in $.wikiEditor.modules){if('evt'in $.wikiEditor.modules[module]&&name in $.wikiEditor.modules[module].evt){$.wikiEditor.modules[module].evt[name](context,event);}}},'addButton':function(options){context.$controls.show();context.$buttons.show();return $('<button />').text($.wikiEditor.autoMsg(options,'caption')).click(options.action).appendTo(context.$buttons);},'addView':function(options){function addTab(options){context.$controls.show();context.$tabs.show();return $('<div></div>').attr('rel','wikiEditor-ui-view-'+options.name).addClass(context.view==options.name?'current':null).append($('<a></a>').attr('href','#').click(function(event){context.$ui.find('.wikiEditor-ui-view').hide();context.$ui.find('.'+$(this).parent().attr('rel')).show();context.$tabs.find('div').removeClass('current');$(this).parent().addClass('current');$(this).blur();if('init'in options&&typeof options.init=='function'){options.init(context);} |
101 | 101 | event.preventDefault();return false;}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);} |
102 | 102 | if(!context.$tabs.children().size()){addTab({'name':'wikitext','titleMsg':'wikieditor-wikitext-tab'});} |
103 | | -addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'setup':function(){var contentHTML=$('<div />').text(context.$textarea.val()).html();context.$iframe[0].contentWindow.document.open();context.$iframe[0].contentWindow.document.write('<html><head><title>wikiEditor</title><script>var context = window.parent.jQuery.wikiEditor.instances['+context.instance+'].data( "wikiEditor-context" ); window.parent.jQuery( document ).bind( "keydown keypress keyup mousedown mouseup cut paste", function( event ) { context.fn.trigger( "change", event ) } );</script></head><body style="margin:0;padding:0;width:100%;height:100%;white-space:pre-wrap;font-family:monospace">'+contentHTML+'</body></html>');context.$iframe[0].contentWindow.document.close();context.$iframe[0].contentWindow.document.designMode='on';context.$content=$(context.$iframe[0].contentWindow.document.body);if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');} |
104 | | -context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();},'isSetup':function(){return context.$content!=undefined&&context.$content[0].innerHTML!=undefined;},'getContents':function(){return $('<div />').html(context.$content.html().replace(/\<br\>/g,"\n")).text();},'setContents':function(options){context.$content.text(options.contents);return context.$textarea;},'getSelection':function(){var retval;if(context.$iframe[0].contentWindow.getSelection){retval=context.$iframe[0].contentWindow.getSelection();}else if(context.$iframe[0].contentWindow.document.selection){retval=context.$iframe[0].contentWindow.document.selection.createRange();} |
| 103 | +addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'setup':function(){context.$iframe[0].contentWindow.document.designMode='on';context.$content=$(context.$iframe[0].contentWindow.document.body);context.$content.html($('<div />').text(context.$textarea.val()).html());if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');} |
| 104 | +context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');},'isSetup':function(){return context.$content!=undefined&&context.$content[0].innerHTML!=undefined;},'getContents':function(){return $('<div />').html(context.$content.html().replace(/\<br\>/g,"\n")).text();},'setContents':function(options){context.$content.text(options.contents);return context.$textarea;},'getSelection':function(){var retval;if(context.$iframe[0].contentWindow.getSelection){retval=context.$iframe[0].contentWindow.getSelection();}else if(context.$iframe[0].contentWindow.document.selection){retval=context.$iframe[0].contentWindow.document.selection.createRange();} |
105 | 105 | if(retval.text){retval=retval.text;}else if(retval.toString){retval=retval.toString();} |
106 | 106 | return retval;},'encapsulateSelection':function(options){var selText=$(this).textSelection('getSelection');var selectAfter=false;var pre=options.pre,post=options.post;if(!selText){selText=options.peri;selectAfter=true;}else if(options.replace){selText=options.peri;}else if(selText.charAt(selText.length-1)==' '){selText=selText.substring(0,selText.length-1);post+=' ';} |
107 | 107 | var range=context.$iframe[0].contentWindow.getSelection().getRangeAt(0);if(options.ownline){if(range.startOffset!=0) |
— | — | @@ -113,7 +113,7 @@ |
114 | 114 | ec=ec.firstChild;sel.extend(sc,options.start);sel.collapseToStart();if(options.end!=options.start||sc!=ec) |
115 | 115 | sel.extend(ec,options.end);},'scrollToCaretPosition':function(options){},'scrollToTop':function($element,force){var body=context.$content.closest('body');var y=$element.offset().top-context.$content.offset().top;if(force||y<body.scrollTop()||y>body.scrollTop()+body.height()) |
116 | 116 | body.scrollTop(y);$element.trigger('scrollToTop');},'beforeSelection':function(selector,getAll){if(typeof selector=='undefined') |
117 | | -selector='*';var retval=[];var range=context.$iframe[0].contentWindow.getSelection().getRangeAt(0);var e=range.startContainer;}};context.$textarea.wrap($('<div></div>').addClass('wikiEditor-ui')).wrap($('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-wikitext')).wrap($('<div></div>').addClass('wikiEditor-ui-left')).wrap($('<div></div>').addClass('wikiEditor-ui-bottom')).wrap($('<div></div>').addClass('wikiEditor-ui-text'));context.$ui=context.$textarea.parent().parent().parent().parent().parent();context.$wikitext=context.$textarea.parent().parent().parent().parent();context.$wikitext.before($('<div></div>').addClass('wikiEditor-ui-controls').append($('<div></div>').addClass('wikiEditor-ui-tabs').hide()).append($('<div></div>').addClass('wikiEditor-ui-buttons'))).before($('<div style="clear:both;"></div>'));context.$controls=context.$ui.find('.wikiEditor-ui-buttons').hide();context.$buttons=context.$ui.find('.wikiEditor-ui-buttons');context.$tabs=context.$ui.find('.wikiEditor-ui-tabs');context.$ui.after($('<div style="clear:both;"></div>'));context.$wikitext.append($('<div></div>').addClass('wikiEditor-ui-right'));context.$wikitext.find('.wikiEditor-ui-left').prepend($('<div></div>').addClass('wikiEditor-ui-top'));context.view='wikitext';$(window).resize(function(event){context.fn.trigger('resize',event)});context.$iframe=$('<iframe></iframe>').attr('frameborder',0).css({'backgroundColor':'white','width':'100%','height':context.$textarea.height(),'display':'none','overflow-y':'scroll','overflow-x':'hidden',}).insertAfter(context.$textarea);setTimeout(function(){context.fn.setup();},1);context.$textarea.closest('form').submit(function(){context.$textarea.attr('disabled',false);context.$textarea.val(context.$textarea.textSelection('getContents'));});} |
| 117 | +selector='*';var retval=[];var range=context.$iframe[0].contentWindow.getSelection().getRangeAt(0);var e=range.startContainer;}};context.$textarea.wrap($('<div></div>').addClass('wikiEditor-ui')).wrap($('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-wikitext')).wrap($('<div></div>').addClass('wikiEditor-ui-left')).wrap($('<div></div>').addClass('wikiEditor-ui-bottom')).wrap($('<div></div>').addClass('wikiEditor-ui-text'));context.$ui=context.$textarea.parent().parent().parent().parent().parent();context.$wikitext=context.$textarea.parent().parent().parent().parent();context.$wikitext.before($('<div></div>').addClass('wikiEditor-ui-controls').append($('<div></div>').addClass('wikiEditor-ui-tabs').hide()).append($('<div></div>').addClass('wikiEditor-ui-buttons'))).before($('<div style="clear:both;"></div>'));context.$controls=context.$ui.find('.wikiEditor-ui-buttons').hide();context.$buttons=context.$ui.find('.wikiEditor-ui-buttons');context.$tabs=context.$ui.find('.wikiEditor-ui-tabs');context.$ui.after($('<div style="clear:both;"></div>'));context.$wikitext.append($('<div></div>').addClass('wikiEditor-ui-right'));context.$wikitext.find('.wikiEditor-ui-left').prepend($('<div></div>').addClass('wikiEditor-ui-top'));context.view='wikitext';$(window).resize(function(event){context.fn.trigger('resize',event)});var ts=(new Date()).getTime();var instance=context.instance;context.$iframe=$('<iframe></iframe>').attr({'frameborder':0,'src':wgScriptPath+'/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html?'+'instance='+context.instance+'&ts='+ts}).css({'backgroundColor':'white','width':'100%','height':context.$textarea.height(),'display':'none','overflow-y':'scroll','overflow-x':'hidden'}).insertAfter(context.$textarea).load(context.fn.setup);context.$textarea.closest('form').submit(function(){context.$textarea.attr('disabled',false);context.$textarea.val(context.$textarea.textSelection('getContents'));});} |
118 | 118 | if(arguments.length>0&&typeof arguments[0]=='object'){if(context.fn.isSetup()) |
119 | 119 | context.api.addModule(context,arguments[0]);else{var args=arguments;setTimeout(function(){context.api.addModule(context,args[0]);},2);}}else{arguments=$.makeArray(arguments);if(arguments.length>0){var call=arguments.shift();if(call in context.api){if(context.fn.isSetup()) |
120 | 120 | context.api[call](context,arguments[0]==undefined?{}:arguments[0]);else{var args=arguments;setTimeout(function(){context.api[call](context,args[0]==undefined?{}:args[0]);},2);}}}} |
— | — | @@ -126,7 +126,7 @@ |
127 | 127 | $(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.highlight={api:{},evt:{change:function(event){}},fn:{create:function(context,config){},divide:function(context){},isolate:function(context){return[];},strip:function(context,division){return $('<div />').html(division.html().replace(/\<br[^\>]*\>/g,"\n")).text();},scan:function(context,division){return[];},mark:function(context,division,tokens){}}};})(jQuery);(function($){$.wikiEditor.modules.preview={api:{},fn:{create:function(context,config){if('preview'in context.modules){return;} |
128 | 128 | context.modules.preview={'previousText':null};context.$preview=context.fn.addView({'name':'preview','titleMsg':'wikieditor-preview-tab','init':function(context){var wikitext=context.fn.getContents();if(context.modules.preview.previousText==wikitext){return;} |
129 | 129 | context.$preview.find('.wikiEditor-preview-contents').empty();context.$preview.find('.wikiEditor-preview-loading').show();$.post(wgScriptPath+'/api.php',{'action':'parse','title':wgPageName,'text':wikitext,'prop':'text','pst':'','format':'json'},function(data){if(typeof data.parse=='undefined'||typeof data.parse.text=='undefined'||typeof data.parse.text['*']=='undefined'){return;} |
130 | | -context.modules.preview.previousText=wikitext;context.$preview.find('.wikiEditor-preview-loading').hide();context.$preview.find('.wikiEditor-preview-contents').html(data.parse.text['*']).find('a:not([href^=#])').attr('href','#');},'json');}});var loadingMsg=gM('wikieditor-preview-loading');context.$preview.append($('<div />').addClass('wikiEditor-preview-loading').append($('<img />').addClass('wikiEditor-preview-spinner').attr({'src':$.wikiEditor.imgPath+'dialogs/loading.gif','valign':'absmiddle','alt':loadingMsg,'title':loadingMsg})).append($('<span></span>').text(loadingMsg))).append($('<div />').addClass('wikiEditor-preview-contents'));}}};})(jQuery);(function($){$.wikiEditor.modules.publish={api:{},fn:{create:function(context,config){var dialogID='wikiEditor-'+context.instance+'-dialog';$.wikiEditor.modules.dialogs.fn.create(context,{previewsave:{id:dialogID,titleMsg:'wikieditor-publish-dialog-title',html:'\ |
| 130 | +context.modules.preview.previousText=wikitext;context.$preview.find('.wikiEditor-preview-loading').hide();context.$preview.find('.wikiEditor-preview-contents').html(data.parse.text['*']).find('a:not([href^=#])').click(function(){return false;});},'json');}});var loadingMsg=gM('wikieditor-preview-loading');context.$preview.append($('<div />').addClass('wikiEditor-preview-loading').append($('<img />').addClass('wikiEditor-preview-spinner').attr({'src':$.wikiEditor.imgPath+'dialogs/loading.gif','valign':'absmiddle','alt':loadingMsg,'title':loadingMsg})).append($('<span></span>').text(loadingMsg))).append($('<div />').addClass('wikiEditor-preview-contents'));}}};})(jQuery);(function($){$.wikiEditor.modules.publish={api:{},fn:{create:function(context,config){var dialogID='wikiEditor-'+context.instance+'-dialog';$.wikiEditor.modules.dialogs.fn.create(context,{previewsave:{id:dialogID,titleMsg:'wikieditor-publish-dialog-title',html:'\ |
131 | 131 | <div class="wikiEditor-dialog-copywarn"></div>\ |
132 | 132 | <div class="wikiEditor-dialog-editoptions">\ |
133 | 133 | <form>\ |
— | — | @@ -150,8 +150,8 @@ |
151 | 151 | $('#wikiEditor-'+context.instance+'-dialog-minor').hide();else if($('#wpMinoredit').is(':checked')) |
152 | 152 | $('#wikiEditor-'+context.instance+'-dialog-minor').attr('checked','checked');if($('#wpWatchthis').size()==0) |
153 | 153 | $('#wikiEditor-'+context.instance+'-dialog-watch').hide();else if($('#wpWatchthis').is(':checked')) |
154 | | -$('#wikiEditor-'+context.instance+'-dialog-watch').attr('checked','checked');$(this).find('form').submit(function(e){$(this).closest('.ui-dialog').find('button:first').click();e.preventDefault();});},dialog:{buttons:{'wikieditor-publish-dialog-publish':function(){var minorChecked=$('#wikiEditor-'+context.instance+'-dialog-minor').is(':checked')?'checked':'';var watchChecked=$('#wikiEditor-'+context.instance+'-dialog-watch').is(':checked')?'checked':'';$('#wpMinoredit').attr('checked',minorChecked);$('#wpWatchthis').attr('checked',watchChecked);$('#wpSummary').val($j('#wikiEditor-'+context.instance+'-dialog-summary').val());$('#editform').submit();},'wikieditor-publish-dialog-goback':function(){$(this).dialog('close');}},open:function(){$('#wikiEditor-'+context.instance+'-dialog-summary').focus();},width:500},resizeme:false}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-publish','action':function(){$('#'+dialogID).dialog('open');return false;}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-cancel','action':function(){}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={api:{},defaultWidth:'166px',minimumWidth:'70px',fn:{create:function(context,config){if('$toc'in context.modules){return;} |
155 | | -var height=context.$ui.find('.wikiEditor-ui-left').height();context.modules.$toc=$('<div />').addClass('wikiEditor-ui-toc').data('context',context);context.$ui.find('.wikiEditor-ui-right').css('width',$.wikiEditor.modules.toc.defaultWidth).append(context.modules.$toc);context.modules.$toc.height(context.$ui.find('.wikiEditor-ui-left').height());context.$ui.find('.wikiEditor-ui-left').css('marginRight',"-"+$.wikiEditor.modules.toc.defaultWidth).children().css('marginRight',$.wikiEditor.modules.toc.defaultWidth);$.wikiEditor.modules.toc.fn.build(context,config);context.$content.parent().delayedBind(250,'mouseup scrollToTop keyup change',function(){$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).blur(function(event){var context=event.data.context;context.$textarea.delayedBindCancel(250,'mouseup scrollToTop keyup change');$.wikiEditor.modules.toc.fn.unhighlight(context);});},unhighlight:function(context){context.modules.$toc.find('div').removeClass('current');},update:function(context){$.wikiEditor.modules.toc.fn.unhighlight(context);var position=context.$textarea.textSelection('getCaretPosition');var section=0;if(context.data.outline.length>0){if(!(position<context.data.outline[0].position-1)){while(section<context.data.outline.length&&context.data.outline[section].position-1<position){section++;} |
| 154 | +$('#wikiEditor-'+context.instance+'-dialog-watch').attr('checked','checked');$(this).find('form').submit(function(e){$(this).closest('.ui-dialog').find('button:first').click();e.preventDefault();});},dialog:{buttons:{'wikieditor-publish-dialog-publish':function(){var minorChecked=$('#wikiEditor-'+context.instance+'-dialog-minor').is(':checked')?'checked':'';var watchChecked=$('#wikiEditor-'+context.instance+'-dialog-watch').is(':checked')?'checked':'';$('#wpMinoredit').attr('checked',minorChecked);$('#wpWatchthis').attr('checked',watchChecked);$('#wpSummary').val($j('#wikiEditor-'+context.instance+'-dialog-summary').val());$('#editform').submit();},'wikieditor-publish-dialog-goback':function(){$(this).dialog('close');}},open:function(){$('#wikiEditor-'+context.instance+'-dialog-summary').focus();},width:500},resizeme:false}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-publish','action':function(){$('#'+dialogID).dialog('open');return false;}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-cancel','action':function(){}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={defaultWidth:'166px',minimumWidth:'70px',api:{},evt:{ready:function(context,event){$.wikiEditor.modules.toc.fn.build(context);context.$content.parent().delayedBind(250,'mouseup scrollToTop keyup change',function(){$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).blur(function(event){var context=event.data.context;context.$textarea.delayedBindCancel(250,'mouseup scrollToTop keyup change');$.wikiEditor.modules.toc.fn.unhighlight(context);});}},fn:{create:function(context,config){if('$toc'in context.modules){return;} |
| 155 | +var height=context.$ui.find('.wikiEditor-ui-left').height();context.modules.$toc=$('<div />').addClass('wikiEditor-ui-toc').data('context',context);context.$ui.find('.wikiEditor-ui-right').css('width',$.wikiEditor.modules.toc.defaultWidth).append(context.modules.$toc);context.modules.$toc.height(context.$ui.find('.wikiEditor-ui-left').height());context.$ui.find('.wikiEditor-ui-left').css('marginRight',"-"+$.wikiEditor.modules.toc.defaultWidth).children().css('marginRight',$.wikiEditor.modules.toc.defaultWidth);},unhighlight:function(context){context.modules.$toc.find('div').removeClass('current');},update:function(context){$.wikiEditor.modules.toc.fn.unhighlight(context);var position=context.$textarea.textSelection('getCaretPosition');var section=0;if(context.data.outline.length>0){if(!(position<context.data.outline[0].position-1)){while(section<context.data.outline.length&&context.data.outline[section].position-1<position){section++;} |
156 | 156 | section=Math.max(0,section);} |
157 | 157 | var sectionLink=context.modules.$toc.find('div.section-'+section);sectionLink.addClass('current');var relTop=sectionLink.offset().top-context.modules.$toc.offset().top;var scrollTop=context.modules.$toc.scrollTop();var divHeight=context.modules.$toc.height();var sectionHeight=sectionLink.height();if(relTop<0) |
158 | 158 | context.modules.$toc.scrollTop(scrollTop+relTop);else if(relTop+sectionHeight>divHeight) |