frio: add a very simple character counter to the jot

This commit is contained in:
rabuzarus 2016-11-18 23:48:31 +01:00
parent 23bc0eae29
commit a8d1a3f997
3 changed files with 128 additions and 127 deletions

View file

@ -1157,6 +1157,9 @@ section #jotOpen {
#profile-jot-wrapper button#jot-submit { #profile-jot-wrapper button#jot-submit {
margin-top: 5px; margin-top: 5px;
} }
#profile-jot-wrapper #character-counter {
padding: 10px 15px;
}
/* ACL */ /* ACL */
/*#jot-modal-body { /*#jot-modal-body {

View file

@ -1,14 +1,12 @@
<script type="text/javascript" src="{{$baseurl}}/js/ajaxupload.js" ></script>
{{*<script language="javascript" type="text/javascript">*}} <script type="text/javascript">
var editor=false;
var textlen = 0;
var plaintext = '{{$editselect}}';
function initEditor(cb){
<script>
var editor=false;
var textlen = 0;
var plaintext = '{{$editselect}}';
function initEditor(cb){
if (editor==false){ if (editor==false){
$("#profile-jot-text-loading").show(); $("#profile-jot-text-loading").show();
if(plaintext == 'none') { if(plaintext == 'none') {
@ -26,6 +24,10 @@ function initEditor(cb){
}); });
$(".jothidden").show(); $(".jothidden").show();
if (typeof cb!="undefined") cb(); if (typeof cb!="undefined") cb();
$("#profile-jot-text").keyup(function(){
var textlen = $(this).val().length;
$('#character-counter').text(textlen);
});
return; return;
} }
tinyMCE.init({ tinyMCE.init({
@ -123,20 +125,16 @@ function initEditor(cb){
} else { } else {
if (typeof cb!="undefined") cb(); if (typeof cb!="undefined") cb();
} }
} }
function enableOnUser(){ function enableOnUser(){
if (editor) return; if (editor) return;
//$(this).val(""); //$(this).val("");
initEditor(); initEditor();
} }
</script> </script>
<script type="text/javascript" src="{{$baseurl}}/js/ajaxupload.js" ></script>
<script> <script type="text/javascript">
var ispublic = '{{$ispublic}}'; var ispublic = '{{$ispublic}}';

View file

@ -38,7 +38,6 @@
<form id="profile-jot-form" action="{{$action}}" method="post"> <form id="profile-jot-form" action="{{$action}}" method="post">
<div id="profile-jot-wrapper"> <div id="profile-jot-wrapper">
<div> <div>
<div id="character-counter" class="grey jothidden text-info pull-left"></div>
<!--<div id="profile-jot-desc" class="jothidden pull-right">&nbsp;</div>--> <!--<div id="profile-jot-desc" class="jothidden pull-right">&nbsp;</div>-->
</div> </div>
@ -80,6 +79,7 @@
--> -->
<li class="pull-right"><button class="btn btn-primary" id="jot-submit" type="submit" id="profile-jot-submit" name="submit" ><i class="fa fa-slideshare fa-fw"></i> {{$share}}</button></li> <li class="pull-right"><button class="btn btn-primary" id="jot-submit" type="submit" id="profile-jot-submit" name="submit" ><i class="fa fa-slideshare fa-fw"></i> {{$share}}</button></li>
<li id="character-counter" class="grey jothidden text-info pull-right"></li>
<div id="profile-rotator-wrapper" style="display: {{$visitor}};" > <div id="profile-rotator-wrapper" style="display: {{$visitor}};" >
<img id="profile-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait}}" style="display: none;" /> <img id="profile-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait}}" style="display: none;" />
</div> </div>