[Tutorial] Mostrar "ir para a pagina X do tópico" no indice
Página 1 de 1 • Compartilhe
Informações:
Autor: JScript
Funcionalidade: Todas as Versões
Acesse:
E crie um novo Javascript em investimento no indice com esse código:Painel de Controle ☛ Módulos ☛ HTML & Javascript ☛ Gestão dos códigos Javascript
- Código:
/***
* Application: showPages.js
* Description:
* Version: 0.03122015-jq1.9.1
* RC1 (Release candidate 1!)
* Author: JScript - 2015/03/12
* Copyright (c) 2015 JScript <jscriptbrasil at live dot com>
* This work is free. You can redistribute it and/or modify it
* under the terms of the WTFPL, Version 2
*/
var showPages = {
autor: "JScript",
Application: "showPages.js",
version: "0.03122015-jq1.9.1",
codename: "FIB",
goToPage: "Go to page",
postsPerPage: 10,
temp: '',
phpBB2: '',
phpBB3: '',
punbb: '',
invision: '',
initialize: function() {
jQuery(function() {
showPages.add();
});
},
add: function() {
var oTarget = $('.last-post-icon'),
aFound, oAppend,
phpBB2 = '<span class="gensmall showpages" style="float: right;">[ <img title="' + showPages.goToPage + '" alt="' + showPages.goToPage + '" src="http://2img.net/i/fa/empty.gif" class="sprite-icon_minipost">' + showPages.goToPage + ': ';
for (var i = 0, len = oTarget.length; i < len; i++) {
aFound = /(\/t[0-9]+)p([0-9]+)-/.exec(oTarget[i]);
if (aFound) { //Versions: |All---| |phpbb2----| |phpbb3----| |PunBB--| |Invision---|
oAppend = $(oTarget[i]).closest('tr, dl').find('td.row1.over, td.tcl:eq(0), dd:eq(0), td.row2.icon');
showPages.temp = phpBB2 + '<a href="' + aFound[1] + '-">1</a>, ';
var jlen = aFound[2] / showPages.postsPerPage;
if (jlen > 3) {
showPages.temp += '<a href="' + aFound[1] + 'p' + showPages.postsPerPage + '-">2</a>, ... ' +
'<a href="' + aFound[1] + 'p' + (aFound[2] - showPages.postsPerPage) + '-">' + jlen + '</a>, ' +
'<a href="' + aFound[1] + 'p' + aFound[2] + '-">' + (jlen + 1) + '</a>, ';
} else {
for (var j = 0; j < jlen; j++) {
showPages.temp += '<a href="' + aFound[1] + 'p' + ((j + 1) * showPages.postsPerPage) + '-">' + (j + 2) + '</a>, ';
}
}
showPages.temp = showPages.temp.slice(0, -2) + ' ]</span>';
oAppend.append(showPages.temp);
}
};
}
};
showPages.initialize();
Resultado:
Tópicos semelhantes
Cria uma conta ou logue para postar uma mensagem.
Você precisa ser um membro, para poder postar uma resposta.
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
|
|