While you're here, please consider supporting GamingOnLinux on:
Reward Tiers: Patreon. Plain Donations: PayPal.
This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!
You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
Reward Tiers: Patreon. Plain Donations: PayPal.
This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!
You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
Login / Register
- Vampire Hunters turns Vampire Survivors into an FPS where you stack 14 weapons together
- Steam Deck SteamOS 3.6.20 update released for everyone
- Manjaro Linux want your system info with their new data collection tool
- Check out Proton-Sarek if you have an older GPU for Windows games on Linux
- Fedora KDE gets approval to be upgraded to sit alongside Fedora Workstation
- > See more over 30 days here
-
GE-Proton 9-19 brings fixes for Horizon Zero Dawn Remas…
- Cyberworm -
GE-Proton 9-19 brings fixes for Horizon Zero Dawn Remas…
- melkemind -
GE-Proton 9-19 brings fixes for Horizon Zero Dawn Remas…
- Liam Dawe -
GE-Proton 9-19 brings fixes for Horizon Zero Dawn Remas…
- Cyberworm -
GE-Proton 9-19 brings fixes for Horizon Zero Dawn Remas…
- Cybolic - > See more comments
- Steam friends nickname list
- tuxer415 - Cookies and Login changes
- Liam Dawe - Introduce Yourself!
- BlackBloodRum - Weekend Players' Club 11/8/2024
- Klaas - error: unexpectedly disconnected from boot status demon…
- Cyba.Cowboy - See more posts
Basically limiting the character count on a specified textarea of tinymce on a page, the current code i have affects all tinymce textareas.
Here's the code:
[HTML]<script type="text/javascript" src="/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins : "bbcode",
theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,styleselect,removeformat,cleanup,code",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "bottom",
theme_advanced_toolbar_align : "center",
theme_advanced_styles : "Code=codeStyle;Quote=quoteStyle",
theme_advanced_resizing : true,
theme_advanced_path : false,
content_css : "css/bbcode.css",
entity_encoding : "raw",
add_unload_trigger : false,
remove_linebreaks : false,
inline_styles : false,
forced_root_block : '',
convert_fonts_to_spans : false,
theme_advanced_statusbar_location : "bottom",
setup: function(ed) {
ed.onKeyUp.add(function(ed, e) {
// What is the max amount of characters you want
var maxChars = 255;
var content = tinyMCE.activeEditor.getContent();
// Remove any BBCode tags from the count
var strip = content.replace(/[/?(?:b|i|u|url|quote|code|img|color|size)*?.*?]/img, '');
// Set the text for what we want to display in the status bar
var text = strip.split(' ').length + " Words, " + strip.length + " Characters"
// Show the status bar message
tinymce.DOM.setHTML(tinymce.DOM.get(tinyMCE.activeEditor.id + '_path_row'), text);
// Is there more Characters than we want
if (strip.length > maxChars)
{
// Show an alert (can comment out)
alert("Sorry too many characters " + strip);
// Get all characters up to the limit
cur = strip.substring(0,maxChars);
// Replace content with the max amount
tinyMCE.activeEditor.setContent(oldContent);
}
else
{
oldContent = content;
}
});
}
});[/HTML]