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
- Fedora KDE gets approval to be upgraded to sit alongside Fedora Workstation
- Steam gets new tools for game devs to offer players version switching in-game
- Palworld dev details the patents Nintendo and The Pokemon Company are suing for
- Sony say their PSN account requirement on PC is so you can enjoy their games 'safely'
- SEGA Mega Drive and Genesis Classics & Dreamcast Classics get delisted in December
- > See more over 30 days here
-
GOG launch their Preservation Program to make games liv…
- Phlebiac -
GOG launch their Preservation Program to make games liv…
- elmapul -
GOG launch their Preservation Program to make games liv…
- elmapul -
GOG launch their Preservation Program to make games liv…
- Klaas -
GOG launch their Preservation Program to make games liv…
- elmapul - > See more comments
- Steam and offline gaming
- Dorrit - Weekend Players' Club 10/11/2024
- Pengling - Upped the limit on article titles
- eldaking - New social media bar in article list
- whizse - Weekend Players' Club 10/18/2024
- DylanFox - 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]