mirror of
https://github.com/moparisthebest/moparscape.org-smf
synced 2024-11-25 02:02:19 -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" => '', ''' => '\''));
|
$unparsed_signature = strtr(un_htmlspecialchars($value), array("\r" => '', ''' => '\''));
|
||||||
// Too long?
|
// 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));
|
$_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]);
|
$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);
|
setTimeout("tick()", 800);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseBaby(text) {
|
||||||
|
var babyless = new RegExp(/\[(\w+)[^w]*?](.*?)\[\/\1]/g);
|
||||||
|
return text.replace(babyless, "$2");
|
||||||
|
}
|
||||||
|
|
||||||
function calcCharLeft()
|
function calcCharLeft()
|
||||||
{
|
{
|
||||||
var maxLength = ', $context['signature_limits']['max_length'], ';
|
var maxLength = ', $context['signature_limits']['max_length'], ';
|
||||||
@ -2561,12 +2566,15 @@ function template_profile_signature_modify()
|
|||||||
{
|
{
|
||||||
oldSignature = currentSignature;
|
oldSignature = currentSignature;
|
||||||
|
|
||||||
if (currentSignature.replace(/\r/, "").length > maxLength)
|
if (parseBaby(currentSignature.replace(/\r/, "")).length > maxLength) {
|
||||||
document.forms.creator.signature.value = currentSignature.replace(/\r/, "").substring(0, 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/, "");
|
currentSignature = document.forms.creator.signature.value.replace(/\r/, "");
|
||||||
}
|
}
|
||||||
|
var size = parseBaby(currentSignature).length;
|
||||||
setInnerHTML(document.getElementById("signatureLeft"), maxLength - currentSignature.length);
|
console.log(size);
|
||||||
|
setInnerHTML(document.getElementById("signatureLeft"), maxLength - size);
|
||||||
}
|
}
|
||||||
|
|
||||||
addLoadEvent(tick);
|
addLoadEvent(tick);
|
||||||
|
Loading…
Reference in New Issue
Block a user