Every time i quote a post from .Lou i get.. |
Author: |
Message: |
WDZ
Former Admin
Posts: 7106 Reputation: 107
– / /
Joined: Mar 2002
|
RE: Every time i quote a post from .Lou i get..
It's not a quick quote bug, it's either a browser bug or the result of you selecting something by mistake. The quick quote feature simply asks the browser for the "range of text selected by the user." That should be blank if you haven't selected anything. O_o
quote: Originally posted by vax
it's buggy in sense that it will quote text you've selected but clicked away from
True, but that's kind of a limitation... I think the feature would stop working properly in certain browsers if I changed it. =p
|
|
03-20-2008 12:00 AM |
|
|
-dt-
Scripting Contest Winner
;o
Posts: 1819 Reputation: 74
36 / /
Joined: Mar 2004
|
RE: Every time i quote a post from .Lou i get..
quote: Originally posted by WDZ
It's not a quick quote bug, it's either a browser bug or the result of you selecting something by mistake. The quick quote feature simply asks the browser for the "range of text selected by the user." That should be blank if you haven't selected anything. O_o
quote: Originally posted by vax
it's buggy in sense that it will quote text you've selected but clicked away from
True, but that's kind of a limitation... I think the feature would stop working properly in certain browsers if I changed it. =p
I could see if i could improve it a little
Happy Birthday, WDZ
|
|
03-20-2008 02:13 AM |
|
|
NanaFreak
Scripting Contest Winner
Posts: 1476 Reputation: 53
32 / /
Joined: Jul 2006
|
RE: Every time i quote a post from .Lou i get..
quote: Originally posted by -dt-
quote: Originally posted by WDZ
It's not a quick quote bug, it's either a browser bug or the result of you selecting something by mistake. The quick quote feature simply asks the browser for the "range of text selected by the user." That should be blank if you haven't selected anything. O_o
quote: Originally posted by vax
it's buggy in sense that it will quote text you've selected but clicked away from
True, but that's kind of a limitation... I think the feature would stop working properly in certain browsers if I changed it. =p
I could see if i could improve it a little
do it!
|
|
03-20-2008 05:28 AM |
|
|
-dt-
Scripting Contest Winner
;o
Posts: 1819 Reputation: 74
36 / /
Joined: Mar 2004
|
RE: Every time i quote a post from .Lou i get..
heres the new improved code
tested in IE and firefox
this new one should fix the crazy selection issues (blame the function quickquotesel1 for that : <) and if you're using a browser that supports selectionStart and selectionEnd then it should preserve the caret position
GM version:
http://version.thedt.net/scripts/GM/quickquotetester.user.js
code:
function quickquote(pid){
var sel = getCurrentSelection();
var messageElement = document.getElementsByName('message')[0];
if(!sel || sel == ""){
var postdata = document.getElementsByName('qq' + pid)[0].value;
var username = document.getElementsByName('qqu' + pid)[0].value;
insertAtCurrentSelection("[quote=" + username + "]" + postdata + "[/quote]\r\n", messageElement);
}else{
insertAtCurrentSelection("[quote]" + sel + "[/quote]\n", messageElement);
}
}
//inserts at the current selection and moves carret
function insertAtCurrentSelection(text, element){
if(element.selectionStart !== undefined && element.selectionEnd !== undefined){
var value = element.value;
var startString = value.substring(0, element.selectionStart);
var endString = value.substring(element.selectionEnd, value.length);
var newSelPos = element.selectionEnd + text.length;
element.value = startString + text + endString;
element.focus();
element.setSelectionRange(newSelPos, newSelPos);
}else{
//IE doesnt have per input selection, only document.selection, so we cannot insert at the correct position :(
element.value += text;
element.focus();
}
}
function getCurrentSelection(){
//good browsers
if(window.getSelection){
return window.getSelection().toString();
//IE
}else if(document.selection && document.selection.type == 'Text' && document.selection.createRange){
return document.selection.createRange().text;
}else{
return false;
}
}
This post was edited on 03-20-2008 at 06:58 AM by -dt-.
Happy Birthday, WDZ
|
|
03-20-2008 06:58 AM |
|
|
WDZ
Former Admin
Posts: 7106 Reputation: 107
– / /
Joined: Mar 2002
|
RE: Every time i quote a post from .Lou i get..
Looks nice, but IIRC the old code "cached" the selected text for a reason: in some browsers (not sure which ), clicking the button will actually unselect the text before quickquote() has a chance to grab it.
I read that using onmousedown instead of onclick for the button will solve that problem though... :\
|
|
03-20-2008 08:51 AM |
|
|
-dt-
Scripting Contest Winner
;o
Posts: 1819 Reputation: 74
36 / /
Joined: Mar 2004
|
|
03-20-2008 09:57 AM |
|
|
Quantum
Disabled Account
Away.
Posts: 1055 Reputation: -17
31 / /
Joined: Feb 2007
|
O.P. RE: Every time i quote a post from .Lou i get..
quote: Originally posted by ShawnZ
quote: Originally posted by Chris UK
Try clearing your cache to get a fresh copy of the JavaScript files and then restart your browser.
wtf?! what does that have to do with it? he's obviously just selected his PM text at one point, and his browser is still saying it's selected or something...
No. I didn't and never have...
|
|
03-20-2008 04:09 PM |
|
|
WDZ
Former Admin
Posts: 7106 Reputation: 107
– / /
Joined: Mar 2002
|
RE: Every time i quote a post from .Lou i get..
The improved code is online now... I tested it in IE6 and it actually works fine, so that's good enough for me.
@dt: I didn't like how your code omitted the username when quoting selected text, so I removed that "feature."
|
|
03-21-2008 05:15 AM |
|
|
John Anderton
Elite Member
Posts: 3908 Reputation: 80
37 / /
Joined: Nov 2004
Status: Away
|
RE: Every time i quote a post from .Lou i get..
quote: Originally posted by Chris UK
Try clearing your cache to get a fresh copy of the JavaScript files and then restart your browser.
Not really.. this is possibly one of the oldest forum bugs ever..
Quick Quote works in such a way that it allows you to quote the last text for an entire post instead of the entire post ie you can quote only this one line from my post and leave everything else out. For that purpose it checks the selected/last selected text on that page by you.. if that happens to not be the same post as you clicked the quick quote button then.. well it can't do anything (meaning highlighting my post and clicking the quick quote button on say ShawnZ's post would show ShawnZ had said what I did).
Solution is to reselect what you want to actually quote and then click the quick quote button on that person's post.
[
KarunAB.com]
[img]http://gamercards.exophase.com/459422.png[
/img]
|
|
03-21-2008 05:58 AM |
|
|
user35870
Disabled Account
Posts: 858
Joined: Aug 2004
Status: Away
|
RE: Every time i quote a post from .Lou i get..
Oh, ok - didn't know about that bug .
This post was edited on 03-21-2008 at 11:10 AM by user35870.
|
|
03-21-2008 11:06 AM |
|
|
Pages: (3):
« First
«
1
[ 2 ]
3
»
Last »
|
|