User talk:Writ Keeper/Scripts/inlineDiffDocs
Changing the link style and content
editI'm enjoying testing this script out (via importScript('User:Writ Keeper/Scripts/commonHistory.js');
) but I'd like to change the wording that is displayed, to make it less eye-catching and also shorter. How would I go about changing the
- [inspect diff]
to instead display as
- [+]
? Thanks. –Quiddity (talk) 18:05, 28 November 2013 (UTC)
- @Quiddity: Hey, sorry for the delay; I've made it so that the text is configurable now. To change it, you can insert variables into your common.js page (or wherever else you installed the script), right above the line where this script is installed: change the value of
inspectText
to change the thing that's currently "inspect diff", change the value ofhideText
to change the thing that's currently "hide diff", and change the value ofshowText
to change the thing that's currently "show diff". This diff should illustrate what I mean; if you copy it exactly, it should give you the +/- you're looking for. Let me know if you have any other issues. Writ Keeper ⚇♔ 22:47, 2 December 2013 (UTC)- Oh, do note though: I only implemented this on the commonHistory.js one; let me know if you need me to extend it to the more specific versions. Writ Keeper ⚇♔ 22:50, 2 December 2013 (UTC)
- Fabulous and perfect! I'm currently using commonHistory, but will ping here if more tweaks are desired. Thanks again. –Quiddity (talk) 22:52, 2 December 2013 (UTC)
- Oh, do note though: I only implemented this on the commonHistory.js one; let me know if you need me to extend it to the more specific versions. Writ Keeper ⚇♔ 22:50, 2 December 2013 (UTC)
Suggest putting this forward as a Gadget
editI just found out about this script, and also found bugzilla:51958 ("Watchlist and recent changes should be able to show diffs inline") where I pointed them towards here. I think it might be a good candidate for a WP:Gadget. Thanks. –Quiddity (talk) 18:39, 28 November 2013 (UTC)
- I think ragesoss and Yunshui suggested making it a gadget when I wrote it for them; others have said that it's too similar to popups (although I personally really hate popups and very much prefer this). I'd be willing to maintain it were it to become a gadget, but it hasn't undergone the kind of thorough testing a gadget requires yet. Writ Keeper ⚇♔ 22:58, 2 December 2013 (UTC)
@Writ Keeper:, Is it doable without an intervention in the code? If no, then making it general would be perfect. The easiest solution I come up with is a single line somewhere in the end:
$(".writsCommonHistory").each(function(){$(this)
.replaceWith($('<a href="#" id="' + $(this).attr("id") + '">' + this.innerHTML + '</a>'));
});
Then from templates one can produce this:
<span class="writsCommonHistory" id="32825887">
<b><span style="color:black;">[</span>
<span style="color:#339900;">+</span>
<span style="color:black;">]
</span></b>
</span>
It has stopped working
editon watchlist. The console is silent. @Writ Keeper--Giorgi Eufshi (talk) 09:07, 24 August 2016 (UTC)
Hmm, still works for me. Perhaps a script conflict, Giorgi Eufshi? Which skin do you use?Actually, you just don't have it loaded on that account: neither your common.js nor your vector.js have anything in them, so Wikipedia doesn't even try to load it. I'm guessing you forgot to import your script declarations from your old account. Writ Keeper ⚇♔ 07:44, 26 August 2016 (UTC)- Thanks for the reply. Actually, I was having this issue on Wiktionary and thought it would the same here. The problem turned out to be on Wiktionary side. --Giorgi Eufshi (talk) 07:54, 26 August 2016 (UTC)
hey
edit@Writ Keeper: Are these changes supposed to mark individual watchlist entries as visited? Or does it do something else? - NQ (talk) 19:18, 20 October 2016 (UTC)
- They're supposed to. They don't yet. Still working on it, give me a few minutes. Writ Keeper ⚇♔ 19:19, 20 October 2016 (UTC)
- I was asking because changing it to "revids : button.id" worked for me. - NQ (talk) 19:23, 20 October 2016 (UTC)
- Hmm, so it does. Thanks! Writ Keeper ⚇♔ 19:32, 20 October 2016 (UTC)
- I was asking because changing it to "revids : button.id" worked for me. - NQ (talk) 19:23, 20 October 2016 (UTC)
Could we maybe get a variable we could set to not have it mark the page as visited (defaulted however you like)? The "Navigation popups" diff doesn't mark a page as visited. I'd rather do this directly, like by visiting the page or using a gadget that explicitly marks the page as visited. Thanks for your consideration. Stevie is the man! Talk • Work 20:19, 20 October 2016 (UTC)
- @Stevietheman: done. Writ Keeper ⚇♔ 20:52, 20 October 2016 (UTC)
- Thank you for your quick turnaround on this! Opt-in does indeed make sense for this. Stevie is the man! Talk • Work 21:01, 20 October 2016 (UTC)
Conflict with Markhurd/hidetopcontrib on Contributions pages
editI love your script, so I was a bit upset when I found it kept User:Markhurd/hidetopcontrib from working on Contributions pages. I wrote a workaround in my common.js to not run commonHistory.js if it's on a Contributions page, so I can continue using your script on all pages except Contributions. I'm not sure exactly what the issue is, but to say that I get highly inaccurate results from hidetopcontrib when both are run on Contributions pages. Stevie is the man! Talk • Work 16:50, 21 October 2016 (UTC)
- @Stevietheman: Hi! I wouldn't pretend to know about any of this stuff, but if you were to copy the script to your user subspace and change
b = 2;
in the script tob = 3;
, that should get it working alongside this one, at least I think it does. Just something to try. - NQ (talk) 17:52, 21 October 2016 (UTC)
Incompatibility with a recent filtering beta feature
edit@Writ Keeper:, the buttons show up and are deleted immediately just in case you do not know. --Dixtosa (talk) 16:20, 26 May 2017 (UTC)
- @Dixtosa: Hey, Dixtosa, thanks for the heads up! This should be fixed now. Writ Keeper ⚇♔ 14:44, 30 May 2017 (UTC)
Not working on watchlists anymore
editI have been using User:Writ Keeper/Scripts/commonHistory.js for several months without issues. Some time in the last few days, it stopped working on my Watchlist page, although it still works fine on individual page histories. This is the case even when I commented out all the other scripts in my common.js. I don't see any recent changes to the script, so I'm not sure what happened here. Any ideas? Sondra.kinsey (talk) 17:49, 18 August 2017 (UTC)
- Yep, I'm seeing it too, and it's also been brought to my attention on my talk page. I'd imagine it's a change on Wikipedia's end, but I'm still looking into it. I'll let people know via the thread on my talk page when there's an update. Thanks! Writ Keeper ⚇♔ 17:59, 18 August 2017 (UTC)
Wrapping width bug with new RC
editHallo. Using commonHistory.js and the new RC filters page, I'm seeing this issue (screenshots: one, two) on all RC & Watchlist rows that are not-grouped (but turning off the preference for "group changes" doesn't fix it). If I un-toggle the width:100%
in those screenshots then it displays normally. Let me know if there's anything else I can do to help test/resolve this. Thanks again for the great script(s) :) Quiddity (talk) 20:34, 11 November 2017 (UTC)
Timing
editThe "Inspect edit" text is just the right size and turns up at just the right time to move the "rollback" link in an article history to where the "thank" link was. I've just, for the second time, rollback-ed an edit I was trying to thank the author for because the text jumped just as I clicked it.
I'm not sure I have a great idea on how to fix this, but it is really annoying when it happens! I think I'll change the "Inspect edit" text to something shorter to reduce the likelihood of this happening for me, but I'm sure I can't be the only one. GoldenRing (talk) 14:30, 27 February 2019 (UTC)
Change request: hooks again and section-watchlist
editHi! Got another request for a change to commonHistory, sorry about that. My version's at Special:Permalink/979692809, and the diff is here. I added support for User:Enterprisey/section-watchlist, and renamed the hook to the "official" mw.hook name (turns out they already had a standard event for diffs!). Or let me know and I can make the change myself, I guess. Thank you! Enterprisey (talk!) 07:02, 22 September 2020 (UTC)
- Whoops, forgot the ping: Writ Keeper Enterprisey (talk!) 07:02, 22 September 2020 (UTC)
- Done Looks good, thanks! Writ Keeper ⚇♔ 12:28, 22 September 2020 (UTC)
- Hey, Enterprisey, just a heads up: I reverted the part of the change that renamed the hook to "wikipage.diff". There are other actions already registered to that hook, including one related to the core "thanks" extension (specifically "ext.thanks.corethank@cy9fg") that get triggered when I fire that hook, and the thanks event break the script by erroring out and preventing the page from finishing the processing for displaying the diff. Changing the hook name back to the unique one prevents that thanks event from happening and corrects the bug. Thanks, Writ Keeper ⚇♔ 15:59, 23 September 2020 (UTC)
- Ah, bit of a shame. Sounds good, and thanks for letting me know. Maybe I'll open a Phab ticket or something. Enterprisey (talk!) 08:01, 24 September 2020 (UTC)
- @Writ Keeper and Enterprisey: I think this is simply because it's returning the DOM element as opposed to a jQuery object. Tried
mw.hook('wikipage.diff').fire($(newTable))
and it worked fine for me. Nardog (talk) 16:38, 26 January 2021 (UTC)
Dark mode tweak
edit@Writ Keeper thank you for this script, it's one of my most needed. It would be best to adjust the styling such that the black braces on the link are allowed to display as needed in dark mode. Remsense ‥ 论 22:11, 22 October 2024 (UTC)
- Hey, Remsense, glad to hear you've been enjoying it! I'm not sure what you mean, though; the brackets should respond normally (i.e. be inverted into white) in dark mode. I've been using dark mode for a dog's age and haven't noticed any issues; the brackets show up as white in dark mode on my screen. What skin are you using? Writ Keeper ⚇♔ 03:07, 23 October 2024 (UTC)
- Here is the full HTML emitted by watchlistDiffs.js:
<a href="#" id="1252826247" class="inspectDiffButton mw-enhanced-rc-diff"><b><span style="color:black;"> [</span><span style="color:#008A00;">inspect diff</span><span style="color:black;">] </span></b></a>
- To me, this would indicate that it's a script problem somewhere, but I actually don't know where if not here. Remsense ‥ 论 03:15, 23 October 2024 (UTC)
- Oh, I think I know one aspect of what's going on here. There's a new hotness—a proper CSS dark design that's being deployed as another option, rather than the inverting gadget—see mw:Reading/Web/Accessibility for reading#Updates. One issue is there's so much hard-coded color and background color over the years, so I've been stuffing a CSS file with one-off bodges. Remsense ‥ 论 03:22, 23 October 2024 (UTC)
- I don't see what the problem with this HTML snippet is, though. The filter:invert(1) from dark mode should automatically invert the black CSS style to display as white, as it does on my screen. Writ Keeper ⚇♔ 04:08, 23 October 2024 (UTC)
- Please see my comment above. Remsense ‥ 论 05:55, 23 October 2024 (UTC)
- Yes, I already saw it, but the only dark mode I immediately had access to was the gadget, which still uses invert(1), which was why I asked you what skin you were using. Digging deeper, I see that this feature is exclusive to Vector 2022, which I don't use, so that would've been helpful information. Anyway, I added classes to both the brackets and the interior text itself, so you should be able to style it as you see fit now. Writ Keeper ⚇♔ 12:40, 23 October 2024 (UTC)
- My apologies: I was trying to make the explanation as brief as possible in order to make your life easier, but I see how I should've been more direct upfront. Thank you very much! Remsense ‥ 论 17:11, 23 October 2024 (UTC)
- Would you consider changing the hardcoded from
black
tovar(--color-base--subtle)
? In general, it's bad to hardcode specific colors, and colors that adapt to the skin are available for these purposes.. Remsense ‥ 论 22:34, 25 October 2024 (UTC)
- Yes, I already saw it, but the only dark mode I immediately had access to was the gadget, which still uses invert(1), which was why I asked you what skin you were using. Digging deeper, I see that this feature is exclusive to Vector 2022, which I don't use, so that would've been helpful information. Anyway, I added classes to both the brackets and the interior text itself, so you should be able to style it as you see fit now. Writ Keeper ⚇♔ 12:40, 23 October 2024 (UTC)
- Please see my comment above. Remsense ‥ 论 05:55, 23 October 2024 (UTC)