Quick Quote Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.
2 posters

    Quick Quote

    avatar
    troyeccles
    Forumember


    Posts : 301
    Reputation : 5
    Language : English

    In progress Quick Quote

    Post by troyeccles Tue 1 Sep - 11:20

    Hi,

    There may be an issue with my Quick Quote javascript.

    It works ok when you select a bunch of text and then hit QUOTE but I'd have thought that the QUOTE button would have worked as normal...but it's now broken; unless you highlight a part (or all) of the text, it does nothing.

    The script is below. Can anyone help to make the QUOTE button work or do I have to add in a new QUICK quote button alongside the original one?

    --------

    $(function(){
      var forum_version = 1, 
      new_button = false,
      quote_image = 'https://i.servimg.com/u/f39/18/21/60/73/quick10.png';

      if (forum_version == 0) n = [".postbody div",".name strong a"];
      if (forum_version == 1) n = [".postbody .content div",".postprofile dl dt strong a"];
      if (forum_version == 2) n = [".entry-content div",".username a"];
      if (forum_version == 3) n = [".post-entry div",".postprofile-details dt a + br + a"];
      if (new_button == true) { q = ".quickquote"; $(forum_version==1?"li:has(.i_icon_quote)":"a:has(.i_icon_quote)").after($('<li style="display:inline-block;list-style:none;"><a href="#quick_reply"><img src="'+quote_image+'" class="quickquote" alt="Quick quote" title="Quick quote" /></a></li>')) }
      if (new_button == false) { q = "a:has(.i_icon_quote)"; $("a:has(.i_icon_quote)").attr("href", "#quick_reply"); $(".i_icon_quote").attr("title", "Reply with quote") }
      
      $(document).on('mouseup',n[0],function(e){
        qtext = $(this).parents(".post");
        if (window.getSelection) theSelection = window.getSelection().toString();
        else if (document.getSelection) theSelection = document.getSelection();
        else if (document.selection) theSelection = document.selection.createRange().text;
      });  
      
      $(q).click(function () {
        if (typeof qtext == 'undefined') return;
        uname = qtext.find(n[1]).text();
        $("div.sceditor-toolbar + iframe").contents().find("body").append('<blockquote><cite>' + uname + '</cite>' + theSelection + '</blockquote> <br />');
        $('.sceditor-container textarea')[0].value += '
    + uname + wrote:' + theSelection + '
    '
      });
      var n,q;
    });
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    In progress Re: Quick Quote

    Post by Ange Tuteur Tue 1 Sep - 12:01

    Hi @troyeccles,

    The quick quote button works based on text selection. If you want to have both quick quote and normal quote change the following in the script :
    Code:
    new_button = false,

    and set it to "true" :
    Code:
    new_button = true,

    That will create a separate button for the quick quote.