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
- Funded in 5 minutes - the open source modular mini computer 'Pilet' is on Kickstarter
- OrangePi Neo gaming handheld with Manjaro Linux now due out in Q1 2025
- Mecha Comet looks like a fun little modular Linux handheld
- Why are there so many different Proton versions? Proton 8, Proton 9, Experimental, GE-Proton
- Bazzite the popular SteamOS-like Linux gets expanded NVIDIA support in Beta
- > See more over 30 days here
Recently Updated
- While Palworld enjoys a resurgence Valve dropped the rating to Steam Deck Unsupported
- GPD WIN 4 handheld plans to support Valve's SteamOS in 2025 (updated: nope)
- Valve confirms a public beta of SteamOS is coming as 'SteamOS expands beyond Steam Deck'
- Discord Canary on Linux breaks Wayland screen-sharing support for now
-
Building a Retro Linux Gaming Computer Part 45: Free as…
- R Daneel Olivaw -
DXVK v2.5.3 released with more improvements for Windows…
- pb -
NTSYNC driver for improving Windows games on Linux with…
- d3Xt3r -
NTSYNC driver for improving Windows games on Linux with…
- Shmerl -
Building a Retro Linux Gaming Computer Part 45: Free as…
- gnarchie - > See more comments
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]