AllDataSheet: straight to PDF

With this script you will directly go to the PDF version of the datasheet when you click on the PDF icon in the search results.

目前為 2021-06-10 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        AllDataSheet: straight to PDF
// @name:it     AllDataSheet: dritto al PDF
// @description With this script you will directly go to the PDF version of the datasheet when you click on the PDF icon in the search results.
// @description:it Con questo script andrai direttamente alla versione in PDF della scheda tecnica quando clicchi sull'icona del PDF nei risultati della ricerca.
// @namespace   StephenP
// @match     http://*.alldatasheet.com/*.jsp*
// @match     https://*.alldatasheet.com/*.jsp*
// @match     http://*.alldatasheet.com/datasheet-pdf/*
// @match     https://*.alldatasheet.com/datasheet-pdf/*
// @version     1
// @grant       none
// ==/UserScript==
if(window.location.href.includes("/datasheet-pdf/")){
  document.body.style.display="none"; //Not really necessary, but avoids misunderstanding on what the script is doing.
  var frames=document.getElementsByTagName("IFRAME");
  for(let frame of frames){
    if(frame.src.includes("/datasheet-pdf/")){
      window.location.href=frame.src;
    }
  }
}
else{  
  var images = document.getElementsByTagName("IMG");
  for(let image of images){
    if(image.src.includes("/electronic_parts_datasheet.gif")){
      image.parentNode.href=image.parentNode.href.replace("www.alldatasheet.com","pdf1.alldatasheet.com").replace("/pdf/","/view/");
    }
  }
}