A possible code to enable WYSIWYG mode for certain forums?
3 posters
Page 1 of 1
A possible code to enable WYSIWYG mode for certain forums?
Hi everyone,
I was wondering if it was possible to only enable WYSIWYG mode for a certain forum or certain forums, but not the whole thing. Thanks in advance
I was wondering if it was possible to only enable WYSIWYG mode for a certain forum or certain forums, but not the whole thing. Thanks in advance
Last edited by Ramdaman on Tue Sep 02, 2014 9:33 pm; edited 1 time in total
Re: A possible code to enable WYSIWYG mode for certain forums?
Hi, it is impossible for the moment on Forumotion, see the suggestions of the members on the forum. Nice day.
Re: A possible code to enable WYSIWYG mode for certain forums?
Hello Ramdaman,
This is absolutely possible with a bit of JavaScript.
Go to Administration Panel > Modules > JavaScript codes management > create a new script
Title : Your choice
Placement : In the topics
Paste the code below :
In the script is a condition :
These are the forums whose topics you'll enabled WYSIWYG mode for. Simply write : forum(n) with n being a number value, that is the forum ID. You must separate multiple forums by ||.
So for example, if you wanted to enable WYSIWYG mode in announcement, you would write :
You can see the forum ID from the address bar while viewing the forum. e.g. http://www.agg-community.com/f6-announcements = f6 - f = 6
Note :
* The forums which don't allow WYSIWYG mode by default will start in source mode
* The mode can still be switched if the source button is visible
This is absolutely possible with a bit of JavaScript.
Go to Administration Panel > Modules > JavaScript codes management > create a new script
Title : Your choice
Placement : In the topics
Paste the code below :
- Code:
$(function(){$(function(){
var editor = $('#text_editor_textarea').sceditor('instance');
if ( forum(1) || forum(2) || forum(3) ) {
if (editor.inSourceMode()) {
editor.sourceMode(false);
$('.sceditor-button-source').removeClass('hover');
$.cookie('WYSIWYG_STATE', '1', { expires: 365 });
}
}
else {
editor.sourceMode(true);
$('.sceditor-button-source').addClass('hover');
$.cookie('WYSIWYG_STATE', '0', { expires: 365 });
}
function forum(n) {return RegExp('\/f'+n+'-').test($('.topic-actions .pathname-box p a.nav:last').attr('href'))}
})});
In the script is a condition :
- Code:
if ( forum(1) || forum(2) || forum(3) )
These are the forums whose topics you'll enabled WYSIWYG mode for. Simply write : forum(n) with n being a number value, that is the forum ID. You must separate multiple forums by ||.
So for example, if you wanted to enable WYSIWYG mode in announcement, you would write :
- Code:
if ( forum(6) )
You can see the forum ID from the address bar while viewing the forum. e.g. http://www.agg-community.com/f6-announcements = f6 - f = 6
Note :
* The forums which don't allow WYSIWYG mode by default will start in source mode
* The mode can still be switched if the source button is visible
Re: A possible code to enable WYSIWYG mode for certain forums?
I have made a form as shown in the Tips and Tricks, and I wanted to have it like forumotion has it for the graphic requests. Since forumotion has enabled WYSIWYG mode in the admin panel, I was wondering if this WYSIWYG script would work with the form script. Because it currently does not show.
Code for the form JS
Code I inserted for certain forums containing WYSIWYG
I basically want the form to not be displayed with the BBBcodes in brackets but I want the BBCodes showing the design.
Code for the form JS
- Code:
$(function() {
if (location.pathname == '/post' && location.search == '?f=17&mode=newtopic') {
$('#text_editor_textarea').val('[FONT=ARIAL BLACK][B][COLOR=#3399ff]Time:[/B][COLOR=#3399ff][/COLOR][/FONT] Answer Here\n
[FONT=ARIAL BLACK][B][COLOR=#669900]In\-Game name of the player:[/B][COLOR=#669900][/COLOR][/FONT] Answer Here \n
[FONT=ARIAL BLACK][B][COLOR=#3399ff]What happened:[/B][COLOR=#3399ff][/COLOR][/FONT] Answer Here \n
[FONT=ARIAL BLACK][B][COLOR=#669900]Proof -Pictures or video-:[/B][COLOR=#669900][/COLOR][/FONT] Answer Here');
}
});
Code I inserted for certain forums containing WYSIWYG
- Code:
$(function(){$(function(){
var editor = $('#text_editor_textarea').sceditor('instance');
if ( forum(17) ) {
if (editor.inSourceMode()) {
editor.sourceMode(false);
$('.sceditor-button-source').removeClass('hover');
$.cookie('WYSIWYG_STATE', '1', { expires: 365 });
}
}
else {
editor.sourceMode(true);
$('.sceditor-button-source').addClass('hover');
$.cookie('WYSIWYG_STATE', '0', { expires: 365 });
}
function forum(n) {return RegExp('\/f'+n+'-').test($('.topic-actions .pathname-box p a.nav:last').attr('href'))}
})});
I basically want the form to not be displayed with the BBBcodes in brackets but I want the BBCodes showing the design.
Re: A possible code to enable WYSIWYG mode for certain forums?
If that's the case, remove the last script and replace your form script by :
- Code:
$$(function(){
if (location.pathname == '/post' && location.search == '?f=17&mode=newtopic') {
$('#text_editor_textarea').val('[FONT=ARIAL BLACK][B][COLOR=#3399ff]Time:[/B][COLOR=#3399ff][/COLOR][/FONT] Answer Here\n[FONT=ARIAL BLACK][B][COLOR=#669900]In\-Game name of the player:[/B][COLOR=#669900][/COLOR][/FONT] Answer Here \n[FONT=ARIAL BLACK][B][COLOR=#3399ff]What happened:[/B][COLOR=#3399ff][/COLOR][/FONT] Answer Here \n[FONT=ARIAL BLACK][B][COLOR=#669900]Proof -Pictures or video-:[/B][COLOR=#669900][/COLOR][/FONT] Answer Here');
$(function(){
var editor = $('#text_editor_textarea').sceditor('instance');
if (editor.inSourceMode()) {
editor.sourceMode(false);
$('.sceditor-button-source').removeClass('hover');
$.cookie('WYSIWYG_STATE', '1', { expires: 365 });
}
});
}
});
Re: A possible code to enable WYSIWYG mode for certain forums?
Oops, I made a typo ^^' replace your script by :
- Code:
$(function(){
if (location.pathname == '/post' && location.search == '?f=17&mode=newtopic') {
$('#text_editor_textarea').val('[FONT=ARIAL BLACK][B][COLOR=#3399ff]Time:[/B][COLOR=#3399ff][/COLOR][/FONT] Answer Here\n[FONT=ARIAL BLACK][B][COLOR=#669900]In\-Game name of the player:[/B][COLOR=#669900][/COLOR][/FONT] Answer Here \n[FONT=ARIAL BLACK][B][COLOR=#3399ff]What happened:[/B][COLOR=#3399ff][/COLOR][/FONT] Answer Here \n[FONT=ARIAL BLACK][B][COLOR=#669900]Proof -Pictures or video-:[/B][COLOR=#669900][/COLOR][/FONT] Answer Here');
$(function(){
var editor = $('#text_editor_textarea').sceditor('instance');
if (editor.inSourceMode()) {
editor.sourceMode(false);
$('.sceditor-button-source').removeClass('hover');
$.cookie('WYSIWYG_STATE', '1', { expires: 365 });
}
});
}
});
Re: A possible code to enable WYSIWYG mode for certain forums?
You're welcome.
Topic archived
Have a nice day.
Topic archived
Have a nice day.
Similar topics
» The new editor: Is there any way to enable "NON WYSIWYG display" as default?
» WYSIWYG mode by default - switch editor not working!
» Need some code to enable new tab
» Multi forums in one code
» dark mode code
» WYSIWYG mode by default - switch editor not working!
» Need some code to enable new tab
» Multi forums in one code
» dark mode code
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum