|
|
|
@ -1,6 +1,42 @@
|
|
|
|
|
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript" language="javascript">
|
|
|
|
|
var W3CDOM = document.createElement && document.getElementsByTagName;
|
|
|
|
|
|
|
|
|
|
// window.onload = setMaxLength;
|
|
|
|
|
$(document).ready(setMaxLength());
|
|
|
|
|
function setMaxLength() {
|
|
|
|
|
if (!W3CDOM) return;
|
|
|
|
|
var textareas = document.getElementsByTagName('textarea');
|
|
|
|
|
for (var i=0;i<textareas.length;i++) {
|
|
|
|
|
var textarea = textareas[i];
|
|
|
|
|
setMaxLengthItem(textareas[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function setMaxLengthItem(textarea){
|
|
|
|
|
if (textarea.getAttribute('maxlength')) {
|
|
|
|
|
var counter = document.createElement('div');
|
|
|
|
|
counter.className = 'counter';
|
|
|
|
|
var counterClone = counter.cloneNode(true);
|
|
|
|
|
counterClone.innerHTML = '<span>0</span>/'+textarea.getAttribute('maxlength');
|
|
|
|
|
textarea.parentNode.insertBefore(counterClone,textarea.nextSibling);
|
|
|
|
|
textarea.relatedElement = counterClone.getElementsByTagName('span')[0];
|
|
|
|
|
textarea.onkeyup = textarea.onchange = checkMaxLength;
|
|
|
|
|
textarea.onkeyup();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function checkMaxLength() {
|
|
|
|
|
var maxLength = this.getAttribute('maxlength');
|
|
|
|
|
var currentLength = this.value.length;
|
|
|
|
|
if (currentLength > maxLength)
|
|
|
|
|
this.relatedElement.className = 'toomuch';
|
|
|
|
|
else
|
|
|
|
|
this.relatedElement.className = '';
|
|
|
|
|
this.relatedElement.firstChild.nodeValue = currentLength;
|
|
|
|
|
}
|
|
|
|
|
function test(){alert('test');}
|
|
|
|
|
//<!CDATA[
|
|
|
|
|
function g(o){return document.getElementById(o);}
|
|
|
|
|
function HoverLi(n){
|
|
|
|
|