|
|
| 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. */ |
|
| |
| /* BEGIN NERO RULES NAVIGATION 2026-10-16 */
| |
| /* NERO: direct Rules and Changelog links in Citizen's navigation rail. */
| |
| (function () {
| |
| 'use strict';
| |
|
| |
| function createRailLink(id, href, title, path) {
| |
| var link = document.createElement('a');
| |
| link.id = id;
| |
| link.className = 'citizen-header__item citizen-cdx-button--size-large cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--icon-only cdx-button--weight-quiet';
| |
| link.href = href;
| |
| link.title = title;
| |
| link.setAttribute('aria-label', title);
| |
|
| |
| var icon = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
| |
| icon.setAttribute('viewBox', '0 0 24 24');
| |
| icon.setAttribute('width', '20');
| |
| icon.setAttribute('height', '20');
| |
| icon.setAttribute('fill', 'none');
| |
| icon.setAttribute('stroke', 'currentColor');
| |
| icon.setAttribute('stroke-width', '1.7');
| |
| icon.setAttribute('stroke-linecap', 'round');
| |
| icon.setAttribute('stroke-linejoin', 'round');
| |
| icon.setAttribute('aria-hidden', 'true');
| |
| icon.setAttribute('focusable', 'false');
| |
|
| |
| var outline = document.createElementNS('http://www.w3.org/2000/svg', 'path');
| |
| outline.setAttribute('d', path);
| |
| icon.appendChild(outline);
| |
| link.appendChild(icon);
| |
| return link;
| |
| }
| |
|
| |
| function addRulesAndChangelogLinks() {
| |
| if (!document.body || !document.body.classList.contains('skin-citizen')) {
| |
| return;
| |
| }
| |
|
| |
| var rail = document.querySelector('.citizen-header__start');
| |
| if (!rail) {
| |
| return;
| |
| }
| |
|
| |
| var changelog = document.getElementById('nero-changelog-nav');
| |
| if (!changelog) {
| |
| changelog = createRailLink(
| |
| 'nero-changelog-nav',
| |
| '/index.php/10th_Edition_Changelog',
| |
| '10th Edition Changelog',
| |
| 'M6 3h13v18H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm-2 16a2 2 0 0 1 2-2h13M14 3v8l-3-2-3 2V3'
| |
| );
| |
| }
| |
|
| |
| var rules = document.getElementById('nero-rules-nav');
| |
| if (!rules) {
| |
| rules = createRailLink(
| |
| 'nero-rules-nav',
| |
| '/index.php/NERO_10th_Edition_Rules',
| |
| 'NERO 10th Edition Rules',
| |
| 'M12 5C9 3 5.5 3 2 4v15c3.5-1 7-1 10 1 3-2 6.5-2 10-1V4c-3.5-1-7-1-10 1zm0 0v15M5 8c1.3-.2 2.7 0 4 .5M5 12c1.3-.2 2.7 0 4 .5M15 8.5c1.3-.5 2.7-.7 4-.5M15 12.5c1.3-.5 2.7-.7 4-.5'
| |
| );
| |
| }
| |
|
| |
| rail.appendChild(changelog);
| |
| rail.insertBefore(rules, changelog);
| |
| }
| |
|
| |
| if (document.readyState === 'loading') {
| |
| document.addEventListener('DOMContentLoaded', addRulesAndChangelogLinks, { once: true });
| |
| } else {
| |
| addRulesAndChangelogLinks();
| |
| }
| |
| }());
| |
|
| |
| /* END NERO RULES NAVIGATION */
| |