| Line 1: |
Line 1: |
| | // License: GPL | | // License: GPL |
| | // Wikibase Instance/Entity Gadget | | // Wikibase Instance/Entity Gadget |
| − | console.log('Wbprocessor loading'); | + | console.log('Wbprocessor loading');function wbContainer( universe, location ) { |
| − | function wbContainer(universe, location) { | + | var obj = {}; |
| | + | |
| | + | obj.main = interjson( get_Y_from_X( universe, location )); |
| | + | |
| | + | obj.checkentity = function ( rel_id_list, inner_location, property ) { |
| | + | var return_obj = {}; |
| | + | Object.keys(rel_id_list).forEach( function(item){ |
| | + | if ( check( main, rel_id_list[item][0] ) != undefined ) { |
| | + | var primary_part = get_Y_from_X( main, rel_id_list[item][0] ); |
| | + | if ( check_Y_in_X ( primary_part, (property) ? inner_location + '.' + property : inner_location ) ) { |
| | + | return_obj[item] = rel_id_list[item]; |
| | + | } |
| | + | } |
| | + | }); |
| | + | return return_obj; |
| | + | } |
| | | | |
| | // the list of private helper functions, could not be accessed from outside | | // the list of private helper functions, could not be accessed from outside |
| Line 66: |
Line 81: |
| | } | | } |
| | | | |
| − | this.main = interjson( get_Y_from_X( universe, location ));
| |
| − |
| |
| − | this.checkentity = function ( rel_id_list, inner_location, property ) {
| |
| − | var return_obj = {};
| |
| − | Object.keys(rel_id_list).forEach( function(item){
| |
| − | if ( check( main, rel_id_list[item][0] ) != undefined ) {
| |
| − | var primary_part = get_Y_from_X( main, rel_id_list[item][0] );
| |
| − | if ( check_Y_in_X ( primary_part, inner_location + '.' + property ) ) {
| |
| − | return_obj[item] = rel_id_list[item];
| |
| − | }
| |
| − | }
| |
| − | });
| |
| − | return return_obj;
| |
| − | }
| |
| | } | | } |