User:Plighting Engineerd/common.js

mw.loader.load( '/w/index.php?title=User:Evad37/rater.js&action=raw&ctype=text/javascript' ); // Backlink: [[User:Evad37/rater.js]]

// 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:BrandonXLF/Autoref.js'); // Backlink: [[User:BrandonXLF/Autoref.js]]
importScript('User:Taavi/Aligner.js'); // Backlink: [[User:Taavi/Aligner.js]]

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.