[Tutorial] Mostrar "ir para a pagina X do tópico" no indice

Ver o tópico anterior Ver o tópico seguinte Ir para baixo

Admin
Admin
Administrador
Tempo Online : 250d 6h 21m 59s
Mensagens : 693
Reputação : 4
https://bestweb.forumeiro.com

MensagemAdmin Seg Out 03, 2016 8:28 pm

Informações:
Autor
: JScript
Funcionalidade: Todas as Versões




Acesse:
Painel de Controle Módulos HTML & Javascript Gestão dos códigos Javascript
E crie um novo Javascript em investimento no indice com esse código:

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:

[Tutorial] Mostrar "ir para a pagina X do tópico" no indice Js20LeB

Ver o tópico anterior Ver o tópico seguinte Ir para o topo

Cria uma conta ou logue para postar uma mensagem.

Você precisa ser um membro, para poder postar uma resposta.

Criar conta

Participe de nossa comunidade, basta se registrar. É Fácil!


Criar uma conta

Logar

Já tem uma conta? Sem problemas, Logue agora.


Logar-se

 
Permissões neste sub-fórum
Não podes responder a tópicos