Content deleted Content added
No edit summary |
No edit summary |
||
Line 3:
* <code><nowiki>{{subst:Iusc|User:Guywan/Scripts/12HourFormat.js}}</nowiki></code>
* or:
* <code><nowiki>importScript("User:Guywan/Scripts/12HourFormat.js"); //
*
* This script was originally authored by User:Bility, [[User:Bility/convert24hourtime.js]].
Line 9:
* I have mainly streamlined the code and introduced more functionality.
*/
$(function()
{
////////////////
// NAMESPACES //
////////////////
switch(mw.config.get("wgCanonicalNamespace"))
{
case "Special":
switch(mw.config.get("wgCanonicalSpecialPageName"))
{
case "Contributions":
$(
$(this).children().first().text(partition($(this).children().first().text()));
});
case "Log":
case "Userrights":
$(
$(this).html(regexpReplace($(this).html(), 1, 5));
});
break;
// TODO
break;
}
break;
case "File":
// Modify time in file history table.
$("td > a").each(function()
{
var
var index = text.indexOf(":");
if(
{
var time = text.substr(index - 2, 6);
// Will convert anything in a table matching the pattern "dd:dd," where d is a digit.
if(time.match(/\d\d:\d\d,/))
{
$(this).text(partition(text));
}
}
});
case "User":
// TODO
}
/////////////
// ACTIONS //
/////////////
switch(mw.config.get("wgAction"))
Line 81 ⟶ 85:
case "view":
if(document.title.indexOf("Difference between revisions") > -1)
{
Line 97 ⟶ 102:
}
// Modify time in permalink pages.
if($("div").hasClass("#mw-revision"))
{
$("#mw-revision-date").html(regexpReplace($("#mw-revision-date").html(), 0, 5));
}
// Modify user signatures.
var html = $("#mw-content-text").html();
switch(mw.config.get("wgDefaultDateFormat"))
{
case "dmy":
// HH:MM, DD MM YY //
html = html.replace(/(<\/a>\)\s\d\d:\d\d,\s\d{1,2}\s\w+\s\d{4}\s)/g, partition);
break;
case "mdy":
// HH:MM, MM DD YY //
html = html.replace(/(<\/a>\)\s\d\d:\d\d,\s\w+\s\d{1,2}\s\d{4}\s)/g, partition);
break;
case "ymd":
// HH:MM, YY MM DD //
html = html.replace(/(<\/a>\)\s\d\d:\d\d,\s\d{4}\s\w+\s\d{1,2}\s)/g, partition);
break;
}
$("#mw-content-text").html(html);
break;
Line 106 ⟶ 136:
break;
}
///////////
// OTHER //
///////////
// Modify time in warning banners.
|