1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Implemented HTML5 "data-author" for quotes

Discussion in 'Closed Suggestions' started by Jeremy, Sep 14, 2011.

  1. Jeremy

    Jeremy XenForo Moderator Staff Member

    I was reading something about the ignore functionality, and how some people want quotes to disappear as well. I was than thinking of how it was accomplished pre-1.1 and thought... could you not add the data-author attribution to quote boxes so the following could be attached to CSS before it is sent to the browser (I know it's not correct, but the idea is there):
    Code:
    *[data-author="Ignored"] {
        display: none;
    }
    Then extend the "show ignored content" to include a JS call to modify the CSS and display quotes.
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    This has already been discussed a few days ago :)
     
  3. Jeremy

    Jeremy XenForo Moderator Staff Member

    Guess this is what happens when I don't spend a lot of time reading this... *whistles* Mind pointing me in the right direction and/or merging?
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Jeremy likes this.
  5. Jeremy

    Jeremy XenForo Moderator Staff Member

    I remember seeing those, and know a few people are using it. I'm personally a little too lazy to add all my ignored users to a list, hence this suggestion. if it can be sent on the fly (maybe a cached CSS file per user?) automatically by the software would be wonderful. I may make that as an add-on later if it doesn't get implemented.

    Although, I did find mention of this in "ignore system, bad for xenforo" thread.
     
  6. ragtek

    ragtek Guest

    or output the ignored users in an js array
     
  7. Jeremy

    Jeremy XenForo Moderator Staff Member

    Really, what's the difference? XenForo then has to code and maintain a JS script to run it. The CSS will be auto-completed by the browser. I think that fact would be most beneficial for the XenForo team.
     
  8. Brogan

    Brogan XenForo Moderator Staff Member

    The only issue with quotes is the plain user name is used in the attribution block, whereas ignoring is done on user id.
    So you would need to match the user id first.
     
  9. Jeremy

    Jeremy XenForo Moderator Staff Member

    True, very true. However, a pre-cached file or user-data within XenForo_Visitor should be able to work around this. So on an update to the user-ignore system, it will do something like...
    PHP:
    XenForo_Model_Ignore::updateCSSCache($userId);
    And of course, this'll have to happen on username changes... Hm, that's a lot more challenging........
     
  10. James

    James Well-Known Member

    You could grab the username of the quote directly using JS:
    $('.bbCodeQuote div:contains('Ignored Username')').parent('.bbCodeQuote').css('display', 'none');

    That could be wrong, or excessive use of :contains and .parent... but the concept is there.
     
  11. Jeremy

    Jeremy XenForo Moderator Staff Member

    Seems a bit excessive... Isn't there a jQuery selector for data-author? So it could be something like:
    $('*[data-author="Ignored Username"]').css('display', 'none');

    That would eliminate all those parent and contains: calls.
     
  12. ragtek

    ragtek Guest

    That's why i wrote "or output the ignored users in an js array"
    So you would have an array with all ignored users, and you would "only" need to scan the page for them...
     
    Jeremy likes this.
  13. Jeremy

    Jeremy XenForo Moderator Staff Member

    I'm still not the best with JavaScript, and my skills in jQuery are rudimentary at best. Until James mentioned it, that solution didn't come to mind at all.
     
  14. James

    James Well-Known Member

    If data-author was applied to quotes, of course you could. The code I posted above (should) scan the quote author from the quotes as they are now (using the Username said) and apply the CSS. It's not perfect though.
     
  15. Jeremy

    Jeremy XenForo Moderator Staff Member

    The suggestion was to apply data-author to quotes. ;)
     
  16. Cezz

    Cezz Well-Known Member

    True, think he was just offering an alternative!
     
  17. Jeremy

    Jeremy XenForo Moderator Staff Member

    I see this is in 1.1. :) Suggest this as implemented in to that forum ?
     

Share This Page