[Phpfreechat-svn] SF.net SVN: phpfreechat: [685] trunk/src/client
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-08-22 12:24:33
|
Revision: 685 Author: kerphi Date: 2006-08-22 05:24:26 -0700 (Tue, 22 Aug 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=685&view=rev Log Message: ----------- [en] Add a popup dialog to ask some text for the bbcode buttons (thanks to Mephisto). [fr] Ajout d'un popup pour demander d'entrer du texte lorsque l'utilisateur a selectionn?\195?\169 un texte vide au moment d'appliquer un bbcode (merci ?\195?\160 Mephisto). Modified Paths: -------------- trunk/src/client/chat.js.tpl.php trunk/src/client/pfcclient.js Modified: trunk/src/client/chat.js.tpl.php =================================================================== --- trunk/src/client/chat.js.tpl.php 2006-08-19 20:54:57 UTC (rev 684) +++ trunk/src/client/chat.js.tpl.php 2006-08-22 12:24:26 UTC (rev 685) @@ -57,31 +57,32 @@ <?php $labels_to_load = -array( "Do you really want to leave this room ?", - "Hide nickname marker", - "Show nickname marker", - "Hide dates and hours", - "Show dates and hours", - "Disconnect", - "Connect", - "Magnify", - "Cut down", - "Hide smiley box", - "Show smiley box", - "Hide online users box", - "Show online users box", - "Please enter your nickname", - "Private message", - "Close this tab", - "Enter your message here", - "Enter your nickname here", - "Bold", - "Italics", - "Underline", - "Delete", - "Mail", - "Color", - "PHP FREE CHAT [powered by phpFreeChat-%s]", +array( "Do you really want to leave this room ?", // _pfc + "Hide nickname marker", // _pfc + "Show nickname marker", // _pfc + "Hide dates and hours", // _pfc + "Show dates and hours", // _pfc + "Disconnect", // _pfc + "Connect", // _pfc + "Magnify", // _pfc + "Cut down", // _pfc + "Hide smiley box", // _pfc + "Show smiley box", // _pfc + "Hide online users box", // _pfc + "Show online users box", // _pfc + "Please enter your nickname", // _pfc + "Private message", // _pfc + "Close this tab", // _pfc + "Enter your message here", // _pfc + "Enter your nickname here", // _pfc + "Bold", // _pfc + "Italics", // _pfc + "Underline", // _pfc + "Delete", // _pfc + "Mail", // _pfc + "Color", // _pfc + "PHP FREE CHAT [powered by phpFreeChat-%s]", // _pfc + "Enter the text to format", // _pfc ); foreach($labels_to_load as $l) { Modified: trunk/src/client/pfcclient.js =================================================================== --- trunk/src/client/pfcclient.js 2006-08-19 20:54:57 UTC (rev 684) +++ trunk/src/client/pfcclient.js 2006-08-22 12:24:26 UTC (rev 685) @@ -1185,8 +1185,15 @@ { msgfield.focus(); sel = document.selection.createRange(); - sel.text = open + sel.text + close; - msgfield.focus(); + var text = sel.text; + if (text == "") + text = prompt(this.res.getLabel('Enter the text to format'),''); + if (text.length > 0) + { + sel.text = open + text + close; + // @todo move the cursor just after the BBCODE, this doesn't work when the text to enclose is selected, IE6 keeps the whole selection active after the operation. + msgfield.focus(); + } } // Moz support @@ -1195,16 +1202,30 @@ var startPos = msgfield.selectionStart; var endPos = msgfield.selectionEnd; - msgfield.value = msgfield.value.substring(0, startPos) + open + msgfield.value.substring(startPos, endPos) + close + msgfield.value.substring(endPos, msgfield.value.length); - msgfield.selectionStart = msgfield.selectionEnd = endPos + open.length + close.length; - msgfield.focus(); + var text = msgfield.value.substring(startPos, endPos); + var extralength = 0; + if (startPos == endPos) + { + text = prompt(this.res.getLabel('Enter the text to format'),''); + extralength = text.length; + } + if (text.length > 0) + { + msgfield.value = msgfield.value.substring(0, startPos) + open + text + close + msgfield.value.substring(endPos, msgfield.value.length); + msgfield.selectionStart = msgfield.selectionEnd = endPos + open.length + extralength + close.length; + msgfield.focus(); + } } // Fallback support for other browsers else { - msgfield.value += open + close; - msgfield.focus(); + var text = prompt(this.res.getLabel('Enter the text to format'),''); + if (text.length > 0) + { + msgfield.value += open + text + close; + msgfield.focus(); + } } return; }, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |