User:Polygnotus/Scripts/GetAPIBatch.js: Difference between revisions

Content deleted Content added
Created page with '(function() { 'use strict'; // Add styles GM_addStyle(` #word-fetcher-container { position: fixed; top: 10px; right: 10px; background-color: white; padding: 10px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); z-index: 9999; } #word-display { font-size: 1.2rem; margin-bottom: 0.5rem;...'
 
No edit summary
Line 2:
'use strict';
 
function addStyles() {
// Add styles
const style = document.createElement('style');
GM_addStyle(`
#word-fetcher-containerstyle.textContent {= `
position:#word-fetcher-container fixed;{
top position: 10pxfixed;
right top: 10px;
background-color right: white10px;
padding background-color: 10pxwhite;
border-radius padding: 8px10px;
box-shadow: 0 4px 6px rgba(0, 0, 0,border-radius: 0.1)8px;
z box-indexshadow: 99990 4px 6px rgba(0, 0, 0, 0.1);
} z-index: 9999;
#word-display { }
font#word-size:display 1.2rem;{
margin font-bottomsize: 01.5rem2rem;
min margin-heightbottom: 10.5rem;
} min-height: 1.5rem;
#next-button { }
font#next-size:button 0.9rem;{
padding: 0.3rem font-size: 0.7rem9rem;
cursor padding: pointer0.3rem 0.7rem;
} cursor: pointer;
#debug-info { }
margin#debug-top:info 0.5rem;{
font margin-sizetop: 0.7rem5rem;
color font-size: #6660.7rem;
} color: #666;
`); }
`;
document.head.appendChild(style);
}
 
function createUI() {
// Create and append UI elements
const container = document.createElement('div');
container.id = 'word-fetcher-container';
container.innerHTML = `
<div id="word-display">Click 'Next Word' to start</div>
<button id="next-button">Next Word</button>
<div id="debug-info"></div>
`;
document.body.appendChild(container);
}
 
class TypoFetcherWordFetcher {
constructor() {
this.words = [];
Line 95 ⟶ 99:
}
 
newfunction TypoFetcherinit(); {
addStyles();
createUI();
new WordFetcher();
}
 
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
})();