r99616 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99615‎ | r99616 | r99617 >
Date:01:58, 12 October 2011
Author:jpostlethwaite
Status:deferred (Comments)
Tags:
Comment:
Added title tag for history link. Changed to prepend link on #content. Limited display to the NS_MAIN namespace.
Modified paths:
  • /trunk/extensions/LastModified/LastModified.i18n.php (modified) (history)
  • /trunk/extensions/LastModified/LastModified.php (modified) (history)
  • /trunk/extensions/LastModified/modules/lastmodified.js (modified) (history)

Diff [purge]

Index: trunk/extensions/LastModified/LastModified.i18n.php
@@ -37,6 +37,7 @@
3838 'lastmodified-label-years' => 'years',
3939 'lastmodified-options' => 'Options',
4040 'lastmodified-display-range-value' => 'Display range value:',
 41+ 'lastmodified-title-tag' => 'View the revision history for this article.',
4142 'lastmodified-seconds' => 'Last updated $1 seconds ago',
4243 'lastmodified-minutes' => 'Last updated $1 minutes ago',
4344 'lastmodified-hours' => 'Last updated $1 hours ago',
Index: trunk/extensions/LastModified/modules/lastmodified.js
@@ -213,13 +213,13 @@
214214
215215 var html = '';
216216
217 - html += '<div style="float: right;" class="lastmodified">';
218 - html += '<a href="' + historyLink + '" title="View the revision history for this article.">';
 217+ html += '<div style="float: right; position: absolute; right: 10px; font-size: 85%;" class="lastmodified">';
 218+ html += '<a href="' + historyLink + '" title="' + mw.msg( 'lastmodified-title-tag' ) + '">';
219219 html += lastModifiedText;
220220 html += '</a>';
221221 html += '</div>';
222222
223 - $('.mw-content-ltr').prepend( html );
 223+ $('#content').prepend( html );
224224 }
225225
226226 /**
Index: trunk/extensions/LastModified/LastModified.php
@@ -64,6 +64,7 @@
6565 'lastmodified-days',
6666 'lastmodified-months',
6767 'lastmodified-years',
 68+ 'lastmodified-title-tag',
6869 ),
6970 ) + $wgResourceTemplate;
7071
@@ -82,7 +83,8 @@
8384 $context = $out->getContext();
8485 $title = $context->getTitle();
8586 $article = Article::newFromTitle( $title, $context );
86 - if ( $article ){
 87+
 88+ if ( $article && ( method_exists( $title, 'getNamespace' ) && $title->getNamespace() == 0 ) ) {
8789 $timestamp = $article->getTimestamp();
8890 $out->addMeta( 'last-edited', wfTimestamp ( TS_UNIX, $timestamp ) );
8991 $out->addMeta( 'last-modified-range', $wgLastModifiedRange );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r99522Adding new extension LastModified.jpostlethwaite18:30, 11 October 2011

Comments

#Comment by Nikerabbit (talk | contribs)   10:50, 12 October 2011
 ( method_exists( $title, 'getNamespace' ) )

??

#Comment by Jpostlethwaite (talk | contribs)   19:52, 13 October 2011

I am changing this to:

( $title instanceof Title )

Status & tagging log