I search but I didn't find what I'm looking for so here is an image of what I mean.
My forum is PhpBB3
My forum is PhpBB3
Last edited by Mati on September 21st 2015, 11:11 pm; edited 1 time in total
<span class="prefix" style="background:#FF9C47;">Rules</span>
<span class="prefix" style="background:#FF9C47;">Solved</span>
<span class="prefix" style="background:#42B4E6;">Accepted</span>
Niko wrote:Hello @Mati
You can try with this tutorial as well
https://help.forumotion.com/t134270-buttons-to-add-prefixes-in-topic-titles#903824
$(function() {
// prefixes
// syntax : 'PREFIX_NAME' : 'ADDITIONAL_ATTRIBUTES'
var prefix = {
'Prefix 1' : '',
'Prefix 2' : '',
'Prefix 3' : ''
};
// check for form and subject existence
if (document.post && document.post.subject) {
var select = document.createElement('SELECT'), // create the dropdown
i;
select.innerHTML = '<option value="none">None</option>'; // default value
// value change function
select.onchange = function() {
var subject = document.post.subject,
child = this.childNodes,
i = 0,
j = child.length,
opts = '',
reg;
if (subject) {
// setup prefix regex
for (; i < j; i++) opts += child[i].value + '|';
reg = RegExp('^(?:' + opts.replace(/[.*+?^${}()[\]\\]/g, "\\$&") + ') ');
// check and replace prefixes if necessary
if (reg.test(subject.value)) subject.value = subject.value.replace(reg, this.value == 'none' ? '' : this.value + ' ');
else subject.value = (this.value == 'none' ? '' : this.value + ' ') + subject.value;
}
};
// put together options
for (i in prefix) select.innerHTML += '<option value="[' + i + ']" ' + prefix[i] + '>[' + i + ']</option>';
document.post.subject.parentNode.appendChild(select); // add selection to form body
}
});
// par ange tuteur
var prefix = {
'Prefix 1' : '',
'Prefix 2' : '',
'Prefix 3' : ''
};
<div class="prefix1">Prefix 1</div>
<div class="prefix2">Prefix 2</div>
<div class="prefix3">Prefix 3</div>
var prefix = {
'Prefix 1' : 'class="prefix_1"',
'Prefix 2' : 'class="prefix_2"',
'Prefix 3' : 'class="prefix_3"'
};