Usuário:Citizen Kimi/common.js
Nota: Depois de publicar, poderá ter de contornar a cache do seu navegador para ver as alterações.
- Firefox / Safari: Pressione Shift enquanto clica Recarregar, ou pressione Ctrl-F5 ou Ctrl-R (⌘-R no Mac)
- Google Chrome: Pressione Ctrl-Shift-R (⌘-Shift-R no Mac)
- Internet Explorer / Edge: Pressione Ctrl enquanto clica Recarregar, ou pressione Ctrl-F5
- Opera: Pressione Ctrl-F5.
mw.loader.load('https://www.mediawiki.org/w/index.php?title=XTools/ArticleInfo.js&action=raw&ctype=text/javascript');
mw.loader.load("https://en.wikipedia.org/w/index.php?title=User:Awesome_Aasim/infiniscroll.js&action=raw&ctype=text/javascript");
mw.loader.load("https://en.wikipedia.org/w/index.php?title=User:Kangaroopower/rawtab.js&action=raw&ctype=text/javascript");
mw.loader.load("https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-Prosesize.js&action=raw&ctype=text/javascript");
mw.loader.load("https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-script-installer.js&action=raw&ctype=text/javascript");
// [[File:User:!Silent/improveVandalBlock.js]]
mw.loader.load( '//pt.wikipedia.org/w/index.php?title=Usuário:!Silent/improveVandalBlock.js&action=raw&ctype=text/javascript' );
//Ajustes automáticos
mw.loader.load('//pt.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=Usuário:Luizdl/Script de ajustes.js&action=raw&ctype=text/javascript', 'text/javascript');
//Smart hollback
mw.loader.load( '//pt.wikipedia.org/w/index.php?title=Usuário:Tks4Fish/Smart Rollback.js&action=raw&ctype=text/javascript' );
//URL mortas
mw.loader.load("//tools.wmflabs.org/deadlinkfinder/script.js");
// Respostas simplificadas em discussões
mw.loader.load( '//pt.wikipedia.org/w/index.php?title=Usuário:Bageense/Reply link em português.js&action=raw&ctype=text/javascript' );
//This adds a quick link in your toolbox to revert vandalism quickly by catching the tag "Repaeting characters".
function addNoVandal(){
mw.util.addPortletLink("p-tb","http://en.wikipedia.org/w/index.php?namespace=&tagfilter=repeating+characters&title=Special%3ARecentChanges" ,"Revert vandalism","tb-repeating characters","Catches all edits with the tag repeating characters on them");
}
$(addNoVandal);
"use strict";
var mw, $;
if (
mw.config.get( 'wgAction' ) === 'history'
|| ( $.inArray( mw.config.get( 'wgCanonicalSpecialPageName' ), ['Recentchanges', 'Watchlist', 'Contributions'] ) + 1 )
|| /\bdiff=/.test( window.location.href ) // poor-man's mw.util.paramValue()
)
$.when( mw.loader.using( [ 'jquery.ui', 'mediawiki.api', 'mediawiki.user', 'mediawiki.util' ] ), $.ready ).done ( function() {
var summaryStorageKey = 'rollback summary',
userTalkStorageKey = 'rollback user talk message',
historyDepth = 20,
api = new mw.Api(),
onRollbackClick = function(e) {
var $this = $(this),
href = $this.attr( 'href' ),
token = decodeURIComponent( href.replace( /.*[&\?]token=/, '' ).replace( /&.*/, '' ) ),
title = decodeURIComponent( href.replace( /.*[&\?]title=/, '' ).replace( /&.*/, '' ).replace(/_/g, ' ') ),
from = decodeURIComponent( href.replace( /.*[&\?]from=/, '' ).replace( /&.*/, '' ).replace( /\+/g, ' ' ) ),
talkPageMessage,
rbParams = { action: 'rollback', token: token, title: title, user: from },
replaceTokens = function( str ) {
return str.replace( /\$1/g, title ).replace( /\$2/g, from ).replace( /\$3/g, $this.text() );
},
rollback = function( watchArticle, watchTalk ) {
if ( watchArticle )
rbParams.watchlist = 'watch';
api.post( rbParams, function() {
var match = $this.text().match( /:(.*)/ ),
edits = ( match && match.length > 1 ) ? match[1] : $this.text(),
userLink = $this.closest('span').parent().find( '.mw-usertoollinks' ),
talkPageLink = $this.closest( 'span' ).parent()
.find( '.mw-usertoollinks a' )
.filter( function() { return $( this ).text() == "Talk" } ),
talkHref = talkPageLink.attr( 'href' ),
vanarticle = 'vanarticle=' + mw.util.rawurlencode( title );
talkPageLink
.attr( 'href', talkHref + ( /\?/.test( talkHref ) ? '&' : '?' ) + vanarticle )
.css( 'font-weight', 'bold' );
mw.util.jsMessage( i18n( 'success', edits, from ) );
$this.remove();
if ( talkPageMessage )
api.post(
{ action: 'edit',
token: mw.user.tokens.get( 'csrfToken' ),
appendtext: talkPageMessage,
title: i18n('user talk', from),
summary: replaceTokens( talkPageSummaryInputbox.val() ),
watchlist: watchTalk ? 'watch' : 'preferences'
},
function() { mw.util.jsMessage( i18n( 'talk success', talkPageMessage, from ) ); }
);
} );
};
e.preventDefault();
var watchOption = mw.user.options.get('watchrollback');
if ( e.type == 'click' ) // left click
rollback( watchOption );
else { // right click.
var dialog,
summary,
summariesJson = mw.storage.get( summaryStorageKey ) || "[]",
summaries = JSON.parse(summariesJson),
talkPageMessagesJson = mw.storage.get( userTalkStorageKey ) || "{}",
talkPageMessages = JSON.parse(talkPageMessagesJson),
summaryInputbox = $( '<input>', { width: '40em' } ),
summarySelector = $( '<select>' ).append( $( '<option>' ) ).change( function() { summaryInputbox.val( this.value ); } ),
watchArticleCheckbox = $( '<input>', { type: 'checkbox' } ).prop( 'checked', watchOption ),
talkPageInputbox = $( '<input>', { width: '40em' } ),
talkPageTextbox = $( '<textarea>', { rows: 5 } ),
talkPageSummaryInputbox = $( '<input>', { width: '40em' } ),
talkPageSelector = $( '<select>' ).change( function() {
talkPageInputbox.val( this.value );
talkPageTextbox.val( talkPageMessages[this.value].m || '' );
talkPageSummaryInputbox.val( talkPageMessages[this.value].s || '' );
} ),
watchTalkpageCheckbox = $( '<input>', { type: 'checkbox' }).prop( 'checked', mw.config.get( 'watchTalkpageOnRollbackMessage' ) ),
prepareTalkpageSelector = function() {
talkPageSelector.find( '*' ).remove();
talkPageSelector.append( $( '<option>' ) );
for ( var talkMessageName in talkPageMessages ) {
var option = $( '<option>', { value: talkMessageName, text: talkMessageName} );
if ( /^=/.test( talkMessageName ) )
option.attr( 'disabled', 'diabled' );
talkPageSelector.append( option );
}
talkPageInputbox.val( '' );
talkPageTextbox.val( '' );
};
$( summaries ).each( function( index, item ) { summarySelector.append( $( '<option>', { value: item, text: item } ) ); } );
prepareTalkpageSelector();
dialog = $( '<div>' ).dialog( {
title: i18n( 'dialogtitle' ),
modal: true,
buttons: [
{ text: i18n('ok'), click: function() {
summary = $.trim( summaryInputbox.val() );
talkPageMessage = $.trim( talkPageTextbox.val() );
if ( !summary && !talkPageMessage )
return;
if ( summary ) {
var old = $.inArray( summary, summaries );
if ( old + 1 )
summaries.splice( old, 1 );
summaries.splice( 1, 0, summary );
if ( summaries.length > 20 )
summaries.pop();
mw.storage.set( summaryStorageKey, JSON.stringify( summaries ) );
rbParams.summary = replaceTokens( summary );
}
var talkPageMessageName = $.trim( talkPageInputbox.val() ),
talkPageSummary = $.trim( talkPageSummaryInputbox.val() );
if ( talkPageMessageName ) {
if ( talkPageMessage ) {
talkPageMessages[ talkPageMessageName ] = { m: talkPageMessage, s: talkPageSummary };
} else
delete talkPageMessages[ talkPageMessageName ];
mw.storage.set( userTalkStorageKey, JSON.stringify( talkPageMessages ) );
}
if ( talkPageMessage )
talkPageMessage = '\n' + replaceTokens( talkPageMessage );
rollback( watchArticleCheckbox.prop( 'checked' ), watchTalkpageCheckbox.prop( 'checked' ) );
$(this).dialog( 'close' );
} },
{ text: i18n( 'read boilerplate button' ), click: function() {
var source = prompt( i18n( 'enter boilerplate source' ), i18n( 'default boilerplate page') );
if ( source ) {
$.ajax( {
url: mw.util.wikiScript(),
cache: false,
data: {title: source, action: 'raw', ctype: 'text/x-wiki'},
success: function( data ) {
try {
talkPageMessages = JSON.parse( data );
prepareTalkpageSelector();
mw.storage.set( userTalkStorageKey, JSON.stringify( talkPageMessages ) );
} catch(e) {
alert( i18n( 'exception reading boilerplates', source, e ) );
}
}
} );
}
} },
{ text: i18n( 'cancel' ), click: function() { $( this ).dialog( 'close' ); } }
]
} )
.append( $( '<p>' ).html( i18n( 'description', title, from, $this.text() ) ) )
.append( $( '<table>' )
.append( $( '<tr>' )
.append( $( '<td>', { text: i18n( 'summary' ) } ) )
.append( summaryInputbox )
)
.append( $( '<tr>' )
.append( $( '<td>', { text: i18n( 'summaryhist' ) } ) )
.append( summarySelector )
)
.append( $( '<tr>' )
.append( $( '<td>', { text: i18n( 'watch article', title ) } ) )
.append( watchArticleCheckbox )
)
.append( $( '<tr>' )
.append( $( '<td>', { text: i18n( 'talkpagename' ) } ) )
.append( talkPageInputbox )
)
.append( $( '<tr>' )
.append( $( '<td>', { text: i18n( 'talkpagemessage', from ) } ) )
.append( talkPageTextbox )
)
.append( $( '<tr>' )
.append( $( '<td>', { text: i18n( 'talkpagesummary', from ) } ) )
.append( talkPageSummaryInputbox )
)
.append( $( '<tr>' )
.append( $( '<td>', {text: i18n( 'talkpagemessagehist' ) } ) )
.append( talkPageSelector )
)
.append( $( '<tr>' )
.append( $( '<td>', { text: i18n( 'watch talkpage', from ) } ) )
.append( watchTalkpageCheckbox )
)
);
dialog.dialog( 'option', { width: 'auto', height: 'auto' } );
dialog.dialog( 'option', { position: { my: 'center', at: 'center', of: window } } );
dialog.dialog( 'option', { width: '100', height: '100' } ); // this perversion is for rtl: we need to force a redraw.
dialog.dialog( 'option', { width: 'auto', height: 'auto' } );
dialog.dialog( 'option', { position: { my: 'center', at: 'center', of: window } } ); // ditto.
} // e.type == contextmenu
}, // onRollbackClick
i18n = function () {
var str = arguments[0];
switch ( mw.config.get( 'wgUserLanguage' ) ) {
case 'he':
switch ( str ) {
case 'description':
str = 'ניתן (אין חובה) להזין תקציר עריכה לשחזור, ו/או הודעה שתישמר בדף השיחה של %2.<br />'
+ '$1 יוחלף בשם הדף (%1),<br />'
+ '$2 יוחלף בשם המשתמש (%2)<br />'
+ '$3 יוחלף בכותרת הקישור (%3)';
break;
case 'dialogtitle':
return 'שחזור עריכה';
case 'success':
str = '%1 של %2 בוצע';
break;
case 'ok':
return 'אישור';
case 'cancel':
return 'ביטול';
case 'rightclick':
return 'לחיצה בכפתור ימני מאפשרת להוסיף תקציר.';
case 'summary':
return 'תקציר עריכה:';
case 'summaryhist':
return 'תקצירים קודמים:';
case 'talkpagename':
return 'שם ההודעה בדף שיחה:';
case 'talkpagemessagehist':
return 'הודעות דף שיחה קודמות:';
case 'talkpagemessage':
str = 'הודעה לדף השיחה של %1:';
break;
case 'read boilerplate button':
return 'קריאת ההודעות מדף';
case 'enter boilerplate source':
return 'הזינו את שם הדף בו נמצאות ההודעות המוכנות';
case 'default boilerplate page':
return 'משתמש:Neukoln/msgs.js';
case 'exception reading boilerplates':
str = 'שגיאה בניסיון לקריאת תבניות מדף "%1". השגיאה היא: %2';
break;
case 'watch article':
str = 'הוסף את הדף %1 לרשימת המעקב';
break;
case 'watch talkpage':
str = 'הוסף את דף השיחה של משתמש:%1 לרשימת המעקב';
break;
case 'user talk':
str = 'שיחת משתמש:%1';
break;
case 'talkpagesummary':
return 'תקציר להודעה בשיחת משתמש';
case 'talk success':
str = 'ההודעה:<br />%1<br />נשמרה בהצלחה בדף "שיחת משתמש:%2"';
break;
}
break;
default:
switch ( str ) {
case 'description':
str = 'You can enter a summary for the rollback instead of the default, '
+ 'and an optional message to be added to %2 talk page<br />'
+ '$1 will be replaced by page name (%1),<br />'
+ '$2 will be replaced by user name (%2),<br />'
+ '$3 will be replaced by rollover text (%3).';
break;
case 'dialogtitle' :
return 'Rollback summary';
case 'success':
str = 'Successfully rolled back %1 by %2';
break;
case 'ok':
return 'OK';
case 'cancel':
return 'Cancel';
case 'rightclick':
return 'Use right mouse button to add summary.';
case 'summary':
return 'Summary:';
case 'summaryhist':
return 'Summary history:';
case 'talkpagename':
return 'Talk page message name:';
case 'talkpagemessagehist':
return 'Talk page message name history:';
case 'talkpagemessage':
return 'Talk page message:';
case 'talk success':
str = 'Message %1 was successfuly saved in %2 talkpage';
break;
case 'read boilerplate button':
return 'Read messages';
case 'enter boilerplate source':
return 'Please enter page name from which to read boilerplate messages';
case 'default boilerplate page':
return '';
case 'exception reading boilerplates':
str = 'Exception trying to interpret Page "%1". Exception is: %2';
break;
case 'watch article':
str = 'Add page "%1" to your watchlist';
break;
case 'watch talkpage':
str = 'Add "User talk:%1" to your watchlist';
break;
case 'user talk':
str = 'User talk:%1';
break;
case 'talkpagesummary':
return 'Summary for talk page message';
case 'talk success':
str = 'Successfuly added<br />%1<br />To page User talk:%2';
break;
}
break;
}
for ( var arg = 1; arg < arguments.length; arg++ )
str = str.replace( new RegExp( '%' + arg, 'g' ), arguments[ arg ] );
return str;
};
$( 'a[href *= "action=rollback"]' ).on( 'click contextmenu', onRollbackClick );
var tries = 0,
timer = setInterval( function() {
if ( window.removeTooltip ) {
$( 'a[href *= "action=rollback"]' ).each( function() {
window.removeTooltip( this );
this.title += " \n" + i18n( 'rightclick' );
});
clearInterval( timer );
} else if ( tries++ > 30 )
clearInterval( timer );
}, 100 );
} ); // using </source>
function rollbackEverythingWKMR(editSummary)
{
if(editSummary === null)
{
return false;
}
var userName = mw.config.get("wgRelevantUserName");
var titleRegex = /title=([^&]+)/;
mw.loader.using( 'mediawiki.api' ).done( function()
{
var api = new mw.Api();
$("a[href*='action=rollback']").each(function(ind, el)
{
var params = {};
if( editSummary != '' )
{
params.summary = editSummary;
}
api.rollback( decodeURIComponent(titleRegex.exec(el.href)[1]), userName, params).done( function()
{
$(el).after("reverted");
$(el).remove();
} );
} );
} );
return false;
}
$(document).ready(function()
{
if(mw.config.get("wgCanonicalSpecialPageName") == "Contributions" && $("span.mw-rollback-link").length > 0)
{
mw.loader.using("mediawiki.util").done( function ()
{
mw.util.addPortletLink('p-cactions', '#', "rollback all", "ca-rollbackeverything", "rollback all edits displayed here");
$("#ca-rollbackeverything").click( function(event)
{
event.preventDefault();
mw.loader.load( 'mediawiki.api' ); //start loading, while the user is in the prompt
return rollbackEverythingWKMR(prompt("Enter an edit summary, or leave blank to use the default (or hit Cancel to cancel the rollback entirely)"));
});
});
}
});
if (mw.config.get('wgCanonicalSpecialPageName') === 'Recentchanges') {
mw.hook('wikipage.content').add(function() {
$('.mw-changeslist a').attr('target', '_blank');
});
}
$.when( mw.loader.using( ['mediawiki.util'] ), $.ready ).done( function() {
mw.util.addPortletLink(
'p-personal',
mw.util.getUrl('Special:NewPages/hidepatrolled'),
'Special:NewPages',
'pt-specialnew',
'View the original Special:NewPages, with patrolled edits hidden',
null,
'#pt-preferences'
);
});
var pendch_http;
var pendch_enabled;
var pendch_num_pages;
var pendch_refresh;
var pendch_num_idle_req;
var pendch_curr_idle_req;
var pendch_diffonly;
var pendch_str_no_ajax = "There seems to be a problem using the pendingchanges script. Your browser is not supported.";
var pendch_str_box_title = "Pending changes";
var pendch_str_box_title_updating = "Pending changes (updating)";
var pendch_str_box_title_failed = "Pending changes (update failed)";
var pendch_str_enable = "Enable this box";
var pendch_str_disable = "Disable this box";
$(document).ready( pendch_init );
/* initalise */
function pendch_init() {
if (window.location.toString().search(/diffonly=1/) != -1) {
var currURL = window.location.toString();
var newURL=currURL.replace(/diffonly=1/,diffonly=0);
console.log(document.getElementById("difference").innerHTML);
if (document.getElementById("difference").innerHTML.search(/Show page below diff/) == -1) {
document.getElementById("difference").innerHTML += ' (<a href="' + newURL + '">Show page below diff</a>)';
}
}
// allow user settings through
if (pendch_enabled == null) {
pendch_enabled = false;
}
if (pendch_num_pages == null) {
pendch_num_pages = 10;
}
if (pendch_refresh == null) {
pendch_refresh = 10;
}
if (pendch_num_idle_req == null) {
pendch_num_idle_req = 60;
}
if(pendch_diffonly == null) {
pendch_diffonly = 1;
}
// A few limits to be nice to the servers
if (pendch_num_pages > 50) {
pendch_num_pages = 50;
}
if (pendch_num_pages < 1) {
pendch_num_pages = 1;
}
if (pendch_refresh < 2) {
pendch_refresh = 2;
}
if (pendch_num_idle_req > 1000) {
pendch_num_idle_req = 1000;
}
if (pendch_num_idle_req < 5) {
pendch_num_idle_req = 5;
}
// get our cookie
if (document.cookie.length > 0) {
var c_start = document.cookie.indexOf("pendch_show_box=");
if (c_start != -1) {
c_start = c_start + 16;
var c_end = document.cookie.indexOf(";", c_start);
if (c_end == -1) {
c_end = document.cookie.length;
}
if (document.cookie.substring(c_start, c_end) == "yes") {
pendch_enabled = true;
} else {
pendch_enabled = false;
}
}
}
// Either make a request or show nothing
pendch_curr_idle_req = 0;
if (pendch_enabled == true) {
pendch_ajax_request();
} else {
pendch_draw_disabled_box();
}
}
/* init ajax */
function pendch_create_request() {
try {
pendch_http = new XMLHttpRequest();
} catch (e) {
try {
pendch_http = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
pendch_http = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
return false;
}
}
}
pendch_http.onreadystatechange = function() {
if(pendch_http.readyState == 4) pendch_ajax_response();
}
return true;
}
/* make a request */
function pendch_ajax_request() {
// if we have done too many requests, disable the box
pendch_curr_idle_req++;
if (pendch_curr_idle_req > pendch_num_idle_req) {
pendch_disable_box();
}
// check we are enabled
if (pendch_enabled == false) return;
// firstly, inform the user
var cur_box = document.getElementById('p-pendingchanges');
if (cur_box != null) {
cur_box.firstChild.firstChild.data = pendch_str_box_title_updating;
}
if (pendch_create_request () == false) {
if (cur_box != null) {
cur_box.firstChild.firstChild.data = pendch_str_box_title_failed;
} else {
alert (pendch_str_no_ajax);
}
}
// Get the current time
var dateobj = new Date();
var now = Math.floor(dateobj.getTime() / 1000.0);
// Then make the request
pendch_http.open("GET", "/w/api.php?action=query&format=json&list=oldreviewedpages&ornamespace=0|4&orlimit=" + pendch_num_pages, true);
pendch_http.send(null);
}
function pendch_draw_disabled_box() {
if (mw.config.get('skin') == 'vector') {
pendch_draw_disabled_box_vector();
} else {
pendch_draw_disabled_box_monobook();
}
}
function pendch_ajax_response() {
if (mw.config.get('skin') == 'vector') {
pendch_ajax_response_vector();
} else {
pendch_ajax_response_monobook();
}
// and do it again in 5 secs
setTimeout("pendch_ajax_request()", pendch_refresh * 1000);
}
function pendch_disable_box() {
pendch_enabled = false;
pendch_draw_disabled_box();
document.cookie = "pendch_show_box=no; path=/";
}
function pendch_enable_box() {
pendch_enabled = true;
pendch_curr_idle_req = 0;
document.cookie = "pendch_show_box=yes; path=/";
pendch_ajax_request();
}
/* Draw disabled (monobook) */
function pendch_draw_disabled_box_monobook() {
// Container div
var link_div = document.createElement('div');
link_div.className = 'pBody';
var div = document.createElement('div');
div.setAttribute('id', 'p-pendingchanges');
div.className = 'portal';
var heading = document.createElement('h3');
heading.appendChild(document.createTextNode(pendch_str_box_title));
div.appendChild(heading);
div.appendChild(link_div);
// enable link
var p = document.createElement('p');
p.style.fontSize = 'x-small';
p.style.margin = '0px';
var a = document.createElement('a');
a.appendChild(document.createTextNode(pendch_str_enable));
a.onclick = pendch_enable_box;
p.appendChild(a);
link_div.appendChild(p);
// now replace the div
var old_div = document.getElementById('p-pendingchanges');
var side_col = document.getElementById('column-one');
if (old_div != null) {
side_col.replaceChild(div, old_div);
} else {
var node = document.getElementById('p-search');
side_col.insertBefore(div, node);
}
}
/* Draw response (monobook) */
function pendch_ajax_response_monobook() {
var resp = JSON.parse(pendch_http.responseText);
var items = resp.query.oldreviewedpages;
// create the div that holds all the newpage links
var link_div = document.createElement('div');
link_div.className = 'pBody';
var list = document.createElement('ul');
link_div.appendChild(list);
// populate the list with 10 links.
for (var i = 0; i < items.length; i++) {
var item = items[i];
var item_name = item.title;
var old_id = item.stable_revid;
item_name = item_name.replace(/&/, "%26");
var item_url = 'http://en.wikipedia.org/w/index.php?title=' + item_name + '&diff=cur&oldid=' + old_id + '&diffonly=' + pendch_diffonly;
a = document.createElement('a');
a.setAttribute('href', item_url);
a.appendChild(document.createTextNode(item_name));
var li = document.createElement('li');
li.appendChild(a);
list.appendChild(li);
}
// Container div
var div = document.createElement('div');
div.setAttribute('id', 'p-pendingchanges');
div.className = 'portal';
var heading = document.createElement('h3');
heading.appendChild(document.createTextNode(pendch_str_box_title));
div.appendChild(heading);
div.appendChild(link_div);
// disable link
var p = document.createElement('p');
p.style.fontSize = 'x-small';
p.style.margin = '0px';
p.style.textAlign = 'right';
a = document.createElement('a');
a.appendChild(document.createTextNode(pendch_str_disable));
a.onclick = pendch_disable_box;
p.appendChild(a);
link_div.appendChild(p);
// now replace the div
var old_div = document.getElementById('p-pendingchanges');
var side_col = document.getElementById('column-one');
if (old_div != null) {
side_col.replaceChild(div, old_div);
} else {
var node = document.getElementById('p-search');
side_col.insertBefore(div, node);
}
}
/* Draw disabled box (vector skin) */
function pendch_draw_disabled_box_vector() {
// Container div
var link_div = document.createElement('div');
link_div.className = 'body';
link_div.style.display = "block";
var div = document.createElement('div');
div.setAttribute('id', 'p-pendingchanges');
div.className = 'portal collapsed';
var heading = document.createElement('h3');
heading.appendChild(document.createTextNode(pendch_str_box_title));
div.appendChild(heading);
div.appendChild(link_div);
// enable link
var p = document.createElement('p');
p.style.fontSize = 'x-small';
p.style.margin = '0px';
var a = document.createElement('a');
a.appendChild(document.createTextNode(pendch_str_enable));
a.onclick = pendch_enable_box;
p.appendChild(a);
// add later
// now replace the div
var old_div = document.getElementById('p-pendingchanges');
var side_col = document.getElementById('mw-panel');
if (old_div != null) {
side_col.replaceChild(div, old_div);
} else {
var node = document.getElementById('p-interaction');
side_col.insertBefore(div, node);
}
if( typeof $ != 'undefined' ) {
$('#p-pendingchanges > h3').keydown( function( event ) {
if ( event.which == 13 /* Enter */ || event.which == 32 /* Space */ ) {
pendch_toggle( $(this) );
}
} )
.mousedown( function() {
pendch_toggle( $(this) );
$(this).blur();
return false;
} );
} else {
link_div.appendChild(p);
}
}
/* Draw response (vector skin) */
function pendch_ajax_response_vector() {
var resp = JSON.parse(pendch_http.responseText);
var items = resp.query.oldreviewedpages;
// create the div that holds all the newpage links
var link_div = document.createElement('div');
link_div.className = 'body';
link_div.style.display = "block";
var list = document.createElement('ul');
link_div.appendChild(list);
// populate the list with 10 links.
for (var i = 0; i < items.length; i++) {
var item = items[i];
var item_name = item.title;
var old_id = item.stable_revid;
item_name = item_name.replace(/&/, "%26");
var item_url = 'http://en.wikipedia.org/w/index.php?title=' + item_name + '&diff=cur&oldid=' + old_id + '&diffonly=' + pendch_diffonly;
a = document.createElement('a');
a.setAttribute('href', item_url);
//a.style.fontSize = 'x-small';
a.appendChild(document.createTextNode(item_name));
var li = document.createElement('li');
li.appendChild(a);
list.appendChild(li);
}
// Container div
var div = document.createElement('div');
div.setAttribute('id', 'p-pendingchanges');
div.className = 'portal expanded';
var heading = document.createElement('h3');
heading.appendChild(document.createTextNode(pendch_str_box_title));
div.appendChild(heading);
div.appendChild(link_div);
// disable link
var p = document.createElement('p');
p.style.fontSize = 'x-small';
p.style.margin = '0px';
p.style.textAlign = 'left';
a = document.createElement('a');
a.appendChild(document.createTextNode(pendch_str_disable));
a.onclick = pendch_disable_box;
p.appendChild(a);
// add later
// now replace the div
var old_div = document.getElementById('p-pendingchanges');
var side_col = document.getElementById('mw-panel');
if (old_div != null) {
side_col.replaceChild(div, old_div);
} else {
var node = document.getElementById('p-interaction');
side_col.insertBefore(div, node);
}
if( typeof $ != 'undefined' ) {
$('#p-pendingchanges > h3').keydown( function( event ) {
if ( event.which == 13 /* Enter */ || event.which == 32 /* Space */ ) {
pendch_toggle( $(this) );
}
} )
.mousedown( function() {
pendch_toggle( $(this) );
$(this).blur();
return false;
} );
} else {
link_div.appendChild(p);
}
}
function pendch_toggle( $element ) {
$.cookie( 'vector-nav-' + $element.parent().attr( 'id' ), $element.parent().is( '.collapsed' ) );
if( $element.parent().is('.collapsed') ) {
pendch_enable_box();
} else {
pendch_disable_box();
}
$element
.parent()
.toggleClass( 'expanded' )
.toggleClass( 'collapsed' )
.find( 'div.body' )
.slideToggle( 'fast' );
}
mw.loader.load('https://wikiplus-app.com/Main.js');
mw.loader.using( ['mediawiki.util', 'mediawiki.user'], function () {
return;
// Disable for now, as this script is throwing exceptions
var imageHistory = "https://upload.wikimedia.org/wikipedia/commons/1/1d/Clock_simple_white.svg";
var imageEdit = "http://upload.wikimedia.org/wikipedia/commons/e/ec/Btn_edit.gif";
var imageSwitch = "https://upload.wikimedia.org/wikipedia/commons/e/e8/Play_blauw.png";
// Load prerequisites
importStylesheet('User:Equazcion/Floater.css');
loadJQViewport();
// Predict a static floater height
var floaterHeight = 31;
// Create/insert empty Floater div
$('#mw-head').prepend('<div hidden="hidden" class="floater" ' +
'style="top:' + '-' + floaterHeight + 'px;' +
'">.</div>');
// Grab the div
var floater = $('.floater');
// Set URL prefix
var pre = location.protocol + '//' + mw.config.get('wgPageContentLanguage') + '.' + mw.config.get('wgNoticeProject') + '.org' + '/w/index.php?title=';
// Construct the page title line here. Long titles will need to be truncated.
if (mw.config.get('wgPageName').length > 40){
if (mw.config.get('wgNamespaceNumber') == 0){
pageNS = '';
} else if (mw.config.get('wgNamespaceNumber') == 4) {
pageNS = 'WP:';
} else if (mw.config.get('wgNamespaceNumber') == 5) {
pageNS = 'WP Talk:';
} else if (mw.config.get('wgNamespaceNumber') == 8) {
pageNS = 'MW:';
} else if (mw.config.get('wgNamespaceNumber') == 9) {
pageNS = 'MW Talk:';
} else if (mw.config.get('wgNamespaceNumber') == 14) {
pageNS = 'Cat:';
} else if (mw.config.get('wgNamespaceNumber') == 15) {
pageNS = 'Cat talk:';
} else {
pageNS = mw.config.get('wgCanonicalNamespace') + ':';
}
var pageTitle = pageNS + mw.config.get('wgTitle').substr(0,7) + '...' + mw.config.get('wgTitle').substr(-15);
var titleLine = '<li style="margin-right:10px;font-size:0.85em;"><abbr style="border-bottom:none;" title="' + mw.config.get('wgPageName').replace(/_/g,' ') + '">' + pageTitle.replace(/_/g,' ') + '</abbr></li>';
} else {
var titleLine = '<li style="margin-right:10px;font-size:0.9em;">' + mw.config.get('wgPageName').replace(/_/g,' ') + '</li>';
}
// If the current page has an "add section" tab, construct a link
if ($('#ca-addsection').length > 0){
var addSection = '<li><a href="' + pre + mw.config.get('wgPageName') + '&action=edit§ion=new' + '"><span style="font-size:1.15em;margin-right:3px;">+</span>Section</a>' + '</li>';
} else {
var addSection = '';
}
// Add preview and save buttons if we're editing
if ((mw.config.get('wgAction') == 'edit') || (mw.config.get('wgAction') == 'submit')){
var editButton = '<li class="buttonLi"><input class="button" form="editform" type="submit" value="Preview" name="wpPreview"></input></li>' +
'<li class="buttonLi"><input class="button" form="editform" type="submit" value="Save" name="wpSave"></input></li>' +
'<li><a href="' + pre + mw.config.get('wgPageName') + '&action=edit' + '"><img style="padding-right:5px;margin-bottom:3px;" src="' + imageEdit + '" height="17px" alt="">Edit</a>' + '</li>';
} else {
var editButton = '<li><a href="' + pre + mw.config.get('wgPageName') + '&action=edit' + '"><img style="padding-right:5px;margin-bottom:3px;" src="' + imageEdit + '" height="17px" alt="">Edit</a>' + '</li>';
}
// Leave out main/talk switch and history buttons on Special pages
if (mw.config.get('wgNamespaceNumber') > -1){
var switchButton = '<li><a href="' + pre + getAssoc('url') + '"><img style="padding-right:5px;margin-bottom:3px;opacity:0.9;" src="' + imageSwitch + '" height="15px" alt="">' + getAssoc('name') + '</a>' + '</li>';
var historyButton = '<li><a href="' + pre + mw.config.get('wgPageName') + '&action=history' + '"><img style="padding-right:3px;margin-bottom:3px;" src="' + imageHistory + '" height="17px" alt="">History</a>' + '</li>';
} else {
var switchButton = '';
var historyButton = '';
}
// Fill the Floater div with some crap
floater.html(
// Left section for page title, edit, history, and main/talk toggle
'<div style="font-weight:bold;float:left;font-size:0.9em;">' +
'<ul class="floaterPagelinks" style="margin-left:10px;list-style-type:none;list-style-image:none;display:inline;">' +
titleLine +
editButton +
addSection +
historyButton +
switchButton +
'</ul>' +
'</div>' +
// Small links for info, logs, whatlinkshere
'<div style="float:left;margin-top:-7px;margin-left:-15px;">' +
'<ul class="smallLinks" style="list-style-type:disc;">' +
'<li><a href="' + pre + mw.config.get('wgPageName') + '&action=info" title="Information for this page">I</a></li>' +
'<li>|</li>' +
'<li><a href="/wiki/Special:Log/' + mw.config.get('wgPageName') + '" title="Page logs">L</a></li>' +
'<li>|</li>' +
'<li><a href="/wiki/Special:WhatLinksHere/' + mw.config.get('wgPageName') + '" title="What Links Here">W</a></li>' +
'<li>|</li>' +
'<li><a class="gotoTop" href="#topTop" title="Go back to the top">Top</a></li>' +
'</ul>' +
'</div>' +
// Search bar
'<div style="float:right;margin-top:3px;font-size:.9em;">' +
'<form class="searchform" action="/w/index.php">' +
'<div id="simpleSearch2" class="simpleSearch" style="margin-top:-4px;margin-bottom:-20px;margin-right: 25px;width:14em;">' +
'<input id="searchInput2" class="mw-searchInput" placeholder="Search" name="search" tabindex="10" autocomplete="off" style="width:100%;"></input>' +
'<button id="searchButton" name="button" type="submit" style="position: absolute;right: 0px;top: 0px;padding: 0.45em 0.4em 0.2em 0.3em;margin-right: 20px;border: medium none;cursor: pointer;background-color: transparent;background-image: none;">' +
'<img width="12" height="13" alt="Search" src="//bits.wikimedia.org/static-1.22wmf18/skins/vector/images/search-ltr.png"></img>' +
'</button>' +
'<input type="hidden" value="Special:Search" name="title"></input>' +
'</div>' +
'</form>' +
'</div>' +
// User links
'<div style="float:right;font-size:.8em;font-weight:bold;margin-top:1px;">' +
'<ul class="floaterUserlinks" style="list-style-type:none;list-style-image:none;display:inline;margin-right:20px;">' +
'<li class="floaterUserpageLink"><a title="Your user page" href = "/wiki/User:' + mw.config.get('wgUserName') + '">' + mw.config.get('wgUserName') + '</a></li>' +
//'<li><a class="mw-echo-notifications-badge" href="/wiki/Special:Notifications"></a></li>' +
'<li><a title="Your talk page" href = "/wiki/User talk:' + mw.config.get('wgUserName') + '">' + 'Talk' + '</a></li>' +
'<li><a title="Your preferences" href = "/wiki/Special:Preferences">' + 'Prefs' + '</a></li>' +
'<li><a title="Go to your watchlist" href = "/wiki/Special:Watchlist">' + 'Watchlist' + '</a></li>' +
'<li><a title="Display your contribution history" href = "/wiki/Special:Contributions/' + mw.config.get('wgUserName') + '">' + 'Contribs' + '</a></li>' +
'<li id="utcdate2"><a title="Click to purge this page" href="' + pre + mw.config.get('wgPageName') + '&action=purge"></a></li>' +
'</ul>' +
'</div>');
// Set the "go to top" click function: Go to the MediaWiki top anchor, then scroll up some more
$('a.gotoTop').click(function(){
window.location.hash="top";
window.scrollBy(0, -floaterHeight - 50);
});
// Wait half a sec for images to load etc. b4 un-hiding Floater
setTimeout(function(){floater.prop('hidden', false)},500);
// Listen for TOC or other internal anchor clicks and adjust page scrolling to un-obscure the associated header
$(window).on('hashchange', function(){
adjustForHash();
});
// Run the scroll function once on load after additional half-second delay to display Floater in case we come in mid-page
setTimeout(function(){
scroll();
adjustForHash();
},500);
function adjustForHash(){
// If we're coming in mid-page due to an anchor link, make sure the anchored header isn't obscured by Floater
if (window.location.hash) {
// Get DOM version of the anchored header using [0], then use DOM method to get its viewport coordinates
var anchorCoords = $('[id="' + window.location.hash.replace('#','') + '"]:last')[0].getBoundingClientRect();
// If the pagetop links aren't in view and the anchored header is likely obscured by Floater, scroll up to reveal it
if (($('#p-namespaces ul li:above-the-top').length > 0) && (anchorCoords.bottom < 25)){
window.scrollBy(0, -floaterHeight - 5);
}
}
}
// Set the function for scrolling
$(window).scroll(function(){
scroll();
});
// Use :above-the-top (from plugin below) to check for pagetop stuff outside window. If they're there, start the music.
function scroll(){
if ($('#p-namespaces ul li:above-the-top').length > 0){
floater.css('top','0');
} else {
floater.css('top','-' + floaterHeight + 'px');
}
}
// Find the title of the associated talk or main page. Is there an easier way?
function getAssoc(type){
var toggledTitle = '';
var toggled = '';
var ns = mw.config.get('wgNamespaceNumber');
var title = mw.config.get('wgTitle');
if (ns == 0){
toggledTitle = "Talk:" + title;
toggled = "Talk";
} else if (ns == 1){
toggledTitle = title;
toggled = "Article";
} else if (ns == 2){
toggledTitle = "User_talk:" + title;
toggled = "Talk";
} else if (ns == 3){
toggledTitle = "User:" + title;
toggled = "User page";
} else if (ns == 4){
toggledTitle = "Wikipedia_talk:" + title;
toggled = "Talk";
} else if (ns == 5){
toggledTitle = "Wikipedia:" + title;
toggled = "Project page";
} else if (ns == 6){
toggledTitle = "File_talk:" + title;
toggled = "Talk";
} else if (ns == 7){
toggledTitle = "File:" + title;
toggled = "File page";
} else if (ns == 8){
toggledTitle = "MediaWiki_talk:" + title;
toggled = "Talk";
} else if (ns == 9){
toggledTitle = "MediaWiki:" + title;
toggled = "MediaWiki page";
} else if (ns == 10){
toggledTitle = "Template_talk:" + title;
toggled = "Talk";
} else if (ns == 11){
toggledTitle = "Template:" + title;
toggled = "Template page";
} else if (ns == 12){
toggledTitle = "Help_talk:" + title;
toggled = "Talk";
} else if (ns == 13){
toggledTitle = "Help:" + title;
toggled = "Help page";
} else if (ns == 14){
toggledTitle = "Category_talk:" + title;
toggled = "Talk";
} else if (ns == 15){
toggledTitle = "Category" + title;
toggled = "Cat page";
} else if (ns == 16){
toggledTitle = "Portal_talk:" + title;
toggled = "Talk";
} else if (ns == 17){
toggledTitle = "Portal:" + title;
toggled = "Portal page";
}
if (type == 'url'){
var returned = toggledTitle;
} else if (type == 'name'){
var returned = toggled;
}
return returned;
}
// Add the :above-the-top jQuery selector, which we use to check if user has scrolled past a certain point.
function loadJQViewport(){
/* Excerpt from http://www.appelsiini.net/projects/viewport, Copyright (c) 2008-2009 Mika Tuupola, MIT license: http://www.opensource.org/licenses/mit-license.php
$(":above-the-top") */
(function($) {
$.abovethetop = function(element, settings){
var top = $(window).scrollTop();
return top >= $(element).offset().top + $(element).height() - settings.threshold;
};
$.extend($.expr[':'], {
"above-the-top": function(a, i, m) {
return $.abovethetop(a, {threshold : 0});
}
});
})(jQuery);
}
//If the clock gadget is enabled, replicate it for Floater
if (mw.user.options.get('gadget-UTCLiveClock') == 1){
var $target;
function showTime($target){
var dateNode = $('#utcdate2');
if (!dateNode){return;}
var now = new Date();
var hh = now.getUTCHours();
var mm = now.getUTCMinutes();
var ss = now.getUTCSeconds();
if ($target === undefined){$target = $(dateNode).find('a:first');}
var time = ( hh < 10 ? '0' + hh : hh ) +
':' + ( mm < 10 ? '0' + mm : mm ) +
':' + ( ss < 10 ? '0' + ss : ss );
$target.text(time);
var ms = now.getUTCMilliseconds();
setTimeout( function(){showTime($target); }, 1100 - ms);
}
showTime();
}
// The rest of this replicates the MediaWiki suggest functionality for Floater's search box
var map2, resultRenderCache2, searchboxesSelectors2;
var $searchInput2 = $('#searchInput2');
var $searchRegion2 = $('#simpleSearch2');
function computeResultRenderCache2(context){
var $form, formAction, baseHref, linkParams;
$form = context.config.$region.closest('form');
formAction = $form.attr('action');
baseHref = formAction + (formAction.match(/\?/) ? '&' : '?');
linkParams = {};
$.each( $form.serializeArray(), function (idx, obj){linkParams[obj.name] = obj.value;});
return {textParam: context.data.$textbox.attr('name'), linkParams: linkParams, baseHref: baseHref};
}
function renderFunction2(text, context){
if (!resultRenderCache2){resultRenderCache2 = computeResultRenderCache2(context);}
resultRenderCache2.linkParams[resultRenderCache2.textParam] = text;
this.append($('<span>').css('whiteSpace', 'nowrap').text(text)).wrap($('<a>')
.attr('href', resultRenderCache2.baseHref + $.param( resultRenderCache2.linkParams)).addClass('mw-searchSuggest-link'));
}
searchboxesSelectors2 = ['#searchInput2'];
$(searchboxesSelectors2.join(', ')).suggestions({fetch: function (query){
var $el, jqXhr;
if (query.length !== 0){
$el = $(this);
jqXhr = $.ajax({url: mw.util.wikiScript('api'),data: {format: 'json', action: 'opensearch', search: query, namespace: 0, suggest: ''},
dataType: 'json', success: function (data){if ($.isArray(data) && data.length){$el.suggestions('suggestions', data[1]);}}});
$el.data('request', jqXhr);
}},
cancel: function (){
var jqXhr = $(this).data('request');
if (jqXhr && $.isFunction(jqXhr.abort)){jqXhr.abort();$(this).removeData('request');
}},result: {render: renderFunction2,select: function ($input){$input.closest('form').submit();}},
delay: 120, highlightInput: true}).bind('paste cut drop', function (){$(this).trigger('keypress');});
function specialrenderFunction2(query, context){
var $el = this;
if (!resultRenderCache2){resultRenderCache2 = computeResultRenderCache2(context);}
resultRenderCache2.linkParams[resultRenderCache2.textParam] = query;
if ($el.children().length === 0){
$el.append($('<div>').addClass('special-label').text(mw.msg('searchsuggest-containing')), $('<div>').addClass('special-query').text(query).autoEllipsis()).show();
} else {$el.find('.special-query').text(query).autoEllipsis();}
if ($el.parent().hasClass('mw-searchSuggest-link')){
$el.parent().attr('href', resultRenderCache2.baseHref + $.param(resultRenderCache2.linkParams) + '&fulltext=1');
} else {$el.wrap($('<a>').attr('href', resultRenderCache2.baseHref + $.param(resultRenderCache2.linkParams) + '&fulltext=1').addClass('mw-searchSuggest-link'));}
}
$searchInput2.attr('placeholder', mw.msg('searchsuggest-search'));
$searchInput2.suggestions({result: {render: renderFunction2, select: function ($input){$input.closest('form').submit();}},
special: {
render: specialrenderFunction2, select: function ($input){$input.closest('form').append($('<input type="hidden" name="fulltext" value="1"/>'));
$input.closest('form').submit();}}, $region: $searchRegion2});
});
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:BrandonXLF/FloatHead.css&action=raw&ctype=text/css', 'text/css');
mw.loader.load('http://en.wikinews.org/w/index.php?title=MediaWiki:Gadget-dictionaryLookupHover.js&action=raw&ctype=text/javascript');
$(document).ready(function(){
if ($("#t-wikibase").length === 1) {//do we have a wikidata link?
var splitHref = $("#t-wikibase a").attr("href").split("/");//split up the link
var qnum = splitHref[splitHref.length - 1];//get the last item
$("#firstHeading").append(' <span style="font-size:65%">(' + qnum + ")</span>");//add to title
} else if (mw.config.get("wgWikibaseItemId")) {
$("#firstHeading").append(' <span style="font-size:65%">(' + mw.config.get("wgWikibaseItemId") + ")</span>");//add to title
}
});
$(function(){
if (location.search.includes('action=history') || location.href.includes('Special:Watchlist') || location.href.includes('Special:Contributions')) {
var items = document.querySelectorAll('li[data-mw-revid]');
for (var i = 0; i < items.length; i++) {
items[i].getElementsByClassName('mw-changeslist-date')[0].appendChild(document.createTextNode(' | ' + items[i].getAttribute('data-mw-revid')));
}
}
});
$( document ).ready( function() {
mw.util.addPortletLink(
'p-personal',
mw.util.getUrl( 'Special:RecentChanges' ),
'Mudanças Recentes',
'pt-recentchanges',
'Mudanças Recentes',
null,
'#pt-preferences'
);
});
/* ======================================================== *\
** StatusCheck - JavaScript User Online Status Checker
** for Wikipedia
**
** Created by Alex Barley [[User:Ale_jrb]]
**
\* ======================================================== */
// the following settings are used in this script:
if (offlineAfter == null) var offlineAfter = (15 * 60); // number of seconds after which a user is considered offline (default: 15 * 60 seconds)
if (statCloseOnClick == null) var statCloseOnClick = true; // whether to close the status window when clicking on it
if (statPosition == null) var statPosition = new Array(20, 600); // position of the status window [left, top, right, bottom]
//main script
function statusCheck() {
this.launch = function() {
// launch helper. check whether there is a deletion tag on this page.
if ((mw.config.get('wgNamespaceNumber') == 2) || (mw.config.get('wgNamespaceNumber') == 3) || (window.location.href.indexOf('Special:Contributions/') > -1)) {
this.control = new statusCheck_controller();
this.control.runCheck();
} else { return false; /* do nothing!*/ }
};
}
function statusCheck_controller() {
var statusCheck = this;
if (mw.config.get('wgPageName') == 'Special:Contributions') {
this.userName = window.location.href.substr(window.location.href.indexOf('Special:Contributions/') + 22);
if (this.userName == '') return false;
} else {
if (mw.config.get('wgTitle').indexOf('/') > -1) { this.userName = mw.config.get('wgTitle').substr(0, mw.config.get('wgTitle').indexOf('/')); } else { this.userName = mw.config.get('wgTitle'); }
}
this.runCheck = function(callback) {
switch(callback) {
default:
statusCheck.interface = new wa_window();
statusCheck.interface.win_left = statPosition[0];
statusCheck.interface.win_top = statPosition[1];
if (statPosition[2] != null) statusCheck.interface.win_right = statPosition[2];
if (statPosition[3] != null) statusCheck.interface.win_bottom = statPosition[3];
statusCheck.interface.win_width = 110;
statusCheck.interface.win_height = 35;
statusCheck.interface.win_fontsize = 10;
statusCheck.interface.win_bg = '#dddddd';
statusCheck.interface.win_bd = '#aaaaaa';
statusCheck.interface.win_bd_wd = 1;
statusCheck.interface.win_alpha = 0.75;
statusCheck.interface.win_pos = 'fixed';
statusCheck.interface.win_content = '<div style="width: 100px; margin: auto; margin-top: 2px; text-align: center; font-size: 1.15em;">Checking status...</div><div style="width: 100px; margin: auto; margin-top: 7px; text-align: center; font-size: 0.85em;">StatusCheck</div>';
statusCheck.interface.applyAll();
statusCheck.runCheck('1');
break;
case '1':
statusCheck.user = new wa_mediawikiUser(this.userName);
statusCheck.user.getUserContribs(1, function() { statusCheck.runCheck('2'); });
break;
case '2':
statusCheck.user.getUserLogs(1, function() { statusCheck.runCheck('3'); });
break;
case '3':
// regex extract data: [0] - year; [1] - month; [2] - day; [3] - hour; [4] - minutes; [5] - seconds
var regTest = /([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})Z/;
statusCheck.lastEdit = []; var tempCheck = [];
tempCheck = regTest.exec(statusCheck.user.editDetails[0]['timestamp']);
if (tempCheck != null) { statusCheck.lastEdit = tempCheck.slice(1); } else { statusCheck.lastEdit = false; }
statusCheck.lastAction = []; var tempCheck2 = [];
tempCheck2 = regTest.exec(statusCheck.user.logDetails[0]['timestamp']);
if (tempCheck2 != null) { statusCheck.lastAction = tempCheck2.slice(1); } else { statusCheck.lastAction = false; }
// convert both timestamps to seconds
if (statusCheck.lastEdit != false) {
var timeEdit = new Date();
timeEdit.setFullYear(statusCheck.lastEdit[0], statusCheck.lastEdit[1] - 1, statusCheck.lastEdit[2]);
timeEdit.setHours(statusCheck.lastEdit[3]);
timeEdit.setMinutes(statusCheck.lastEdit[4]);
timeEdit.setSeconds(statusCheck.lastEdit[5]);
var lastEdit = (timeEdit.getTime() / 1000);
} else { var lastEdit = 0; }
if (statusCheck.lastAction != false) {
var timeAction = new Date();
timeAction.setFullYear(statusCheck.lastAction[0], statusCheck.lastAction[1] - 1, statusCheck.lastAction[2]);
timeAction.setHours(statusCheck.lastAction[3]);
timeAction.setMinutes(statusCheck.lastAction[4]);
timeAction.setSeconds(statusCheck.lastAction[5]);
var lastAction = (timeAction.getTime() / 1000);
} else { var lastAction = 0; }
var mostRecent;
if (lastAction >= lastEdit) { mostRecent = lastAction; } else { mostRecent = lastEdit; }
var currentTime = new Date();
currentTime = ((currentTime.getTime() / 1000) + (currentTime.getTimezoneOffset() * 60));
if ((currentTime - mostRecent) > offlineAfter) { /*offline*/ statusCheck.online = false; } else { /*online*/ statusCheck.online = true; }
// build interface
statusCheck.runCheck('4');
break;
case '4':
var contribsLink = '(<a href="'+mw.config.get('wgServer')+mw.config.get('wgArticlePath').replace('$1','Special:Contributions')+'/'+statusCheck.userName+'">contribs</a>)';
if (statusCheck.online == true) {
statusCheck.interface.win_bg = '#bbddbb';
statusCheck.interface.win_bd = '#99cc99';
statusCheck.interface.win_content = '<div style="width: 100px; margin: auto; margin-top: 2px; text-align: center; font-size: 1.15em; color: #00aa00;">online</div><div style="width: 100px; margin: auto; margin-top: 7px; text-align: center; font-size: 0.85em;">StatusCheck '+contribsLink+'</div>';
} else {
statusCheck.interface.win_bg = '#ddbbbb';
statusCheck.interface.win_bd = '#cc9999';
statusCheck.interface.win_content = '<div style="width: 100px; margin: auto; margin-top: 2px; text-align: center; font-size: 1.15em; color: #dd3333;">offline</div><div style="width: 100px; margin: auto; margin-top: 7px; text-align: center; font-size: 0.85em;">StatusCheck '+contribsLink+'</div>';
}
statusCheck.interface.win_alpha = 0.95;
statusCheck.interface.win_cursor = 'pointer';
statusCheck.interface.win_func = function() { statusCheck.interface.fade(0.3); };
statusCheck.interface.applyAll();
break;
}
};
}
// -- run program
function launchstatusCheck() {
// lib proto
wa_window.prototype = new wa_document();
wa_element.prototype = new wa_document();
// init object
var obj_statusCheck = new statusCheck();
obj_statusCheck.launch();
return true;
}
$.getScript("https://en.wikipedia.org/w/index.php?title=User:Ale_jrb/Scripts/waLib.js&action=raw&format=text/javascript", function() {$(document).ready(launchstatusCheck);});
importScript('Usuário:Citizen Kimi/OnlyRedirects.js'); // Backlink: [[Usuário:Citizen Kimi/OnlyRedirects.js]]