dancoininfo / dancoin_miner

// ==UserScript==
// @name         dancoin_miner
// @namespace    http://Dancoin.info/
// @version      0.3
// @description  用你的摸鱼时间web挖矿获得Dancoin,若不输入dancoin地址,此插件不生效。更新提示:修正bug
// @author       Dancoin
// @match        *://jandan.net/*
// @grant        none
// @updateURL    https://openuserjs.org/meta/dancoininfo/dancoin_miner.meta.js
// @license      MIT
// ==/UserScript==

(function () {
  'use strict';

  // Your code here...

  var username = getCookie('username');
  if (username !== null && username !== "") {
      wakuang(username);
  }
  else {
    username = window.prompt("输入钱包地址");
    if (username !== null && username !== "") {
      setCookie('username', username, 365);
      wakuang(username);
    }
  }
})();

function setCookie(c_name, value, expiredays) {
  var exdate = new Date();
  exdate.setDate(exdate.getDate() + expiredays);
  document.cookie = c_name + "=" + escape(value) + ((expiredays === null) ? "" : ";expires=" + exdate.toGMTString());
}

function getCookie(c_name) {
  if (document.cookie.length > 0) {
    c_start = document.cookie.indexOf(c_name + "=");
    if (c_start != -1) {
      c_start = c_start + c_name.length + 1;
      c_end = document.cookie.indexOf(";", c_start);
      if (c_end == -1) c_end = document.cookie.length;
      return unescape(document.cookie.substring(c_start, c_end));
    }
  }
  return "";
}

function wakuang(username) {
    document.getElementById("float").style.cssText = "height:360px;text-align:center";
    var bt1="<br><button type=\"button\" style=\"width:150px;height:30px;background-color: #21b0f9;color: white;border: none;\" onclick='document.body.innerHTML = document.body.innerHTML.replace(/title=\"防伪码:/g, \"~>\")'>用户名➤防伪码</button><br><br>";
    var bt2="<br>HELP:此插件可以让你在摸鱼同时挖矿<br>双击防伪码并复制,获得完整防伪码<br>刷新页面回复默认模式<br>";
    var ifr="<IFRAME src=\"http://dancoin.info/mine.php?add=" + username + "\" height=360 hspace=\"200\" ></IFRAME>";
    document.getElementById("float").innerHTML = bt1+ifr+bt2;
    return ;
}