diff --git a/public_html/media/js/post-upload.js b/public_html/media/js/post-upload.js index 85eb29e8..972347c0 100644 --- a/public_html/media/js/post-upload.js +++ b/public_html/media/js/post-upload.js @@ -199,7 +199,12 @@ $(function() { postDom.data('url', url); postDom.data('file', ''); - postDom.find('[name=source]').val(url); + + var sourceInput = postDom.find('[name=source]'); + sourceInput.val(url); + if (sourceInput.attr('maxlength')) + sourceInput.val(sourceInput.val().substring(0, sourceInput.attr('maxlength'))); + if (matches = url.match(/watch.*?=([a-zA-Z0-9_-]+)/)) { postDom.find('.file-name strong').text(url); diff --git a/src/Views/input/input-basic.phtml b/src/Views/input/input-basic.phtml index 2a791e9e..e59000eb 100644 --- a/src/Views/input/input-basic.phtml +++ b/src/Views/input/input-basic.phtml @@ -8,6 +8,7 @@ $placeholder = isset($this->context->placeholder) ? $this->context->placeholder $additionalInfo = isset($this->context->additionalInfo) ? $this->context->additionalInfo : ''; $inputClass = isset($this->context->inputClass) ? $this->context->inputClass : ''; $noAutocomplete = isset($this->context->noAutocomplete) ? true : false; +$maxLength = isset($this->context->maxLength) ? intval($this->context->maxLength) : null; ?>
@@ -16,6 +17,9 @@ $noAutocomplete = isset($this->context->noAutocomplete) ? true : false;
+ maxlength="" + autocomplete="off" diff --git a/src/Views/post/post-edit.phtml b/src/Views/post/post-edit.phtml index d6bb6e1c..411b7008 100644 --- a/src/Views/post/post-edit.phtml +++ b/src/Views/post/post-edit.phtml @@ -56,6 +56,7 @@ $post = $this->context->transport->post; $context = new StdClass; $context->label = 'Source'; $context->name = 'source'; + $context->maxLength = Core::getConfig()->posts->maxSourceLength; $context->value = htmlspecialchars($post->getSource()); $this->renderExternal('input-text', $context); } diff --git a/src/Views/post/post-upload.phtml b/src/Views/post/post-upload.phtml index 80757208..8ca9e53a 100644 --- a/src/Views/post/post-upload.phtml +++ b/src/Views/post/post-upload.phtml @@ -115,7 +115,10 @@ $this->assets->addScript('../lib/tagit/jquery.tagit.js');
- +