MediaWiki talk:Wdsearch-autodesc.js: Difference between revisions
Content deleted Content added
m Obsolete HTML tags "tt" swapped out for "code". Project Lint |
|||
(20 intermediate revisions by 9 users not shown) | |||
Line 1:
== Add Greek nationalities ==
{{editprotected|ans=yes}}
Please add to the list of nationalities:
<
language_specific : { el : { 'nationality' : {
'Αυστρία':'Αυστριακός', 'Ηνωμένες Πολιτείες Αμερικής':'Αμερικανός', 'Σουηδία':'Σουηδός', 'Πολωνία':'Πολωνός', 'Ουκρανία':'Ουκρανός', 'Ιρλανδία':'Ιρλανδός', 'Σερβία':'Σέρβος', 'Γιουγκοσλαβία':'Γιουγκοσλάβος'
</syntaxhighlight>
Thanks. -[[User:Geraki|<
:{{done}} I added the appropriate closing brackets. You might want to check the list did not get truncated as the list of language seemed rather small. --[[User:Salix alba|Salix alba]] ([[User talk:Salix alba|talk]]): 17:50, 14 March 2014 (UTC)
@[[User:Salix alba|Salix alba]]. There was some confusion here. There was already a list for ''el''. I just wanted to add to the existing list, five rows higher from what it was added (that's why I had'n added closing brackets - I only mentioned ''where'' it should be added). Please merge the two lists. -[[User:Geraki|<
:{{ping|Geraki L}} Ah yes I see now. Lists merged now. --[[User:Salix alba|Salix alba]] ([[User talk:Salix alba|talk]]): 14:30, 16 March 2014 (UTC)
Line 18:
{{editprotected|answered=yes}}
I've made a Dutch translation, it can be found on [http://pastebin.com/sHmz14ss Pastebin]. I've posted the whole script on Pastebin (because of the complicated translation-system of this script), so it's just copy-and-paste. [[User:Sjoerddebruin|<
:Ping [[User:Writ Keeper|Writ Keeper]]: ^^ the onwiki request as you requested. :) [[User:Trijnstel|<
::Done, thanks. [[User:Writ Keeper|Writ Keeper]] [[User Talk: Writ Keeper|⚇]][[Special:Contributions/Writ_Keeper|♔]] 21:46, 15 July 2014 (UTC)
Line 51:
I've fixed the Dutch translation and trimmed some whitespace, please replace with [https://nl.wikipedia.org/w/index.php?title=Gebruiker:Sjoerddebruin/js&oldid=42954723 this].
<!-- End request -->
[[User:Sjoerddebruin|<
:[[File:Yes check.svg|20px|link=]] '''Done'''<!-- Template:EP --> Thanks for the update! — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 20:33, 8 January 2015 (UTC)
Line 61:
Also in the code
<
if (typeof mw !== 'undefined' && typeof prevent_wd_auto_desc === 'undefined' ) { // On Wikidata
$(document).ready( function() {
if ( mw.config.get('wgSiteName') != 'Wikidata' ) return ;
...
</syntaxhighlight>
The comment <
2. Why is the script hosted on {{SERVERNAME}} when it only works on wikidata.org?
Line 73:
3. It looks like this script started out matching [https://bitbucket.org/magnusmanske/autodesc/src/HEAD/www/js/short_autodesc.js?at=master Magnus Manske's AutoDesc] code, but there's no mention of this in comments except the vague "The code hosted here also runs OUTSIDE of mediawiki scopes". Also the JavaScript on-wiki has drifted from the JS in that project.
4. It's unclear what it does on Wikidata. How do I know it's working? Even if I set <code>wd_auto_desc_wd_always_show = true;</code> in my common.js on Wikidata before this script, I never see its generated wikidata auto-description. I can invoke <code>loadItem()</code> by hand by pasting the following into the browser's developer tools JavaScript console:<
wd_auto_desc.loadItem ( "Q2045965" , { callback: function ( q , html , opt ) {
console.log( "AutoDesc for " + q + " item=" + html );
} } ) ;
</syntaxhighlight>
and then it displays teh AutoDesc awesomeness:
: "AutoDesc for Q2045965 item=Indian author and autobiographer (*1940); Padma Shri and Sahitya Akademi Award; spouse of Surinder Singh ♀"
I'm not sure where this description is supposed to appear on the Wikidata page [[d:Q2045965]].
: I figured 4. out, the AutoDesc short descriptions appear on wikidata's [[d:Special:Search]] results page and in the search suggestions dropdown on www.wikidata.org that appears when you enter "Padma S...". This is obvious from the script name <
Thanks for any elucidation, and maybe someone with rights can add comments to the script clarifying these. -- [[User:SPage (WMF)|SPage (WMF)]] ([[User talk:SPage (WMF)|talk]]) 21:01, 20 August 2015 (UTC)
Line 100:
== Koninkrijk der Nederlanden ==
{{editrequest|answered=
Please add <code>'Koninkrijk der Nederlanden':'Nederlands'</code> to the nl-section, will come with more improvements later. [[User:Sjoerddebruin|<
:{{notdone}} {{u|Sjoerddebruin}} I'm not sure "exactly" what you want done. Can you please provide a current line as-is, and with your change included below? (Then reactivate the edit request). — [[User:Xaosflux|<span style="color:#FF9933; font-weight:bold; font-family:monotype;">xaosflux</span>]] <sup>[[User talk:Xaosflux|<span style="color:#009933;">Talk</span>]]</sup> 22:49, 14 August 2016 (UTC)
::I think [[Special:Diff/734745225|this]] would do, as the former ones are no official nationalities. [[User:Sjoerddebruin|<
:{{u|Sjoerddebruin}} That diff appears to '''remove''' entries, as well as add the new entry - is that what you intend?
Line 112:
</pre>
'''Change to''':{{?}}</br>
::Like I said, I removed those because they are not valid nationalities. [[User:Sjoerddebruin|<span style="color: #325186">'''Sjoerd de Bruin'''</span>]] [[User talk:Sjoerddebruin|<span style="color: #325186"><small>(talk)</small></span>]] 23:05, 19 August 2016 (UTC)
:::Hello?!? [[User:Sjoerddebruin|<span style="color: #325186">'''Sjoerd de Bruin'''</span>]] [[User talk:Sjoerddebruin|<span style="color: #325186"><small>(talk)</small></span>]] 21:02, 28 August 2016 (UTC)
::::Hi! {{done}} :) [[User:Legoktm|Legoktm]] ([[User talk:Legoktm|talk]]) 21:12, 28 August 2016 (UTC)
== Please ignore claims marked with deprecated rank ==
Would you be able to avoid listing claims that are marked with a [https://www.wikidata.org/wiki/Help:Ranking#Deprecated_rank deprecated rank]? Example: P31 for {{Q|1596}}.
Thanks, --[[User:Aeroid|Aeroid]] ([[User talk:Aeroid|talk]]) 06:49, 26 October 2016 (UTC)
If any claim with preferred rank is present, then claims with normal rank should be hidden as well. <span style="font-family:Segoe Script">[[User:Petr Matas|Petr Matas]]</span> 23:06, 27 December 2016 (UTC)
{{editprotected|answered=yes}}
: [[Special:Diff/756970705|Diff/756970705]] should do the trick. Can anyone apply it and test it, please? <span style="font-family:Segoe Script">[[User:Petr Matas|Petr Matas]]</span> 00:16, 28 December 2016 (UTC)
:: {{ping|Petr Matas}} I spotted two things which I think are bugs in the filterClaims function. The first is the $.each syntax - the first parameter to the callback function is the array index, not the value. The second is the use of $.grep in a loop. According to the [http://api.jquery.com/jquery.grep/ docs], this function alters the existing array. It would work fine on the first iteration if there are any preferred statements, but as the original values array is altered, on the second iteration $.grep would be working with an empty array (it has no preferred statements, and any normal or deprecated statements were removed in the first iteration). I've fixed both of these bugs in [[Special:Diff/756970705/757143441|this diff]], but I haven't tested the code yet. Could you look over my changes and see if they look ok? Best — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 01:23, 29 December 2016 (UTC)
::: {{ping|Mr. Stradivarius}} Thank you for your review. Your fix of the $.each syntax seems correct. Concerning $.grep, its docs say that ''"The original array is not affected."'' Therefore I believe that the two versions are equivalent, except that Array.prototype.filter is only supported since IE 9. <span style="font-family:Segoe Script">[[User:Petr Matas|Petr Matas]]</span> 05:22, 29 December 2016 (UTC)
:::: {{ping|Petr Matas}} Ah yes, you're quite right. Sorry about that. We should probably go with the version that is better supported, in that case. I've restored $.grep in your version - does the [https://en.wikipedia.org/wiki/Special:ComparePages?page1=&rev1=757138647&page2=&rev2=757176210&action=&diffonly=&unhide= diff] look ok to you now? — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 06:29, 29 December 2016 (UTC)
::::: {{ping|Mr. Stradivarius}} Yes, it does. I am keeping my fingers crossed. ;-) <span style="font-family:Segoe Script">[[User:Petr Matas|Petr Matas]]</span> 06:41, 29 December 2016 (UTC)
:::::: {{ping|Petr Matas}} Ok, I have put the change up live. Let me know if you notice any strange behaviour. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 07:45, 29 December 2016 (UTC)
::::::: It seems to work as expected. <span style="font-family:Segoe Script">[[User:Petr Matas|Petr Matas]]</span> 08:10, 29 December 2016 (UTC)
== Language selection bugfix ==
{{edit fully-protected|answered=yes}}
There is a bug in this script. If the label in user's language is not present in the Wikidata item, then the first available language is used and the list of fallback languages (introduced by {{u|Magnus Manske}} in [[Special:Diff/600430404|Diff/600430404]]) is ignored.
[https://en.wikipedia.org/wiki/Special:ComparePages?page1=MediaWiki%3AWdsearch-autodesc.js&rev1=736636595&page2=User%3APetr+Matas%2FWdsearch-autodesc.js&rev2=756952077&action=&diffonly=&unhide= Here is the fix] to be applied. <span style="font-family:Segoe Script">[[User:Petr Matas|Petr Matas]]</span> 21:44, 27 December 2016 (UTC)
:[[File:Yes check.svg|20px|link=|alt=]] '''Done'''<!-- Template:EP --> — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 00:47, 29 December 2016 (UTC)
== Limit to mainspace to reduce query errors ==
If I search the help-namespace (using the inputbox at the main help:contents page), I get query errors for all results. See [https://www.wikidata.org/w/index.php?search=name&title=Special:Search&profile=advanced&fulltext=1&ns12=1 example search] and [http://storage6.static.itmages.com/i/17/1008/h_1507502125_8121460_1d0b947ee6.png screenshot]. I suggest limiting this gadget to mainspace results, if feasible. [[User:Quiddity|Quiddity]] ([[User talk:Quiddity|talk]]) 18:50, 9 October 2017 (UTC)
|