Funzionalità aggiuntive e ottimizzazione layout per le pagine del Forum HTML.it
当前为
// ==UserScript==
// @name Forum HTML.it Toolset
// @description Funzionalità aggiuntive e ottimizzazione layout per le pagine del Forum HTML.it
// @version 1.0
// @author OpenDec
// @match https://forum.html.it/forum/*
// @exclude https://forum.html.it/forum/modcp/*
// @exclude https://forum.html.it/forum/admincp/*
// @icon https://forum.html.it/forum/favicon.ico
// @grant GM.getValue
// @grant GM.setValue
// @grant GM.deleteValue
// @run-at document-start
// @noframes
// @namespace forum_html_it_toolset
// @license MIT
// ==/UserScript==
/* jshint esversion: 8 */
(function(){
'use strict';
// --------------------------------------------------
// --- INIT ---
// --------------------------------------------------
var versione = GM.info.script.version;
var paginaCorrente = window.location.href.match(/^(?:https:\/\/forum.html.it\/forum\/(.+?).php)?/)[1] || 'home';
// --------------------------------------------------
// --- GESTIONE IMPOSTAZIONI ---
// --------------------------------------------------
function impostazioni(key, val){
if (!impostazioni.campi.hasOwnProperty(key)) return undefined;
if (typeof val === 'undefined'){
// Se specificato solo 'key', restituisco il corrispettivo valore
return impostazioni.utente.hasOwnProperty(key) ? impostazioni.utente[key] : impostazioni.campi[key].valori[0];
} else {
// Se specificato 'key' e 'val', controllo e (se valido) applico il valore specificato per la chiave specificata, quindi lo restituisco
if (impostazioni.campi[key].valori.includes(val) && val !== impostazioni.campi[key].valori[0]){
impostazioni.utente[key] = val;
} else {
delete impostazioni.utente[key];
}
return impostazioni(key);
}
}
impostazioni.campi = {
rimuoviTopBar: {tipo: 'checkbox', valori: ['0', '1']},
visualizzazioneCompatta: {tipo: 'checkbox', valori: ['1', '0']},
copiaCodice: {tipo: 'checkbox', valori: ['1', '0']},
riportaQuotato: {tipo: 'checkbox', valori: ['1', '0']},
schemaColore: {tipo: 'radio', valori: ['A', 'S', 'C']} // A: auto (impostazione del sistema operativo), S: scuro, C: chiaro
};
impostazioni.utente = {};
impostazioni.encode = function(obj){
return JSON.stringify(obj);
};
impostazioni.decode = function(str){
return JSON.parse(str);
};
impostazioni.carica = async function(callback){
// Uso localStorage come cuscinetto in appoggio alle API GM. In questo modo, quando possibile, limito il caricamento asincrono delle impostazioni,
// perché il CSS viene inserito e applicato dopo questo caricamento e crea un disturbo iniziale se eseguito in modo asincrono
var str = localStorage.getItem('FHT_impostazioni');
if (str != null && !!GM){
str = await GM.getValue('FHT_impostazioni', '');
localStorage.setItem('FHT_impostazioni', str);
}
if(str) impostazioni.utente = impostazioni.decode(str);
callback();
};
impostazioni.salva = function(){
if (Object.keys(impostazioni.utente).length){
var str = impostazioni.encode(impostazioni.utente);
localStorage.setItem('FHT_impostazioni', str);
if (!!GM) GM.setValue('FHT_impostazioni', str);
} else {
localStorage.setItem('FHT_impostazioni', '');
if (!!GM) GM.deleteValue('FHT_impostazioni');
}
};
// --------------------------------------------------
// --- DISEGNA STAGE ---
// --------------------------------------------------
function disegnaStage(){
initStyle();
// --------------------------------------------------
// --- IMPOSTAZIONI TOOLSET ---
// --------------------------------------------------
// Pulsante impostazioni
var btnImpostazioni = document.createElement('button');
btnImpostazioni.id = 'FHT-btn-impostazioni';
btnImpostazioni.title = 'Impostazioni Toolset';
btnImpostazioni.classList.add('FHT-init-fade');
document.querySelector('.trends--section').appendChild(btnImpostazioni);
setTimeout(function(){ btnImpostazioni.classList.remove('FHT-init-fade'); }, 1); // fade-in
btnImpostazioni.addEventListener('click', apriImpostazioniToolset);
// Pannello impostazioni
function apriImpostazioniToolset(e){
var header = 'Impostazioni Toolset';
var footer = '';
var body =
'<fieldset id="FHT-layout"><legend>Layout</legend>'+
' <label><input type="checkbox" value="1" name="rimuoviTopBar">Rimuovi Top-Bar</label>'+
' <label><input type="checkbox" value="1" name="visualizzazioneCompatta">Visualizzazione compatta</label>'+
'</fieldset>'+
'<fieldset id="FHT-strumenti"><legend>Strumenti</legend>'+
' <label><input type="checkbox" value="1" name="riportaQuotato">Tooltip "Riporta quotato"</label>'+
' <label><input type="checkbox" value="1" name="copiaCodice">Pulsante "Copia codice"</label>'+
'</fieldset>'+
'<fieldset id="FHT-schemaColore"><legend>Modalità colore</legend>'+
' <label><input type="radio" value="A" name="schemaColore">Come da sistema operativo</label>'+
' <label><input type="radio" value="C" name="schemaColore">Chiaro</label>'+
' <label><input type="radio" value="S" name="schemaColore">Scuro</label>'+
'</fieldset>';
overlay.apri(header, body, footer);
var inputs = document.querySelectorAll('#FHT-overlay > .FHT-overlay-content > .FHT-overlay-body input');
for (var i = 0; i < inputs.length; ++i) {
var input = inputs[i];
var key = input.name;
var val = impostazioni(key);
input.checked = input.value === val;
input.addEventListener('change', impostazioni_input_onChange);
}
}
function impostazioni_input_onChange(e){
var me = e.target;
var key = me.name;
var val = me.type === "checkbox" ? ''+(+me.checked) : me.value;
impostazioni(key, val);
aggiornaStyle(css(paginaCorrente));
impostazioni.salva();
}
// --------------------------------------------------
// --- OVERLAY ---
// --------------------------------------------------
var overlay = {};
overlay.apri = function(header, body, footer){
document.body.classList.add('FHT-overlay');
var container = document.querySelector('#FHT-overlay');
if (!container){
container = document.createElement('div');
container.id = 'FHT-overlay';
document.body.appendChild(container);
container.addEventListener('click', function(e){
overlay.chiudi();
});
}
overlay.aggiorna(header, body, footer);
setTimeout(function(){
container.classList.add('aperto');
},10);
};
overlay.aggiorna = function(header, body, footer){
var container = document.querySelector('#FHT-overlay');
var content, elHeader, elBody, elFooter;
if (!container) return false;
if (container.childElementCount === 0){
container.innerHTML =
'<div class="FHT-overlay-content">'+
' <div class="FHT-overlay-header">'+
' <span class="FHT-overlay-close">×</span>'+
' <h2></h2>'+
' </div>'+
' <div class="FHT-overlay-body FHT-scrollbar-thin">'+
' </div>'+
' <div class="FHT-overlay-footer"></div>'+
'</div>';
content = container.querySelector('#FHT-overlay > .FHT-overlay-content');
content.addEventListener('click', function(e){
e.stopPropagation();
});
content.querySelector('.FHT-overlay-header > .FHT-overlay-close').addEventListener('click', function(e){
e.stopPropagation();
overlay.chiudi();
});
}
content = container.querySelector('#FHT-overlay > .FHT-overlay-content');
elHeader = content.querySelector('.FHT-overlay-header > h2');
elBody = content.querySelector('.FHT-overlay-body');
elFooter = content.querySelector('.FHT-overlay-footer');
if (header != null) elHeader.innerHTML = header;
if (body != null) elBody.innerHTML = body;
if (footer != null) elFooter.innerHTML = footer;
};
overlay.chiudi = function(){
document.body.classList.remove('FHT-overlay');
var contenitore = document.querySelector('#FHT-overlay.aperto');
if (contenitore){
contenitore.classList.remove('aperto');
setTimeout(function(){
document.body.removeChild(contenitore);
},400);
}
};
// --------------------------------------------------
// Pagine in cui è presente l'editor messaggi
if (['showthread', 'private', 'newthread', 'newreply', 'editpost', 'profile'].includes(paginaCorrente)){(function(){
function editorReady(){
// Recupero il riferimento a CKEDITOR (v3.6.2) già esistente sulla piattaforma
// NOTA: "unsafeWindow" è necessario in GreaseMonkey FF per accedere ad oggetti nello scope principale della pagina.
// Nel caso in cui "unsafeWindow" non sia digerito da qualche browser/gestore (es. Opera con Tampermonkey su Win), accedo direttamente all'oggetto.
var CKEDITOR = unsafeWindow.CKEDITOR || CKEDITOR;
// Attendo il tram
if (!CKEDITOR){
if (editorReady.tentativi--) setTimeout(editorReady, 250);
return;
}
CKEDITOR.on('instanceReady', function(e){
var editor = e.editor;
editorReady.callbacks.forEach(function(fn){
fn(editor);
});
});
// Lancio l'inizializzazione dello strumento "Riporta quotato"
// FIX: su FF con Greasemonkey sembra che instanceReady non funzioni, quindi risolvo alla vecchia maniera
function mainInstanceReady(){
var editor = CKEDITOR.instances.vB_Editor_QR_editor;
if (!editor){
if (mainInstanceReady.tentativi--) setTimeout(mainInstanceReady, 250);
return;
}
editorReady.callbacks.initRiportaQuotato(editor);
}
mainInstanceReady.tentativi = 10;
mainInstanceReady();
}
editorReady.tentativi = 10;
editorReady.callbacks = [];
setTimeout(editorReady, 1);
// --------------------------------------------------
// --- BUGS FIX ---
// --------------------------------------------------
// --------------------------------------------------
// - DIGITAZIONE BLOCCATA NELL'EDITOR DOPO UN DOPPIO CLICK
//
// Nell'editor, dopo aver evidenziato una parola eseguendo un doppio click, non è possibile digitare finché non si esegue un singolo click.
// Il problema si presenta su browser Chromium-based. Dovuto alla libreria yuiloader-dom-event.js con cui è applicato, sull'editor, un listener per l'evento dblclick che impedisce la digitazione.
// Non è chiaro il fine di questo listener ma applicando un ulteriore listener, in cui interrompo la propagazione, il problema si risolve.
(function(){
function fixEditorDblclick(editor){
// Esco se l'editor è di tipo textarea (non è affetto dal bug)
if (editor.mode === 'source') return;
// FIX
editor.document.getDocumentElement().$.addEventListener('dblclick', function(e){
e.stopImmediatePropagation();
e.stopPropagation();
});
}
editorReady.callbacks.push(function(editor){
var container = editor.container.$.closest('form');
// Applico il FIX appena è pronta un'istanza dell'editor
fixEditorDblclick(editor);
// Applico il FIX quando l'istanza viene aggiornata al click di specifici pulsanti
container.addEventListener('click', function(e){
var el = e.target;
if (container.querySelector('.cke_button_enhancedsource > span') === el || // Pulsante Switch Editor
container.querySelector('.restoretext') === el || // Pulsante Restore Autosave
container.querySelector('input[type="reset"], input[value="Resetta"]')) // Pulsante Resetta
{setTimeout(fixEditorDblclick, 250, editor);}
});
});
})();
// --------------------------------------------------
// - FACCINE NON FUNZIONANTI (bug minore)
//
// Nello "smiliebox" mostrato di fianco all'editor, al click sulle faccine viene riportato automaticamente, nell'editor, il relativo shortcode.
// Questo non avviene per le faccine il cui shortcode presenta dei caratteri accentati (vedi :dottò:, :dhò:).
// In sostanza per tali elementi non viene valorizzato l'attributo "alt" che serve per questa funzionalità.
// Risolvo valorizzando questi attributi.
(function(){
function fixBrokenSmilies(){
var box = document.querySelector('.smiliebox');
// Attendo il tram
if (!box){
if (fixBrokenSmilies.tentativi--) setTimeout(fixBrokenSmilies, 500);
return;
}
[
{img: 'dotto.gif', alt: ':dottò:', title: 'Dottò!'},
{img: 'dho.gif', alt: ':dhò:'},
{img: 'senzasperanza.gif', alt: ':bhò:'},
].forEach(function(o){
let el = box.querySelector('[src$="/' + o.img +'"]');
if (el){
if (o.alt) el.alt = o.alt;
if (o.title) el.title = o.title;
}
});
}
fixBrokenSmilies.tentativi = 4;
fixBrokenSmilies();
})();
// --------------------------------------------------
// --- STRUMENTI ---
// --------------------------------------------------
// --------------------------------------------------
// - RIPORTA TESTO SELEZIONATO COME "QUOTE"
//
// Quando viene selezionato un contenuto dentro un qualsiasi post, visualizzo un tooltip cliccabile che permette di riportare nell'editor il testo selezionato, inserendolo dentro un tag [QUOTE]
if (['showthread', 'private'].includes(paginaCorrente)){ (function(){
var tooltip;
var timeoutTooltip;
var saltaSelectionchange;
var editor;
editorReady.callbacks.initRiportaQuotato = function(ed){
editor = ed;
initTooltip();
};
function initTooltip(){
tooltip = document.createElement('div');
tooltip.id = 'FHT-tooltip-reply';
tooltip.innerHTML = 'Riporta quotato';
document.body.appendChild(tooltip);
// FIX: aggiungo un elemento alla fine di ciascun contenitore ".postrow" (target valido) in modo che,
// selezionando la fine del contenuto del post, l'ultimo carattere selezionato (di fine riga) non si trovi in un target non valido
document.querySelectorAll('.postbitlegacy .postrow').forEach(function(nod){
var el = document.createElement('span');
el.classList.add('FHT-fine-post');
el.innerHTML = ' ';
nod.appendChild(el);
});
// Al click sul tooltip
tooltip.addEventListener('click', function(){
chiudiTooltip();
var quoted = getQuotato();
// Deseleziono
if (window.getSelection().empty) window.getSelection().empty(); // Chrome
else if (window.getSelection().removeAllRanges) window.getSelection().removeAllRanges(); // Firefox
riportaQuotato(quoted);
});
// Posiziono il tooltip quando la selezione è cambiata
document.addEventListener('selectionchange', function(e){
chiudiTooltip();
if (saltaSelectionchange) return;
clearTimeout(timeoutTooltip);
timeoutTooltip = setTimeout(function(){
esaminaSelezione();
}, 10);
});
window.addEventListener('resize', function(e){
if (tooltip.classList.contains('FHT-tooltip-aperto')) posizionaTooltip();
});
// Mentre si seleziona col mouse, disattivo il tooltip per evitare interferenze durante la selezione
const nod = document.querySelector('#postlist, .postdetails');
nod.addEventListener('mousedown', function(e){
saltaSelectionchange = true;
});
nod.addEventListener('mouseup', function(e){
setTimeout(function(){
saltaSelectionchange = false;
esaminaSelezione();
}, 1);
});
document.addEventListener('dragend', function(e){
esaminaSelezione();
});
}
function esaminaSelezione(){
var sel = window.getSelection();
var rangeCount = sel.rangeCount;
var range;
var frag;
var div;
var el;
var targetValido;
var testo = '';
if (sel.isCollapsed || sel.toString().trim() == ''){
chiudiTooltip();
return;
}
for (var i = 0; i < rangeCount; i++){
range = sel.getRangeAt(i);
if (range.collapsed) continue;
targetValido = false;
// Partendo dal contenitore comune, relativo alla selezione effettuata, verifico la discendenza per stabilire se la selezione appartiene al contenuto di un post (target valido)
el = range.commonAncestorContainer;
while (el) {
if (el.classList){
if (incluso(el)){
targetValido = true;
break;
} else if (escluso(el) || el.tagName === 'HTML'){
targetValido = false;
break;
}
}
el = el.parentElement;
}
if (!targetValido){
return;
}
}
posizionaTooltip();
}
function incluso(el){
return incluso.selettori
.some(function(selettore){
return el.matches(selettore);
});
}
incluso.selettori = ['.postrow blockquote.postcontent', '.postrow > .content', '.postrow'];
function escluso(el){
return escluso.selettori
.some(function(selettore){
return el.matches(selettore);
});
}
escluso.selettori = ['.postbody', '.postrow .title', '.after_content', '.after_content .postcontent', '.quote_container', '.bbcode_quote', '.postdetails', '.bbcode_description',
'.postcontainer', '.posts', '.postlist', '.body_wrapper', '.wrapper', '.container', '.body-wrapper', '.desktop', '.attachments', '.attachments .postcontent'];
function apriTooltip(){
tooltip.classList.add('FHT-tooltip-aperto');
}
function chiudiTooltip(){
tooltip.classList.remove('FHT-tooltip-aperto');
}
function posizionaTooltip(){
saltaSelectionchange = true;
var sel = window.getSelection();
var range = sel.getRangeAt(0);
var rangeClone;
var testo = sel.toString();
var segnaposto;
// Se la selezione termina con caratteri newline, posiziono il tooltip prima di tali caratteri
if (/\r?\n/.test(testo.slice(-1))){
let newline = false;
const selezioneContraria = sel.anchorNode !== range.startContainer || sel.anchorOffset !== range.startOffset;
// Inverto i componenti della selezione se l'utente ha effettuato la selezione in direzione contraria
if (selezioneContraria) sel.setBaseAndExtent(sel.focusNode, sel.focusOffset, sel.anchorNode, sel.anchorOffset);
// Sposto indietro la posizione finale finché non siano esclusi i caratteri di ritorno a capo
let conta = 0;
while (!newline && testo.length > conta++){
sel.modify('extend', 'left', 'character');
newline = !/\r?\n/.test(sel.toString().slice(-1));
}
// Rilevo il range di riferimento
rangeClone = sel.getRangeAt(0).cloneRange();
// Reimposto la selezione
while (conta--){
sel.modify('extend', 'right', 'character');
}
if (selezioneContraria) sel.setBaseAndExtent(sel.focusNode, sel.focusOffset, sel.anchorNode, sel.anchorOffset);
} else {
rangeClone = range.cloneRange();
}
rangeClone.collapse(false);
var rangeBounds = rangeClone.getBoundingClientRect();
var bodyBounds = document.body.parentNode.getBoundingClientRect();
// FIX: alcune volte, quando la selezione termina con elementi che creano una interruzione di riga, la posizione del range risulta inconsistente.
// Risolvo inserendo un elemento segnaposto momentaneo da cui rilevo la posizione valida
if (rangeBounds.x === 0 || rangeBounds.y === 0){
segnaposto = document.createElement('span');
rangeClone.insertNode(segnaposto);
rangeBounds = segnaposto.getBoundingClientRect();
segnaposto.remove();
}
tooltip.style.top = Math.round(rangeBounds.bottom - bodyBounds.top + 3) + 'px';
tooltip.style.right = -Math.round(rangeBounds.right - bodyBounds.right - 5) + 'px';
range.endContainer.normalize();
range.detach();
rangeClone.detach();
setTimeout(function(){
saltaSelectionchange = false;
apriTooltip();
}, 1);
}
function toBbcode(el){
var cod;
el.querySelectorAll(':scope > .FHT-code-container, :scope > b, :scope > i, :scope > u, :scope > font, :scope > span, :scope > a, :scope > img, :scope > h2, :scope > .attachments, :scope > .bbcode_container').forEach(function(x){
var cont = null, tag, atr;
if (['B','I','U'].includes(x.tagName)){
cont = toBbcode(x);
tag = x.tagName;
} else if (x.tagName === 'FONT'){
cont = toBbcode(x);
if (x.hasAttribute('size')){
tag = 'SIZE';
atr = x.size;
} else if (x.hasAttribute('color')){
tag = 'COLOR';
atr = x.color;
}
} else if (x.tagName === 'SPAN'){
cont = toBbcode(x);
if (x.style.fontFamily){
tag = 'FONT';
atr = x.style.fontFamily;
}
} else if (x.tagName === 'A'){
cont = toBbcode(x);
const href = x.href;
if (href){
if (href.indexOf('mailto:') === 0){
tag = 'MAIL';
atr = '"' + href.slice(7) + '"';
} else {
tag = 'URL';
if (href !== cont) atr = '"' + href + '"';
}
}
} else if (x.tagName === 'IMG'){
const src = x.getAttribute("src");
if (src.indexOf('images/smilies/') === 0){
const nome = src.slice(15);
cont = faccine[nome];
}
} else if (x.classList.contains('FHT-code-container')){
x.innerHTML = x.innerHTML.replace(/ /g, ' ').replace(/<br>/g, '\n');
const block = x.querySelector('.bbcode_code');
if (!block){
cont = '';
} else {
cont = escapeHtml(block.innerText);
tag = {'html': 'HTML', 'php': 'PHP'}[x.dataset.codeType] || 'CODE';
cod = true;
}
} else if (x.classList.contains('bbcode_container')){
if (x.querySelector(':scope > .bbcode_quote')) cont = '';
} else if (x.classList.contains('attachments')){
cont = '';
} else if (x.tagName === 'H2'){
cont = '';
}
if (cont === null) return;
x.outerHTML = wrapBbcode(cont, tag, atr);
});
if (cod) return el.innerText.replace(/\n(\[(?:CODE|HTML|PHP)\])/g, '$1'); // Rimuovo ritorno-a-capo aggiuntivo prima del blocco di codice
else return el.innerText;
}
var faccine = {
'tongue.png': ':p', 'blink.gif': ';)', 'biggrin.gif': ':D', 'redface.png': ':o', 'smile.gif': ':)', 'frown.gif': ':(', 'what.gif': ':confused:', 'mad.png': ':mad:', 'rolleyes.png': ':rolleyes:', 'cool.png': ':cool:', 'eek.gif': ':eek:', '030.gif': ':smack:',
'jam.gif': ':jam:', 'dotto.gif': ':dottò:', 'stordita.gif': ':stordita:', 'fagiano.gif': ':fagiano:', 'nondirlo.gif': ':nonlodire', 'noncisiamo.gif': ':nonono:', 'metallica.gif': ':unz:', 'sgrat.gif': ':argo:', 'senzasperanza.gif': ':bhò:',
'sbonk.gif': ':biifu:', 'dho.gif': ':dhò:', 'cool.gif': ':fighet:', 'sbav.gif': ':sbav:', 'certocerto.gif': ':madai!?:', 'tupitupi.gif': ':yuppi:', 'zizi.gif': ':zizi:', 'cry.gif': ':cry:', 'nillio.gif': ':nillio:', 'mame.gif': ':mame:',
'electric_g.gif': ':prrr:', 'rotf.gif': ':malol:', 'incupito.gif': ':incupito:', 'ciapet.gif': ':ciapet:', 'ciao.gif': ':ciauz:', 'fiore.gif': ':fiore:', 'saggio.gif': ':98:', 'timida.gif': ':shy:', 'sonno.gif': ':sonno:', 'ecco.gif': ':ecco:',
'sadico.gif': ':sadico:', 'popcorn.gif': ':popcorn:', 'd56.gif': ':d56:', 'old.gif': ':old:', 'scalata.gif': ':messner:', 'look.gif': ':spy:', 'confermo.gif': ':mem:', 'facepalm.gif': ':facepalm:', 'afraid.gif': ':afraid:', 'ammore.gif': ':love:'
};
function wrapBbcode(cont, tag, atr){
return tag ? '[' + tag + (atr ? '=' + atr : '') + ']' + cont + '[/' + tag + ']' : cont;
}
function escapeHtml(str){
return str
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, """)
.replace(/'/g, "'");
}
function getQuotato(){
var testo = '';
var autore;
var selection = window.getSelection();
var rangeCount = selection.rangeCount;
var range;
var frammento;
var div;
for (var i = 0; i < rangeCount; i++){
range = window.getSelection().getRangeAt(i);
if (range.collapsed) continue;
frammento = range.cloneContents();
div = document.createElement('div');
div.appendChild(frammento.cloneNode(true));
// Verifico se il range è un frammento incluso per intero in un blocco di codice, quindi lo includo direttamente come bbcode
let el = range.commonAncestorContainer;
let isBloccoCodice;
while (el) {
if (el.classList){
if (el.matches('.FHT-code-container, .bbcode_code')){
div.innerHTML = (div.querySelector(':scope > .bbcode_code') || div).innerHTML.replace(/ /g, ' ').replace(/<br>/g, '\n');
let tag = {'html': 'HTML', 'php': 'PHP'}[el.dataset.codeType] || 'CODE';
let cont = div.innerText;
testo += '[' + tag + ']' + cont + '[/' + tag + ']';
isBloccoCodice = true;
break;
} else if (el.classList.contains('postrow') || el.tagName === 'HTML'){
break;
}
}
el = el.parentElement;
}
// Eseguo il parsing
if (!isBloccoCodice){
testo += toBbcode(div);
}
div.remove();
if (!autore){
// Recupero il nome dell'autore del post
let el = range.commonAncestorContainer;
el = el.parentElement.closest('.postdetails');
autore = el.querySelector('.userinfo .username').innerText;
}
}
testo = testo.trim();
return {testo: testo, autore: autore};
}
function riportaQuotato(o){
var testo = o.testo;
var autore = o.autore;
if (!testo) return;
// FIX: se editor è vuoto, il contenuto inserito viene ripulito dalla newline finale che gli aggiungo, e il cursore viene portato all'inizio.
// In questo caso inserisco preventivamente una nuova riga. Sembra risolvere!
if (editor.getData() === '') {
editor.insertHtml('\n');
}
var str = '[QUOTE' + (autore ? '=' + autore : '') + ']'+ testo +'[/QUOTE]\n\n';
editor.insertHtml(str);
editor.container.$.scrollIntoView(false);
}
})();} // <- showthread, private
// --------------------------------------------------
// - PULSANTE COPIA CODICE
//
// Aggiungo un pulsante "copia codice" per ogni blocco di codice presente nelle discussioni
(function(){
var codeBoxes = document.querySelectorAll('div.bbcode_container > .bbcode_code');
function btnCopy_OnClick(me){
var codeBox = me.parentElement.nextElementSibling;
var flag;
if (window.clipboardData && window.clipboardData.setData){
window.clipboardData.setData("Text", codeBox.innerText);
flag = true;
} else if (document.queryCommandSupported && document.queryCommandSupported("copy")){
try {
var t = document.createElement("textarea");
document.body.appendChild(t);
t.value = codeBox.innerText;
t.select();
document.execCommand("copy");
document.body.removeChild(t);
flag = true;
}
catch (m){ flag = false; }
}
if (!flag){ modal(50); return; }
var w = me.parentElement.parentElement;
w.classList.add('FHT-codecopied');
setTimeout(function(){w.classList.remove('FHT-codecopied');}, 1000);
}
function applica_btnCopy(codeBoxes){
for (var i = 0; i < codeBoxes.length; i++) {
var btnCopy = document.createElement('span');
var codeBox = codeBoxes[i];
var container = codeBox.parentElement;
var description = codeBox.previousElementSibling;
btnCopy.innerText = 'Copia codice';
btnCopy.className = 'FHT-btn-copycode';
btnCopy.title = 'Copia codice negli appunti';
description.appendChild(btnCopy);
}
}
function applica_classiCode(codeBoxes){
for (var i = 0; i < codeBoxes.length; i++) {
var codeBox = codeBoxes[i];
var container = codeBox.parentElement;
var description = codeBox.previousElementSibling;
var strDescription = description.innerText.toLowerCase();
var tipoCodice = strDescription.includes('html') ? 'html' : strDescription.includes('php') ? 'php' : 'generic';
container.classList.add('FHT-code-container');
container.classList.add('FHT-code-type-' + tipoCodice);
container.dataset.codeType = tipoCodice;
}
}
function riapplicaCopiaCodice(tentativi){
if (tentativi <= 0) return;
var codeBoxes = document.querySelectorAll('div.bbcode_container:not(.FHT-code-container) > .bbcode_code');
if (codeBoxes.length){
applica_btnCopy(codeBoxes);
setTimeout(applica_classiCode, 1, codeBoxes);
} else {
setTimeout(riapplicaCopiaCodice, 300, --tentativi);
}
}
applica_btnCopy(codeBoxes);
setTimeout(applica_classiCode, 1, codeBoxes); // Applico le classi in modo differito per creare un effetto fade all'apertura
// Delego il click del pulsante "Copia codice" perché, quando viene modificato un post, il suo contenuto viene rigenerato al volo, compresi gli elementi qui creati che perderebbero i relativi listener
const postContainer = document.querySelector('#posts, #showpm, #post_preview');
if (postContainer){
postContainer.addEventListener('click', function(e){
const el = e.target;
if (el.classList.contains('FHT-btn-copycode')) btnCopy_OnClick(e.target);
// Riapplico lo strumento "Copia codice" dopo il click su pulsanti che modificano/creano al volo contenuti nel thread
if(el.matches('.quickedit > .actionbuttons input[id^="vB_Editor_QE_"][id$="save"]')){ // [Salva] modifica rapida
riapplicaCopiaCodice(10);
}
});
}
// Estendo la funzione eseguita al success di invio rispsta rapida, per riapplicare il "Copia codice" sul nuovo post
var qr_do_ajax_post = unsafeWindow.qr_do_ajax_post || qr_do_ajax_post;
if (qr_do_ajax_post){
unsafeWindow.qr_do_ajax_post = (function(oldFn) {
function funzioneEstesa(E, A) {
oldFn(E, A);
riapplicaCopiaCodice(5);
}
return funzioneEstesa;
})(qr_do_ajax_post);
}
})();
})();} // <- showthread, private, newthread, newreply, editpost
}
// --------------------------------------------------
// --- MODAL ---
// --------------------------------------------------
function modal(msg, delay){
if (typeof delay === 'undefined') delay = 10;
if (typeof msg === 'number'){
msg = modal.msgList[msg];
}
setTimeout(function(){
alert(msg);
}, delay);
}
modal.msgList = {
50: '⚠️ Qualcosa è andato storto!\nNon riesco a copiare negli appunti."',
};
// --------------------------------------------------
// --- START ---
// --------------------------------------------------
function start(){
impostazioni.carica(function(){
document.documentElement.classList.add('FHT-toolset');
initStyle();
window.addEventListener('DOMContentLoaded', disegnaStage, {once: true});
console.log('%c ⛭ Forum HTML.it Toolset '+versione+' ', 'background: #f8e71c; color: #10121d; font-weight: bold;');
});
}
// --------------------------------------------------
// --- STYLE ---
// --------------------------------------------------
// Appende in <head> l'elemento <style> con id FHT-style quindi include il CSS
function initStyle(){
// Attendo il tram
if (!document.head){
setTimeout(initStyle, 10);
return;
}
var s = document.getElementById('FHT-style');
if (!s){
s = document.createElement('style');
s.type = 'text/css';
s.id = 'FHT-style';
document.head.appendChild(s);
}
aggiornaStyle(css(paginaCorrente));
delete css.noTransition;
}
function aggiornaStyle(strCSS){
var s = document.getElementById('FHT-style');
if (s) s.innerHTML = strCSS;
}
// Restituisce una stringa di codice CSS, costruita secondo le sezioni specificate
function css(sezioni){
// [sezioni]: [str] valori separati da spazi. Il css restituito comprenderà le sezioni specificate, oltre alle regole generali
var sez = sezioni ? sezioni.split(' ').reduce(function(obj, v){
obj[v] = true;
return obj;
}, {}) : {};
var schemaColore = impostazioni('schemaColore');
var rimuoviTopBar = impostazioni('rimuoviTopBar') === '1';
var copiaCodice = impostazioni('copiaCodice') === '1';
var riportaQuotato = impostazioni('riportaQuotato') === '1';
var visualizzazioneCompatta = impostazioni('visualizzazioneCompatta') === '1';
var pagineConEditor = !!(sez.showthread || sez.private || sez.newthread || sez.editpost);
return (
// RESET BOX-MODEL
'html.FHT-toolset *,'+
'html.FHT-toolset *::before,'+
'html.FHT-toolset *::after {box-sizing: border-box !important}'+
'.wrapper {max-width: 1014px !important}'+
'.forumbit_post .foruminfo .forumdata .datacontainer {width: 100% !important}'+
// ------------------------------------
// PULSANTE IMPOSTAZIONI
'#FHT-btn-impostazioni {'+
' position: absolute;'+
' right: 10px;'+
' width: 32px;'+
' height: 32px;'+
' padding: 4px;'+
' border: 0;'+
' background: none;'+
' cursor: pointer;'+
'}'+
'.FHT-init-fade {'+
' opacity: 0;'+
'}'+
'#FHT-btn-impostazioni::before {'+
' content: "";'+
' display: block;'+
' width: 100%;'+
' height: 100%;'+
' border-radius: 100%;'+
' outline: 5px solid hsla(0, 0%, 100%, 0);'+
' background: #ffde03 center/90% no-repeat'+
' url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pg0KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4NCjwhLS1HZW5lcmF0b3I6IFhhcmEgRGVzaWduZXIgKHd3dy54YXJhLmNvbSksIFNWRyBmaWx0ZXIgdmVyc2lvbjogNi4wLjAuNC0tPg0KPHN2ZyBzdHJva2Utd2lkdGg9IjAuNTAxIiBzdHJva2UtbGluZWpvaW49ImJldmVsIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgb3ZlcmZsb3c9InZpc2libGUiIHdpZHRoPSIyNHB0IiBoZWlnaHQ9IjI0cHQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+DQogPGRlZnM+DQoJPC9kZWZzPg0KIDxnIGlkPSJEb2N1bWVudCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJibGFjayIgZm9udC1mYW1pbHk9IlRpbWVzIE5ldyBSb21hbiIgZm9udC1zaXplPSIxNiIgdHJhbnNmb3JtPSJzY2FsZSgxIC0xKSI+DQogIDxnIGlkPSJTcHJlYWQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTI0KSI+DQogICA8ZyBpZD0iTGF5ZXIgMSI+DQogICAgPHBhdGggZD0iTSAwLDEyIEMgMCwxOC42MjQgNS4zNzYsMjQgMTIsMjQgQyAxOC42MjQsMjQgMjQsMTguNjI0IDI0LDEyIEMgMjQsNS4zNzYgMTguNjI0LDAgMTIsMCBDIDUuMzc2LDAgMCw1LjM3NiAwLDEyIFoiIGZpbGw9IiNmZmRlMDMiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2Utd2lkdGg9IjAuMTA3IiBtYXJrZXItc3RhcnQ9Im5vbmUiIG1hcmtlci1lbmQ9Im5vbmUiIHN0cm9rZS1taXRlcmxpbWl0PSI3OS44NDAzMTkzNjEyNzc1Ii8+DQogICAgPHBhdGggZD0iTSAxMS40NzYsMS41MzcgTCA3LjI2NCwyLjY1MSBDIDcuMDc0LDIuNzAxIDYuOTU1LDIuODkxIDYuOTkyLDMuMDg1IEwgNy41MjEsNS44MjQgTCA3LjE0NSw2LjEwNSBDIDYuOTU3LDYuMjYgNi43NzYsNi40MjYgNi42LDYuNjAyIEMgNi40MzcsNi43NjUgNi4yODIsNi45MzQgNi4xMzYsNy4xMDcgTCA1Ljg3NCw3LjQ0OSBMIDMuMTAxLDYuOTUxIEMgMi45MSw2LjkxNiAyLjcyMyw3LjAzNCAyLjY3Miw3LjIyMiBMIDEuNTM5LDExLjQyNyBDIDEuNDg5LDExLjYxNyAxLjU5MywxMS44MTQgMS43NzgsMTEuODc5IEwgNC40MTIsMTIuNzg5IEwgNC40NjQsMTMuMjM1IEMgNC41NCwxMy42OTcgNC42NTksMTQuMTU0IDQuODE5LDE0LjU5OCBMIDQuOTk4LDE1LjAyOCBMIDMuMTc5LDE3LjE4MSBDIDMuMDUzLDE3LjMyOSAzLjA2MiwxNy41NDkgMy4yLDE3LjY4NyBMIDYuMjczLDIwLjc3NCBDIDYuNDExLDIwLjkxNCA2LjYzNSwyMC45MjMgNi43ODQsMjAuNzkzIEwgOC44OTEsMTguOTY2IEwgOS4zMTMsMTkuMTQ3IEMgOS43NTUsMTkuMzEzIDEwLjIxLDE5LjQzNiAxMC42NzEsMTkuNTE3IEwgMTEuMTIyLDE5LjU3NSBMIDEyLjA3NSwyMi4yMjYgQyAxMi4xNCwyMi40MDkgMTIuMzM2LDIyLjUxMSAxMi41MjQsMjIuNDYxIEwgMTYuNzM1LDIxLjM0NyBDIDE2LjkyNSwyMS4yOTcgMTcuMDQ1LDIxLjEwNyAxNy4wMDcsMjAuOTEzIEwgMTYuNDc5LDE4LjE3MyBMIDE2Ljg1NCwxNy44OTIgQyAxNy4wNDIsMTcuNzM4IDE3LjIyMywxNy41NzQgMTcuMzk4LDE3LjM5OSBDIDE3LjU2MywxNy4yMzQgMTcuNzE3LDE3LjA2NSAxNy44NjIsMTYuODg5IEwgMTguMTI1LDE2LjU0NiBMIDIwLjg5NywxNy4wNDYgQyAyMS4wODksMTcuMDgxIDIxLjI3NiwxNi45NjQgMjEuMzI2LDE2Ljc3NiBMIDIyLjQ1OSwxMi41NyBDIDIyLjUwOSwxMi4zNzkgMjIuNDA1LDEyLjE4MiAyMi4yMiwxMi4xMTggTCAxOS41ODUsMTEuMjA2IEwgMTkuNTMzLDEwLjc2MSBDIDE5LjQ1OCwxMC4yOTkgMTkuMzM5LDkuODQzIDE5LjE3OSw5LjM5OCBMIDE5LjAwMSw4Ljk2OCBMIDIwLjgyLDYuODE4IEMgMjAuOTQ2LDYuNjcgMjAuOTM3LDYuNDUgMjAuNzk5LDYuMzEyIEwgMTcuNzI2LDMuMjI1IEMgMTcuNTg3LDMuMDg1IDE3LjM2NCwzLjA3NiAxNy4yMTUsMy4yMDUgTCAxNS4xMDcsNS4wMzEgTCAxNC42ODYsNC44NSBDIDE0LjI0Myw0LjY4NSAxMy43ODksNC41NjEgMTMuMzI4LDQuNDggTCAxMi44NzgsNC40MjIgTCAxMS45MjUsMS43NzIgQyAxMS44NTksMS41ODkgMTEuNjY0LDEuNDg3IDExLjQ3NiwxLjUzNyBaIE0gMTQuNTg1LDkuNDE0IEMgMTYuMDEzLDEwLjg0MSAxNi4wMTMsMTMuMTU5IDE0LjU4NSwxNC41ODYgQyAxMy4xNTgsMTYuMDE0IDEwLjg0LDE2LjAxNCA5LjQxMywxNC41ODYgQyA3Ljk4NSwxMy4xNTkgNy45ODUsMTAuODQxIDkuNDEzLDkuNDE0IEMgMTAuODQsNy45ODYgMTMuMTU4LDcuOTg2IDE0LjU4NSw5LjQxNCBaIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMC41IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiMwMDAwMDAiIG1hcmtlci1zdGFydD0ibm9uZSIgbWFya2VyLWVuZD0ibm9uZSIgc3Ryb2tlLW1pdGVybGltaXQ9Ijc5Ljg0MDMxOTM2MTI3NzUiLz4NCiAgIDwvZz4NCiAgPC9nPg0KIDwvZz4NCjwvc3ZnPg0K);'+
' transform: rotate(1deg);'+
' transition: transform .5s ease-in-out;'+
'}'+
'#FHT-btn-impostazioni:hover::before {'+
' outline-color: hsla(0, 0%, 100%, .2);'+
' transform: rotate(180deg);'+
'}'+
'.trends--section .trends-section__container {'+
' width: calc(100% - 158px - 36px) !important;'+
'}'+
'.trends--section .trendsSlider-nav.trendsSlider__next {'+
' right: calc(10px + 36px) !important;'+
'}'+
// PANNELLO IMPOSTAZIONI - Overlay wrapper
'body.FHT-overlay {'+
' overflow: hidden;'+
'}'+
'body.FHT-overlay > :not(#FHT-overlay) {'+
' user-select: none;'+
' pointer-events: none;'+
'}'+
'#FHT-overlay * {'+
' box-sizing: border-box !important;'+
'}'+
'#FHT-overlay {'+
' user-select: none;'+
' display: flex;'+
' justify-content: center;'+
' align-items: center;'+
' position: fixed;'+
' top: 0;'+
' right: 0;'+
' bottom: 0;'+
' left: 0;'+
' z-index: 9999;'+
' font: 100 14px/1.1 Calibri, Arial, sans-serif;'+
' background-color: rgba(0, 0, 0, .7);'+
' opacity: 0;'+
'}'+
'#FHT-overlay.aperto {'+
' opacity: 1;'+
'}'+
'#FHT-overlay > .FHT-overlay-content {'+
' display: flex;'+
' flex-direction: column;'+
' width: 600px;'+
' height: 400px;'+
' max-width: 100%;'+
' max-height: 100%;'+
' border: 1px solid rgba(125, 125, 125, .4);'+
' border-radius: 5px;'+
' color: #000;'+
' background-color: #f9f9f9;'+
' box-shadow: 0 0 40px rgba(0, 0, 0, .9);'+
' overflow: hidden;'+
'}'+
'#FHT-overlay > .FHT-overlay-content > .FHT-overlay-header {'+
' position: relative;'+
' min-height: 30px;'+
' padding: 6px 8px;'+
' border-bottom: 1px solid rgba(125, 125, 125, .4);'+
' background-color: #e6e6e6;'+
'}'+
'#FHT-overlay > .FHT-overlay-content > .FHT-overlay-header > h2 {'+
' margin: 0;'+
' padding: 0;'+
' font: inherit !important;'+
' font-size: 1.1em !important;'+
' color: inherit !important;'+
'}'+
'#FHT-overlay > .FHT-overlay-content > .FHT-overlay-header > .FHT-overlay-close {'+
' display: flex;'+
' justify-content: center;'+
' align-items: center;'+
' position: absolute;'+
' top: 2px;'+
' right: 2px;'+
' width: 25px;'+
' height: 25px;'+
' font-size: 25px;'+
' font-weight: normal;'+
' line-height: 0;'+
' color: #aaa;'+
' cursor: pointer;'+
' background: transparent;'+
' border: 0;'+
' border-radius: 6px;'+
'}'+
'#FHT-overlay > .FHT-overlay-content > .FHT-overlay-header > .FHT-overlay-close:hover {'+
' color: #fff;'+
' background-color: rgba(255, 0, 0, .7);'+
'}'+
'#FHT-overlay > .FHT-overlay-content > .FHT-overlay-body {'+
' flex: auto;'+
' padding: 12px;'+
' overflow: auto;'+
'}'+
'#FHT-overlay > .FHT-overlay-content > .FHT-overlay-footer {'+
' margin: 0 8px;'+
' padding: 4px;'+
' border-top: 1px solid rgba(125, 125, 125, .4);'+
'}'+
'#FHT-overlay > .FHT-overlay-content > .FHT-overlay-footer:empty {'+
' display: none;'+
'}'+
// PANNELLO IMPOSTAZIONI - Contenuti
'.FHT-overlay-body > fieldset {'+
' display: flex;'+
' flex-direction: column;'+
' margin-top: 10px;'+
' padding: 5px;'+
' border: 1px solid rgba(125, 125, 125, .7);'+
' border-radius: 4px;'+
'}'+
'.FHT-overlay-body > fieldset > legend {'+
' margin-left: 10px;'+
' padding: 0 6px;'+
' color: #f37000'+
'}'+
'.FHT-overlay-body > fieldset > label {'+
' padding: 1px 0;'+
' height: 32px;'+
'}'+
'.FHT-overlay-body > fieldset > label > input {'+
' margin: 8px;'+
'}'+
'.FHT-overlay-body > fieldset > label:hover {'+
' background-color: rgba(125, 125, 125, .2);'+
'}'+
css.scrollbarSottile('.FHT-scrollbar-thin')+
// ------------------------------------
// REGOLE COMUNI (per la maggior parte delle pagine)
'html.FHT-toolset > body {margin-top: 0 !important; padding-top: 90px}'+
'html.FHT-toolset > body {display: flex; flex-direction: column; min-height: 100vh}'+
'html.FHT-toolset > body > .body-wrapper {flex: 1; width: 100%}'+
'html.FHT-toolset, html.FHT-toolset > body {background: #f8faff !important}'+
'body > .body-wrapper > .wrapper.container {border-radius: 8px; box-shadow: 0 4px 15px 0 rgba(88, 106, 153, .2)}'+
'body > .body-wrapper > .wrapper.container {border-radius: 8px; box-shadow: 0 4px 15px 0 rgba(88, 106, 153, .2)}'+
'.notices li {box-shadow: none !important}'+
'.front-page__trends {background-color: #21253a !important}'+
'.header {overflow: hidden}'+
'#pagetitle {background-color: #fff !important}'+
'.dropdown {background-image: none !important}'+
'#announcements {display: flex}'+
'.announcements .announcerow,'+
'.newcontent_textcontrol {-moz-box-shadow: none !important; -webkit-box-shadow: none !important; box-shadow: none !important}'+
'.breadcrumb .floatcontainer {margin: 0 !important}'+
'.body_wrapper > .toolsmenu {display: flex; float: none !important;}'+
'.body_wrapper > .toolsmenu,'+
'#above_searchresults,'+
'.body_wrapper > .navlinks {background: #eff1fb !important; border: 1px solid #cecece !important}'+
'html.FHT-toolset a.username > :hover,'+
'html.FHT-toolset a.username.active,'+
'html.FHT-toolset a.username:hover {color: #1ea6d8 !important}'+
'.postrow,.postrow blockquote {overflow: visible !important}'+
'.rules_link {width: auto !important}'+
'#navbar_username, #navbar_password {'+
' font-size: 16px !important;'+
' border-radius: 6px !important;'+
' color: #000 !important;'+
' caret-color: #000 !important;'+
' -webkit-text-fill-color: #000 !important;'+
' background-color: #fff !important;'+
' -webkit-box-shadow: 0 0 0 30px #fff inset !important;'+
'}'+
'.forum_info .options_block .options_correct,'+
'.thread_info .options_block .options_correct,'+
'.forum_info .options_block2 .options_correct,'+
'.thread_info .options_block2 .options_correct {margin-right: 0 !important}'+
'.postbit, .postbitlegacy, .eventbit, .formcontrols {border: 0 !important}'+
'.memberaction_body.popupbody {box-shadow: 0px 4px 12px rgb(0 0 0 / 35%) !important}'+
'#navpopup {padding: 5px !important}'+
// Barra login
'.login--section {background-color: #34384a}'+
'.login--section .container {display: flex; justify-content: start; padding: 0 10px !important}'+
'.login--section .container > div {width: auto !important}'+
'.login--section .container > :last-child {margin: 0 0 0 auto !important}'+
'.login--section-logged__list .chosen-select {cursor: pointer}'+
// Lista discussioni
// Righe
'.threadbit > * {background-image: none !important; display: flex !important}'+
// Righe in evidenza
'html.FHT-toolset .threadbit .sticky {background: #e6f0f9 !important}'+
// Righe selezionate per moderazione
'.threadbit.imod_highlight .deleted,'+
'html.FHT-toolset .threadbit.imod_highlight .sticky,'+
'.threadbit.imod_highlight .nonsticky,'+
'.threadbit.imod_highlight .discussionrow,'+
'.threadbit.imod_highlight .alt,'+
'.threadbit.imod_highlight .ignored {background-color: #FFEB90 !important;}'+
// Colonne
'.threadbit > * > * {display: flex; align-items: center}'+
// Alternanza colonne
'.threadbit .alt {background: #f2f6f8 !important; background: rgba(0, 85, 119, .05) !important}'+
// Colonna posted in
'.threadbit .threadpostedin {margin-left: auto; overflow: hidden}'+
// Colonna stats
'.threadbit .threadstats {word-wrap: normal !important}'+
// Colonna mod (checkbox)
'.threadbit .threadimod {display: flex; align-items: center; justify-content: center; min-width: 24px; margin-left: auto;}'+
'.threadbit .threadimod > input {position: static !important; margin: 0 !important}'+
// Navigazione veloce
'.navpopupmenu {width: 100%; background: #f6f6f6; padding: 10px 5px !important}'+
// Paginazione
'.pagination span {margin: 0 !important}'+
'.pagination span a {outline: 1px solid #c5c5e8 !important; margin: 0 !important}'+
'.pagination span a:hover {color: #1ea6de !important; border-bottom: 1px solid #1ea6de !important; background-color: #ffffff !important}'+
// Barra intestazione blocchi
'#forums .forumhead, div.collapse,'+
'#forumbits > .forumhead,'+
'#forum_icon_legend > h5,'+
'#threaded_view > h4,'+
'html.FHT-toolset .blockhead,'+
'html.FHT-toolset .posthead,'+
'html.FHT-toolset .eventhead,'+
'html.FHT-toolset .searchlisthead,'+
'html.FHT-toolset .threadlisthead {background: #707277 none !important; border-color: transparent !important; margin: 0 !important}'+
'html.FHT-toolset .blockhead > a,'+
'html.FHT-toolset .blockhead > a:hover,'+
'html.FHT-toolset .blockhead > a > span:hover,'+
'html.FHT-toolset .blockhead > h2 {color: #fff}'+
'#pollinfo .blockhead {background-color: #d4d4d4 !important}'+
'.blockhead a.collapse, .forum_info a.collapse {top: 6px !important; z-index: 1}'+
css.transitionPreset(
'html.FHT-toolset > body, .header, .header__menu, .header__menu nav .opener, .header__logo img, #main_search, .trends--section, body > .body-wrapper > .wrapper.container, .body_wrapper, .forumbit_post .forumrow,'+
'.forumbit_nopost .forumbit_nopost .forumrow, .body_wrapper > .toolsmenu, #above_searchresults, #forums .forumhead, .forumhead, #navbar, #welcomemessage, #announcements, #pagetitle > p.description, #pagetitle,'+
'#pagetitle > h1, .wgo_block, .body_wrapper > .navlinks, .login--section .chosen-container-single .chosen-single, .trends--section'
)+
css.transitionPreset('.login--section, .login--section .btn', 'background 0s')+
css.transitionPreset('.trends--section .trends-section__container a, .login--section-logged__title label a', 'color 0s, background 0s')+
(visualizzazioneCompatta ?
'html.FHT-toolset > body {padding-top: 30px}'+
'.header,'+
'.header__menu,'+
'.header__menu nav .opener {max-height: 30px}'+
'.header__logo img {margin-top: 0 !important; height: 40px !important}'+
'#main_search {padding: 0 12px !important}'+
'.trends--section {padding: 0 16px !important}'+
'body > .body-wrapper > .wrapper.container {padding: 4px 8px 10px !important}'+
'.body_wrapper,'+
'.forumbit_post .forumrow,'+
'.forumbit_nopost .forumbit_nopost .forumrow {min-height: auto}'+
'.body_wrapper > .toolsmenu,'+
'#above_searchresults,'+
'#forums .forumhead, .forumhead, #navbar,'+
'#welcomemessage, #announcements,'+
'#pagetitle > p.description {margin: 0 !important}'+
'#pagetitle > h1 {padding: 0 !important; font-size: 19px !important}'+
'#pagetitle {margin: 0 !important; padding: 0 0 2px 5px !important}'+
'.wgo_block,'+
'.body_wrapper > .navlinks {margin: 2px 0 !important}'+
'.login--section-logged__title label a {font-size: 14px !important;}'+
'.login--section {padding: 2px 0 !important}'+
'.login--section .btn {padding: 4px !important; font-size: 14px !important; font-weight: normal !important; border-radius: 4px;}'+
'.login--section .chosen-container-single .chosen-single {padding: 2px 28px 2px 7px !important}'+
'.trends--section {padding: 4px 16px !important;}'+
'.trends--section .trends-section__container a {padding: 0 6px !important; font-size: 12px !important;}'+
'':
'.header,'+
'.header__menu,'+
'.header__menu nav .opener {max-height: 90px}'+
'body > .body-wrapper > .wrapper.container {padding: 5px 8px 10px !important}'+
'.forumbit_post .forumrow,'+
'.forumbit_nopost .forumbit_nopost .forumrow {min-height: 59px !important}'+
'.body_wrapper > .toolsmenu, #above_searchresults {margin: 5px 0 0 !important}'+
'#welcomemessage {margin-bottom: 22px}'+
'#pagetitle {margin: 0 !important; padding: 5px !important}'+
'.body_wrapper > .navlinks {margin: 15px 0 !important}'+
'')+
(rimuoviTopBar ?
'html.FHT-toolset > body {padding-top: 0}'+
'header.header {max-height: 0; opacity: 0}'+
'':'')+
// ------------------------------------
// REGOLE PER SPECIFICI TIPI DI PAGINE
// ------------------------------------
// PAGINE IN CUI E' PRESENTE L'EDITOR
(pagineConEditor ?
// BLOCCO CODICE E STRUMENTO "COPIA CODICE"
'.bbcode_container {'+ // <- NOTA: questa classe è usata anche per altri contenitori non "code", ad es. "quote"
' position: relative;'+
' margin: 12px 0 !important;'+
' padding-top: 12px !important;'+
'}'+
'.bbcode_container::before {'+
' content: "";'+
' pointer-events: none;'+
' border: 1px solid #c4c8e7;'+
' border-radius: 8px;'+
' display: block;'+
' position: absolute;'+
' top: 29px;'+
' right: 0;'+
' bottom: -4px;'+
' left: 0;'+
' background: #faf7f2;'+
' visibility: hidden;'+ // <- Tengo nascosto sui contenitori non "code"
' opacity: 0;'+
'}'+
'.bbcode_container.FHT-code-container::before {'+
' visibility: visible;'+ // <- Visualizzo solo per ".FHT-code-container" (classe aggiunta via script)
' opacity: 1;'+
'}'+
'.bbcode_container > .bbcode_code {'+
' position: relative;'+
' z-index: 1;'+
' border: 0 !important;'+
' margin: 4px !important;'+
' padding: 4px!important;'+
' background: none !important;'+
' max-height: 500px;'+
'}'+
// FIX: i blocchi di codice sono formattati runtime attraverso un plugin dopo il caricamento della pagina. Questo crea un fastidioso scatto
// dovuto all'ingombro dei contenuti che varia dopo la formattazione. Risolvo fissando il valore di line-height
'.bbcode_container > .bbcode_code,'+
'.bbcode_container > .prettyprint.theme-balupton {'+
' line-height: 15px;'+
'}'+
css.scrollbarSottile('.bbcode_container > .bbcode_code')+
'.bbcode_container .prettyprint {'+
' width: auto;'+
'}'+
'.bbcode_container > .bbcode_description {'+
' position: relative;'+
' z-index: 2;'+
' overflow: visible;'+
'}'+
'.bbcode_container > .bbcode_description::after {'+
' content: "Codice copiato";'+
' display: block;'+
' position: absolute;'+
' bottom: -1.2em;'+
' width: 100%;'+
' pointer-events: none;'+
' text-align: center;'+
' font: bolder 2em sans-serif;'+
' color: #fff;'+
' text-shadow: 0 0 3px #025;'+
' opacity: 0;'+
'}'+
'.bbcode_container.FHT-codecopied > .bbcode_description::after {'+
' opacity: 1;'+
'}'+
'.bbcode_container.FHT-codecopied > .bbcode_code {'+
' opacity: .6;'+
'}'+
'.bbcode_container.FHT-codecopied > .bbcode_code,'+
'.bbcode_container.FHT-codecopied::before {'+
' background-color: #a3e2fc;'+
'}'+
'.FHT-btn-copycode {'+
(copiaCodice ? '' : 'display: none;')+
' position: absolute;'+
' top: -3px;'+
' right: 4px;'+
' padding: 0 .5em 0 1.9em;'+
' font: 200 13px/1.2 Calibri, Arial, sans-serif;'+
' color: #0074e8;'+
' border: 1px solid #aaa;'+
' border-radius: 1em;'+
' background: #f5f5ff .5em center/1em no-repeat'+
' url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiB3aWR0aD0iMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHJlY3QgZmlsbD0ibm9uZSIgaGVpZ2h0PSIxMyIgcng9IjIiIHJ5PSIyIiBzdHJva2U9IiMwMDAiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIiB3aWR0aD0iMTMiIHg9IjkiIHk9IjkiLz48cGF0aCBkPSJNNSAxNUg0YTIgMiAwIDAgMS0yLTJWNGEyIDIgMCAwIDEgMi0yaDlhMiAyIDAgMCAxIDIgMnYxIiBmaWxsPSJub25lIiBzdHJva2U9IiMwMDAiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIi8+PC9zdmc+);'+
' cursor: pointer;'+
'}'+
'.bbcode_container:not(.FHT-code-container) > .bbcode_description > .FHT-btn-copycode {'+
' opacity: 0;'+ // <- Questo è lo stato iniziale per poter creare un effetto fade. La classe ".FHT-code-container" viene infatti applicata da script in modo differito
'}'+
'.FHT-btn-copycode:hover {'+
' color: #2497f3;'+
' background-color: #fff;'+
'}'+
// TOOLTIP RIPORTA TESTO SELEZIONATO COME QUOTE
'#FHT-tooltip-reply {'+
' will-change: top, right;'+
' display: '+ (riportaQuotato ? 'flex' : 'none') +';'+
' user-select: none;'+
' align-items: center;'+
' position: absolute;'+
' z-index: 90;'+
' padding: 3px 8px;'+
' font: 200 13px/1.1 Calibri, Arial, sans-serif;'+
' border: 1px solid;'+
' border-radius: 7px 0 7px 7px;'+
' cursor: pointer;'+
' border-color: #3d3e40;'+
' color: #0074e8;'+
' background: #fff;'+
'}'+
'#FHT-tooltip-reply:hover {'+
' color: #00a1ff;'+
' border-color: #2497f3;'+
' background: #f5fbff;'+
'}'+
'#FHT-tooltip-reply::before {'+
' content: "“";'+
' margin: -5px 6px 0 -6px;'+
' height: .35em;'+
' overflow: hidden;'+
' font: bold 40px/.8 Georgia, serif;'+
' color: #595a57;'+
' opacity: .4;'+
'}'+
'#FHT-tooltip-reply:hover::before {'+
' color: #2497f3;'+
'}'+
'#FHT-tooltip-reply:not(.FHT-tooltip-aperto) {'+
' opacity: 0;'+
' pointer-events: none;'+
'}'+
// FIX: quando si seleziona con triplo-click l'ultima riga di un post, il tooltip non compare perché la selezione va oltre il target valido.
// Risolvo inserendo da script un elemento fittizio a fine post.
'.postbitlegacy .postrow span.FHT-fine-post {'+
' position: absolute;'+
'}'+
'':'')+ // <- pagineConEditor
// ------------------------------------
// - HOME
(sez.home ?
'.forumbit_post .forumrow {background: #fbfbfb !important}'+
'':'')+ // <- home
// ------------------------------------
// - LOGIN
(sez.login ?
'':'')+ // <- login
// ------------------------------------
// - FORUMDISPLAY
(sez.forumdisplay ?
'.forumbit_nopost .forumbit_nopost .forumrow,'+
'.threadbit .nonthread,'+
'.forumbit_post .forumrow {background: #fbfbfb !important}'+
'#above_threadlist, #below_threadlist {background: #f6f6f6}'+
'#above_threadlist, #below_threadlist {display: flex; justify-content: space-between; align-items: start; float: none !important; height: auto !important}'+
'.newcontent_textcontrol {position: static !important; float: left !important; margin: 0 !important; white-space: nowrap}'+
'#above_threadlist > .threadpagenav,'+
'#below_threadlist > .threadpagenav {position: static !important; float: right !important; width: auto !important; clear: none !important; margin: 5px 0 0 auto !important}'+
'.forumfoot {position: static !important; height: auto !important; padding: 0 !important; display: flex !important; justify-content: end;}'+
'#inlinemod_formctrls .popupctrl {position: static !important}'+
'#thread_inlinemod_form {display: flex; flex-direction: column}'+
'.pagination, .pagination span {margin: 0 !important}'+
'.threadbit .pagination {position: absolute !important; margin-left: 0.5em !important;}'+
'.forum_info .options_block,'+
'.thread_info .options_block,'+
'.forum_info .options_block2,'+
'.thread_info .options_block2 {width: calc(50% - 2.5px) !important; padding-right: 0 !important; margin-right: 0 !important}'+
'.forum_info .options_block2,'+
'.thread_info .options_block2 {margin-left: 5px !important}'+
'#forumbits > .forumhead > h2 {color: #fff !important}'+
'#forum_info_options {top: 0 !important}'+
'.prefix.understate {color: #7e3bff; font-variant: small-caps}'+
// Colonna stats
'.threadbit .threadstats {width: 12% !important; min-width: 12%; word-wrap: normal !important}'+
css.transitionPreset(
'#pagetitle .description, #above_threadlist, #below_threadlist, #below_threadlist > .threadpagenav,'+
'#forumdisplay_navpopup, .forumbits, #above_threadlist_controls, #threadlist, .forumfoot'
)+
(visualizzazioneCompatta ?
'#above_threadlist, #below_threadlist {margin: 0 !important; padding: 2px 5px !important}'+
'#below_threadlist > .threadpagenav {padding: 0 !important}'+
'#forumdisplay_navpopup {margin: 0 !important}'+
'#pagetitle .description,'+
'.forumbits, #above_threadlist_controls,'+
'#threadlist {margin: 0 !important}'+
'.forumfoot {margin: 2px 0 !important;}'+
'':
'#above_threadlist, #below_threadlist {margin: 5px 0 0 !important; padding: 5px !important}'+
'#pagetitle .description {margin: 0 0 22px !important}'+
'#threadlist {margin: 5px 0 0 !important}'+
'.forumfoot {margin: 10px 0 !important}'+
'')+
'' : '')+ // <- forumdisplay
// ------------------------------------
// - SHOWTHREAD
(sez.showthread ?
'#above_postlist, #below_postlist {background: #f6f6f6}'+
'#above_postlist, #below_postlist {display: flex; justify-content: space-between; align-items: start; float: none !important; height: auto !important}'+
'.newcontent_textcontrol {position: static !important; float: left !important; margin: 0 !important; white-space: nowrap}'+
'#pagination_top, #pagination_bottom {position: static !important; float: right !important; width: auto !important; clear: none !important}'+
'#pagination_top {margin-top: 10px !important}'+
'#pagination_bottom {width: auto !important; float: right; margin-top: 0 !important; margin-left: auto}'+
'.postbit, .postbitlegacy, .eventbit, .formcontrols,'+
'.postbitdeleted, .postbitignored {border: 0 !important}'+
'#posts {margin: 0 !important}'+
'.eventbit .eventhead {margin: 0 !important}'+
'.postlistfoot {position: static !important; height: auto !important; padding: 0 !important; display: flex !important; justify-content: end}'+
'#thread_info, #inlinemod_formctrls .popupctrl {position: static !important}'+
'#newreplylink_bottom {position: static !important; float: left; margin-top: 2px !important}'+
'.separator {clear: both}'+
'.cke_button a.restoretext,'+
'.cke_button a.restoretext:hover {color: #0057c3 !important; text-decoration: none !important}'+
'.postbitdeleted .nodecontrols,'+
'.postbitignored .nodecontrols {height: auto !important}'+
// Quando è attiva la modalità elencata/ibrida delle discussioni
'#posttree {border: 0 !important}'+
'#threaded_view {background: #f4f4f4}'+
'#posttree .poston {box-shadow: 0 0 0 1px #d0daed}'+
'#posttree > div {display: flex; height: 23px; align-items: center}'+
'#posttree > div > :not(img) {margin-left: .5em}'+
css.transitionPreset(
'#above_postlist, #below_postlist, .newcontent_textcontrol, .navpopupmenu, .postbit, .postbitlegacy,'+
'.eventbit, #postlist, .vbform, .wysiwyg_block, .thread_info h4, .postlistfoot'+
''
)+
(visualizzazioneCompatta ?
'#above_postlist, #below_postlist {margin: 0 !important; padding: 2px 5px !important}'+
'.newcontent_textcontrol {margin: 0 5px !important}'+
':not(#pagination_bottom) > .navpopupmenu,'+
'.postbit, .postbitlegacy, .eventbit,'+
'#postlist,'+
'.vbform, .wysiwyg_block, .thread_info h4 {margin: 0 !important}'+
'.postlistfoot {margin: 2px 0 !important}'+
'#pollinfo {margin: 3px 50px !important}'+
'':
'#above_postlist, #below_postlist {margin: 5px 0 0 !important; padding: 5px !important}'+
'#postlist, {margin: 5px 0 0 !important}'+
'.postlistfoot {margin: 10px 0 !important}'+
':not(#pagination_bottom) > .navpopupmenu {margin: 5px 0 0 !important}'+
'#pollinfo {margin: 8px 50px !important}'+
'')+
'':'')+ // <- showthread
// ------------------------------------
// - ANNOUNCEMENT
(sez.announcement ?
'#announcementlist {margin: 0 !important}'+
// Navigazione veloce
'#navpopup {margin: 10px 0 !important}'+
css.transitionPreset('#annoucements_navpopup')+
(visualizzazioneCompatta ?
'#annoucements_navpopup {margin: 0 !important}'+
'':
'#annoucements_navpopup {margin: 5px 0 !important}'+
'')+
'':'')+ // <- announcement
// ------------------------------------
// - STAFF
(sez.staff ?
'html.FHT-toolset .groupbit .blockfoot {margin: 2px 0 !important; padding: 0 !important}'+
'#groups_1, #groups_2 li.block.usergroup {margin-bottom: 3em}'+
'html.FHT-toolset .groupbit {min-height: 68px !important}'+
'':'')+ // <- staff
// ------------------------------------
// - ONLINE
(sez.online ?
'.blockfootpad {background: #f6f6f6;}'+
'#above_who_online {margin: -26px 5px 5px 0 !important}'+
'#pagination_bottom {margin: 5px !important}'+
'':'')+ // <- online
// ------------------------------------
// - SEARCH, TAGS
(sez.search || sez.tags ?
'#searchtypeswitcher li:not(.selected) a {background: #707277 none !important}'+
'ul#searchtypeswitcher > li.selected a {background: #29a4e5 none !important}'+
'ul#searchtypeswitcher {border-bottom-color: #29a4e5 !important}'+
'#tag_search > .blockfoot, #tag_search > .blocksubfoot {padding: 5px !important}'+
'html.FHT-toolset .searchlisthead {box-shadow: none !important}'+
'#above_searchresults {margin: 0 !important; border: 0 !important}'+
'#above_searchresults .popupgroup {padding: 5px 0; float: right; margin-right: 10px}'+
'#above_searchresults .popupctrl {color: #4e4e4e}'+
'.searchtitle, .threadbit .threadpostedin {height: auto !important}'+
// Intestazione blocco risultati
'.searchlisthead {margin: 5px 0 !important}'+
// Colonna stats
'.threadbit .threadstats {width: 15% !important; min-width: 15%; word-wrap: normal !important}'+
// Colonna ultimo post
'.threadbit .threadlastpost dd {margin: 0 8px !important;}'+
// Barra bassa con paginazione
'#below_searchresults {float: none !important; display: flex !important; width: 100% !important; background: #f6f6f6}'+
'#below_searchresults > .pagination {margin: 0 0 0 auto}'+
// Navigazione veloce
'#navpopup {margin: 10px 0 !important}'+
// Paginazione
'#pagination_top {margin-right: 6px !important}'+
css.transitionPreset('#thread, #above_searchresults')+
(visualizzazioneCompatta ?
'#below_searchresults {margin: 2px 0 !important; padding: 5px !important}'+
'#thread {margin: 0 !important}'+
'':
'#below_searchresults {margin: 10px 0 !important; padding: 10px 5px !important}'+
'#thread {margin: 5px 0 0 !important}'+
'')+
'':'')+ // <- search, tags
// ------------------------------------
// - MEMBERLIST
(sez.memberlist ?
'#charnav {background: #f6f6f6 none !important; border: 0 !important; border-radius: 0 !important; margin: 0 !important; padding: 10px 5px !important}'+
'#charnav > dd > a {background: #fff}'+
'#charnav > dd > a:hover {background: #29a4e5 !important}'+
'#above_memberlist, #pagination_bottom {background: #f6f6f6 !important; margin: 0 !important; padding: 10px 5px !important; display: flex}'+
'#memberlist_menus {margin: 0 0 0 auto !important}'+
'#searchstats {padding: 5px !important}'+
'#memberlist .blockhead {clear: both}'+
'':'')+ // <- memberlist
// ------------------------------------
// - MEMBER
(sez.member ?
'#sidebar_container.member_summary {-moz-box-shadow: none !important; -webkit-box-shadow: none !important; box-shadow: none !important; background: #f2f2f2 none !important}'+
'.member_content #sidebar_container div.block {background: transparent none !important}'+
'#activity_tab_container, #activitylist {margin: 0 !important}'+
'#activitylist li.activitybit,'+
'li.userprof_content_border {border: 1px solid #dadada !important}'+
'.member_summary dl.stats dd {width: 50% !important}'+
'.member_summary .friends_mini .friends_list li img {height: auto !important}'+
'#friends {clear: none !important}'+
// Primo <a> per ogni scheda
'.profile_content > div > a.floatright:first-child {margin: 5px 0; padding: 3px 6px; background: #f8f8f8; border: 1px solid #dadada; border-radius: 6px;}'+
'.profile_content > div > a.floatright:first-child:hover {color: #1ea6d8 !important;}'+
css.transitionPreset('#activitylist li.activitybit, .profile_content .friends_list li, .newactivity, .moreactivity')+
(visualizzazioneCompatta ?
'#activitylist li.activitybit,'+
'.profile_content .friends_list li {margin: 2px 0 0 !important}'+
'.newactivity, .moreactivity {margin: 5px 0 0 !important}'+
'':
'#activitylist li.activitybit,'+
'.profile_content .friends_list li,'+
'.newactivity, .moreactivity {margin: 10px 0 0 !important}'+
'')+
'':'')+ // <- member
// ------------------------------------
// - USERCP
(sez.usercp ?
'':'')+ // <- usercp
// ------------------------------------
// - PRIVATE (ucp)
(sez.private ?
'#pmlist_info > div {background: #f6f6f6 !important}'+
'#above_postlist, #below_postlist {background: #f6f6f6; padding: 10px 5px !important}'+
'#pagination_top, #pagination_bottom {margin: 0 !important; padding: 0 !important}'+
'#pmfolderlist {margin: 0 !important}'+
'html.FHT-toolset .blockfoot,'+
'html.FHT-toolset .blocksubfoot {padding: 0 5px !important}'+
'.actionbuttons .group {padding: 10px !important}'+
css.transitionPreset('#pmlist_info > div, .navpopupmenu, #yui-gen3')+
(visualizzazioneCompatta ?
'#pmlist_info > div:last-child {margin: 5px 0 0 !important; padding: 2px 5px !important}'+
'.navpopupmenu {margin: 5px 0 0 !important;}'+
'#yui-gen3 {padding: 5px !important}'+
'':
'#pmlist_info > div:last-child {margin: 8px 0 0 !important; padding: 5px !important}'+
'.navpopupmenu {margin: 8px 0 0 !important;}'+
'#yui-gen3 {padding: 10px 5px !important}'+
'')+
'':'')+ // <- private
// ------------------------------------
// - SUBSCRIPTION (ucp)
(sez.subscription ?
'#jump-to-folder {margin-top: 0 !important}'+
'#above_threadlist, .groupcontrols {background: #f6f6f6; padding: 8px !important}'+
'#above_threadlist .pagination {float: right !important}'+
'#subscription_info {background: #fff}'+
'':'')+ // <- subscription
// ------------------------------------
// - PROFILE (ucp)
(sez.profile ?
'#below_postlist {background: #f6f6f6; padding: 8px !important}'+
'.permissions.formcontrols {background: #fff}'+
'.cp_content .blockfoot {padding: 5px !important}'+
'.blockfoot.actionbuttons.redirect_button {padding: 0 !important; text-align: center !important}'+
'#redirect_button {width: 100% !important; padding: 0 !important; text-align: center !important}'+
'#redirect_button > a.textcontrol {padding: 5px !important; display: block}'+
'':'')+ // <- profile
// ------------------------------------
// - CALENDAR (ucp)
(sez.calendar ?
'#above_reminders {background: #f6f6f6; padding: 8px !important; overflow: auto}'+
'#calendarpicker {background: #f6f6f6; padding: 5px !important}'+
'':'')+ // <- calendar
// ------------------------------------
// - MISC
(sez.misc ?
'.blockrow.bbcodeblock {margin: 0 !important}'+
css.transitionPreset('.block')+
(visualizzazioneCompatta ?
'.block {margin: 0 !important}'+
'':
'.block {margin: 10px 0 0 !important}'+
'')+
'':'')+ // <- misc
// ------------------------------------
// - USERNOTE
(sez.usernote ?
'':'')+ // <- usernote
// ------------------------------------
// - POLL
(sez.poll ?
'':'')+ // <- poll
// ------------------------------------
// - SHOEGROUPS
(sez.showgroups ?
// Navigazione veloce
'.navpopupmenu {margin: 0 !important}'+
'#groups_1, .blockfoot {margin: 0 !important}'+
css.transitionPreset('.block')+
(visualizzazioneCompatta ?
'.block, #showgroups_navpopup {margin: 0 !important}'+
'#showgroups_navpopup {margin: 5px 0 0 !important}'+
'':
'.block {margin: 10px 0 0 !important}'+
'#showgroups_navpopup {margin: 10px 0 0 !important}'+
'')+
'':'')+ // <- showgroups
// ------------------------------------
// INDICATORE UTENTE ONLINE
'.groupbit a.username.online,'+
'.groupbit a.username.offline,'+
'.groupbit a.username.invisible {'+
' background: initial;'+
'}'+
'img.onlinestatus {'+
' display: none;'+
'}'+
'a.username.online::after,'+
'a.username.offline::after,'+
'a.username.invisible::after {'+
' content: "";'+
' display: inline-block;'+
' width: 7px;'+
' height: 7px;'+
' margin-left: 5px;'+
' border: 1px solid #888;'+
' border-radius: 50%;'+
'}'+
'a.username.online::after {'+
' border-color: #4b4;'+
' background: #7e8;'+
' box-shadow: 0 0 2px #2b2, inset 1px 1px 3px #fff;'+
'}'+
'a.username.invisible::after {'+
' border-color: #a84;'+
' background: #fe4;'+
'}'+
// TRANSITION
'#FHT-overlay, #FHT-overlay > .FHT-overlay-content {transition: .4s ease-out !important}'+
'#FHT-btn-impostazioni {transition: opacity .3s ease-in-out}'+
'#FHT-tooltip-reply {transition: opacity .3s ease-out}'+
'.bbcode_container::before {transition: background-color 3s ease-out, opacity .7s ease-out}'+
'.bbcode_description::after,'+
'.bbcode_code {transition: opacity 3s ease-out}'+
'.bbcode_container.FHT-codecopied::before,'+
'.bbcode_container.FHT-codecopied > .bbcode_description::after,'+
'.bbcode_container.FHT-codecopied > .bbcode_code {transition-duration: .2s}'+
'#FHT-overlay > .FHT-overlay-content *,'+
'.FHT-btn-copycode {transition: .2s ease-out, opacity .7s ease-out}'+
'#FHT-overlay > .FHT-overlay-content *:hover,'+
'.FHT-btn-copycode:hover {transition: 0s}'+
// SCHEMA COLORE
// "Modalità scura" automatica, applicata in base alle impostazioni di sistema
(schemaColore === 'A' ? '@media (prefers-color-scheme: dark) {' : '')+
// "Modalità scura" automatica o impostazioni da utente
(schemaColore !== 'C' ?
// REGOLE COMUNI
'html.FHT-toolset, html.FHT-toolset > body,'+
'.front-page__trends,'+
'.login--section {background-color: #171a29 !important}'+
'.wrapper.container {background-color: #505156 !important}'+
'.wrapper.container > .body_wrapper,'+
'#forums {background-color: transparent !important; background-image: none !important; border-color: transparent !important}'+
'#FHT-overlay > .FHT-overlay-content {color: #fff; background-color: #1f1f1f}'+
'#FHT-overlay > .FHT-overlay-content > .FHT-overlay-header {background-color: #353535}'+
'#navbar_username, #navbar_password {'+
' color: #fff !important;'+
' caret-color: #fff !important;'+
' -webkit-text-fill-color: #fff !important;'+
' background-color: #202438 !important;'+
' -webkit-box-shadow: 0 0 0 30px #202438 inset !important;'+
'}'+
// REGOLE PER SPECIFICI TIPI DI PAGINE
(pagineConEditor ?
'#FHT-tooltip-reply {color: #fff; background: #505156; border-color: #999}'+
'#FHT-tooltip-reply:hover {color: #fff; background: #29a4e5; border-color: #f5fbff}'+
'#FHT-tooltip-reply::before {color: #fff}'+
'#FHT-tooltip-reply:hover::before {color: #fff}'+
'':'')+
(sez.tags || sez.search?
'#postpagestats {color: #fff !important}'+
'':'')+
(sez.memberlist?
'#searchstats {color: #fff !important}'+
'':'')+
(sez.member?
'.userprof_title {color: #fff !important}'+
'':'')+
(sez.subscription ?
'.forumfoot {color: #fff !important}'+
'':'')+
(sez.private ?
'.abovepm {color: #fff !important}'+
'':'')+
'':'')+
(schemaColore === 'A' ? '}' : '')
);}
// FUNZIONI CSS
// Restituisce il css, applicato al selettore specificato, per una transizione preimpostata
css.transitionPreset = function(selettore, prop){
// [prop]: [str] proprietà aggiuntive. Se specificato, sarà aggiunto come definizione per le specifiche proprietà oltre al preset generale.
if (css.noTransition) return '';
var dichiarazione = '{transition: .4s ease-out' + (prop ? ', ' + prop : '') + ' !important}';
return selettore ? selettore + dichiarazione : '';
};
// Può capitare che il CSS sia caricato in ritardo rispetto a quello preesistente.
// Questo crea un disturbo iniziale accentuato dagli effetti di transizione.
// Per limitare il danno disabilito in prima istanza gli effetti di transizione.
css.noTransition = true;
// Dato un selettore di uno o più elementi separati da virgola, appende la parte specificata ad ognuno degli elementi e restituisce il css elaborato
css.aggiungiPerOgniSelettore = function(selettore, part){
return selettore ? selettore.replace(/(?: *(,) *)|$/g, part+'$1') : '';
};
// Restituisce il css, applicato al selettore specificato, per ottenere la scrollbar sottile
css.scrollbarSottile = function(selettore){
if (!selettore) return '';
return ''+
// -moz- style scrollbar
selettore + ' {scrollbar-width: thin}'+
// -webkit- style scrollbar
css.aggiungiPerOgniSelettore(selettore,'::-webkit-scrollbar') + '{height: 8px; width: 8px; background: rgba(2, 2, 8, .05)}'+
css.aggiungiPerOgniSelettore(selettore,'::-webkit-scrollbar-thumb') + '{background: rgba(168, 168, 168, .65)}'+
css.aggiungiPerOgniSelettore(selettore,'::-webkit-scrollbar-thumb:hover') + '{background: rgba(168, 168, 168, 1)}'+
css.aggiungiPerOgniSelettore(selettore,'::-webkit-scrollbar-thumb:active') + '{background: rgba(250, 125, 0, .7)}';
};
// --------------------------------------------------
// --- INIZIAMO! ---
// --------------------------------------------------
start();
})();