Content deleted Content added
No edit summary |
maintenance: TypeError: undefined is not an object (evaluating 'html.replace') |
||
(8 intermediate revisions by one other user not shown) | |||
Line 1:
// [[Category:Wikipedia scripts]]
/*▼
// <nowiki>
*▼
*/▼
$(function()
{
Line 14 ⟶ 6:
// NAMESPACES //
////////////////
switch(mw.config.get("wgCanonicalNamespace"))
{
case "Special":
switch(mw.config.get("wgCanonicalSpecialPageName"))
{
Line 54 ⟶ 43:
case "File":
// Modify time in file history table.
$("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));
});
Line 84 ⟶ 71:
case "view":
if(document.title.indexOf("Difference between revisions") > -1)
{
Line 122 ⟶ 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");
}
▲});
// </nowiki>
▲ hour = 12;
▲ return (hour + time.substr(2) + " AM");
|