User:Plighting Engineerd/common.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | The accompanying .css page for this skin is at User:Plighting Engineerd/common.css. |
mw.loader.load( '/w/index.php?title=User:Evad37/rater.js&action=raw&ctype=text/javascript' ); // Backlink: [[User:Evad37/rater.js]]
mw.loader.load( '/w/index.php?title=User:Evad37/duplinks-alt.js&action=raw&ctype=text/javascript' ); // Backlink: [[User:Evad37/duplinks-alt.js]]
importScript('User:SD0001/GAN-helper.js'); // Backlink: [[User:SD0001/GAN-helper.js]]
importScript('Wikipedia:AutoEd/complete.js'); // Backlink: [[Wikipedia:AutoEd/complete.js]]
autoEdLinkName = "AutoEd";
// UTC clock with modifications
mw.loader.using(['mediawiki.util', 'mediawiki.api', 'user']).then(function() {
function padWithZeroes(num) {
return num < 10 ? '0' + num.toString() : num.toString();
}
function showTime($target) {
var now = new Date();
var timezone = window.LiveClockTimeZone || 'UTC';
var hh, mm, ss;
if (timezone === "UTC") {
hh = now.getUTCHours();
mm = now.getUTCMinutes();
ss = now.getUTCSeconds();
} else if (timezone === "local") {
hh = now.getHours();
mm = now.getMinutes();
ss = now.getSeconds();
} else {
var newNow;
try {
newNow = new Date(now.toLocaleString("en-US", { timeZone: timezone }));
hh = newNow.getHours();
mm = newNow.getMinutes();
ss = newNow.getSeconds();
} catch (err) {
console.log("LiveClock - error creating Date object with timezone '" + timezone + "': " + err.name);
timezone = "UTC";
newNow = now;
hh = now.getUTCHours();
mm = now.getUTCMinutes();
ss = now.getUTCSeconds();
}
}
var time = padWithZeroes(hh) + ':' + padWithZeroes(mm);
$target.text(time);
var ms = now.getUTCMilliseconds();
setTimeout(function() {
showTime($target);
}, 1100 - ms);
}
function addLiveClockInstance(clockLocation) {
var node = document.createElement('span'); // Changed from div to span
node.id = 'utcdate';
node.style.cssText = 'font-weight: bold; font-size: 120%; display: inline-block;'; // Ensure it's inline
var container = document.getElementById(clockLocation);
if (container) {
var list = container.querySelector('ul'); // Ensuring it's added to a list if it exists
if (list) {
var listItem = document.createElement('li');
listItem.appendChild(node);
list.appendChild(listItem); // Adding it as a list item
} else {
container.appendChild(node); // Fallback if no list
}
showTime($(node));
}
}
function liveClock() {
var dbName = mw.config.get('wgDBname');
var showOutsideDropdown = dbName === 'mediawikiwiki' || dbName === 'enwiki';
var clockLocation = document.getElementById('p-vector-user-menu-overflow') && showOutsideDropdown ? 'p-vector-user-menu-overflow' : 'p-personal';
addLiveClockInstance(clockLocation);
addLiveClockInstance('p-personal-sticky-header');
}
$(liveClock);
});
// Cite RCDB
$('head').one('reftoolbarbase', function() {
new citeTemplate('Cite RCDB', 'Cite RCDB',
[ // Basic fields
{"field": "coaster_name", "label":"Coaster name"},
{"field": "location", "label":"Location"},
{"field": "rcdb_number", "label":"RCDB number"},
{"field": "accessdate", "label":"Access date"},
{"field": "url", "label":"URL"}
],
[ // Expanded fields
]);
});
importScript('User:Polygnotus/DuplicateReferences.js'); // Backlink: [[User:Polygnotus/DuplicateReferences.js]]
importScript('User:Mesidast/Tidy citations.js'); // Backlink: [[User:Mesidast/Tidy citations.js]]
importScript('User:Nardog/RefRenamer.js'); // Backlink: [[User:Nardog/RefRenamer.js]]
importScript('User:Ohconfucius/script/Sources.js'); // Backlink: [[User:Ohconfucius/script/Sources.js]]