Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -21,17 +21,17 @@ |
22 | 22 | array( 'src' => 'css/suggestions.css', 'version' => 6 ), |
23 | 23 | array( 'src' => 'css/wikiEditor.css', 'version' => 7 ), |
24 | 24 | array( 'src' => 'css/wikiEditor.toolbar.css', 'version' => 7 ), |
25 | | - array( 'src' => 'css/wikiEditor.dialogs.css', 'version' => 4 ), |
| 25 | + array( 'src' => 'css/wikiEditor.dialogs.css', 'version' => 5 ), |
26 | 26 | array( 'src' => 'css/wikiEditor.toc.css', 'version' => 23 ), |
27 | 27 | array( 'src' => 'css/wikiEditor.preview.css', 'version' => 1 ), |
28 | 28 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ), |
29 | 29 | ), |
30 | 30 | 'combined' => array( |
31 | | - array( 'src' => 'css/combined.css', 'version' => 32 ), |
| 31 | + array( 'src' => 'css/combined.css', 'version' => 33 ), |
32 | 32 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ), |
33 | 33 | ), |
34 | 34 | 'minified' => array( |
35 | | - array( 'src' => 'css/combined.min.css', 'version' => 32 ), |
| 35 | + array( 'src' => 'css/combined.min.css', 'version' => 33 ), |
36 | 36 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ), |
37 | 37 | ), |
38 | 38 | ) |
Index: trunk/extensions/UsabilityInitiative/css/wikiEditor.dialogs.css |
— | — | @@ -17,4 +17,10 @@ |
18 | 18 | .ui-dialog-content .status-invalid input { |
19 | 19 | border: 2px solid red; |
20 | 20 | padding: 2px 1px; |
| 21 | +} |
| 22 | + |
| 23 | +.ui-dialog .ui-dialog-buttonpane button.disabled { |
| 24 | + color: #7f7f7f; |
| 25 | + background: #f2f2f2; |
| 26 | + border-color: #cccccc; |
21 | 27 | } |
\ No newline at end of file |
Index: trunk/extensions/UsabilityInitiative/css/combined.css |
— | — | @@ -177,6 +177,12 @@ |
178 | 178 | .ui-dialog-content .status-invalid input { |
179 | 179 | border: 2px solid red; |
180 | 180 | padding: 2px 1px; |
| 181 | +} |
| 182 | + |
| 183 | +.ui-dialog .ui-dialog-buttonpane button.disabled { |
| 184 | + color: #7f7f7f; |
| 185 | + background: #f2f2f2; |
| 186 | + border-color: #cccccc; |
181 | 187 | }/* wikiEditor toc module */ |
182 | 188 | body.rtl .wikiEditor-ui-text { |
183 | 189 | border-right: none; |
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css |
— | — | @@ -167,6 +167,11 @@ |
168 | 168 | border:2px solid red; |
169 | 169 | padding:2px 1px; |
170 | 170 | } |
| 171 | +.ui-dialog .ui-dialog-buttonpane button.disabled{ |
| 172 | +color:#7f7f7f; |
| 173 | +background:#f2f2f2; |
| 174 | +border-color:#cccccc; |
| 175 | +} |
171 | 176 | body.rtl .wikiEditor-ui-text{ |
172 | 177 | border-right:none; |
173 | 178 | border-left:solid silver 1px; |
— | — | @@ -707,4 +712,4 @@ |
708 | 713 | .wikiEditor-preview-contents{ |
709 | 714 | padding:1em; |
710 | 715 | background-color:white; |
711 | | -} |
\ No newline at end of file |
| 716 | +} |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php |
— | — | @@ -16,14 +16,14 @@ |
17 | 17 | array( 'src' => 'Modules/Preview/Preview.js', 'version' => 3 ), |
18 | 18 | array( 'src' => 'Modules/Publish/Publish.js', 'version' => 2 ), |
19 | 19 | array( 'src' => 'Modules/Toc/Toc.js', 'version' => 2 ), |
20 | | - array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 13 ), |
| 20 | + array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 14 ), |
21 | 21 | array( 'src' => 'Modules/Toolbar/TemplateEditor.js', 'version' => 1 ), |
22 | 22 | ), |
23 | 23 | 'combined' => array( |
24 | | - array( 'src' => 'WikiEditor.combined.js', 'version' => 11 ), |
| 24 | + array( 'src' => 'WikiEditor.combined.js', 'version' => 12 ), |
25 | 25 | ), |
26 | 26 | 'minified' => array( |
27 | | - array( 'src' => 'WikiEditor.combined.min.js', 'version' => 11 ), |
| 27 | + array( 'src' => 'WikiEditor.combined.min.js', 'version' => 12 ), |
28 | 28 | ), |
29 | 29 | ); |
30 | 30 | static $messages = array( |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js |
— | — | @@ -937,6 +937,15 @@ |
938 | 938 | $j( '#wikieditor-toolbar-link-int-target-status-' + status ).show(); |
939 | 939 | $j( '#wikieditor-toolbar-link-int-target' ).parent().addClass( 'status-' + status ); |
940 | 940 | } |
| 941 | + if ( status == 'invalid' ) { |
| 942 | + $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' ) |
| 943 | + .attr('disabled', true) |
| 944 | + .addClass('disabled'); |
| 945 | + } else { |
| 946 | + $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' ) |
| 947 | + .removeAttr('disabled') |
| 948 | + .removeClass('disabled'); |
| 949 | + } |
941 | 950 | } |
942 | 951 | // Abort previous request |
943 | 952 | var request = $j( '#wikieditor-toolbar-link-int-target-status' ).data( 'request' ); |
— | — | @@ -1234,7 +1243,7 @@ |
1235 | 1244 | insertText = '[' + escTarget + ' ' + escText + ']'; |
1236 | 1245 | } |
1237 | 1246 | // Preserve whitespace in selection when replacing |
1238 | | - insertText = whitespace[0] + insertText + whitespace[1]; |
| 1247 | + if ( whitespace ) insertText = whitespace[0] + insertText + whitespace[1]; |
1239 | 1248 | $j.wikiEditor.modules.toolbar.fn.doAction( $j(this).data( 'context' ), { |
1240 | 1249 | type: 'replace', |
1241 | 1250 | options: { |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js |
— | — | @@ -33,7 +33,8 @@ |
34 | 34 | </tr>\ |
35 | 35 | </table></fieldset>',init:function(){function isExternalLink(s){if(typeof arguments.callee.regex=='undefined'){arguments.callee.regex=new RegExp("(^("+urlprotocols+"))|(^www\\.)|([^.]\\.[a-z]{2,}($|\\/))",'i');} |
36 | 36 | return s.match(arguments.callee.regex);} |
37 | | -function updateExistence(){function updateWidget(status){$j('#wikieditor-toolbar-link-int-target-status').children().hide();$j('#wikieditor-toolbar-link-int-target').parent().removeClass('status-invalid status-external status-notexists status-exists status-loading');if(status){$j('#wikieditor-toolbar-link-int-target-status-'+status).show();$j('#wikieditor-toolbar-link-int-target').parent().addClass('status-'+status);}} |
| 37 | +function updateExistence(){function updateWidget(status){$j('#wikieditor-toolbar-link-int-target-status').children().hide();$j('#wikieditor-toolbar-link-int-target').parent().removeClass('status-invalid status-external status-notexists status-exists status-loading');if(status){$j('#wikieditor-toolbar-link-int-target-status-'+status).show();$j('#wikieditor-toolbar-link-int-target').parent().addClass('status-'+status);} |
| 38 | +if(status=='invalid'){$j('.ui-dialog:visible .ui-dialog-buttonpane button:first').attr('disabled',true).addClass('disabled');}else{$j('.ui-dialog:visible .ui-dialog-buttonpane button:first').removeAttr('disabled').removeClass('disabled');}} |
38 | 39 | var request=$j('#wikieditor-toolbar-link-int-target-status').data('request');if(request){request.abort();} |
39 | 40 | var target=$j('#wikieditor-toolbar-link-int-target').val();var cache=$j('#wikieditor-toolbar-link-int-target-status').data('existencecache');if(cache[target]){updateWidget(cache[target]);return;} |
40 | 41 | if(target==''){updateWidget(false);return;} |
— | — | @@ -68,7 +69,7 @@ |
69 | 70 | insertText=escTarget;else if(text=='') |
70 | 71 | insertText='['+escTarget+']';else |
71 | 72 | insertText='['+escTarget+' '+escText+']';} |
72 | | -insertText=whitespace[0]+insertText+whitespace[1];$j.wikiEditor.modules.toolbar.fn.doAction($j(this).data('context'),{type:'replace',options:{pre:insertText}},$j(this));$j('#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text').val('');$j('#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext').attr('checked','');$j(this).dialog('close');},'wikieditor-toolbar-tool-link-cancel':function(){$j(this).dialog('close');}},open:function(){$j(this).data('articlePathRegex',new RegExp('^'+RegExp.escape(wgServer+wgArticlePath).replace(/\\\$1/g,'(.*)')+'$'));var selection=$j(this).data('context').$textarea.textSelection('getSelection');$j('#wikieditor-toolbar-link-int-target').focus();$j('#wikieditor-toolbar-link-dialog').data('whitespace',['','']);if(selection!=''){var target,text,type;var matches;if((matches=selection.match(/^(\s*)\[\[([^\]\|]+)(\|([^\]\|]*))?\]\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:matches[2]);type='int';$j('#wikieditor-toolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else if((matches=selection.match(/^(\s*)\[([^\] ]+)( ([^\]]+))?\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:'');type='ext';$j('#wikieditor-toolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else{target=text=selection;} |
| 73 | +if(whitespace)insertText=whitespace[0]+insertText+whitespace[1];$j.wikiEditor.modules.toolbar.fn.doAction($j(this).data('context'),{type:'replace',options:{pre:insertText}},$j(this));$j('#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text').val('');$j('#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext').attr('checked','');$j(this).dialog('close');},'wikieditor-toolbar-tool-link-cancel':function(){$j(this).dialog('close');}},open:function(){$j(this).data('articlePathRegex',new RegExp('^'+RegExp.escape(wgServer+wgArticlePath).replace(/\\\$1/g,'(.*)')+'$'));var selection=$j(this).data('context').$textarea.textSelection('getSelection');$j('#wikieditor-toolbar-link-int-target').focus();$j('#wikieditor-toolbar-link-dialog').data('whitespace',['','']);if(selection!=''){var target,text,type;var matches;if((matches=selection.match(/^(\s*)\[\[([^\]\|]+)(\|([^\]\|]*))?\]\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:matches[2]);type='int';$j('#wikieditor-toolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else if((matches=selection.match(/^(\s*)\[([^\] ]+)( ([^\]]+))?\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:'');type='ext';$j('#wikieditor-toolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else{target=text=selection;} |
73 | 74 | if(typeof text!='undefined') |
74 | 75 | $j('#wikieditor-toolbar-link-int-text').val(text).change();if(typeof target!='undefined') |
75 | 76 | $j('#wikieditor-toolbar-link-int-target').val(target).change();if(typeof type!='undefined') |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js |
— | — | @@ -889,6 +889,15 @@ |
890 | 890 | $j( '#wikieditor-toolbar-link-int-target-status-' + status ).show(); |
891 | 891 | $j( '#wikieditor-toolbar-link-int-target' ).parent().addClass( 'status-' + status ); |
892 | 892 | } |
| 893 | + if ( status == 'invalid' ) { |
| 894 | + $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' ) |
| 895 | + .attr('disabled', true) |
| 896 | + .addClass('disabled'); |
| 897 | + } else { |
| 898 | + $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' ) |
| 899 | + .removeAttr('disabled') |
| 900 | + .removeClass('disabled'); |
| 901 | + } |
893 | 902 | } |
894 | 903 | // Abort previous request |
895 | 904 | var request = $j( '#wikieditor-toolbar-link-int-target-status' ).data( 'request' ); |
— | — | @@ -1186,7 +1195,7 @@ |
1187 | 1196 | insertText = '[' + escTarget + ' ' + escText + ']'; |
1188 | 1197 | } |
1189 | 1198 | // Preserve whitespace in selection when replacing |
1190 | | - insertText = whitespace[0] + insertText + whitespace[1]; |
| 1199 | + if ( whitespace ) insertText = whitespace[0] + insertText + whitespace[1]; |
1191 | 1200 | $j.wikiEditor.modules.toolbar.fn.doAction( $j(this).data( 'context' ), { |
1192 | 1201 | type: 'replace', |
1193 | 1202 | options: { |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -1526,28 +1526,32 @@ |
1527 | 1527 | /* Event Handlers */ |
1528 | 1528 | context.evt = { |
1529 | 1529 | 'change': function( event ) { |
1530 | | - // BTW: context is in event.data.context |
1531 | | - |
1532 | 1530 | switch ( event.type ) { |
1533 | 1531 | case 'keypress': |
1534 | | - if ( /* something interesting was deleted */ false ) { |
1535 | | - //console.log( 'MAJOR CHANGE' ); |
| 1532 | + if ( /* TODO: test if something interesting was deleted */ true ) { |
| 1533 | + event.data.scope = 'division'; |
1536 | 1534 | } else { |
1537 | | - //console.log( 'MINOR CHANGE' ); |
| 1535 | + event.data.scope = 'character'; |
1538 | 1536 | } |
1539 | 1537 | break; |
1540 | 1538 | case 'mousedown': // FIXME: mouseup? |
1541 | | - if ( /* text was dragged and dropped */ false ) { |
1542 | | - //console.log( 'MAJOR CHANGE' ); |
| 1539 | + if ( /* TODO: test if text was dragged and dropped */ true ) { |
| 1540 | + event.data.scope = 'division'; |
1543 | 1541 | } else { |
1544 | | - //console.log( 'MINOR CHANGE' ); |
| 1542 | + event.data.scope = 'none'; |
1545 | 1543 | } |
1546 | 1544 | break; |
1547 | 1545 | default: |
1548 | | - //console.log( 'MAJOR CHANGE' ); |
| 1546 | + event.data.scope = 'division'; |
1549 | 1547 | break; |
1550 | 1548 | } |
1551 | | - |
| 1549 | + if ( event.data.scope !== 'none' ) { |
| 1550 | + for ( module in $.wikiEditor.modules ) { |
| 1551 | + if ( 'evt' in $.wikiEditor.modules[module] && 'change' in $.wikiEditor.modules[module].evt ) { |
| 1552 | + $.wikiEditor.modules[module].evt.change( context, event ); |
| 1553 | + } |
| 1554 | + } |
| 1555 | + } |
1552 | 1556 | } |
1553 | 1557 | }; |
1554 | 1558 | |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -90,9 +90,10 @@ |
91 | 91 | src=path+src;return src+'?'+wgWikiEditorIconVersion;},'fixOperaBrokenness':function(s){return s;}};$.fn.wikiEditor=function(){if($j.wikiEditor.isSupportKnown()&&!$j.wikiEditor.isSupported()){return $(this);} |
92 | 92 | var context=$(this).data('wikiEditor-context');if(typeof context=='undefined'){var instance=$.wikiEditor.instances.length;context={'$textarea':$(this),'views':{},'modules':{},'data':{},'instance':instance};$.wikiEditor.instances[instance]=$(this);context.api={'addModule':function(context,data){function callModuleApi(module,call,data){if(module in $.wikiEditor.modules&&'fn'in $.wikiEditor.modules[module]&&call in $.wikiEditor.modules[module].fn){$.wikiEditor.modules[module].fn[call](context,data);}} |
93 | 93 | if(typeof data=='string'){callModuleApi(data,'create',{});}else if(typeof data=='object'){for(module in data){if(typeof module=='string'){callModuleApi(module,'create',data[module]);}}}}};for(module in $.wikiEditor.modules){if('api'in $.wikiEditor.modules[module]){for(call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}}} |
94 | | -context.evt={'change':function(event){switch(event.type){case'keypress':if(false){}else{} |
95 | | -break;case'mousedown':if(false){}else{} |
96 | | -break;default:break;}}};context.fn={'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);} |
| 94 | +context.evt={'change':function(event){switch(event.type){case'keypress':if(true){event.data.scope='division';}else{event.data.scope='character';} |
| 95 | +break;case'mousedown':if(true){event.data.scope='division';}else{event.data.scope='none';} |
| 96 | +break;default:event.data.scope='division';break;} |
| 97 | +if(event.data.scope!=='none'){for(module in $.wikiEditor.modules){if('evt'in $.wikiEditor.modules[module]&&'change'in $.wikiEditor.modules[module].evt){$.wikiEditor.modules[module].evt.change(context,event);}}}}};context.fn={'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);} |
97 | 98 | event.preventDefault();return false;}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);} |
98 | 99 | if(!context.$tabs.children().size()){addTab({'name':'wikitext','titleMsg':'wikieditor-wikitext-tab'});} |
99 | 100 | 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", { "context": context }, context.evt.change );</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');} |