Line 9: |
Line 9: |
| if ( typeof check( obj, INSTANCE_OF_PROPERTY ) != "undefined" ) // if the entity has any "instance of" claim | | if ( typeof check( obj, INSTANCE_OF_PROPERTY ) != "undefined" ) // if the entity has any "instance of" claim |
| { | | { |
− | for( var i = 0; i < dive( obj, INSTANCE_OF_PROPERTY ).length; i++ ) // retrieve each 'instance of' claim to check it | + | let instance_of_claims = dive( obj, INSTANCE_OF_PROPERTY ); |
| + | for( var i = 0; i < instance_of_claims.length; i++ ) // retrieve each 'instance of' claim to check it |
| { | | { |
− | if( dive( dive( obj, INSTANCE_OF_PROPERTY)[i] , 'mainsnak.datavalue.value')['numeric-id'] === DATA_CONTROLLER_ITEM_ID ) | + | let the_thing_it_is_an_instance_of = dive( instance_of_claims[i] , 'mainsnak.datavalue.value'); |
| + | if (the_thing_it_is_an_instance_of['numeric-id'] === DATA_CONTROLLER_ITEM_ID ) |
| { | | { |
| // it's a data controller | | // it's a data controller |
Line 21: |
Line 23: |
| return retVal; | | return retVal; |
| } | | } |
− |
| |
| | | |
| console.log ("start of Alex's Access template"); | | console.log ("start of Alex's Access template"); |
Line 37: |
Line 38: |
| action: 'expandtemplates', | | action: 'expandtemplates', |
| text: '{{User:Alexbfree/Template:GDPRMailtoAccess|qID='+qId+'}}' | | text: '{{User:Alexbfree/Template:GDPRMailtoAccess|qID='+qId+'}}' |
− | } ) | + | } ).done( function ( data ) { |
− | .done( function ( data ) {
| |
| var expanded = $(data.expandtemplates["*"]) | | var expanded = $(data.expandtemplates["*"]) |
| mw.notify( expanded , { autoHide: false } ); // pop up the notification with the link | | mw.notify( expanded , { autoHide: false } ); // pop up the notification with the link |