This commit is contained in:
LubuWest 2019-01-09 22:03:16 +01:00
commit 63dfb9b197
70 changed files with 2829 additions and 1056 deletions

View file

@ -95,6 +95,20 @@ function friendicaWebRequest(url,rootwindow,callback) {
xhrequest.send();
}
function friendicaXmlRequest(url,rootwindow,callback) {
var xhrequest = new XMLHttpRequest();
xhrequest.onreadystatechange = function() {
if (xhrequest.readyState === XMLHttpRequest.HEADERS_RECEIVED) {}
else if(xhrequest.readyState === XMLHttpRequest.DONE) {
try{callback(xhrequest.responseXML)}
catch (e){showMessage("Error","API:\n" +url+" "+e+"\n Return: "+xhrequest.responseText, rootwindow)}
}
}
xhrequest.open("GET", url);
xhrequest.responseType ="document";
xhrequest.send();
}
function friendicaRemoteAuthRequest(login,url,c_url,rootwindow,callback) {
var xhrequest = new XMLHttpRequest();
xhrequest.onreadystatechange = function() {

View file

@ -465,7 +465,7 @@ function chatsfromdb(database,user,callback,stop_time){
helpernews.statusnet_html=Qt.atob(helpernews.statusnet_html);
helpernews.text=Qt.atob(helpernews.text);
helpernews.id=helpernews.status_id;
if (helpernews.attachments!==null){print(Qt.atob(helpernews.attachments));helpernews.attachments=JSON.parse(Qt.atob(helpernews.attachments))};
if (helpernews.attachments!==null){helpernews.attachments=JSON.parse(Qt.atob(helpernews.attachments))};
newsArray.push(helpernews);
}
callback(newsArray);

View file

@ -135,6 +135,21 @@ else{
if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=ptvideohelper.url)){attachmentList.push(ptvideohelper)}
}
}
// if (newsitemobject.text.indexOf("https://www.youtube.com/watch")>-1){
// //print("message "+msg.options.showWebsiteForLinks);
// if (msg.options.showYoutube!="false"){
// var ythelper={mimetype:"video/youtube"}
// var yttext=newsitemobject.text;
// while (yttext.indexOf("https://www.youtube.com/watch")>-1){
// var ythelperstringposition=linktext.indexOf("watch?v=");
// var ytposend=findend(yttext,ythelperstringposition);
// ythelper.url=yttext.substring(yttext.lastIndexOf("http",linkhelperstringposition),linkposend);
// linktext=linktext.substring(linkhelperstringposition+5,linktext.length)
// if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=linkhelper.url)){attachmentList.push(linkhelper)}
// }
// }
// }
// if (newsitemobject.text.indexOf(".html")>-1){
// //print("message "+msg.options.showWebsiteForLinks);
// if (msg.options.showWebsiteForLinks!="false"){

View file

@ -513,9 +513,6 @@ function updateView(viewtype){
//downloadNotice.text="xhr start "+Date.now()
switch(viewtype){
case "Conversations":
// updatenews.setDatabase();
// updatenews.login();
// updatenews.timeline();
var lastnews=Newsjs.getLastNews(login,db);
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
@ -525,9 +522,6 @@ function updateView(viewtype){
xhr.setParam("count",50)
break;
case "Timeline":
// updatenews.setDatabase();
// updatenews.login();
// updatenews.timeline();
var lastnews=Newsjs.getLastNews(login,db);
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
@ -565,6 +559,12 @@ function updateView(viewtype){
xhr.setApi("/api/favorites");
xhr.clearParams();
break;
case "Replies":
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
xhr.setApi("/api/statuses/replies");
xhr.clearParams();
break;
default:
var lastnews=Newsjs.getLastNews(login,db);
xhr.setLogin(login.username+":"+Qt.atob(login.password));
@ -575,8 +575,8 @@ function updateView(viewtype){
xhr.setParam("count",50)
newstab.newstabstatus="Conversations";
}
xhr.get();
xhr.get();
if (viewtype==="Conversations"){Newsjs.allchatsfromdb(db,login.username,function(temp){
newsStack.allchats=temp
})}

View file

@ -0,0 +1,45 @@
<html>
<head>
<title>-1</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
</head>
<body bgcolor="black" marginwidth="0" marginheight="0">
<div id="player"></div>
<script>
function getVideoId() {
return window.location.href.slice(window.location.href.indexOf('?') + 1);
}
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {
playerVars: { 'html5': 1, 'iv_load_policy': 3 },
frameborder: '0',
height: '100%',
width: '100%',
videoId: getVideoId(),
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
function onPlayerReady(event) {
document.title = 0;
}
function onPlayerStateChange(event) {
if (event.data == YT.PlayerState.PLAYING) {
document.title = 1;
} else if (event.data == YT.PlayerState.ENDED || event.data == YT.PlayerState.PAUSED) {
document.title = 2;
}
}
</script>
</body>
</html>