Line 2: |
Line 2: |
| const INSTANCE_OF_PROPERTY = 'claims.P3'; // because P3 is the property "instance of" | | const INSTANCE_OF_PROPERTY = 'claims.P3'; // because P3 is the property "instance of" |
| | | |
− | function generateGDPRLink(qId) { | + | function generateGDPRLink(dataControllerItemID) { |
| // make an API call to expand the letter template, using this item. | | // make an API call to expand the letter template, using this item. |
| let api = new mw.Api(); | | let api = new mw.Api(); |
| api.get( { | | api.get( { |
| action: 'expandtemplates', | | action: 'expandtemplates', |
− | text: '{{User:Alexbfree/Template:GDPRMailtoAccess|qID='+qId+'}}' | + | text: '{{User:Alexbfree/Template:GDPRMailtoAccess|qID='+dataControllerItemID+'}}' |
| } ).done( function ( data ) { | | } ).done( function ( data ) { |
| var expanded = $(data.expandtemplates["*"]) | | var expanded = $(data.expandtemplates["*"]) |
Line 39: |
Line 39: |
| // get the ID of the current page | | // get the ID of the current page |
| var $title2 = $( '.wikibase-title' ); | | var $title2 = $( '.wikibase-title' ); |
− | console.log($title2.find( '.wikibase-title-id' ).text());
| |
| var qId = $title2.find( '.wikibase-title-id' ).text().replace( /[()]/g, '' ); | | var qId = $title2.find( '.wikibase-title-id' ).text().replace( /[()]/g, '' ); |
− | console.log('qid is '+qId);
| |
| | | |
| if (isDataController()) { | | if (isDataController()) { |
− | generateGDPRLink(qID); | + | generateGDPRLink(qId); |
| } | | } |