by Ange Tuteur October 5th 2015, 11:20 am
Try the following.
Go to Modules > JavaScript codes management > Create a new script
Placement : In all the pages
- Code:
$(function() {
var config = {
name : '<strong>Select your website type :</strong> ',
option : {
'Is your site a website, blog, or forum?' : 'DEFAULT',
'Website' : 'Website',
'Blog' : 'Blog',
'Forum' : 'Forum'
}
},
bloc, select, i;
if (document.post && document.post.f && document.post.f.value == 16) {
select = document.createElement('SELECT');
bloc = document.createElement('DL');
for (i in config.option) select.innerHTML += '<option value="' + config.option[i] + '">' + i + '</option>';
select.onchange = function() {
var sujet = document.post.subject;
if (this.value == 'DEFAULT') sujet.value = sujet.value.replace(/^\[.*?\]\s/, '');
else {
if (/^\[.*?\]\s/.test(sujet.value)) sujet.value = sujet.value.replace(/^\[.*?\]\s/, '');
sujet.value = '[' + this.value + '] ' + sujet.value;
}
};
bloc.innerHTML = '<dt><label>' + config.name + '</label></dt><dd></dd>';
bloc.getElementsByTagName('DD')[0].appendChild(select);
document.post.subject.parentNode.parentNode.parentNode.insertBefore(bloc, document.post.subject.parentNode.parentNode);
}
});
At the top you can change the label, and option names : values.
If any questions let me know.