User:Mike Dillon/Scripts/recentpages.js: Difference between revisions

Content deleted Content added
mNo edit summary
m use wfMsg; add localizations in English and Spanish
Line 7:
var pageHistoryBeforePorlet;
var pageHistoryExpiresInDays;
 
/* Messages */
// pageHistoryTitle: title of page history portlet
wfAddMsg("en", "pageHistoryTitle", "Page history");
wfAddMsg("es", "pageHistoryTitle", "Historial de páginas");
 
// clearHistoryLabel: label of the "clear history" link
wfAddMsg("en", "clearHistoryLabel", "clear history");
wfAddMsg("es", "clearHistoryLabel", "borrar historial");
 
// clearHistoryTitle: tooltip of the "clear history" link
wfAddMsg("en", "clearHistoryTitle", "Clear page history");
wfAddMsg("es", "clearHistoryTitle", "Borrar historial de páginas");
 
// noPageHistoryText: text to display when there is no page history
wfAddMsg("en", "noPageHistoryText", "No page history");
wfAddMsg("es", "noPageHistoryText", "Ningún historial de páginas");
 
addOnloadHook(function () {
Line 18 ⟶ 35:
with (easyDom) {
var historyPortlet = div({ "class": "portlet", "id": "p-history" },
h5(wfMsg("Page historypageHistoryTitle")));
var historyList = ul();
var historyPBody = div({ "class": "pBody" }, historyList);
Line 60 ⟶ 77:
}
with (easyDom) {
historyList.appendChild(li(em(wfMsg("No page historynoPageHistoryText"))));
}
deleteCookie(pageHistoryCookieName, { path: "/" });
Line 69 ⟶ 86:
with (easyDom) {
if (historyItems.length == 0) {
historyList.appendChild(li(em(wfMsg("No page historynoPageHistoryText"))));
} else {
for (var n in historyItems) {
Line 87 ⟶ 104:
}
 
var clearHistoryLink = a({ "href": "#", "title": wfMsg("Clear page historyclearHistoryTitle") }, em("clear history"));
em(wfMsg("clearHistoryLabel")));
clearHistoryLink.onclick = clearHistory;
historyPBody.appendChild(div(