OIer交流站·洛谷插件

在洛谷添加一些关于Oier交流站(OIer Club)的消息(非广告)

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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         OIer交流站·洛谷插件
// @namespace    http://tampermonkey.net/
// @version      1.1.2
// @description  在洛谷添加一些关于Oier交流站(OIer Club)的消息(非广告)
// @author       jyb666
// @match        *://www.luogu.com.cn/
// @homepageURL  https://greasyfork.org/zh-CN/scripts/412366
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
  'use strict';
  var status_html;
  function init() {
    var node = document.createElement('div');
	  node.id = 'oier-club';
	  node.className = 'lg-article';
    status_html="<h3>OIer交流站</h3>\n当前在线状态:不在线</br>\n上次在线时间:"+window.localStorage.getItem("oier-club");//如果在线的话服务器端会替换的
    node.innerHTML = status_html;
    document.querySelector('div.lg-index-benben > div:nth-child(2)').insertAdjacentElement('afterend', node);
    var url = "https://oier.test.utools.club/api/online.php";
    var script = document.createElement('script');
    script.setAttribute('src', url);
    document.getElementsByTagName('head')[0].appendChild(script); 
  }
  setTimeout(init, 100);
})();