1、來源,偉大的github,歡迎去打賞作者
https://github.com/cuifeiran/ppkao/blob/master/UserScript
2、準備部分,為瀏覽器安裝油猴腳本插件
火狐:
https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/
谷歌:
3、使用,打開網(wǎng)址安裝腳本即可
4、代碼部分,把問題網(wǎng)址id添加到網(wǎng)站答案接口,不管他
// ==UserScript==
// @name 考試資料網(wǎng)跳轉(zhuǎn)顯示答案
// @namespace https://github.com/cuifeiran/ppkao/
// @version 0.1.7
// @description 對單個題目進行跳轉(zhuǎn),使得跳轉(zhuǎn)后的頁面顯示題目的答案。期間可能需要驗證,遇到問題可以在GitHub issue我~
// @author Dave
// @match *://www.ppkao.com/tiku/shiti/*
// @match *://www.ppkao.com/kaoti/*
// @include *://www.ppkao.com/tiku/shiti/*
// @include *://www.ppkao.com/shiti/*
// @include *://www.ppkao.com/kaoti/*
// @include *://www.ppkao.com/daan/*
//@contributionURL
// @grant none
// ==/UserScript==
(function() {
'use strict';
//清除限制題目訪問數(shù)量的cookie
var Days = 30;
var exp = new Date();
exp.setTime(exp.getTime() + Days*24*60*60*1000);
document.cookie="PPKAO=PPKAOSTID=&PPKAOCEID=&PPKAOSJID=&UserName=&EDays=; domain=ppkao.com;expires="+exp.toGMTString()+";path=/";
//獲取當(dāng)前頁面URL
var iSite = window.location.href;
var reg = /[1-9][0-9]*/g;
var numList = iSite.match(reg);
var isKaoti =new RegExp("kaoti").test(iSite);
var isTiku =new RegExp("tiku").test(iSite);
var isShiti =new RegExp("shiti").test(iSite);
var isDaan =new RegExp("daan").test(iSite);
var sUrl="";
if (isKaoti===true){sUrl='https://api.ppkao.com/mnkc/kaoti/?id='+ numList;window.location.href =sUrl;}
else{
if(isTiku===true){sUrl='https://api.ppkao.com/mnkc/tiku/?id='+ numList;window.location.href =sUrl;}
else{
if(isShiti===true){sUrl='https://newapi.ppkao.com/mnkc/shiti/?id='+ numList;window.location.href =sUrl;}
else{
if(isDaan===true){
var html = '<div id="showQRcode" style="position: fixed;right:30px;bottom: 0px;"><a style="font-size:14px;color:red;background-color: white;display:block;" >[捐助名單]我在考研二戰(zhàn),愁于房租,致謝捐助者!</a><a style="font-size: 14px;display:block;color:black;background-color: white;" onclick="$(this).parent().remove();" hidden="javascripe:void(0)" >[不想捐助點擊這里]</a><img width="420" height="210" src="https://s1.ax1x.com/2018/12/11/FJ47an.jpg"></img></div>'
var div = document.createElement('div');
div.setAttribute('id', 'showQRcode');
div.innerHTML = html;
document.body.appendChild(div);
}
}
}
}
})();