Content deleted Content added
No edit summary |
maintenance: TypeError: undefined is not an object (evaluating 'html.replace') |
||
(30 intermediate revisions by one other user not shown) | |||
Line 1:
// [[Category:Wikipedia scripts]]
/*▼
// <nowiki>
*/▼
$(function()
{
Line 14 ⟶ 10:
{
case "Special":
switch(mw.config.get("wgCanonicalSpecialPageName"))
{
case "Contributions":
$(".mw-
{
$(this).
});
break;
Line 29 ⟶ 24:
$("ul").children().each(function()
{
$(this).html
});
break;
case "Listusers":
$("ul").children().each(function()
{
$(this).html
});
break;
Line 56 ⟶ 45:
$("td > a").each(function()
{
// DMY
$(
// MD,Y
$(this).html($(this).html().replace(/()(\d\d:\d\d)(, \w+ \d{1,2}, \d{4})/g, rxPartition));
});
break;
Line 72 ⟶ 64:
{
case "history":
$("
{
{▼
}▼
});
break;
case "view":
if(document.title.indexOf("Difference between revisions") > -1)
{
$("#mw-diff-ntitle1 > strong > a").html(
$("#mw-diff-otitle1 > strong > a").html(
$(".diff-currentversion-title").text(
}
Line 93 ⟶ 81:
if($("div").hasClass("mw-revision"))
{
$("#mw-revision-date").html(
}
▲ $("#mw-content-text").html($("#mw-content-text").html().replace(/(<\/a>\)\s\d\d:\d\d,\s\d{1,2}\s\w+\s\d{4}\s)/g, partition));
break;
Line 114 ⟶ 99:
$(".mw-warning-with-logexcerpt.mw-content-ltr > ul").children().each(function()
{
$(this).html(
});
}
Line 121 ⟶ 106:
if($("#footer-info-lastmod").length)
{
$("#footer-info-lastmod").text(
}
});▼
▲ /*
function partition(text)▼
* Used when it is unlikely non-times will be matched.
{▼
▲ {
// Note a call to html on nonexistent elements returns undefined e.g. $('.sssssss').html(). Guard against this being passed in.
html = html || '';
}▼
/*
return (front + time + end);▼
* 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 html.replace(/(\d\d:\d\d)/g, convert);
return (p1 + convert(p2) + p3);
▲ }
function convert(time)▼
var hour = parseFloat(time.substr(0, 2));▼
▲ function convert(time)
if(hour >= 12)▼
{
{
if(hour !=
hour = hour - 12;▼
}
}
}
▲});
// </nowiki>
▲ if(hour === 0)
▲ {
▲ hour = 12;
▲ }
▲ return (hour + time.substr(2, 5) + " AM");
|