Difference between revisions of "User:Abel/experimental.js"

From Wikibase Personal data
Jump to navigation Jump to search
m
m
Line 31: Line 31:
 
console.log('User Interface active');
 
console.log('User Interface active');
  
var wbproc = new wbContainer(mw, mwEStruct['wbXntity']);
+
var wbproc = new wbContainer(mw, mwEStruct['wbXntity']),
  
 
// Check whether the current page is in a relation of interest to an id of interest
 
// Check whether the current page is in a relation of interest to an id of interest
current_entity = wbproc.checkentity( relational_id_list, wbEStruct['IDPropLoc'], wbEStruct['IDName'] );
+
current_entity = wbproc.checkentity( relational_id_list, [ wbEStruct['IDPropLoc'], wbEStruct['IDName'] ] );
 
// This should return an object of relations and ids
 
// This should return an object of relations and ids
  

Revision as of 10:36, 14 May 2019

// License: GPL
// Experimental Main
console.log("'⌣'");

var mwEStruct = {
      wbXntity: 'config.values.wbEntity'
    },

    language = "en",

	wbEStruct = {
        subclassOfRelations: 'claims.P4', // location of P4 relations in wbEntity
        defaultValRelation: 'claims.P108',
        concernsRelation: 'claims.P110',
        instanceOfRelations: 'claims.P3',
        IDPropLoc:  'mainsnak.datavalue.value', // location of ID properties in related entity
        IDName:   'numeric-id', // ID property name which checked 
        qIDPropName: 'id',
        standardValue: 'labels' + '.' + language + '.' + 'value'
    },

	relational_id_list = { 
						   controller_id: [ wbEStruct['instanceOfRelations'], 96 ],
						   personal_data_id: [ wbEStruct['subclassOfRelations'], 421 ],
						   interface_button_id: [ wbEStruct ['instanceOfRelations'], 487 ]
						};

mw.loader.using( ['ext.gadget.WbProcessor', 'ext.gadget.PersonalDataBase', 'ext.gadget.PDOOUI'] ).then( function () {
	console.log('Wbprocessor active');
	console.log('Personaldatabase active');
	console.log('User Interface active');

	var wbproc = new wbContainer(mw, mwEStruct['wbXntity']),

	// Check whether the current page is in a relation of interest to an id of interest
	current_entity = wbproc.checkentity( relational_id_list, [ wbEStruct['IDPropLoc'], wbEStruct['IDName'] ] );
	// This should return an object of relations and ids

	console.log(current_entity);

	// for each match, render the corresponding ui elements
	// current_entity.forEach(pdooui.render);

});