Content deleted Content added
No edit summary |
mNo edit summary |
||
Line 1:
// This is the Deployment Version:
// See User:Guywan/Scripts/12HourFormat.js for annotated code.
// <nowiki>
$(function()
{
switch(mw.config.get("wgCanonicalNamespace"))
{
Line 27 ⟶ 15:
});
break;
case "Log":
case "Userrights":
Line 36 ⟶ 23:
});
break;
case "Listusers":
$("ul").children().each(function()
Line 42 ⟶ 28:
$(this).html($(this).html().replace(/(on \d{1,2} \w+ \d{4} at )(\d\d:\d\d)()/g, rxPartition));
});
break;
}
break;
case "File":
$("td > a").each(function()
{
Line 59 ⟶ 39:
$(this).html($(this).html().replace(/()(\d\d:\d\d)(, \w+ \d{1,2}, \d{4})/g, rxPartition));
});
break;
}
switch(mw.config.get("wgAction"))
{
Line 78 ⟶ 49:
});
break;
case "view":
if(document.title.indexOf("Difference between revisions") > -1)
Line 86 ⟶ 56:
$(".diff-currentversion-title").text(rxReplace($(".diff-currentversion-title").text()));
}
if($("div").hasClass("mw-revision"))
{
$("#mw-revision-date").html(rxReplace($("#mw-revision-date").html()));
}
break;
}
if($("div").hasClass("mw-warning-with-logexcerpt mw-content-ltr"))
{
Line 111 ⟶ 69:
});
}
if($("#footer-info-lastmod").length)
{
Line 118 ⟶ 74:
}
});
function rxReplace(html)
{
return html.replace(/(\d\d:\d\d)/g, convert);
}
function rxPartition(match, p1, p2, p3)
{
return (p1 + convert(p2) + p3);
}
function convert(time)
{
var hour = parseFloat(time.substr(0, 2));
if(hour >= 12)
{
Line 146 ⟶ 91:
hour = hour - 12;
}
return (hour + time.substr(2) + " PM");
}
if(hour === 0)
{
hour = 12;
}
return (hour + time.substr(2) + " AM");
}
|