Content deleted Content added
→New fields: reply |
→New fields: comment |
||
Line 44:
::At any rate, if it's possible, I would be glad to help rewrite whatever part of the JS poses issues for passthrough of extra parameters (since this might prove useful for other stuff as well). '''[[User:JPxG|jp]]'''×'''[[User talk:JPxG|g]]''' 03:16, 8 January 2023 (UTC)
:::{{ping|JPxG}} If you just want the page view numbers, you can query the API directly, without going through {{tl|Graph:PageViews}}. Is the page view data intended to just be used by Signpost editors, not by all readers? Because in that case, you can get the desired result by using a user script, without having to duplicate the page view data in the index modules. (And with a default gadget, you could even do the same for all readers if the community agrees.) <p>I will have a look at [[WP:SPT]] to see how difficult it would be to pass through arbitrary Lua data tables. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 12:19, 8 January 2023 (UTC)</p>
::::Hm, it looks like my suggestion for the Lua table structure above wasn't so great, as [[WP:SPT]] uses JSON as a data interchange format between Lua and JavaScript, and JSON can't have numbers as object keys. For example, the Lua function mw.text.jsonEncode() encodes number keys in tables as strings:
<syntaxhighlight lang="lua">
mw.text.jsonEncode({[7] = 642, [30] = 1966, [60] = 2279, [90] = 2419})
-- '{"7":642,"30":1966,"60":2279,"90":2419}'
</syntaxhighlight>
::::Assuming that we don't go down the route of making a JavaScript gadget for this, probably something like the following would be an easier structure for [[WP:SPT]] to cope with:
<syntaxhighlight lang="lua">
views = {d7 = 642, d30 = 1966, d60 = 2279, d90 = 2419},
</syntaxhighlight>
::::— '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 12:39, 8 January 2023 (UTC)
== Fleshing ==
|