Ex - coder666 (Beta)

这个版本会实时跟踪 Ex-coder666 的开发状况,但因为不是是正式版可能会有一些些bug

当前为 2023-08-07 提交的版本,查看 最新版本

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Ex - coder666 (Beta)
// @namespace    http://tampermonkey.net/
// @version      3.3.4
// @description  这个版本会实时跟踪 Ex-coder666 的开发状况,但因为不是是正式版可能会有一些些bug
// @author       emmm
// @match        *://www.coder666.com/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {

 //   var r=(Math.floor(Math.random() * 905) + 1000).toString();
    var w = document.querySelector('body > div:nth-child(1)');
 //   function find(){ emm }

    var s = '<br> \xa0 <a id="back" class="small ui red button">回到比赛首页</a>';
    s = s + '\xa0 <a id="first" class="small ui orange button">试试这题  \xa0 ( 随机 )</a>';
    s = s + '\xa0 <a  id="yob" class="small ui yellow button">在洛谷里找找这题</a>';
    w.innerHTML = s;

    document.getElementById("back").addEventListener("click", function(){
        var now = window.location.href;
        var number='',f=0;
        for(var i=10;i<=now.length;i++){
            if(now.substr(i,4)=='&cid'){
                f=1;
            }
            if(now.substr(i,4)=='&pid'){
                f=2;
            }
        }
        if(f==2){
            f=0;
            for(i=1;i<=now.length;i++){
                if(now[i]=='?'){
                    f=1;
                }
                if(now[i]=='&'){
                    f=0;
                }
                if(f==1){
                    number=number+now[i];
                }
            }
            window.open('http://www.coder666.com/contest.php'+ number, '_self');
        }else if(f==1){
            f=0;
            for(i=1;i<=now.length;i++){
                if(now[i-1]=='&'){
                    f=1;
                }
                if(f==1){
                    number=number+now[i];
                }
            }
            window.open('http://www.coder666.com/contest.php'+ '?' + number, '_self');
        }else{
            if(f==0) window.alert('进入比赛并打开比赛题目后该按钮有效');
        }
    });

    document.getElementById("first").addEventListener("click", function(){
        var str = (Math.floor(Math.random() * 905) + 1000).toString();
        window.open('http://www.coder666.com/problem.php?id='+ str, '_self');
    });

    document.getElementById("yob").addEventListener("click", function(){
        var now = window.location.pathname;

        if(now[1]!='p'){
            window.alert('请打开题目页面后点击此按钮');
        }else{
            var b=document.querySelector('#main > div.ui.center.aligned.grid > div:nth-child(1) > h1');
            b=b.innerHTML;

            var e,h=' ';
            for(var i=0;i<b.length;i=i+1){
                if(b[i]==':' || b[i]==':'){
                    e=i;
                    break;
                }
            }
            e=e+2;
            while(e<b.length){
                h=h+b[e];
                e=e+1;
            }

            window.open('https://www.luogu.com.cn/problem/list?keyword='+h);
        }
    });
  //  <input class="prompt" style="width: 100%; " type="text" placeholder="题目编号 …" name="id">

    var next=document.querySelector('#page-header > div > a.header.item > span');
    next.innerText='Coder666';
    // 可将 56-57 行注释化以让网站左上角恢复到 “徐工院”


})();