// ==UserScript==
// @name HotPot.ai Submit button move
// @namespace Wizzergod
// @version 1.0.6
// @description Add variation to scroll submit and downlaod all buttons, move at the page scroll.
// @icon https://www.google.com/s2/favicons?sz=64&domain=hotpot.ai
// @license MIT
// @author Wizzergod
// @match *://hotpot.ai/art-generator*
// @match *://hotpot.ai/remove-background*
// @match *://hotpot.ai/anime-generator*
// @match *://hotpot.ai/logo-generator*
// @match *://hotpot.ai/headshot/train*
// @match *://hotpot.ai/colorize-picture*
// @match *://hotpot.ai/restore-picture*
// @match *://hotpot.ai/enhance-face*
// @match *://hotpot.ai/upscale-photo*
// @match *://hotpot.ai/sparkwriter*
// @match *://hotpot.ai/background-generator*
// @match *://hotpot.ai/lunar-new-year-headshot*
// @match *://hotpot.ai/ai-avatar*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var styles = {
submitBox: {
fixed: {
position: 'fixed',
top: 'unset',
left: '0',
padding: '5px',
right: 'auto',
zIndex: '9999',
backgroundColor: 'transparent',
display: 'flex',
justifyContent: 'flex-start' // Выравнивание по левому краю
},
static: {
position: 'static',
zIndex: 'auto',
backgroundColor: 'transparent',
display: 'block'
}
},
downloadAllBox: {
fixed: {
position: 'fixed',
top: 'unset',
left: 'auto',
padding: '5px',
width: 'unset',
height: '60px',
right: '0',
zIndex: '9999',
backgroundColor: 'transparent',
display: 'flex',
justifyContent: 'flex-end' // Выравнивание по правому краю
},
static: {
position: 'static',
zIndex: 'auto',
backgroundColor: 'transparent',
display: 'block'
}
},
downloadButton: {
width: 'auto',
}
};
function moveElementAboveHeaderBox(element, headerBox) {
if (element.length > 0 && headerBox.length > 0) {
headerBox.before(element);
}
}
function fixElementOnScroll(element, fixAt, styles) {
if (element.length > 0) {
$(window).on('scroll', function() {
var scrollTop = $(window).scrollTop();
if (scrollTop > fixAt) {
element.css(styles.fixed);
$('.button.download').css({
width: '60px',
fontSize: '10px',
height: '200px'
});
$('#submitButton').css({
width: '60px',
fontSize: '16px',
height: '200px'
});
} else {
element.css(styles.static);
$('.button.download').css({
width: '520px',
fontSize: '20px',
height: '60px'
});
$('#submitButton').css({
width: '520px',
fontSize: '20px',
height: '60px'
});
}
});
}
}
var submitBox = $('.submitBox');
var downloadAllBox = $('#downloadAllBox');
var headerBox = $('.headerBox');
$(document).ready(function() {
moveElementAboveHeaderBox(submitBox, headerBox);
fixElementOnScroll(submitBox, 100, styles.submitBox);
moveElementAboveHeaderBox(downloadAllBox, headerBox);
fixElementOnScroll(downloadAllBox, 200, styles.downloadAllBox);
$('#downloadAllBox .button.download').css(styles.downloadButton);
$('#submitButton').on('click', function(event) {
event.preventDefault();
event.stopPropagation();
});
});
})();