Widget Últimos Assuntos

3 participantes

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

Tópico resolvido Widget Últimos Assuntos

Mensagem por d3vinn 07.01.18 22:12

Detalhes da questão


Endereço do fórum: http://planetaspfc.forumeiros.com/
Versão do fórum: ModernBB

Descrição


Boa noite!

Gostaria de saber se é possível colocar o widget "últimos assuntos" entre o cabeçalho e os fóruns, como no print: https://imgur.com/a/VFTub

Tentei fazer no painel de controle, na parte de widgets, porém só é possível colocar nos lados.

O tópico mais parecido que achei foi esse abaixo, mas não me ajudou.

https://ajuda.forumeiros.com/t111067-widget-ultimos-assuntos

Agradeço desde já!
d3vinn

d3vinn
Novo Membro

Membro desde : 06/01/2018
Mensagens : 5
Pontos : 9

http://planetaspfc.forumeiros.com/

Ir para o topo Ir para baixo

Tópico resolvido Re: Widget Últimos Assuntos

Mensagem por Harleen 08.01.18 2:24

Olá d3vinn Welcome FdF , use o esse addon.
Seta https://ajuda.forumeiros.com/t100061-

Veja também esse tópico se o resultado lhe agrada.
https://ajuda.forumeiros.com/t107984-ultimos-assuntos-com-numero-de-respostas-e-botao-scroll#756388

Até mais
Harleen

Harleen
Super Membro

Membro desde : 09/07/2012
Mensagens : 1779
Pontos : 2373

https://antenadogames.forumeiros.com/

Ir para o topo Ir para baixo

Tópico resolvido Re: Widget Últimos Assuntos

Mensagem por d3vinn 08.01.18 2:48

Harleen escreveu:Olá d3vinn Welcome FdF , use o esse addon.
Seta https://ajuda.forumeiros.com/t100061-

Veja também esse tópico se o resultado lhe agrada.
https://ajuda.forumeiros.com/t107984-ultimos-assuntos-com-numero-de-respostas-e-botao-scroll#756388

Até mais

Funcionou, porém agora ficam 2 widgets, seria possível remover o da esquerda? No menu "Gestão dos widgets do fórum", se eu deixar a largura da coluna "0", o widget inserido no JS também some. Alguma outra saída?

Widget Últimos Assuntos 110
d3vinn

d3vinn
Novo Membro

Membro desde : 06/01/2018
Mensagens : 5
Pontos : 9

http://planetaspfc.forumeiros.com/

Ir para o topo Ir para baixo

Tópico resolvido Re: Widget Últimos Assuntos

Mensagem por Harleen 08.01.18 3:21

Experimente esse código
Código:
$(function() {
    $('head').append(
    '<style type="text/css">' +
    '.recentTopics .main-content {' +
    '  font-family: helvetica, arial, sans-serif !important;' +
    '  line-height: 15px;' +
    '  padding: 0;' +
    '}' +
    '.recentTopics ul {' +
    '  padding-left: 0 !important;' +
    '}' +
    '.mini_photo {' +
    '  margin-right: 5px;' +
    '}' +
    'li.recentPost {' +
    '  min-height: 50px;' +
    '  padding: 1em 1em 0.5em 1em;' +
    '  list-style-type: none;' +
    '  border-bottom: 1px solid #f3f3f3;' +
    '}' +
    '.recentPost a[href^="/t"] {' +
    '  font-size: 14px;' +
    '  text-decoration: none;' +
    '  font-weight: bold;' +
    '}' +
    '.recentInline {' +
    '  min-width: 30%;' +
    '  font-size: 12px;' +
    '  float: right;' +
    '}' +
    '.small_links {' +
    '  display: table;' +
    '  margin-top: 10px;' +
    '}' +
    '.local {' +
    '  font-size: 0;' +
    '}' +
    '.local a:after {' +
    '  content: " → ";' +
    '}' +
    '.local a:last-child:after {' +
    '  content: "";' +
    '}' +
    '.small_links, .small_links a {' +
    '  color: #a4a4a4 !important;' +
    '  font-size: 12px !important;' +
    '  text-decoration: none !important;' +
    '}' +
    '.creator_post:before {' +
    '  content: "Tópico iniciado por ";' +
    '}' +
    '.creator_post:after {' +
    '  content: ", Em: ";' +
    '}' +
    '.recentTopics {' +
    '  margin: 15px 0;' +
    '}' +
    '</style>'
    );
   
    var jModuleRecentPosts = $('.module:contains("Últimos assuntos")');
   
    jModuleRecentPosts
    .remove() // Clonando widget de últimos assuntos
    .prependTo('#wrapper') // Inserindo no main-content
    .addClass('recentTopics') // Adicionando nova classe
    .removeClass('module'); // Removendo classe existente
   
    $('.recentTopics').each(function() {
          $(this).html(
                  $(this).html()
                    .replace(/\»/g, '')
                    .replace(/\<a href="\/t(.*?)\-/g,'<li class="recentPost"><a href="/t$1-')
                    .replace(/\<\/a\><br\>/g, '</a><div class="recentInline">')
                    .replace(/\<a href="\/u([0-9])"\>(.*?)<\/a\>/g, '<a href="/u$1">$2</a><br>')
          ).find('li').wrapAll('<ul></ul>');
          $('a[href^="/u"]', this).each(function() {
              var jLinkUser = $(this).attr('href');
              $(this).before(
              '<a href="' + jLinkUser + '" class="user_photo lastpost-avatar">' +
              '    <img src="http://r26.imgfast.net/users/2617/31/90/74/avatars/1-40.png" alt="no_photo" class="mini_photo" />' +
              '</a>'
              );
              var jImg = $(this).prev().find('img'),
                    jUser = sessionStorage.getItem(jLinkUser);
              if(jUser) {
                  jImg.attr('src', jUser);
              } else {
              $.ajax({
                      url: jLinkUser + "?change_version=punbb",
                      type: 'GET',
                      success: function(data) {
                        var jImage = $('#profile-advanced-right .module:first img:first', data).attr('src');
                              jImg.attr('src', jImage);
                              sessionStorage.setItem(jLinkUser, jImage);
                      },
                      error: function(err)
                      {
                        alert("AJAX error in request (Last posts)");
                      }
              });
              }
          });
          $('a[href^="/t"]', this).each(function() {
              var jThis = $(this),
                    jLinkTpc = jThis.attr('href').split('#')[0];
              $.ajax({
                      url: jLinkTpc + "?change_version=punbb",
                      type: 'GET',
                      success: function(recent) {
                      var jCreator = '',
                            jLocal = $('.crumbs:first a.nav', recent).wrapAll('<div></div>').parent().html(),
                            jPaging = $('.paging', recent)[0];
                      jThis.parents('.recentPost').append(
                      '<div class="small_links">' +
                      '    <span class="creator_post">Carregando...</span>' +
                      '    <span class="local">' + jLocal + '</span>' +
                      '</div>'
                      ).find('a[href*="change_version"]').each(function() {
                        var jHref = $(this).attr('href').split('?')[0];
                        $(this).attr('href', jHref);
                      });
                      if(jPaging) {
                          jCreator = $('a:contains("1")', jPaging).attr('href');
                          jThis.parents('.recentPost').find('.creator_post').load(jCreator + ' .username:first', function() {
                                $(this).text($(this).text());
                          });
                      } else {
                          jCreator = $('.username:first', recent).text();
                          jThis.parents('.recentPost').find('.creator_post').text(jCreator);
                      }
                      },
                      error: function(err)
                      {
                        alert("AJAX error in request (Last posts)");
                      }
              });
          });
    });
    });

Acho que irá resolver, caso ainda tenha algum problema, veja em tópicos já resolvido sobre essa questão

Até mais
Harleen

Harleen
Super Membro

Membro desde : 09/07/2012
Mensagens : 1779
Pontos : 2373

https://antenadogames.forumeiros.com/

Ir para o topo Ir para baixo

Tópico resolvido Re: Widget Últimos Assuntos

Mensagem por d3vinn 08.01.18 3:40

Harleen escreveu:Experimente esse código
Código:
$(function() {
    $('head').append(
    '<style type="text/css">' +
    '.recentTopics .main-content {' +
    '  font-family: helvetica, arial, sans-serif !important;' +
    '  line-height: 15px;' +
    '  padding: 0;' +
    '}' +
    '.recentTopics ul {' +
    '  padding-left: 0 !important;' +
    '}' +
    '.mini_photo {' +
    '  margin-right: 5px;' +
    '}' +
    'li.recentPost {' +
    '  min-height: 50px;' +
    '  padding: 1em 1em 0.5em 1em;' +
    '  list-style-type: none;' +
    '  border-bottom: 1px solid #f3f3f3;' +
    '}' +
    '.recentPost a[href^="/t"] {' +
    '  font-size: 14px;' +
    '  text-decoration: none;' +
    '  font-weight: bold;' +
    '}' +
    '.recentInline {' +
    '  min-width: 30%;' +
    '  font-size: 12px;' +
    '  float: right;' +
    '}' +
    '.small_links {' +
    '  display: table;' +
    '  margin-top: 10px;' +
    '}' +
    '.local {' +
    '  font-size: 0;' +
    '}' +
    '.local a:after {' +
    '  content: " → ";' +
    '}' +
    '.local a:last-child:after {' +
    '  content: "";' +
    '}' +
    '.small_links, .small_links a {' +
    '  color: #a4a4a4 !important;' +
    '  font-size: 12px !important;' +
    '  text-decoration: none !important;' +
    '}' +
    '.creator_post:before {' +
    '  content: "Tópico iniciado por ";' +
    '}' +
    '.creator_post:after {' +
    '  content: ", Em: ";' +
    '}' +
    '.recentTopics {' +
    '  margin: 15px 0;' +
    '}' +
    '</style>'
    );
   
    var jModuleRecentPosts = $('.module:contains("Últimos assuntos")');
   
    jModuleRecentPosts
    .remove() // Clonando widget de últimos assuntos
    .prependTo('#wrapper') // Inserindo no main-content
    .addClass('recentTopics') // Adicionando nova classe
    .removeClass('module'); // Removendo classe existente
   
    $('.recentTopics').each(function() {
          $(this).html(
                  $(this).html()
                    .replace(/\»/g, '')
                    .replace(/\<a href="\/t(.*?)\-/g,'<li class="recentPost"><a href="/t$1-')
                    .replace(/\<\/a\><br\>/g, '</a><div class="recentInline">')
                    .replace(/\<a href="\/u([0-9])"\>(.*?)<\/a\>/g, '<a href="/u$1">$2</a><br>')
          ).find('li').wrapAll('<ul></ul>');
          $('a[href^="/u"]', this).each(function() {
              var jLinkUser = $(this).attr('href');
              $(this).before(
              '<a href="' + jLinkUser + '" class="user_photo lastpost-avatar">' +
              '    <img src="http://r26.imgfast.net/users/2617/31/90/74/avatars/1-40.png" alt="no_photo" class="mini_photo" />' +
              '</a>'
              );
              var jImg = $(this).prev().find('img'),
                    jUser = sessionStorage.getItem(jLinkUser);
              if(jUser) {
                  jImg.attr('src', jUser);
              } else {
              $.ajax({
                      url: jLinkUser + "?change_version=punbb",
                      type: 'GET',
                      success: function(data) {
                        var jImage = $('#profile-advanced-right .module:first img:first', data).attr('src');
                              jImg.attr('src', jImage);
                              sessionStorage.setItem(jLinkUser, jImage);
                      },
                      error: function(err)
                      {
                        alert("AJAX error in request (Last posts)");
                      }
              });
              }
          });
          $('a[href^="/t"]', this).each(function() {
              var jThis = $(this),
                    jLinkTpc = jThis.attr('href').split('#')[0];
              $.ajax({
                      url: jLinkTpc + "?change_version=punbb",
                      type: 'GET',
                      success: function(recent) {
                      var jCreator = '',
                            jLocal = $('.crumbs:first a.nav', recent).wrapAll('<div></div>').parent().html(),
                            jPaging = $('.paging', recent)[0];
                      jThis.parents('.recentPost').append(
                      '<div class="small_links">' +
                      '    <span class="creator_post">Carregando...</span>' +
                      '    <span class="local">' + jLocal + '</span>' +
                      '</div>'
                      ).find('a[href*="change_version"]').each(function() {
                        var jHref = $(this).attr('href').split('?')[0];
                        $(this).attr('href', jHref);
                      });
                      if(jPaging) {
                          jCreator = $('a:contains("1")', jPaging).attr('href');
                          jThis.parents('.recentPost').find('.creator_post').load(jCreator + ' .username:first', function() {
                                $(this).text($(this).text());
                          });
                      } else {
                          jCreator = $('.username:first', recent).text();
                          jThis.parents('.recentPost').find('.creator_post').text(jCreator);
                      }
                      },
                      error: function(err)
                      {
                        alert("AJAX error in request (Last posts)");
                      }
              });
          });
    });
    });

Acho que irá resolver, caso ainda tenha algum problema, veja em tópicos já resolvido sobre essa questão

Até mais

Os fóruns ficaram "travados" até uma parte e o widget vai até mais pra frente, mas coloquei outros widgets na lateral e acho que me serve assim.

Widget Últimos Assuntos 111

Obrigado, @Harleen!
d3vinn

d3vinn
Novo Membro

Membro desde : 06/01/2018
Mensagens : 5
Pontos : 9

http://planetaspfc.forumeiros.com/

Ir para o topo Ir para baixo

Tópico resolvido Re: Widget Últimos Assuntos

Mensagem por Ketholy 08.01.18 19:31

Questão marcada como Resolvida ou o Autor solicitou que ela fosse arquivada.
Tópico marcado como Resolvido e movido para Questões resolvidas.
Ketholy

Ketholy
Super Membro

Membro desde : 20/01/2017
Mensagens : 1309
Pontos : 1577

http://jogosrpg-com-br.forumais.com/forum https://twitter.com/Ketholy Suan

Ir para o topo Ir para baixo

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

- Tópicos semelhantes

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