Content deleted Content added
No edit summary |
maintenance: TypeError: undefined is not an object (evaluating 'html.replace') |
||
(35 intermediate revisions by one other user not shown) | |||
Line 1:
// [[Category:Wikipedia scripts]]
// <nowiki>
$(function()
{
Line 19 ⟶ 10:
{
case "Special":
switch(mw.config.get("wgCanonicalSpecialPageName"))
{
case "Contributions":
$(".mw-
{
$(this).
});
break;
Line 31 ⟶ 21:
case "Log":
case "Userrights":
case "AbuseLog":
$("ul").children().each(function()
{
$(this).html
});
break;
case "Listusers":
$("ul").children().each(function()
{
$(this).html($(this).html().replace(/(on \d{1,2} \w+ \d{4} at )(\d\d:\d\d)()/g, rxPartition));
});
break;
Line 47 ⟶ 45:
$("td > a").each(function()
{
// DMY
$(this).html($(this).html().replace(/()(\d\d:\d\d)(, \d{1,2} \w+ \d{4})/g, rxPartition));
// MD,Y
$(this).html($(this).html().replace(/()(\d\d:\d\d)(, \w+ \d{1,2}, \d{4})/g, rxPartition));
});
break;
Line 75 ⟶ 64:
{
case "history":
$("
{
});
break;
case "view":
if(document.title.indexOf("Difference between revisions") > -1)
{
$("#mw-diff-otitle1 > strong > a").html(rxReplace($("#mw-diff-otitle1 > strong > a").html()));
$(".diff-currentversion-title").text(rxReplace($(".diff-currentversion-title").text()));
}
// Modify time in permalink pages.
if($("div").hasClass("
{
$("#mw-revision-date").html(
}
break;
Line 146 ⟶ 99:
$(".mw-warning-with-logexcerpt.mw-content-ltr > ul").children().each(function()
{
$(this).html(
});
}
Line 153 ⟶ 106:
if($("#footer-info-lastmod").length)
{
$("#footer-info-lastmod").text(
}
/*
* Used when it is unlikely non-times will be matched.
*/
function rxReplace(html)
{
// Note a call to html on nonexistent elements returns undefined e.g. $('.sssssss').html(). Guard against this being passed in.
html = html || '';
return html.replace(/(\d\d:\d\d)/g, convert);
}
/*
* Used when a very specific match needs to be made and
* only a substring of the match should be modified.
*/
function rxPartition(match, p1, p2, p3)
{
return (p1 + convert(p2) + p3);
}
function convert(time)
{
if(hour >= 12)
{
if(hour !=
{
hour = hour - 12;
}
return (hour + time.substr(2) + " PM");
}
{
hour = 12;
}
return (hour + time.substr(2) + " AM");
}
});
// </nowiki>
|