From f6fb36de53036fe1a6e3d6445d5c157a6b5bb780 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Wed, 21 Nov 2001 23:08:10 +0000 Subject: [PATCH] Updated smilies + fixes for insertion of smilie at caret (IE/PC only) + Mac BBCode buttons ... perhaps, Tom git-svn-id: file:///svn/phpbb/trunk@1410 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/images/smiles/icon_razz.gif | Bin 177 -> 176 bytes phpBB/images/smiles/icon_surprised.gif | Bin 175 -> 174 bytes phpBB/templates/subSilver/posting_body.tpl | 132 ++++++++++++--------- 3 files changed, 76 insertions(+), 56 deletions(-) diff --git a/phpBB/images/smiles/icon_razz.gif b/phpBB/images/smiles/icon_razz.gif index d4307dccf8cbc7e2b2f58f756fd4c7baa3d77915..29da2a2fccc79981bc54db7513ca6d2374592f9d 100644 GIT binary patch literal 176 zcmZ?wbhEHb^3h|5y0`zsdjqAOHXV zwXw1B|EEADAfWh@g^_`Qk3k2-0hz(T5_`c@GHdRQt4o8V#Kj6YnC2W7^l?<@Q2(%O z^|TpzE=L6K%vq%4Qv0AgI88 ZPHWn(3w4)`M4Rs!oY|mbDlEug4FCb$KH>lX literal 177 zcmZ?wbhEHb!C`$i;Q_}4 aZpJNLTh;bFH4S@kz@EprN=#Ca!5RRp^g+h} diff --git a/phpBB/images/smiles/icon_surprised.gif b/phpBB/images/smiles/icon_surprised.gif index f391fa1d89d4f94628ad02a6ea5b104f2c582b5f..cb21424319829487d477e5f17262891c1be03e8c 100644 GIT binary patch delta 125 zcmV-@0D}Lo0j>d%7Zm^h|IPsa$pHSH0ROZA|NfKz{S%QZC0<*wNf~OLxK*YQA{Q2L zNdlaN5llfR2q*BStA?0y4r&SxpTB}Ca0AAIhYBLc1Qe11ob2^FJu3v@V7nD8gsVVS f!0i@x8UkTKHq%(@0`;uQR1WyVFvGIcCJ_KT({46Y delta 126 zcmV-^0D=Fm0j~j&7ZlC_|H%OUodEx|0RR0H|NsC0{*#d_C0|^yNf~OLxK*Z78W$FD z#{rx}5llfR2q*BStCpB?4r&SxpFe^sa09|#CxW4p$T= 4) && (navigator.appName == "Microsoft Internet Explorer")) - theSelection = document.selection.createRange().text; // Get text selection - - if (theSelection) { - // Add tags around selection - document.selection.createRange().text = theSelection + theSmilie + ' '; - formObj.message.focus(); - theSelection = ''; - return; - } - - - document.post.message.value += ' ' + theSmilie + ' '; +function emoticon(text) { + text = ' ' + text + ' '; + if (document.post.message.createTextRange && document.post.message.caretPos) { + var caretPos = document.post.message.caretPos; + caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text; + document.post.message.focus(); + } else { + document.post.message.value += text; document.post.message.focus(); + } } -function bbfontstyle(formObj, bbopen, bbclose) { - if ((parseInt(navigator.appVersion) >= 4) && (navigator.appName == "Microsoft Internet Explorer")) { +function bbfontstyle(bbopen, bbclose) { + if ((clientVer >= 4) && is_ie && is_win) { theSelection = document.selection.createRange().text; if (!theSelection) { - formObj.message.value += bbopen + bbclose; - formObj.message.focus(); + document.post.message.value += bbopen + bbclose; + document.post.message.focus(); return; } document.selection.createRange().text = bbopen + theSelection + bbclose; - formObj.message.focus(); + document.post.message.focus(); return; } else { - formObj.message.value += bbopen + bbclose; - formObj.message.focus(); + document.post.message.value += bbopen + bbclose; + document.post.message.focus(); return; } } -function bbstyle(formObj, bbnumber) { +function bbstyle(bbnumber) { donotinsert = false; theSelection = false; @@ -126,21 +140,21 @@ function bbstyle(formObj, bbnumber) { if (bbnumber == -1) { // Close all open tags & default button names while (bbcode[0]) { butnumber = arraypop(bbcode) - 1; - formObj.message.value += bbtags[butnumber + 1]; - buttext = eval('formObj.addbbcode' + butnumber + '.value'); - eval('formObj.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"'); + document.post.message.value += bbtags[butnumber + 1]; + buttext = eval('document.post.addbbcode' + butnumber + '.value'); + eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"'); } - formObj.message.focus(); + document.post.message.focus(); return; } - if ((parseInt(navigator.appVersion) >= 4) && (navigator.appName == "Microsoft Internet Explorer")) + 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]; - formObj.message.focus(); + document.post.message.focus(); theSelection = ''; return; } @@ -156,33 +170,39 @@ function bbstyle(formObj, bbnumber) { if (donotinsert) { // Close all open tags up to the one just clicked & default button names while (bbcode[bblast]) { butnumber = arraypop(bbcode) - 1; - formObj.message.value += bbtags[butnumber + 1]; - buttext = eval('formObj.addbbcode' + butnumber + '.value'); - eval('formObj.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"'); + document.post.message.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; } - formObj.message.focus(); + document.post.message.focus(); return; } else { // Open tags if (imageTag && (bbnumber != 14)) { // Close image tag before adding another - formObj.message.value += bbtags[15]; + document.post.message.value += bbtags[15]; lastValue = arraypop(bbcode) - 1; // Remove the close image tag from the list - formObj.addbbcode14.value = "Img"; // Return button back to normal state + document.post.addbbcode14.value = "Img"; // Return button back to normal state imageTag = false; } // Open tag - formObj.message.value += bbtags[bbnumber]; + document.post.message.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('formObj.addbbcode'+bbnumber+'.value += "*"'); - formObj.message.focus(); + eval('document.post.addbbcode'+bbnumber+'.value += "*"'); + document.post.message.focus(); return; } } +// Insert at Claret position. Code from +// http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130 +function storeCaret(textEl) { + if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate(); +} + //-->
@@ -192,7 +212,7 @@ function bbstyle(formObj, bbnumber) { -
{L_INDEX} + {SITENAME} {L_INDEX} -> {FORUM_NAME}
@@ -246,7 +266,7 @@ function bbstyle(formObj, bbnumber) { Neutral Sad Uncertain - Surprise + Surprise Roll eyes @@ -275,31 +295,31 @@ function bbstyle(formObj, bbnumber) { @@ -307,7 +327,7 @@ function bbstyle(formObj, bbnumber) {
- + - + - + - + - + - + - + - + - +
-
 Font color: - @@ -327,7 +347,7 @@ function bbstyle(formObj, bbnumber) {  Font size: - @@ -335,7 +355,7 @@ function bbstyle(formObj, bbnumber) { Close + Close Tags
@@ -348,7 +368,7 @@ function bbstyle(formObj, bbnumber) { - +