AutoSubmitTdk

auto submitter for tdk website

Dette script bør ikke installeres direkte. Det er et bibliotek, som andre scripts kan inkludere med metadirektivet // @require https://update.greasyfork.org/scripts/479447/1277888/AutoSubmitTdk.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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!)

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
    
    

  
    

    
    }
   
  }
});