outsourced comments scripting to serendipity_editor.js

This commit is contained in:
Ian 2012-12-09 14:58:59 +01:00
parent baa7d04860
commit c90142080f
3 changed files with 59 additions and 108 deletions

View File

@ -4,61 +4,12 @@
{if !empty($errormsg)}
<span class="msg_error"><span class="attention"></span> {$errormsg}</span>
{/if}
{* Smarty 3 has a new auto literal option which is enabled by default.
When the { is followed by a space it's not interpreted as smarty delimiter but literal. *}
<script>
function FT_toggle(id) {
if ( document.getElementById(id + '_full').style.display == '' ) {
document.getElementById(id + '_full').style.display='none';
document.getElementById(id + '_summary').style.display='';
document.getElementById(id + '_text').innerHTML = '{$CONST.VIEW_FULL}';
} else {
document.getElementById(id + '_full').style.display='';
document.getElementById(id + '_summary').style.display='none';
document.getElementById(id + '_text').innerHTML = '{$CONST.HIDE}';
}
return false;
}
function invertSelection() {
var f = document.formMultiDelete;
for (var i = 0; i < f.elements.length; i++) {
if( f.elements[i].type == 'checkbox' ) {
f.elements[i].checked = !(f.elements[i].checked);
f.elements[i].onclick();
}
}
}
var origborder = '';
var origwidth = '';
function highlightComment(id, checkvalue) {
var comment = document.getElementById(id);
if (origborder == '') {
origborder = comment.style.borderColor;
if (origborder == '') {
origborder = '#FFFFFF';
}
}
if (origwidth == '') {
origwidth = comment.style.borderWidth;
if (origwidth == '' || origwidth == 0) {
origwidth = 1;
}
}
if (checkvalue) {
comment.style.borderColor = '#FF0000';
comment.style.borderWidth = origwidth;
} else {
comment.style.borderColor = '';
comment.style.borderWidth = origwidth;
}
}
<script type="text/javascript">
var view_full = '{$CONST.VIEW_FULL}';
var view_hide = '{$CONST.HIDE}';
</script>
<script src="serendipity_editor.js"></script>
<h2>{$CONST.COMMENTS}</h2>

View File

@ -2,63 +2,11 @@
<p class="serendipityAdminMsgNote msg_notice"><img class="img_error" src="{serendipity_getFile file='admin/img/admin_msg_note.png'}" alt="" />{$errormsg}</p>
{/if}
{*
Smarty 3 has a new auto literal option which is enabled by default.
When the { is followed by a space it's not interpreted as smarty delimiter but literal.
*}
<script type="text/javascript">
function FT_toggle(id) {
if ( document.getElementById(id + '_full').style.display == '' ) {
document.getElementById(id + '_full').style.display='none';
document.getElementById(id + '_summary').style.display='';
document.getElementById(id + '_text').innerHTML = '{$CONST.VIEW_FULL}';
} else {
document.getElementById(id + '_full').style.display='';
document.getElementById(id + '_summary').style.display='none';
document.getElementById(id + '_text').innerHTML = '{$CONST.HIDE}';
}
return false;
}
function invertSelection() {
var f = document.formMultiDelete;
for (var i = 0; i < f.elements.length; i++) {
if( f.elements[i].type == 'checkbox' ) {
f.elements[i].checked = !(f.elements[i].checked);
f.elements[i].onclick();
}
}
}
var origborder = '';
var origwidth = '';
function highlightComment(id, checkvalue) {
var comment = document.getElementById(id);
if (origborder == '') {
origborder = comment.style.borderColor;
if (origborder == '') {
origborder = '#FFFFFF';
}
}
if (origwidth == '') {
origwidth = comment.style.borderWidth;
if (origwidth == '' || origwidth == 0) {
origwidth = 1;
}
}
if (checkvalue) {
comment.style.borderColor = '#FF0000';
comment.style.borderWidth = origwidth;
} else {
comment.style.borderColor = '';
comment.style.borderWidth = origwidth;
}
}
var view_full = '{$CONST.VIEW_FULL}';
var view_hide = '{$CONST.HIDE}';
</script>
<script src="serendipity_editor.js"></script>
<form action="" method="GET" style="margin: 0">
{$formtoken}

View File

@ -648,5 +648,57 @@ function fillInput(source, target) {
}
/* outsourced from comments.inc.tpl */
function FT_toggle(id) {
if ( document.getElementById(id + '_full').style.display == '' ) {
document.getElementById(id + '_full').style.display='none';
document.getElementById(id + '_summary').style.display='';
document.getElementById(id + '_text').innerHTML = view_full;
} else {
document.getElementById(id + '_full').style.display='';
document.getElementById(id + '_summary').style.display='none';
document.getElementById(id + '_text').innerHTML = view_hide;
}
return false;
}
function invertSelection() {
var f = document.formMultiDelete;
for (var i = 0; i < f.elements.length; i++) {
if( f.elements[i].type == 'checkbox' ) {
f.elements[i].checked = !(f.elements[i].checked);
f.elements[i].onclick();
}
}
}
var origborder = '';
var origwidth = '';
function highlightComment(id, checkvalue) {
var comment = document.getElementById(id);
if (origborder == '') {
origborder = comment.style.borderColor;
if (origborder == '') {
origborder = '#FFFFFF';
}
}
if (origwidth == '') {
origwidth = comment.style.borderWidth;
if (origwidth == '' || origwidth == 0) {
origwidth = 1;
}
}
if (checkvalue) {
comment.style.borderColor = '#FF0000';
comment.style.borderWidth = origwidth;
} else {
comment.style.borderColor = '';
comment.style.borderWidth = origwidth;
}
}
// -->