v0.6.3 Dark Mode

This commit is contained in:
LubuWest 2021-10-28 21:56:00 +02:00
commit 66e5c33b00
56 changed files with 1869 additions and 1283 deletions

View file

@ -64,19 +64,21 @@ function beautify(newsitemobject,msg){
var attachArray=newsitemobject.attachments;
for (var image in attachArray){
var attachhelper={mimetype:attachArray[image].mimetype}
var attachhelperstring=Qt.btoa(attachArray[image].url)
var attachhelperstring="<img" //Qt.btoa(attachArray[image].url)
var helperstringposition=newsitemobject.statusnet_html.indexOf(attachhelperstring);
if (helperstringposition>-1){attachhelper.url=newsitemobject.statusnet_html.substring(newsitemobject.statusnet_html.lastIndexOf("http",helperstringposition),helperstringposition+attachhelperstring.length);
if (attachArray[image].mimetype=="image/jpeg"){attachhelper.url=attachhelper.url+".jpg"}
else if (attachArray[image].mimetype=="image/gif"){attachhelper.url=attachhelper.url+".gif"}
else if (attachArray[image].mimetype=="image/png"){attachhelper.url=attachhelper.url+".png"}
}
else {attachhelper.url=attachArray[image].url}
// if (helperstringposition>-1){attachhelper.url=newsitemobject.statusnet_html.substring(newsitemobject.statusnet_html.lastIndexOf("http",helperstringposition),helperstringposition+attachhelperstring.length);
// if (attachArray[image].mimetype=="image/jpeg"){attachhelper.url=attachhelper.url+".jpg"}
// else if (attachArray[image].mimetype=="image/gif"){attachhelper.url=attachhelper.url+".gif"}
// else if (attachArray[image].mimetype=="image/png"){attachhelper.url=attachhelper.url+".png"}
// }
// else {
attachhelper.url=attachArray[image].url
// }
if (helperstringposition>-1){var removeme=newsitemobject.statusnet_html.substring(helperstringposition,newsitemobject.statusnet_html.indexOf('">',helperstringposition)+2);}
//print("Attachhelper "+attachhelper.url)
newsitemobject.statusnet_html=newsitemobject.statusnet_html.replace(attachhelper.url,"")
newsitemobject.statusnet_html=newsitemobject.statusnet_html.replace(attachhelper.url.substring(0,attachhelper.url.length-4)+".jpeg","")
newsitemobject.statusnet_html=newsitemobject.statusnet_html.replace(attachhelper.url.substring(0,attachhelper.url.length-4),"")
newsitemobject.statusnet_html=newsitemobject.statusnet_html.replace(removeme,"")
//newsitemobject.statusnet_html=newsitemobject.statusnet_html.replace(attachhelper.url.substring(0,attachhelper.url.length-4)+".jpeg","")
//newsitemobject.statusnet_html=newsitemobject.statusnet_html.replace(attachhelper.url.substring(0,attachhelper.url.length-4),"")
imageAttachmentList.push(attachhelper)
}
@ -138,18 +140,19 @@ if(msg.deleteId!==undefined)
msg.model.sync()
}
else{
if(msg.method=="refresh" ||(msg.method=="conversation"&&msg.news.length>0)){msg.model.clear()};
if(msg.method=="refresh" || msg.method=="contact" ||(msg.method=="conversation"&&msg.news.length>0)){msg.model.clear()};
msg.model.sync()
for (var j=0;j<msg.news.length;j++){
//for (var j=0;j<msg.news.length;j++){
for (var j in msg.news){
let data=({})
if (msg.news[j]) {
var newsitemobject=msg.news[j];
newsitemobject=beautify(newsitemobject,msg);
if (newsitemobject.hasOwnProperty("currentconversation")&&(newsitemobject.currentconversation.length>0)){
newsitemobject.lastcomment=beautify(newsitemobject.currentconversation[newsitemobject.currentconversation.length-1],msg);
newsitemobject.lastcomment.indent=1
//print("Currentconversation" + newsitemobject.currentconversation.length+JSON.stringify(newsitemobject.lastcomment))
}
}
if (msg.method=="conversation"){
if (j==0){newsitemobject.indent=0}else{
@ -160,19 +163,17 @@ else{
}
}
}}
var data=({"newsitemobject": newsitemobject})
data=({"newsitemobject": newsitemobject})
}
if(msg.method=="append") {
msg.model.insert(j, data)}
else{
msg.model.append(data)
}
}
if (j==msg.news.length){
//if (j==msg.news.length){
msg.model.sync()
}
//}
}
}