• 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

Jeremy

Well-known member
#1
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.
 

Jeremy

Well-known member
#5
Hmm, perhaps I should have been clearer...I meant it was discussed offline.

I believe some are making use of that for a greasemonkey script (http://xenforo.com/community/threads/where-is-1-1.18976/page-17#post-250571), but Kier & Mike are looking at a different approach.
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.
 
R

ragtek

Guest
#6
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.
or output the ignored users in an js array
 

Jeremy

Well-known member
#7
or output the ignored users in an js array
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.
 

Brogan

XenForo moderator
Staff member
#8
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.
 

Jeremy

Well-known member
#9
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.
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........
 

James

Well-known member
#10
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.
 

Jeremy

Well-known member
#11
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.
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.
 
R

ragtek

Guest
#12
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

Well-known member
#13
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...
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.
 

James

Well-known member
#14
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.
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.
 

Jeremy

Well-known member
#15
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.
The suggestion was to apply data-author to quotes. ;)