User talk:Lingzhi/reviewsourcecheck

Latest comment: 5 years ago by Lingzhi2 in topic Toggle

Comments edit

I like the idea of this tool, but I probably won't use it in reviewing because of the number of preference issues - we have fairly wide latitude for differences in citation formatting, but a lot of those differences are being thrown up as errors. Specifically:

  • Missing location for books is not an issue per se - locations can be omitted if this is done in all cases.
  • OCLC number is nice to have but not required; actually, technically ISBN is not required either, although perhaps de facto it is where it exists (and it doesn't always)
  • Retrieval date isn't required where there is a known publication date (and the source isn't wiki-like)

Also, there seems to be an error with the hyphen error - it's throwing errors in a lot of cases where a dash is correctly used. There's also something odd happening with the name error - take a look at Thorium for some examples. Nikkimaria (talk) 03:22, 30 January 2018 (UTC)Reply

    • @Nikkimaria: Thank you, this is good feedback. First, to my mind at least, OCLC and location errors could just be ignored; however, it would be easily-peasily to create separate have-it-your-way scripts (e.g., create a script called 'User:Lingzhi/reviewsourcecheck-nolocs.js';) that simply remove the logic that checks for oclc and/or location.. Another option would be to check for inconsistent use of location paramter (some have it; some don't). In fact, maybe that should be the default logic... BTW, I know isbns don't always exists, esp. pre-197; the script logic takes year into acct... About the names, I didn't know "displayauthors=3" (what's the template for displaying parameters? i always forget) existed, so I didn't check for it. That could of course be tweaked... As for hyphens, there seem to be two issues: first, there simply are some valid uses for hyphens (I remember one ref in Bengal famine '43 had an odd pagination format that included hyphens). In that case, the error can only be ignored. There's no way to tweak for special cases... Second, it may occasionally be sending error messages to another cite by the same author, when that author has a different cite with an actual error elsewhere (?)... or grabbing too much text and picking up an isbn (?)... I'm not sure; I will check Lingzhi ♦ (talk) 05:52, 30 January 2018 (UTC)Reply

Missing identifier (ISSN, JSTOR, etc.); edit

While the dsecriptive table says that this error should only occur for journals (or perhaps it means it should only be regarded for journals, in which case you can ignore this, although you may want to clarify your table), it also occurs for {{Cite news}}. E to the Pi times i (talk | contribs) 14:40, 11 March 2018 (UTC)Reply

  • @E to the Pi times i: Yes, thanks. I think it would've been better to say "periodicals", so I'll change it... One of these days, which probably means never, I really should research all the various ins and outs of all the identifiers and how they are used for different media. Forex, I think I saw someone say once that arXiv was only for pre-prints (?). It might be useful to write all that down somewhere. But that will likely never happen, at least not with me doing it, because I'm pretty busy... Thanks! Lingzhi ♦ (talk) 23:55, 11 March 2018 (UTC)Reply
Yeah, I'm still wrapping my head around all the formats myself too. What might be nice is if the script could be circumvented, for example |isbn=<!--Not applicable-->. I may fork my own version which does that. E to the Pi times i (talk | contribs) 00:04, 12 March 2018 (UTC)Reply
Circumvented in what way, and for what reason? I'm curious. Lingzhi ♦ (talk) 00:17, 12 March 2018 (UTC)Reply
For example, when I'm citing the Donkey Kong Country's instruction manual to describe the gameplay (link), it gives me the error "Missing ISBN", even though this source doesn't and will never have an ISBN. If putting something like |isbn=<!--Not applicable--> would make the script ignore the error, then one could see the actual errors, and have the errors caused by source-specific parameter irrelevance disappear. But in that example, I think the error is cause by some kind of {{sfn}} interaction, since the error didn't happen when I copied {{Cite book}} directly here. E to the Pi times i (talk | contribs) 00:42, 12 March 2018 (UTC)Reply
My point is that some sources don't fit neatly into the citation tempates for some parameters, and having the script check for a certain comment after the parameter would help minimize visual clutter from situationally irrelevant parameters. Of course, the other solution would be to make an entire booklet template which does not support ISBN, but that makes little sense to me. E to the Pi times i (talk | contribs) 01:04, 12 March 2018 (UTC)Reply
  • It would be trivially easy to skip any {{cite book}} that includes the text string (Booklet), but I am not sure that booklets never have isbn or oclc. In fact, I bet many do. Lingzhi ♦ (talk) 01:09, 12 March 2018 (UTC)Reply
Which is why I suggested it be activated via a discretionary user comment, because broad rules always have exceptions and consequences, and "Not applicable" is a succinct way of expressing that the specific source doesn't have that parameter, and will probably never have that parameter. E to the Pi times i (talk | contribs) 01:14, 12 March 2018 (UTC)Reply
I'm pretty sure that's a "no can do". I put a comment in the isbn field in a book in my sandbox, and the page source showed absolutely no sign of it:
<dd><cite id="CITEREFBianchi2004" class="citation book">Bianchi, Robert Steven (2004). <i>Daily life of the Nubians</i>. Greenwood Press "Daily life through history" series. Westport, Conn.: Greenwood Press.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Daily+life+of+the+Nubians&rft.place=Westport%2C+Conn.&rft.series=Greenwood+Press+%22Daily+life+through+history%22+series&rft.pub=Greenwood+Press&rft.date=2004&rft.aulast=Bianchi&rft.aufirst=Robert+Steven&rfr_id=info%3Asid%2Fen.wikipedia.org%3AUser%3ALingzhi%2Fsandbox" class="Z3988"><span style="display:none;"> </span></span></dd> Lingzhi ♦ (talk) 01:28, 12 March 2018 (UTC)Reply
Ah, because of course the script uses page level retrieval, not wikisource retrieval, because grabbing the wikisource would be a needless inefficiency (not to mention the code which matches the wikisource to the HTML). That's probably not the way to implement it, then. I will have to ponder that further. Anyway, I do like your extension, it just sometimes overwhelms me with a lot of (sometimes needless) red. E to the Pi times i (talk | contribs) 01:36, 12 March 2018 (UTC)Reply
    • The hard truth is this: cases where identifiers are truly unavailable are relatively rare, but cases where no one ever got around to adding them are ubiquitous. Lingzhi ♦ (talk) 01:41, 12 March 2018 (UTC)Reply
You're probably right in most cases. I just happen to be editing VG articles (or a VG article) which has a lot of those errors which are not actually relevant. But I could of course add in a personal exception for the missing identifier error, which would get rid of most of errors (since I don't think most VG news sites get their publications registered with ISSN, etc., especially the back catalog from 1994 and early 2000's) E to the Pi times i (talk | contribs) 01:56, 12 March 2018 (UTC)Reply
  • I sorta think there's no reason to create a special exception for Nintendo games. Readers don't see those error messages. Only experienced editors who are specifically trying to see them, and so have added this script to their common.js, see them. And if you made such a narrowly-scoped fork, it would be useful only to you. But hey, if you wanna do it only for yourself, then have at it... Lingzhi ♦ (talk) 02:03, 12 March 2018 (UTC)Reply
Yeah, obviously I would only do it for myself. Although I'm starting to think I'm close-minded and ignorant of how extensive these classifications are: the OCLC for Donkey Kong Country 3 GBA. OCLC seems a bit iffy sometimes, though, and additionally I doubt that it has the SNES version. But it's really cool that it classifies video games. E to the Pi times i (talk | contribs) 02:12, 12 March 2018 (UTC)Reply

Toggle edit

Love this tool. Thanks for your work on it! A feature request: It would be nice to have some sort of on/off toggle (perhaps in the tools sidebar) since when browsing outside of reviews, lots of articles become a sea of red warnings and it'd be nice to not have to toggle it manually in common.js. czar 17:21, 20 December 2018 (UTC)Reply

  • @Czar: Sorry so long to reply. I have scrambled the Lingzhi password and deleted the relevant email acct, so I an completely unable to edit this script again, ever. In fact I believe no one can, ever. the only way would be to copy/fork. I'm really really busy grading final exams now and will be on winter vacation immediately afer that. I dunno.... maybe... maybe a couple weeks from now I could try something... maybe.Lingzhi2 (talk) 02:42, 10 January 2019 (UTC)Reply
    @Lingzhi2, no pressure, but would be wonderful if you had a moment. Unless... @Evad37, would this happen to be an easy fix? czar 02:52, 10 January 2019 (UTC)Reply
    I believe even if Evad did it, it would need to be a copy/paste fork; see above. Thanks for your interest! It is encouraging. Lingzhi ♦ (talk) 02:54, 10 January 2019 (UTC)Reply
    WP:Interface administrators can edit other people's js/css pages, and so can make the old page into a javascript "redirect" – like how User:Mr.Z-man/closeAFD.js "redirects" to XFDcloser. It should also be relatively easy to do the toggle. - Evad37 [talk] 03:23, 10 January 2019 (UTC)Reply
  • Evad, are you an interface admin? If so, would you please make that a redirect into my (Lingzhi2) userspace? As for the toggle, there is seriously no way I can look into it for at the very least 2 or 3 weeks. @Czar:, if you think it's an emergency and you wanna beg Evad to make the change after he makes a redirect, then that's between you and him. I certainly would not mind. But you'd have to ask him. Lingzhi ♦ (talk) 04:53, 10 January 2019 (UTC)Reply
    • I'm not actually an interface admin, but I've left a note at their noticeboard - Evad37 [talk] 11:00, 10 January 2019 (UTC)Reply
      Hi. What do you want exactly? We can move the script it to someone else's userspace, putting the "redirect" in place. If so, whose userspace? — Martin (MSGJ · talk) 11:42, 10 January 2019 (UTC)Reply
      I see Lingzhi requested his new userspace, so I have moved to User:Lingzhi2/reviewsourcecheck.js. Hope this is okay — Martin (MSGJ · talk) 11:47, 10 January 2019 (UTC)Reply
  • Nice! If possible, my recommendation would be to have the toggle default to "off", since I'd only activate the script when I'm reviewing a specific article. Otherwise, I might as well toggle it in common.js each time so as not to add to my pageload (or clutter my viewer). Also might be less conspicuous if added in the "tools" menu of the left sidebar (as you originally tested), rather than alongside the Twinkle tabs atop the page, which gets crowded. czar 05:09, 3 February 2019 (UTC)Reply
    • @Czar: I made it, and it works. The slightly altered script is named User:Lingzhi2/reviewsourcecheck-sb.js (just add "-sb" before the ".js"). There's an unexpected hassle tho with making "don't display errors/warnings" the default behavior: any time you reload the page, they go away again. It's a new start. So let's say you do want to see the errors. Click "Show ref check." Ahah you see dozens of errors. You edit one or two but not all and save the page. But when you press save, that reloads the page and all the warnings errors disappear. So you have to click "Show ref check" again. And so on until infinity. same thing happens if you just press reload on your browser. ♦ Lingzhi2 (talk) 17:17, 3 February 2019 (UTC)Reply
      • Nice, thanks!
      @Evad37, would you know how to make the toggle remember its last state between pageloads? Similar to the show/hide closed discussions toggle in XFDcloser? czar 22:38, 3 February 2019 (UTC)Reply
You can use localStorage to store the state every time the toggle is activated. And when the script loads, it can check the value in localStorage to see if things should be hidden or shown. So the last part of the code would become
        $.when(mw.loader.using('mediawiki.util'), $.ready).then(function() {
            // Default state
            var isHidden = false;        
            // Determine previous state from localStorage, if available
            try {
                if ( localStorage.getItem('reviewsourcecheck-state') === 'hidden' ) {
                    isHidden = true;
                }
            } catch(e) {}
            // General usage:
            mw.util.addPortletLink('p-cactions', '#', 'Hide ref check', 'ca-hideCk', "Hide ref check");
            mw.util.addPortletLink('p-cactions', '#', 'Show ref check', 'ca-showCk', "Show ref check");
            $('#ca-showCk').toggle(isHidden);
            $('#ca-hideCk').toggle(!isHidden);

            $('#ca-hideCk').on('click', function() {
                $(".refckErr").hide();
                $(".refckWarn").hide();
                $('#ca-showCk').show();
                $('#ca-hideCk').hide();
                try {
                    localStorage.setItem('reviewsourcecheck-state', 'hidden');
                }  catch(e) {}
                return false;
            });

            $('#ca-showCk').on('click', function() {
                $(".refckErr").show();
                $(".refckWarn").hide();
                $('#ca-showCk').hide();
                $('#ca-hideCk').show();
                try {
                    localStorage.setItem('reviewsourcecheck-state', 'shown');
                }  catch(e) {}
                return false;
            });
        });
The try ... catch blocks are important, because localStorage might not be available (if the user has an old browser, or has disabled localStorage, or the storage space is full) - Evad37 [talk] 08:31, 4 February 2019 (UTC)Reply

@Evad37: Oh – you mentioned localStorage three weeks ago, but my very-near-zero level of experience with Internet/web browser work left me drawing a blank, unable to make the connection to the real-world application. Thanks! I appreciate that. ♦ Lingzhi2 (talk) 20:52, 4 February 2019 (UTC)Reply