User:Guywan/Scripts/12HourFormat.js: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 17:
};
 
if(mw.config.get("wgAction") == "history"
$(function()
|| mw.config.get("wgAction") == "view"
|| mw.config.get("wgAction") == "edit"
|| mw.config.get("wgCanonicalNamespace") == "Special")
{
$(function()
if(mw.config.get("wgCanonicalNamespace") == "Special")
{
// Modify time when viewing page history.
switch(mw.config.get("wgCanonicalSpecialPageName"))
if(mw.config.get("wgAction") == "history")
{
$("span.mw-history-histlinks ~ a").each(function()
case "Contributions":
{
$(".mw-contributions-list").children().each(function()
if($(this).attr("class") === "mw-changeslist-date")
{
$(this).children().first().text(var time = partition($(this).children().first().text()));
});
$(this).text(time[0] + time[1] + time[2]);
break;
}
case "Log":});
case "Userrights":
$("ul").children().each(function()
{
$(this).html(regexpReplace($(this).html(), 1, 5));
});
break;
case "Project":
// TODO
break;
}
else if(mw.config.get("wgAction") == "edit")
}
else if(mw.config.get("wgCanonicalNamespace") == "File")
{
// Modify time in file history table.
$("td > a").each(function()
{
if($("div").hasClass("mw-warning-with-logexcerpt mw-content-ltr"))
var text = $(this).text();
{
var indexhtml = text.indexOf$(":.mw-logline-delete").html();
if(index > -1)
{
var time = text.substr(index - 2, 6);
$(".mw-logline-delete").html(regexpReplace(html));
// Will convert anything in a table matching the pattern "dd:dd," where d is a digit.
if(time.match(/\d\d:\d\d,/)) { $(this).text(partition(text)); }
}
});
else if(mw.config.get("wgCanonicalNamespace") == "File")
}
{
// Modify time in file history table.
switch(mw.config.get("wgAction"))
$("td > a").each(function()
{
case "history":
$("span.mw-history-histlinks ~ a").each(function()
{
if(var text = $(this).attrtext("class") == "mw-changeslist-date");
var index = text.indexOf(":");
if(index > -1)
{
$(this).var time = text(partition($(this).textsubstr())index - 2, 6);
// Will convert anything in the table matching the pattern "dd:dd," where d is a digit.
if(time.match(/\d\d:\d\d,/))
{
text = partition(text);
$(this).text(text[0] + text[1] + text[2]);
}
}
});
break;}
else if(mw.config.get("wgCanonicalNamespace") == "Special")
{
case "view":
// Modify time when viewing user contributions.
if(document.title.indexOf("Difference between revisions") > -1)
if(mw.config.get("wgCanonicalSpecialPageName") == "Contributions")
{
$(".mw-contributions-list").children().each(function()
var comp = "#mw-diff-ntitle1 > strong > a";
{
for(i = 0; i < 2; i++)
var text = partition($(this).children().first().text());
{
$(comp).html($(comp).html().replace(/(\d\d:\d\d)/g, convert(temp.substr(temp.indexOf(":") - 2, 5))));
$(this).children().first().text(text[0] + text[1] + text[2]);
comp = "#mw-diff-otitle1 > strong > a";
});
}
// Modify time when viewing user log info.
else if(mw.config.get("wgCanonicalSpecialPageName") == "Log")
{
$("ul").first().children().each(function()
{
var html = $(this).html();
$(this).html(regexpReplace(html));
$(".diff-currentversion-title").html(partition($(".diff-currentversion-title").text()));
});
}
// Modify time in user rights page.
break;
else if(mw.config.get("wgCanonicalSpecialPageName") == "Userrights")
{
case "edit":
$("ul").children().each(function()
// Modify time in the "This page has been moved or deleted" banner.
{
if($("div").hasClass("mw-warning-with-logexcerpt mw-content-ltr"))
var html = $(this).html();
{
$(".mw-logline-delete").html(regexpReplace($(".mw-logline-delete").html(), 1, 5));
$(this).html(regexpReplace(html));
});
}
break;}
// Modify time when comparing two revisions.
}
else if((mw.config.get("wgAction") == "view") && (document.title.indexOf("Difference between revisions") > -1))
 
{
// Modify the time in the footer of most pages.
var comp = "#mw-diff-ntitle1 > strong > a";
if($("#footer-info-lastmod").length)
var text = "";
{
for(i = 0; i < 2; i++)
$("#footer-info-lastmod").text(partition($("#footer-info-lastmod").text()));
{
}
text = partition($(comp).text());
});
$(comp).text(text[0] + text[1] + text[2]);
comp = "#mw-diff-otitle1 > strong > a";
}
text = partition($(".diff-currentversion-title").text());
$(".diff-currentversion-title").text(text[0] + text[1] + text[2]);
}
// Modify the time in the footer of most pages.
if($("#footer-info-lastmod").length)
{
var footer = partition($("#footer-info-lastmod").text());
$("#footer-info-lastmod").text(footer[0] + footer[1] + footer[2]);
}
});
}
 
function partition(text)
Line 134 ⟶ 158:
if(hour === 0)
{
hour = 12;
}