
[MODDB] Extended Quick Reply Form v.2
-
- Former team member
- Сообщения: 955
- Стаж: 20 лет 3 месяца
- Откуда: Москва
-
- phpBB 1.4.4
- Сообщения: 138
- Стаж: 20 лет 5 месяцев
- Откуда: Россия, Москва
-
- phpBB Guru
- Сообщения: 5484
- Стаж: 21 год 1 месяц
- Поблагодарили: 2 раза
Версия 2.3.0
Префинальный релиз. Если с ним все будет гладко - выпуск.
Список изменений:
Скачать
Префинальный релиз. Если с ним все будет гладко - выпуск.
Список изменений:
Код: Выделить всё
## - Updated quick_reply.tpl for Helius.
## - Added quick_reply.tpl for Iris (thanks to Jack).
## - Updated templates, now JS code is external.
## - Fixed a bug with "Watch this topic..." checkbox (thanks to Meithar).
## - Other fixes.
Эксперт - это человек, который избегает мелких ошибок на пути к грандиозному провалу.
Любая более-менее сложная задача имеет несколько простых, изящных, лёгких для понимания неправильных решений
Любая более-менее сложная задача имеет несколько простых, изящных, лёгких для понимания неправильных решений
Всё не гладно...Xpert писал(а):Если с ним все будет гладко - выпуск.

1) В моде не упоминается файл quick_reply.js, а между тем все javascript функции вынесены туда. ;-)
2) В самом файле встречаются просто гениальные функции, типа:
Код: Выделить всё
function emoticon(text) {
var txtarea = document.post.message;
text = ' ' + text + ' ';
if (txtarea.createTextRange && txtarea.caretPos) {
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
txtarea.focus();
} else {
txtarea.value += text;
txtarea.focus();
}
}
function emoticon_wospaces(text) {
var txtarea = document.post.message;
if (txtarea.createTextRange && txtarea.caretPos) {
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
txtarea.focus();
} else {
txtarea.value += text;
txtarea.focus();
}
}
Далее. С 8 версии Opera приподнялась, в основном за счёт совместимости с IE. Т.е. теперь там возможно не только цитирование, но и вставка по месту курсора. Для Mozilla такой функциональности не реализовано, хотя она поддерживается уже с пол года. Более того, я давно ей на своём форуме пользуюсь.
Если задержите релиз на 2-3 дня, то я прошерстю весь этот js код, уберу повторяющиеся куски и добавлю свои фишки по поддержке mozilla...

-
- phpBB Guru
- Сообщения: 5484
- Стаж: 21 год 1 месяц
- Поблагодарили: 2 раза
Поправлю.atrus писал(а):В моде не упоминается файл quick_reply.js, а между тем все javascript функции вынесены туда
Эээ... хорошо что обратили внимание, оттуда надо фокусировку убрать...atrus писал(а):Называется - найдите 10 отличий...
Я только за. Заранее спасибо. Вот только добавление фишек может стоит начать с формы полного ответа, а потом уже перенести и на быстрый?atrus писал(а):Если задержите релиз на 2-3 дня, то я прошерстю весь этот js код, уберу повторяющиеся куски и добавлю свои фишки по поддержке mozilla...

Эксперт - это человек, который избегает мелких ошибок на пути к грандиозному провалу.
Любая более-менее сложная задача имеет несколько простых, изящных, лёгких для понимания неправильных решений
Любая более-менее сложная задача имеет несколько простых, изящных, лёгких для понимания неправильных решений
У меня уже убрано. По понятной причине... ;-)Xpert писал(а):оттуда надо фокусировку убрать...
Логично. Я, собственно так и делал. Потому и просил о двух-трёх днях. С одной формой полностью можно разобраться и за день. Тем более мне надо выкусывать общий код из частного. У меня ещё disable-email, post-is-sending, цитирование в mozilla со смайликами ;-). И отдельная кнопка. Вот такая:Xpert писал(а):Вот только добавление фишек может стоит начать с формы полного ответа, а потом уже перенести и на быстрый?
title="Цитировать в форму быстрого ответа"

Последний раз редактировалось atrus 21.04.2005 13:05, всего редактировалось 1 раз.
-
- phpBB 1.4.2
- Сообщения: 62
- Стаж: 20 лет 4 месяца
- Откуда: Москва
-
- phpBB 1.0.0
- Сообщения: 2
- Стаж: 20 лет
-
- phpBB Guru
- Сообщения: 5484
- Стаж: 21 год 1 месяц
- Поблагодарили: 2 раза
-
- phpBB 1.4.2
- Сообщения: 62
- Стаж: 20 лет 4 месяца
- Откуда: Москва
Так... Я тут немного выпал из процесса...
Но сделал. Сегодя уже не успею описать изменения, поэтому просто даю ссылку. Здесь все изменённые файлы по сравнению с чистым phpBB 2.0.14 + установленный QR 2.3.0 + мои обещанные изменения.
http://lrngate.narod.ru/php/qr_tmp_all.rar
В quick_reply.js достаточно изменний, теперь он более универсален. Изменения, как и говорили, коснулись и формы полного ответа: поддержка всех фич mozilla + проверил на релизе Opera 8. Так же добавленна ссылка "цитировать" в фрейм предпросмотра сообщений в форме полного цитирования. Теперь можно легко цитировать с разных пользователей и там.
P.S. Вот такй вопрос ещё - среди модов встречаются такие (типа Tab), тэги которых не имеют закрывающего. А форма норовит... В общем, это фиксится двумя строчками и функция начинает понимать, что есть тэги, которые не надо закрывать. Вопрос: стоит включать?

http://lrngate.narod.ru/php/qr_tmp_all.rar
В quick_reply.js достаточно изменний, теперь он более универсален. Изменения, как и говорили, коснулись и формы полного ответа: поддержка всех фич mozilla + проверил на релизе Opera 8. Так же добавленна ссылка "цитировать" в фрейм предпросмотра сообщений в форме полного цитирования. Теперь можно легко цитировать с разных пользователей и там.
P.S. Вот такй вопрос ещё - среди модов встречаются такие (типа Tab), тэги которых не имеют закрывающего. А форма норовит... В общем, это фиксится двумя строчками и функция начинает понимать, что есть тэги, которые не надо закрывать. Вопрос: стоит включать?
А вот и изменения, в виде мода. Применять после установки 2.3.0:
','
imageTag = false;
#
#-----[ REPLACE WITH ]---------------------------------------------
#
#
#-----[ FIND ]------------------------------------------
#
// Replacement for arrayname.length property
function getarraysize(thearray) {
for (i = 0; i < thearray.length; i++) {
if ((thearray == "undefined") || (thearray == "") || (thearray == null))
return i;
}
return thearray.length;
}
// Replacement for arrayname.push(value) not implemented in IE until version 5.5
// Appends element to the array
function arraypush(thearray,value) {
thearray[ getarraysize(thearray) ] = value;
}
// Replacement for arrayname.pop() not implemented in IE until version 5.5
// Removes and returns the last element of an array
function arraypop(thearray) {
thearraysize = getarraysize(thearray);
retval = thearray[thearraysize - 1];
delete thearray[thearraysize - 1];
return retval;
}
function checkForm() {
formErrors = false;
if (document.post.message.value.length < 2) {
formErrors = "{L_EMPTY_MESSAGE}";
}
if (formErrors) {
alert(formErrors);
return false;
} else {
bbstyle(-1);
//formObj.preview.disabled = true;
//formObj.submit.disabled = true;
return true;
}
}
function emoticon(text) {
var txtarea = document.post.message;
text = ' ' + text + ' ';
if (txtarea.createTextRange && txtarea.caretPos) {
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
txtarea.focus();
} else {
txtarea.value += text;
txtarea.focus();
}
}
#
#-----[ REPLACE WITH ]---------------------------------------------
#
function insert_at_cursor(text) {
var txtarea = document.post.message;
if (txtarea.createTextRange && txtarea.caretPos) {
if (baseHeight != txtarea.caretPos.boundingHeight) {
txtarea.focus();
storeCaret(txtarea);
}
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
} else {
if (is_nav && document.getElementById) {
mozWrap(txtarea, '', text);
} else {
txtarea.value += text;
}
}
txtarea.focus();
}
#
#-----[ FIND ]------------------------------------------
# Line: 112
#
if (!theSelection) {
txtarea.value += bbopen + bbclose;
txtarea.focus();
#
#-----[ REPLACE WITH ]---------------------------------------------
#
if (!theSelection) {
insert_at_cursor(bbopen + bbclose);
#
#-----[ FIND ]------------------------------------------
# Line: 128
#
txtarea.value += bbopen + bbclose;
txtarea.focus();
#
#-----[ REPLACE WITH ]---------------------------------------------
#
insert_at_cursor(bbopen + bbclose);
txtarea.focus();
#
#-----[ FIND ]------------------------------------------
#
function bbstyle(bbnumber) {
var txtarea = document.post.message;
txtarea.focus();
donotinsert = false;
theSelection = false;
bblast = 0;
if (bbnumber == -1) { // Close all open tags & default button names
while (bbcode[0]) {
butnumber = arraypop(bbcode) - 1;
txtarea.value += bbtags[butnumber + 1];
buttext = eval('document.post.addbbcode' + butnumber + '.value');
eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
}
imageTag = false; // All tags are closed including image tags :D
txtarea.focus();
return;
}
if ((clientVer >= 4) && is_ie && is_win)
{
theSelection = document.selection.createRange().text; // Get text selection
if (theSelection) {
// Add tags around selection
document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
txtarea.focus();
theSelection = '';
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, bbtags[bbnumber], bbtags[bbnumber+1]);
return;
}
// Find last occurance of an open tag the same as the one just clicked
for (i = 0; i < bbcode.length; i++) {
if (bbcode == bbnumber+1) {
bblast = i;
donotinsert = true;
}
}
if (donotinsert) { // Close all open tags up to the one just clicked & default button names
while (bbcode[bblast]) {
butnumber = arraypop(bbcode) - 1;
txtarea.value += bbtags[butnumber + 1];
buttext = eval('document.post.addbbcode' + butnumber + '.value');
eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
imageTag = false;
}
txtarea.focus();
return;
} else { // Open tags
if (imageTag && (bbnumber != 14)) { // Close image tag before adding another
txtarea.value += bbtags[15];
lastValue = arraypop(bbcode) - 1; // Remove the close image tag from the list
document.post.addbbcode14.value = "Img"; // Return button back to normal state
imageTag = false;
}
// Open tag
txtarea.value += bbtags[bbnumber];
if ((bbnumber == 14) && (imageTag == false)) imageTag = 1; // Check to stop additional tags after an unclosed image tag
arraypush(bbcode,bbnumber+1);
eval('document.post.addbbcode'+bbnumber+'.value += "*"');
txtarea.focus();
return;
}
storeCaret(txtarea);
}
// From http://www.massless.org/mozedit/
function mozWrap(txtarea, open, close)
{
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
if (selEnd == 1 || selEnd == 2)
selEnd = selLength;
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd)
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + open + s2 + close + s3;
return;
}
// Insert at Claret position. Code from
// http://www.faqts.com/knowledge_base/vie ... 52/fid/130
function storeCaret(textEl) {
if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}
#
#-----[ REPLACE WITH ]---------------------------------------------
#
#
#-----[ FIND ]------------------------------------------
#
//-->
</script>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<script language="JavaScript" type="text/javascript" src="templates/quick_reply.js"></script>
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/posting_smilies.tpl
#
#-----[ FIND ]------------------------------------------
#
function emoticon(text) {
text = ' ' + text + ' ';
if (opener.document.forms['post'].message.createTextRange && opener.document.forms['post'].message.caretPos) {
var caretPos = opener.document.forms['post'].message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
opener.document.forms['post'].message.focus();
} else {
opener.document.forms['post'].message.value += text;
opener.document.forms['post'].message.focus();
}
}
#
#-----[ REPLACE WITH ]---------------------------------------------
#
function insert_at_cursor(text) {
if (opener.document.forms['post'].message.createTextRange && opener.document.forms['post'].message.caretPos) {
if (opener.baseHeight != opener.document.forms['post'].message.caretPos.boundingHeight) {
opener.document.forms['post'].message.focus();
opener.storeCaret(opener.document.forms['post'].message);
}
var caretPos = opener.document.forms['post'].message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
opener.document.forms['post'].message.focus();
} else {
if (is_nav && document.getElementById) {
mozWrap(opener.document.forms['post'].message, '', text);
} else {
opener.document.forms['post'].message.value += text;
}
opener.document.forms['post'].message.focus();
}
}
#
#-----[ FIND ]------------------------------------------
#
//-->
</script>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<script language="JavaScript" type="text/javascript" src="templates/quick_reply.js"></script>
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/posting_topic_review.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- END switch_inline_mode -->
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- BEGIN iframe_script -->
<script language="JavaScript" type="text/javascript">
<!--
l_no_text_selected = "{L_NO_TEXT_SELECTED}";
function insert_at_cursor(text) {
if (parent.top.document.forms['post'].message.createTextRange && parent.top.document.forms['post'].message.caretPos) {
if (parent.top.baseHeight != parent.top.document.forms['post'].message.caretPos.boundingHeight) {
parent.top.document.forms['post'].message.focus();
parent.top.storeCaret(parent.top.document.forms['post'].message);
}
var caretPos = parent.top.document.forms['post'].message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
parent.top.document.forms['post'].message.focus();
} else {
if (is_nav && document.getElementById) {
mozWrap(parent.top.document.forms['post'].message, '', text);
} else {
parent.top.document.forms['post'].message.value += text;
}
parent.top.document.forms['post'].message.focus();
}
}
-->
</script>
<script language="JavaScript" type="text/javascript" src="templates/quick_reply.js"></script>
<!-- END iframe_script -->
#
#-----[ FIND ]------------------------------------------
#
<td width="22%" align="left" valign="top" class="{postrow.ROW_CLASS}"><span class="name"><a name="{postrow.U_POST_ID}"></a><b>{postrow.POSTER_NAME}</b></span></td>
#
#-----[ IN-LINE FIND ]------------------------------------------
#
{postrow.POSTER_NAME}</b>
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
{postrow.QUOTE_LINK}
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/quick_reply.tpl
#
#-----[ FIND ]------------------------------------------
#
//-->
</script>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
var baseHeight;
window.onload = initInsertions;
// Fix a bug involving the TextRange object. From
// http://www.frostjedi.com/terra/scripts/ ... etBug.html
function initInsertions() {
document.post.message.focus();
if (is_ie && typeof(baseHeight) != 'number') baseHeight = document.selection.createRange().duplicate().boundingHeight;
}
function insert_at_cursor(text) {
var txtarea = document.post.message;
if (txtarea.createTextRange && txtarea.caretPos) {
if (baseHeight != txtarea.caretPos.boundingHeight) {
txtarea.focus();
storeCaret(txtarea);
}
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
} else {
if (is_nav && document.getElementById) {
mozWrap(txtarea, '', text);
} else {
txtarea.value += text;
}
}
txtarea.focus();
}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM[/code]
Код: Выделить всё
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------
#
'L_STYLES_TIP' => $lang['Styles_tip'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
// [begin] Extended Quick Reply Form mod
'L_NO_TEXT_SELECTED' => $lang['Qreply_no_text_selected'],
// [end] Extended Quick Reply Form mod
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
$quote_link = '<br /><a href="javascript:quoteSelection(\'' . addslashes($poster) . '\')" onMouseOver="catchSelection()">' . $lang['Qreply_quote_link'] . '</a><br />';
#
#-----[ IN-LINE FIND ]------------------------------------------
#
javascript:quoteSelection(
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
document,
#
#-----[ FIND ]------------------------------------------
#
$poster = '<a href="javascript:putName(\'' . addslashes($poster) . '\')">' . $poster . '</a>';
#
#-----[ IN-LINE FIND ]------------------------------------------
#
javascript:putName(
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
document,
#
#-----[ OPEN ]------------------------------------------
#
includes/topic_review.php
#
#-----[ FIND ]------------------------------------------
# Line: 98
#
$template->set_filenames(array(
'reviewbody' => 'posting_topic_review.tpl')
);
#
#-----[ AFTER, ADD ]------------------------------------------
#
// [begin] Extended Quick Reply Form mod
$template->assign_block_vars('iframe_script', array());
$js_doc = 'parent.top.document';
$template->assign_vars(array(
'L_NO_TEXT_SELECTED' => $lang['Qreply_no_text_selected'])
);
// [end] Extended Quick Reply Form mod
#
#-----[ FIND ]------------------------------------------
# Line: 110
#
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
// [begin] Extended Quick Reply Form mod
else
{
$js_doc = 'document';
}
// [end] Extended Quick Reply Form mod
#
#-----[ FIND ]------------------------------------------
#
$template->assign_block_vars('postrow', array(
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// [begin] Extended Quick Reply Form mod
$quote_link = '<br /><a href="javascript:quoteSelection('.$js_doc.', \'' . addslashes($poster) . '\')" onMouseOver="catchSelection()">' . $lang['Qreply_quote_link'] . '</a><br />';
$poster = '<a href="javascript:putName('.$js_doc.', \'' . addslashes($poster) . '\')">' . $poster . '</a>';
// [end] Extended Quick Reply Form mod
#
#-----[ FIND ]------------------------------------------
#
'MINI_POST_IMG' => $mini_post_img,
'POSTER_NAME' => $poster,
#
#-----[ AFTER, ADD ]------------------------------------------
#
// [begin] Extended Quick Reply Form mod
'QUOTE_LINK' => $quote_link,
// [end] Extended Quick Reply Form mod
#
#-----[ OPEN ]------------------------------------------
#
templates/quick_reply.js
#
#-----[ FIND ]------------------------------------------
#
function emoticon(text) {
var txtarea = document.post.message;
text = ' ' + text + ' ';
if (txtarea.createTextRange && txtarea.caretPos) {
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
txtarea.focus();
} else {
txtarea.value += text;
txtarea.focus();
}
}
function emoticon_wospaces(text) {
var txtarea = document.post.message;
if (txtarea.createTextRange && txtarea.caretPos) {
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
txtarea.focus();
} else {
txtarea.value += text;
txtarea.focus();
}
}
#
#-----[ REPLACE WITH ]---------------------------------------------
#
function emoticon(text) {
text = ' ' + text + ' ';
insert_at_cursor(text);
}
#
#-----[ FIND ]------------------------------------------
#
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, bbtags[bbnumber], bbtags[bbnumber+1]);
#
#-----[ AFTER, ADD ]------------------------------------------
#
txtarea.focus();
#
#-----[ FIND ]------------------------------------------
# Line: 124
#
butnumber = arraypop(bbcode) - 1;
txtarea.value += bbtags[butnumber + 1];
#
#-----[ REPLACE WITH ]---------------------------------------------
#
butnumber = arraypop(bbcode) - 1;
insert_at_cursor(bbtags[butnumber + 1]);
#
#-----[ FIND ]------------------------------------------
# Line: 141
#
// Open tag
txtarea.value += bbtags[bbnumber];
#
#-----[ REPLACE WITH ]---------------------------------------------
#
// Open tag
insert_at_cursor(bbtags[bbnumber]);
#
#-----[ FIND ]------------------------------------------
#
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd)
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + open + s2 + close + s3;
#
#-----[ AFTER, ADD ]------------------------------------------
#
txtarea.selectionEnd = 0;
txtarea.selectionStart = selEnd + open.length + close.length;
#
#-----[ FIND ]------------------------------------------
#
function putName(name)
{
emoticon_wospaces('[b]'+name+'[/b]\n');
document.post.message.focus();
#
#-----[ REPLACE WITH ]---------------------------------------------
#
function putName(doc, name)
{
insert_at_cursor('[b]'+name+'[/b]\n');
doc.post.message.focus();
#
#-----[ FIND ]------------------------------------------
#
function quoteSelection(name)
{
if (selection)
{
emoticon_wospaces('[quote="'+name+'"]' + selection + '[/quote]\n');
selection = '';
document.post.message.focus();
#
#-----[ REPLACE WITH ]---------------------------------------------
#
function quoteSelection(doc, name)
{
if (selection)
{
insert_at_cursor('[quote="'+name+'"]' + selection + '[/quote]\n');
selection = '';
doc.post.message.focus();
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/posting_body.tpl
#
#-----[ FIND ]------------------------------------------
#
// bbCode control by
// subBlue design
// www.subBlue.com
// Startup variables
var imageTag = false;
var theSelection = false;
// Check for Browser & Platform for PC & IE specific bits
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version
var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
&& (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
&& (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_moz = 0;
var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);
#
#-----[ REPLACE WITH ]---------------------------------------------
#
l_empty_message = "{L_EMPTY_MESSAGE}";
l_no_text_selected = "{L_NO_TEXT_SELECTED}";
var baseHeight;
window.onload = initInsertions;
// Fix a bug involving the TextRange object. From
// http://www.frostjedi.com/terra/scripts/demo/caretBug.html
function initInsertions() {
document.post.message.focus();
if (is_ie && typeof(baseHeight) != 'number') baseHeight = document.selection.createRange().duplicate().boundingHeight;
}
#
#-----[ FIND ]------------------------------------------
#
// Define the bbCode tags
bbcode = new Array();
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','
- ','
- ','
imageTag = false;
#
#-----[ REPLACE WITH ]---------------------------------------------
#
#
#-----[ FIND ]------------------------------------------
#
// Replacement for arrayname.length property
function getarraysize(thearray) {
for (i = 0; i < thearray.length; i++) {
if ((thearray == "undefined") || (thearray == "") || (thearray == null))
return i;
}
return thearray.length;
}
// Replacement for arrayname.push(value) not implemented in IE until version 5.5
// Appends element to the array
function arraypush(thearray,value) {
thearray[ getarraysize(thearray) ] = value;
}
// Replacement for arrayname.pop() not implemented in IE until version 5.5
// Removes and returns the last element of an array
function arraypop(thearray) {
thearraysize = getarraysize(thearray);
retval = thearray[thearraysize - 1];
delete thearray[thearraysize - 1];
return retval;
}
function checkForm() {
formErrors = false;
if (document.post.message.value.length < 2) {
formErrors = "{L_EMPTY_MESSAGE}";
}
if (formErrors) {
alert(formErrors);
return false;
} else {
bbstyle(-1);
//formObj.preview.disabled = true;
//formObj.submit.disabled = true;
return true;
}
}
function emoticon(text) {
var txtarea = document.post.message;
text = ' ' + text + ' ';
if (txtarea.createTextRange && txtarea.caretPos) {
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
txtarea.focus();
} else {
txtarea.value += text;
txtarea.focus();
}
}
#
#-----[ REPLACE WITH ]---------------------------------------------
#
function insert_at_cursor(text) {
var txtarea = document.post.message;
if (txtarea.createTextRange && txtarea.caretPos) {
if (baseHeight != txtarea.caretPos.boundingHeight) {
txtarea.focus();
storeCaret(txtarea);
}
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
} else {
if (is_nav && document.getElementById) {
mozWrap(txtarea, '', text);
} else {
txtarea.value += text;
}
}
txtarea.focus();
}
#
#-----[ FIND ]------------------------------------------
# Line: 112
#
if (!theSelection) {
txtarea.value += bbopen + bbclose;
txtarea.focus();
#
#-----[ REPLACE WITH ]---------------------------------------------
#
if (!theSelection) {
insert_at_cursor(bbopen + bbclose);
#
#-----[ FIND ]------------------------------------------
# Line: 128
#
txtarea.value += bbopen + bbclose;
txtarea.focus();
#
#-----[ REPLACE WITH ]---------------------------------------------
#
insert_at_cursor(bbopen + bbclose);
txtarea.focus();
#
#-----[ FIND ]------------------------------------------
#
function bbstyle(bbnumber) {
var txtarea = document.post.message;
txtarea.focus();
donotinsert = false;
theSelection = false;
bblast = 0;
if (bbnumber == -1) { // Close all open tags & default button names
while (bbcode[0]) {
butnumber = arraypop(bbcode) - 1;
txtarea.value += bbtags[butnumber + 1];
buttext = eval('document.post.addbbcode' + butnumber + '.value');
eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
}
imageTag = false; // All tags are closed including image tags :D
txtarea.focus();
return;
}
if ((clientVer >= 4) && is_ie && is_win)
{
theSelection = document.selection.createRange().text; // Get text selection
if (theSelection) {
// Add tags around selection
document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
txtarea.focus();
theSelection = '';
return;
}
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
{
mozWrap(txtarea, bbtags[bbnumber], bbtags[bbnumber+1]);
return;
}
// Find last occurance of an open tag the same as the one just clicked
for (i = 0; i < bbcode.length; i++) {
if (bbcode == bbnumber+1) {
bblast = i;
donotinsert = true;
}
}
if (donotinsert) { // Close all open tags up to the one just clicked & default button names
while (bbcode[bblast]) {
butnumber = arraypop(bbcode) - 1;
txtarea.value += bbtags[butnumber + 1];
buttext = eval('document.post.addbbcode' + butnumber + '.value');
eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
imageTag = false;
}
txtarea.focus();
return;
} else { // Open tags
if (imageTag && (bbnumber != 14)) { // Close image tag before adding another
txtarea.value += bbtags[15];
lastValue = arraypop(bbcode) - 1; // Remove the close image tag from the list
document.post.addbbcode14.value = "Img"; // Return button back to normal state
imageTag = false;
}
// Open tag
txtarea.value += bbtags[bbnumber];
if ((bbnumber == 14) && (imageTag == false)) imageTag = 1; // Check to stop additional tags after an unclosed image tag
arraypush(bbcode,bbnumber+1);
eval('document.post.addbbcode'+bbnumber+'.value += "*"');
txtarea.focus();
return;
}
storeCaret(txtarea);
}
// From http://www.massless.org/mozedit/
function mozWrap(txtarea, open, close)
{
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
if (selEnd == 1 || selEnd == 2)
selEnd = selLength;
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd)
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + open + s2 + close + s3;
return;
}
// Insert at Claret position. Code from
// http://www.faqts.com/knowledge_base/vie ... 52/fid/130
function storeCaret(textEl) {
if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}
#
#-----[ REPLACE WITH ]---------------------------------------------
#
#
#-----[ FIND ]------------------------------------------
#
//-->
</script>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<script language="JavaScript" type="text/javascript" src="templates/quick_reply.js"></script>
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/posting_smilies.tpl
#
#-----[ FIND ]------------------------------------------
#
function emoticon(text) {
text = ' ' + text + ' ';
if (opener.document.forms['post'].message.createTextRange && opener.document.forms['post'].message.caretPos) {
var caretPos = opener.document.forms['post'].message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
opener.document.forms['post'].message.focus();
} else {
opener.document.forms['post'].message.value += text;
opener.document.forms['post'].message.focus();
}
}
#
#-----[ REPLACE WITH ]---------------------------------------------
#
function insert_at_cursor(text) {
if (opener.document.forms['post'].message.createTextRange && opener.document.forms['post'].message.caretPos) {
if (opener.baseHeight != opener.document.forms['post'].message.caretPos.boundingHeight) {
opener.document.forms['post'].message.focus();
opener.storeCaret(opener.document.forms['post'].message);
}
var caretPos = opener.document.forms['post'].message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
opener.document.forms['post'].message.focus();
} else {
if (is_nav && document.getElementById) {
mozWrap(opener.document.forms['post'].message, '', text);
} else {
opener.document.forms['post'].message.value += text;
}
opener.document.forms['post'].message.focus();
}
}
#
#-----[ FIND ]------------------------------------------
#
//-->
</script>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<script language="JavaScript" type="text/javascript" src="templates/quick_reply.js"></script>
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/posting_topic_review.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- END switch_inline_mode -->
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- BEGIN iframe_script -->
<script language="JavaScript" type="text/javascript">
<!--
l_no_text_selected = "{L_NO_TEXT_SELECTED}";
function insert_at_cursor(text) {
if (parent.top.document.forms['post'].message.createTextRange && parent.top.document.forms['post'].message.caretPos) {
if (parent.top.baseHeight != parent.top.document.forms['post'].message.caretPos.boundingHeight) {
parent.top.document.forms['post'].message.focus();
parent.top.storeCaret(parent.top.document.forms['post'].message);
}
var caretPos = parent.top.document.forms['post'].message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
parent.top.document.forms['post'].message.focus();
} else {
if (is_nav && document.getElementById) {
mozWrap(parent.top.document.forms['post'].message, '', text);
} else {
parent.top.document.forms['post'].message.value += text;
}
parent.top.document.forms['post'].message.focus();
}
}
-->
</script>
<script language="JavaScript" type="text/javascript" src="templates/quick_reply.js"></script>
<!-- END iframe_script -->
#
#-----[ FIND ]------------------------------------------
#
<td width="22%" align="left" valign="top" class="{postrow.ROW_CLASS}"><span class="name"><a name="{postrow.U_POST_ID}"></a><b>{postrow.POSTER_NAME}</b></span></td>
#
#-----[ IN-LINE FIND ]------------------------------------------
#
{postrow.POSTER_NAME}</b>
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
{postrow.QUOTE_LINK}
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/quick_reply.tpl
#
#-----[ FIND ]------------------------------------------
#
//-->
</script>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
var baseHeight;
window.onload = initInsertions;
// Fix a bug involving the TextRange object. From
// http://www.frostjedi.com/terra/scripts/ ... etBug.html
function initInsertions() {
document.post.message.focus();
if (is_ie && typeof(baseHeight) != 'number') baseHeight = document.selection.createRange().duplicate().boundingHeight;
}
function insert_at_cursor(text) {
var txtarea = document.post.message;
if (txtarea.createTextRange && txtarea.caretPos) {
if (baseHeight != txtarea.caretPos.boundingHeight) {
txtarea.focus();
storeCaret(txtarea);
}
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
} else {
if (is_nav && document.getElementById) {
mozWrap(txtarea, '', text);
} else {
txtarea.value += text;
}
}
txtarea.focus();
}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM[/code]
-
- phpBB 1.4.3
- Сообщения: 87
- Стаж: 20 лет 2 месяца
-
- phpBB 1.4.3
- Сообщения: 87
- Стаж: 20 лет 2 месяца