|
Thanks Paul, thanks Mike!
The quote button is in.
cheers,
Chris Maunder (CodeProject)
|
|
|
|
|
*highlight text*
*click quote*
Chris Maunder wrote:
Thanks Paul, thanks Mike!
The quote button is in.
Ooooohhhhh
Now all we need is a "Generate rational, intelligent and rallying counter arguement" button...
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
Do you Sonork? I do! 100.9903 Stormfront
"The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge
|
|
|
|
|
Here's code that will append the current selection to the end of the textarea's contents. I couldn't figure out how to insert it at the current caret position (or even how to get the caret position).
Button1 = your Paste button, Text1 = the text box.
function Button1_onclick() {
var seltext = document.selection.createRange().text;
if ( seltext != "" )
Text1.value += seltext;
}
--Mike--
http://home.inreach.com/mdunn/
#include "witty_sig.h"
your with and
|
|
|
|
|
I couldn't figure out how to insert it at the current caret position (or even how to get the caret position).
I noticed that when inserting emoticons on CP it also just puts it at the end of the text, not where the cursor is.
However, seeing as focus is passed to the Quote button would there be a cursor (caret) position to get? I guess onblur of the textbox you could record the last caret position and use that. Then when you click the Quote button it uses the caret variable as the position... hmmm might work.
brb, trying it out
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
Do you Sonork? I do! 100.9903 Stormfront
"The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge
|
|
|
|
|
Paul Watson wrote:
I guess onblur of the textbox you could record the last caret position and use that. Then when you click the Quote button it uses the caret variable as the position... hmmm might work.
brb, trying it out
Any luck?
cheers,
Chris Maunder (CodeProject)
|
|
|
|
|
Chris Maunder wrote:
Any luck?
Here it is Chris. Once again not all my work, got it from FAQTs - Knowledge Base.
I took your new Quote code and put in the other code.
Once again it uses the TextRange object and then the CharAt method.
You may have to do a few more tests than I did on recording the caret position from the TEXTAREA as I have only covered OnClick and OnKeyPress. (Avoid the OnBlur, something odd happens)
You could also use the functions for inserting the Emoticons! That would be nice
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<script language='JavaScript'>
<!--
function QuoteText(author)
{
var txt = "";
if (document.getSelection) txt = document.getSelection();
else if (document.selection) txt = document.selection.createRange().text;
else return;
var emph = false;
emph = true
var TextArea = txtReply;
if (txt !== "") {
var text = "";
var length = text.length;
if (length > 0 && text.charAt(length-1) != "\n") text += "\n\n";
text += (author + " wrote:\n");
if (emph) text += "<i>";
text += txt;
if (emph) text += "</i>";
text += "\n\n";
insertAtCaret(TextArea, text);
TextArea.focus();
}
else
alert('You did not select any text to quote');
}
function storeCaret (textEl)
{
if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}
function insertAtCaret (textEl, text)
{
if (textEl.createTextRange && textEl.caretPos)
{
var caretPos = textEl.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
}
else textEl.value = text;
}
</script>
<body>
<DIV id="divOriginal" style="padding: 5px; width: 400px; border: 1px solid #cccccc">
Colin Davies wrote:
Yeah the quote button is a cool idea<BR><BR>
Thank Paul Watson and Mike Dunn for the kick in the bum to get this feature added.<BR><BR>
cheers,<BR>
Chris Maunder (CodeProject)
</DIV>
<BR><INPUT type="Button" name="cmdQuote" value="Quote that!" onclick="QuoteText('Bob');"><BR><BR>
<TEXTAREA name="txtReply" id="txtReply"
rows="20" cols="47"
style="width: 400px;"
onclick="storeCaret(this);"
onkeypress="storeCaret(this);" ></TEXTAREA>
</body>
</html>
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
Do you Sonork? I do! 100.9903 Stormfront
"The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge
|
|
|
|
|
Thanks Paul!
I had a go at this but it didn't seem to be consistently saving the carrot position. I'll have a second attempt later.
cheers,
Chris Maunder (CodeProject)
|
|
|
|
|
Hmmm, in what instances doesn't it record the caret position? I will have a look at it and fiddle.
(lame joke alert!) I may call Bugs Bunny, he is good with carrots...
Chris Maunder wrote:
cheers,
Chris Maunder (CodeProject)
Damn I like clicking that button...
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
Do you Sonork? I do! 100.9903 Stormfront
"The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge
|
|
|
|
|
I only had a brief time to play and it seemed semi-random. I'll have to sit down and really thrash it out.
cheers,
Chris Maunder (CodeProject)
|
|
|
|
|
1) A good idea would be to slightly vary the table row background of each forum message entry so that the subject can be linked to the author more easily. Just vary the orange slightly for conso that you can read across without jumping lines (as my eyes always tend to do.) I often find it difficult to link a post with an author on big threads.
2) There could be an 'expand all messages' option on the DHTML view so that IE can expand every messsage on the page. It would result in one huge page with all of the message text available with no clicking. Handy for sitting back and letting the page scroll.
Simon
Hey, it looks like you're writing a letter!
|
|
|
|
|
How about setting one of these up Chris? With a special Retromingents sections for john and all of his friends.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
"Don't belong. Never join. Think for yourself. Peace"
- Victor Stone
|
|
|
|
|
The gender ratio would be a problem. For every one girl, there are 500 guys here. Perhaps even 1000.
Nish
|
|
|
|
|
I doubt the ratio is that high! Probably 50 to 1 i'd say.
Simon
Hey, it looks like you're writing a letter!
|
|
|
|
|
How about a virtual dating service that would allow geeks to date without risk of actual human contact? That would allow us to indulge in our wildest fantasies without having to make small talk, shave or leave our CPU.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
Already been done: It is called IRC
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
"The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge
"In other words, the developer is dealing with an elephant, the accountant is dealing with a bunny rabbit." by Stan Shannon - 16/10/2001
|
|
|
|
|
Some way to reply to the root of the thread from anywhere within the thread would be useful.
What happens to me is that I read the entire thread and then decide I want to say something about the thread, (or post off topic, you know me ), and I am three pages away from the root message. If I want my post to be in response to the root message then I have to page back to the root.
Or is there a way to do this already that I am managing to overlook?
Jason Jystad
Cito Technologies
www.citotech.net
>------------------------------------------------<
"Luckily," he went on, "you have come to exactly the right place with your interesting problem, for there is no such word as 'impossible' in my dictionary. In fact," he added, brandishing the abused book, "everything between 'herring' and 'marmalade' seems to be missing."
-- Dirk Gently (Douglas Adams)
>------------------------------------------------<
|
|
|
|
|
Click on [View Thread]
Nish
|
|
|
|
|
I don't really like the thread view, but I tried it out and it doesn't seem to give me any way to do what I am talking about.
Maybe I am just not seeing it, it is past my bedtime I'll try again in the morning.
Jason Jystad
Cito Technologies
www.citotech.net
>------------------------------------------------<
"Luckily," he went on, "you have come to exactly the right place with your interesting problem, for there is no such word as 'impossible' in my dictionary. In fact," he added, brandishing the abused book, "everything between 'herring' and 'marmalade' seems to be missing."
-- Dirk Gently (Douglas Adams)
>------------------------------------------------<
|
|
|
|
|
No!
I didnt ask you to change your forum view to Thread View
At the bottom of each post you have several links.
One of them says [Thread View]
When you click on that, it takes you to a page showing the first 25/50 posts in that thread. Try it out. It works.
Nish
|
|
|
|
|
Aaahh!
Kick butt!
Thanks Nish, I didn't even notice that link!
I see now, it takes you to the same page you get if you surf in from an e-mail. Rock on!
Never mind Chris, Nish has made me all happy and you didn't even have to change anything!
Jason Jystad
Cito Technologies
www.citotech.net
>------------------------------------------------<
"Luckily," he went on, "you have come to exactly the right place with your interesting problem, for there is no such word as 'impossible' in my dictionary. In fact," he added, brandishing the abused book, "everything between 'herring' and 'marmalade' seems to be missing."
-- Dirk Gently (Douglas Adams)
>------------------------------------------------<
|
|
|
|
|
Nish
|
|
|
|
|
I was just looking at who's birthdays it was today in the demograhics option and it said it would list for the 30th Oct to 1st November. But it also showed 2nd Nov - 9th Nov!
Is it a bug?
Roger Allen the man
|
|
|
|
|
Chris is getting bad at SQL
Nish
|
|
|
|
|
No - the SQL was perfect. The ASP on the other hand...
cheers,
Chris Maunder (CodeProject)
|
|
|
|
|
Hello Chris,
will it be possible to make TheLounge page to autoreload itself all 5 or 10 minutes ?
Stephane
|
|
|
|