MediaWiki:Common.js: Difference between revisions
From Sanatan Hindu Dharma
No edit summary Tag: Reverted |
No edit summary Tags: Manual revert Reverted |
||
| Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
$(document).ready(function() { | $(document).ready(function() { | ||
if (mw.config.get('wgNamespaceNumber') >= 0) { // Only on normal pages | if (mw.config.get('wgNamespaceNumber') >= 0) { // Only show on normal pages | ||
var pageName = mw.config.get('wgTitle'); // Get the current page name | var pageName = mw.config.get('wgTitle'); // Get the current page name | ||
// | // Create a hidden input field to store page name | ||
var inputField = $('<input>') | |||
.attr('type', 'hidden') | |||
.attr('id', 'currentPageName') | |||
.attr('value', pageName); | |||
$('body').append(inputField); // Add hidden field to the body | |||
// Create Upload Button | // Create Upload Button | ||
Revision as of 18:18, 7 February 2025
/* Any JavaScript here will be loaded for all users on every page load. */
$(document).ready(function() {
if (mw.config.get('wgNamespaceNumber') >= 0) { // Only show on normal pages
var pageName = mw.config.get('wgTitle'); // Get the current page name
// Create a hidden input field to store page name
var inputField = $('<input>')
.attr('type', 'hidden')
.attr('id', 'currentPageName')
.attr('value', pageName);
$('body').append(inputField); // Add hidden field to the body
// Create Upload Button
$('<div style="position:fixed; bottom:20px; right:20px; background:#007bff; color:white; padding:10px; border-radius:5px; cursor:pointer; font-weight:bold;">Upload a Video</div>')
.click(function() {
window.location.href = mw.util.getUrl('Form:UploadVideo');
}).appendTo('body');
}
});
