Hydriz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/94091


Change subject: Check if the article exists first before actually displaying it.
......................................................................

Check if the article exists first before actually displaying it.

This commit adds a check on whether the article actually exists
before displaying the last modified text in the header. Before this,
articles that do not exist will display an incorrect "Last modified
x seconds ago".

Change-Id: If333c8f57de00ff8ffbfe9ccebced22083675041
---
M modules/lastmodified.js
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LastModified 
refs/changes/91/94091/1

diff --git a/modules/lastmodified.js b/modules/lastmodified.js
index 07bda49..1c30f9f 100644
--- a/modules/lastmodified.js
+++ b/modules/lastmodified.js
@@ -58,8 +58,10 @@
        html += '</a>';
        html += '</div>';
 
-       // Insert the HTML into the web page
-       $( '#firstHeading' ).append( html );
+       // Check if the article exists and insert the HTML into the web page
+       if ( mw.config.get( 'wgArticleId' ) !== 0 ) {
+               $( '#firstHeading' ).append( html );
+       }
 }
 /**
  * Get the UTC Timestamp without microseconds

-- 
To view, visit https://gerrit.wikimedia.org/r/94091
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If333c8f57de00ff8ffbfe9ccebced22083675041
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LastModified
Gerrit-Branch: master
Gerrit-Owner: Hydriz <ad...@alphacorp.tk>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to