Hydriz has uploaded a new change for review.

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


Change subject: (bug 54450) Fix compatibility with all skins
......................................................................

(bug 54450) Fix compatibility with all skins

This commit checks if the user is currently on a specified skin and
displays the relevant HTML styles for it. This fixes the display
for the Modern skin by placing it into the "p-cactions" section.

All other supported skins by MediaWiki work as of this commit.

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


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

diff --git a/modules/lastmodified.js b/modules/lastmodified.js
index 07bda49..2f2dd8a 100644
--- a/modules/lastmodified.js
+++ b/modules/lastmodified.js
@@ -50,16 +50,25 @@
        var historyLink = getArticleHistoryLink();
        //console.log( 'historyLink: ' + historyLink );
 
+       // Get the current skin
+       var currentSkin = getCurrentSkin();
+
+       // Get the proper styling (skin-dependent)
+       var divStyle = getDivStyle( currentSkin );
+
+       // Get the HTML property to append to (skin-dependent)
+       var htmlProperty = getHtmlProperty( currentSkin );
+
        // Construct the HTML
        var html = '';
-       html += '<div style="float:right; font-size: 0.5em;" 
id="mwe-lastmodified">';
+       html += '<div style="' + divStyle + '" id="mwe-lastmodified">';
        html += '<a href="' + historyLink + '" title="' + mw.message( 
'lastmodified-title-tag' ).escaped() + '">';
        html += lastModifiedText;
        html += '</a>';
        html += '</div>';
 
        // Insert the HTML into the web page
-       $( '#firstHeading' ).append( html );
+       $( htmlProperty ).append( html );
 }
 /**
  * Get the UTC Timestamp without microseconds
@@ -194,6 +203,41 @@
 }
 
 /**
+ * Get the value of the current skin, introduced to fix bug 54450
+ *
+ * @return string
+ */
+function getCurrentSkin() {
+       return mw.config.get( 'skin' );
+}
+
+/**
+ * Get the proper div style tag information depending on the skin
+ *
+ * @return string
+ */
+function getDivStyle( skin ) {
+       if ( skin == 'modern' ) {
+               return "float:right;";
+       } else {
+               return "float:right; font-size: 0.5em;";
+       }
+}
+
+/**
+ * Get the HTML property to append to depending on the skin
+ *
+ * @return string
+ */
+function getHtmlProperty( skin ) {
+       if ( skin == 'modern' ) {
+               return '#p-cactions';
+       } else {
+               return '#firstHeading';
+       }
+}
+
+/**
  * Display the last modified link on the page.
  */
 $( document ).ready( function() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia03ca52def8b42432987818635346d9ef263eaef
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LastModified
Gerrit-Branch: master
Gerrit-Owner: Hydriz <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to