move new comment open/close js functions to core so they can be used by other themes

This commit is contained in:
marijus 2014-06-05 17:53:06 +02:00
parent 48f856e84c
commit fed8b6b566
3 changed files with 34 additions and 32 deletions

View File

@ -1,5 +1,38 @@
function confirmDelete() { return confirm(aStr['delitem']); }
function commentOpenUI(obj,id) {
$(document).unbind( "click.commentOpen", handler );
var handler = function() {
if(obj.value == aStr['comment']) {
obj.value = '';
$("#comment-edit-text-" + id).addClass("comment-edit-text-full").removeClass("comment-edit-text-empty");
$("#comment-tools-" + id).show();
}
};
$(document).bind( "click.commentOpen", handler );
}
function commentCloseUI(obj,id) {
$(document).unbind( "click.commentClose", handler );
var handler = function() {
if(obj.value == '') {
obj.value = aStr['comment'];
$("#comment-edit-text-" + id).removeClass("comment-edit-text-full").addClass("comment-edit-text-empty");
$("#comment-tools-" + id).hide();
}
};
$(document).bind( "click.commentClose", handler );
}
function commentOpen(obj,id) {
if(obj.value == aStr['comment']) {
obj.value = '';

View File

@ -1,34 +1,3 @@
function commentOpenRedbasic(obj,id) {
$(document).unbind( "click.commentOpen", handler );
var handler = function() {
if(obj.value == aStr['comment']) {
obj.value = '';
$("#comment-edit-text-" + id).addClass("comment-edit-text-full").removeClass("comment-edit-text-empty");
$("#comment-tools-" + id).show();
}
};
$(document).bind( "click.commentOpen", handler );
}
function commentCloseRedbasic(obj,id) {
$(document).unbind( "click.commentClose", handler );
var handler = function() {
if(obj.value == '') {
obj.value = aStr['comment'];
$("#comment-edit-text-" + id).removeClass("comment-edit-text-full").addClass("comment-edit-text-empty");
$("#comment-tools-" + id).hide();
}
};
$(document).bind( "click.commentClose", handler );
}
$(document).ready(function() {

View File

@ -10,7 +10,7 @@
<input type="hidden" name="return" value="{{$return_path}}" />
<input type="hidden" name="jsreload" value="{{$jsreload}}" />
<input type="hidden" name="preview" id="comment-preview-inp-{{$id}}" value="0" />
<textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" onFocus="commentOpenRedbasic(this,{{$id}});" onBlur="commentCloseRedbasic(this,{{$id}});" >{{$comment}}</textarea>
<textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" onFocus="commentOpenUI(this,{{$id}});" onBlur="commentCloseUI(this,{{$id}});" >{{$comment}}</textarea>
{{if $qcomment}}
<select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});" >
<option value=""></option>