Index: trunk/extensions/UsabilityInitiative/css/wikiEditor.toc.css |
— | — | @@ -21,33 +21,56 @@ |
22 | 22 | } |
23 | 23 | .wikiEditor-ui-toc ul { |
24 | 24 | padding: 0; |
25 | | - margin: 0.5em 1em; |
| 25 | + margin: 0; |
26 | 26 | list-style: none; |
27 | 27 | /* IE needs to be told in great detail how to act, or it misbehaves */ |
28 | 28 | list-style-image: none; |
29 | 29 | list-style-position: outside; |
30 | 30 | list-style-type: none; |
| 31 | + width: 100%; |
31 | 32 | } |
| 33 | +.wikiEditor-ui-toc li { |
| 34 | + padding: 0; |
| 35 | + margin: 0; |
| 36 | +} |
32 | 37 | .wikiEditor-ui-toc ul ul { |
33 | 38 | padding: 0; |
34 | 39 | margin: 0; |
35 | | - margin-left: 0.75em; |
36 | 40 | margin-bottom: 0 !important; |
37 | 41 | margin-top: 0 !important; |
38 | 42 | list-style: none; |
39 | 43 | } |
40 | | -body.rtl .wikiEditor-ui-toc ul ul { |
41 | | - margin-left: 0; |
42 | | - margin-right: 0.75em; |
43 | | -} |
44 | | -.wikiEditor-ui-toc ul li a { |
| 44 | +.wikiEditor-ui-toc ul li div { |
45 | 45 | display: block; |
46 | 46 | font-size: 0.9em; |
| 47 | + padding: 0.125em; |
| 48 | + padding-left: 1em; |
| 49 | + cursor: pointer; |
| 50 | + color: #0645ad; |
47 | 51 | } |
48 | | -.wikiEditor-ui-toc ul li a.currentSelection { |
49 | | - font-weight: bold; |
| 52 | +.wikiEditor-ui-toc ul ul li div { |
| 53 | + padding-left: 2em; |
50 | 54 | } |
51 | | -.wikiEditor-ui-toc ul li a.section-0 { |
| 55 | +.wikiEditor-ui-toc ul ul ul li div { |
| 56 | + padding-left: 3em; |
| 57 | +} |
| 58 | +.wikiEditor-ui-toc ul ul ul ul li div { |
| 59 | + padding-left: 4em; |
| 60 | +} |
| 61 | +.wikiEditor-ui-toc ul ul ul ul ul li div { |
| 62 | + padding-left: 5em; |
| 63 | +} |
| 64 | +.wikiEditor-ui-toc ul ul ul ul ul ul li div { |
| 65 | + padding-left: 6em; |
| 66 | +} |
| 67 | +.wikiEditor-ui-toc ul li div.current { |
| 68 | + background-color: #FAFAFA; |
| 69 | + color: #333333; |
| 70 | + cursor: default; |
| 71 | +} |
| 72 | +.wikiEditor-ui-toc ul li div.section-0 { |
52 | 73 | font-size: 1em; |
| 74 | + padding-top: 0.5em; |
| 75 | + padding-bottom: 0.5em; |
53 | 76 | border-bottom: solid 1px #DDDDDD; |
54 | 77 | } |
\ No newline at end of file |
Index: trunk/extensions/UsabilityInitiative/css/combined.css |
— | — | @@ -126,34 +126,57 @@ |
127 | 127 | } |
128 | 128 | .wikiEditor-ui-toc ul { |
129 | 129 | padding: 0; |
130 | | - margin: 0.5em 1em; |
| 130 | + margin: 0; |
131 | 131 | list-style: none; |
132 | 132 | /* IE needs to be told in great detail how to act, or it misbehaves */ |
133 | 133 | list-style-image: none; |
134 | 134 | list-style-position: outside; |
135 | 135 | list-style-type: none; |
| 136 | + width: 100%; |
136 | 137 | } |
| 138 | +.wikiEditor-ui-toc li { |
| 139 | + padding: 0; |
| 140 | + margin: 0; |
| 141 | +} |
137 | 142 | .wikiEditor-ui-toc ul ul { |
138 | 143 | padding: 0; |
139 | 144 | margin: 0; |
140 | | - margin-left: 0.75em; |
141 | 145 | margin-bottom: 0 !important; |
142 | 146 | margin-top: 0 !important; |
143 | 147 | list-style: none; |
144 | 148 | } |
145 | | -body.rtl .wikiEditor-ui-toc ul ul { |
146 | | - margin-left: 0; |
147 | | - margin-right: 0.75em; |
148 | | -} |
149 | | -.wikiEditor-ui-toc ul li a { |
| 149 | +.wikiEditor-ui-toc ul li div { |
150 | 150 | display: block; |
151 | 151 | font-size: 0.9em; |
| 152 | + padding: 0.125em; |
| 153 | + padding-left: 1em; |
| 154 | + cursor: pointer; |
| 155 | + color: #0645ad; |
152 | 156 | } |
153 | | -.wikiEditor-ui-toc ul li a.currentSelection { |
154 | | - font-weight: bold; |
| 157 | +.wikiEditor-ui-toc ul ul li div { |
| 158 | + padding-left: 2em; |
155 | 159 | } |
156 | | -.wikiEditor-ui-toc ul li a.section-0 { |
| 160 | +.wikiEditor-ui-toc ul ul ul li div { |
| 161 | + padding-left: 3em; |
| 162 | +} |
| 163 | +.wikiEditor-ui-toc ul ul ul ul li div { |
| 164 | + padding-left: 4em; |
| 165 | +} |
| 166 | +.wikiEditor-ui-toc ul ul ul ul ul li div { |
| 167 | + padding-left: 5em; |
| 168 | +} |
| 169 | +.wikiEditor-ui-toc ul ul ul ul ul ul li div { |
| 170 | + padding-left: 6em; |
| 171 | +} |
| 172 | +.wikiEditor-ui-toc ul li div.current { |
| 173 | + background-color: #FAFAFA; |
| 174 | + color: #333333; |
| 175 | + cursor: default; |
| 176 | +} |
| 177 | +.wikiEditor-ui-toc ul li div.section-0 { |
157 | 178 | font-size: 1em; |
| 179 | + padding-top: 0.5em; |
| 180 | + padding-bottom: 0.5em; |
158 | 181 | border-bottom: solid 1px #DDDDDD; |
159 | 182 | }/* wikiEditor toolbar module */ |
160 | 183 | |
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css |
— | — | @@ -114,33 +114,56 @@ |
115 | 115 | } |
116 | 116 | .wikiEditor-ui-toc ul{ |
117 | 117 | padding:0; |
118 | | -margin:0.5em 1em; |
| 118 | +margin:0; |
119 | 119 | list-style:none; |
120 | 120 | list-style-image:none; |
121 | 121 | list-style-position:outside; |
122 | 122 | list-style-type:none; |
| 123 | +width:100%; |
123 | 124 | } |
| 125 | +.wikiEditor-ui-toc li{ |
| 126 | +padding:0; |
| 127 | +margin:0; |
| 128 | +} |
124 | 129 | .wikiEditor-ui-toc ul ul{ |
125 | 130 | padding:0; |
126 | 131 | margin:0; |
127 | | -margin-left:0.75em; |
128 | 132 | margin-bottom:0 !important; |
129 | 133 | margin-top:0 !important; |
130 | 134 | list-style:none; |
131 | 135 | } |
132 | | -body.rtl .wikiEditor-ui-toc ul ul{ |
133 | | -margin-left:0; |
134 | | -margin-right:0.75em; |
135 | | -} |
136 | | -.wikiEditor-ui-toc ul li a{ |
| 136 | +.wikiEditor-ui-toc ul li div{ |
137 | 137 | display:block; |
138 | 138 | font-size:0.9em; |
| 139 | +padding:0.125em; |
| 140 | +padding-left:1em; |
| 141 | +cursor:pointer; |
| 142 | +color:#0645ad; |
139 | 143 | } |
140 | | -.wikiEditor-ui-toc ul li a.currentSelection{ |
141 | | -font-weight:bold; |
| 144 | +.wikiEditor-ui-toc ul ul li div{ |
| 145 | +padding-left:2em; |
142 | 146 | } |
143 | | -.wikiEditor-ui-toc ul li a.section-0{ |
| 147 | +.wikiEditor-ui-toc ul ul ul li div{ |
| 148 | +padding-left:3em; |
| 149 | +} |
| 150 | +.wikiEditor-ui-toc ul ul ul ul li div{ |
| 151 | +padding-left:4em; |
| 152 | +} |
| 153 | +.wikiEditor-ui-toc ul ul ul ul ul li div{ |
| 154 | +padding-left:5em; |
| 155 | +} |
| 156 | +.wikiEditor-ui-toc ul ul ul ul ul ul li div{ |
| 157 | +padding-left:6em; |
| 158 | +} |
| 159 | +.wikiEditor-ui-toc ul li div.current{ |
| 160 | +background-color:#FAFAFA; |
| 161 | +color:#333333; |
| 162 | +cursor:default; |
| 163 | +} |
| 164 | +.wikiEditor-ui-toc ul li div.section-0{ |
144 | 165 | font-size:1em; |
| 166 | +padding-top:0.5em; |
| 167 | +padding-bottom:0.5em; |
145 | 168 | border-bottom:solid 1px #DDDDDD; |
146 | 169 | } |
147 | 170 | .wikiEditor-ui-toolbar{ |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.codepress.js |
— | — | @@ -1,13 +0,0 @@ |
2 | | -/* |
3 | | - * |
4 | | - */ |
5 | | -(function ($) { |
6 | | - |
7 | | -$.fn.codePress = function() { |
8 | | - $(this).each( function { |
9 | | - CodePress(this) |
10 | | - } ); |
11 | | -}; |
12 | | - |
13 | | - |
14 | | -})(jQuery); |
\ No newline at end of file |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.autoEllipse.js |
— | — | @@ -15,27 +15,24 @@ |
16 | 16 | if ( $text.outerWidth() > $(this).innerWidth() ) { |
17 | 17 | switch ( options.position ) { |
18 | 18 | case 'right': |
19 | | - // Use binary search-like technique for |
20 | | - // efficiency |
| 19 | + // Use binary search-like technique for efficiency |
21 | 20 | var l = 0, r = text.length; |
22 | | - var ow, iw; |
23 | 21 | do { |
24 | 22 | var m = Math.ceil( ( l + r ) / 2 ); |
25 | 23 | $text.text( text.substr( 0, m ) + '...' ); |
26 | | - ow = $text.outerWidth(); |
27 | | - iw = $(this).innerWidth(); |
28 | | - if ( ow > iw ) |
| 24 | + if ( $text.outerWidth() > $(this).width() ) { |
29 | 25 | // Text is too long |
30 | 26 | r = m - 1; |
31 | | - else |
| 27 | + } else { |
32 | 28 | l = m; |
| 29 | + } |
33 | 30 | } while ( l < r ); |
34 | 31 | break; |
35 | 32 | case 'center': |
36 | 33 | // TODO: Use binary search like for 'right' |
37 | 34 | var i = [Math.round( text.length / 2 ), Math.round( text.length / 2 )]; |
38 | 35 | var side = 1; // Begin with making the end shorter |
39 | | - while ( $text.outerWidth() > ( $(this).innerWidth() ) && i[0] > 0 ) { |
| 36 | + while ( $text.outerWidth() > ( $(this).width() ) && i[0] > 0 ) { |
40 | 37 | $text.text( text.substr( 0, i[0] ) + '...' + text.substr( i[1] ) ); |
41 | 38 | // Alternate between trimming the end and begining |
42 | 39 | if ( side == 0 ) { |
— | — | @@ -52,7 +49,7 @@ |
53 | 50 | case 'left': |
54 | 51 | // TODO: Use binary search like for 'right' |
55 | 52 | var r = 0; |
56 | | - while ( $text.outerWidth() > $(this).innerWidth() && r < text.length ) { |
| 53 | + while ( $text.outerWidth() > $(this).width() && r < text.length ) { |
57 | 54 | $text.text( '...' + text.substr( r ) ); |
58 | 55 | r++; |
59 | 56 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js |
— | — | @@ -463,10 +463,10 @@ |
464 | 464 | $(this).parent().parent().find( 'a' ).removeClass( 'current' ); |
465 | 465 | if ( show ) { |
466 | 466 | $section.fadeIn( 'fast' ); |
467 | | - $sections.animate( { 'height': $section.outerHeight() }, 'fast' ); |
| 467 | + $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2 ); |
468 | 468 | $(this).addClass( 'current' ); |
469 | 469 | } else { |
470 | | - $sections.animate( { 'height': 0 } ); |
| 470 | + $sections.animate( { 'height': 0 }, $section.outerHeight() * 2 ); |
471 | 471 | } |
472 | 472 | // Click tracking |
473 | 473 | if($.trackAction != undefined){ |
— | — | @@ -567,7 +567,7 @@ |
568 | 568 | s.$sections.append( $.wikiEditor.modules.toolbar.fn.buildSection( s.context, s.id, s.config ) ); |
569 | 569 | var $section = s.$sections.find( '.section:visible' ); |
570 | 570 | if ( $section.size() ) { |
571 | | - $sections.animate( { 'height': $section.outerHeight() }, 'fast' ); |
| 571 | + $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2 ); |
572 | 572 | } |
573 | 573 | } |
574 | 574 | } ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js |
— | — | @@ -1,6 +1,4 @@ |
2 | | -/** |
3 | | - * TOC Module for wikiEditor |
4 | | - */ |
| 2 | +/* TOC Module for wikiEditor */ |
5 | 3 | ( function( $ ) { $.wikiEditor.modules.toc = { |
6 | 4 | |
7 | 5 | /** |
— | — | @@ -71,7 +69,7 @@ |
72 | 70 | }, |
73 | 71 | |
74 | 72 | unhighlight: function( context ) { |
75 | | - context.modules.$toc.find( 'a' ).removeClass( 'currentSelection' ); |
| 73 | + context.modules.$toc.find( 'div' ).removeClass( 'current' ); |
76 | 74 | }, |
77 | 75 | /** |
78 | 76 | * Highlight the section the cursor is currently within |
— | — | @@ -95,8 +93,8 @@ |
96 | 94 | } |
97 | 95 | section = Math.max( 0, section ); |
98 | 96 | } |
99 | | - var sectionLink = context.modules.$toc.find( 'a.section-' + section ); |
100 | | - sectionLink.addClass( 'currentSelection' ); |
| 97 | + var sectionLink = context.modules.$toc.find( 'div.section-' + section ); |
| 98 | + sectionLink.addClass( 'current' ); |
101 | 99 | |
102 | 100 | // Scroll the highlighted link into view if necessary |
103 | 101 | var relTop = sectionLink.offset().top - context.modules.$toc.offset().top; |
— | — | @@ -145,16 +143,16 @@ |
146 | 144 | * @param {Object} structure Structured outline |
147 | 145 | */ |
148 | 146 | function buildList( structure ) { |
149 | | - var list = $( '<ul />' ); |
| 147 | + var list = $( '<ul></ul>' ); |
150 | 148 | for ( i in structure ) { |
151 | | - var item = $( '<li />' ) |
| 149 | + var item = $( '<li></li>' ) |
152 | 150 | .append( |
153 | | - $( '<a />' ) |
| 151 | + $( '<div></div>' ) |
154 | 152 | .attr( 'href', '#' ) |
155 | 153 | .addClass( 'section-' + structure[i].index ) |
156 | 154 | .data( 'textbox', context.$textarea ) |
157 | 155 | .data( 'position', structure[i].position ) |
158 | | - .click( function( event ) { |
| 156 | + .bind( 'mousedown', function( event ) { |
159 | 157 | $(this).data( 'textbox' ) |
160 | 158 | .focus() |
161 | 159 | .setSelection( $(this).data( 'position' ) ) |
— | — | @@ -235,18 +233,11 @@ |
236 | 234 | // Recursively build the structure and add special item for |
237 | 235 | // section 0, if needed |
238 | 236 | var structure = buildStructure( outline ); |
239 | | - if ( $( 'input[name=wpSection]' ).val() == '' ) |
| 237 | + if ( $( 'input[name=wpSection]' ).val() == '' ) { |
240 | 238 | structure.unshift( { 'text': wgPageName.replace(/_/g, ' '), 'level': 1, 'index': 0, 'position': 0 } ); |
| 239 | + } |
241 | 240 | context.modules.$toc.html( buildList( structure ) ); |
242 | | - |
243 | | - context.modules.$toc.find( 'ul' ).css( 'width', '10em' ); |
244 | | - |
245 | | - var links = context.modules.$toc.find( 'ul a' ); |
246 | | - // Highlighted links are wider; autoEllipse links in |
247 | | - // highlighted state |
248 | | - links.addClass( 'currentSelection' ); |
249 | | - links.autoEllipse( { 'position': 'right', 'tooltip': true } ); |
250 | | - links.removeClass( 'currentSelection' ); |
| 241 | + context.modules.$toc.find( 'div' ).autoEllipse( { 'position': 'right', 'tooltip': true } ); |
251 | 242 | // Cache the outline for later use |
252 | 243 | context.data.outline = outline; |
253 | 244 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.editor.js |
— | — | @@ -0,0 +1,202 @@ |
| 2 | +/** |
| 3 | + * TOC Module for wikiEditor |
| 4 | + */ |
| 5 | +( function( $ ) { $.wikiEditor.modules.$editor = { |
| 6 | + |
| 7 | +/** |
| 8 | + * API accessible functions |
| 9 | + */ |
| 10 | +api: { |
| 11 | + // |
| 12 | +}, |
| 13 | +/** |
| 14 | + * |
| 15 | + */ |
| 16 | +languages: { |
| 17 | + csharp : 'C#', |
| 18 | + css : 'CSS', |
| 19 | + generic : 'Generic', |
| 20 | + html : 'HTML', |
| 21 | + java : 'Java', |
| 22 | + javascript : 'JavaScript', |
| 23 | + perl : 'Perl', |
| 24 | + ruby : 'Ruby', |
| 25 | + php : 'PHP', |
| 26 | + text : 'Text', |
| 27 | + sql : 'SQL', |
| 28 | + vbscript : 'VBScript' |
| 29 | +}, |
| 30 | +/** |
| 31 | + * Internally used functions |
| 32 | + */ |
| 33 | +fn: { |
| 34 | + create: function( context, config ) { |
| 35 | + context.$textarea |
| 36 | + .attr( 'disabled', true ) |
| 37 | + .css( 'overflow', 'hidden' ); |
| 38 | + context.modules.editor.$iframe = $( '<iframe></iframe>' ) |
| 39 | + .css( { |
| 40 | + 'width': context.$textarea.css( 'width' ), |
| 41 | + 'height': context.$textarea.css( 'height' ), |
| 42 | + 'border': '1px solid gray', |
| 43 | + 'visibility': 'hidden', |
| 44 | + 'position': 'absolute' |
| 45 | + }); |
| 46 | + .attr( 'frameborder', 0 ) |
| 47 | + context.$textarea |
| 48 | + .css( 'overflow', 'auto' ); |
| 49 | + |
| 50 | + |
| 51 | + var self = document.createElement('iframe'); |
| 52 | + |
| 53 | + self.textarea = obj; |
| 54 | + self.textarea.disabled = true; |
| 55 | + self.textarea.style.overflow = 'hidden'; |
| 56 | + |
| 57 | + self.style.height = self.textarea.clientHeight +'px'; |
| 58 | + self.style.width = self.textarea.clientWidth +'px'; |
| 59 | + self.textarea.style.overflow = 'auto'; |
| 60 | + |
| 61 | + self.style.border = '1px solid gray'; |
| 62 | + self.frameBorder = 0; // remove IE internal iframe border |
| 63 | + self.style.visibility = 'hidden'; |
| 64 | + self.style.position = 'absolute'; |
| 65 | + |
| 66 | + |
| 67 | + self.editor = self.contentWindow.CodePress; |
| 68 | + self.editor.body = self.contentWindow.document.getElementsByTagName('body')[0]; |
| 69 | + self.editor.setCode(self.textarea.value); |
| 70 | + self.setOptions(); |
| 71 | + self.editor.syntaxHighlight('init'); |
| 72 | + self.textarea.style.display = 'none'; |
| 73 | + self.style.position = 'static'; |
| 74 | + self.style.visibility = 'visible'; |
| 75 | + self.style.display = 'inline'; |
| 76 | + }, |
| 77 | + language: function( context, language ) { |
| 78 | + if ( language != undefined ) { |
| 79 | + if(obj) self.textarea.value = document.getElementById(obj) ? document.getElementById(obj).value : obj; |
| 80 | + if(!self.textarea.disabled) return; |
| 81 | + self.language = language ? language : self.getLanguage(); |
| 82 | + self.src = CodePress.path+'codepress.html?language='+self.language+'&ts='+(new Date).getTime(); |
| 83 | + if(self.attachEvent) self.attachEvent('onload',self.initialize); |
| 84 | + else self.addEventListener('load',self.initialize,false); |
| 85 | + |
| 86 | + var config = { "language": "generic", "engine": null }; |
| 87 | + var language = "generic"; var engine = "older"; |
| 88 | + var ua = navigator.userAgent; |
| 89 | + var ts = (new Date).getTime(); // timestamp to avoid cache |
| 90 | + var lh = location.href; |
| 91 | + |
| 92 | + if(ua.match('MSIE')) engine = 'msie'; |
| 93 | + else if(ua.match('KHTML')) engine = 'khtml'; |
| 94 | + else if(ua.match('Opera')) engine = 'opera'; |
| 95 | + else if(ua.match('Gecko')) engine = 'gecko'; |
| 96 | + if(lh.match('language=')) language = lh.replace(/.*language=(.*?)(&.*)?$/,'$1'); |
| 97 | + |
| 98 | + html = '\ |
| 99 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html>\ |
| 100 | +<head><title>wikiEditor</title><meta name="description" content="wikiEditor" /><script type="text/javascript">\ |
| 101 | + <link type="text/css" href="codepress.css?ts='+ts+'" rel="stylesheet" />\ |
| 102 | + <link type="text/css" href="languages/'+language+'.css?ts='+ts+'" rel="stylesheet" id="cp-lang-style" />\ |
| 103 | + <script type="text/javascript" src="engines/'+engine+'.js?ts='+ts+'"></script>\ |
| 104 | + <script type="text/javascript" src="languages/'+language+'.js?ts='+ts+'"></script>\ |
| 105 | +</head>\ |
| 106 | +'; |
| 107 | + |
| 108 | +<script type="text/javascript"> |
| 109 | +if(engine == "msie" || engine == "gecko") document.write('<body><pre> </pre></body>'); |
| 110 | +else if(engine == "opera") document.write('<body></body>'); |
| 111 | +// else if(engine == "khtml") document.write('<body> </body>'); |
| 112 | +</script> |
| 113 | + |
| 114 | +</html> |
| 115 | + |
| 116 | + |
| 117 | + '; |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + } else { |
| 134 | + for (language in CodePress.languages) |
| 135 | + if(self.options.match('\\b'+language+'\\b')) |
| 136 | + return CodePress.languages[language] ? language : 'generic'; |
| 137 | + } |
| 138 | + }, |
| 139 | + options: function( context, options ) { |
| 140 | + if ( options != undefined ) { |
| 141 | + $.extend( context.modules.editor.options, options ); |
| 142 | + } else { |
| 143 | + return context.modules.editor.options; |
| 144 | + } |
| 145 | + }, |
| 146 | + code: function( context, code ) { |
| 147 | + if ( code !== undefined ) { |
| 148 | + // Set |
| 149 | + self.textarea.disabled ? self.editor.setCode(code) : self.textarea.value = code; |
| 150 | + } else { |
| 151 | + // Get |
| 152 | + return self.textarea.disabled ? self.editor.getCode() : self.textarea.value; |
| 153 | + } |
| 154 | + }, |
| 155 | + // toggleReadOnly |
| 156 | + lock: function( context ) { |
| 157 | + self.textarea.readOnly = true; |
| 158 | + if(self.style.display != 'none') // prevent exception on FF + iframe with display:none |
| 159 | + self.editor.readOnly( true ); |
| 160 | + }, |
| 161 | + unlock: function( context ) { |
| 162 | + self.textarea.readOnly = false; |
| 163 | + if(self.style.display != 'none') // prevent exception on FF + iframe with display:none |
| 164 | + self.editor.readOnly( false ); |
| 165 | + }, |
| 166 | + // toggleEditor |
| 167 | + on: function( context ) { |
| 168 | + self.textarea.disabled = true; |
| 169 | + self.setCode(self.textarea.value); |
| 170 | + self.editor.syntaxHighlight('init'); |
| 171 | + self.style.display = 'inline'; |
| 172 | + self.textarea.style.display = 'none'; |
| 173 | + } |
| 174 | + off: function( context ) { |
| 175 | + self.textarea.value = self.getCode(); |
| 176 | + self.textarea.disabled = false; |
| 177 | + self.style.display = 'none'; |
| 178 | + self.textarea.style.display = 'inline'; |
| 179 | + } |
| 180 | + |
| 181 | + |
| 182 | + |
| 183 | + CodePress.run = function() { |
| 184 | + s = document.getElementsByTagName('script'); |
| 185 | + for(var i=0,n=s.length;i<n;i++) { |
| 186 | + if(s[i].src.match('codepress.js')) { |
| 187 | + CodePress.path = s[i].src.replace('codepress.js',''); |
| 188 | + } |
| 189 | + } |
| 190 | + t = document.getElementsByTagName('textarea'); |
| 191 | + for(var i=0,n=t.length;i<n;i++) { |
| 192 | + if(t[i].className.match('codepress')) { |
| 193 | + id = t[i].id; |
| 194 | + t[i].id = id+'_cp'; |
| 195 | + eval(id+' = new CodePress(t[i])'); |
| 196 | + t[i].parentNode.insertBefore(eval(id), t[i]); |
| 197 | + } |
| 198 | + } |
| 199 | + } |
| 200 | + |
| 201 | +} |
| 202 | + |
| 203 | +}; } ) ( jQuery ); |
\ No newline at end of file |
Property changes on: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.editor.js |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 204 | + native |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -93,27 +93,24 @@ |
94 | 94 | if ( $text.outerWidth() > $(this).innerWidth() ) { |
95 | 95 | switch ( options.position ) { |
96 | 96 | case 'right': |
97 | | - // Use binary search-like technique for |
98 | | - // efficiency |
| 97 | + // Use binary search-like technique for efficiency |
99 | 98 | var l = 0, r = text.length; |
100 | | - var ow, iw; |
101 | 99 | do { |
102 | 100 | var m = Math.ceil( ( l + r ) / 2 ); |
103 | 101 | $text.text( text.substr( 0, m ) + '...' ); |
104 | | - ow = $text.outerWidth(); |
105 | | - iw = $(this).innerWidth(); |
106 | | - if ( ow > iw ) |
| 102 | + if ( $text.outerWidth() > $(this).width() ) { |
107 | 103 | // Text is too long |
108 | 104 | r = m - 1; |
109 | | - else |
| 105 | + } else { |
110 | 106 | l = m; |
| 107 | + } |
111 | 108 | } while ( l < r ); |
112 | 109 | break; |
113 | 110 | case 'center': |
114 | 111 | // TODO: Use binary search like for 'right' |
115 | 112 | var i = [Math.round( text.length / 2 ), Math.round( text.length / 2 )]; |
116 | 113 | var side = 1; // Begin with making the end shorter |
117 | | - while ( $text.outerWidth() > ( $(this).innerWidth() ) && i[0] > 0 ) { |
| 114 | + while ( $text.outerWidth() > ( $(this).width() ) && i[0] > 0 ) { |
118 | 115 | $text.text( text.substr( 0, i[0] ) + '...' + text.substr( i[1] ) ); |
119 | 116 | // Alternate between trimming the end and begining |
120 | 117 | if ( side == 0 ) { |
— | — | @@ -130,7 +127,7 @@ |
131 | 128 | case 'left': |
132 | 129 | // TODO: Use binary search like for 'right' |
133 | 130 | var r = 0; |
134 | | - while ( $text.outerWidth() > $(this).innerWidth() && r < text.length ) { |
| 131 | + while ( $text.outerWidth() > $(this).width() && r < text.length ) { |
135 | 132 | $text.text( '...' + text.substr( r ) ); |
136 | 133 | r++; |
137 | 134 | } |
— | — | @@ -1986,10 +1983,10 @@ |
1987 | 1984 | $(this).parent().parent().find( 'a' ).removeClass( 'current' ); |
1988 | 1985 | if ( show ) { |
1989 | 1986 | $section.fadeIn( 'fast' ); |
1990 | | - $sections.animate( { 'height': $section.outerHeight() }, 'fast' ); |
| 1987 | + $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2 ); |
1991 | 1988 | $(this).addClass( 'current' ); |
1992 | 1989 | } else { |
1993 | | - $sections.animate( { 'height': 0 } ); |
| 1990 | + $sections.animate( { 'height': 0 }, $section.outerHeight() * 2 ); |
1994 | 1991 | } |
1995 | 1992 | // Click tracking |
1996 | 1993 | if($.trackAction != undefined){ |
— | — | @@ -2090,7 +2087,7 @@ |
2091 | 2088 | s.$sections.append( $.wikiEditor.modules.toolbar.fn.buildSection( s.context, s.id, s.config ) ); |
2092 | 2089 | var $section = s.$sections.find( '.section:visible' ); |
2093 | 2090 | if ( $section.size() ) { |
2094 | | - $sections.animate( { 'height': $section.outerHeight() }, 'fast' ); |
| 2091 | + $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2 ); |
2095 | 2092 | } |
2096 | 2093 | } |
2097 | 2094 | } ); |
— | — | @@ -2098,9 +2095,7 @@ |
2099 | 2096 | } |
2100 | 2097 | |
2101 | 2098 | }; } )( jQuery ); |
2102 | | -/** |
2103 | | - * TOC Module for wikiEditor |
2104 | | - */ |
| 2099 | +/* TOC Module for wikiEditor */ |
2105 | 2100 | ( function( $ ) { $.wikiEditor.modules.toc = { |
2106 | 2101 | |
2107 | 2102 | /** |
— | — | @@ -2171,7 +2166,7 @@ |
2172 | 2167 | }, |
2173 | 2168 | |
2174 | 2169 | unhighlight: function( context ) { |
2175 | | - context.modules.$toc.find( 'a' ).removeClass( 'currentSelection' ); |
| 2170 | + context.modules.$toc.find( 'div' ).removeClass( 'current' ); |
2176 | 2171 | }, |
2177 | 2172 | /** |
2178 | 2173 | * Highlight the section the cursor is currently within |
— | — | @@ -2195,8 +2190,8 @@ |
2196 | 2191 | } |
2197 | 2192 | section = Math.max( 0, section ); |
2198 | 2193 | } |
2199 | | - var sectionLink = context.modules.$toc.find( 'a.section-' + section ); |
2200 | | - sectionLink.addClass( 'currentSelection' ); |
| 2194 | + var sectionLink = context.modules.$toc.find( 'div.section-' + section ); |
| 2195 | + sectionLink.addClass( 'current' ); |
2201 | 2196 | |
2202 | 2197 | // Scroll the highlighted link into view if necessary |
2203 | 2198 | var relTop = sectionLink.offset().top - context.modules.$toc.offset().top; |
— | — | @@ -2245,16 +2240,16 @@ |
2246 | 2241 | * @param {Object} structure Structured outline |
2247 | 2242 | */ |
2248 | 2243 | function buildList( structure ) { |
2249 | | - var list = $( '<ul />' ); |
| 2244 | + var list = $( '<ul></ul>' ); |
2250 | 2245 | for ( i in structure ) { |
2251 | | - var item = $( '<li />' ) |
| 2246 | + var item = $( '<li></li>' ) |
2252 | 2247 | .append( |
2253 | | - $( '<a />' ) |
| 2248 | + $( '<div></div>' ) |
2254 | 2249 | .attr( 'href', '#' ) |
2255 | 2250 | .addClass( 'section-' + structure[i].index ) |
2256 | 2251 | .data( 'textbox', context.$textarea ) |
2257 | 2252 | .data( 'position', structure[i].position ) |
2258 | | - .click( function( event ) { |
| 2253 | + .bind( 'mousedown', function( event ) { |
2259 | 2254 | $(this).data( 'textbox' ) |
2260 | 2255 | .focus() |
2261 | 2256 | .setSelection( $(this).data( 'position' ) ) |
— | — | @@ -2335,18 +2330,11 @@ |
2336 | 2331 | // Recursively build the structure and add special item for |
2337 | 2332 | // section 0, if needed |
2338 | 2333 | var structure = buildStructure( outline ); |
2339 | | - if ( $( 'input[name=wpSection]' ).val() == '' ) |
| 2334 | + if ( $( 'input[name=wpSection]' ).val() == '' ) { |
2340 | 2335 | structure.unshift( { 'text': wgPageName.replace(/_/g, ' '), 'level': 1, 'index': 0, 'position': 0 } ); |
| 2336 | + } |
2341 | 2337 | context.modules.$toc.html( buildList( structure ) ); |
2342 | | - |
2343 | | - context.modules.$toc.find( 'ul' ).css( 'width', '10em' ); |
2344 | | - |
2345 | | - var links = context.modules.$toc.find( 'ul a' ); |
2346 | | - // Highlighted links are wider; autoEllipse links in |
2347 | | - // highlighted state |
2348 | | - links.addClass( 'currentSelection' ); |
2349 | | - links.autoEllipse( { 'position': 'right', 'tooltip': true } ); |
2350 | | - links.removeClass( 'currentSelection' ); |
| 2338 | + context.modules.$toc.find( 'div' ).autoEllipse( { 'position': 'right', 'tooltip': true } ); |
2351 | 2339 | // Cache the outline for later use |
2352 | 2340 | context.data.outline = outline; |
2353 | 2341 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -11,10 +11,8 @@ |
12 | 12 | {var i=0,l=array.length,loop=opts.loop||function(){};$.whileAsync($.extend(opts,{test:function(){return i<l;},loop:function() |
13 | 13 | {var val=array[i];return loop.call(val,i++,val);}}));} |
14 | 14 | $.fn.eachAsync=function(opts) |
15 | | -{$.eachAsync(this,opts);return this;}})(jQuery);(function($){$.fn.autoEllipse=function(options){$(this).each(function(){options=$.extend({'position':'center','tooltip':false},options);var text=$(this).text();var $text=$('<span />').text(text).css('whiteSpace','nowrap');$(this).empty().append($text);if($text.outerWidth()>$(this).innerWidth()){switch(options.position){case'right':var l=0,r=text.length;var ow,iw;do{var m=Math.ceil((l+r)/2);$text.text(text.substr(0,m)+'...');ow=$text.outerWidth();iw=$(this).innerWidth();if(ow>iw) |
16 | | -r=m-1;else |
17 | | -l=m;}while(l<r);break;case'center':var i=[Math.round(text.length/2),Math.round(text.length/2)];var side=1;while($text.outerWidth()>($(this).innerWidth())&&i[0]>0){$text.text(text.substr(0,i[0])+'...'+text.substr(i[1]));if(side==0){i[0]--;side=1;}else{i[1]++;side=0;}} |
18 | | -break;case'left':var r=0;while($text.outerWidth()>$(this).innerWidth()&&r<text.length){$text.text('...'+text.substr(r));r++;} |
| 15 | +{$.eachAsync(this,opts);return this;}})(jQuery);(function($){$.fn.autoEllipse=function(options){$(this).each(function(){options=$.extend({'position':'center','tooltip':false},options);var text=$(this).text();var $text=$('<span />').text(text).css('whiteSpace','nowrap');$(this).empty().append($text);if($text.outerWidth()>$(this).innerWidth()){switch(options.position){case'right':var l=0,r=text.length;do{var m=Math.ceil((l+r)/2);$text.text(text.substr(0,m)+'...');if($text.outerWidth()>$(this).width()){r=m-1;}else{l=m;}}while(l<r);break;case'center':var i=[Math.round(text.length/2),Math.round(text.length/2)];var side=1;while($text.outerWidth()>($(this).width())&&i[0]>0){$text.text(text.substr(0,i[0])+'...'+text.substr(i[1]));if(side==0){i[0]--;side=1;}else{i[1]++;side=0;}} |
| 16 | +break;case'left':var r=0;while($text.outerWidth()>$(this).width()&&r<text.length){$text.text('...'+text.substr(r));r++;} |
19 | 17 | break;} |
20 | 18 | if(options.tooltip) |
21 | 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]);} |
— | — | @@ -132,7 +130,7 @@ |
133 | 131 | return html;},buildRow:function(context,row){var html='<tr>';for(cell in row){html+='<td class="cell cell-'+cell+'" valign="top"><span>'+ |
134 | 132 | $.wikiEditor.autoMsg(row[cell],['html','text'])+'</span></td>';} |
135 | 133 | html+='</tr>';return html;},buildCharacter:function(character,actions){if(typeof character=='string'){character={'label':character,'action':{'type':'encapsulate','options':{'pre':character}}};}else if(0 in character&&1 in character){character={'label':character[0],'action':{'type':'encapsulate','options':{'pre':character[1]}}};} |
136 | | -if('action'in character&&'label'in character){actions[character.label]=character.action;return'<a rel="'+character.label+'" href="#">'+character.label+'</a>';}},buildTab:function(context,id,section){var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');return $('<span />').attr({'class':'tab tab-'+id,'rel':id}).append($('<a />').addClass(selected==id?'current':null).attr('href','#').text($.wikiEditor.autoMsg(section,'label')).data('context',context).click(function(){var $sections=$(this).data('context').$ui.find('.sections');var $section=$(this).data('context').$ui.find('.section-'+$(this).parent().attr('rel'));$(this).blur();var show=$section.css('display')=='none';$previousSections=$section.parent().find('.section:visible');$previousSections.css('position','absolute');$previousSections.fadeOut('fast',function(){$(this).css('position','relative');});$(this).parent().parent().find('a').removeClass('current');if(show){$section.fadeIn('fast');$sections.animate({'height':$section.outerHeight()},'fast');$(this).addClass('current');}else{$sections.animate({'height':0});} |
| 134 | +if('action'in character&&'label'in character){actions[character.label]=character.action;return'<a rel="'+character.label+'" href="#">'+character.label+'</a>';}},buildTab:function(context,id,section){var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');return $('<span />').attr({'class':'tab tab-'+id,'rel':id}).append($('<a />').addClass(selected==id?'current':null).attr('href','#').text($.wikiEditor.autoMsg(section,'label')).data('context',context).click(function(){var $sections=$(this).data('context').$ui.find('.sections');var $section=$(this).data('context').$ui.find('.section-'+$(this).parent().attr('rel'));$(this).blur();var show=$section.css('display')=='none';$previousSections=$section.parent().find('.section:visible');$previousSections.css('position','absolute');$previousSections.fadeOut('fast',function(){$(this).css('position','relative');});$(this).parent().parent().find('a').removeClass('current');if(show){$section.fadeIn('fast');$sections.animate({'height':$section.outerHeight()},$section.outerHeight()*2);$(this).addClass('current');}else{$sections.animate({'height':0},$section.outerHeight()*2);} |
137 | 135 | if($.trackAction!=undefined){$.trackAction($section.attr('rel')+'.'+(show?'show':'hide'));} |
138 | 136 | $.cookie('wikiEditor-'+$(this).data('context').instance+'-toolbar-section',show?$section.attr('rel'):null);return false;}));},buildSection:function(context,id,section){context.$textarea.trigger('wikiEditor-toolbar-buildSection-'+id,[section]);var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');var $section;switch(section.type){case'toolbar':var $section=$('<div />').attr({'class':'toolbar section section-'+id,'rel':id});if('groups'in section){for(group in section.groups){$section.append($.wikiEditor.modules.toolbar.fn.buildGroup(context,group,section.groups[group]));}} |
139 | 137 | break;case'booklet':var $pages=$('<div />').addClass('pages');var $index=$('<div />').addClass('index');if('pages'in section){for(page in section.pages){$pages.append($.wikiEditor.modules.toolbar.fn.buildPage(context,page,section.pages[page]));$index.append($.wikiEditor.modules.toolbar.fn.buildBookmark(context,page,section.pages[page]));}} |
— | — | @@ -140,16 +138,16 @@ |
141 | 139 | if($section!==null&&id!=='main'){var show=selected==id;$section.css('display',show?'block':'none');} |
142 | 140 | return $section;},updateBookletSelection:function(context,id,$pages,$index){var cookie='wikiEditor-'+context.instance+'-booklet-'+id+'-page';var selected=$.cookie(cookie);var $selectedIndex=$index.find('*[rel='+selected+']');if($selectedIndex.size()==0){selected=$index.children().eq(0).attr('rel');$.cookie(cookie,selected);} |
143 | 141 | $pages.children().hide();$pages.find('*[rel='+selected+']').show();$index.children().removeClass('current');$selectedIndex.addClass('current');},build:function(context,config){var $tabs=$('<div />').addClass('tabs').appendTo(context.modules.$toolbar);var $sections=$('<div />').addClass('sections').appendTo(context.modules.$toolbar);context.modules.$toolbar.append($('<div />').css('clear','both'));var sectionQueue=[];for(section in config){if(section=='main'){context.modules.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,config[section]));}else{sectionQueue.push({'$sections':$sections,'context':context,'id':section,'config':config[section]});$tabs.append($.wikiEditor.modules.toolbar.fn.buildTab(context,section,config[section]));}} |
144 | | -$.eachAsync(sectionQueue,{'bulk':0,'end':function(){$('body').css('position','static');$('body').css('position','relative');},'loop':function(i,s){s.$sections.append($.wikiEditor.modules.toolbar.fn.buildSection(s.context,s.id,s.config));var $section=s.$sections.find('.section:visible');if($section.size()){$sections.animate({'height':$section.outerHeight()},'fast');}}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={api:{},fn:{create:function(context,config){if('$toc'in context.modules){return;} |
| 142 | +$.eachAsync(sectionQueue,{'bulk':0,'end':function(){$('body').css('position','static');$('body').css('position','relative');},'loop':function(i,s){s.$sections.append($.wikiEditor.modules.toolbar.fn.buildSection(s.context,s.id,s.config));var $section=s.$sections.find('.section:visible');if($section.size()){$sections.animate({'height':$section.outerHeight()},$section.outerHeight()*2);}}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={api:{},fn:{create:function(context,config){if('$toc'in context.modules){return;} |
145 | 143 | context.modules.$toc=$('<div />').addClass('wikiEditor-ui-toc').attr('id','wikiEditor-ui-toc');var height=context.$ui.find('.wikiEditor-ui-bottom').height() |
146 | | -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','marginTop':-(height)});context.$ui.find('.wikiEditor-ui-text').css(($('body.rtl').size()?'marginLeft':'marginRight'),'12em');$.wikiEditor.modules.toc.fn.build(context,config);context.$textarea.delayedBind(1000,'keyup encapsulateSelection change',function(event){var context=$(this).data('wikiEditor-context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).bind('mouseup scrollToPosition focus keyup encapsulateSelection change',function(event){var context=$(this).data('wikiEditor-context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.update(context);}});}).blur(function(){var context=$(this).data('wikiEditor-context');$.wikiEditor.modules.toc.fn.unhighlight(context);});},unhighlight:function(context){context.modules.$toc.find('a').removeClass('currentSelection');},update:function(context){$.wikiEditor.modules.toc.fn.unhighlight(context);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++;} |
| 144 | +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','marginTop':-(height)});context.$ui.find('.wikiEditor-ui-text').css(($('body.rtl').size()?'marginLeft':'marginRight'),'12em');$.wikiEditor.modules.toc.fn.build(context,config);context.$textarea.delayedBind(1000,'keyup encapsulateSelection change',function(event){var context=$(this).data('wikiEditor-context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).bind('mouseup scrollToPosition focus keyup encapsulateSelection change',function(event){var context=$(this).data('wikiEditor-context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.update(context);}});}).blur(function(){var context=$(this).data('wikiEditor-context');$.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.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++;} |
147 | 145 | section=Math.max(0,section);} |
148 | | -var sectionLink=context.modules.$toc.find('a.section-'+section);sectionLink.addClass('currentSelection');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) |
| 146 | +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) |
149 | 147 | context.modules.$toc.scrollTop(scrollTop+relTop);else if(relTop+sectionHeight>divHeight) |
150 | 148 | context.modules.$toc.scrollTop(scrollTop+relTop+sectionHeight-divHeight);}},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;} |
151 | 149 | sections[sections.length]=outline[i];}else if(outline[i].nLevel<level){break;}} |
152 | 150 | return sections;} |
153 | | -function buildList(structure){var list=$('<ul />');for(i in structure){var item=$('<li />').append($('<a />').attr('href','#').addClass('section-'+structure[i].index).data('textbox',context.$textarea).data('position',structure[i].position).click(function(event){$(this).data('textbox').focus().setSelection($(this).data('position')).scrollToCaretPosition(true);if(typeof $.trackAction!='undefined') |
| 151 | +function buildList(structure){var list=$('<ul></ul>');for(i in structure){var item=$('<li></li>').append($('<div></div>').attr('href','#').addClass('section-'+structure[i].index).data('textbox',context.$textarea).data('position',structure[i].position).bind('mousedown',function(event){$(this).data('textbox').focus().setSelection($(this).data('position')).scrollToCaretPosition(true);if(typeof $.trackAction!='undefined') |
154 | 152 | $.trackAction('ntoc.heading');event.preventDefault();}).text(structure[i].text));if(structure[i].sections!==undefined){item.append(buildList(structure[i].sections));} |
155 | 153 | list.append(item);} |
156 | 154 | return list;} |
— | — | @@ -161,5 +159,5 @@ |
162 | 160 | else if(outline[i].level<lastLevel){nLevel-=Math.max(1,lastLevel-outline[i].level);} |
163 | 161 | if(nLevel<=0){nLevel=1;} |
164 | 162 | outline[i].nLevel=nLevel;lastLevel=outline[i].level;} |
165 | | -var structure=buildStructure(outline);if($('input[name=wpSection]').val()=='') |
166 | | -structure.unshift({'text':wgPageName.replace(/_/g,' '),'level':1,'index':0,'position':0});context.modules.$toc.html(buildList(structure));context.modules.$toc.find('ul').css('width','10em');var links=context.modules.$toc.find('ul a');links.addClass('currentSelection');links.autoEllipse({'position':'right','tooltip':true});links.removeClass('currentSelection');context.data.outline=outline;}}};})(jQuery); |
\ No newline at end of file |
| 163 | +var structure=buildStructure(outline);if($('input[name=wpSection]').val()==''){structure.unshift({'text':wgPageName.replace(/_/g,' '),'level':1,'index':0,'position':0});} |
| 164 | +context.modules.$toc.html(buildList(structure));context.modules.$toc.find('div').autoEllipse({'position':'right','tooltip':true});context.data.outline=outline;}}};})(jQuery); |
\ No newline at end of file |
Index: trunk/extensions/UsabilityInitiative/Makefile |
— | — | @@ -4,30 +4,34 @@ |
5 | 5 | # For more info on JSMin, see: http://www.crockford.com/javascript/jsmin.html |
6 | 6 | # |
7 | 7 | |
8 | | -CSS := css/suggestions.css\ |
9 | | - css/wikiEditor.css\ |
10 | | - css/wikiEditor.dialogs.css\ |
11 | | - css/wikiEditor.toc.css\ |
12 | | - css/wikiEditor.toolbar.css |
| 8 | +CSS := \ |
| 9 | + css/suggestions.css\ |
| 10 | + css/wikiEditor.css\ |
| 11 | + css/wikiEditor.dialogs.css\ |
| 12 | + css/wikiEditor.toc.css\ |
| 13 | + css/wikiEditor.toolbar.css |
13 | 14 | |
14 | | -JS2 := js/js2/jquery-1.3.2.js\ |
15 | | - js/js2/jquery-ui-1.7.2.js\ |
16 | | - js/js2/js2.js |
| 15 | +JS2 := \ |
| 16 | + js/js2/jquery-1.3.2.js\ |
| 17 | + js/js2/jquery-ui-1.7.2.js\ |
| 18 | + js/js2/js2.js |
17 | 19 | |
18 | | -PLUGINS := js/plugins/jquery.async.js\ |
19 | | - js/plugins/jquery.autoEllipse.js\ |
20 | | - js/plugins/jquery.browser.js\ |
21 | | - js/plugins/jquery.cookie.js\ |
22 | | - js/plugins/jquery.delayedBind.js\ |
23 | | - js/plugins/jquery.namespaceSelect.js\ |
24 | | - js/plugins/jquery.suggestions.js\ |
25 | | - js/plugins/jquery.textSelection.js\ |
26 | | - js/plugins/jquery.wikiEditor.js\ |
27 | | - js/plugins/jquery.wikiEditor.dialogs.js\ |
28 | | - js/plugins/jquery.wikiEditor.toolbar.js\ |
29 | | - js/plugins/jquery.wikiEditor.toc.js |
| 20 | +PLUGINS := \ |
| 21 | + js/plugins/jquery.async.js\ |
| 22 | + js/plugins/jquery.autoEllipse.js\ |
| 23 | + js/plugins/jquery.browser.js\ |
| 24 | + js/plugins/jquery.cookie.js\ |
| 25 | + js/plugins/jquery.delayedBind.js\ |
| 26 | + js/plugins/jquery.namespaceSelect.js\ |
| 27 | + js/plugins/jquery.suggestions.js\ |
| 28 | + js/plugins/jquery.textSelection.js\ |
| 29 | + js/plugins/jquery.wikiEditor.js\ |
| 30 | + js/plugins/jquery.wikiEditor.dialogs.js\ |
| 31 | + js/plugins/jquery.wikiEditor.toolbar.js\ |
| 32 | + js/plugins/jquery.wikiEditor.toc.js |
30 | 33 | |
31 | | -all: css/combined.css\ |
| 34 | +all: \ |
| 35 | + css/combined.css\ |
32 | 36 | css/combined.min.css\ |
33 | 37 | js/js2.combined.js\ |
34 | 38 | js/js2.combined.min.js\ |
— | — | @@ -43,21 +47,25 @@ |
44 | 48 | js/plugins.combined.js: $(PLUGINS) |
45 | 49 | cat $(PLUGINS) > js/plugins.combined.js |
46 | 50 | |
47 | | -js/js2.combined.min.js : js/js2.combined.js ./jsmin |
48 | | - jsmin < js/js2.combined.js > js/js2.combined.min.js |
| 51 | +js/js2.combined.min.js : js/js2.combined.js jsmin |
| 52 | + if [ -e ./jsmin ]; then ./jsmin < js/js2.combined.js > js/js2.combined.min.js;\ |
| 53 | + else jsmin < js/js2.combined.js > js/js2.combined.min.js; fi |
49 | 54 | |
50 | | -js/plugins.combined.min.js : js/plugins.combined.js ./jsmin |
51 | | - jsmin < js/plugins.combined.js > js/plugins.combined.min.js |
| 55 | +js/plugins.combined.min.js : js/plugins.combined.js jsmin |
| 56 | + if [ -e ./jsmin ]; then ./jsmin < js/plugins.combined.js > js/plugins.combined.min.js;\ |
| 57 | + else jsmin < js/plugins.combined.js > js/plugins.combined.min.js; fi |
52 | 58 | |
53 | 59 | css/combined.min.css : css/combined.css |
54 | | - cat css/combined.css |\ |
55 | | - sed -e 's/^[ ]*//g; s/[ ]*$$//g; s/\([:{;,]\) /\1/g; s/ {/{/g; s/\/\*.*\*\///g; /^$$/d'\ |
| 60 | + cat css/combined.css | sed -e 's/^[ ]*//g; s/[ ]*$$//g; s/\([:{;,]\) /\1/g; s/ {/{/g; s/\/\*.*\*\///g; /^$$/d'\ |
56 | 61 | > css/combined.min.css |
57 | 62 | |
58 | | -./jsmin: |
59 | | - wget http://www.crockford.com/javascript/jsmin.c |
60 | | - gcc jsmin.c -o jsmin |
| 63 | +jsmin: |
| 64 | + type -P jsmin &>/dev/null || ( wget http://www.crockford.com/javascript/jsmin.c; gcc jsmin.c -o jsmin ) |
61 | 65 | |
| 66 | +distclean: clean |
| 67 | + rm -rf jsmin |
| 68 | + rm -rf jsmin.c |
| 69 | + |
62 | 70 | clean: |
63 | 71 | rm -f js/js2.combined.* |
64 | 72 | rm -f js/plugins.combined.* |