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

Content deleted Content added
No edit summary
No edit summary
Line 43:
var html = $(".mw-logline-delete").html();
$(".mw-logline-delete").html(regexpReplace(html));
var time = html.substr(1, 5);
html = html.replace(/(\d\d\:\d\d)/g, convert(time));
$(".mw-logline-delete").html(html);
}
}
Line 57 ⟶ 53:
var text = $(this).text();
// An ugly test to see if this is actually a time.
// Will convert anything in a table matching the pattern "nn:nn," where n is a digit.
var index = text.indexOf(":");
if(index > -1)
{
if(var time = text.charAtsubstr(index - 2, 5).match(/[0-9]/i);
&& text.charAt(index - 1).match(/[0-9]/i)
// Will convert anything in athe table matching the pattern "nn:nn," where n is a digit.
&& text.charAt(index + 1).match(/[0-9]/i)
&& text.charAtif(index + 2)time.match(/[0-9]\d\d:\d\d,/i))
&& text.charAt(index + 3 == ","))
{
text = partition(text);
Line 91 ⟶ 84:
$("ul").first().children().each(function()
{
var timehtml = partition($(this).texthtml());
$(this).html(regexpReplace(html));
//var time = htmlpartition($(this).substrtext(1, 5));
//$(this).text(time[0] + time[1] + time[2]);
});
}
// Modify time in user rights page.
else if(mw.config.get("wgCanonicalSpecialPageName") == "Userrights")
{
Line 102 ⟶ 100:
var html = $(this).html();
$(this).html(regexpReplace(html));
var time = html.substr(1, 5);
});
html = html.replace(/(\d\d\:\d\d)/g, convert(time));
$(this).html(html);
})
}
}
Line 148 ⟶ 142:
return new Array(front, time, end);
}
 
function regexpReplace(text)
{
var time = htmltext.substr(1, 5);
})
html return = htmltext.replace(/(\d\d\:\d\d)/g, convert(time));
}