Content deleted Content added
No edit summary |
maintenance: TypeError: undefined is not an object (evaluating 'html.replace') |
||
(16 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"))
{
Line 34 ⟶ 24:
$("ul").children().each(function()
{
$(this).html
});
break;
Line 55 ⟶ 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
});
break;
Line 73 ⟶ 66:
$(".mw-changeslist-date").each(function()
{
});
break;
case "view":
if(document.title.indexOf("Difference between revisions") > -1)
{
Line 91 ⟶ 83:
$("#mw-revision-date").html(rxReplace($("#mw-revision-date").html()));
}
▲ //$("#mw-content-text").html($("#mw-content-text").html().replace(/( )(\d\d:\d\d)(, \d{1,2} \w+ \d{4} )/g, rxPartition));
break;
Line 119 ⟶ 108:
$("#footer-info-lastmod").text(rxReplace($("#footer-info-lastmod").text()));
}
});▼
/*
function rxReplace(html)
{
// Note a call to html on nonexistent elements returns undefined e.g. $('.sssssss').html(). Guard against this being passed in.
return html.replace(/(\d\d:\d\d)/g, convert);▼
html = html || '';
}▼
* 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)▼
var hour = parseFloat(time.substr(0, 2));▼
▲ /*
if(hour >= 12)▼
▲ function rxPartition(match, p1, p2, p3)
{
if(hour != 12)▼
▲ }
▲ function convert(time)
▲ {
{
if(hour !=
{
hour = hour - 12;▼
}
}
{
}
return (hour + time.substr(2) + " AM");
}
▲});
▲ hour = 12;
▲ return (hour + time.substr(2, 5) + " AM");
// </nowiki>
|