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.
62 lines
1.8 KiB
62 lines
1.8 KiB
4 years ago
|
/**
|
||
|
* This function search for a matching pictogram for the thirdparty
|
||
|
*
|
||
|
*/
|
||
|
function getpictogramthird(explaination){
|
||
|
let deflt = "thirdparty";
|
||
|
let src = "";
|
||
|
let tmp = explaination;
|
||
|
|
||
|
let potential_keys = tmp.toLowerCase().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/"+deflt+".png'");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
console.log(src);
|
||
|
return "<div class='summary-picto-div'>"+"<image src="+src+ "width='32' height='32' >"+"<p class='summary-explain-p'>"+explaination+"</p>"+"</div>";
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* This function search for a matching pictogram for the collected data
|
||
|
*
|
||
|
*/
|
||
|
function getpictogramdata(explaination){
|
||
|
let dflt = "dflt";
|
||
|
let src = "";
|
||
|
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'");
|
||
|
break;
|
||
|
} else {
|
||
|
src = "'"+browser.runtime.getURL("pic_data_base/"+dflt+".png'");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if(explaination.includes("operation syst")){
|
||
|
console.log("TREFFER");
|
||
|
console.log(os);
|
||
|
switch(os.os){
|
||
|
case "win": src = "'"+browser.runtime.getURL("pic_data_base/"+"Microsoft"+".png'");
|
||
|
break;
|
||
|
case "mac": src = "'"+browser.runtime.getURL("pic_data_base/"+"mac"+".png'");
|
||
|
break;
|
||
|
case "linux": src = "'"+browser.runtime.getURL("pic_data_base/"+"linux"+".png'");
|
||
|
default: dflt = "dflt";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
return "<div class='summary-picto-div'>"+"<image src="+src+" width='32' height='32' >"+"<p class='summary-explain-p'>"+explaination+"</p>"+"</div>";
|
||
|
}
|
||
|
|