Index: trunk/extensions/UsabilityInitiative/css/wikiEditor.css |
— | — | @@ -26,20 +26,18 @@ |
27 | 27 | width: 100%; |
28 | 28 | line-height: 1em; |
29 | 29 | background-color: #f3f3f3; |
| 30 | + border: solid silver 1px; |
30 | 31 | } |
31 | 32 | body.rtl .wikiEditor-ui { |
32 | 33 | float: right; |
33 | 34 | } |
34 | 35 | .wikiEditor-ui .wikiEditor-ui-bottom { |
35 | | - position: relative; |
36 | | - border: solid silver 1px; |
37 | | - border-top-width: 0; |
38 | 36 | width: 100%; |
39 | 37 | } |
40 | 38 | .wikiEditor-ui .wikiEditor-ui-top { |
41 | 39 | position: relative; |
42 | | - border: solid silver 1px; |
43 | 40 | width: 100%; |
| 41 | + border-bottom: solid silver 1px; |
44 | 42 | } |
45 | 43 | .ui-dialog-content fieldset table td { |
46 | 44 | padding: 0.25em; |
Index: trunk/extensions/UsabilityInitiative/css/wikiEditor.toolbar.css |
— | — | @@ -18,16 +18,11 @@ |
19 | 19 | display: none; |
20 | 20 | float: left; |
21 | 21 | width: 100%; |
22 | | - margin-left: -1px; |
23 | | - border-left: solid silver 1px; |
24 | | - border-right: solid silver 1px; |
25 | 22 | border-top: solid 1px #DDDDDD; |
26 | 23 | background-color: #F3F3F3; |
27 | 24 | } |
28 | 25 | body.rtl .wikiEditor-ui-toolbar .sections .section { |
29 | 26 | float: right; |
30 | | - margin-left: auto; |
31 | | - margin-right: -1px; |
32 | 27 | } |
33 | 28 | .wikiEditor-ui-toolbar .sections .loading { |
34 | 29 | padding-top: 0.5em; |
Index: trunk/extensions/UsabilityInitiative/css/wikiEditor.toc.css |
— | — | @@ -1,19 +1,22 @@ |
2 | 2 | /* wikiEditor toc module */ |
3 | 3 | |
| 4 | +.wikiEditor-ui-text { |
| 5 | + border-right: solid silver 1px; |
| 6 | +} |
| 7 | +body.rtl .wikiEditor-ui-text { |
| 8 | + border-right: none; |
| 9 | + border-left: solid silver 1px; |
| 10 | +} |
4 | 11 | .wikiEditor-ui-toc { |
5 | | - /* width is set dynamically */ |
6 | | - position: absolute; |
7 | | - right: -1px; |
8 | | - top: 0; |
| 12 | + /* height and width are set dynamically */ |
| 13 | + float: right; |
9 | 14 | padding: 0; |
10 | | - border-left: solid silver 1px; |
11 | 15 | overflow: auto; |
12 | 16 | } |
13 | 17 | body.rtl .wikiEditor-ui-toc { |
14 | 18 | right: auto; |
15 | 19 | left: -1px; |
16 | 20 | border-left: none; |
17 | | - border-right: solid silver 1px; |
18 | 21 | } |
19 | 22 | .wikiEditor-ui-toc ul { |
20 | 23 | padding: 0; |
Index: trunk/extensions/UsabilityInitiative/css/combined.css |
— | — | @@ -26,39 +26,40 @@ |
27 | 27 | width: 100%; |
28 | 28 | line-height: 1em; |
29 | 29 | background-color: #f3f3f3; |
| 30 | + border: solid silver 1px; |
30 | 31 | } |
31 | 32 | body.rtl .wikiEditor-ui { |
32 | 33 | float: right; |
33 | 34 | } |
34 | 35 | .wikiEditor-ui .wikiEditor-ui-bottom { |
35 | | - position: relative; |
36 | | - border: solid silver 1px; |
37 | | - border-top-width: 0; |
38 | 36 | width: 100%; |
39 | 37 | } |
40 | 38 | .wikiEditor-ui .wikiEditor-ui-top { |
41 | 39 | position: relative; |
42 | | - border: solid silver 1px; |
43 | 40 | width: 100%; |
| 41 | + border-bottom: solid silver 1px; |
44 | 42 | } |
45 | 43 | .ui-dialog-content fieldset table td { |
46 | 44 | padding: 0.25em; |
47 | 45 | }/* wikiEditor toc module */ |
48 | 46 | |
| 47 | +.wikiEditor-ui-text { |
| 48 | + border-right: solid silver 1px; |
| 49 | +} |
| 50 | +body.rtl .wikiEditor-ui-text { |
| 51 | + border-right: none; |
| 52 | + border-left: solid silver 1px; |
| 53 | +} |
49 | 54 | .wikiEditor-ui-toc { |
50 | | - /* width is set dynamically */ |
51 | | - position: absolute; |
52 | | - right: -1px; |
53 | | - top: 0; |
| 55 | + /* height and width are set dynamically */ |
| 56 | + float: right; |
54 | 57 | padding: 0; |
55 | | - border-left: solid silver 1px; |
56 | 58 | overflow: auto; |
57 | 59 | } |
58 | 60 | body.rtl .wikiEditor-ui-toc { |
59 | 61 | right: auto; |
60 | 62 | left: -1px; |
61 | 63 | border-left: none; |
62 | | - border-right: solid silver 1px; |
63 | 64 | } |
64 | 65 | .wikiEditor-ui-toc ul { |
65 | 66 | padding: 0; |
— | — | @@ -107,16 +108,11 @@ |
108 | 109 | display: none; |
109 | 110 | float: left; |
110 | 111 | width: 100%; |
111 | | - margin-left: -1px; |
112 | | - border-left: solid silver 1px; |
113 | | - border-right: solid silver 1px; |
114 | 112 | border-top: solid 1px #DDDDDD; |
115 | 113 | background-color: #F3F3F3; |
116 | 114 | } |
117 | 115 | body.rtl .wikiEditor-ui-toolbar .sections .section { |
118 | 116 | float: right; |
119 | | - margin-left: auto; |
120 | | - margin-right: -1px; |
121 | 117 | } |
122 | 118 | .wikiEditor-ui-toolbar .sections .loading { |
123 | 119 | padding-top: 0.5em; |
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css |
— | — | @@ -21,37 +21,38 @@ |
22 | 22 | width:100%; |
23 | 23 | line-height:1em; |
24 | 24 | background-color:#f3f3f3; |
| 25 | +border:solid silver 1px; |
25 | 26 | } |
26 | 27 | body.rtl .wikiEditor-ui{ |
27 | 28 | float:right; |
28 | 29 | } |
29 | 30 | .wikiEditor-ui .wikiEditor-ui-bottom{ |
30 | | -position:relative; |
31 | | -border:solid silver 1px; |
32 | | -border-top-width:0; |
33 | 31 | width:100%; |
34 | 32 | } |
35 | 33 | .wikiEditor-ui .wikiEditor-ui-top{ |
36 | 34 | position:relative; |
37 | | -border:solid silver 1px; |
38 | 35 | width:100%; |
| 36 | +border-bottom:solid silver 1px; |
39 | 37 | } |
40 | 38 | .ui-dialog-content fieldset table td{ |
41 | 39 | padding:0.25em; |
42 | 40 | } |
| 41 | +.wikiEditor-ui-text{ |
| 42 | +border-right:solid silver 1px; |
| 43 | +} |
| 44 | +body.rtl .wikiEditor-ui-text{ |
| 45 | +border-right:none; |
| 46 | +border-left:solid silver 1px; |
| 47 | +} |
43 | 48 | .wikiEditor-ui-toc{ |
44 | | -position:absolute; |
45 | | -right:-1px; |
46 | | -top:0; |
| 49 | +float:right; |
47 | 50 | padding:0; |
48 | | -border-left:solid silver 1px; |
49 | 51 | overflow:auto; |
50 | 52 | } |
51 | 53 | body.rtl .wikiEditor-ui-toc{ |
52 | 54 | right:auto; |
53 | 55 | left:-1px; |
54 | 56 | border-left:none; |
55 | | -border-right:solid silver 1px; |
56 | 57 | } |
57 | 58 | .wikiEditor-ui-toc ul{ |
58 | 59 | padding:0; |
— | — | @@ -97,16 +98,11 @@ |
98 | 99 | display:none; |
99 | 100 | float:left; |
100 | 101 | width:100%; |
101 | | -margin-left:-1px; |
102 | | -border-left:solid silver 1px; |
103 | | -border-right:solid silver 1px; |
104 | 102 | border-top:solid 1px #DDDDDD; |
105 | 103 | background-color:#F3F3F3; |
106 | 104 | } |
107 | 105 | body.rtl .wikiEditor-ui-toolbar .sections .section{ |
108 | 106 | float:right; |
109 | | -margin-left:auto; |
110 | | -margin-right:-1px; |
111 | 107 | } |
112 | 108 | .wikiEditor-ui-toolbar .sections .loading{ |
113 | 109 | padding-top:0.5em; |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -16,8 +16,14 @@ |
17 | 17 | 'modules': {}, |
18 | 18 | 'instances': [], |
19 | 19 | 'isSupported': function() { |
20 | | - var supportedBrowsers = { 'msie': 7, 'firefox': 2, 'opera': 9, 'safari': 3, 'chrome': 1, 'camino': 1 }; |
21 | | - return ( $.browser.name in supportedBrowsers && $.browser.versionNumber >= supportedBrowsers[$.browser.name] ); |
| 20 | + function isSupported( supportedBrowsers ) { |
| 21 | + return $.browser.name in supportedBrowsers && $.browser.versionNumber >= supportedBrowsers[$.browser.name]; |
| 22 | + } |
| 23 | + var supportedBrowsers = { |
| 24 | + 'ltr': { 'msie': 7, 'firefox': 2, 'opera': 9, 'safari': 3, 'chrome': 1, 'camino': 1 }, |
| 25 | + 'rtl': { 'msie': 8, 'firefox': 2, 'opera': 9, 'safari': 3, 'chrome': 1, 'camino': 1 } |
| 26 | + }; |
| 27 | + return isSupported( supportedBrowsers[$( 'body.rtl' ).size() ? 'rtl' : 'ltr'] ); |
22 | 28 | } |
23 | 29 | }; |
24 | 30 | $.fn.wikiEditor = function() { |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js |
— | — | @@ -34,10 +34,11 @@ |
35 | 35 | ); |
36 | 36 | // Make some css modifications to make room for the toc on the right... |
37 | 37 | // Perhaps this could be configurable? |
38 | | - context.modules.$toc.css( 'width', '12em' ); |
39 | | - context.$ui.find( '.wikiEditor-ui-text' ).css( |
40 | | - ( $( 'body.rtl' ).size() ? 'marginLeft' : 'marginRight' ), '12em' |
41 | | - ); |
| 38 | + context.modules.$toc |
| 39 | + .css( 'width', '12em' ) |
| 40 | + .css( 'marginTop', -( context.$ui.find( '.wikiEditor-ui-bottom' ).height() ) ); |
| 41 | + context.$ui.find( '.wikiEditor-ui-text' ) |
| 42 | + .css( ( $( 'body.rtl' ).size() ? 'marginLeft' : 'marginRight' ), '12em' ); |
42 | 43 | // Add the TOC to the document |
43 | 44 | $.wikiEditor.modules.toc.fn.build( context ); |
44 | 45 | $.wikiEditor.modules.toc.fn.update( context ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -1041,8 +1041,14 @@ |
1042 | 1042 | 'modules': {}, |
1043 | 1043 | 'instances': [], |
1044 | 1044 | 'isSupported': function() { |
1045 | | - var supportedBrowsers = { 'msie': 7, 'firefox': 2, 'opera': 9, 'safari': 3, 'chrome': 1, 'camino': 1 }; |
1046 | | - return ( $.browser.name in supportedBrowsers && $.browser.versionNumber >= supportedBrowsers[$.browser.name] ); |
| 1045 | + function isSupported( supportedBrowsers ) { |
| 1046 | + return $.browser.name in supportedBrowsers && $.browser.versionNumber >= supportedBrowsers[$.browser.name]; |
| 1047 | + } |
| 1048 | + var supportedBrowsers = { |
| 1049 | + 'ltr': { 'msie': 7, 'firefox': 2, 'opera': 9, 'safari': 3, 'chrome': 1, 'camino': 1 }, |
| 1050 | + 'rtl': { 'msie': 8, 'firefox': 2, 'opera': 9, 'safari': 3, 'chrome': 1, 'camino': 1 } |
| 1051 | + }; |
| 1052 | + return isSupported( supportedBrowsers[$( 'body.rtl' ).size() ? 'rtl' : 'ltr'] ); |
1047 | 1053 | } |
1048 | 1054 | }; |
1049 | 1055 | $.fn.wikiEditor = function() { |
— | — | @@ -1182,10 +1188,11 @@ |
1183 | 1189 | ); |
1184 | 1190 | // Make some css modifications to make room for the toc on the right... |
1185 | 1191 | // Perhaps this could be configurable? |
1186 | | - context.modules.$toc.css( 'width', '12em' ); |
1187 | | - context.$ui.find( '.wikiEditor-ui-text' ).css( |
1188 | | - ( $( 'body.rtl' ).size() ? 'marginLeft' : 'marginRight' ), '12em' |
1189 | | - ); |
| 1192 | + context.modules.$toc |
| 1193 | + .css( 'width', '12em' ) |
| 1194 | + .css( 'marginTop', -( context.$ui.find( '.wikiEditor-ui-bottom' ).height() ) ); |
| 1195 | + context.$ui.find( '.wikiEditor-ui-text' ) |
| 1196 | + .css( ( $( 'body.rtl' ).size() ? 'marginLeft' : 'marginRight' ), '12em' ); |
1190 | 1197 | // Add the TOC to the document |
1191 | 1198 | $.wikiEditor.modules.toc.fn.build( context ); |
1192 | 1199 | $.wikiEditor.modules.toc.fn.update( context ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -108,14 +108,15 @@ |
109 | 109 | return($.os.name=='mac'?13:($.os.name=='linux'?15:16))*row;} |
110 | 110 | return this.each(function(){$(this).focus();if(this.selectionStart||this.selectionStart=='0'){this.selectionStart=pos;this.selectionEnd=pos;$(this).scrollTop(getCaretScrollPosition(this));}else if(document.selection&&document.selection.createRange){var range=document.selection.createRange();var oldPos=$(this).getCaretPosition();var goBack=false;if(oldPos==pos){pos++;goBack=true;} |
111 | 111 | range.moveToElementText(this);range.collapse();range.move('character',pos);range.select();this.scrollTop+=range.offsetTop;if(goBack){range.move('character',-1);range.select();}} |
112 | | -$(this).trigger('scrollToPosition');});}});})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'isSupported':function(){var supportedBrowsers={'msie':7,'firefox':2,'opera':9,'safari':3,'chrome':1,'camino':1};return($.browser.name in supportedBrowsers&&$.browser.versionNumber>=supportedBrowsers[$.browser.name]);}};$.fn.wikiEditor=function(){var context=$(this).data('context');if(typeof context!=='undefined'){arguments=$.makeArray(arguments);if(arguments.length>0){var call=arguments.shift();if(call in context.api){context.api[call](context,arguments[0]==undefined?{}:arguments[0]);} |
| 112 | +$(this).trigger('scrollToPosition');});}});})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'isSupported':function(){function isSupported(supportedBrowsers){return $.browser.name in supportedBrowsers&&$.browser.versionNumber>=supportedBrowsers[$.browser.name];} |
| 113 | +var supportedBrowsers={'ltr':{'msie':7,'firefox':2,'opera':9,'safari':3,'chrome':1,'camino':1},'rtl':{'msie':8,'firefox':2,'opera':9,'safari':3,'chrome':1,'camino':1}};return isSupported(supportedBrowsers[$('body.rtl').size()?'rtl':'ltr']);}};$.fn.wikiEditor=function(){var context=$(this).data('context');if(typeof context!=='undefined'){arguments=$.makeArray(arguments);if(arguments.length>0){var call=arguments.shift();if(call in context.api){context.api[call](context,arguments[0]==undefined?{}:arguments[0]);} |
113 | 114 | return $(this).data('context',context);} |
114 | 115 | return $(this);} |
115 | 116 | var instance=$.wikiEditor.instances.length;context={'$textarea':$(this),'modules':{},'data':{},'instance':instance};$.wikiEditor.instances[instance]=$(this);$(this).wrap($('<div></div>').addClass('wikiEditor-ui').attr('id','wikiEditor-ui')).wrap($('<div></div>').addClass('wikiEditor-ui-bottom').attr('id','wikiEditor-ui-bottom')).wrap($('<div></div>').addClass('wikiEditor-ui-text').attr('id','wikiEditor-ui-text'));context.$ui=$(this).parent().parent().parent();context.$ui.after($('<div style="clear:both;"></div>'));context.$ui.prepend($('<div></div>').addClass('wikiEditor-ui-top').attr('id','wikiEditor-ui-top'));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);}} |
116 | 117 | 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];}}}} |
117 | 118 | if(arguments.length>0&&typeof arguments[0]=='object'){context.api.addModule(context,arguments[0]);} |
118 | 119 | context.$textarea.scrollToCaretPosition(0);return $(this).data('context',context);};})(jQuery);(function($){$.wikiEditor.modules.toc={api:{},fn:{create:function(context,config){if('$toc'in context.modules){return;} |
119 | | -context.modules.$toc=$('<div></div>').addClass('wikiEditor-ui-toc').attr('id','wikiEditor-ui-toc');$.wikiEditor.modules.toc.fn.build(context,config);context.$ui.find('.wikiEditor-ui-bottom').append(context.modules.$toc);context.modules.$toc.height(context.$ui.find('.wikiEditor-ui-bottom').height());context.modules.$toc.css('width','12em');context.$ui.find('.wikiEditor-ui-text').css(($('body.rtl').size()?'marginLeft':'marginRight'),'12em');$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);context.$textarea.bind('keyup encapsulateSelection',function(event){var context=$(this).data('context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).bind('mouseup scrollToPosition',function(event){var context=$(this).data('context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.update(context);}});});},update:function(context){context.modules.$toc.find('a').removeClass('currentSelection');var position=context.$textarea.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++;} |
| 120 | +context.modules.$toc=$('<div></div>').addClass('wikiEditor-ui-toc').attr('id','wikiEditor-ui-toc');$.wikiEditor.modules.toc.fn.build(context,config);context.$ui.find('.wikiEditor-ui-bottom').append(context.modules.$toc);context.modules.$toc.height(context.$ui.find('.wikiEditor-ui-bottom').height());context.modules.$toc.css('width','12em').css('marginTop',-(context.$ui.find('.wikiEditor-ui-bottom').height()));context.$ui.find('.wikiEditor-ui-text').css(($('body.rtl').size()?'marginLeft':'marginRight'),'12em');$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);context.$textarea.bind('keyup encapsulateSelection',function(event){var context=$(this).data('context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).bind('mouseup scrollToPosition',function(event){var context=$(this).data('context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.update(context);}});});},update:function(context){context.modules.$toc.find('a').removeClass('currentSelection');var position=context.$textarea.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++;} |
120 | 121 | section=Math.max(0,section);} |
121 | 122 | context.modules.$toc.find('a.section-'+section).addClass('currentSelection');}},build:function(context){function buildStructure(outline,offset,level){if(offset==undefined)offset=0;if(level==undefined)level=1;var sections=[];for(var i=offset;i<outline.length;i++){if(outline[i].nLevel==level){var sub=buildStructure(outline,i+1,level+1);if(sub.length){outline[i].sections=sub;} |
122 | 123 | sections[sections.length]=outline[i];}else if(outline[i].nLevel<level){break;}} |