WIP done some ToDO

This commit is contained in:
Cutls
2019-04-11 02:59:13 +09:00
parent 0ad7bf9036
commit 1c16a5f4a0
16 changed files with 168 additions and 64 deletions

View File

@@ -154,11 +154,6 @@ function emojiList(target,reaction) {
}
$("#emoji-next").removeClass("disabled");
$("#emoji-count").text(ct);
if(localStorage.getItem("emoji-zero-width")){
var brank="";
}else{
var brank=" ";
}
for (i = start; i < start + 126; i++) {
var emoji = obj[i];
if (emoji) {
@@ -167,7 +162,7 @@ function emojiList(target,reaction) {
':\')" class="pointer"><img src="' + emoji.url + '" width="20"></a>';
}else{
html = html + '<a onclick="emojiInsert(\':' + emoji.shortcode +
':'+brank+'\')" class="pointer"><img src="' + emoji.url + '" width="20"></a>';
':\')" class="pointer"><img src="' + emoji.url + '" width="20"></a>';
}
}
@@ -179,14 +174,19 @@ function emojiList(target,reaction) {
function emojiInsert(code, del) {
var now = $("#textarea").val();
var selin = localStorage.getItem("cursor");
if(localStorage.getItem("emoji-zero-width")=="yes"){
var brank="";
}else{
var brank=" ";
}
console.log(selin);
var now = $("#textarea").val();
if(selin>0){
var before = now.substr(0, selin);
var after = now.substr(selin, now.length);
newt = before + " "+ code+" " + after;
newt = before + brank+ code+brank + after;
}else{
newt = code+" ";
newt = code+brank;
}
if (!del) {
$("#textarea").val(newt);
@@ -194,7 +194,7 @@ function emojiInsert(code, del) {
} else {
var regExp = new RegExp(del, "g");
var now = now.replace(regExp, "");
$("#textarea").val(now + " " + code);
$("#textarea").val(now + brank + code);
}
$("#textarea").focus();

View File

@@ -65,7 +65,7 @@ function reactiontoggle(id,acct_id,tlid){
var json = httpreq.response;
console.log(json);
if(json.reactionCounts){
var reactions=["like","love","laugh","hmm","surprise","congrats","angry","confused","pudding"];
var reactions=["like","love","laugh","hmm","surprise","congrats","angry","confused","pudding","star"];
for(var i=0;i<reactions.length;i++){
if(json.reactionCounts[reactions[i]]){
$("#pub_" + id +" .re-"+reactions[i]+"ct").text(json.reactionCounts[reactions[i]])
@@ -133,8 +133,12 @@ function reactRefresh(acct_id,id){
return false;
}
var poll="";
console.log(json);
reactRefreshCore(json)
if(json.error){
$("[toot-id=" + id + "]").hide();
$("[toot-id=" + id + "]").remove();
}else{
reactRefreshCore(json)
}
});
}
function reactRefreshCore(json){

View File

@@ -236,6 +236,8 @@ function del(id, acct_id) {
httpreq.setRequestHeader('Content-Type', 'application/json');
httpreq.responseType = "json";
httpreq.send(JSON.stringify({i:at,noteId:id}));
$("[toot-id=" + id+ "]").hide();
$("[toot-id=" + id + "]").remove();
}else{
var start = "https://" + domain + "/api/v1/statuses/" + id;
var httpreq = new XMLHttpRequest();