CVPR paper homepage tranverse

在cvpr的pdf和abstract反复横跳 Generate a button to trans between cvpr homepage and pdf

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        CVPR paper homepage tranverse
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  在cvpr的pdf和abstract反复横跳 Generate a button to trans between cvpr homepage and pdf
// @author       gusongen
// @match        https://openaccess.thecvf.com/content/*/html/*
// @match       https://openaccess.thecvf.com/content/*/papers/*
// @grant        none
// @license MIT
// ==/UserScript==
(function(){
    // download by clicking on the button
    var btn = document.createElement("button");
    btn.setAttribute('style', "position:absolute;z-index:1000; right: 50px; top: 50px; height: 28px; background-color: #424649; border: none; color: white; font-size: 16px; cursor: pointer;");
    btn.setAttribute('id', "btn");
    document.body.appendChild(btn);
    btn.onmouseover = function() {
        this.style.backgroundColor="#424649"
    };
    btn.onmouseout = function() {
        this.style.backgroundColor="#323639"
    };
    var url = window.location.href
    if(url.slice(-3) == "pdf"){
        btn.innerText = "cvpr";
        btn.onclick=cvpr;

    }else{
        btn.innerText = "pdf";
        btn.onclick=pdf;
    }
//    btn.innerText = url.slice(-3)
}
)()


function cvpr(){
    var home_url = window.location.href.slice(0, -4).replace('papers', 'html');
    window.open(home_url);
}

function pdf(){
    var home_url = window.location.href.replace('.html', '').replace('html', 'papers') + ".pdf";
    window.open(home_url);
}