Changes

Jump to navigation Jump to search
no edit summary
Line 14: Line 14:  
       // Your code goes here
 
       // Your code goes here
 
       console.log( entity );
 
       console.log( entity );
  } );
   
// check if we are on a page of a loaded Entity
 
// check if we are on a page of a loaded Entity
if ( typeof mw.config.values.wbEntity !=  "undefined" ) {
+
if ( typeof entity !=  "undefined" ) {
console.log( "entity is defined" )
   
// get wbEntity as json
 
// get wbEntity as json
var obj = JSON.parse ( mw.config.values.wbEntity );
+
var obj = JSON.parse ( entity );
 
console.log( "parsed object", obj )
 
console.log( "parsed object", obj )
 
// check if we have P3 relations and iterate through
 
// check if we have P3 relations and iterate through
Line 45: Line 43:  
// Else let's do nothing;
 
// Else let's do nothing;
 
}
 
}
 
+
  } );
 +
 
 
// helper function for diving into a part of array
 
// helper function for diving into a part of array
 
function indexinterpolate(obj,i) { return  (obj[i] != undefined) ? obj[i] : obj};  
 
function indexinterpolate(obj,i) { return  (obj[i] != undefined) ? obj[i] : obj};  

Navigation menu