r101662 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101661‎ | r101662 | r101663 >
Date:19:09, 2 November 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Swtiched from using .editSurface in CSS classes to .es to better match the names of things in JavaScript
Modified paths:
  • /trunk/parsers/wikidom/lib/hype/bases/es.DocumentViewLeafNode.js (modified) (history)
  • /trunk/parsers/wikidom/lib/hype/es.Surface.css (modified) (history)
  • /trunk/parsers/wikidom/lib/hype/views/es.ContentView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/hype/views/es.DocumentView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/hype/views/es.HeadingView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/hype/views/es.ListItemView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/hype/views/es.ListView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/hype/views/es.ParagraphView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/hype/views/es.SurfaceView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/hype/views/es.TableCellView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/hype/views/es.TableRowView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/hype/views/es.TableView.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/hype/es.Surface.css
@@ -1,8 +1,8 @@
2 -.editSurface {
 2+.es-surfaceView {
33 overflow: hidden;
44 }
55
6 -.editSurface-surfaceView-input {
 6+.es-surfaceView-input {
77 position: absolute;
88 z-index: -1;
99 opacity: 0;
@@ -14,11 +14,11 @@
1515 width: 1px;
1616 }
1717
18 -.editSurface-surfaceView-input:focus {
 18+.es-surfaceView-input:focus {
1919 outline: none;
2020 }
2121
22 -.editSurface-surfaceView-cursor {
 22+.es-surfaceView-cursor {
2323 position: absolute;
2424 background-color: black;
2525 width: 1px;
@@ -27,21 +27,21 @@
2828 display: none;
2929 }
3030
31 -.editSurface-documentView {
 31+.es-documentView {
3232 cursor: text;
3333 margin-top: 1em;
3434 overflow: hidden;
3535 -webkit-user-select: none;
3636 }
3737
38 -.editSurface-contentView {
 38+.es-contentView {
3939 position: relative;
4040 }
4141
42 -.editSurface-headingView,
43 -.editSurface-tableView,
44 -.editSurface-listView,
45 -.editSurface-paragraphView {
 42+.es-headingView,
 43+.es-tableView,
 44+.es-listView,
 45+.es-paragraphView {
4646 margin: 1em;
4747 margin-top: 0;
4848 position: relative;
@@ -49,61 +49,61 @@
5050 font-size: 1em;
5151 }
5252
53 -.editSurface-headingView-level1,
54 -.editSurface-headingView-level2 {
 53+.es-headingView-level1,
 54+.es-headingView-level2 {
5555 border-bottom: 1px solid #AAA;
5656 }
5757
58 -.editSurface-headingView-level1 > * {
 58+.es-headingView-level1 > * {
5959 font-size:188%;
6060 font-weight: normal;
6161 }
6262
63 -.editSurface-headingView-level2 > * {
 63+.es-headingView-level2 > * {
6464 font-size:150%;
6565 font-weight: normal;
6666 }
6767
68 -.editSurface-headingView-level3 > * {
 68+.es-headingView-level3 > * {
6969 font-size:132%;
7070 font-weight: bold;
7171 }
7272
73 -.editSurface-headingView-level4 > * {
 73+.es-headingView-level4 > * {
7474 font-size:116%;
7575 font-weight: bold;
7676 }
7777
78 -.editSurface-headingView-level5 > * {
 78+.es-headingView-level5 > * {
7979 font-size:100%;
8080 font-weight: bold;
8181 }
8282
83 -.editSurface-headingView-level6 > * {
 83+.es-headingView-level6 > * {
8484 font-size:80%;
8585 font-weight: bold;
8686 }
8787
88 -.editSurface-listItemView {
 88+.es-listItemView {
8989 position: relative;
9090 padding: 0 0 0 1em;
9191 background-position: left 0.6em;
9292 background-repeat: no-repeat;
9393 }
9494
95 -.editSurface-listItemView-bullet {
 95+.es-listItemView-bullet {
9696 background-image: url(images/bullet.png);
9797 }
9898
99 -.editSurface-listItemView-number {
 99+.es-listItemView-number {
100100 /* */
101101 }
102102
103 -.editSurface-listItemView-bullet .editSurface-listItemView-icon {
 103+.es-listItemView-bullet .es-listItemView-icon {
104104 display: none;
105105 }
106106
107 -.editSurface-listItemView-number .editSurface-listItemView-icon {
 107+.es-listItemView-number .es-listItemView-icon {
108108 position: absolute;
109109 right: 100%;
110110 margin-right: -0.5em;
@@ -111,43 +111,43 @@
112112 line-height: 1.5em;
113113 }
114114
115 -.editSurface-listItemView-level0 {
 115+.es-listItemView-level0 {
116116 margin-left: 0.5em;
117117 }
118118
119 -.editSurface-listItemView-level1 {
 119+.es-listItemView-level1 {
120120 margin-left: 2.5em;
121121 }
122122
123 -.editSurface-listItemView-level2 {
 123+.es-listItemView-level2 {
124124 margin-left: 4.5em;
125125 }
126126
127 -.editSurface-listItemView-level3 {
 127+.es-listItemView-level3 {
128128 margin-left: 6.5em;
129129 }
130130
131 -.editSurface-listItemView-level4 {
 131+.es-listItemView-level4 {
132132 margin-left: 8.5em;
133133 }
134134
135 -.editSurface-listItemView-level5 {
 135+.es-listItemView-level5 {
136136 margin-left: 10.5em;
137137 }
138138
139 -.editSurface-listItemView-level6 {
 139+.es-listItemView-level6 {
140140 margin-left: 12.5em;
141141 }
142142
143 -.editSurface-contentView-line,
144 -.editSurface-contentView-ruler {
 143+.es-contentView-line,
 144+.es-contentView-ruler {
145145 line-height: 1.5em;
146146 cursor: text;
147147 white-space: nowrap;
148148 color: #000000;
149149 }
150150
151 -.editSurface-contentView-ruler {
 151+.es-contentView-ruler {
152152 position: absolute;
153153 top: 0;
154154 left: 0;
@@ -155,16 +155,16 @@
156156 z-index: -1000;
157157 }
158158
159 -.editSurface-contentView-line.empty {
 159+.es-contentView-line.empty {
160160 display: block;
161161 width: 0px;
162162 }
163163
164 -.editSurface-contentView-whitespace {
 164+.es-contentView-whitespace {
165165 color: #ffffff;
166166 }
167167
168 -.editSurface-contentView-range {
 168+.es-contentView-range {
169169 display: none;
170170 position: absolute;
171171 background-color: #bbffcc;
@@ -172,7 +172,7 @@
173173 z-index: -1;
174174 }
175175
176 -.editSurface-contentView-format-object {
 176+.es-contentView-format-object {
177177 background-color: rgba(0,0,0,0.05);
178178 border-radius: 0.25em;
179179 margin: 1px 0 1px 1px;
@@ -180,43 +180,43 @@
181181 cursor: default;
182182 }
183183
184 -.editSurface-contentView-format-object * {
 184+.es-contentView-format-object * {
185185 cursor: default !important;
186186 }
187187
188 -.editSurface-contentView-format-object a:link,
189 -.editSurface-contentView-format-object a:visited,
190 -.editSurface-contentView-format-object a:active {
 188+.es-contentView-format-object a:link,
 189+.es-contentView-format-object a:visited,
 190+.es-contentView-format-object a:active {
191191 color: blue;
192192 }
193193
194 -.editSurface-contentView-format-italic {
 194+.es-contentView-format-italic {
195195 font-style: italic;
196196 }
197197
198 -.editSurface-contentView-format-bold {
 198+.es-contentView-format-bold {
199199 font-weight: bold;
200200 }
201201
202 -.editSurface-contentView-format-link {
 202+.es-contentView-format-link {
203203 color: blue;
204204 text-decoration: underline;
205205 }
206206
207 -.editSurface-contentView-format-big {
 207+.es-contentView-format-big {
208208 font-size: 1.2em;
209209 }
210210
211 -.editSurface-contentView-format-small,
212 -.editSurface-contentView-format-sub,
213 -.editSurface-contentView-format-super {
 211+.es-contentView-format-small,
 212+.es-contentView-format-sub,
 213+.es-contentView-format-super {
214214 font-size: .8em;
215215 }
216216
217 -.editSurface-contentView-format-sub {
 217+.es-contentView-format-sub {
218218 vertical-align: sub;
219219 }
220220
221 -.editSurface-contentView-format-super {
 221+.es-contentView-format-super {
222222 vertical-align: super;
223223 }
Index: trunk/parsers/wikidom/lib/hype/bases/es.DocumentViewLeafNode.js
@@ -12,7 +12,7 @@
1313 es.DocumentViewNode.call( this, model, $element );
1414
1515 // Properties
16 - this.$content = $( '<div class="editSurface-content"></div>' ).appendTo( this.$ );
 16+ this.$content = $( '<div class="es-content"></div>' ).appendTo( this.$ );
1717 this.contentView = new es.ContentView( this.$content, model );
1818 };
1919
Index: trunk/parsers/wikidom/lib/hype/views/es.ParagraphView.js
@@ -11,7 +11,7 @@
1212 es.DocumentViewLeafNode.call( this, model );
1313
1414 // DOM Changes
15 - this.$.addClass( 'editSurface-paragraphView' );
 15+ this.$.addClass( 'es-paragraphView' );
1616 };
1717
1818 /* Inheritance */
Index: trunk/parsers/wikidom/lib/hype/views/es.TableCellView.js
@@ -13,7 +13,7 @@
1414 // DOM Changes
1515 this.$
1616 .attr( 'style', model.getElementAttribute( 'html/style' ) )
17 - .addClass( 'editSurface-tableCellView' );
 17+ .addClass( 'es-tableCellView' );
1818 };
1919
2020 /* Inheritance */
Index: trunk/parsers/wikidom/lib/hype/views/es.TableView.js
@@ -13,7 +13,7 @@
1414 // DOM Changes
1515 this.$
1616 .attr( 'style', model.getElementAttribute( 'html/style' ) )
17 - .addClass( 'editSurface-tableView' );
 17+ .addClass( 'es-tableView' );
1818 };
1919
2020 /* Inheritance */
Index: trunk/parsers/wikidom/lib/hype/views/es.SurfaceView.js
@@ -7,7 +7,7 @@
88 * @param {es.SurfaceModel} model Surface model to view
99 */
1010 es.SurfaceView = function( $container, model ) {
11 - this.$ = $container.addClass( 'editSurface' );
 11+ this.$ = $container.addClass( 'es-surfaceView' );
1212 this.$window = $( window );
1313 this.model = model;
1414
@@ -16,7 +16,7 @@
1717 this.$.append( this.documentView.$ );
1818
1919 this.cursor = {
20 - $: $( '<div class="editSurface-surfaceView-cursor"></div>' ).appendTo( this.$ ),
 20+ $: $( '<div class="es-surfaceView-cursor"></div>' ).appendTo( this.$ ),
2121 interval: null,
2222 offset: null,
2323 initialLeft: null
@@ -46,30 +46,30 @@
4747 } );
4848
4949 // Hidden input
50 - this.$input = $( '<input class="editSurface-surfaceView-input" />' )
 50+ this.$input = $( '<input class="es-surfaceView-input" />' )
5151 .prependTo( this.$ )
5252 .on( {
5353 'focus' : function() {
5454 //console.log("focus");
55 - $document.off( '.editSurface' );
 55+ $document.off( '.es-surfaceView' );
5656 $document.on({
57 - 'mousemove.editSurface' : function(e) {
 57+ 'mousemove.es-surfaceView': function(e) {
5858 //return surfaceView.onMouseMove( e );
5959 },
60 - 'mouseup.editSurface' : function(e) {
 60+ 'mouseup.es-surfaceView': function(e) {
6161 //return surfaceView.onMouseUp( e );
6262 },
63 - 'keydown.editSurface' : function( e ) {
 63+ 'keydown.es-surfaceView': function( e ) {
6464 return surfaceView.onKeyDown( e );
6565 },
66 - 'keyup.editSurface' : function( e ) {
 66+ 'keyup.es-surfaceView': function( e ) {
6767 return surfaceView.onKeyUp( e );
6868 }
6969 });
7070 },
7171 'blur': function( e ) {
7272 //console.log("blur");
73 - $document.off( '.editSurface' );
 73+ $document.off( '.es-surfaceView' );
7474 surfaceView.hideCursor();
7575 }
7676 } ).focus();
Index: trunk/parsers/wikidom/lib/hype/views/es.ContentView.js
@@ -45,10 +45,10 @@
4646 } );
4747
4848 // DOM Changes
49 - this.$ranges = $( '<div class="editSurface-contentView-ranges"></div>' );
50 - this.$rangeStart = $( '<div class="editSurface-contentView-range"></div>' );
51 - this.$rangeFill = $( '<div class="editSurface-contentView-range"></div>' );
52 - this.$rangeEnd = $( '<div class="editSurface-contentView-range"></div>' );
 49+ this.$ranges = $( '<div class="es-contentView-ranges"></div>' );
 50+ this.$rangeStart = $( '<div class="es-contentView-range"></div>' );
 51+ this.$rangeFill = $( '<div class="es-contentView-range"></div>' );
 52+ this.$rangeEnd = $( '<div class="es-contentView-range"></div>' );
5353 this.$.prepend( this.$ranges.append( this.$rangeStart, this.$rangeFill, this.$rangeEnd ) );
5454
5555 // Initialization
@@ -70,7 +70,7 @@
7171 es.ContentView.annotationRenderers = {
7272 'template': {
7373 'open': function( data ) {
74 - return '<span class="editSurface-contentView-format-object">' + data.html;
 74+ return '<span class="es-contentView-format-object">' + data.html;
7575 },
7676 'close': '</span>',
7777 'float': function( data ) {
@@ -79,41 +79,39 @@
8080 }
8181 },
8282 'bold': {
83 - 'open': '<span class="editSurface-contentView-format-bold">',
 83+ 'open': '<span class="es-contentView-format-bold">',
8484 'close': '</span>',
8585 'float': false
8686 },
8787 'italic': {
88 - 'open': '<span class="editSurface-contentView-format-italic">',
 88+ 'open': '<span class="es-contentView-format-italic">',
8989 'close': '</span>',
9090 'float': false
9191 },
9292 'size': {
9393 'open': function( data ) {
94 - return '<span class="editSurface-contentView-format-' + data.type + '">';
 94+ return '<span class="es-contentView-format-' + data.type + '">';
9595 },
9696 'close': '</span>',
9797 'float': false
9898 },
9999 'script': {
100100 'open': function( data ) {
101 - return '<span class="editSurface-contentView-format-' + data.type + '">';
 101+ return '<span class="es-contentView-format-' + data.type + '">';
102102 },
103103 'close': '</span>',
104104 'float': false
105105 },
106106 'xlink': {
107107 'open': function( data ) {
108 - return '<span class="editSurface-contentView-format-link" data-href="' + data.href +
109 - '">';
 108+ return '<span class="es-contentView-format-link" data-href="' + data.href + '">';
110109 },
111110 'close': '</span>',
112111 'float': false
113112 },
114113 'ilink': {
115114 'open': function( data ) {
116 - return '<span class="editSurface-contentView-format-link" data-title="' + data.title +
117 - '">';
 115+ return '<span class="es-contentView-format-link" data-title="' + data.title + '">';
118116 },
119117 'close': '</span>',
120118 'float': false
@@ -132,8 +130,8 @@
133131 '>': '&gt;',
134132 '\'': '&#039;',
135133 '"': '&quot;',
136 - '\n': '<span class="editSurface-contentView-whitespace">&#182;</span>',
137 - '\t': '<span class="editSurface-contentView-whitespace">&#8702;</span>',
 134+ '\n': '<span class="es-contentView-whitespace">&#182;</span>',
 135+ '\t': '<span class="es-contentView-whitespace">&#8702;</span>',
138136 ' ': '&nbsp;'
139137 };
140138
@@ -366,7 +364,7 @@
367365 * TODO: The offset needs to be chosen based on nearest offset to the cursor, not offset before
368366 * the cursor.
369367 */
370 - var $ruler = $( '<div class="editSurface-contentView-ruler"></div>' ).appendTo( this.$ ),
 368+ var $ruler = $( '<div class="es-contentView-ruler"></div>' ).appendTo( this.$ ),
371369 ruler = $ruler[0],
372370 fit = this.fitCharacters( line.range, ruler, position.left ),
373371 center;
@@ -451,7 +449,7 @@
452450 * measuring for those cases.
453451 */
454452 if ( line.range.start < offset ) {
455 - var $ruler = $( '<div class="editSurface-contentView-ruler"></div>' ).appendTo( this.$ ),
 453+ var $ruler = $( '<div class="es-contentView-ruler"></div>' ).appendTo( this.$ ),
456454 ruler = $ruler[0];
457455 ruler.innerHTML = this.getHtml( new es.Range( line.range.start, offset ) );
458456 position.left = ruler.clientWidth;
@@ -564,7 +562,7 @@
565563 // Cleanup
566564 rs.$ruler.remove();
567565 this.lines = rs.lines;
568 - this.$.find( '.editSurface-contentView-line[line-index=' + ( this.lines.length - 1 ) + ']' )
 566+ this.$.find( '.es-contentView-line[line-index=' + ( this.lines.length - 1 ) + ']' )
569567 .nextAll()
570568 .remove();
571569 rs.timeout = undefined;
@@ -606,7 +604,7 @@
607605 // In case of empty content model we still want to display empty with non-breaking space inside
608606 // This is very important for lists
609607 if(this.model.getContentLength() === 0) {
610 - var $line = $( '<div class="editSurface-contentView-line" line-index="0">&nbsp;</div>' );
 608+ var $line = $( '<div class="es-contentView-line" line-index="0">&nbsp;</div>' );
611609 this.$.empty().append( $line );
612610 this.lines = [{
613611 'text': ' ',
@@ -628,7 +626,7 @@
629627 */
630628 rs.$ruler = $( '<div>&nbsp;</div>' ).appendTo( this.$ );
631629 rs.width = rs.$ruler.innerWidth();
632 - rs.ruler = rs.$ruler.addClass('editSurface-contentView-ruler')[0];
 630+ rs.ruler = rs.$ruler.addClass('es-contentView-ruler')[0];
633631 // Ignore offset optimization if the width has changed or the text has never been flowed before
634632 if (this.width !== rs.width) {
635633 offset = undefined;
@@ -674,7 +672,7 @@
675673 $line = this.$.children( '[line-index=' + lineCount + ']' );
676674 if ( !$line.length ) {
677675 $line = $(
678 - '<div class="editSurface-contentView-line" line-index="' + lineCount + '"></div>'
 676+ '<div class="es-contentView-line" line-index="' + lineCount + '"></div>'
679677 );
680678 this.$.append( $line );
681679 }
@@ -689,7 +687,7 @@
690688 'fractional': fractional
691689 });
692690 // Disable links within rendered content
693 - $line.find( '.editSurface-contentView-format-object a' )
 691+ $line.find( '.es-contentView-format-object a' )
694692 .mousedown( function( e ) {
695693 e.preventDefault();
696694 } )
Index: trunk/parsers/wikidom/lib/hype/views/es.ListItemView.js
@@ -11,10 +11,10 @@
1212 es.DocumentViewLeafNode.call( this, model );
1313
1414 // Properties
15 - this.$icon = $( '<div class="editSurface-listItemView-icon"></div>' ).prependTo( this.$ );
 15+ this.$icon = $( '<div class="es-listItemView-icon"></div>' ).prependTo( this.$ );
1616
1717 // DOM Changes
18 - this.$.addClass( 'editSurface-listItemView' );
 18+ this.$.addClass( 'es-listItemView' );
1919
2020 // Events
2121 this.on( 'update', this.setClasses );
@@ -31,13 +31,13 @@
3232 .attr(
3333 'class',
3434 classes
35 - .replace( /editSurface-listItemView-level[0-9]+/, '' )
36 - .replace( /editSurface-listItemView-(bullet|number)/, '' )
 35+ .replace( /es-listItemView-level[0-9]+/, '' )
 36+ .replace( /es-listItemView-(bullet|number)/, '' )
3737 )
3838 // Set the list style class from the style on top of the stack
39 - .addClass( 'editSurface-listItemView-' + styles[styles.length - 1] )
 39+ .addClass( 'es-listItemView-' + styles[styles.length - 1] )
4040 // Set the list level class from the length of the stack
41 - .addClass( 'editSurface-listItemView-level' + ( styles.length - 1 ) );
 41+ .addClass( 'es-listItemView-level' + ( styles.length - 1 ) );
4242 };
4343
4444 es.ListItemView.prototype.setNumber = function( number ) {
Index: trunk/parsers/wikidom/lib/hype/views/es.ListView.js
@@ -11,7 +11,7 @@
1212 es.DocumentViewBranchNode.call( this, model );
1313
1414 // DOM Changes
15 - this.$.addClass( 'editSurface-listView' );
 15+ this.$.addClass( 'es-listView' );
1616
1717 // Events
1818 this.on( 'update', this.enumerate );
Index: trunk/parsers/wikidom/lib/hype/views/es.DocumentView.js
@@ -15,7 +15,7 @@
1616 this.surfaceView = surfaceView;
1717
1818 // DOM Changes
19 - this.$.addClass( 'editSurface-documentView' );
 19+ this.$.addClass( 'es-documentView' );
2020 };
2121
2222 /**
Index: trunk/parsers/wikidom/lib/hype/views/es.HeadingView.js
@@ -11,7 +11,7 @@
1212 es.DocumentViewLeafNode.call( this, model, $( '<h' + model.getElementAttribute( 'level' ) + '>') );
1313
1414 // DOM Changes
15 - this.$.addClass( 'editSurface-headingView' );
 15+ this.$.addClass( 'es-headingView' );
1616
1717 // Events
1818 this.on( 'update', this.setClasses );
@@ -27,9 +27,9 @@
2828 level = this.model.getElementAttribute( 'level' );
2929 this.$
3030 // Remove any existing level classes
31 - .attr( 'class', classes.replace( /editSurface-headingView-level[1-6]/, '' ) )
 31+ .attr( 'class', classes.replace( /es-headingView-level[1-6]/, '' ) )
3232 // Add a new level class
33 - .addClass( 'editSurface-headingView-level' + level );
 33+ .addClass( 'es-headingView-level' + level );
3434 };
3535
3636 /* Inheritance */
Index: trunk/parsers/wikidom/lib/hype/views/es.TableRowView.js
@@ -13,7 +13,7 @@
1414 // DOM Changes
1515 this.$
1616 .attr( 'style', model.getElementAttribute( 'html/style' ) )
17 - .addClass( 'editSurface-tableRowView' );
 17+ .addClass( 'es-tableRowView' );
1818 };
1919
2020 /* Inheritance */

Status & tagging log