osk
osk
The Moon, 21 years old
Joined
Last seen
Topics
14
Posts
388
Comments
8
Changes
1
#11312
https://kagari.online/hiroyo_chizuko.png
https://kagari.moe/outer_assets/flashii/signature.png https://kagari.moe/outer_assets/flashii/signature-sites.pnghttps://kagari.moe/outer_assets/flashii/signature-kagarimoe.pnghttps://kagari.moe/outer_assets/flashii/signature-tetrio.png?v=2https://kagari.moe/outer_assets/flashii/signature-osksh.pnghttps://kagari.moe/outer_assets/flashii/signature-social.pnghttps://kagari.moe/outer_assets/flashii/signature-twitter.pnghttps://kagari.moe/outer_assets/flashii/signature-lastfm.pnghttps://kagari.moe/outer_assets/flashii/signature-github.pnghttps://kagari.moe/outer_assets/flashii/signature-blog.pnghttps://kagari.moe/outer_assets/flashii/signature-projects.pnghttps://kagari.moe/outer_assets/flashii/signature-wsmasher.pnghttps://kagari.moe/outer_assets/flashii/signature-yukari.pnghttps://kagari.moe/outer_assets/flashii/signature-kurumi.pnghttps://kagari.moe/outer_assets/flashii/signature-teto.pnghttps://kagari.moe/outer_assets/flashii/signature-rdg.pnghttps://kagari.moe/outer_assets/flashii/signature-attoch.png
#11354
if lazy it could also literally just insert the img tag i guess https://kagari.online/linkagari-feisty.png
https://kagari.moe/outer_assets/flashii/signature.png https://kagari.moe/outer_assets/flashii/signature-sites.pnghttps://kagari.moe/outer_assets/flashii/signature-kagarimoe.pnghttps://kagari.moe/outer_assets/flashii/signature-tetrio.png?v=2https://kagari.moe/outer_assets/flashii/signature-osksh.pnghttps://kagari.moe/outer_assets/flashii/signature-social.pnghttps://kagari.moe/outer_assets/flashii/signature-twitter.pnghttps://kagari.moe/outer_assets/flashii/signature-lastfm.pnghttps://kagari.moe/outer_assets/flashii/signature-github.pnghttps://kagari.moe/outer_assets/flashii/signature-blog.pnghttps://kagari.moe/outer_assets/flashii/signature-projects.pnghttps://kagari.moe/outer_assets/flashii/signature-wsmasher.pnghttps://kagari.moe/outer_assets/flashii/signature-yukari.pnghttps://kagari.moe/outer_assets/flashii/signature-kurumi.pnghttps://kagari.moe/outer_assets/flashii/signature-teto.pnghttps://kagari.moe/outer_assets/flashii/signature-rdg.pnghttps://kagari.moe/outer_assets/flashii/signature-attoch.png
#11380
yknow if you hated my venting or kagariposting you shouldve just said so
#11398
i modded szy's script a bit to work with non-eeprom files too, using flash's mii thing which i never heard of until now but it's cute
it also shows the resolution and length if applicable, and for eeprom files, you can hover over the tag to see its original filename

// ==UserScript==
// @name Sockchat Embed File Sizes
// @description adds things to embeds
// @author szy, osk
// @match https://sockchat.flashii.net/
// @grant none
// ==/UserScript==

(function() {
'use strict';
function xhr(url) {
return new Promise((resolve, reject) => {
const request = new XMLHttpRequest();
request.open('GET', url, true);
request.onload = () => {
if (request.readyState === 4) {
const json = JSON.parse(request.responseText);
if (json) {
resolve(json);
} else {
reject(json);
}
}
};
request.onerror = () => {
console.error(`Request ${url} returned onerror`);
reject();
};
request.send();
});
}
function sizeOf(bytes) { // https://stackoverflow.com/a/28120564
if (bytes === 0) { return '0B'; }
const e = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes/Math.pow(1024, e)).toFixed(e === 0 ? 0 : 2)+'\u200b'+'\u200bKMGTP'.charAt(e)+'B';
}
function ParseMS(oms) {
const roms = Math.round(oms);

const ms = roms % 1000;
const s = Math.floor(roms / 1000) % 60;
const m = Math.floor(roms / 60000);

return {
ms: ms.toString().padStart(3, '0'),
s: s.toString().padStart(2, '0'),
m: m.toString()
};
}


window.addEventListener('umi:ui:message_add', function(ev) {
const embedButtons = ev.detail.element.querySelectorAll('a[onclick^="Umi.Parser.SockChatBBcode.Embed"]');

for (const embedButton of embedButtons) {
const embed = embedButton.parentElement;
let link = embed.getAttribute('title');
if (link.startsWith('//')) { link = `https:${ link }`; } // Mii 500s on //domain.name URIs

try {
const el = document.createElement('span');
el.classList.add('eeprom_extended_data');
el.style.color = '#AFF';
el.textContent = ' [...]';
embed.appendChild(el);

xhr(`https://mii.flashii.net/metadata?url=${ encodeURIComponent(link) }`).then((resp) => {
if (resp.errorMessage) {
throw resp.errorMessage;
}

if (!resp.media) {
if (resp.content_type) {
throw `Not a media file; detected as ${ resp.content_type.string }`;
}
throw 'Not a media file; content type unknown';
}

let size = resp.media.size || 0;

if (resp.eeprom_file_info) {
size = resp.eeprom_file_info.size;
el.title = resp.eeprom_file_info.name;
}

el.style.color = '#A0F5B8';
if (size >= 128*1024) { el.style.color = '#BAE9C7'; }
if (size >= 512*1024) { el.style.color = '#CDD'; }
if (size >= 1024*1024) { el.style.color = '#CCA1F4'; }
if (size >= 4*1024*1024) { el.style.color = '#DB5FF1'; }
if (size >= 10*1024*1024) { el.style.color = '#EC32A4'; }

let elText = sizeOf(size);

if (resp.is_image && resp.width && resp.height) {
elText += `・${ resp.width }x${ resp.height }`;
}
if (resp.is_video && resp.width && resp.height && resp.media.duration) {
const p = ParseMS(resp.media.duration * 1000);
elText += `・${ resp.width }x${ resp.height }・${ p.m }:${ p.s }<span style="font-size: 70%">.${ p.ms }</span>`;
}
if (resp.is_audio && resp.media.duration) {
const p = ParseMS(resp.media.duration * 1000);
elText += `・${ p.m }:${ p.s }<span style="font-size: 70%">.${ p.ms }</span>`;
}

el.innerHTML = ` [${ elText }]`;
}).catch((err) => {
console.error(err);
el.textContent = '[ERR]';
el.style.color = '#FAA';
el.title = err || 'Network error while requesting metadata';
})
} catch (ex) {
console.error(ex)
}
}
});
})();
https://kagari.moe/outer_assets/flashii/signature.png https://kagari.moe/outer_assets/flashii/signature-sites.pnghttps://kagari.moe/outer_assets/flashii/signature-kagarimoe.pnghttps://kagari.moe/outer_assets/flashii/signature-tetrio.png?v=2https://kagari.moe/outer_assets/flashii/signature-osksh.pnghttps://kagari.moe/outer_assets/flashii/signature-social.pnghttps://kagari.moe/outer_assets/flashii/signature-twitter.pnghttps://kagari.moe/outer_assets/flashii/signature-lastfm.pnghttps://kagari.moe/outer_assets/flashii/signature-github.pnghttps://kagari.moe/outer_assets/flashii/signature-blog.pnghttps://kagari.moe/outer_assets/flashii/signature-projects.pnghttps://kagari.moe/outer_assets/flashii/signature-wsmasher.pnghttps://kagari.moe/outer_assets/flashii/signature-yukari.pnghttps://kagari.moe/outer_assets/flashii/signature-kurumi.pnghttps://kagari.moe/outer_assets/flashii/signature-teto.pnghttps://kagari.moe/outer_assets/flashii/signature-rdg.pnghttps://kagari.moe/outer_assets/flashii/signature-attoch.png
#11430
https://kagari.online/fujimaki_mayo.png
https://kagari.moe/outer_assets/flashii/signature.png https://kagari.moe/outer_assets/flashii/signature-sites.pnghttps://kagari.moe/outer_assets/flashii/signature-kagarimoe.pnghttps://kagari.moe/outer_assets/flashii/signature-tetrio.png?v=2https://kagari.moe/outer_assets/flashii/signature-osksh.pnghttps://kagari.moe/outer_assets/flashii/signature-social.pnghttps://kagari.moe/outer_assets/flashii/signature-twitter.pnghttps://kagari.moe/outer_assets/flashii/signature-lastfm.pnghttps://kagari.moe/outer_assets/flashii/signature-github.pnghttps://kagari.moe/outer_assets/flashii/signature-blog.pnghttps://kagari.moe/outer_assets/flashii/signature-projects.pnghttps://kagari.moe/outer_assets/flashii/signature-wsmasher.pnghttps://kagari.moe/outer_assets/flashii/signature-yukari.pnghttps://kagari.moe/outer_assets/flashii/signature-kurumi.pnghttps://kagari.moe/outer_assets/flashii/signature-teto.pnghttps://kagari.moe/outer_assets/flashii/signature-rdg.pnghttps://kagari.moe/outer_assets/flashii/signature-attoch.png
#11509
happy birdthday mon!!!!!!!!!!!!!!!!!

https://kagari.moe/outer_assets/flashii/signature.png https://kagari.moe/outer_assets/flashii/signature-sites.pnghttps://kagari.moe/outer_assets/flashii/signature-kagarimoe.pnghttps://kagari.moe/outer_assets/flashii/signature-tetrio.png?v=2https://kagari.moe/outer_assets/flashii/signature-osksh.pnghttps://kagari.moe/outer_assets/flashii/signature-social.pnghttps://kagari.moe/outer_assets/flashii/signature-twitter.pnghttps://kagari.moe/outer_assets/flashii/signature-lastfm.pnghttps://kagari.moe/outer_assets/flashii/signature-github.pnghttps://kagari.moe/outer_assets/flashii/signature-blog.pnghttps://kagari.moe/outer_assets/flashii/signature-projects.pnghttps://kagari.moe/outer_assets/flashii/signature-wsmasher.pnghttps://kagari.moe/outer_assets/flashii/signature-yukari.pnghttps://kagari.moe/outer_assets/flashii/signature-kurumi.pnghttps://kagari.moe/outer_assets/flashii/signature-teto.pnghttps://kagari.moe/outer_assets/flashii/signature-rdg.pnghttps://kagari.moe/outer_assets/flashii/signature-attoch.png
#11512
https://kagari.moe/outer_assets/flashii/signature.png https://kagari.moe/outer_assets/flashii/signature-sites.pnghttps://kagari.moe/outer_assets/flashii/signature-kagarimoe.pnghttps://kagari.moe/outer_assets/flashii/signature-tetrio.png?v=2https://kagari.moe/outer_assets/flashii/signature-osksh.pnghttps://kagari.moe/outer_assets/flashii/signature-social.pnghttps://kagari.moe/outer_assets/flashii/signature-twitter.pnghttps://kagari.moe/outer_assets/flashii/signature-lastfm.pnghttps://kagari.moe/outer_assets/flashii/signature-github.pnghttps://kagari.moe/outer_assets/flashii/signature-blog.pnghttps://kagari.moe/outer_assets/flashii/signature-projects.pnghttps://kagari.moe/outer_assets/flashii/signature-wsmasher.pnghttps://kagari.moe/outer_assets/flashii/signature-yukari.pnghttps://kagari.moe/outer_assets/flashii/signature-kurumi.pnghttps://kagari.moe/outer_assets/flashii/signature-teto.pnghttps://kagari.moe/outer_assets/flashii/signature-rdg.pnghttps://kagari.moe/outer_assets/flashii/signature-attoch.png
#11557
https://kagari.online/1630173796128.jpg
https://kagari.moe/outer_assets/flashii/signature.png https://kagari.moe/outer_assets/flashii/signature-sites.pnghttps://kagari.moe/outer_assets/flashii/signature-kagarimoe.pnghttps://kagari.moe/outer_assets/flashii/signature-tetrio.png?v=2https://kagari.moe/outer_assets/flashii/signature-osksh.pnghttps://kagari.moe/outer_assets/flashii/signature-social.pnghttps://kagari.moe/outer_assets/flashii/signature-twitter.pnghttps://kagari.moe/outer_assets/flashii/signature-lastfm.pnghttps://kagari.moe/outer_assets/flashii/signature-github.pnghttps://kagari.moe/outer_assets/flashii/signature-blog.pnghttps://kagari.moe/outer_assets/flashii/signature-projects.pnghttps://kagari.moe/outer_assets/flashii/signature-wsmasher.pnghttps://kagari.moe/outer_assets/flashii/signature-yukari.pnghttps://kagari.moe/outer_assets/flashii/signature-kurumi.pnghttps://kagari.moe/outer_assets/flashii/signature-teto.pnghttps://kagari.moe/outer_assets/flashii/signature-rdg.pnghttps://kagari.moe/outer_assets/flashii/signature-attoch.png