User:Technical 13/Scripts/ACCHelp/Block list.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
This user script seems to have a documentation page at User:Technical 13/Scripts/ACCHelp/Block list. |
if(mw.config.get("wgCanonicalSpecialPageName") === "BlockList"){
$("p:contains(\"The requested IP address or username is not blocked.\")").addClass("error");
if(typeof($("p:contains(\"The requested IP address or username is not blocked.\")").html()) === "undefined"){
var blocklistTable = '\n\t<thead>\n\t\t<tr style="text-align: center;">\n\t\t\t<th>Admin</th>\n\t\t\t<th>blocked</th>\n\t\t\t<th>Target</th>\n\t\t\t<th>because</th>\n\t\t\t<th>expires</th>\n\t\t</tr>\n\t</thead>\n\t</tbody>';
$('table.mw-blocklist tbody').find('tr').each(function(){
var blocklistAdmin = $(this).find('td.TablePager_col_ipb_by').html();
blocklistAdmin = blocklistAdmin.replace(/(\(|\))/ig, '$1').replace(/ \| /ig, '|').replace('>talk</a>', '>t</a>').replace('>contribs</a>', '>c</a>');
var blocklistTimestamp = $(this).find('td.TablePager_col_ipb_timestamp').html();
var blocklistTimestampISO = new Date(blocklistTimestamp);
blocklistTimestampISO = blocklistTimestampISO.toISOString();
blocklistTimestampReturn = '<a href="/w/index.php?title=Special:Log&type=block&limit=1&dir=prev&offset=' + blocklistTimestampISO.replace(/(\-|T|:|\.|Z)/ig, "")+1 + '" title="view entry in block log">' + blocklistTimestamp + '</a>';
blocklistTimestamp = new Date(blocklistTimestamp);
var blocklistTarget = $(this).find('td.TablePager_col_ipb_target').html();
if(blocklistTarget.indexOf("</a>") === -1){
blocklistTarget = '<a href="/wiki/Special:Contributions/' + blocklistTarget + '" title="contributions of ' + blocklistTarget + '" class="mw-userlink">' + blocklistTarget + '</a><span class="mw-usertoollinks"><code>(<a href="/wiki/User_talk:' + $('input#mw-input-wpTarget').val() + '" title="User talk:' + $('input#mw-input-wpTarget').val() + '">t</a>)</code></span>';
} else {
blocklistTarget = blocklistTarget.replace(/(\(|\))/ig, '1').replace(/ \| /ig, '|').replace('>talk</a>', '>t</a>');
}
var blocklistReason = $(this).find('td.TablePager_col_ipb_reason').html();
if(blocklistReason.search(/\{\{(.*?)\}\}/) !== -1){
blocklistReason = $(this).find('td.TablePager_col_ipb_reason').html().match(/\{\{(.*?)\}\}(.*?)/);
blocklistReason = '{'+'{<a href="/wiki/Template:' + blocklistReason[1].charAt(0).toUpperCase() + blocklistReason[1].substr(1) + '" title="Template:' + blocklistReason[1].charAt(0).toUpperCase() + blocklistReason[1].substr(1) + '">' + blocklistReason[1].charAt(0).toUpperCase() + blocklistReason[1].substr(1) + '</a>}'+'}' + blocklistReason[2];
}
// var blocklistExpires = new Date($(this).find('td.TablePager_col_ipb_expiry').html());
var blocklistParameters = $(this).find('td.TablePager_col_ipb_params').html();
blocklistParameters = blocklistParameters.split(", ").sort().join(", ");
// var blocklistExpiresIn = new Date();
// blocklistExpiresIn = blocklistExpires.getTime() - Date.now();
var blocklistExpires = $(this).find('td.TablePager_col_ipb_expiry').html();
blocklistTable += '\n\t\t<tr style="text-align: center;">\n\t\t\t<td class="TablePager_col_ipb_by">' + blocklistAdmin + '</td>\n\t\t\t<td class="TablePager_col_ipb_timestamp">' + blocklistTimestampReturn + '</td>\n\t\t\t<td class="TablePager_col_ipb_target">' + blocklistTarget + '</td>\n\t\t\t<td class="TablePager_col_ipb_reason TablePager_col_ipb_params">' + blocklistReason + ', ' + blocklistParameters + '</td>\n\t\t\t<td class="TablePager_col_ipb_expiry">' + blocklistExpires + '</td>\n\t\t</tr>';
});
blocklistTable += '\n\t</tbody>';
$('table.TablePager').css({"border": "", "width": "100%"});
$('table.TablePager').html(blocklistTable);
$("h1#firstHeading").html(tickBad + " " + $("h1#firstHeading").html());
document.title = Ucross + document.title;
var blocklistTimestampWeek = blocklistTimestamp.valueOf()+(7*24*60*60*1000);
if(blocklistTimestampWeek >= Date.now()){
alert('WARNING!\n\t\tThe local block on:\n\n\t\t\t\t' + $("input#mw-input-wpTarget").val() + '\n\n\t\t... is less than a week old.');
}
} else {
$("h1#firstHeading").html(tickGood + " " + $("h1#firstHeading").html());
document.title = Ucheck + document.title;
}
}