Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Major Quotations extension update

edited June 2009 in Vanilla 1.0 Help
If you're using the latest Vanilla revision, and wondering why the Quotations extension wasn't working, well I fixed it. The changes to the XHTML templates were messing up the javascript, causing it to return blanks. All has been rectified.

Also I updated the stylesheet to reflect the new layout, and to be a little more "Vanilla-like".

Get it here



  • you don't have enough info in the header for it to be recognized.

    i added Extension Url: and it worked.
  • Whoops. Fixed.
  • i had already rewritten your extension to work with the new DOM and combined it with some other dude's quote extension that works with partial selection too. it took me a while to figure out the xhtml, so i'll be interested to see "the right way to do it" :)
  • Oooh, partial selection would be cool.
  • nothing to it... document.getSelection(). just be sure to use onmousedown instead of onclick, because lots of browsers including firefox 1.5 clear the selection before onclick fires.
  • Hmm, document.getSelection() only returns text, though.
  • how do you mean? isn't it supposed to? :)

    oh, you mean like if i selected some text and an image, i'd want the image included?

    maybe there's a clever solution but i can't think of it. maybe match the first part and the last part of the selection, using the comment id as identified by the quote link, with a regex, to pull the rest of the stuff in between. sounds unreliable at best :)

    anyway my users are happy with the partial selection as it works now.
  • you might also try messing with a mysterious property called anchorOffset - i can't find much documentation about it, but it supposedly marks the start of the selection as related to the beginning of the text in the node.
  • Any working versions of the Quotations extension for a very recent 0.9.3?
  • edited April 2006
    Any working versions of the Quotations extension for a very recent 0.9.3?
    The version linked above was tested with revision #358, and seems to work fine. (certainly better than it worked before)
  • ithcyithcy New
    edited April 2006
    hey bergamot, check this out!
    function quote() { var d = document.createElement("p"), s = getSelection(); for(var i = 0; i < s.rangeCount; ++i) { var r = s.getRangeAt(i); if (!r.collapsed) d.appendChild(r.cloneContents()); } alert(d.innerHTML); }

    put that in a document with some html-formatted text, and call quote with onmousedown when you've got a selection. it worked perfectly for me in firefox 1.5!
  • ithcyithcy New
    edited April 2006
    well, almost perfectly. it catches everything except the outermost tag.
    for example if i select all of this: ddddddsss

    it returns ddd<u>ddd</u>sss, so it's missing the <em> tags.

    but i think i can make it work.
  • edited April 2006
    Ok, I made those changes and reuploaded it. Seems to work fine, and I didn't run into your bug (probably because I wasn't using innerHTML, which is evil).

    In Internet Explorer, it just ignores the selection and quotes the whole post; I'll mess with that later.

    My code is here, if you want to look at it.
  • hmm... doesn't work for me in firefox

    oh, i think i see. you need to use onmousedown instead of onclick for the quote link.
  • yeah, that fixed it.
  • but there is another problem.
    no matter where i click quote on the page, it always cites the author of the last comment on the page. i had that problem for a while and i ended up having to re-analyze the dom tree and get all the elements by a different method.

    my code is here but it looks nothing like yours :)
    also i haven't added the new appendChild business yet.
  • edited April 2006

    I think it's finally working. Of course, I thought that the last time, and there were still bugs.

    Anyone want to try it?

    Ithcy: I ended up using some of your code.
  • edited April 2006
    Yup works perfect, (by works perfect I mean I barely tested it but it does now get the new quote).

    You can try it out over at this board
  • edited April 2006 ahahahahah
  • And that right there is the exact reason I won't be bothering to install any quote feature on my site :P

    Still a very nice extension, good work Bergamot!
Sign In or Register to comment.