MediaWiki:Graph.js: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 981: Line 981:


function getProperUrl(){
function getProperUrl(){
   var url = window.location.toString();
   // locally use a full url adress found in data.js, on server use the function to get the url
   url = url.split("#")[0];
  // var url = window.location.href;
   var url="https://wiki.veriqloud.fr/index.php?title=Quantum_Leader_Election";
   return url;
   return url;
}
}


var selected= [];
var selected= [];
function noParty() {
  for (i=0;i<zooData.length;i++){
    if(zooData[i]['category']=='protocol_party'){
        if ( typeof zooData[i]['requires']  !== 'undefined'){
            for (j=0;j<zooData.length;j++){
                if ( typeof zooData[j]['requires']  !== 'undefined' ){
                    if(zooData[j]['requires'].includes(zooData[i]['id'])){
                        for (k=0;k<zooData[i]['requires'].length;k++){
                            zooData[j]['requires'].push(zooData[i]['requires'][k]);
                        }
                    }
                }
            }
        }
        zooData.splice(i,1);
        i--;
    }
  }
}


function unique(){
function unique(){
   if (typeof getAllUrlParams().title  !== 'undefined'){
   if (typeof getAllUrlParams().title  !== 'undefined'){
     if (getAllUrlParams().title.length >0 ){
     if (getAllUrlParams().title.length >0 && getAllUrlParams().title[0] != "Main_Page"){
       for (i=0;i<zooData.length;i++){
       for (i=0;i<zooData.length;i++){
         if ( typeof zooData[i].uri  !== 'undefined'){
         if ( typeof zooData[i].uri  !== 'undefined'){
Line 1,014: Line 1,036:
       }
       }
     }
     }
    else {noParty();}
   }
   }
  else {noParty();}
}
}
// graph build


let allNodes;
let allNodes;
let allEdges;
let allEdges;


// transformation data for protocol_party
// transformation data for protocol_party and graphs in pages
 
for (i=0;i<zooData.length;i++){
    if(zooData[i]['category']=='protocol_party'){
        if ( typeof zooData[i]['requires']  !== 'undefined'){
            for (j=0;j<zooData.length;j++){
                if ( typeof zooData[j]['requires']  !== 'undefined' ){
                    if(zooData[j]['requires'].includes(zooData[i]['id'])){
                        for (k=0;k<zooData[i]['requires'].length;k++){
                            zooData[j]['requires'].push(zooData[i]['requires'][k]);
                        }
                    }
                }
            }
        }
        zooData.splice(i,1);
        i--;
    }
}


unique();
unique();
299

edits