Ex - coder666

你可以通过这个插件让 coder666 的顶部有一个随机跳题按钮和一个“在洛谷里找找这题”按钮

ของเมื่อวันที่ 26-07-2023 ดู เวอร์ชันล่าสุด

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Ex - coder666
// @namespace    http://tampermonkey.net/
// @version      3.0
// @description  你可以通过这个插件让 coder666 的顶部有一个随机跳题按钮和一个“在洛谷里找找这题”按钮
// @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(){
//        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.alert(h);
            window.open('https://www.luogu.com.cn/problem/list?keyword='+h);
        } */
    // }
    var s='<br> \xa0 <a class="small ui orange button" onclick="window.open(\'http://www.coder666.com/problem.php?id=\'+(Math.floor(Math.random() * 905) + 1000).toString(),\'_self\');">试试这题  \xa0 ( 随机 )</a>';
    s=s+'\xa0 <a  id="yob" class="small ui yellow button">在洛谷里找找这题</a>';
    w.innerHTML=s;
    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.alert(h);
            window.open('https://www.luogu.com.cn/problem/list?keyword='+h);
        }
    });
  //  <input class="prompt" style="width: 100%; " type="text" placeholder="题目编号 …" name="id">
})();