OK so. I was lost, because in previous message I saw that it is for staff members not for all members. So I wasn't sure what for it should really exist.
Now I understand (sorry if you wrote it before and had to repeat it).
Your request it too unique for your particular forum to be included in official release. So we do not plan to include it in vBET. Especially that with auto detection enabled it is really not needed and as said Albert Einstein "things should be as simple as possible, but not simpler". We think that giving such button will only confuse users who will think that they must to click it in case of writing in Catalan. And this lowers usability of forum. Simpler solutions - like just write what you want and let the system care about the rest - are better for users in our opinion.
But we can help you to add such button.
As I wrote already it will be easy if you use already existing functionality and just change the appearance of it. So vBET already knows how to wrap in lang BBCode, according to additional input from editor. All you really need is to change the look of it (we have radio button, you want just button) and include it always (we include in particular condition).
So - you already know how to add the button as shows image include in first post. What you also need is to:
1. include hidden field:
Code:
<input id="vbet_addbbcodes" type="hidden" name="vbet_postInLanguage" value="0">
2. Include simple Java Script which will set there catalan code (not tested):
Code:
<script language="javascript">
function vbet_setCatalan(){
document.getElementById("vbet_addbbcodes").setAttribute("value", "ca");
return false;
}
</script>
Please note that you can made it more complex to allow set/unset the button
3. Execute the Java Script function when button is clicked. So in your button add:
Code:
onClick="vbet_setCatalan()"
If you do not want to make more complex function (which will be able also to unset value) then you can just set function body in onClick attribute and do not include java script as function at all.
Also please note that if you want it to be user friendly you suppose to add this button as toggle button so user will know is it already turned on or not. This would be all much simpler if you would like to add there checkbox instead of button, but with button it is also possible to make it, just more complex if you want to make it right (so setting and unsetting)
Please note that the change will be visible after user commits message – so it will be used on server side.
If you want it to work on browser side, then you do not need 1st step – just Java Script function (attached to button), which will take by id (or by structure if you cannot predict editor id) editor text area and add to content opening and closing lang BBCode. In such case you also do not have to worry about any toggle button (user will just see that it is already added in editor). Just you should check it is already wrapped (does text start by lang BBCode) and ignore button click in such case (to avoid wrapping several times).
Please tell do you need more help here. If yes – please tell where particularly.