Bachelorarbeit: "Ein Tool zur Erklärung von Datenschutzrichtlinien"
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

82 lines
2.5 KiB

/**
* This document defines the functions for the summary to get the right pictogram
*/
/**
* This function search for the right third party picture.
* It gets a explaination for the icon and the id for the scroll animation.
* It returns a div with the pictogram and a explaination.
*/
function getpictogramthird(explaination, id){
try{
let deflt = "thirdparty";
let src = "'pic_data_base/"+deflt+".png'";
let tmp = explaination.toLowerCase();
let potential_keys = tmp.split(" ");
for(let i = 0; i < potential_keys.length;i++){
if(potential_keys[i] in keys_en){
src = "'"+browser.runtime.getURL("pic_data_base/"+keys_en[potential_keys[i]]+".png'");
} else {
src = "'"+browser.runtime.getURL("pic_data_base/"+deflt+".png'");
}
}
//console.log(src);
let btn = "<button class='mdc-button "+id+"button'><span class='mdc-button__ripple'></span><span class='mdc-button__label'>Mark in Text</span></button>";
return "<div class='summary-picto-div'>"+"<image src="+src+ "width='32' height='32' >"+"<p class='summary-explain-p'>"+explaination+"<br>"+btn+"</p>"+"</div>";
} catch(e){
console.log(e);
}
}
/**
* This function search for the right collected data picture.
* It gets a explaination for the icon and the id for the scroll animation.
* It returns a div with the pictogram and a explaination.
*/
function getpictogramdata(explaination, id){
try{
let dflt = "dflt";
let src = "";
let tmp = explaination.toLowerCase();
let potential_keys = tmp.split(" ");
for(let i = 0; i < potential_keys.length;i++){
console.log(potential_keys[i]);
if(potential_keys[i] in keys_en){
src = "'"+browser.runtime.getURL("pic_data_base/"+keys_en[potential_keys[i]]+".png'");
break;
} else {
src = "'"+browser.runtime.getURL("pic_data_base/"+dflt+".png'");
}
}
let btn = "<button class='mdc-button "+id+"button'><span class='mdc-button__ripple'></span><span class='mdc-button__label'>Mark in Text</span></button>";
//let btn = "<a href='#"+id+"'>Go to Text</a>";
//console.log("class='"+id+"button'");
return "<div class='summary-picto-div' >"+"<image src="+src+" width='32' height='32' >"+"<p class='summary-explain-p'>"+explaination+"<br>"+btn+"</p>"+"</div>";
} catch(e){
console.log(e);
}
}
/**
* This function returns a pictogram by a name
*/
function getpic(name){
try{
src = "'"+ browser.runtime.getURL("pic_data_base/"+name+".png")+"'";
//console.log(src);
return "<img src="+src+" width='32' height='32'>";
} catch(e){
console.log(e);
}
}