调整打印文件

2022/8/3 08:33:33

目前为 2022-08-05 提交的版本。查看 最新版本

// ==UserScript==
// @name        调整打印文件
// @namespace   print adjust
// @match       https://ctbpsp.com/#/bulletinDetail?uuid=*
// @match       https://bulletin.cebpubservice.com/qualifyBulletin/*
// @match       https://bulletin.cebpubservice.com/biddingBulletin/*
// @match       https://bulletin.cebpubservice.com/candidateBulletin/*
// @match       https://bulletin.cebpubservice.com/resultBulletin/*
// @run-at      document-end
// @grant       unsafeWindow
// @version     1.2.1
// @author      我爱小熊啊
// @description 2022/8/3 08:33:33
// @description 中国招标投标公共服务平台公告文件打印调整
// @description 增加对 cebpubservice.com的支持
// @description 自动隐藏 cebpubservice.com 上的二维码广告
// @license     MIT
// ==/UserScript==

// window.onload = function () {
//     // 加载时获取
//     var a = document.getElementsByTagName('select')[0];
//     console.info(a);
// }

// 设置延时定时器,避免网页未加载完,弹出页码输入框
setTimeout(function(){
  var weburl = window.location.href;
  var n = 1;
  // ctbpsp.com 网页打印
  if(weburl.indexOf('ctbpsp.com')!=-1){
    // var windowAttribute = $('iframe');  ??? 引入 jQuery 库也不生效
    var windowAttribute = document.getElementsByTagName('iframe')[0];
    n = prompt('请输入文件页码','');
   if(n){    // 如果输入框点击取消,则 prompt 返回的是 null,则取消更改,否则网页会出错
     windowAttribute.width = 900;
     windowAttribute.height = 1150 * n;
     // alert("Hello");
   }
  }
  
  // cebpubservice.com 网页打印
  if(weburl.indexOf('cebpubservice.com')!=-1){
    var p = document.getElementsByClassName('pdf_wraper')[0];
    var b = document.getElementsByClassName('PublicAddress')[0];
    b.style.display = 'none';
    // var n = prompt('请输入文件页码','');
    n = prompt('请输入文件页码','');
    if(n){
      p.style.width = '900px';
      var h = n * 1150;
      var gaodu = h + 'px';
      p.style.height = gaodu;
    }
    
  }
}, 5800);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址