v0.1
This commit is contained in:
parent
8d99b55818
commit
7e37546ae9
108 changed files with 6063 additions and 1450 deletions
|
@ -1,6 +1,11 @@
|
|||
WorkerScript.onMessage = function(msg) {
|
||||
if(msg.appendnews!==true){ msg.model.clear()};
|
||||
|
||||
if(msg.deleteId)
|
||||
{msg.model.remove(msg.deleteId);
|
||||
msg.model.sync()
|
||||
}
|
||||
else{
|
||||
if(msg.appendnews!==true){msg.model.clear()};
|
||||
msg.model.sync()
|
||||
for (var j=0;j<msg.news.length;j++){
|
||||
if (msg.news[j]) {
|
||||
var newsitemobject=msg.news[j];
|
||||
|
@ -11,7 +16,7 @@ WorkerScript.onMessage = function(msg) {
|
|||
newsitemobject.user.profile_image_url="";
|
||||
newsitemobject.user.name="";
|
||||
}
|
||||
//var forumname="";if (newsitemobject.messagetype==0&&(parseInt(newsitemobject.friendica_owner)!=parseInt(newsitemobject.user.id))){forumname=" via "+newsitemobject.friendica_owner_object.name}
|
||||
var forumname="";if (newsitemobject.messagetype==0&&((newsitemobject.friendica_owner)!=(newsitemobject.user.url))){forumname=" via "+Qt.atob(newsitemobject.friendica_owner_object.name)}
|
||||
var likeText="";var dislikeText="";var attendyesText="";var attendnoText="";var attendmaybeText=""; var self={};
|
||||
if (newsitemobject.messagetype==0){
|
||||
if (newsitemobject.like.length>0){
|
||||
|
@ -41,7 +46,7 @@ WorkerScript.onMessage = function(msg) {
|
|||
if (newsitemobject.friendica_activities_self.indexOf(1)!=-1){self.liked=1}
|
||||
if (newsitemobject.friendica_activities_self.indexOf(2)!=-1){self.disliked=1}
|
||||
}
|
||||
var friendica_activities={likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText,self:self}
|
||||
var friendica_activities={likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText,self:self}
|
||||
|
||||
var attachmentList=[];if(newsitemobject.attachments){
|
||||
var attachArray=JSON.parse(Qt.atob(newsitemobject.attachments));
|
||||
|
@ -52,21 +57,26 @@ WorkerScript.onMessage = function(msg) {
|
|||
}
|
||||
newsitemobject.attachmentList=attachmentList;
|
||||
var seconds=(msg.currentTime-newsitemobject.created_at)/1000;
|
||||
var timestring="";
|
||||
if (seconds<60) {timestring=seconds+" "+qsTr("seconds") +" "+qsTr("ago");}
|
||||
else if (seconds<90){timestring=Math.round(seconds/60)+" "+qsTr("minute") +" "+qsTr("ago");}
|
||||
else if (seconds<3600){timestring=Math.round(seconds/60)+" "+qsTr("minutes") +" "+qsTr("ago");}
|
||||
else if (seconds<5400){timestring=Math.round(seconds/3600)+" "+qsTr("hour") +" "+qsTr("ago");}
|
||||
else if (seconds<86400){timestring=Math.round(seconds/3600)+" "+qsTr("hours") +" "+qsTr("ago");}
|
||||
else if (seconds<129600){timestring=Math.round(seconds/86400)+" "+qsTr("day") +" "+qsTr("ago");}
|
||||
else if (seconds<3888000){timestring=Math.round(seconds/86400)+" "+qsTr("days") +" "+qsTr("ago");}
|
||||
else if (seconds<5832000){timestring=Math.round(seconds/3888000)+" "+qsTr("month") +" "+qsTr("ago");}
|
||||
else if (seconds<69984000){timestring=Math.round(seconds/3888000)+" "+qsTr("months") +" "+qsTr("ago");}
|
||||
else {timestring=Math.round(seconds/46656000)+" "+qsTr("years") +" "+qsTr("ago");}
|
||||
var data=({"newsitemobject": newsitemobject,"dateDiff":timestring,"friendica_activities":friendica_activities})}
|
||||
//print("News:"+j+msg.news.length+JSON.stringify(data));
|
||||
msg.model.append(data);}
|
||||
if (j==msg.news.length){
|
||||
msg.model.sync()
|
||||
};
|
||||
var timestring="";
|
||||
if (seconds<60) {timestring=seconds+" "+qsTr("seconds") +" "+qsTr("ago");}
|
||||
else if (seconds<90){timestring=Math.round(seconds/60)+" "+qsTr("minute") +" "+qsTr("ago");}
|
||||
else if (seconds<3600){timestring=Math.round(seconds/60)+" "+qsTr("minutes") +" "+qsTr("ago");}
|
||||
else if (seconds<5400){timestring=Math.round(seconds/3600)+" "+qsTr("hour") +" "+qsTr("ago");}
|
||||
else if (seconds<86400){timestring=Math.round(seconds/3600)+" "+qsTr("hours") +" "+qsTr("ago");}
|
||||
else if (seconds<129600){timestring=Math.round(seconds/86400)+" "+qsTr("day") +" "+qsTr("ago");}
|
||||
else if (seconds<3888000){timestring=Math.round(seconds/86400)+" "+qsTr("days") +" "+qsTr("ago");}
|
||||
else if (seconds<5832000){timestring=Math.round(seconds/3888000)+" "+qsTr("month") +" "+qsTr("ago");}
|
||||
else if (seconds<69984000){timestring=Math.round(seconds/3888000)+" "+qsTr("months") +" "+qsTr("ago");}
|
||||
else {timestring=Math.round(seconds/46656000)+" "+qsTr("years") +" "+qsTr("ago");}
|
||||
|
||||
var data=({"newsitemobject": newsitemobject,"dateDiff":timestring,"friendica_activities":friendica_activities,"forumname":forumname})}
|
||||
//print("News:"+j+msg.news.length+JSON.stringify(data));
|
||||
msg.model.append(data)
|
||||
}
|
||||
|
||||
if (j==msg.news.length){
|
||||
//print("j: "+j+" msg.model.count: "+msg.model.count);
|
||||
msg.model.sync()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue