MediaWiki talk:Wdsearch-autodesc.js
Add Greek nationalities
[edit]This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please add to the list of nationalities:
language_specific : { el : { 'nationality' : {
'Αυστρία':'Αυστριακός', 'Ηνωμένες Πολιτείες Αμερικής':'Αμερικανός', 'Σουηδία':'Σουηδός', 'Πολωνία':'Πολωνός', 'Ουκρανία':'Ουκρανός', 'Ιρλανδία':'Ιρλανδός', 'Σερβία':'Σέρβος', 'Γιουγκοσλαβία':'Γιουγκοσλάβος'
Thanks. -geraki TL 17:32, 14 March 2014 (UTC)
- 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. --Salix alba (talk): 17:50, 14 March 2014 (UTC)
@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. -geraki TL 12:58, 16 March 2014 (UTC)
- @Geraki L: Ah yes I see now. Lists merged now. --Salix alba (talk): 14:30, 16 March 2014 (UTC)
Add Dutch translation
[edit]This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
I've made a Dutch translation, it can be found on 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. Sjoerd de Bruin (talk) 21:29, 15 July 2014 (UTC)
- Ping Writ Keeper: ^^ the onwiki request as you requested. :) Trijnsteltalk 21:34, 15 July 2014 (UTC)
- Done, thanks. Writ Keeper ⚇♔ 21:46, 15 July 2014 (UTC)
Protected edit request on 16 August 2014
[edit]This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please add the following lines to provide origin for organizations and groups of people, based on country of origin (P495) and headquarters location (P159):
This change improves descriptions such as this family or this band or this company. Laddo (talk) 15:23, 16 August 2014 (UTC)
- Done--Salix alba (talk): 16:39, 16 August 2014 (UTC)
Add Polish translation (protected edit request)
[edit]This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please add Polish translation, which I already made. It can be found on Pastebin. You should only copy and paste. Aw, this was not an easy translation task, as in inflecting language we have complicated declension. Also adjectives decline in Polish for gender (British actor is described by the adjective brytyjski, but British actress is described by the adjective brytyjska. Thus, I was forced to create unisex forms like: brytyjski/a). Thanks, WTM (talk) 15:24, 17 August 2014 (UTC)
- @WTM: You've changed a lot of the whitespace in the file, which makes it hard to read the diff of your change. Could you post it again, this time preserving the whitespace? Best — Mr. Stradivarius ♪ talk ♪ 20:38, 17 August 2014 (UTC)
- @Mr. Stradivarius:: Yes, I can see it now. Please use this text from my sandbox. --WTM (talk) 23:16, 17 August 2014 (UTC)
- Done Thanks! — Mr. Stradivarius ♪ talk ♪ 23:22, 17 August 2014 (UTC)
- @Mr. Stradivarius:: Yes, I can see it now. Please use this text from my sandbox. --WTM (talk) 23:16, 17 August 2014 (UTC)
Protected edit request on 8 January 2015
[edit]This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
I've fixed the Dutch translation and trimmed some whitespace, please replace with this. Sjoerd de Bruin (talk) 20:18, 8 January 2015 (UTC)
- Done Thanks for the update! — Mr. Stradivarius ♪ talk ♪ 20:33, 8 January 2015 (UTC)
usage is unclear
[edit]I think this is amazing, but it needs better explanation. Is there some page that explains it?
1. It appears to only does something on https://www.wikidata.org, right? So the comment should say "To add this to your common.js page on wikidata.org:"
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 ;
...
The comment // On Wikidata
is on the wrong line, it should be after the test for wgSiteName
.
2. Why is the script hosted on en.wikipedia.org when it only works on wikidata.org?
3. It looks like this script started out matching 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 wd_auto_desc_wd_always_show = true;
in my common.js on Wikidata before this script, I never see its generated wikidata auto-description. I can invoke loadItem()
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 );
} } ) ;
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
MediaWiki:Wdsearch-autodesc.js
:-) , but a comment mentioning this would be nice. The AutoDesc doesn't display on individual QNNNN pages as I expected. -- SPage (WMF) (talk) 21:50, 20 August 2015 (UTC)
Thanks for any elucidation, and maybe someone with rights can add comments to the script clarifying these. -- SPage (WMF) (talk) 21:01, 20 August 2015 (UTC)
Improve comments (protected edit request on 20 August 2015)
[edit]This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
https://www.wikidata.org/w/index.php?title=User:SPage_%28WMF%29/Wdsearch-autodesc.js&oldid=244389496 adds and improves comments that avoid my confusion in #usage is unclear. -- SPage (WMF) (talk) 22:29, 20 August 2015 (UTC) SPage (WMF) (talk) 22:29, 20 August 2015 (UTC)
- Done. Thanks, Nakon 23:35, 20 August 2015 (UTC)
jslint warnings
[edit]If I copy MediaWiki:Wdsearch-autodesc.js and edit it, the jslint in the code editor (extension CodeEditor I think) warns about various coding issues, as does standalone JSHint. Some of them have uncontroversial fixes, I made them in this diff. With these fixes I'm down to no warnings and one error, but the latter is "Too many errors. (34% scanned)." Other warnings involving tests for null and falsy require more consideration.
Koninkrijk der Nederlanden
[edit]This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please add 'Koninkrijk der Nederlanden':'Nederlands'
to the nl-section, will come with more improvements later. Sjoerd de Bruin (talk) 19:16, 13 August 2016 (UTC)
- Not done 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). — xaosflux Talk 22:49, 14 August 2016 (UTC)
- I think this would do, as the former ones are no official nationalities. Sjoerd de Bruin (talk) 12:33, 16 August 2016 (UTC)
- Sjoerddebruin That diff appears to remove entries, as well as add the new entry - is that what you intend?
Current:
{'Ecuador':'Ecuadoraans','Ghana':'Ghanees','Rusland':'Russisch','Argentinië':'Argentijns','Australië':'Australisch','Oostenrijk':'Oostenrijks','België':'Belgisch','Brazilië':'Braziliaans','Canada':'Canadees','Chili':'Chileens','China':'Chinees','Denemarken':'Deens','Finland':'Fins','Faeröer':'Faeröers','Nederland':'Nederlands','Puerto Rico':'Puerto Ricaans','Frankrijk':'Frans','Luxemburg':'Luxemburgs','Duitsland':'Duits','Griekenland':'Grieks','Holland':'Nederlands','Hongarije':'Hongaars','IJsland':'IJslands','India':'Indiaas','Iran':'Iranees','Irak':'Irakees','Ierland':'Iers','Israël':'Israëlisch','Indonesië':'Indonesisch','Italië':'Italiaans','Japan':'Japans','Jamaica':'Jamaicaans','Jordanië':'Jordaans','Mexico':'Mexicaans','Nepal':'Nepalees','Nieuw-Zeeland':'Nieuw-Zeelands','Noorwegen':'Noors','Pakistan':'Pakistaans','Paraguay':'Paraguayaans','Peru':'Peruaans','Polen':'Pools','Roemenië':'Roemeens','Schotland':'Schots','Zuid-Afrika':'Zuid-Afrikaans','Spanje':'Spaans','Zwitserland':'Zwitsers','Syrië':'Syrisch','Thailand':'Thais','Turkije':'Turks','VS':'Amerikaans','Uruguay':'Uruguayaans','Venezuela':'Venezolaans','Wales':'Welsh','Verenigd Koninkrijk':'Brits','Verenigde Staten van Amerika':'Amerikaans','Zweden':'Zweeds'} } ,
Change to:?
- Like I said, I removed those because they are not valid nationalities. Sjoerd de Bruin (talk) 23:05, 19 August 2016 (UTC)
- Hello?!? Sjoerd de Bruin (talk) 21:02, 28 August 2016 (UTC)
- Hi! Done :) Legoktm (talk) 21:12, 28 August 2016 (UTC)
- Hello?!? Sjoerd de Bruin (talk) 21:02, 28 August 2016 (UTC)
- Like I said, I removed those because they are not valid nationalities. Sjoerd de Bruin (talk) 23:05, 19 August 2016 (UTC)
Please ignore claims marked with deprecated rank
[edit]Would you be able to avoid listing claims that are marked with a deprecated rank? Example: P31 for Rissen (Q1596). Thanks, --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. Petr Matas 23:06, 27 December 2016 (UTC)
This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
- Diff/756970705 should do the trick. Can anyone apply it and test it, please? Petr Matas 00:16, 28 December 2016 (UTC)
- @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 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 this diff, but I haven't tested the code yet. Could you look over my changes and see if they look ok? Best — Mr. Stradivarius ♪ talk ♪ 01:23, 29 December 2016 (UTC)
- @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. Petr Matas 05:22, 29 December 2016 (UTC)
- @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 diff look ok to you now? — Mr. Stradivarius ♪ talk ♪ 06:29, 29 December 2016 (UTC)
- @Mr. Stradivarius: Yes, it does. I am keeping my fingers crossed. ;-) Petr Matas 06:41, 29 December 2016 (UTC)
- @Petr Matas: Ok, I have put the change up live. Let me know if you notice any strange behaviour. — Mr. Stradivarius ♪ talk ♪ 07:45, 29 December 2016 (UTC)
- It seems to work as expected. Petr Matas 08:10, 29 December 2016 (UTC)
- @Petr Matas: Ok, I have put the change up live. Let me know if you notice any strange behaviour. — Mr. Stradivarius ♪ talk ♪ 07:45, 29 December 2016 (UTC)
- @Mr. Stradivarius: Yes, it does. I am keeping my fingers crossed. ;-) Petr Matas 06:41, 29 December 2016 (UTC)
- @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 diff look ok to you now? — Mr. Stradivarius ♪ talk ♪ 06:29, 29 December 2016 (UTC)
- @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. Petr Matas 05:22, 29 December 2016 (UTC)
- @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 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 this diff, but I haven't tested the code yet. Could you look over my changes and see if they look ok? Best — Mr. Stradivarius ♪ talk ♪ 01:23, 29 December 2016 (UTC)
Language selection bugfix
[edit]This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
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 Magnus Manske in Diff/600430404) is ignored.
Here is the fix to be applied. Petr Matas 21:44, 27 December 2016 (UTC)
Limit to mainspace to reduce query errors
[edit]If I search the help-namespace (using the inputbox at the main help:contents page), I get query errors for all results. See example search and screenshot. I suggest limiting this gadget to mainspace results, if feasible. Quiddity (talk) 18:50, 9 October 2017 (UTC)