MediaWiki:UnsupportedTitles.js
Note: Qeydi ra dıme, gani viriya cıgeyrayoği pak bo ke vurnayışi bıvêniyê.
- Gışta şıma ke niya ro gocega Firefox / Safari: Shift ser, bıtıknê ra newe ra bar kerên ya zi Ctrl-F5 ya zi Ctrl-R bıtıknê (seba Mac ra ⌘-R).
- Google Chrome: Ctrl-Shift-R ro nê. (seba Mac ra ⌘-Shift-R)
- Internet Explorer / Edge: Ctrl ke niyo ro cı, Newe ke bıtıknê ya zi Ctrl-F5 bıkerê.
- Opera: Ctrl-F5 bıtıknê.
/* [[en:MediaWiki:UnsupportedTitles.js]]
* On subpages of Unsupported titles and Talk:Unsupported titles, show the
* correct title in the header at the top of the page. For instance, on the page
* [[Unsupported titles/Left curly bracket]], show the title {.
*
* This is not enabled in the mobile version of the site.
*
* For all such pages, see [[Special:PrefixIndex/Unsupported titles]].
*/
if (mw.config.get('wgAction') === 'view'
&& /^(?:Talk:)?Unsupported_titles\//.test(mw.config.get('wgPageName')))
$(function() {
var titleMap = {
'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': '..',
'Full_stop': '.',
'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 = /^(?:Talk:)?Unsupported_titles\/(.+)$/
.exec(mw.config.get('wgPageName'))[1];
var newTitle = titleMap[subpage] || subpage;
if (mw.config.get('wgCanonicalNamespace') == 'Talk')
newTitle = 'Talk:' + 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('Unsupported titles/' + revTitleMap[title]);
}
}