Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -68,7 +68,7 @@ |
69 | 69 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 16 ), |
70 | 70 | array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 12 ), |
71 | 71 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 12 ), |
72 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 5 ), |
| 72 | + array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 6 ), |
73 | 73 | array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 21 ), |
74 | 74 | ), |
75 | 75 | 'combined' => array( |
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.hooks.php |
— | — | @@ -59,6 +59,9 @@ |
60 | 60 | 'edittoolbar-tool-link-int-target-status-invalid', |
61 | 61 | 'edittoolbar-tool-link-int-target-status-loading', |
62 | 62 | 'edittoolbar-tool-link-int-invalid', |
| 63 | + 'edittoolbar-tool-link-lookslikeinternal', |
| 64 | + 'edittoolbar-tool-link-lookslikeinternal-int', |
| 65 | + 'edittoolbar-tool-link-lookslikeinternal-ext', |
63 | 66 | 'edittoolbar-tool-file', |
64 | 67 | 'edittoolbar-tool-file-pre', |
65 | 68 | 'edittoolbar-tool-file-example', |
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js |
— | — | @@ -1005,12 +1005,35 @@ |
1006 | 1006 | else |
1007 | 1007 | insertText = '[[' + target + '|' + escapeInternalText( text ) + ']]'; |
1008 | 1008 | } else { |
| 1009 | + // Prepend http:// if there is no protocol |
| 1010 | + if ( !target.match( /^[a-z]+:\/\/./ ) ) |
| 1011 | + target = 'http://' + target; |
| 1012 | + |
| 1013 | + // Detect if this is really an internal link in disguise |
| 1014 | + var match = target.match( $j(this).data( 'articlePathRegex' ) ); |
| 1015 | + if ( match && !$j(this).data( 'ignoreLooksInternal' ) ) { |
| 1016 | + var buttons = { }; |
| 1017 | + var that = this; |
| 1018 | + buttons[ gM( 'edittoolbar-tool-link-lookslikeinternal-int' ) ] = function() { |
| 1019 | + $j( '#edittoolbar-link-int-target' ).val( match[1] ).change(); |
| 1020 | + $j(this).dialog( 'close' ); |
| 1021 | + }; |
| 1022 | + buttons[ gM( 'edittoolbar-tool-link-lookslikeinternal-ext' ) ] = function() { |
| 1023 | + $j(that).data( 'ignoreLooksInternal', true ); |
| 1024 | + $j(that).closest( '.ui-dialog' ).find( 'button:first' ).click(); |
| 1025 | + $j(that).data( 'ignoreLooksInternal', false ); |
| 1026 | + $j(this).dialog( 'close' ); |
| 1027 | + }; |
| 1028 | + $j.wikiEditor.modules.dialogs.quickDialog( |
| 1029 | + gM( 'edittoolbar-tool-link-lookslikeinternal', match[1] ), |
| 1030 | + { buttons: buttons } |
| 1031 | + ); |
| 1032 | + return; |
| 1033 | + } |
| 1034 | + |
1009 | 1035 | var escTarget = escapeExternalTarget( target ); |
1010 | 1036 | var escText = escapeExternalText( text ); |
1011 | | - // Prepend http:// if there is no protocol |
1012 | | - if ( !escTarget.match( /^[a-z]+:\/\/./ ) ) { |
1013 | | - escTarget = 'http://' + escTarget; |
1014 | | - } |
| 1037 | + |
1015 | 1038 | if ( escTarget == escText ) |
1016 | 1039 | insertText = escTarget; |
1017 | 1040 | else if ( text == '' ) |
— | — | @@ -1033,6 +1056,12 @@ |
1034 | 1057 | } |
1035 | 1058 | }, |
1036 | 1059 | open: function() { |
| 1060 | + // Cache the articlepath regex |
| 1061 | + $j(this).data( 'articlePathRegex', new RegExp( |
| 1062 | + '^' + RegExp.escape( wgServer + wgArticlePath ) |
| 1063 | + .replace( /\\\$1/g, '(.*)' ) + '$' |
| 1064 | + ) ); |
| 1065 | + |
1037 | 1066 | $j( '#edittoolbar-link-int-target' ).focus(); |
1038 | 1067 | // Pre-fill the text fields based on the current selection |
1039 | 1068 | var selection = $j(this).data( 'context' ).$textarea.getSelection(); |
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.i18n.php |
— | — | @@ -41,6 +41,9 @@ |
42 | 42 | 'edittoolbar-tool-link-int-target-status-invalid' => 'Invalid title', |
43 | 43 | 'edittoolbar-tool-link-int-target-status-loading' => 'Checking page existence...', |
44 | 44 | 'edittoolbar-tool-link-int-invalid' => 'The title you specified is invalid.', |
| 45 | + 'edittoolbar-tool-link-lookslikeinternal' => 'The URL you specified looks like it was intended as a link to another wiki page. Do you want to make it an internal link?', |
| 46 | + 'edittoolbar-tool-link-lookslikeinternal-int' => 'Internal link', |
| 47 | + 'edittoolbar-tool-link-lookslikeinternal-ext' => 'External link', |
45 | 48 | 'edittoolbar-tool-file' => 'Embedded file', |
46 | 49 | 'edittoolbar-tool-file-pre' => '$1{{ns:file}}:', |
47 | 50 | 'edittoolbar-tool-file-example' => 'Example.jpg', |
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.php |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | /* Configuration */ |
21 | 21 | |
22 | 22 | // Bump the version number every time you change any of the .css/.js files |
23 | | -$wgEditToolbarStyleVersion = 59; |
| 23 | +$wgEditToolbarStyleVersion = 60; |
24 | 24 | |
25 | 25 | // Set this to true to simply override the stock toolbar for everyone |
26 | 26 | $wgEditToolbarGlobalEnable = false; |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.dialogs.js |
— | — | @@ -137,6 +137,16 @@ |
138 | 138 | }); |
139 | 139 | } |
140 | 140 | }, |
141 | | -'modules': {} |
| 141 | +modules: {}, |
| 142 | +quickDialog: function( body, settings ) { |
| 143 | + $( '<div />' ) |
| 144 | + .text( body ) |
| 145 | + .appendTo( $( 'body' ) ) |
| 146 | + .dialog( $.extend( { |
| 147 | + bgiframe: true, |
| 148 | + modal: true |
| 149 | + }, settings ) ) |
| 150 | + .dialog( 'open' ); |
| 151 | +} |
142 | 152 | |
143 | 153 | }; } ) ( jQuery ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -263,11 +263,11 @@ |
264 | 264 | collapsible: 'li.collapsible', |
265 | 265 | shifting: false, |
266 | 266 | expandCondition: function(eleWidth) { |
267 | | - return ( $('#left-navigation').position().left + $('#left-navigation').width() - 4) |
| 267 | + return ( $('#left-navigation').position().left + $('#left-navigation').width()) |
268 | 268 | < ($('#right-navigation').position().left - eleWidth); |
269 | 269 | }, |
270 | 270 | collapseCondition: function() { |
271 | | - return ( $('#left-navigation').position().left + $('#left-navigation').width() + 4) |
| 271 | + return ( $('#left-navigation').position().left + $('#left-navigation').width()) |
272 | 272 | > $('#right-navigation').position().left; |
273 | 273 | } |
274 | 274 | }, |
— | — | @@ -1609,7 +1609,17 @@ |
1610 | 1610 | }); |
1611 | 1611 | } |
1612 | 1612 | }, |
1613 | | -'modules': {} |
| 1613 | +modules: {}, |
| 1614 | +quickDialog: function( body, settings ) { |
| 1615 | + $( '<div />' ) |
| 1616 | + .text( body ) |
| 1617 | + .appendTo( $( 'body' ) ) |
| 1618 | + .dialog( $.extend( { |
| 1619 | + bgiframe: true, |
| 1620 | + modal: true |
| 1621 | + }, settings ) ) |
| 1622 | + .dialog( 'open' ); |
| 1623 | +} |
1614 | 1624 | |
1615 | 1625 | }; } ) ( jQuery ); |
1616 | 1626 | /** |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | $text.attr('title',text);}});};})(jQuery);(function($){$.browserTest=function(a,z){var u='unknown',x='X',m=function(r,h){for(var i=0;i<h.length;i=i+1){r=r.replace(h[i][0],h[i][1]);} |
20 | 20 | return r;},c=function(i,a,b,c){var r={name:m((a.exec(i)||[u,u])[1],b)};r[r.name]=true;r.version=(c.exec(i)||[x,x,x,x])[3];if(r.name.match(/safari/)&&r.version>400){r.version='2.0';} |
21 | 21 | if(r.name==='presto'){r.version=($.browser.version>9.27)?'futhark':'linear_b';} |
22 | | -r.versionNumber=parseFloat(r.version,10)||0;r.versionX=(r.version!==x)?(r.version+'').substr(0,1):x;r.className=r.name+r.versionX;return r;};a=(a.match(/Opera|Navigator|Minefield|KHTML|Chrome/)?m(a,[[/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/,''],['Chrome Safari','Chrome'],['KHTML','Konqueror'],['Minefield','Firefox'],['Navigator','Netscape']]):a).toLowerCase();$.browser=$.extend((!z)?$.browser:{},c(a,/(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari)/,[],/(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari)(\/|\s)([a-z0-9\.\+]*?)(\;|dev|rel|\s|$)/));$.layout=c(a,/(gecko|konqueror|msie|opera|webkit)/,[['konqueror','khtml'],['msie','trident'],['opera','presto']],/(applewebkit|rv|konqueror|msie)(\:|\/|\s)([a-z0-9\.]*?)(\;|\)|\s)/);$.os={name:(/(win|mac|linux|sunos|solaris|iphone)/.exec(navigator.platform.toLowerCase())||[u])[0].replace('sunos','solaris')};if(!z){$('html').addClass([$.os.name,$.browser.name,$.browser.className,$.layout.name,$.layout.className].join(' '));}};$.browserTest(navigator.userAgent);})(jQuery);(function($){$.fn.collapsibleTabs=function($$options){if(!this.length)return this;var $settings=$.extend({},$.collapsibleTabs.defaults,$$options);this.each(function(){var $this=$(this);$.collapsibleTabs.instances=($.collapsibleTabs.instances.length==0?$this:$.collapsibleTabs.instances.add($this));$this.data('collapsibleTabsSettings',$settings);$this.children($settings.collapsible).each(function(){var $collapsible=$(this);$collapsible.data('collapsibleTabsSettings',{'expandedContainer':$settings.expandedContainer,'collapsedContainer':$settings.collapsedContainer,'expandedWidth':$collapsible.width(),'prevElement':$collapsible.prev()});});});if(!$.collapsibleTabs.boundEvent)$(window).delayedBind('500','resize',function(){$.collapsibleTabs.handleResize();});$.collapsibleTabs.handleResize();return this;};$.collapsibleTabs={instances:[],boundEvent:null,defaults:{expandedContainer:'#p-views ul',collapsedContainer:'#p-cactions ul',collapsible:'li.collapsible',shifting:false,expandCondition:function(eleWidth){return($('#left-navigation').position().left+$('#left-navigation').width()-4)<($('#right-navigation').position().left-eleWidth);},collapseCondition:function(){return($('#left-navigation').position().left+$('#left-navigation').width()+4)>$('#right-navigation').position().left;}},handleResize:function(e){$.collapsibleTabs.instances.each(function(){var $this=$(this),data=$this.data('collapsibleTabsSettings');if(data.shifting)return;if($this.children(data.collapsible).length>0&&data.collapseCondition()){$this.trigger("beforeTabCollapse");$.collapsibleTabs.moveToCollapsed($this.children(data.collapsible+':last'));} |
| 22 | +r.versionNumber=parseFloat(r.version,10)||0;r.versionX=(r.version!==x)?(r.version+'').substr(0,1):x;r.className=r.name+r.versionX;return r;};a=(a.match(/Opera|Navigator|Minefield|KHTML|Chrome/)?m(a,[[/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/,''],['Chrome Safari','Chrome'],['KHTML','Konqueror'],['Minefield','Firefox'],['Navigator','Netscape']]):a).toLowerCase();$.browser=$.extend((!z)?$.browser:{},c(a,/(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari)/,[],/(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari)(\/|\s)([a-z0-9\.\+]*?)(\;|dev|rel|\s|$)/));$.layout=c(a,/(gecko|konqueror|msie|opera|webkit)/,[['konqueror','khtml'],['msie','trident'],['opera','presto']],/(applewebkit|rv|konqueror|msie)(\:|\/|\s)([a-z0-9\.]*?)(\;|\)|\s)/);$.os={name:(/(win|mac|linux|sunos|solaris|iphone)/.exec(navigator.platform.toLowerCase())||[u])[0].replace('sunos','solaris')};if(!z){$('html').addClass([$.os.name,$.browser.name,$.browser.className,$.layout.name,$.layout.className].join(' '));}};$.browserTest(navigator.userAgent);})(jQuery);(function($){$.fn.collapsibleTabs=function($$options){if(!this.length)return this;var $settings=$.extend({},$.collapsibleTabs.defaults,$$options);this.each(function(){var $this=$(this);$.collapsibleTabs.instances=($.collapsibleTabs.instances.length==0?$this:$.collapsibleTabs.instances.add($this));$this.data('collapsibleTabsSettings',$settings);$this.children($settings.collapsible).each(function(){var $collapsible=$(this);$collapsible.data('collapsibleTabsSettings',{'expandedContainer':$settings.expandedContainer,'collapsedContainer':$settings.collapsedContainer,'expandedWidth':$collapsible.width(),'prevElement':$collapsible.prev()});});});if(!$.collapsibleTabs.boundEvent)$(window).delayedBind('500','resize',function(){$.collapsibleTabs.handleResize();});$.collapsibleTabs.handleResize();return this;};$.collapsibleTabs={instances:[],boundEvent:null,defaults:{expandedContainer:'#p-views ul',collapsedContainer:'#p-cactions ul',collapsible:'li.collapsible',shifting:false,expandCondition:function(eleWidth){return($('#left-navigation').position().left+$('#left-navigation').width())<($('#right-navigation').position().left-eleWidth);},collapseCondition:function(){return($('#left-navigation').position().left+$('#left-navigation').width())>$('#right-navigation').position().left;}},handleResize:function(e){$.collapsibleTabs.instances.each(function(){var $this=$(this),data=$this.data('collapsibleTabsSettings');if(data.shifting)return;if($this.children(data.collapsible).length>0&&data.collapseCondition()){$this.trigger("beforeTabCollapse");$.collapsibleTabs.moveToCollapsed($this.children(data.collapsible+':last'));} |
23 | 23 | if($(data.collapsedContainer+' '+data.collapsible).length>0&&data.expandCondition($(data.collapsedContainer).children(data.collapsible+":first").data('collapsibleTabsSettings').expandedWidth)){$this.trigger("beforeTabExpand");$.collapsibleTabs.moveToExpanded(data.collapsedContainer+" "+data.collapsible+':first');}});},moveToCollapsed:function(ele){var $moving=$(ele);var data=$moving.data('collapsibleTabsSettings');$(data.expandedContainer).data('collapsibleTabsSettings').shifting=true;$moving.remove().prependTo(data.collapsedContainer).data('collapsibleTabsSettings',data);$(data.expandedContainer).data('collapsibleTabsSettings').shifting=false;$.collapsibleTabs.handleResize();},moveToExpanded:function(ele){var $moving=$(ele);var data=$moving.data('collapsibleTabsSettings');$(data.expandedContainer).data('collapsibleTabsSettings').shifting=true;$moving.remove().insertAfter(data.prevElement).data('collapsibleTabsSettings',data);$(data.expandedContainer).data('collapsibleTabsSettings').shifting=false;$.collapsibleTabs.handleResize();}};})(jQuery);jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;} |
24 | 24 | var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;} |
25 | 25 | expires='; expires='+date.toUTCString();} |
— | — | @@ -93,7 +93,7 @@ |
94 | 94 | configuration.newButtons[gM(msg)]=configuration.buttons[msg];configuration.buttons=configuration.newButtons;$('<div /> ').attr('id',module.id).html(module.html).data('context',context).appendTo($('body')).each(module.init).dialog(configuration).bind('dialogopen',$.wikiEditor.modules.dialogs.fn.resize).find('.ui-tabs').bind('tabsshow',function(){$(this).closest('.ui-dialog-content').each($.wikiEditor.modules.dialogs.fn.resize);});var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI) |
95 | 95 | maxTI=ti;});var tabIndex=maxTI+1;$j('.ui-dialog input, .ui-dialog button').not('[tabindex]').each(function(){$j(this).attr('tabindex',tabIndex++);});}}});},resize:function(){var wrapper=$(this).closest('.ui-dialog');var oldWidth=wrapper.width();var oldHidden=$(this).find('*').not(':visible');oldHidden.each(function(){$(this).data('oldstyle',$(this).attr('style'));});oldHidden.show();var oldWS=$(this).css('white-space');$(this).css('white-space','nowrap');if(wrapper.width()<=$(this).get(0).scrollWidth){$(this).width($(this).get(0).scrollWidth);wrapper.width(wrapper.get(0).scrollWidth);$(this).dialog({'width':wrapper.width()});wrapper.css('left',parseInt(wrapper.css('left'))- |
96 | 96 | (wrapper.width()-oldWidth)/2);} |
97 | | -$(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});}},'modules':{}};})(jQuery);(function($){$.wikiEditor.modules.toolbar={api:{addToToolbar:function(context,data){for(type in data){switch(type){case'sections':var $sections=context.modules.$toolbar.find('div.sections');var $tabs=context.modules.$toolbar.find('div.tabs');for(section in data[type]){if(section=='main'){context.modules.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));continue;} |
| 97 | +$(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.toolbar={api:{addToToolbar:function(context,data){for(type in data){switch(type){case'sections':var $sections=context.modules.$toolbar.find('div.sections');var $tabs=context.modules.$toolbar.find('div.tabs');for(section in data[type]){if(section=='main'){context.modules.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));continue;} |
98 | 98 | $sections.append($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));$tabs.append($.wikiEditor.modules.toolbar.fn.buildTab(context,section,data[type][section]));$section=$sections.find('.section:visible');if($section.size()){$sections.animate({'height':$section.outerHeight()},'fast');}} |
99 | 99 | break;case'groups':if(!('section'in data)){continue;} |
100 | 100 | var $section=context.modules.$toolbar.find('div[rel='+data.section+'].section');for(group in data[type]){$section.append($.wikiEditor.modules.toolbar.fn.buildGroup(context,group,data[type][group]));} |