User:Euphoria/common.js: Difference between revisions
From Test Wiki
Content deleted Content added
No edit summary |
No edit summary |
||
| Line 3: | Line 3: | ||
var pageTitle = mw.config.get('wgPageName'); // Get the current page title |
var pageTitle = mw.config.get('wgPageName'); // Get the current page title |
||
var apiURL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php'; |
var apiURL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php'; |
||
var wikiURL = mw.config.get('wgServer') + mw.config.get('wgScriptPath'); |
|||
// Function to fetch page creator |
// Function to fetch page creator |
||
| Line 54: | Line 55: | ||
// Function to display the creator with edit count |
// Function to display the creator with edit count |
||
function displayCreator(creator, editCount) { |
function displayCreator(creator, editCount) { |
||
var userPageURL = wikiURL + '/wiki/User:' + encodeURIComponent(creator); |
|||
var userContribsURL = wikiURL + '/wiki/Special:Contributions/' + encodeURIComponent(creator); |
|||
var creatorLink = $('<a>') |
|||
.attr('href', userPageURL) |
|||
.text(creator) |
|||
.css({'color': '#0645ad'}); |
|||
var contribsLink = $('<a>') |
|||
.attr('href', userContribsURL) |
|||
.text(editCount + ' edits') |
|||
.css({'color': '#0645ad'}); |
|||
var creatorInfo = $('<div>') |
var creatorInfo = $('<div>') |
||
. |
.append('Page created by: ') |
||
.append(creatorLink) |
|||
.append(' (') |
|||
.append(contribsLink) |
|||
.append(')') |
|||
.css({ |
.css({ |
||
'font-size': 'small', |
'font-size': 'small', |
||
| Line 62: | Line 80: | ||
}); |
}); |
||
// Append the creator info below the title bar |
|||
$('#bodyContent').prepend(creatorInfo); // Try '#mw-content-text' if '#bodyContent' doesn't work |
$('#bodyContent').prepend(creatorInfo); // Try '#mw-content-text' if '#bodyContent' doesn't work |
||
} |
} |
||