Index: trunk/extensions/CodeReview/modules/ext.codereview.overview.js |
— | — | @@ -1,36 +1,31 @@ |
2 | | -/** |
3 | | - * Revision overview widget for the MediaWiki CodeReview extension |
4 | | - * Based on http://www.mediawiki.org/wiki/User:Splarka/scapmap.js |
| 2 | +/* Scap roadmap viewer, version [0.0.7] |
| 3 | + * Originally from: http://www.mediawiki.org/wiki/User:Splarka/scapmap.js |
5 | 4 | * |
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. |
10 | 5 | * |
11 | | - * Hovering over a colored box shows a tooltip containg info from the table row. |
| 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. |
12 | 11 | */ |
13 | 12 | jQuery( function( $ ) { |
14 | | - |
15 | | - // Return early if this page doesn't qualify |
16 | | - if ( !$( '#path' ).length || !$( 'table.TablePager' ).length ) { |
17 | | - return; |
| 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 | + ); |
18 | 23 | } |
19 | 24 | |
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() { |
| 25 | + $('#ca-scapmap').click( function () { |
31 | 26 | var $tr = $('table.TablePager tr'); |
32 | | - if ( $tr.length < 2 ){ |
| 27 | + if( $tr.size() < 2 ){ |
33 | 28 | return; |
34 | | - } else if ( $('#overviewmap').length ) { |
| 29 | + } else if( $('#overviewmap').size() ) { |
35 | 30 | // We've already created it; maybe they just want to toggle it on and off |
36 | 31 | $('#overviewmap').slideToggle(); |
37 | 32 | return; |
— | — | @@ -47,13 +42,13 @@ |
48 | 43 | var status = false; |
49 | 44 | |
50 | 45 | var trc = $(this).attr( 'class' ); |
51 | | - if ( !trc || !trc.length ) { |
| 46 | + if( !trc || !trc.length ) { |
52 | 47 | return; |
53 | 48 | } else { |
54 | 49 | trc = trc.split( ' ' ); |
55 | 50 | } |
56 | | - for ( var j = 0; j < trc.length; j++ ) { |
57 | | - if ( trc[j].substring( 0, 21 ) == 'mw-codereview-status-' ) { |
| 51 | + for( var j = 0; j < trc.length; j++ ) { |
| 52 | + if( trc[j].substring( 0, 21 ) == 'mw-codereview-status-' ) { |
58 | 53 | status = trc[j].substring( 21 ); |
59 | 54 | } |
60 | 55 | } |
— | — | @@ -61,7 +56,7 @@ |
62 | 57 | |
63 | 58 | var statusname = $td.filter( '.TablePager_col_cr_status' ).text(); |
64 | 59 | |
65 | | - if ( !statusname || !status ) { |
| 60 | + if( !statusname || !status ) { |
66 | 61 | return; |
67 | 62 | } |
68 | 63 | |
— | — | @@ -75,12 +70,12 @@ |
76 | 71 | }; |
77 | 72 | |
78 | 73 | var path = $td.filter( '.TablePager_col_cr_path' ).text(); |
79 | | - if ( path && path.indexOf( vpath ) == 0 && path != vpath && vpath != '' ) { |
| 74 | + if( path && path.indexOf( vpath ) == 0 && path != vpath && vpath != '' ) { |
80 | 75 | path = '\u2026' + path.substring( vpath.length ); |
81 | 76 | } |
82 | 77 | overviewPopupData[i]['path'] = path; |
83 | 78 | |
84 | | - if ( !totals[statusname] ) { |
| 79 | + if( !totals[statusname] ) { |
85 | 80 | totals[statusname] = 0; |
86 | 81 | } |
87 | 82 | totals[statusname]++; |
— | — | @@ -95,24 +90,24 @@ |
96 | 91 | }); |
97 | 92 | |
98 | 93 | var sumtext = []; |
99 | | - for ( var i in totals ) { |
100 | | - if ( typeof i != 'string' || typeof totals[i] != 'number' ) { |
| 94 | + for( var i in totals ) { |
| 95 | + if( typeof i != 'string' || typeof totals[i] != 'number' ) { |
101 | 96 | continue; |
102 | 97 | } |
103 | 98 | sumtext.push( i + ': ' + totals[i] ); |
104 | 99 | } |
105 | 100 | sumtext.sort(); |
106 | 101 | var $summary = $( '<div class="summary">' ) |
107 | | - .text( 'Total revisions: ' + ( $tr.length - 1 ) + '. [' + sumtext.join(', ') + ']' ); |
| 102 | + .text( 'Total revisions: ' + ( $tr.size() - 1 ) + '. [' + sumtext.join(', ') + ']' ); |
108 | 103 | |
109 | 104 | $( '#overviewmap' ) |
110 | 105 | .append( $summary ) |
111 | | - .css( 'max-width', Math.floor( Math.sqrt( $tr.length ) ) * 30 ) |
| 106 | + .css( 'max-width', Math.floor( Math.sqrt( $tr.size() ) ) * 30 ) |
112 | 107 | .slideDown(); |
113 | 108 | |
114 | 109 | // Add the hover popup |
115 | 110 | $( '#overviewmap > a' ) |
116 | | - .mouseenter( function() { |
| 111 | + .mouseenter( function () { |
117 | 112 | |
118 | 113 | var $el = $( this ); |
119 | 114 | if ( $el.data('overviewPopup') ) { |
Index: trunk/extensions/MobileFrontend/views/layout/application.html.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | -global $wgScriptPath, $wgExtensionAssetsPath, $wgAppleTouchIcon; |
| 3 | +global $wgExtensionAssetsPath, $wgAppleTouchIcon; |
4 | 4 | |
5 | 5 | $dir = self::$dir; |
6 | 6 | $code = self::$code; |
— | — | @@ -12,31 +12,19 @@ |
13 | 13 | |
14 | 14 | $cssFileName = ( isset( self::$device['css_file_name'] ) ) ? self::$device['css_file_name'] : 'default'; |
15 | 15 | |
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 | | - |
28 | 16 | $applicationHtml = <<<EOT |
29 | 17 | <!DOCTYPE html PUBLIC |
30 | 18 | "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" |
31 | 19 | "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd"> |
32 | | -<html lang="{$code}" dir="{$dir}" xml:lang="{$code}" xmlns="http://www.w3.org/1999/xhtml"> |
| 20 | +<html lang='{$code}' dir='{$dir}' xml:lang='{$code}' xmlns='http://www.w3.org/1999/xhtml'> |
33 | 21 | <head> |
34 | 22 | <title>{$htmlTitle}</title> |
35 | 23 | <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" /> |
36 | | - <link href="{$wgExtensionAssetsPath}/MobileFrontend/stylesheets/{$cssFileName}.css" media="all" rel="Stylesheet" type="text/css" /> |
| 24 | + <link href='{$wgExtensionAssetsPath}/MobileFrontend/stylesheets/{$cssFileName}.css' media='all' rel='Stylesheet' type='text/css' /> |
37 | 25 | <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" /> |
38 | | - <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" /> |
| 26 | + <meta name = "viewport" content = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" /> |
39 | 27 | ${appleTouchIconTag} |
40 | | - <script type="text/javascript"> |
| 28 | + <script type='text/javascript'> |
41 | 29 | //<![CDATA[ |
42 | 30 | var title = "{$htmlTitle}"; |
43 | 31 | function shouldCache() { |
— | — | @@ -44,12 +32,12 @@ |
45 | 33 | } |
46 | 34 | //]]> |
47 | 35 | </script> |
48 | | - <script type="text/javascript" language="javascript" src="{$wgScriptPath}/resources/jquery/jquery.js"></script> |
49 | | - {$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> |
50 | 38 | </head> |
51 | 39 | <body> |
52 | 40 | {$searchWebkitHtml} |
53 | | - <div class="show" id="content_wrapper"> |
| 41 | + <div class='show' id='content_wrapper'> |
54 | 42 | {$contentHtml} |
55 | 43 | </div> |
56 | 44 | {$footerHtml} |