Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
//importScript('User:Belteshassar/sdc tool.js')
mw.loader.load( 'ext.gadget.VisualFileChange' );
function DBMClaim() {
	var api = new mw.Api();
	var conf = mw.config.get( [
		'wgCategories',
		'wgIsArticle',
		'wgGlobalGroups',
		'wgNamespaceNumber',
		'wgPageName',
		'wgUserGroups',
		'wgUserLanguage',
		'wgUserName',
		'wgArticleId',
	] )
	if ( conf.wgNamespaceNumber !== 6 ) {
		return;
	}
	user = conf.wgUserName;
	page = conf.wgPageName;
	oChangeTag = 'CreatorAdder';
	var entityId = 'M' + conf.wgArticleId;
	guidGenerator = new wikibase.utilities.ClaimGuidGenerator( entityId );
	guid = guidGenerator.newGuid();
	claim = JSON.stringify( {
		type: 'statement',
		id: guid,
		rank: 'normal',
		mainsnak: {
			snaktype: 'value',
			property: 'P170',
			datatype: 'wikibase-item',
			datavalue: {
				type: 'wikibase-entityid',
				value: {
					'entity-type': 'item',
					'id': 'Q113531294',
					'numeric-id': 113531294,
				},
			},
		},
		qualifiers: {
        	'P3831': [{
              snaktype: 'value',
              property: 'P3831',
              datatype: 'wikibase-item',
              datavalue: {
				type: 'wikibase-entityid',
				value: {
					'entity-type': 'item',
					'id': 'Q33231',
					'numeric-id': 33231,
					},
				},
        	},
        	]
        },
        'qualifiers-order': [
          'P3831',
        ],
	} );
	api.postWithEditToken( {
		action: 'wbsetclaim',
		id: entityId,
		format: 'json',
		claim: claim,
		summary: 'add creator info',
	}).done(function() {
		mw.notify(mw.msg('Added the claim to the item'));
	}).fail( function() {
    	mw.notify(mw.msg('Failed to add the claim to the item'));
    });
}
$.when( mw.loader.using( 'mediawiki.util' ), $.ready ).then( function () {
if (mw.config.get('wgNamespaceNumber') === 6 &&
	mw.config.get('wgIsArticle') &&
	document.getElementById('file')) {
	$(function () {
		mw.util.addPortletLink(
			'p-tb',
			'javascript:DBMClaim();',
			'Add DBM as Creator',
			'dbm-cr',
			'Add DBM as Creator');
	});
}
} );
window.acdcFavoriteProperties = [
	'P180',
	'P170',
];