zotero / styles-repo

Zotero styles page
http://www.zotero.org/styles
14 stars 12 forks source link

Add filtering to only show a single specific style #11

Closed rmzelle closed 8 years ago

rmzelle commented 9 years ago

We all seem to like the ability to point users to certain styles in the repo: https://forums.zotero.org/search/?PostBackAction=Search&Keywords=styles%3Fq&Type=Comments&btnSubmit=Search .

My issue is that it's sometimes impossible to highlight a certain style, e.g. https://zotero.org/styles?q=vancouver lists 17 styles, while I might only want to select "Vancouver". I could direct users directly to "https://zotero.org/styles/vancouver" or "https://zotero.org/styles/vancouver?source=1", but that doesn't provide as much context. Would it make sense to support the standard regex "^" and "$" characters, so we can search for "^Vancouver$" and only get one hit?

Alternatively we could use a flag for "exact match".

cc @aurimasv, @adam3smith

dstillman commented 9 years ago

We could go with "https://zotero.org/styles?q=vancouver&exact=1" or something like "https://zotero.org/styles?q=name:vancouver".

zuphilip commented 9 years ago

For me this looks like match=any vs. match=exact, but most of the times an "exact match" is only fixing the ordering and not forbidding any other words. However, I am not sure if we have to stick to that. I could also imagine something like match=phrase for a (hypothetical) third option.

rmzelle commented 9 years ago

Google's ad system uses "&matchtype=e" for an exact match (https://support.google.com/adwords/answer/2375447?hl=en), so I guess "&match=exact" or "&exact=1" would work. Aurimas and Sebastian spend more time staring at URLs, though, so I'm curious if they think this proposal will be useful, and what they think the implementation should be.

Alternatively, we could just move up any exact matches in the DOM (there can be more than one, since we're matching both against the file name and title), and not bother with URL parameters, e.g.:

https://zotero.org/styles?q=plos

8 styles found:

Exact Match:

Additional Matches:

adam3smith commented 9 years ago

Yes, I think this would be very useful, thanks Rintze for bringing it up. I don't have a strong preference for the URL format, but to me, &match=exact is most intuitive and easiest to remember. Personally, I fine the exact match/additional matches results too confusing.

On Mon, Dec 15, 2014 at 8:40 AM, Rintze M. Zelle notifications@github.com wrote:

Google's ad system uses "&matchtype=e" for an exact match ( https://support.google.com/adwords/answer/2375447?hl=en), so I guess "&match=exact" or "&exact=1" would work. Aurimas and Sebastian spend more time staring at URLs, though, so I'm curious if they think this proposal will be useful, and what they think the implementation should be.

Alternatively, we could just move up any exact matches in the DOM (there can be more than one, since we're matching both against the file name and title), and not bother with URL parameters, e.g.:

https://zotero.org/styles?q=plos

8 styles found:

Exact Match:

  • Public Library of Science (2013-08-29 03:14:21)

Additional Matches:

  • PLOS Biology (2014-06-05 22:31:00)
  • PLOS Computational Biology (2014-06-05 22:31:00)
  • PLOS Genetics (2014-06-05 22:31:00)
  • PLOS Medicine (2014-06-05 22:31:00)
  • PLOS Neglected Tropical Diseases (2014-06-05 22:31:00)
  • PLOS ONE (2014-06-05 22:31:00)
  • PLOS Pathogens (2014-06-05 22:31:00)

— Reply to this email directly or view it on GitHub https://github.com/zotero/styles-repo/issues/11#issuecomment-67002835.

Sebastian Karcher, PhD Department of Political Science Northwestern University

rmzelle commented 9 years ago

@dstillman, would you consider adding a checkbox to the webpage, or would you prefer to keep that clean?

rmzelle commented 8 years ago

Coming back to this, @dstillman, how would you feel about https://www.zotero.org/styles?id=apa as a way to target a single style? (id=apa would match apa.csl)

That certainly seems like the most concise option. I was also thinking that, when the page is loaded with the "id" URL parameter, it might make sense to fill the search field with something like "id=apa" or "apa[id]" (this latter option is similar to PubMed searches: http://www.ncbi.nlm.nih.gov/pubmed/?term=Zelle+RM%5BAuthor%5D ). Then, if the user changes the contents of the search field to some other string, the URL "id" parameter would be removed.

dstillman commented 8 years ago

I think a colon makes the most sense in the field: id:apa. (This is similar to various keywords in Google search, like site:.) And we can get that for free with q=id:apa. We can fix the code to not swap in a %3A for the colon.

rmzelle commented 8 years ago

Works for me.

(is there an easy way to hack on this project without installing all the prerequisites like apache listed in https://github.com/zotero/styles-repo/blob/master/README.md (in particular the JavaScript bits)? Maybe save the webpage to disk and edit that?)

rmzelle commented 8 years ago

@tnajdek, is this in the cards for the revamped version? Would be much appreciated.

tnajdek commented 8 years ago

I'd be happy to make this happen, just thought of a bit different approach. My suggestion would be to use fragment identifier to highlight matching style in the results. This means we could do the following:

https://www.zotero.org/styles?q=apa#apa

This would produce the same results as it does currently, however it would highlight second row of results and (optionally) automatically scroll to that result, something similar looking to this:

screen shot 2016-05-02 at 14 37 52

Would that be a good solution?

rmzelle commented 8 years ago

I guess. I still would prefer a solution that would allow us to point to one style, and one style only, though.

Ideally it would also be very easy for us to fashion such a targeted URL (e.g. from the source link, "https://www.zotero.org/styles/3-biotech?source=1"), so the fewer characters we have to type, the better.

adam3smith commented 8 years ago

yes, I agree. Having the ability to completely unambiguously point to a specific style would be the goal here. The highlighting is nice, but in my experience is still going to get missed by a good number of people.

dstillman commented 8 years ago

Yeah, I think we want to change the "View Source" on hover to "Link" and "Source", with the latter former triggering ?q=id:apa.

adam3smith commented 8 years ago

that's the former (i.e. "Link") triggering ?=id:apa, right?

dstillman commented 8 years ago

Yes, sorry, reordered those after typing.

rmzelle commented 8 years ago

Yeah, that would be great. (maybe "Download" instead of "Source" would be clearer?)

dstillman commented 8 years ago

It's not a download, though.

adam3smith commented 8 years ago

yeah, source seems right to me. Download/install is what a regular click does, no?

dstillman commented 8 years ago

That's right.

rmzelle commented 8 years ago

What's the purpose of the source view, otherwise? As I understood it, it was added to add a way to access the style while suppressing the Zotero for Firefox "do you want to install this style" dialog. Wouldn't most people want to download it, in that case?

dstillman commented 8 years ago

The purpose of the source view is to view the source. I've clicked that link many times and never downloaded from it. You can download just by right-clicking on the main link. Doesn't make sense to call the thing a download that's specifically coded to show up in the browser pane.

adam3smith commented 8 years ago

Was going to write exact same thing as Dan. Using source view a lot, too, e.g. for documentation links.

rmzelle commented 8 years ago

Okay, never mind, then. (I use the source view myself sometimes, but I couldn't think of many reasons why the average user would be interested in it)

rmzelle commented 8 years ago

Thanks, Dan.

(others: it will get easier to get a direct link, but for now just fashioning URLs as https://www.zotero.org/styles?q=id:apa already works [super snappy, too!])

dstillman commented 8 years ago

Now on production, filtering can be done from the Link link on each style.

adam3smith commented 8 years ago

works nicely, thanks!