Improve: nano
This commit is contained in:
parent
4cabeb2e99
commit
85468761d3
|
@ -1,7 +1,11 @@
|
||||||
|
|
||||||
//TL取得
|
//TL取得
|
||||||
|
var websocket;
|
||||||
function tl(data) {
|
function tl(data) {
|
||||||
var tlid = 0;
|
var tlid = 0;
|
||||||
|
if(websocket){
|
||||||
|
websocket.close()
|
||||||
|
}
|
||||||
var acct_id = $("#post-acct-sel").val();
|
var acct_id = $("#post-acct-sel").val();
|
||||||
var type = $("#type-sel").val();
|
var type = $("#type-sel").val();
|
||||||
var domain = localStorage.getItem("domain_" + acct_id);
|
var domain = localStorage.getItem("domain_" + acct_id);
|
||||||
|
@ -28,9 +32,9 @@ function tl(data) {
|
||||||
var templete = parse([json[0]], '', acct_id, tlid);
|
var templete = parse([json[0]], '', acct_id, tlid);
|
||||||
$("#timeline_nano").html(templete);
|
$("#timeline_nano").html(templete);
|
||||||
jQuery("time.timeago").timeago();
|
jQuery("time.timeago").timeago();
|
||||||
|
$("#menu").addClass("hide");
|
||||||
});
|
});
|
||||||
//Streaming接続
|
//Streaming接続
|
||||||
var websocket = [];
|
|
||||||
var tlid = 0;
|
var tlid = 0;
|
||||||
if (type == "home") {
|
if (type == "home") {
|
||||||
var start = "wss://" + domain +
|
var start = "wss://" + domain +
|
||||||
|
@ -45,29 +49,26 @@ function tl(data) {
|
||||||
var start = "wss://" + domain +
|
var start = "wss://" + domain +
|
||||||
"/api/v1/streaming/?stream=hashtag&tag=" + data + "&access_token=" + at;
|
"/api/v1/streaming/?stream=hashtag&tag=" + data + "&access_token=" + at;
|
||||||
}
|
}
|
||||||
var wsid = websocket.length;
|
websocket = new WebSocket(start);
|
||||||
websocket[wsid] = new WebSocket(start);
|
websocket.onopen = function (mess) {
|
||||||
websocket[wsid].onopen = function (mess) {
|
|
||||||
$("#notice_icon_" + tlid).removeClass("red-text");
|
$("#notice_icon_" + tlid).removeClass("red-text");
|
||||||
}
|
}
|
||||||
websocket[wsid].onmessage = function (mess) {
|
websocket.onmessage = function (mess) {
|
||||||
var typeA = JSON.parse(mess.data).event;
|
var typeA = JSON.parse(mess.data).event;
|
||||||
if (typeA == "delete") {
|
if (typeA == "update") {
|
||||||
var obj = JSON.parse(mess.data).payload;
|
|
||||||
$("[toot-id=" + JSON.parse(mess.data).payload + "]").hide();
|
|
||||||
$("[toot-id=" + JSON.parse(mess.data).payload + "]").remove();
|
|
||||||
} else if (typeA == "update") {
|
|
||||||
var obj = JSON.parse(JSON.parse(mess.data).payload);
|
var obj = JSON.parse(JSON.parse(mess.data).payload);
|
||||||
var templete = parse([obj], '', acct_id, tlid);
|
var templete = parse([obj], '', acct_id, tlid);
|
||||||
|
jQuery("time.timeago").timeago();
|
||||||
$("#timeline_nano").html(templete);
|
$("#timeline_nano").html(templete);
|
||||||
}
|
}
|
||||||
websocket[wsid].onclose = function (mess) {
|
|
||||||
console.error("Close Streaming API:" + type);
|
|
||||||
}
|
}
|
||||||
}
|
websocket.onerror = function (error) {
|
||||||
websocket[wsid].onerror = function (error) {
|
|
||||||
console.error('WebSocket Error ' + error);
|
console.error('WebSocket Error ' + error);
|
||||||
};
|
};
|
||||||
|
websocket.onclose = function (mess) {
|
||||||
|
console.error("Close Streaming API:" + type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//TLのタイトル
|
//TLのタイトル
|
||||||
function cap(type, data) {
|
function cap(type, data) {
|
||||||
|
@ -134,3 +135,122 @@ $(function ($) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
function set() {
|
||||||
|
$("#menu").toggleClass("hide");
|
||||||
|
if($("#menu").hasClass("hide")){
|
||||||
|
$("#setting").text("Setting")
|
||||||
|
}else{
|
||||||
|
$("#setting").text("Close")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var multi = localStorage.getItem("multi");
|
||||||
|
if (!multi) {
|
||||||
|
var obj = [
|
||||||
|
{
|
||||||
|
at: localStorage.getItem(localStorage.getItem("domain_" + acct_id) + "_at"),
|
||||||
|
name: localStorage.getItem("name_" + acct_id),
|
||||||
|
domain: localStorage.getItem("domain_" + acct_id),
|
||||||
|
user: localStorage.getItem("user_" + acct_id),
|
||||||
|
prof: localStorage.getItem("prof_" + acct_id)
|
||||||
|
}
|
||||||
|
];
|
||||||
|
var json = JSON.stringify(obj);
|
||||||
|
localStorage.setItem("multi", json);
|
||||||
|
} else {
|
||||||
|
var obj = JSON.parse(multi);
|
||||||
|
}
|
||||||
|
var templete;
|
||||||
|
var last = localStorage.getItem("last-use");
|
||||||
|
var sel;
|
||||||
|
Object.keys(obj).forEach(function(key) {
|
||||||
|
var acct = obj[key];
|
||||||
|
var list = key * 1 + 1;
|
||||||
|
if (key == last) {
|
||||||
|
sel = "selected";
|
||||||
|
} else {
|
||||||
|
sel = "";
|
||||||
|
}
|
||||||
|
templete = '<option value="' + key + '" ' + sel + ">" + acct.user + "@" + acct.domain + "</option>";
|
||||||
|
$("#post-acct-sel").append(templete);
|
||||||
|
});
|
||||||
|
function mov() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function resetmv() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function post() {
|
||||||
|
var acct_id = $("#post-acct-sel").val();
|
||||||
|
var domain = localStorage.getItem("domain_" + acct_id);
|
||||||
|
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||||
|
var start = "https://" + domain + "/api/v1/statuses";
|
||||||
|
var str = $("#textarea").val();
|
||||||
|
var toot = {
|
||||||
|
status: str
|
||||||
|
};
|
||||||
|
var vis = loadVis(acct_id);
|
||||||
|
toot.visibility = vis;
|
||||||
|
var httpreq = new XMLHttpRequest();
|
||||||
|
httpreq.open("POST", start, true);
|
||||||
|
httpreq.setRequestHeader("Content-Type", "application/json");
|
||||||
|
httpreq.setRequestHeader("Authorization", "Bearer " + at);
|
||||||
|
httpreq.responseType = "json";
|
||||||
|
httpreq.send(JSON.stringify(toot));
|
||||||
|
httpreq.onreadystatechange = function() {
|
||||||
|
if (httpreq.readyState === 4) {
|
||||||
|
$("#textarea").val("");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function loadVis(acct_id) {
|
||||||
|
var vist = localStorage.getItem("vis");
|
||||||
|
if (!vist) {
|
||||||
|
return "public";
|
||||||
|
} else {
|
||||||
|
if (vist == "memory") {
|
||||||
|
var memory = localStorage.getItem("vis-memory-" + acct_id);
|
||||||
|
if (!memory) {
|
||||||
|
memory = "public";
|
||||||
|
}
|
||||||
|
return memory;
|
||||||
|
} else if (vist == "server" || vist == "useapi") {
|
||||||
|
var multi = localStorage.getItem("multi");
|
||||||
|
var obj = JSON.parse(multi);
|
||||||
|
var memory = obj[acct_id]["vis"];
|
||||||
|
if (!memory) {
|
||||||
|
memory = "public";
|
||||||
|
}
|
||||||
|
return memory;
|
||||||
|
} else {
|
||||||
|
return vist;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function loader(){
|
||||||
|
var acct_id = $("#post-acct-sel").val()
|
||||||
|
console.log(loadVis(acct_id))
|
||||||
|
$("#vis-sel").val(loadVis(acct_id));
|
||||||
|
}
|
||||||
|
loader()
|
||||||
|
$("textarea").height(15); //init
|
||||||
|
$("textarea").css("lineHeight", "1rem"); //init
|
||||||
|
|
||||||
|
$("textarea").on("input", function(evt) {
|
||||||
|
if (evt.target.scrollHeight > evt.target.offsetHeight) {
|
||||||
|
$(evt.target).height(evt.target.scrollHeight);
|
||||||
|
} else {
|
||||||
|
var lineHeight = Number(
|
||||||
|
$(evt.target)
|
||||||
|
.css("lineHeight")
|
||||||
|
.split("px")[0]
|
||||||
|
);
|
||||||
|
while (true) {
|
||||||
|
$(evt.target).height($(evt.target).height() - lineHeight);
|
||||||
|
if (evt.target.scrollHeight > evt.target.offsetHeight) {
|
||||||
|
$(evt.target).height(evt.target.scrollHeight);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
|
@ -13,34 +13,6 @@ function system(mainWindow, dir, lang, dirname) {
|
||||||
const dialog = electron.dialog;
|
const dialog = electron.dialog;
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
const language = require("../main/language.js");
|
const language = require("../main/language.js");
|
||||||
ipc.on('native-notf', function (e, args) {
|
|
||||||
|
|
||||||
var platform = process.platform;
|
|
||||||
var bit = process.arch;
|
|
||||||
if (platform == "win32") {
|
|
||||||
const notifier = require('node-notifier')
|
|
||||||
var tmp_imge = tmp_img;
|
|
||||||
Jimp.read(args[2], function (err, lenna) {
|
|
||||||
if (!err && lenna) {
|
|
||||||
lenna.write(tmp_img);
|
|
||||||
var tmp_imge = tmp_img;
|
|
||||||
} else {
|
|
||||||
var tmp_imge = "";
|
|
||||||
}
|
|
||||||
notifier.notify({
|
|
||||||
appID: "top.thedesk",
|
|
||||||
message: args[1],
|
|
||||||
title: args[0],
|
|
||||||
icon: tmp_imge,
|
|
||||||
sound: false,
|
|
||||||
wait: true,
|
|
||||||
},
|
|
||||||
function (err, response) {
|
|
||||||
console.log(err, response)
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//プラットフォーム
|
//プラットフォーム
|
||||||
ipc.on('getPlatform', function (e, arg) {
|
ipc.on('getPlatform', function (e, arg) {
|
||||||
try {
|
try {
|
||||||
|
@ -162,14 +134,14 @@ function system(mainWindow, dir, lang, dirname) {
|
||||||
preload: join(dirname, "js", "platform", "preload.js")
|
preload: join(dirname, "js", "platform", "preload.js")
|
||||||
},
|
},
|
||||||
width: 350,
|
width: 350,
|
||||||
height: 200,
|
height: 140,
|
||||||
"transparent": false, // ウィンドウの背景を透過
|
"transparent": false, // ウィンドウの背景を透過
|
||||||
"frame": false, // 枠の無いウィンドウ
|
"frame": false, // 枠の無いウィンドウ
|
||||||
"resizable": false
|
"resizable": false
|
||||||
});
|
});
|
||||||
nanowindow.loadURL(dir + '/nano.html');
|
nanowindow.loadURL(dir + '/nano.html');
|
||||||
nanowindow.setAlwaysOnTop(true);
|
nanowindow.setAlwaysOnTop(true);
|
||||||
|
//nanowindow.toggleDevTools()
|
||||||
nanowindow.setPosition(window_pos[0], window_pos[1]);
|
nanowindow.setPosition(window_pos[0], window_pos[1]);
|
||||||
nanowindow.on('close', function () {
|
nanowindow.on('close', function () {
|
||||||
fs.writeFileSync(nano_info_path, JSON.stringify(nanowindow.getPosition()));
|
fs.writeFileSync(nano_info_path, JSON.stringify(nanowindow.getPosition()));
|
||||||
|
|
181
app/nano.html
181
app/nano.html
|
@ -1,11 +1,11 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
<head>
|
||||||
<head>
|
<meta charset="utf-8" />
|
||||||
<meta charset="utf-8">
|
<link href="./css/themes.css" type="text/css" rel="stylesheet" />
|
||||||
<link href="./css/themes.css" type="text/css" rel="stylesheet">
|
<link href="./css/tl.css" type="text/css" rel="stylesheet" />
|
||||||
<link href="./css/tl.css" type="text/css" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="./node_modules/@fortawesome/fontawesome-free/css/all.min.css" type="text/css" rel="stylesheet">
|
||||||
<title>TheDesk Nano</title>
|
<title>TheDesk Nano</title>
|
||||||
<style>
|
<style>
|
||||||
html {
|
html {
|
||||||
|
@ -15,6 +15,7 @@
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
|
color: var(--color) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
@ -43,6 +44,7 @@
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
-webkit-app-region: no-drag;
|
-webkit-app-region: no-drag;
|
||||||
|
color: var(--color) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar {
|
::-webkit-scrollbar {
|
||||||
|
@ -56,10 +58,6 @@
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.area-actions {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-date_via {
|
.area-date_via {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
@ -75,68 +73,66 @@
|
||||||
background: rgba(0, 0, 0, 0.8);
|
background: rgba(0, 0, 0, 0.8);
|
||||||
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
|
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
|
||||||
}
|
}
|
||||||
|
.hide, .pin, .rep-btn, .tickers{
|
||||||
.blacktheme body {
|
display: none;
|
||||||
color: white;
|
|
||||||
background-color: #212121;
|
|
||||||
}
|
}
|
||||||
|
.fas {
|
||||||
.blacktheme button {
|
font-size: 1rem !important;
|
||||||
background-color: black;
|
|
||||||
color: white;
|
|
||||||
}
|
}
|
||||||
|
.cvo {
|
||||||
.blacktheme textarea,
|
grid-template-rows: auto 1rem 1fr auto 2rem;
|
||||||
.blacktheme select {
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.blacktheme select,
|
|
||||||
.blacktheme option {
|
|
||||||
background-color: black;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript" src="./node_modules/jquery/dist/jquery.js"></script>
|
<script type="text/javascript" src="./node_modules/jquery/dist/jquery.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$.strip_tags = function (str, allowed) {
|
$.strip_tags = function(str, allowed) {
|
||||||
if (!str) {
|
if (!str) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
allowed = (((allowed || '') + '').toLowerCase().match(/<[a-z][a-z0-9]*>/g) || [])
|
allowed = (((allowed || "") + "").toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join("");
|
||||||
.join('');
|
|
||||||
var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>?/gi,
|
var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>?/gi,
|
||||||
commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
|
commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
|
||||||
return str.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) {
|
return str.replace(commentsAndPhpTags, "").replace(tags, function($0, $1) {
|
||||||
return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
|
return allowed.indexOf("<" + $1.toLowerCase() + ">") > -1 ? $0 : "";
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
function escapeHTML(str) {
|
function escapeHTML(str) {
|
||||||
if (!str) {
|
if (!str) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
return str.replace(/&/g, '&')
|
return str
|
||||||
.replace(/</g, '<')
|
.replace(/&/g, "&")
|
||||||
.replace(/>/g, '>')
|
.replace(/</g, "<")
|
||||||
.replace(/"/g, '"')
|
.replace(/>/g, ">")
|
||||||
.replace(/'/g, ''');
|
.replace(/"/g, """)
|
||||||
|
.replace(/'/g, "'");
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="./js/platform/first-not-view.js"></script>
|
<script type="text/javascript" src="./js/platform/first-not-view.js"></script>
|
||||||
<select id="post-acct-sel" style="max-width:150px">
|
<div id="menu" class="hide">
|
||||||
</select>
|
TL and posting account<br>
|
||||||
<select id="type-sel" style="max-width:60px">
|
<select id="post-acct-sel" style="max-width:150px"> </select><br>
|
||||||
|
TL type<br>
|
||||||
|
<select id="type-sel" style="max-width:60px" onchange="loader()">
|
||||||
<option value="local">Local</option>
|
<option value="local">Local</option>
|
||||||
<option value="home">Home</option>
|
<option value="home">Home</option> </select
|
||||||
</select><button onclick="tl()">Show</button><button onclick="window.close()">x</button><br>
|
><button onclick="tl()">Show</button><br>
|
||||||
<div id="timeline_nano">
|
Visibility<br>
|
||||||
|
<select id="vis-sel" style="max-width:60px">
|
||||||
|
<option value="public">Public</option>
|
||||||
|
<option value="unlisted">Unlisted</option>
|
||||||
|
<option value="private">Private</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<button onclick="set()" id="setting">Setting</button>
|
||||||
<textarea id="textarea" style="width:80%; background-color:transparent"></textarea>
|
<textarea id="textarea" style="width:55%; background-color:transparent" placeholder="Post someyhing new"></textarea>
|
||||||
<button class="btn" onclick="post()">Post</button>
|
<button class="btn" onclick="post()">Post</button>
|
||||||
|
<button onclick="window.close()">x</button><br />
|
||||||
|
<div id="timeline_nano">Click "settings" to show TL</div>
|
||||||
|
<br />
|
||||||
<script>
|
<script>
|
||||||
if (localStorage.getItem("lang")) {
|
if (localStorage.getItem("lang")) {
|
||||||
var lang = localStorage.getItem("lang");
|
var lang = localStorage.getItem("lang");
|
||||||
|
@ -145,6 +141,8 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script src="https://twemoji.maxcdn.com/2/twemoji.min.js?2.7"></script>
|
<script src="https://twemoji.maxcdn.com/2/twemoji.min.js?2.7"></script>
|
||||||
|
<script type="text/javascript" src="view/en/main.js"></script>
|
||||||
|
<script type="text/javascript" src="./js/post/status.js"></script>
|
||||||
<script type="text/javascript" src="./js/post/post.js"></script>
|
<script type="text/javascript" src="./js/post/post.js"></script>
|
||||||
<script type="text/javascript" src="./js/post/use-txtbox.js"></script>
|
<script type="text/javascript" src="./js/post/use-txtbox.js"></script>
|
||||||
<script type="text/javascript" src="./js/tl/parse.js"></script>
|
<script type="text/javascript" src="./js/tl/parse.js"></script>
|
||||||
|
@ -153,88 +151,5 @@
|
||||||
<script type="text/javascript" src="./js/common/time.js"></script>
|
<script type="text/javascript" src="./js/common/time.js"></script>
|
||||||
<script type="text/javascript" src="./js/platform/nano.js"></script>
|
<script type="text/javascript" src="./js/platform/nano.js"></script>
|
||||||
<script type="text/javascript" src="./js/platform/end.js"></script>
|
<script type="text/javascript" src="./js/platform/end.js"></script>
|
||||||
<script>
|
</body>
|
||||||
var multi = localStorage.getItem("multi");
|
</html>
|
||||||
if (!multi) {
|
|
||||||
var obj = [{
|
|
||||||
at: localStorage.getItem(localStorage.getItem("domain_" + acct_id) + "_at"),
|
|
||||||
name: localStorage.getItem("name_" + acct_id),
|
|
||||||
domain: localStorage.getItem("domain_" + acct_id),
|
|
||||||
user: localStorage.getItem("user_" + acct_id),
|
|
||||||
prof: localStorage.getItem("prof_" + acct_id)
|
|
||||||
}];
|
|
||||||
var json = JSON.stringify(obj);
|
|
||||||
localStorage.setItem("multi", json);
|
|
||||||
} else {
|
|
||||||
var obj = JSON.parse(multi);
|
|
||||||
}
|
|
||||||
var templete;
|
|
||||||
var last = localStorage.getItem("last-use");
|
|
||||||
var sel;
|
|
||||||
Object.keys(obj).forEach(function (key) {
|
|
||||||
var acct = obj[key];
|
|
||||||
var list = key * 1 + 1;
|
|
||||||
if (key == last) {
|
|
||||||
sel = "selected";
|
|
||||||
} else {
|
|
||||||
sel = "";
|
|
||||||
}
|
|
||||||
templete = '<option value="' + key + '" ' + sel + '>' + acct.user + '@' + acct.domain +
|
|
||||||
'</option>';
|
|
||||||
$("#post-acct-sel").append(templete);
|
|
||||||
});
|
|
||||||
function mov() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
function resetmv() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
function post() {
|
|
||||||
var acct_id = $("#post-acct-sel").val();
|
|
||||||
var domain = localStorage.getItem("domain_" + acct_id);
|
|
||||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
|
||||||
var start = "https://" + domain + "/api/v1/statuses";
|
|
||||||
var str = $("#textarea").val();
|
|
||||||
var toot = {
|
|
||||||
status: str
|
|
||||||
}
|
|
||||||
var vis = loadVis(acct_id)
|
|
||||||
toot.visibility = vis;
|
|
||||||
var httpreq = new XMLHttpRequest();
|
|
||||||
httpreq.open('POST', start, true);
|
|
||||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
|
||||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
|
||||||
httpreq.responseType = "json";
|
|
||||||
httpreq.send(JSON.stringify(toot));
|
|
||||||
httpreq.onreadystatechange = function () {
|
|
||||||
if (httpreq.readyState === 4) {
|
|
||||||
$("#textarea").val("");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function loadVis(acct_id) {
|
|
||||||
var vist = localStorage.getItem("vis");
|
|
||||||
console.log(vist);
|
|
||||||
if (!vist) {
|
|
||||||
return "public";
|
|
||||||
} else {
|
|
||||||
if (vist == "memory") {
|
|
||||||
var memory = localStorage.getItem("vis-memory-" + acct_id);
|
|
||||||
if (!memory) {
|
|
||||||
memory = "public";
|
|
||||||
}
|
|
||||||
return memory;
|
|
||||||
} else if (vist == "server") {
|
|
||||||
var multi = localStorage.getItem("multi");
|
|
||||||
var obj = JSON.parse(multi);
|
|
||||||
var memory = obj[acct_id]["vis"];
|
|
||||||
if (!memory) {
|
|
||||||
memory = "public";
|
|
||||||
}
|
|
||||||
return memory;
|
|
||||||
} else {
|
|
||||||
return vist;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user