AutoSubmitTdk

auto submitter for tdk website

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/479447/1277888/AutoSubmitTdk.js

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

let input = document.getElementById("tdk-srch-input");
let autocmp=document.getElementById("autocmp");
autocmp.disabled=true;
autocmp.style.pointerEvents = "none";
autocmp.style.opacity = "0";
// Execute a function when the user presses a key on the keyboard


// Execute a function when the user presses a key on the keyboard
input.addEventListener("keypress", function(event) {
  // If the user presses the "Enter" key on the keyboard
  input.addEventListener("keydown", function(event) {
    // If the user presses the "Ctrl+A" key combination
    if (event.ctrlKey && event.key === "a") {
      event.preventDefault();
      input.value = ""; // Clear the input value
    }
  });
  if (event.key != "Enter") {
    if ( event.key === "Alt" || event.key === "Tab") {
        return; 
        //For shortcuts
      }
    else {
    
    event.preventDefault();
    // Cancel the default action, if needed
    setInterval(function() {
      var divElements = document.querySelectorAll("#maddeler0");
      if(divElements){
        divElements.forEach(function(divElement) {
          var innerFailedDivElement = divElement.querySelector("#bulunmayan-gts");
          var innerSuccesfulDivElement = divElement.querySelector("#bulunan-gts0");
          if (innerFailedDivElement.textContent.trim() === "Bu söz bulunamadı.") {
            divElement.remove();
            console.log("removed")
          }
          if(innerSuccesfulDivElement.textContent.trim() !==input.value){
            divElement.remove();
            console.log("removed succesful one")
          }
        });
      } 
    
    }, 10);
    
    input.value=input.value+event.key;
    console.log("PressedEnter")
    document.getElementById("tdk-search-btn").click();
    // Trigger the button element with a click
    
    

  
    

    
    }
   
  }
});