mirror of
https://github.com/moparisthebest/moparscape.org-smf
synced 2024-11-22 00:32:22 -05:00
Removes BBCode from being calculated in signatures.
Stops bbcode from being calculated into the total for signatures. Also adjusts the character limit in the text area from N, to N + BBC length. Tested on my website.
This commit is contained in:
parent
0dc351fcbf
commit
1bfe0df460
@ -2892,7 +2892,7 @@ function profileValidateSignature(&$value)
|
||||
|
||||
$unparsed_signature = strtr(un_htmlspecialchars($value), array("\r" => '', ''' => '\''));
|
||||
// Too long?
|
||||
if (!empty($sig_limits[1]) && $smcFunc['strlen']($unparsed_signature) > $sig_limits[1])
|
||||
if (!empty($sig_limits[1]) && (!empty($sig_bbc) ? ($smcFunc['strlen']($unparsed_signature) - $smcFunc['strlen']($sig_bbc)) : $smcFunc['strlen']($unparsed_signature)) > $sig_limits[1])
|
||||
{
|
||||
$_POST['signature'] = trim(htmlspecialchars($smcFunc['substr']($unparsed_signature, 0, $sig_limits[1]), ENT_QUOTES));
|
||||
$txt['profile_error_signature_max_length'] = sprintf($txt['profile_error_signature_max_length'], $sig_limits[1]);
|
||||
|
@ -2549,6 +2549,11 @@ function template_profile_signature_modify()
|
||||
setTimeout("tick()", 800);
|
||||
}
|
||||
|
||||
function parseBaby(text) {
|
||||
var babyless = new RegExp(/\[(\w+)[^w]*?](.*?)\[\/\1]/g);
|
||||
return text.replace(babyless, "$2");
|
||||
}
|
||||
|
||||
function calcCharLeft()
|
||||
{
|
||||
var maxLength = ', $context['signature_limits']['max_length'], ';
|
||||
@ -2561,12 +2566,15 @@ function template_profile_signature_modify()
|
||||
{
|
||||
oldSignature = currentSignature;
|
||||
|
||||
if (currentSignature.replace(/\r/, "").length > maxLength)
|
||||
document.forms.creator.signature.value = currentSignature.replace(/\r/, "").substring(0, maxLength);
|
||||
if (parseBaby(currentSignature.replace(/\r/, "")).length > maxLength) {
|
||||
var diff = currentSignature.replace(/\r/, "").length - parseBaby(currentSignature.replace(/\r/, "")).length;
|
||||
document.forms.creator.signature.value = currentSignature.replace(/\r/, "").substring(0, maxLength+diff);
|
||||
}
|
||||
currentSignature = document.forms.creator.signature.value.replace(/\r/, "");
|
||||
}
|
||||
|
||||
setInnerHTML(document.getElementById("signatureLeft"), maxLength - currentSignature.length);
|
||||
var size = parseBaby(currentSignature).length;
|
||||
console.log(size);
|
||||
setInnerHTML(document.getElementById("signatureLeft"), maxLength - size);
|
||||
}
|
||||
|
||||
addLoadEvent(tick);
|
||||
|
Loading…
Reference in New Issue
Block a user