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
- GOG launch their Preservation Program to make games live forever with a hundred classics being 're-released'
- Half-Life 2 free to keep until November 18th, Episodes One & Two now included with a huge update
- Grand Theft Auto: The Trilogy – The Definitive Edition gets updated, needs a fix on Steam Deck
- Linux GPU Configuration Tool 'LACT' adds NVIDIA support
- Godot Engine 4.4 dev 4 released with interactive in-game editing
- > See more over 30 days here
-
NVIDIA stable driver 550.135 released for Linux
- Liam Dawe -
NVIDIA stable driver 550.135 released for Linux
- ShabbyX -
Steam Deck OLED: Limited Edition White and Steam Deck A…
- Philadelphus -
NVIDIA stable driver 550.135 released for Linux
- tuubi -
NVIDIA stable driver 550.135 released for Linux
- Caldathras - > See more comments
- WINE Game Screenshot Thread
- Avehicle7887 - Why Valve released Steam for Linux after all?
- CatKiller - What do you want to see on GamingOnLinux?
- Liam Dawe - Our own anti-cheat list
- Liam Dawe - Weekend Players' Club 11/15/2024
- Klaas - 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]