MediaWiki:Common.js: Difference between revisions
From Sanatan Hindu Dharma
No edit summary Tag: Reverted |
No edit summary Tag: 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 | if (mw.config.get('wgNamespaceNumber') >= 0) { // Only 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 | ||
// | // Store the page name in local storage | ||
localStorage.setItem('currentPageName', pageName); | |||
// Create Upload Button | // Create Upload Button | ||
Revision as of 18:16, 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 on normal pages
var pageName = mw.config.get('wgTitle'); // Get the current page name
// Store the page name in local storage
localStorage.setItem('currentPageName', pageName);
// 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');
}
});
