| Line 17: |
Line 17: |
| | return dive( claim , 'mainsnak.datavalue.value')['numeric-id'] === DATA_CONTROLLER_ITEM_ID; | | return dive( claim , 'mainsnak.datavalue.value')['numeric-id'] === DATA_CONTROLLER_ITEM_ID; |
| | } | | } |
| − |
| |
| | | | |
| | mw.hook( 'wikibase.entityPage.entityLoaded' ).add( function ( entity ) { | | mw.hook( 'wikibase.entityPage.entityLoaded' ).add( function ( entity ) { |
| | 'use strict'; | | 'use strict'; |
| − | console.log( entity );
| |
| | | | |
| | // get the ID of the current page | | // get the ID of the current page |
| Line 28: |
Line 26: |
| | | | |
| | if (isDataController(entity)) { | | if (isDataController(entity)) { |
| − | console.log('is dc');
| |
| | generateGDPRLink(pageID); | | generateGDPRLink(pageID); |
| | } | | } |
| Line 35: |
Line 32: |
| | function isDataController(entity) { | | function isDataController(entity) { |
| | let foundThatThisIsAnInstanceOfDataController = false; | | let foundThatThisIsAnInstanceOfDataController = false; |
| − | console.log('here1');
| |
| | | | |
| | if ( typeof entity != "undefined" ) // if we are on the page of a loaded entity | | if ( typeof entity != "undefined" ) // if we are on the page of a loaded entity |
| | { | | { |
| − | console.log( "entity is defined" );
| |
| − | console.log('here2');
| |
| − | console.dir(entity);
| |
| | if ( typeof check( entity, INSTANCE_OF_PROPERTY ) != "undefined" ) // if the entity has any "instance of" claim | | if ( typeof check( entity, INSTANCE_OF_PROPERTY ) != "undefined" ) // if the entity has any "instance of" claim |
| | { | | { |
| − | console.log('here3');
| |
| | let claims = dive( entity, INSTANCE_OF_PROPERTY ); // get the claims which use the "instance of" property | | let claims = dive( entity, INSTANCE_OF_PROPERTY ); // get the claims which use the "instance of" property |
| | if (claims.some(claimUsesDataControllerAsItsObject)) | | if (claims.some(claimUsesDataControllerAsItsObject)) |
| | { | | { |
| − | console.log('here4');
| |
| | foundThatThisIsAnInstanceOfDataController = true; | | foundThatThisIsAnInstanceOfDataController = true; |
| | } | | } |