What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » General » Forum & Website » Every time i quote a post from .Lou i get..

Pages: (3): « First « 1 [ 2 ] 3 » Last »
Every time i quote a post from .Lou i get..
Author: Message:
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
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
Profile PM Web Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
35 / Male / Flag
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 :P
[Image: dt2.0v2.png]      Happy Birthday, WDZ
03-20-2008 02:13 AM
Profile PM Web Find Quote Report
NanaFreak
Scripting Contest Winner
*****


Posts: 1476
Reputation: 53
32 / Male / Flag
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 :P
do it!
03-20-2008 05:28 AM
Profile PM Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
35 / Male / Flag
Joined: Mar 2004
RE: Every time i quote a post from .Lou i get..
heres the new improved code :P

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 :D

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-.
[Image: dt2.0v2.png]      Happy Birthday, WDZ
03-20-2008 06:58 AM
Profile PM Web Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
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 :tongue:), clicking the [Image: qquote.gif] 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
Profile PM Web Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
35 / Male / Flag
Joined: Mar 2004
RE: Every time i quote a post from .Lou i get..
quote:
Originally posted by WDZ
Looks nice, but IIRC the old code "cached" the selected text for a reason: in some browsers (not sure which :tongue:), clicking the [Image: qquote.gif] 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... :\
hm i thought that might have been why, but in a test with IE7 and firefox it seemed fine. probably an IE6 thing...
[Image: dt2.0v2.png]      Happy Birthday, WDZ
03-20-2008 09:57 AM
Profile PM Web Find Quote Report
Quantum
Disabled Account
*****

Away.

Posts: 1055
Reputation: -17
30 / Male / Flag
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...
No longer here.
03-20-2008 04:09 PM
Profile PM Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
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." :p
03-21-2008 05:15 AM
Profile PM Web Find Quote Report
John Anderton
Elite Member
*****

Avatar

Posts: 3908
Reputation: 80
37 / Male / Flag
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
Profile E-Mail PM Web Find Quote Report
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 :P.

This post was edited on 03-21-2008 at 11:10 AM by user35870.
03-21-2008 11:06 AM
Profile PM Find Quote Report
Pages: (3): « First « 1 [ 2 ] 3 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On