IDDQD (обсуждение | вклад) (у Скобки ник специфичный...) |
IDDQD (обсуждение | вклад) мНет описания правки |
||
Строка 484: | Строка 484: | ||
var rights = {}; |
var rights = {}; |
||
rights["IDDQD"] = ["БЫДЛОКРАТ"]; |
rights["IDDQD"] = ["БЫДЛОКРАТ"]; |
||
− | rights["Retard-"] = [" |
+ | rights["Retard-"] = ["ШКОЛЬНИК"]; |
rights["AbraCadavre"] = ["САЛОЕД"]; |
rights["AbraCadavre"] = ["САЛОЕД"]; |
||
rights["Женя=)"] = ["СКОБОЧКА"]; |
rights["Женя=)"] = ["СКОБОЧКА"]; |
Версия от 16:28, 25 ноября 2013
var autoCollapse = 2;
var collapseCaption = "скрыть";
var expandCaption = "показать";
function collapseTable( tableIndex )
{
var Button = document.getElementById( "collapseButton" + tableIndex );
var Table = document.getElementById( "collapsibleTable" + tableIndex );
if ( !Table || !Button ) {
return false;
}
var Rows = Table.rows;
if ( Button.firstChild.data == collapseCaption ) {
for ( var i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = "none";
}
Button.firstChild.data = expandCaption;
} else {
for ( var i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = Rows[0].style.display;
}
Button.firstChild.data = collapseCaption;
}
}
function createCollapseButtons()
{
var tableIndex = 0;
var NavigationBoxes = new Object();
var Tables = document.getElementsByTagName( "table" );
for ( var i = 0; i < Tables.length; i++ ) {
if ( hasClass( Tables[i], "collapsible" ) ) {
/* only add button and increment count if there is a header row to work with */
var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0];
if (!HeaderRow) continue;
var Header = HeaderRow.getElementsByTagName( "th" )[0];
if (!Header) continue;
NavigationBoxes[ tableIndex ] = Tables[i];
Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );
var Button = document.createElement( "span" );
var ButtonLink = document.createElement( "a" );
var ButtonText = document.createTextNode( collapseCaption );
Button.className = "collapseButton"; //Styles are declared in Common.css
ButtonLink.style.color = Header.style.color;
ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
ButtonLink.appendChild( ButtonText );
Button.appendChild( document.createTextNode( "[" ) );
Button.appendChild( ButtonLink );
Button.appendChild( document.createTextNode( "]" ) );
Header.insertBefore( Button, Header.childNodes[0] );
tableIndex++;
}
}
for ( var i = 0; i < tableIndex; i++ ) {
if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
collapseTable( i );
}
}
}
addOnloadHook( createCollapseButtons );
/** Test if an element has a certain class **************************************
*
* Description: Uses regular expressions and caching for better performance.
* Maintainers: User:Mike Dillon, User:R. Koot, User:SG
*/
var hasClass = (function () {
var reCache = {};
return function (element, className) {
return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
};
})();
// *****************************************************
// * Experimental javascript countdown timer (Splarka) *
// * Version 0.0.3 *
// *****************************************************
//
// Usage example:
// <span class="countdown" style="display:none;">
// Only <span class="countdowndate">January 01 2007 00:00:00 PST</span> until New years.
// </span>
// <span class="nocountdown">Javascript disabled.</span>
function updatetimer(i) {
var now = new Date();
var then = timers[i].eventdate;
var diff = count=Math.floor((then.getTime()-now.getTime())/1000);
// catch bad date strings
if(isNaN(diff)) {
timers[i].firstChild.nodeValue = '** ' + timers[i].eventdate + ' **' ;
return;
}
// determine plus/minus
if(diff<0) {
diff = -diff;
var tpm = '';''
} else {
var tpm = '';''
}
// Calculate the diff - Modified by Eladkse
if ((diff%60) == 1) {
left = (diff%60) + ' секунды';
} else {
left = (diff%60) + ' секунда';
}
diff=Math.floor(diff/60);
if(diff > 0) {
if ((diff%60) == 1) {
left = (diff%60) + ' минута, и ' + left;
} else {
left = (diff%60) + ' минут, и ' + left;
}
}
diff=Math.floor(diff/60);
if(diff > 0) {
if ((diff%24) == 1) {
left = (diff%24) + ' час, ' + left;
} else {
left = (diff%24) + ' часов, ' + left;
}
}
diff=Math.floor(diff/24);
if(diff > 0) {
if (diff == 1) {
left = diff + ' день, ' + left;
} else {
left = diff + ' дней, ' + left;
}
}
timers[i].firstChild.nodeValue = tpm + left;
// a setInterval() is more efficient, but calling setTimeout()
// makes errors break the script rather than infinitely recurse
timeouts[i] = setTimeout('updatetimer(' + i + ')',1000);
}
function checktimers() {
//hide 'nocountdown' and show 'countdown'
var nocountdowns = getElementsByClassName(document, 'span', 'nocountdown');
for(var i in nocountdowns) nocountdowns[i].style.display = 'none'
var countdowns = getElementsByClassName(document, 'span', 'countdown');
for(var i in countdowns) countdowns[i].style.display = 'inline'
//set up global objects timers and timeouts.
timers = getElementsByClassName(document, 'span', 'countdowndate'); //global
timeouts = new Array(); // generic holder for the timeouts, global
if(timers.length == 0) return;
for(var i in timers) {
timers[i].eventdate = new Date(timers[i].firstChild.nodeValue);
updatetimer(i); //start it up
}
}
addOnloadHook(checktimers);
// **************************************************
// - end - Experimental javascript countdown timer
// **************************************************
//A script that adds a "Back To Top" option in the footer of the Oasis theme.
//I don't like scrolling back to top on long pages neither do you :)
//
function hideFade () {
// hide #backtotop first
$( "#backtotop" ).hide ();
// fade in #backtotop
$( function () {
$( window ).scroll( function () {
if ( $( this ).scrollTop () > ButtonStart ) {
$( '#backtotop' ).fadeIn ();
} else {
$( '#backtotop' ).fadeOut ();
}
});
});
}
//A script that adds a "Back To Top" option in the footer of the Oasis theme.
//Created by Noemon from Dead Space Wiki, translate from ru.elderscrolls.wikia
function hideFade () {
// hide #backtotop first
$( "#backtotop" ).hide ();
// fade in #backtotop
$( function () {
$( window ).scroll( function () {
if ( $( this ).scrollTop () > ButtonStart ) {
$( '#backtotop' ).fadeIn ();
} else {
$( '#backtotop' ).fadeOut ();
}
});
});
}
function goToTop (){
// scroll body to 0px on click
$( 'body,html' ).animate ({
scrollTop: 0
}, ScrollSpeed );
return false;
}
function addBackToTop () {
if( skin == 'oasis' ) {
$('<li id="backtotop" style="position: absolute; right:20px; top:0px; border:none;"><button type="button" value="Наверх" onClick="goToTop();">Наверх</button></li>').appendTo('#WikiaBarWrapper .toolbar > .tools');
hideFade ();
}
}
var ButtonStart = 800;
var ScrollSpeed = 600;
if( !window.BackToTop ) {
$( document ).ready( function () {
addBackToTop ();
});
}
var BackToTop = true; // prevent duplication
// ============================================================
// BEGIN AjaxRC
// ============================================================
/* ######################################################################## */
/* ### AJAX RC ### */
/* ### ---------------------------------------------------------------- ### */
/* ### Description: Automatically refresh "Recent changes" via AJAX ### */
/* ### Credit: User:pcj (http://www.wowpedia.org) ### */
/* ### Maintenance, cleanup, style and bug fixes by Grunny ### */
/* ### (http://community.wikia.com/wiki/User:Grunny) ### */
/* ######################################################################## */
var ajaxIndicator = 'http://images.wikia.com/dev/images/8/82/Facebook_throbber.gif',
ajaxTimer,
ajaxRefresh = 60000,
refreshText = 'Авто-Обновление',
refreshHover = 'Включить авто-обновление страницы',
doRefresh = true;
if ( !window.ajaxPages ) {
var ajaxPages = new Array ("Служебная:RecentChanges", "Служебная:WikiActivity", "Служебная:NewFiles");
}
if ( !window.ajaxCallAgain ) {
var ajaxCallAgain = [];
}
if( typeof AjaxRCRefreshText == "string" ) {
refreshText = AjaxRCRefreshText;
}
if( typeof AjaxRCRefreshHoverText == "string" ) {
refreshHover = AjaxRCRefreshHoverText;
}
/**
* Sets the cookie
* @param c_name string Name of the cookie
* @param value string 'on' or 'off'
* @param expiredays integer Expiry time of the cookie in days
*/
function setCookie( c_name, value, expiredays ) {
var exdate = new Date();
exdate.setDate( exdate.getDate() + expiredays);
document.cookie = c_name + "=" + escape(value) + ( ( expiredays === null ) ? "" : ";expires=" + exdate.toGMTString() );
}
/**
* Gets the cookie
* @param c_name string Cookie name
* @return The cookie name or empty string
*/
function getCookie( c_name ) {
if ( document.cookie.length > 0 ) {
var c_start = document.cookie.indexOf( c_name + "=" )
if ( c_start !== -1 ) {
c_start = c_start + c_name.length + 1;
var c_end = document.cookie.indexOf( ";", c_start );
if ( c_end === -1 ) {
c_end = document.cookie.length;
}
return unescape( document.cookie.substring( c_start, c_end ) );
}
}
return "";
}
/**
* Main function to start the Auto-refresh process
*/
function preloadAJAXRL() {
var ajaxRLCookie = (getCookie("ajaxload-" + wgPageName) == "on") ? true : false;
var appTo = ($('#WikiaPageHeader').length ) ? $('#WikiaPageHeader > h1') : $('.firstHeading');
appTo.append(' <span style="font-size: xx-small; line-height: 100%;" id="ajaxRefresh"><span style="border-bottom: 1px dotted; cursor: help;" id="ajaxToggleText" title="' + refreshHover + '">' + refreshText + ':</span><input type="checkbox" style="margin-bottom: 0;" id="ajaxToggle"><span style="display: none;" id="ajaxLoadProgress"><img src="' + ajaxIndicator + '" style="vertical-align: baseline;" border="0" alt="Refreshing page" /></span></span>');
$('#ajaxLoadProgress').ajaxSend(function(event, xhr, settings) {
if (location.href == settings.url) {
$(this).show();
}
} ).ajaxComplete(function(event, xhr, settings) {
if (location.href == settings.url) {
$(this).hide();
for(i in ajaxCallAgain) {
ajaxCallAgain[i]();
}
}
} );
$('#ajaxToggle').click(toggleAjaxReload).attr('checked', ajaxRLCookie);
if (getCookie("ajaxload-" + wgPageName) == "on") {
loadPageData();
}
}
/**
* Turn refresh on and off by toggling the checkbox
*/
function toggleAjaxReload() {
if ( $( '#ajaxToggle' ).prop( 'checked' ) == true ) {
setCookie( "ajaxload-" + wgPageName, "on", 30 );
doRefresh = true;
loadPageData();
} else {
setCookie( "ajaxload-" + wgPageName, "off", 30 );
doRefresh = false;
clearTimeout( ajaxTimer );
}
}
/**
* Does the actual refresh
*/
function loadPageData() {
var cC = ( $( '#WikiaArticle' ).length ) ? '#WikiaArticle' : '#bodyContent';
$( cC ).load( location.href + " " + cC, function ( data ) {
if ( doRefresh ) {
ajaxTimer = setTimeout( "loadPageData();", ajaxRefresh );
}
} );
}
/**
* Load the script on specific pages
*/
$( function () {
for ( x in ajaxPages ) {
if ( wgPageName == ajaxPages[x] && $( '#ajaxToggle' ).length === 0 ) {
preloadAJAXRL();
}
}
} );
/* ######################################################################## */
/* ######################################################################## */
function infoboxToggle() {
var page = window.pageName.replace(/\W/g, '_');
var nowShown;
if(document.getElementById('infoboxtoggle').innerHTML == '[Hide]') {
document.getElementById('infoboxinternal').style.display = 'none';
document.getElementById('infoboxtoggle').innerHTML = '[Show]';
nowShown = false;
} else {
document.getElementById('infoboxinternal').style.display = 'block';
document.getElementById('infoboxtoggle').innerHTML = '[Hide]';
nowShown = true;
}
if(window.storagePresent) {
var storage = globalStorage[window.location.hostname];
storage.setItem('infoboxshow-' + page, nowShown);
}
}
/**
* jQuery version of fillEditSummaries
* @author Grunny
*/
function fillEditSummaries() {
if( !$( '#wpSummaryLabel' ).length ) {
return;
}
var summaryOptionsHtml = '',
$summaryOptionsList;
$.get( wgScript, { title: 'Template:Stdsummaries', action: 'raw', ctype: 'text/plain' }, function( data ) {
var lines = data.split( '\n' );
for( var i = 0; i < lines.length; i++ ) {
var value = ( lines[i].indexOf( '-- ' ) === 0 ) ? lines[i].substring(3) : "";
summaryOptionsHtml += '<option value="' + value + '">' + lines[i] + '</option>';
}
$summaryOptionsList = $( '<select />' ).attr( 'id', 'stdEditSummaries' ).html( summaryOptionsHtml ).change( function() {
var value = $( this ).val();
if ( value !== '' ) {
if( skin === 'oasis' ) {
$( '#wpSummary' ).text( value );
} else {
$( '#wpSummary' ).val( value );
}
}
} );
$( '#wpSummaryLabel' ).prepend( 'Standard summaries: ', $summaryOptionsList, '<br />' );
} );
}
/**
* jQuery version of fillPreloads
* @author Grunny
*/
function fillPreloads() {
if( !$( '#lf-preload' ).length ) {
return;
}
var preloadOptionsHtml = '',
$preloadOptionsList;
$( '#lf-preload' ).attr( 'style', 'display: block' );
$.get( wgScript, { title: 'Template:Stdpreloads', action: 'raw', ctype: 'text/plain' }, function( data ) {
var lines = data.split( '\n' );
for( var i = 0; i < lines.length; i++ ) {
var value = ( lines[i].indexOf( '-- ' ) === 0 ) ? lines[i].substring(3) : "";
preloadOptionsHtml += '<option value="' + value + '">' + lines[i] + '</option>';
}
$preloadOptionsList = $( '<select />' ).attr( 'id', 'stdSummaries' ).html( preloadOptionsHtml ).change( function() {
var value = $( this ).val();
if ( value !== '' ) {
value = 'Template:' + value + '/preload';
value = value.replace( ' ', '_' );
$.get( wgScript, { title: value, action: 'raw', ctype: 'text/plain' }, function( data ) {
insertAtCursor( document.getElementById( 'wpTextbox1' ), data );
} );
}
} );
$( '#lf-preload-cbox' ).html( $preloadOptionsList );
} );
$( '#lf-preload-pagename' ).html( '<input type="text" class="textbox" />' );
$( '#lf-preload-button' ).html( '<input type="button" class="button" value="Insert" onclick="doCustomPreload()" />' );
}
function doCustomPreload() {
var value = $( '#lf-preload-pagename > input' ).val();
value = value.replace( ' ', '_' );
$.get( wgScript, { title: value, action: 'raw', ctype: 'text/plain' }, function( data ) {
insertAtCursor( document.getElementById( 'wpTextbox1' ), data );
} );
}
// ============================================================
// END AjaxRC
// ============================================================
// Код написан: Rappy_4187 для англовики.
// Только видимый скрипт, статусов он не даёт
$(function() {
var rights = {};
rights["IDDQD"] = ["БЫДЛОКРАТ"];
rights["Retard-"] = ["ШКОЛЬНИК"];
rights["AbraCadavre"] = ["САЛОЕД"];
rights["Женя=)"] = ["СКОБОЧКА"];
if (typeof rights[wgTitle] != "undefined") {
// убираем старые права
$('.UserProfileMasthead .masthead-info span.tag').remove();
for( var i=0, len=rights[wgTitle].length; i < len; i++) {
// добавляем новые
$('<span class="tag">' + rights[wgTitle][i] +
'</span>').appendTo('.masthead-info hgroup');
}
}
});
/*Неактивные пользователи*/
//Inactive users
InactiveUsers = {
months: 3,
text: 'НЕАКТИВЕН'
};
importScriptPage('InactiveUsers/code.js', 'dev');