r96238 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96237‎ | r96238 | r96239 >
Date:17:06, 4 September 2011
Author:krinkle
Status:reverted
Tags:
Comment:
Add new directory for extension
Modified paths:
  • /trunk/extensions/CodeReview/modules/ext.codereview.overview.js (modified) (history)
  • /trunk/extensions/InlineCategorizer (added) (history)
  • /trunk/extensions/MobileFrontend/views/layout/application.html.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/modules/ext.codereview.overview.js
@@ -1,31 +1,36 @@
2 -/* Scap roadmap viewer, version [0.0.7]
3 - * Originally from: http://www.mediawiki.org/wiki/User:Splarka/scapmap.js
 2+/**
 3+ * Revision overview widget for the MediaWiki CodeReview extension
 4+ * Based on http://www.mediawiki.org/wiki/User:Splarka/scapmap.js
45 *
 6+ * Adds an "Overview" portlet link on pages with a revision table on SpecialCode.
 7+ * When triggered the overview slides out with boxes, each representing a revision.
 8+ * The boxes links take you to that relevant row in the table, and a backlink is created
 9+ * in the id column.
510 *
6 - * Loads on, for example: http://www.mediawiki.org/wiki/Special:Code/MediaWiki
7 - * Click [overview] to generate map.
8 - * Text in the "path" input box is stripped from the path line in the summary.
9 - * Clicking a colored box takes you to that relevant line, and a backlink is created in the id column on focus.
10 - * Hovering over a colored box pops up a little info packet box.
 11+ * Hovering over a colored box shows a tooltip containg info from the table row.
1112 */
1213 jQuery( function( $ ) {
13 - // check if we're on a page with a useful list of revisions
14 - if( $( '#path' ).size() && $('table.TablePager').size() ) {
15 - var portlet = $( '#p-namespaces' ).size() ? 'p-namespaces' : 'p-cactions';
16 - mw.util.addPortletLink(
17 - portlet,
18 - '#',
19 - mw.msg( 'codereview-overview-title' ),
20 - 'ca-scapmap',
21 - mw.msg( 'codereview-overview-desc' )
22 - );
 14+
 15+ // Return early if this page doesn't qualify
 16+ if ( !$( '#path' ).length || !$( 'table.TablePager' ).length ) {
 17+ return;
2318 }
2419
25 - $('#ca-scapmap').click( function () {
 20+ var portletLink = mw.util.addPortletLink(
 21+ $( '#p-namespaces' ).length ? 'p-namespaces' : 'p-cactions',
 22+ '#',
 23+ mw.msg( 'codereview-overview-title' ),
 24+ 'ca-scapmap',
 25+ mw.msg( 'codereview-overview-desc' )
 26+ ),
 27+ // Cache since we'll be using this a few times
 28+ $portletLink = $( portletLink );
 29+
 30+ $portletLink.click( function() {
2631 var $tr = $('table.TablePager tr');
27 - if( $tr.size() < 2 ){
 32+ if ( $tr.length < 2 ){
2833 return;
29 - } else if( $('#overviewmap').size() ) {
 34+ } else if ( $('#overviewmap').length ) {
3035 // We've already created it; maybe they just want to toggle it on and off
3136 $('#overviewmap').slideToggle();
3237 return;
@@ -42,13 +47,13 @@
4348 var status = false;
4449
4550 var trc = $(this).attr( 'class' );
46 - if( !trc || !trc.length ) {
 51+ if ( !trc || !trc.length ) {
4752 return;
4853 } else {
4954 trc = trc.split( ' ' );
5055 }
51 - for( var j = 0; j < trc.length; j++ ) {
52 - if( trc[j].substring( 0, 21 ) == 'mw-codereview-status-' ) {
 56+ for ( var j = 0; j < trc.length; j++ ) {
 57+ if ( trc[j].substring( 0, 21 ) == 'mw-codereview-status-' ) {
5358 status = trc[j].substring( 21 );
5459 }
5560 }
@@ -56,7 +61,7 @@
5762
5863 var statusname = $td.filter( '.TablePager_col_cr_status' ).text();
5964
60 - if( !statusname || !status ) {
 65+ if ( !statusname || !status ) {
6166 return;
6267 }
6368
@@ -70,12 +75,12 @@
7176 };
7277
7378 var path = $td.filter( '.TablePager_col_cr_path' ).text();
74 - if( path && path.indexOf( vpath ) == 0 && path != vpath && vpath != '' ) {
 79+ if ( path && path.indexOf( vpath ) == 0 && path != vpath && vpath != '' ) {
7580 path = '\u2026' + path.substring( vpath.length );
7681 }
7782 overviewPopupData[i]['path'] = path;
7883
79 - if( !totals[statusname] ) {
 84+ if ( !totals[statusname] ) {
8085 totals[statusname] = 0;
8186 }
8287 totals[statusname]++;
@@ -90,24 +95,24 @@
9196 });
9297
9398 var sumtext = [];
94 - for( var i in totals ) {
95 - if( typeof i != 'string' || typeof totals[i] != 'number' ) {
 99+ for ( var i in totals ) {
 100+ if ( typeof i != 'string' || typeof totals[i] != 'number' ) {
96101 continue;
97102 }
98103 sumtext.push( i + ': ' + totals[i] );
99104 }
100105 sumtext.sort();
101106 var $summary = $( '<div class="summary">' )
102 - .text( 'Total revisions: ' + ( $tr.size() - 1 ) + '. [' + sumtext.join(', ') + ']' );
 107+ .text( 'Total revisions: ' + ( $tr.length - 1 ) + '. [' + sumtext.join(', ') + ']' );
103108
104109 $( '#overviewmap' )
105110 .append( $summary )
106 - .css( 'max-width', Math.floor( Math.sqrt( $tr.size() ) ) * 30 )
 111+ .css( 'max-width', Math.floor( Math.sqrt( $tr.length ) ) * 30 )
107112 .slideDown();
108113
109114 // Add the hover popup
110115 $( '#overviewmap > a' )
111 - .mouseenter( function () {
 116+ .mouseenter( function() {
112117
113118 var $el = $( this );
114119 if ( $el.data('overviewPopup') ) {
Index: trunk/extensions/MobileFrontend/views/layout/application.html.php
@@ -1,5 +1,5 @@
22 <?php
3 -global $wgExtensionAssetsPath, $wgAppleTouchIcon;
 3+global $wgScriptPath, $wgExtensionAssetsPath, $wgAppleTouchIcon;
44
55 $dir = self::$dir;
66 $code = self::$code;
@@ -12,19 +12,31 @@
1313
1414 $cssFileName = ( isset( self::$device['css_file_name'] ) ) ? self::$device['css_file_name'] : 'default';
1515
 16+if ( @$_GET['patch'] == '1' ) {
 17+
 18+ $script = '';
 19+
 20+
 21+} else {
 22+
 23+ $script = '<script type="text/javascript" language="javascript" src="'.$wgExtensionAssetsPath.'/MobileFrontend/javascripts/application.js"></script>';
 24+
 25+}
 26+
 27+
1628 $applicationHtml = <<<EOT
1729 <!DOCTYPE html PUBLIC
1830 "-//WAPFORUM//DTD XHTML Mobile 1.2//EN"
1931 "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">
20 -<html lang='{$code}' dir='{$dir}' xml:lang='{$code}' xmlns='http://www.w3.org/1999/xhtml'>
 32+<html lang="{$code}" dir="{$dir}" xml:lang="{$code}" xmlns="http://www.w3.org/1999/xhtml">
2133 <head>
2234 <title>{$htmlTitle}</title>
2335 <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
24 - <link href='{$wgExtensionAssetsPath}/MobileFrontend/stylesheets/{$cssFileName}.css' media='all' rel='Stylesheet' type='text/css' />
 36+ <link href="{$wgExtensionAssetsPath}/MobileFrontend/stylesheets/{$cssFileName}.css" media="all" rel="Stylesheet" type="text/css" />
2537 <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
26 - <meta name = "viewport" content = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
 38+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
2739 ${appleTouchIconTag}
28 - <script type='text/javascript'>
 40+ <script type="text/javascript">
2941 //<![CDATA[
3042 var title = "{$htmlTitle}";
3143 function shouldCache() {
@@ -32,12 +44,12 @@
3345 }
3446 //]]>
3547 </script>
36 - <script type="text/javascript" language="javascript" src="{$wgExtensionAssetsPath}/MobileFrontend/javascripts/jquery.js"></script>
37 - <script type="text/javascript" language="javascript" src="{$wgExtensionAssetsPath}/MobileFrontend/javascripts/application.js"></script>
 48+ <script type="text/javascript" language="javascript" src="{$wgScriptPath}/resources/jquery/jquery.js"></script>
 49+ {$script}
3850 </head>
3951 <body>
4052 {$searchWebkitHtml}
41 - <div class='show' id='content_wrapper'>
 53+ <div class="show" id="content_wrapper">
4254 {$contentHtml}
4355 </div>
4456 {$footerHtml}

Follow-up revisions

RevisionCommit summaryAuthorDate
r96239Revert r96238, commit failkrinkle17:11, 4 September 2011

Status & tagging log