GolfHos
 
*
November 23, 2024, 12:35:43 AM
Username: Password: Duration:

Quote vs. MultiQuote

 
Pages: 1 [2]   Go Down
  Print  
Author Topic: Quote vs. MultiQuote  (Read 7719 times)
0 Members and 1 Lurker/Spider are viewing this topic.
spacey
Amazing Technicolor Dreamcoat
From: Group W Bench

Karma: 98
Posts: 7733
Offline Offline


View ProfileIgnore this user
Re: Quote vs. MultiQuote
« Reply #15 on: April 04, 2008, 04:12:48 PM »

D'oh!  Oops

There's a forum option to set this.  Embarrassed

At this point, it's either one way or the other, there's no option for buttons for both.  I don't have time now to get both options to work, so let's try having it default to a simple, non-nested quote and see if anyone cares.
The only potential drawback I can see is that now anything in quote tags is eliminated, as you can see with the above demonstration. Whether people will care?  Don't Know
Logged Return to Top
gleek
Flak Jacket

Karma: 107
Posts: 9511
Offline Offline

E chu ta!

View ProfileIgnore this user
Re: Quote vs. MultiQuote
« Reply #16 on: April 04, 2008, 04:23:35 PM »

I think the new setting is a little strange. I'd prefer that there be something there to indicate that something was removed.
Logged Return to Top

Woman, open the door, don't let it sting. I wanna breathe that fire again.
dystopia
Amazing Technicolor Dreamcoat
From: Silicon Valley

Karma: 94
Posts: 7929
Offline Offline


View ProfileIgnore this user
Re: Quote vs. MultiQuote
« Reply #17 on: April 04, 2008, 04:30:39 PM »

Hmm, tough call.  On the plus side, maybe it cuts back on thisDevil
« Last Edit: April 04, 2008, 04:35:14 PM by dystopia » Logged Return to Top
Uisce Beatha
Amazing Technicolor Dreamcoat
From: In the Jar

Karma: 116
Posts: 7357
Offline Offline

Get me the tank!

View ProfileIgnore this user
Re: Quote vs. MultiQuote
« Reply #18 on: April 04, 2008, 04:47:13 PM »


i.e. "shallow copy" vs. "deep copy"


Geek. Wink


I don't have time now to get both options to work...


"Lazy copy" ftw.   Shocked Shocked Shocked
Logged Return to Top

"If you're darker than a caramel, Reverend Al speaks for you." - Aasif Mandvi
"Well, you can tell by the way I use my walk, I'm a woman's man: no time to talk." - stroh
gleek
Flak Jacket

Karma: 107
Posts: 9511
Offline Offline

E chu ta!

View ProfileIgnore this user
Re: Quote vs. MultiQuote
« Reply #19 on: April 04, 2008, 04:54:10 PM »

If you want to try using JavaScript, this might give you an idea about how to implement it. This code will strip out any quotes that came from another post (as opposed to regular text wrapped in quote tags), and it will also leave any quotes that are inside code tags as-is. Whatever is stripped out is replaced with a brief message. You'll still have to wrap the resultant text in quote tags with references to the original post.

You can try it out here. Copy the code into the left textarea, and click the button. Then on the right-hand side, paste the message into the top textarea. Ah, you can figure it out.  Cheesy


Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Test</title>
<script type="text/javascript">
function sortnum(a, b)
{
return a - b;
}

function Strip()
{
var quoterep = '~~inane crap snipped~~';
var txtsrc = document.getElementById('txtSource');
var strsrc = txtsrc.value;
var QS$ = '[' + 'quote]';
var QS = '[' + 'quote';
var QE = '[' + '/quote]';
var CS = '[' + 'code]';
var CE = '[' + '/code]';

var tags = {};
var aryq1 = LoadHash(tags, strsrc, QS);
var aryq2 = LoadHash(tags, strsrc, QE);
var aryc1 = LoadHash(tags, strsrc, CS);
var aryc2 = LoadHash(tags, strsrc, CE);

var indices = new Array();
indices = indices.concat(aryq1,aryq2,aryc1,aryc2);
indices = indices.sort(sortnum);

var section = new Array();
var mode = level = sectionstart = curpos = 0;
var index, tag;
for (var i in indices)
{
    curpos = indices[i];
    tag = tags['i' + curpos];
    if (tag == QS && strsrc.substr(curpos, QS$.length) == QS$)
    {
        tag = QS$;
    }
   
    if (mode == 0)
    {
        if (tag == QS || tag == QS$ || tag == CS)
        {
            section.push(strsrc.substring(sectionstart, curpos - 1));
            sectionstart = curpos;
            switch (tag)
            {
                case CS:
                    mode = 1;
                    break;
                case QS$:
                    mode = 2;
                    break;
                default:
                    mode = 3;
            }
            level = 1;
        }
    }
    else if (mode == 1)
    {
        if (tag == CS)
        {
            level++;
        }
        else if (tag == CE)
        {
            level--;
            if (level == 0)
            {
                section.push(strsrc.substring(sectionstart, curpos += tag.length));
                mode = 0;
                sectionstart = curpos;
            }
        }
    }
    else if (mode == 2)
    {
        if (tag == QS$ || tag == QS)
        {
            level++;
        }
        else if (tag == QE)
        {
            level--;
            if (level == 0)
            {
                section.push(strsrc.substring(sectionstart, curpos += tag.length));
                mode = 0;
                sectionstart = curpos;
            }
        }
    }
    else if (mode == 3)
    {
        if (tag == QS$ || tag == QS)
        {
            level++;
        }
        else if (tag == QE)
        {
            level--;
            if (level == 0)
            {
                section.push(quoterep + '\r\n');
                sectionstart = curpos + tag.length;
                mode = 0;
            }
        }
    }
}
if (curpos < strsrc.length - 1)
{
    if (mode == 3)
    {
        section.push(quoterep + '\r\n');
    }
    else
    {
        section.push(strsrc.substring(sectionstart, strsrc.length - 1));
    }
}

document.getElementById('txtResult').value = section.join('');

}

function LoadHash(ohash, strsrch, strfind)
{
    var aryfind = new Array();
    var i = 0;
    var index;
    do
    {
        i = strsrch.indexOf(strfind, i);
        if (i != -1)
        {
            index = 'i' + i;
            ohash[index] = strfind;
            aryfind.push(i);
            i += strfind.length;
        }
    } while (i != -1)
    return aryfind;
}

</script>
  </head>
  <body>
  <div>
<input type="button" id="btnQuote" name="btnQuote" value="Strip Quotes" onclick="Strip(); return false;"/><br />
<span>Original Post:</span><br/>
<textarea id="txtSource" cols="50" rows="2" style="width:100%;height:100px;" /></textarea><br /><br />
<span>Stripped Post:</span><br/>
<textarea id="txtResult" cols="50" rows="2" style="width:100%;height:100px;" /></textarea>
  </div>
  </body>
</html>
Logged Return to Top

Woman, open the door, don't let it sting. I wanna breathe that fire again.
spacey
Amazing Technicolor Dreamcoat
From: Group W Bench

Karma: 98
Posts: 7733
Offline Offline


View ProfileIgnore this user
Re: Quote vs. MultiQuote
« Reply #20 on: April 04, 2008, 05:53:05 PM »

Hmm, tough call.  On the plus side, maybe it cuts back on thisDevil

Sold!
Logged Return to Top
gleek
Flak Jacket

Karma: 107
Posts: 9511
Offline Offline

E chu ta!

View ProfileIgnore this user
Re: Quote vs. MultiQuote
« Reply #21 on: April 04, 2008, 05:58:33 PM »

Sold!
Thumbs Up
Logged Return to Top

Woman, open the door, don't let it sting. I wanna breathe that fire again.
dystopia
Amazing Technicolor Dreamcoat
From: Silicon Valley

Karma: 94
Posts: 7929
Offline Offline


View ProfileIgnore this user
Re: Quote vs. MultiQuote
« Reply #22 on: April 05, 2008, 01:34:47 PM »

Grim.  I don't have time today to look at the smiley bug when nested quotes are removed, so I put it back to the way it used to be. Embarrassed
Logged Return to Top
Aske
Lederhosen

Karma: 120
Posts: 31405
Offline Offline


View ProfileIgnore this user
Re: Quote vs. MultiQuote
« Reply #23 on: April 05, 2008, 05:34:23 PM »

D'oh!  Oops

There's a forum option to set this.  Embarrassed

Quote
Remove nested quotes when posting - This will only show the quote of the post in question, not any quoted posts from that post.

At this point, it's either one way or the other, there's no option for buttons for both.  I don't have time now to get both options to work, so let's try having it default to a simple, non-nested quote and see if anyone cares.

test
Logged Return to Top

Quote
Russia has invaded a sovereign neighboring state and threatens a democratic government elected by its people. Such an action is unacceptable in the 21st century.
--  Chimpy McFlightsuit, CEO of Bu$hco Industries of 'Merka
Aske
Lederhosen

Karma: 120
Posts: 31405
Offline Offline


View ProfileIgnore this user
Re: Quote vs. MultiQuote
« Reply #24 on: April 05, 2008, 05:35:25 PM »

D'oh!  Oops

There's a forum option to set this.  Embarrassed

Quote
Remove nested quotes when posting - This will only show the quote of the post in question, not any quoted posts from that post.

At this point, it's either one way or the other, there's no option for buttons for both.  I don't have time now to get both options to work, so let's try having it default to a simple, non-nested quote and see if anyone cares.

test

test2
Logged Return to Top

Quote
Russia has invaded a sovereign neighboring state and threatens a democratic government elected by its people. Such an action is unacceptable in the 21st century.
--  Chimpy McFlightsuit, CEO of Bu$hco Industries of 'Merka
dystopia
Amazing Technicolor Dreamcoat
From: Silicon Valley

Karma: 94
Posts: 7929
Offline Offline


View ProfileIgnore this user
Re: Quote vs. MultiQuote
« Reply #25 on: April 05, 2008, 06:58:04 PM »

Grim.  I don't have time today to look at the smiley bug when nested quotes are removed, so I put it back to the way it used to be. Embarrassed

test
Logged Return to Top
stroh
Sleeveless Hoodie
From: Impact Crater Springs, CA

Karma: 155
Posts: 16135
Offline Offline

We're doomed!

View ProfileIgnore this user
Re: Quote vs. MultiQuote
« Reply #26 on: April 06, 2008, 08:35:03 AM »

Quote
Related Posts

None
Logged Return to Top
Pages: 1 [2]   Return to Top
  Print  
 
Jump to:  

Related Posts
MultiQuote
Right now it's not really a feature. When I click on MultiQuote it tells me
by Fuzzy

MultiQuote
???
by gleek

MultiQuote
bout time
by Walfredo

MultiQuote
Is this another one of those features that Golfhos gets and Prolefeed doesn'
by Clive

 


 
  Powered by SMF | SMF © 2001-2009, Lewis Media

Dilber MC Theme by HarzeM