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 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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/");
    }
  }
}