Adds a modernized, light-themed UI with upload image input to the avatar builder.
< 脚本 Drawaria Avatar Builder ++ 的反馈
Escucha mijo, vas a copiar este codigo de aca y lo vas a pegar 2 veces en tu consola cuando este en el avatar builder>
// ==UserScript==
// @name Avatar Builder+
// @namespace Vholran.AvatarBuilder+
// @version 2.4.Final
// @description Adds a upload image input to the avatar builder.
// @author Vholran (https://gf.qytechs.cn/en/users/841616)
// @match https://*.drawaria.online/avatar/builder/
// @icon https://www.google.com/s2/favicons?domain=drawaria.online
// @grant none
// ==/UserScript==
(function() {
// Function to load jQuery asynchronously
function loadjQuery(callback) {
if (typeof jQuery !== 'undefined') {
callback();
return;
}
const script = document.createElement('script');
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js';
script.onload = callback;
document.head.appendChild(script);
}
// Wait for jQuery to be loaded
loadjQuery(function() {
// Use jQuery in noConflict mode to avoid conflicts with other libraries
var $ = jQuery.noConflict(true);
$(document).ready(function() {
const avatar = () => {
$('header').append('Upload Image');
$('body').on('change', '#imageInput', async (event) => {
const $imageInput = $(event.target);
const $labelButton = $('label.Button');
const file = $imageInput[0].files[0];
if (!file) {
return;
}
const reader = new FileReader();
reader.addEventListener('load', async () => {
const uploadedImage = reader.result.replace(/^data:[^;]+;/, 'data:image/jpeg;');
$labelButton.text('Uploading...').css('pointer-events', 'none');
try {
const response = await $.ajax({
url: window.LOGGEDIN ? '/saveavatar' : '/uploadavatarimage',
type: 'POST',
data: { 'avatarsave_builder': JSON.stringify(window.ACCOUNT_AVATARSAVE), 'imagedata': uploadedImage, 'fromeditor': true },
xhr: () => {
const xhr = new window.XMLHttpRequest();
xhr.upload.addEventListener('progress', evt => {
if (evt.lengthComputable) {
const percentComplete = (evt.loaded / evt.total) * 100;
$labelButton.css('background', `linear-gradient(180deg, #f6f9fc 85%, transparent 15%), linear-gradient(90deg, #3ad73d ${percentComplete.toFixed(0)}%, #808386 0%`);
}
}, false);
return xhr;
}
});
$labelButton.text('Saving...').removeAttr('style').css('pointer-events', 'none');
await fetch(location.origin + `/avatar/cache/${response}.jpg`, { method: 'GET', mode: 'cors', cache: 'reload' });
$labelButton.text('Save OK!');
location.href = new URL(location.href).origin;
} catch (error) {
$labelButton.text('Upload Image').removeAttr('style');
$imageInput.val('');
alert(error.responseText || error.statusText || 'An error occurred');
}
});
reader.readAsDataURL(file);
});
};
const mainObserver = new MutationObserver(() => {
if ($('main').length) {
avatar();
mainObserver.disconnect();
}
});
mainObserver.observe(document, { childList: true, subtree: true });
});
});
})();
No vengas aca a decir que mi script no funciono, que 236 personas ya lo descargaron y me reportaron que funciono :v
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址
No sirve, Pongo para ponerme imagen, Pero no carga.