User talk:Magnus Manske/wikidata useful.js

From Wikidata
Jump to navigation Jump to search

Remarks[edit]

  • township: why for Taiwan? Isn't there in other countries (USA)? Why not Q346810?
  • county: the same. Q706447Q28575.

Infovarius (talk) 04:38, 9 April 2013 (UTC)[reply]

I corrected that, because Magnus didn't reacted. Don't know if its good to link a disambiguation page, but its for sure better than before.--CENNOXX (talk) 11:24, 14 April 2013 (UTC)[reply]
Thanks, because I have no rights for this. There's another township - Q3266850, but it is interefered with commune... Infovarius (talk) 16:56, 14 April 2013 (UTC)[reply]

Fictional character and video game[edit]

Hallo Mangnus, in das Skript haben sich zwei Fehler eingeschlichen:

Die Hintergründe findet du in der Entitätencodierung: Vergaberichtlinien - Kurzliste.

Cheers --Kolja21 (talk) 20:26, 9 April 2013 (UTC)[reply]

PS: Ich habe auf Wikidata talk:Notability#Main types (GND) vorgeschlagen, den GND-Typen eigene Items zuzuordnen (eventuell könnte man dabei den Typ s untergliedern: "siw" = Software und "snz" = Nomenklatur Biologie - Chemie), bin bislang aber nur auf geringes Interesse gestoßen. --Kolja21 (talk) 20:35, 9 April 2013 (UTC)[reply]
Video Game ist wirklich ein Begriff?? Wollte das grade ändern, aber ich wollt jetzt nochmal auf Nummer sicher gehen, ob ich das richtig verstanden hab… Wo steht das, ich hab unter Wikidata:Infoboxes task force/terms nichts zu video game oder ähnlichem gesehen?! Viele Grüße, --CENNOXX (talk) 11:33, 14 April 2013 (UTC)[reply]
Die GND sieht das eigentlich so. Lustigerweise wird gerade abgestimmt (Wikidata:Requests for comment/Software statements) und eine Mehrheit ist dafür Software are "work" zu betrachten. --Goldzahn (talk) 12:03, 14 April 2013 (UTC)[reply]
Danke für die Info. Ich hinterlasse dort einen Kommentar. --Kolja21 (talk) 13:58, 14 April 2013 (UTC)[reply]

Bot flag[edit]

Hi Magnus,

I try to affirm a bot flag through the script, but somehow I don't seem to find the correct place. Would you mind adding the option? --  Docu  at 16:34, 13 April 2013 (UTC)[reply]

Thats done.--CENNOXX (talk) 21:41, 16 April 2013 (UTC)[reply]

Problem with the sportsperson occupation[edit]

An editor has changed the meaning of Q2066131 and wikidata useful should be updated. The correct item corresponding to "sportsperson" should be changed to Q10865754. Best, Pichpich (talk) 19:33, 15 April 2013 (UTC)[reply]

I left a message with User talk:Infovarius. Maybe the best solution is to undo his changes or perhaps to swap Q2066131 and Q10865754. So changing the script before we decide how to fix that problem might be premature. Pichpich (talk) 19:59, 15 April 2013 (UTC)[reply]
 Support reverting these changes, too many items link to Q2066131. --Ricordisamoa 20:49, 15 April 2013 (UTC)[reply]

problem bei teilweise vorhandenen statements[edit]

das script verweigert die einfügung von statements, wenn ein teil davon schon erfüllt ist, der andere aber noch nicht (beispielsweise eine person, für die kein geschlecht angegeben ist, oder ein werk für das kein instance-of angegeben ist). es sollte einfach das fehlende ergänzen, das andere ignorieren. --Akkakk (talk) 20:11, 16 April 2013 (UTC)[reply]

Flooding on RC page[edit]

This tool is flooding on recent changes page, and I think that we should require some rules how to use this tool. It's not nice to look recent changes, when it's full of edits made by using this tool. --Stryn (talk) 17:10, 20 April 2013 (UTC)[reply]

We should set a limit, so that if wd_useful detects an high edit rate, it stops editing, and requires the user to obtain a bot flag; then, we should use bot=true to ensure that bot edits are marked as such. --Ricordisamoa 19:09, 20 April 2013 (UTC)[reply]

Edit requests[edit]

Since this page is protected, could someone add

  • the following in the sportspeople section
[ 'ice hockey' , 'p106:q11774891' ] ,
  • the following in the organization section
[ 'political party' , 'p107:q43229' , 'p31:q7278' ] ,
[ 'sports club' , 'p107:q43229' , 'p31:q847017' ] ,

Also, as discussed at Property talk:P107, the GND type of a fictional character is not "Work" but "Term". Yes that's counter-intuitive but we have to live with that. So the line

[ 'fictional character' , 'p107:q386724' , 'p31:q95074' ] ,

should be deleted or moved down and replaced by

[ 'fictional character' , 'p107:q1969448' , 'p31:q95074' ] ,

Thanks, Pichpich (talk) 20:08, 23 April 2013 (UTC)[reply]

Is it ok if I insist? The last one in particular is really important because it's creating mistakes. Pichpich (talk) 19:14, 26 April 2013 (UTC)[reply]

new item for Property:P107[edit]

There is a new item Q11651459 instead of Q4167410 for not individualized persons, names or disambiguationpages. To prevent editwars with Sk!dbot this should be changed in this script. --Knopfkind (talk) 01:58, 25 April 2013 (UTC)[reply]

novalue/somevalue[edit]

Is it possible to modify this to add "novalue" or "somevalue" to a claim? -- Lavallen (block) 09:17, 18 May 2013 (UTC)[reply]

Source[edit]

Hello,

I want to add the same source (a book) on a lot of items. Is it possible to customize the script to do that ? Pyb (talk) 18:34, 31 May 2013 (UTC)[reply]

Duplicate category items in other languages[edit]

Is it possible to expand "Duplicate statements to en category" to wiki categories in other languages? Thanks. --Wylve (talk) 11:56, 31 August 2013 (UTC)[reply]

Time to remove all the references to P107[edit]

Should this be amended to remove all the items that add property P107 (P107)? --Filceolaire (talk) 20:11, 4 September 2013 (UTC)[reply]

Comment. I've done this already in my copy of this gadget. Infovarius (talk) 18:23, 9 September 2013 (UTC)[reply]
Sad, now we can't use the gadget any more for oc:Categoria:Tipe principal absent sus Wikidata. Is there a possibility to use the old version? --Martssnail (talk) 01:04, 25 September 2013 (UTC)[reply]

Wikimedia pages[edit]

the last section of Useful reads (Won't format for me. :(. Can anyone fix this?)

{ pre : 'an ' , options : [ [ '<b>event</b>' , 'p107:q1656682' ] , [ '<b>term</b>' , 'p107:q1969448' ] , [ '<b>disambiguation</b>' , 'p107:q11651459' ] , ] } ,

Could we change this to:

{ pre : 'an ' , options : [ [ '<b>Category</b>' , 'p31:q4167836' ] , [ '<b>template</b>' , 'p31:q14565791' ] , [ '<b>disambiguation</b>' , 'p31:q4167410' ] , [ '<b>name disambiguation</b>' , 'p31:q4167410', 'p31:q11651459' ] , ] } ,

--Filceolaire (talk) 20:32, 4 September 2013 (UTC)[reply]

Wikimedia template (Q11266439) is used for templates I suppose. Infovarius (talk) 18:23, 9 September 2013 (UTC)[reply]

fr translation[edit]

Hi, I have made a french translation of your script here. It works but it's not easy to pass your modifications. Is it possible to insert translations in your script ? Leag ⠇⠑⠁⠛ 07:22, 26 September 2013 (UTC)[reply]

Auto-detection of dates don't work with fr articles. I've translated months in french but dates aren't detected. Leag ⠇⠑⠁⠛ 08:50, 26 September 2013 (UTC)[reply]

I've added multi-language support, as well as your French translation, with English as fallback. I'll have a look at the months. --Magnus Manske (talk) 10:24, 26 September 2013 (UTC)[reply]

Unlinke other languages, French biographies don't put the dates in (); I've added a fallback for all languages, which might produce the occasional bogus result though. Also, French dates seem to use a template that adds encoded unicode characters instead of spaces; script now works with those as well. fr needs to do everything different, "just because we can" ;-) --Magnus Manske (talk) 10:42, 26 September 2013 (UTC)[reply]

Thanks a lot for the translations and for this great script. There are several translations remind here lien 982, here lines 397, 561 and 600. Is it possible to have a parameter to set the main langage as I have done line 676 ?
There are others translations nedded in your script between lines 501 and 511, lines 557 and 559, between lines 601 and 607, line 1179, lines 1216 and 1217. Can you put parameters in translation section ? Thanks again. Leag ⠇⠑⠁⠛ 11:39, 26 September 2013 (UTC)[reply]

One more thing, can you unprotect the script to allowed me to make changes on the french translation ? Thanks Leag ⠇⠑⠁⠛ 11:48, 26 September 2013 (UTC)[reply]

I'll get on that soon. Would love to unprotect the page but I'm not an admin here. Tried to move it to MediaWiki namespace but it wouldn't let me. Other place come to mind? --Magnus Manske (talk) 12:02, 2 October 2013 (UTC)[reply]

Extensibility of the code so other people can use this tool[edit]

I would like to extend your code. Here is my plan, creaet a way for your code to check for a variable named "wd_useful_thisis_langs_ex" that would be parsed. If it contains additional values...

  • add the custom definition to the your my common.js or another custom file like wikidata_useful_ex.js in your user page.
var wd_useful_thisis_langs_ex = {} ;
wd_useful_thisis_langs_ex['en'] = [
	[
		{
			pre : 'a ' ,
			options : [
				[ 'police station' , 'P31:Q861951' ] 
			]
		} 
	]
];

then i would add the following in your script page, a way to loop wd_useful_thisis_langs_ex then add the items to wd_useful_thisis_langs;

Also, I was planning to place the country list to a code and would make it also extensible to another ex variable.

is this ok? --Napoleon.tan (talk) 15:18, 26 September 2013 (UTC)[reply]

It seems i cannot edit the file. Do i need more special access rights? --Napoleon.tan (talk) 01:03, 27 September 2013 (UTC)[reply]
How about adding this code....
var wd_useful_thisis ;
if (undefined === wd_useful_thisis_langs_ex) {
	if ( undefined === wd_useful_thisis_langs[wgUserLanguage] ) {
		wd_useful_thisis = wd_useful_thisis_langs['en'] ; // Fallback
	} else {
		wd_useful_thisis = wd_useful_thisis_langs[wgUserLanguage] ;
	}
} else {
	if ( undefined === wd_useful_thisis_langs_ex[wgUserLanguage] ) {
		wd_useful_thisis = wd_useful_thisis_langs_ex['en'] ; // Fallback
	} else {
		wd_useful_thisis = wd_useful_thisis_langs_ex[wgUserLanguage] ;
	}
}

--Napoleon.tan (talk) 01:46, 27 September 2013 (UTC)[reply]

Would it be possible to add country of origin (P495) alongside country and country of citizenship, just below the pull-down list of countries? Danrok (talk) 16:53, 29 September 2013 (UTC)[reply]

I agree Danrok, and I tried, however, my coding is clearly insufficient. To me it was a line addition and two variations

h += "<a href='#' onclick='wd_useful.useCountry(2);return false'>C. of origin</a>" ;

...

var prop = v == 0 ? 17 : 27 : 495;

If someone is unable to add it appropriately, it would be great.  — billinghurst sDrewth 22:30, 9 November 2013 (UTC)[reply]
Legoktm was kind to me and fixed this and we now have country of origin.  — billinghurst sDrewth 10:25, 24 November 2013 (UTC)[reply]

Cricket[edit]

Hi, there is an error with this line : [ 'cricket' , 'P106:Q5185059' ] , it's not Q5185059 but Q12299841. Q5185059 is a disambiguation page. Thanks Leag ⠇⠑⠁⠛ 10:27, 12 November 2013 (UTC)[reply]

Good catch. ;-) I have taken the liberty of fixing.  — billinghurst sDrewth 10:28, 24 November 2013 (UTC)[reply]
Thanks Leag ⠇⠑⠁⠛ 08:08, 25 November 2013 (UTC)[reply]

This error still exist on fr and it translations, someone can fix it ? Leag ⠇⠑⠁⠛ 10:04, 27 January 2014 (UTC)[reply]

Someone can fix this error, please ? Leag ⠇⠑⠁⠛ 09:59, 12 February 2014 (UTC)[reply]

Missing months names in italian[edit]

Hello Magnus, the date extraction function is missing a couple of italian months names. Here they are:

  • july -> luglio
  • september -> settembre
  • october -> ottobre
  • december -> dicembre

Thank you. -- CristianCantoro (talk) 11:24, 25 April 2014 (UTC)[reply]

TypeError[edit]

I get the following error when using your script. This kind of error is annoying because it tends to stop execution of all other scripts. I did not dug deeper into this, yet. Sorry. Tested with Opera 12.

[06.05.2014 10:45:39] JavaScript - https://www.wikidata.org/wiki/Q16722397
Timeout thread: delay 300 ms
Uncaught exception: TypeError: '$('#wd_useful_dialog').dialog' is not a functionError thrown at line 419, column 3 in <anonymous function: init>() in https://www.wikidata.org/w/index.php?title=User:Magnus_Manske/wikidata_useful.js&action=raw&ctype=text/javascript:
    $('#wd_useful_dialog').dialog({
called from line 1218, column 2 in <anonymous function>() in https://www.wikidata.org/w/index.php?title=User:Magnus_Manske/wikidata_useful.js&action=raw&ctype=text/javascript:
    wd_useful.init();

--Thiemo Mättig (WMDE) 08:46, 6 May 2014 (UTC)[reply]

Seems the jQuery dialog module isn't guaranteed to be loaded. Here is a suggestion for the very last bit in the script. The timeout is probably not needed but it doesn't hurt.

if ( mw.config.get( 'wgNamespaceNumber' ) === 0 && mw.config.get( 'wgAction' ) === 'view' ) {
	$(document).ready( function() {
		setTimeout( function() {
			mw.loader.using( ['jquery.ui.dialog'], function() {
				wd_useful.init();
			} );
		}, 300 );
	} );
}

--Thiemo Mättig (WMDE) 15:51, 6 May 2014 (UTC)[reply]

addOnloadHook is deprecated[edit]

Not a real problem currently, it just triggers a little warning in the console which confuses people (e.g. in bugzilla:64842). In case you don't know, PerfektesChaos created this really helpful overview: de:Wikipedia:Technik/Skin/JS/Obsolet#addOnloadHook(). --Thiemo Mättig (WMDE) 08:53, 6 May 2014 (UTC)[reply]

Russian translation[edit]

Hi Magnus,

I added the Russian translations of the interface and month names. The code is here. GranD (talk) 18:16, 19 May 2014 (UTC)[reply]

RTL support[edit]

Hi,

In an RTL interface, the dialog is quite broken, because it is all shown in English.

It should either have everything translated to Hebrew, or be defined as LTR. Simply adding dir="ltr" to the main dialog element is a good quick fix. --Amir E. Aharoni (talk) 06:10, 14 August 2014 (UTC)[reply]

now displaying in bottom-left of item, instead of top-right...[edit]

now displaying in bottom-left of item, instead of top-right...

It's clearly not so convenient ;)

could you please do something to fix it ? it is really so, so, useful. Thanks --Hsarrazin (talk) 12:45, 1 October 2014 (UTC)[reply]

Same problem for me. — Ayack (talk) 17:30, 5 October 2014 (UTC)[reply]

Hide in diff view?[edit]

Is there a way to not show this tool in diff view? It is obstructing the vew of the diff itself, and isn't really useful in those cases; I would prefer to only see it when I'm in the normal view. Jon Harald Søby (talk) 19:56, 12 February 2015 (UTC)[reply]

I found a way to do it, so I went ahead and added it. Jon Harald Søby (talk) 13:20, 13 February 2015 (UTC)[reply]

Error[edit]

The English entry for transgender male has the following claim: P21:Q15145783) - has a extra bracket on the end. —Tom Morris (talk) 20:49, 7 December 2015 (UTC)[reply]

@Tom Morris: Fixed. Jon Harald Søby (talk) 19:19, 21 December 2015 (UTC)[reply]

Hide by default?[edit]

I sometimes make erroneous edits, by clicking on something before this tool has loaded, only for it to appear under my mouse pointer just at the crucial moment.

Also, at least 50% of the time, I find it's in the way when it opens, and has to be moved or closed.

Would it be possible, please, for it not to show, until a menu item is clicked, activating it?

If that would disrupt too many people's workflow, perhaps the behaviour could be made a user option? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 15:36, 8 September 2017 (UTC)[reply]

Agree with Andy. I frequently experience the same problems. --Infovarius (talk) 23:27, 9 September 2017 (UTC)[reply]
Support; I think it would be better to have a button for it similar to merge.js, AutoEdit etc. 1234qwer1234qwer4 (talk) 15:21, 8 August 2020 (UTC)[reply]
I have not had this problem, and so I prefer it showing up without an extra click required. However, if it were an option (perhaps a commented line in the script that could be 'turned on') for users who prefer it initially being hidden until called, that could work. Josh Baumgartner (talk) 09:17, 16 March 2021 (UTC)[reply]

Stopped working[edit]

Has this stopped working for anyone else? Gamaliel (talk) 19:32, 18 May 2020 (UTC)[reply]

Needs fix.--Jklamo (talk) 20:13, 18 May 2020 (UTC)[reply]
Thank you, Jklamo, this fixed my own copy of the script perfectly. Now we have to try and get Magnus to add the line, too. --Anvilaquarius (talk) 07:55, 19 May 2020 (UTC)[reply]
Done, thanks! --Magnus Manske (talk) 08:00, 19 May 2020 (UTC)[reply]

Date in qualifier[edit]

Hi, I'm having trouble adding a date in the automatic qualifier:

var wd_useful_thisis_add = [
				[ 'OkayAfrica 100 Women 2020' , 'P166:Q54889438|P585:Q25337' ] , // award received: OkayAfrica 100 Women; point in time: 2020
//				[ 'PD-100' , 'P6216:Q19652|P459:Q29940705' ] // copyright status:public domain, with qualifier determination method:100 years after author's death
				// You can add more (item only!) qualifiers by adding them with "|"
] ;

"P585:Q25337" should be point in time: 2020 (the year, not necessarily the Q item). What should I replace 2020 (Q25337) with to add "2020" in the qualifier? czar 18:51, 27 November 2020 (UTC)[reply]

@Czar: As of the moment, this script only supports qualifier properties with 'wikibase-item' datatype. point in time (P585) has 'time' datatype, so cannot currently be added with this script. I lack the scripting chops to know how to add functionality for other datatypes to the script. Josh Baumgartner (talk) 09:13, 16 March 2021 (UTC)[reply]

References[edit]

Does anyone have a solution to allow adding references to statements (in the same vein as qualifiers) by modifying this script? A patch I can splice work into my local version would be perfect. Josh Baumgartner (talk) 17:28, 16 March 2021 (UTC)[reply]

Stopped working[edit]

Yesterday, the script stopped working (again). Thanks in advance for any fixes. This is the single most important gadget for me for editing the usability nightmare that is Wikidata... --Anvilaquarius (talk) 11:33, 10 October 2021 (UTC)[reply]

I was worried it just stopped working for me. Yes, please don't make me go back to adding genders manually. Gamaliel (talk) 14:18, 10 October 2021 (UTC)[reply]
See https://www.wikidata.org/w/index.php?title=User%3AFrettie%2FWUS.js&type=revision&diff=1510493377&oldid=1506966496. --Jklamo (talk) 23:48, 15 October 2021 (UTC)[reply]

adding string properties and "novalue" or "somevalue" values[edit]

I would like to create some personal shortcuts for:

Is there any mechanism to add multi-lingual strings, numbers or "novalue" or "somevalue" values? Jarekt (talk) 16:08, 31 October 2022 (UTC)[reply]