HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

WordCount Addon beautifully Works with Button Bar and Vanilla 2.0.18.4

This discussion is related to the Word Count addon.
aeryaery Gtricks Forum in 2.2 :) ✭✭✭
edited February 2013 in Feedback

Comments

  • KasperKasper Scholar of the Bits Copenhagen Vanilla Staff

    Sweet, thanks for the verification @aery! Glad you could use the plugin!

    Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub

    aerykirkpa31
  • I'm using ButtonBar and Vanilla 2.0.18.4 and WordCount works perfectly when adding a comment to a posted question (I'm also using the Q&A plugin)

    But when composing a new question it does not appear. I've included two screenshots that display what I am talking about:

    imageimage

  • I've been playing with this bit of code within the default.php of this plugin:

    public function PostController_Render_Before($Sender) { $this->_WordCounter($Sender); } public function DiscussionController_Render_Before($Sender) { $this->_WordCounter($Sender); }

    It looks correct, but doesn't display the Word Count on the new discussion form. I have absolutely no clue why.

  • var forms = $(".DiscussionForm, .CommentForm, .EditCommentForm");

    whats the name of the form in qna?

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • kirkpa31kirkpa31 ✭✭
    edited March 2013

    <form id="Form_Discussion" method="post" action="/post/discussion">

    I've been looking at that piece of code and not understanding why it doesn't work as the form name, even for q&a, is still "discussion".

    I've even tried disabling Q&A just to see if it works without, uninstalling/reinstalling ButtonBar and Count Words, switching to default theme, but no luck.

  • peregrineperegrine MVP
    edited March 2013

    And what do you see in jquery.wordcount.js

    var forms = $(".DiscussionForm, .CommentForm, .EditCommentForm");
    
    it is looking for** class**  not id
    
    so try changing it to this add the id
    var forms = $(".DiscussionForm, .CommentForm, .EditCommentForm, #DiscussionForm");
    
    
    report back.
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    kirkpa31422
  • kirkpa31kirkpa31 ✭✭
    edited March 2013

    Just deleted code I pasted here

    b/c your fix on line 6 above worked perfectly. Just needed to add #DiscussionForm

    Thank you @peregrine!!!!!

    peregrine
Sign In or Register to comment.