CVPR paper homepage tranverse

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);
}