Skip to content

Instantly share code, notes, and snippets.

View coo11's full-sized avatar

coo11

  • Future Gadget Laboratory
  • China
View GitHub Profile
@coo11
coo11 / config.yaml
Last active March 22, 2023 01:28
Chrome Extension "Redirect URL, Modify Headers & Mock APIs" Settings
- pixiv:
- https:\/\/i(?:-c?f)?\.pximg\.net
- https://www.pixiv.net
- Sina:
- https?:\/\/\w+\.sinaimg\.cn
- https://weibo.com
{
"created_at": "Tue Nov 24 10:43:40 +0000 2020",
"id": 1331186716795781000,
"id_str": "1331186716795781122",
"full_text": ". https://t.co/WNDBnBCjSp",
"truncated": false,
"display_text_range": [0, 1],
"entities": {
"hashtags": [],
"symbols": [],
@coo11
coo11 / CalibreMetadataHelper-GAS.js
Last active August 15, 2022 00:26
Chrome Console Script: Get Pixiv and Twitter info as metadata for Calibre.
(async uid => {
if (!uid) uid = prompt("Input Twitter user name or Pixiv UID:");
const GAS_ID =
"AKfycbxTxbDpJj3RRfP7yIq06v7hP5zUJcBjanurZvsj37iBUtsGgYDkBGW6yl4tYIlIcxbr";
const urlPrefix = `https://script.google.com/macros/s/${GAS_ID}/exec?type=calibremetadata&id=`;
let res = await (await fetch(`${urlPrefix}${uid}`)).text();
let tname, tid, pid;
isPid = /^\d+$/.test(uid);
try {
res = JSON.parse(res);
@coo11
coo11 / QuickPageTurning.js
Last active December 5, 2020 15:59
通过 Chrome 控制台,快速获取桃子圈( http://peachring.com/ )微博快照页码地址。
(async () => {
let n = 1000; //Page turning times
let uid = "3139723905";
let cids = ["4208773252239704"];
let index = {};
/* http://m.peachring.com/weibo/user/3139723905/?next=${cid}
* https://m.weibo.cn/${uid}/${cid}
*/
async function getHTML(id) {
const res = await fetch(
@coo11
coo11 / NoShowingRetweets.js
Created October 1, 2020 09:40
A bookmarklet to prevent Twitter from showing retweets in timeline.
setTimeout(function fn() {
Array.prototype.filter
.call(document.querySelectorAll("div"), (e, i) => {
var t;
try {
t = e.querySelector("div > div > article").querySelector("span[dir]")
.parentNode;
if (t.lastChild.nodeValue == " 转推了") {
t.parentNode.removeChild(t);
t = true;
@coo11
coo11 / DOMCapture.js
Created July 25, 2020 17:36
A bookmarklet can capture DOM with custom background color and scale by [html2canvas](http://html2canvas.hertzen.com).
javascript:!function(){if("about:blank"==location.href)return;let d=document,a=d.createElement("script");a.src="//cdn.jsdelivr.net/npm/html2canvas@1.0.0-rc.5/dist/html2canvas.min.js",d.body.appendChild(a),a.onload=function(){let t=prompt("Enter a DOM Object or just Selector:");if(t){try{t=eval(t)}catch(e){try{t=d.querySelector(t)}catch(t){if(t instanceof SyntaxError)return}}if("string"==typeof t||!(t instanceof HTMLElement))return;window.pageYOffset=0,d.documentElement.scrollTop=0,d.body.scrollTop=0;let f=[null,3],x=prompt("Enter your custom params (backgroundColor,scale):","null,3");x||(f=x.split(",")),html2canvas(t,{dpi:window.devicePixelRatio,backgroundColor:"null"===f[0]?null:f[0],scale:"0"===f[1]?0:f[1],useCORS:!0}).then(t=>{let e=t.toDataURL("image/png",1);window.open("","_blank").document.write(`<html><head></head><body><img src="${e}" style="width: 100%"></body></html>`)})}}}();