Aggregare i doppi post (PhpBB/ModernBB/AwesomeBB)

Tutorial Aggregare i doppi post (PhpBB/ModernBB/AwesomeBB)

Messaggio Da Niko Mar 11 Giu 2013 - 21:49

PhpBB: Aggregare i doppi post


Definizione

Quando un membro inserisce due post di fila, conalcune informazioni ripetute di scarso interesse come nell'esempio:
Aggregare i doppi post (PhpBB/ModernBB/AwesomeBB) OavuoSH

Questo script permette di fare questo:
Aggregare i doppi post (PhpBB/ModernBB/AwesomeBB) PzTjB0T



Configurazione per PhpBB2

Codice:
$(function() {
  var c = "", a, d = 0, b = 0;
  $("tr.post").each(function() {
    var e = $("> td:first span.name", this).text();
    e != c ? (d++, b++, a = $(this), b % 2 != d % 2 && $("> td", a).add($("> td", a.next())).toggleClass("row1 row2"), c = e) : (b++, $(a).find("div.signature_div").remove(), $("> td:last", a).append($("> td:last > table ", this).addClass("doublepost").attr("id", $(this).attr("id").replace(/^p([0-9]+)$/, "$1"))), $(this).next().remove(), $(this).remove())
  });
  var f = location.hash;
  location.hash = "";
  location.hash = f
});

Configurazione per PhpBB3

Codice:
$(function() {
  var c = "", a, d = 0, b = 0;
  $("div.post").each(function() {
    var e = $(".postprofile dt", this).text();
    e != c ? (d++, b++, a = $(this), b % 2 != d % 2 && a.toggleClass("row1 row2"), c = e) : (b++, $(a).find("div.signature_div").remove(), $("div.postbody", a).append($("div.postbody", this).attr("class", "doublepost").attr("id", $(this).attr("id").replace(/^p([0-9]+)$/, "$1"))), $(this).remove())
  });
  var f = location.hash;
  location.hash = "";
  location.hash = f
});

Modifica di stile: CSS

I blocchi dei doppi post hanno una classe doublepost.
Come tutte le altre classi può essere modificata con i codici CSS ( PDA > Visualizzazione > Colori > Foglio di stile):

Codice:
.doublepost { border-top: 1px solid #888888 }
in questo caso verrà messo un bordo divisore in alto di colore #888888 e spessore 1px :bene:




Ultima modifica di Niko il Gio 9 Dic 2021 - 2:07 - modificato 2 volte. (Motivazione : Aggiornamento)
Niko
Niko
Moderatore
Moderatore

Sesso : Maschio
Età : 27
Messaggi : 9425
Località : Provincia di Varese

https://www.fmcodes.net/
Niko è stato ringraziato dall'autore di questo topic.

Tutorial Unire i doppi post (AwesomeBB e ModernBB)

Messaggio Da Niko Gio 9 Dic 2021 - 2:10

Unire i doppi post (AwesomeBB e ModernBB)


ModernBB

Andiamo verso Pannello di amministrazione ► Visualizzazione ► Immagini e colori ► Colori ► Foglio di stile CSS e aggiungiamo:
Codice:
/* Hide the signature on multiposts */
.post.has_prev > .postbody > .signature_div { display: none; }
 
/* Hide the profile on multiposts */
.post.has_next .post .postprofile { display: none; }
 
/* Change the basic format of the multiposts and add a border line to separate them */
.post.has_next .post {
  border: none;
  box-shadow: none;
  float: left;
  margin-top: 10px;
  padding-top: 10px;
  width: 100%;
  border-top: 3px solid #3793ff !important;
  border-radius: 0 !important;
}

Andiamo ora verso Pannello di amministrazione ► , assicuriamoci che la gestione dei codici Javascript sia attivata e aggiungiamo un nuovo codice:
  • Titolo: a tua scelta
  • Dove: in tutte le pagine
  • Codice:
    Codice:
    /*
    * -- Automerge Double Posts --
    * Version: 1.0 EN (2021-03-21) [ModernBB]
    * Author: Wecoc & Bipo
    * Description: When a user makes multiple posts in a row, they are displayed as part of the same post,
    * with a thin line that seperates their content.
    */
     
    $(function() {
      var posts = $(".post");
      if (posts.length < 2) return;
      for(var i=0; i<posts.length; i++ ) {
        var post = posts[i], author = post.querySelector(".postprofile-name a");
        if (author == null) break;
        author = author.innerText;
        if (i > 0) {
          var prev_post = posts[i-1], prev_author = prev_post.querySelector(".postprofile-name a");
          if (prev_author == null) break;
          prev_author = prev_author.innerText;
          if (author == prev_author) {
            $(post).addClass("has_prev");
          }
        }
        if (i < (posts.length - 1)) {
          var next_post = posts[i+1], next_author = next_post.querySelector(".postprofile-name a");
          if (next_author == null) break;
          next_author = next_author.innerText;
          if (author == next_author) {
            $(post).addClass("has_next");
            post.appendChild(next_post);
          }
        }
      }
    });


AwesomeBB

Andiamo verso Pannello di amministrazione ► Visualizzazione ► Immagini e colori ► Colori ► Foglio di stile CSS e aggiungiamo:
Codice:
/* Hide the signature on multiposts */
.post-wrap.has_prev > .post-body > .post > .post-content > .post-signature { display: none; }
 
/* Hide the profile on multiposts */
.post-wrap.has_prev .post-body .post-aside { display: none;}
 
/* Hide the space post on multiposts */
.post-wrap.has_prev .post { margin: 0px 3px 0;}

Andiamo ora verso Pannello di amministrazione ► , assicuriamoci che la gestione dei codici Javascript sia attivata e aggiungiamo un nuovo codice:
  • Titolo: a tua scelta
  • Dove: in tutte le pagine
  • Codice:
    Codice:
    /*
    * -- Automerge Double Posts --
    * Version: 1.0 EN (2021-03-21) [AwesomeBB]
    * Author: Wecoc & Bipo
    * Description: When a user makes multiple posts in a row, they are displayed as part of the same post,
    * with a thin line that seperates their content.
    */
     
    $(function() {
      var posts = $(".post-wrap");
      if (posts.length < 2) return;
      for(var i=0; i<posts.length; i++ ) {
        var post = posts[i], author = post.querySelector(".post-author a");
        if (author == null) break;
        author = author.innerText;
        if (i > 0) {
          var prev_post = posts[i-1], prev_author = prev_post.querySelector(".post-author a");
          if (prev_author == null) break;
          prev_author = prev_author.innerText;
          if (author == prev_author) {
            $(post).addClass("has_prev");
          }
        }
        if (i < (posts.length - 1)) {
          var next_post = posts[i+1], next_author = next_post.querySelector(".post-author a");
          if (next_author == null) break;
          next_author = next_author.innerText;
          if (author == next_author) {
            $(post).addClass("has_next");
            post.appendChild(next_post);
          }
        }
      }
    });



Niko
Niko
Moderatore
Moderatore

Sesso : Maschio
Età : 27
Messaggi : 9425
Località : Provincia di Varese

https://www.fmcodes.net/

A rozalia piace questo messaggio.

Niko è stato ringraziato dall'autore di questo topic.

Visualizza l'argomento precedente Visualizza l'argomento successivo Torna in alto

- Argomenti simili

 
Permessi in questa sezione del forum:
Non puoi rispondere agli argomenti in questo forum.