RuneScape Wiki
RuneScape Wiki
4 924
páginas
(Removing some code, may be breaking the editor)
Linha 84: Linha 84:
 
$(function(){
 
$(function(){
 
$('#bodyContent .wikia-gallery-add a').unbind('click').click(function(){return false;});
 
$('#bodyContent .wikia-gallery-add a').unbind('click').click(function(){return false;});
});
 
 
/*************************/
 
/* sliders usando jquery */
 
/*************************/
 
//wsl.loadScript("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js");
 
wsl.loadScript("http://pt.runescape.wikia.com/wiki/MediaWiki:Jquery-ui.min.js&action=raw&ctype=text/javascript");
 
 
 
$(document).ready(function() {
 
var $tabs = $("#portal_slider").tabs({ fx: {opacity:'toggle', duration:100} } );
 
$("[class^=portal_sliderlink]").click(function() { // bind click event to link
 
$tabs.tabs('select', this.className.replace("portal_sliderlink_", ""));
 
return false;
 
});
 
$('#portal_next').click(function() {
 
$tabs.tabs('select', ($tabs.tabs('option', 'selected') == ($tabs.tabs('length'))-1) ? 0 : $tabs.tabs('option', 'selected') + 1 ); // switch to next tab
 
return false;
 
});
 
$('#portal_prev').click(function() { // bind click event to link
 
$tabs.tabs('select', ($tabs.tabs('option', 'selected') == 0) ? ($tabs.tabs('length')-1) : $tabs.tabs('option', 'selected') - 1 ); // switch to previous tab
 
return false;
 
});
 
 
});
 
});
   

Revisão das 16h03min de 10 de outubro de 2011

/* Código Javascript colocado aqui será carregado para todos os utilizadores em cada carregamento de página. */
/* <pre> */

/*** Funções para acessar o Cookie ***/
function setCookie(name, value, expires) {
	var d = new Date();
	d.setDate(d.getDate() + expires);
	document.cookie = name + '=' + escape(value) + ';path=/';
}
 
function getCookie(name) {
	if (document.cookie.length > 0) {
		var start = document.cookie.indexOf(name + '=');
		if (start != -1) { 
			start = start + name.length + 1; 
			var end = document.cookie.indexOf(';', start);
			if (end == -1) {
				end = document.cookie.length;
			}
			return unescape(document.cookie.substring(start, end));
		} 
	}
	return '';
}

/************ Testa se um elemento tem uma certa classe ************/
/* Usa expressões regulares e a cache para uma melhor performance.  */
/*******************************************************************/
 
var hasClass = (function () {
    var reCache = {};
    return function (element, className) {
        return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
    };
})();

var autoCollapse = 2;
var collapseCaption = "esconder";
var expandCaption = "mostrar";

/* Collapsible Tables */
importScript('MediaWiki:Common.js/collapsibletables.js');

/* IRC nas páginas */
importScript('MediaWiki:Common.js/embedirc.js‎');

/* Intro for Exchange Namespace */
importScript('MediaWiki:Common.js/exchangeintro.js');
 
/* Intro for Update Namespace */
importScript('MediaWiki:Common.js/updateintro.js');

/* Standard Edit Summaries */
importScript('MediaWiki:Common.js/standardeditsummaries.js');

/* Adiciona um relógio (UTC) sobre os artigos */
importScript('MediaWiki:Common.js/displayTimer.js');

/* Propaganda ao Chat */
importScript('MediaWiki:Common.js/chat.js');

/* Ajax Auto-Refresh */
var ajaxPages = ["Forum:Fórum_Geral", "Especial:NewFiles", "Especial:WikiActivity"];
 
var AjaxRCRefreshText = 'Atualizar automaticamente';
importScript('MediaWiki:Common.js/ajaxrefresh.js');
 
/* Count-down Timer */
importScript('MediaWiki:Common.js/countdowntimer.js');

/* Remove itens desnecessários na Wikia Game Guides */
importScript('MediaWiki:Wikiaapp.js');
 
/* Add MyContributions to AccountNavigation */
importScript('MediaWiki:Common.js/accountNavigation.js‎');

/* HighlightTables */
importScript('MediaWiki:Common.js/highlightTable.js');

/* GEMW updating interface on exchange pages and item infoboxes */
importScript('Utilizador:SandroHc/gemwupdate.js');

/* Desabilita o botão para adicionar imagens a uma galeria existente */
$(function(){
	$('#bodyContent .wikia-gallery-add a').unbind('click').click(function(){return false;});
});

 
// ==================================================================
// Dynamic Templates
// ==================================================================
$(function() {
	if ($('#WikiaArticle pre.jcConfig,#bodyContent pre.jcConfig').size() > 0) {
		importScript('MediaWiki:Common.js/calc.js');
		importStylesheet('MediaWiki:Common.css/calc.css');
	}
});
 
// ==================================================================
// Insert username 
// ==================================================================
$(function() {
    if(typeof(disableUsernameReplace) != 'undefined' && disableUsernameReplace || wgUserName == null) return;
    $("span.insertusername").text(wgUserName);
});
 
// ==================================================================
// Hide Auto-uploads
// ==================================================================
if (wgCanonicalNamespace == "Especial" && wgCanonicalSpecialPageName == "Log") {
    importScript('Utilizador:SandroHc/HideBotUploads.js');
}
 
// ==================================================================
// Description: Redirects from /User:UserName/skin.js or .css to the user's actual skin page
// ==================================================================
if (wgArticleId == 0 && wgUserName) {
	var slash = wgPageName.indexOf('/');
	var norm = wgPageName.substr(0, slash) + wgPageName.substr(slash).toLowerCase();
	var test = 'User:' + wgUserName.replace(/ /g, '_') + '/skin.';
	var ext = null;
	if (norm == test + 'js') ext = 'js';
	else if (norm == test + 'css') ext = 'css';
	if (ext != null) window.location.href = window.location.href.replace(/\/skin.(css|js)/i, '/' + skin.replace('oasis', 'wikia') + '.' + ext);
}
 
// ==================================================================
// Description: Adds row highlighting to various wiki-tables.
// ==================================================================
 
$(document).ready(function() {
	var lightCookieLen = 20;
	var lightCookie = getCookie('lightTable').split('');
 
	function HighlightRow(el, val) {
		var cssText = '';
		if (val == '2') {
			cssText = 'background-color: #CCC !important';
		} else if (val == '1') {
			cssText = 'background-color: #CFC !important';
		}
		$(el).children('td').css('cssText', cssText);
	}
 
	function save() {
		setCookie('lightTable', lightCookie.join(''), 60 * 60 * 24 * 7);
	}
 
	if ( wgCanonicalNamespace == 0 ) {
		while (lightCookie.length < lightCookieLen) {
			lightCookie.push('0');
		}
 
		$('#lighttable tr').each(function(i) {
			HighlightRow(this, lightCookie[i]);
 
			$(this).mouseover(function() {
				HighlightRow(this, 2);
			}).mouseout(function() {
				HighlightRow(this, lightCookie[i]);
			}).click(function() {
				lightCookie[i] = 1 - lightCookie[i];
				HighlightRow(this, lightCookie[i]);
				save();
			});
		});
 
		$('#lighttable').append(  //TODO: Apply to each table on page
			$('<tr />').append(
				$('<th />').attr('colspan', '7').append(
					$('<input />').attr('type', 'button').val('Resetar').click(function() {
						$('#lighttable tr').each(function(i) {
							lightCookie[i] = '0';
							HighlightRow(this, lightCookie[i]);
						});
						save();
					})
				)
			)
		);
	}
});
 
/* </pre> */