Auto Read for getepic.com

Automatically clicks the right arrow key every minute on getepic.com with a GUI indicator.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey to install this script.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name Auto Read for getepic.com
// @namespace 
// @version 1.0
// @description Automatically clicks the right arrow key every minute on getepic.com with a GUI indicator.
// @match https://www.getepic.com/*
// @grant none
// @license MIT
// ==/UserScript==

let intervalId;
let autoReadEnabled = false;

// Create GUI elements
const guiContainer = document.createElement('div');
guiContainer.style.position = 'fixed';
guiContainer.style.top = '20px';
guiContainer.style.right = '20px';
guiContainer.style.padding = '10px';
guiContainer.style.background = 'rgba(0, 0, 0, 0.7)';
guiContainer.style.color = '#fff';
guiContainer.style.fontFamily = 'Arial, sans-serif';
guiContainer.style.fontSize = '14px';
guiContainer.style.borderRadius = '5px';
guiContainer.style.zIndex = '9999';

const statusText = document.createElement('span');
statusText.textContent = 'Auto Read: OFF';
guiContainer.appendChild(statusText);

document.body.appendChild(guiContainer);

// Function to simulate a key press
function simulateKeyPress(key) {
  const event = new KeyboardEvent('keydown', { key });
  document.dispatchEvent(event);
}

// Function to toggle auto read on and off
function toggleAutoRead() {
  autoReadEnabled = !autoReadEnabled;

  if (autoReadEnabled) {
    console.log('Auto Read: ON');
    intervalId = setInterval(() => {
      simulateKeyPress('ArrowRight');
    }, 60000); // 60000 milliseconds = 1 minute
    statusText.textContent = 'Auto Read: ON';
  } else {
    console.log('Auto Read: OFF');
    clearInterval(intervalId);
    statusText.textContent = 'Auto Read: OFF';
  }
}

// Event listener for the keybind "K"
document.addEventListener('keydown', (event) => {
  if (event.key.toLowerCase() === 'k') {
    toggleAutoRead();
  }
});