/*
* Zeigt auf Unterseiten von "ungültige Seitennamen" und "Diskussion:ungültige Seitennamen"
* den korrekten Titel in der Kopfzeile oben auf der Seite an. Zeig zum Beispiel
* auf der Seite [[Nicht unterstützte Titel/left curly bracket]] den Titel {
*
* Muss in [[MediaWiki:Common.js]] eingebunden werden.
* Für die mobile Ansicht ggf. in [[MediaWiki:Mobile.js]]
*
* Um alle entsprechenden Seiten zu finden,
* siehe [[Spezial:Präfixindex/ungültige Seitennamen]].
*/
if (mw.config.get('wgAction') === 'view'
&& /^(?:Diskussion:)?ungültige_Seitennamen\//.test(mw.config.get('wgPageName')))
$(function() {
var titleMap = {
'full_stop': '.',
'semicolon': ';',
'left_curly_bracket': '{',
'right_curly_bracket': '}',
'left_square_bracket': '[',
'right_square_bracket': ']',
'less_than': '<',
'greater_than': '>',
'equal_greater_than': '=>',
'equal_less_than': '=<',
'greater_than_equal': '>=',
'less_than_equal': '<=',
'hyphen_greater_than': '->',
'less_than_hyphen': '<-',
'greater_than_low_line_less_than': '>_<',
'double_colon': '::',
'enclosing_colons': ': :',
'colon_equals': ':=',
'colon_capital_thorn': ':Þ',
'colon_lowercase_thorn': ':þ',
'colon_slash': ':/',
'colon_slash_slash': '://',
'colon_left_paren': ':(',
'colon_right_paren': ':)',
'colon_three': ':3',
'colon_capital_P': ':P',
'colon_small_p': ':p',
'less_than_greater_than': '<>',
'less_than_three': '<3',
'enclosing_less_than_greater_than': '< >',
'less_than_trailing_slash_greater_than': '< />',
'html_start_tag_end_tag': '< > </ >',
'html_comment': '<!-- -->',
'g_tag': '<g>',
'colon_hyphen_left_paren': ':-(',
'colon_hyphen_right_paren': ':-)',
'vertical_line': '|',
'vertical_line_vertical_line': '||',
'enclosing_vertical_lines': '| |',
'c_sharp': 'C#',
'number_sign': '#',
'enclosing_number_signs': '# #',
'amp': '&',
'colon': ':',
'double_period': '..',
'low_line': '_',
'low_line_interfix': '-_-',
'replacement_character': '\uFFFD',
'square_brackets': '[ ]',
'curly_brackets': '{ }',
'square_bracketed_ellipsis': '[…]',
'enclosing_low_lines': '_ _',
'c_through_n_to_k': 'C|N>K',
'о_slash_dot': 'о/.',
'metoo': '#MeToo',
'eq_number_sign': 'eq #',
'hr_number_sign': 'hr #',
'less_than_slash_three': '</3',
'period_slash_period': './.',
'Thai_name_of_Bangkok': 'กรุงเทพมหานคร อมรรัตนโกสินทร์ มหินทรายุธยา มหาดิลกภพ นพรัตนราชธานีบูรีรมย์ อุดมราชนิเวศน์มหาสถาน อมรพิมานอวตารสถิต สักกะทัตติยวิษณุกรรมประสิทธิ์',
'ancient_Greek_dish': 'λοπαδο\u00ADτεμαχο\u00ADσελαχο\u00ADγαλεο'
+ '\u00ADκρανιο\u00ADλειψανο\u00ADδριμυ\u00ADποτριμματο\u00AD'
+ 'σιλφιο\u00ADκαραβο\u00ADμελιτο\u00ADκατακεχυμενο\u00AD'
+ 'κιχλε\u00ADπικοσσυφο\u00ADφαττο\u00ADπεριστερα\u00AD'
+ 'λεκτρυο\u00ADνοπτο\u00ADκεφαλλιο\u00ADκιγκλο\u00AD'
+ 'πελειο\u00ADλαγῳο\u00ADσιραιο\u00ADβαφητραγανοπτερύγων',
'ideographic_space': '[ideographic space]',
'space': '[space]',
'Ogham_space': '[Ogham space]',
'cifrão': '[Cifrão]',
'old_Israeli_shekel': '[Old Israeli shekel]',
'': '',
'hyphen_vertical_line_vertical_line_hyphen' : '-||-',
'Australian_Aboriginal_Flag_emoticon' : '[-o-]',
'Australian_Aboriginal_Flag_emoticon_alternative' : '[-0-]'
};
try {
var subpage = /^(?:Diskussion:)?ungültige_Seitennamen\/(.+)$/
.exec(mw.config.get('wgPageName'))[1];
var newTitle = titleMap[subpage] || subpage;
if (mw.config.get('wgCanonicalNamespace') == 'Talk')
newTitle = 'Diskussion:' + newTitle;
var titleTag = document.getElementsByTagName('title')[0];
titleTag.textContent = titleTag.textContent.replace(/^.*(?= -)/, newTitle);
document.getElementById('firstHeading').textContent = newTitle;
} catch (e) {
console.log('Error while correcting title: ' + e.message + '.');
}
});
/*
* This redirects a user to the correct Unsupported titles page if they attempt
* to access an invalid title. For instance, if you attempt to access
* en.wiktionary.org/wiki/<
* you will be redirected to
* en.wiktionary.org/wiki/Unsupported_titles/Less_than
*/
if (mw.config.get('wgCanonicalSpecialPageName') == 'Badtitle') {
/*
* Get the name of the page that the user attempted to access using either
* the portion of the URL after "/wiki/" or the value of the "title"
* parameter in the query. That is, the user is accessing the page using
* either the path /wiki/<invalid title> or a path similar to
* /w/index.php?title=<invalid title>.
*
* The actual page displayed if a user attempts to access an invalid title
* is the special page with the canonical title [[Special:Badtitle]].
*/
var rxArticlePath = new RegExp('^' + mw.config.get('wgArticlePath').replace('$1', '(.*)') + '$');
var m = rxArticlePath.exec(location.pathname);
var title = m ? decodeURIComponent(m[1]) : mw.util.getParamValue('title');
// Not all titles are listed, because not all actually trigger the "bad title" message.
var revTitleMap = {
'<': 'less than',
'>': 'greater than',
'{': 'left curly bracket',
'}': 'right curly bracket',
'[': 'left square bracket',
']': 'right square bracket',
'_': 'low line',
' ': 'space',
':': 'colon',
'.': 'full stop',
'|': 'vertical line',
'||': 'vertical line vertical line',
'| |': 'enclosing vertical lines',
'::': 'double colon',
': :': 'enclosing colons',
'<>': 'less than greater than',
'< >': 'enclosing less than greater than',
'<3': 'less than three',
'<g>': 'g tag',
'< > </ >': 'html start tag end tag',
'[ ]': 'square brackets',
'{ }': 'curly brackets',
'C|N>K': 'c through n to k',
'\uFFFD': 'replacement character',
'-||-' : 'hyphen vertical line vertical line hyphen'
};
if (revTitleMap[title]) {
location.href = mw.util.getUrl('ungültige_Seitennamen/' + revTitleMap[title]);
}
}