various fixes
This commit is contained in:
parent
302341bb99
commit
fa1db8cf5d
6 changed files with 65 additions and 6 deletions
|
@ -77,6 +77,9 @@ class Guild {
|
||||||
if (json === -1) {
|
if (json === -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (json.stickers.length) {
|
||||||
|
console.log(json.stickers, ":3");
|
||||||
|
}
|
||||||
this.emojis = json.emojis;
|
this.emojis = json.emojis;
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.headers = this.owner.headers;
|
this.headers = this.owner.headers;
|
||||||
|
|
|
@ -164,7 +164,7 @@ class InfiniteScroller {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const out = await Promise.allSettled([this.watchForTop(), this.watchForBottom()]);
|
const out = await Promise.allSettled([this.watchForTop(), this.watchForBottom()]);
|
||||||
const changed = (out[0] || out[1]);
|
const changed = (out[0].value || out[1].value);
|
||||||
if (null === this.timeout && changed) {
|
if (null === this.timeout && changed) {
|
||||||
this.timeout = setTimeout(this.updatestuff.bind(this), 300);
|
this.timeout = setTimeout(this.updatestuff.bind(this), 300);
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ class InfiniteScroller {
|
||||||
await this.destroyFromID(thing[1]);
|
await this.destroyFromID(thing[1]);
|
||||||
}
|
}
|
||||||
this.HTMLElements = [];
|
this.HTMLElements = [];
|
||||||
clearInterval(this.timeout);
|
clearTimeout(this.timeout);
|
||||||
if (this.div) {
|
if (this.div) {
|
||||||
this.div.remove();
|
this.div.remove();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,34 @@ function getBulkUsers() {
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
function trimswitcher() {
|
||||||
|
const json = getBulkInfo();
|
||||||
|
const map = new Map();
|
||||||
|
for (const thing in json.users) {
|
||||||
|
const user = json.users[thing];
|
||||||
|
console.log(user, json.users);
|
||||||
|
let wellknown = user.serverurls.wellknown;
|
||||||
|
if (wellknown[wellknown.length - 1] !== "/") {
|
||||||
|
wellknown += "/";
|
||||||
|
}
|
||||||
|
if (map.has(wellknown)) {
|
||||||
|
const otheruser = map.get(wellknown);
|
||||||
|
if (otheruser[1].serverurls.wellknown[otheruser[1].serverurls.wellknown.length - 1] === "/") {
|
||||||
|
delete json.users[otheruser[0]];
|
||||||
|
map.set(wellknown, [thing, user]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
delete json.users[thing];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
map.set(wellknown, [thing, user]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
localStorage.setItem("userinfos", JSON.stringify(json));
|
||||||
|
console.log(json);
|
||||||
|
}
|
||||||
|
trimswitcher();
|
||||||
function getBulkInfo() {
|
function getBulkInfo() {
|
||||||
return JSON.parse(localStorage.getItem("userinfos"));
|
return JSON.parse(localStorage.getItem("userinfos"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,9 @@ class Guild{
|
||||||
if(json===-1){
|
if(json===-1){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(json.stickers.length){
|
||||||
|
console.log(json.stickers,":3")
|
||||||
|
}
|
||||||
this.emojis = json.emojis
|
this.emojis = json.emojis
|
||||||
this.owner=owner;
|
this.owner=owner;
|
||||||
this.headers=this.owner.headers;
|
this.headers=this.owner.headers;
|
||||||
|
|
|
@ -163,8 +163,8 @@ class InfiniteScroller{
|
||||||
this.currrunning=true;
|
this.currrunning=true;
|
||||||
}
|
}
|
||||||
if(!this.div){this.currrunning=false;return}
|
if(!this.div){this.currrunning=false;return}
|
||||||
const out=await Promise.allSettled([this.watchForTop(),this.watchForBottom()])
|
const out=await Promise.allSettled([this.watchForTop(),this.watchForBottom()]) as {value:boolean}[];
|
||||||
const changed=(out[0]||out[1]);
|
const changed=(out[0].value||out[1].value);
|
||||||
if(null===this.timeout&&changed){
|
if(null===this.timeout&&changed){
|
||||||
this.timeout=setTimeout(this.updatestuff.bind(this),300);
|
this.timeout=setTimeout(this.updatestuff.bind(this),300);
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ class InfiniteScroller{
|
||||||
await this.destroyFromID(thing[1]);
|
await this.destroyFromID(thing[1]);
|
||||||
}
|
}
|
||||||
this.HTMLElements=[];
|
this.HTMLElements=[];
|
||||||
clearInterval(this.timeout);
|
clearTimeout(this.timeout);
|
||||||
if(this.div){
|
if(this.div){
|
||||||
this.div.remove();
|
this.div.remove();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,32 @@ function getBulkUsers(){
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
function trimswitcher(){
|
||||||
|
const json=getBulkInfo()
|
||||||
|
const map=new Map();
|
||||||
|
for(const thing in json.users){
|
||||||
|
const user=json.users[thing];
|
||||||
|
console.log(user,json.users);
|
||||||
|
let wellknown=user.serverurls.wellknown;
|
||||||
|
if(wellknown[wellknown.length-1]!=="/"){
|
||||||
|
wellknown+="/";
|
||||||
|
}
|
||||||
|
if(map.has(wellknown)){
|
||||||
|
const otheruser=map.get(wellknown);
|
||||||
|
if(otheruser[1].serverurls.wellknown[otheruser[1].serverurls.wellknown.length-1]==="/"){
|
||||||
|
delete json.users[otheruser[0]];
|
||||||
|
map.set(wellknown,[thing,user]);
|
||||||
|
}else{
|
||||||
|
delete json.users[thing];
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
map.set(wellknown,[thing,user]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
localStorage.setItem("userinfos",JSON.stringify(json));
|
||||||
|
console.log(json);
|
||||||
|
}
|
||||||
|
trimswitcher();
|
||||||
function getBulkInfo(){
|
function getBulkInfo(){
|
||||||
return JSON.parse(localStorage.getItem("userinfos"));
|
return JSON.parse(localStorage.getItem("userinfos"));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue