您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
try to take over the world!
当前为
- // ==UserScript==
- // @name en OpenReview Helper
- // @name zh OpenReview Helper
- // @namespace http://tampermonkey.net/
- // @version 0.1.1
- // @description try to take over the world!
- // @author Han Yang
- // @match https://openreview.net/group?id=*
- // @grant none
- // ==/UserScript==
- (function () {
- 'use strict';
- function httpGetAsync(paper, callback) {
- // console.log('paper', paper);
- let url = 'forum?id=' + paper.getAttribute('data-id');
- console.log(url);
- let xmlHttp = new XMLHttpRequest();
- let parser = new DOMParser();
- xmlHttp.onreadystatechange = function () {
- if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
- let doc = parser.parseFromString(xmlHttp.responseText, "text/html")
- callback(doc.getElementById('reply_count').innerText);
- }
- }
- xmlHttp.open("GET", url, true); // true for asynchronous
- xmlHttp.send(null);
- };
- function httpGet(paper, callback) {
- // console.log('paper', paper);
- let url = 'forum?id=' + paper.getAttribute('data-id');
- console.log(url);
- let xmlHttp = new XMLHttpRequest();
- let parser = new DOMParser();
- xmlHttp.open("GET", url, false); // false for synchronous request
- xmlHttp.send(null);
- // let doc = parser.parseFromString(xmlHttp.responseText, "text/html")
- let doc = xmlHttp.response;
- console.log(xmlHttp.response);
- callback(doc.getElementById('reply_count').innerText);
- };
- function tt(paper) {
- console.log(paper);
- let id = paper.getAttribute('data-id');
- let url = `notes?forum=${id}&details=replyCount`;
- console.log(url);
- fetch(url).then(async (response) => {
- let reply_count = (await response.json()).count - 1;
- console.log(id, reply_count, paper);
- // paper.appendChild(document.createElement('br', reply_count));
- document.querySelector(`li[data-id='${id}']`).append(`reply count: ${reply_count}`);
- });
- // console.log(r);
- }
- function dd() {
- // let papers = Array.prototype.slice.call(window.document.querySelectorAll('li.note')).slice(0, 50);
- let papers = document.querySelector('#all-submissions').querySelectorAll('li.note');
- console.log(papers);
- for (let i = 0; i < papers.length; ++i) {
- console.log(i);
- // console.log(paper.childElementCount);
- // let id = paper.getAttribute('data-id');
- // console.log('pre paper', papers[paper]);
- tt(papers[i]);
- }
- };
- function fire() {
- setTimeout(dd, 1000);
- }
- // let $ = window.jQuery;
- // Your code here...
- // alert('hello');
- // setTimeout(dd, 5000);
- let notes = document.getElementById('notes');
- notes.onchange = fire;
- })();