MediaWiki:Common.js: Difference between revisions
Footer redesign: two link columns, calmer 18+ notice, quiet last-edited bar (CURACAOFIL-6) |
Footer: add editorial standards, editing policy, join the team, FAQ, terms |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 40: | Line 40: | ||
nav.setAttribute( 'aria-label', 'About CasinoLeaks' ); | nav.setAttribute( 'aria-label', 'About CasinoLeaks' ); | ||
[ | [ | ||
[ 'About', [ [ 'About us', 'CasinoLeaks:About' ], [ 'Methodology', 'CasinoLeaks:Methodology' ], [ 'Sources and coverage', 'CasinoLeaks:Sources_and_coverage' ], [ 'Independence', 'CasinoLeaks:Funding_and_independence' ], [ 'Team and experts', 'CasinoLeaks:Team_and_experts' ] ] ], | [ 'About', [ [ 'About us', 'CasinoLeaks:About' ], [ 'Methodology', 'CasinoLeaks:Methodology' ], [ 'Sources and coverage', 'CasinoLeaks:Sources_and_coverage' ], [ 'Editorial standards', 'CasinoLeaks:Editorial_standards' ], [ 'Independence', 'CasinoLeaks:Funding_and_independence' ], [ 'Editing policy', 'CasinoLeaks:Editing_policy' ], [ 'Team and experts', 'CasinoLeaks:Team_and_experts' ], [ 'Join the team', 'CasinoLeaks:Join_the_team' ] ] ], | ||
[ 'Help', [ [ 'Corrections', 'CasinoLeaks:Corrections_policy' ], [ 'Report an error', 'CasinoLeaks:Report_an_error' ], [ 'Contact', 'CasinoLeaks:Contact' ], [ 'Privacy', 'CasinoLeaks:Privacy_policy' ], [ 'Disclaimer', 'CasinoLeaks:General_disclaimer' ] ] ] | [ 'Help', [ [ 'FAQ', 'CasinoLeaks:FAQ' ], [ 'Corrections', 'CasinoLeaks:Corrections_policy' ], [ 'Report an error', 'CasinoLeaks:Report_an_error' ], [ 'Contact', 'CasinoLeaks:Contact' ], [ 'Privacy', 'CasinoLeaks:Privacy_policy' ], [ 'Terms of use', 'CasinoLeaks:Terms_of_use' ], [ 'Disclaimer', 'CasinoLeaks:General_disclaimer' ] ] ] | ||
].forEach( function ( group ) { | ].forEach( function ( group ) { | ||
var col = el( 'div', 'clf-col' ); | var col = el( 'div', 'clf-col' ); | ||
| Line 71: | Line 71: | ||
} ); | } ); | ||
/* Last-edited bar on phones: show when, not which account (CURACAOFIL-6). */ | /* Last-edited bar on phones: show when, not which account (CURACAOFIL-6). | ||
Minerva replaces the text node after load, so watch the whole bar and re-query each time. */ | |||
mw.hook( 'wikipage.content' ).add( function () { | mw.hook( 'wikipage.content' ).add( function () { | ||
var | var bar = document.querySelector( '.last-modified-bar' ); | ||
if ( ! | if ( !bar || bar.getAttribute( 'data-clf' ) ) { | ||
return; | return; | ||
} | } | ||
bar.setAttribute( 'data-clf', '1' ); | |||
function tidy() { | function tidy() { | ||
var m = t.textContent.replace( /\s+/g, ' ' ).trim().match( /^(.*?) by .+$/ ); | var t = bar.querySelector( '.last-modified-bar__text' ); | ||
var m = t && t.textContent.replace( /\s+/g, ' ' ).trim().match( /^(.*?) by .+$/ ); | |||
if ( m ) { | if ( m ) { | ||
t.textContent = m[ 1 ]; | t.textContent = m[ 1 ]; | ||
| Line 85: | Line 87: | ||
} | } | ||
tidy(); | tidy(); | ||
new MutationObserver( tidy ).observe( | new MutationObserver( tidy ).observe( bar, { childList: true, subtree: true, characterData: true } ); | ||
} ); | } ); | ||