crash писал(а):SemenH8
так возьми и напиши здесь решение проблемы
В стиле prosilver в папке template есть фаил posting_buttons.html. Можно из админки редактировать. Открываем его.
Наша (моя) задача: добавить строку с кнопками символов на страницу набора сообщения и сохранить при этом возможность добавлять BBCode средствами предоставленными в административном разделе. Вот мое решение этой задачи:
1). Создаем новый массив var
bbtags2 = new Array(...) и размещаем его под старым:
Код: Выделить всё
// Define the bbCode tags
var bbcode = new Array();
var bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','
','
','
','[img]','[/img]','
','','[flash=]', '[/flash]','[size=]','[/size]'<!-- BEGIN custom_tags -->, {custom_tags.BBCODE_NAME}<!-- END custom_tags -->);
var bbtags2 = new Array ('α','','β','','γ','','δ','','ε','','λ','','μ','','ν','','ξ','','π','','ρ','','σ','','τ','','υ','','φ','','ψ','','ω','','Δ','','→','','↔','','↑','','↓','','≈','','≠','','√','','±','','∞',''<!-- BEGIN custom_tags -->, {custom_tags.BBCODE_NAME}<!-- END custom_tags -->);
var imageTag = false;[/code]
Добавлено спустя 11 минут 2 секунды:
crash писал(а):SemenH8
так возьми и напиши здесь решение проблемы
В стиле prosilver в папке template есть фаил posting_buttons.html. Можно из админки редактировать. Открываем его.
Наша (моя) задача: добавить строку с кнопками символов на страницу набора сообщения и сохранить при этом возможность добавлять BBCode средствами предоставленными в административном разделе. Вот мое решение этой задачи:
1). Создаем новый массив var
bbtags2 = new Array(...) и размещаем его под старым:
Код: Выделить всё
// Define the bbCode tags
var bbcode = new Array();
var bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','
','
','
','[img]','[/img]','
','','[flash=]', '[/flash]','[size=]','[/size]'<!-- BEGIN custom_tags -->, {custom_tags.BBCODE_NAME}<!-- END custom_tags -->);
var bbtags2 = new Array ('α','','β','','γ','','δ','','ε','','λ','','μ','','ν','','ξ','','π','','ρ','','σ','','τ','','υ','','φ','','ψ','','ω','','Δ','','→','','↔','','↑','','↓','','≈','','≠','','√','','±','','∞',''<!-- BEGIN custom_tags -->, {custom_tags.BBCODE_NAME}<!-- END custom_tags -->);
var imageTag = false;[/code]
2). Создаем новую строку с функциональными кнопками, на которых находится изображение символов:
Код: Выделить всё
<!-- ENDIF --> //это последняя строка стандартного файла posting_buttons.html
<div> // а это, новая строка с кнопками
<input type="button" class="button2" accesskey=α name="0001" value=α style="font-weight: width: 30px" onclick="bbstyle2(0)" title="альфа" />
<input type="button" class="button2" accesskey=β name="0002" value=β style="font-weight: width: 30px" onclick="bbstyle2(2)" title="бета" />
<input type="button" class="button2" accesskey=γ name="0003" value=γ style="font-weight: width: 30px" onclick="bbstyle2(4)" title="гамма" />
<input type="button" class="button2" accesskey=δ name="0004" value=δ style="font-weight: width: 30px" onclick="bbstyle2(6)" title="дельта" />
<input type="button" class="button2" accesskey=ε name="0005" value=ε style="font-weight: width: 30px" onclick="bbstyle2(8)" title="эпсилон" />
<input type="button" class="button2" accesskey=λ name="0006" value=λ style="font-weight: width: 30px" onclick="bbstyle2(10)" title="ламбда" />
<input type="button" class="button2" accesskey=μ name="0007" value=μ style="font-weight: width: 30px" onclick="bbstyle2(12)" title="ми" />
<input type="button" class="button2" accesskey=ν name="0008" value=ν style="font-weight: width: 30px" onclick="bbstyle2(14)" title="ни" />
<input type="button" class="button2" accesskey=ξ name="0009" value=ξ style="font-weight: width: 30px" onclick="bbstyle2(16)" title="кси" />
<input type="button" class="button2" accesskey=π name="0010" value=π style="font-weight: width: 30px" onclick="bbstyle2(18)" title="пи" />
<input type="button" class="button2" accesskey=ρ name="0011" value=ρ style="font-weight: width: 30px" onclick="bbstyle2(20)" title="ро" />
<input type="button" class="button2" accesskey=σ name="0012" value=σ style="font-weight: width: 30px" onclick="bbstyle2(22)" title="сигма" />
<input type="button" class="button2" accesskey=τ name="0013" value=τ style="font-weight: width: 30px" onclick="bbstyle2(24)" title="тау" />
<input type="button" class="button2" accesskey=υ name="0014" value=υ style="font-weight: width: 30px" onclick="bbstyle2(26)" title="ипсилон" />
<input type="button" class="button2" accesskey=φ name="0015" value=φ style="font-weight: width: 30px" onclick="bbstyle2(28)" title="фи" />
<input type="button" class="button2" accesskey=ψ name="0016" value=ψ style="font-weight: width: 30px" onclick="bbstyle2(30)" title="пси" />
<input type="button" class="button2" accesskey=ω name="0017" value=ω style="font-weight: width: 30px" onclick="bbstyle2(32)" title="омега" />
<input type="button" class="button2" accesskey=Δ name="0018" value=Δ style="font-weight: width: 30px" onclick="bbstyle2(34)" title="Дельта" />
<input type="button" class="button2" accesskey=→ name="0019" value=→ style="font-weight:bold; width: 30px" onclick="bbstyle2(36)" title="прямое направление реакции" />
<input type="button" class="button2" accesskey=↔ name="0020" value=↔ style="font-weight:bold; width: 30px" onclick="bbstyle2(38)" title="обратимая реакция" />
<input type="button" class="button2" accesskey=↑ name="0021" value=↑ style="font-weight:bold; width: 30px" onclick="bbstyle2(40)" title="газ" />
<input type="button" class="button2" accesskey=↓ name="0022" value=↓ style="font-weight:bold; width: 30px" onclick="bbstyle2(42)" title="осадок" />
<input type="button" class="button2" accesskey=≈ name="0023" value=≈ style="font-weight:bold; width: 30px" onclick="bbstyle2(44)" title="примерно" />
<input type="button" class="button2" accesskey=≠ name="0024" value=≠ style="font-weight:bold; width: 30px" onclick="bbstyle2(46)" title="неравно" />
<input type="button" class="button2" accesskey=√ name="0025" value=√ style="font-weight:bold; width: 30px" onclick="bbstyle2(48)" title="корень" />
<input type="button" class="button2" accesskey=± name="0026" value=± style="font-weight:bold; width: 30px" onclick="bbstyle2(50)" title="+/-" />
<input type="button" class="button2" accesskey=∞ name="0027" value=∞ style="font-weight:bold; width: 30px" onclick="bbstyle2(52)" title="знак бесконечности" />
</div>
3). Копируем код функции bbstyle из файла
editor.js в конец фаила posting_buttons.html и корректируем код: я напрмер, просто подставил 2 к именам - bbstyle2, bbtags2, bbnumber2
Код: Выделить всё
</div> //конец строки с кнопками
<script type="text/javascript">
function bbstyle2(bbnumber2)
{
if (bbnumber2 != -1)
{
bbfontstyle(bbtags2[bbnumber2], bbtags2[bbnumber2+1]);
}
else
{
insert_text('[*]');
document.forms[form_name].elements[text_name].focus();
}
}
</script>
Хочу заметить, что в новом массиве
bbtags2, в моем случае, нечетный элемент массива - пустой, т.е. ...,'',...