Skip to content

Instantly share code, notes, and snippets.

@bramblex
Created September 26, 2017 01:26
Show Gist options
  • Select an option

  • Save bramblex/9afede30ccf9ea16bf4c25e04873fe52 to your computer and use it in GitHub Desktop.

Select an option

Save bramblex/9afede30ccf9ea16bf4c25e04873fe52 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name fuck网易
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://mc.netease.com/*
// @grant none
// @require http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js
// ==/UserScript==
(function() {
const add = () => {
const key = 'fuck_list';
const fuck_list = new Set(JSON.parse(localStorage.getItem(key) || '[]'));
fuck_list.add(location.href);
localStorage.setItem(key, JSON.stringify(Array.from(fuck_list)));
};
const getRunningState = () => {
return JSON.parse(localStorage.getItem('fuck_running') || false);
};
const changeRuningState = () => {
localStorage.setItem('fuck_running', !JSON.parse(localStorage.getItem('fuck_running') || false));
location.href = location.href;
};
const button_add = `<span onclick="(${add.toString().replace(/\s+/g, ' ')})()">添加</span>`;
const button_running = `<span onclick="(${changeRuningState.toString().replace(/\s+/g, ' ')})()">${getRunningState() ? '结束' : '执行'}</span>`;
const css = `position: fixed; background-color: white; top: 0; right: 0; z-index: 10000;`;
const ui = `<div style="${css}">${[button_add, button_running].join(' | ')}</div>`;
$('body').append($(ui));
if (getRunningState()) {
if(!(/thread-.*/.test(location.href))){
const fuck_list = JSON.parse(localStorage.getItem('fuck_list') || '[]');
location.href = fuck_list[Math.floor(Math.random()*fuck_list.length)];
}
setTimeout(()=>{
$('#fastpostmessage').val('顶上去');
$('#fastpostsubmit').mouseover();
setTimeout(() => {
$('#fastpostsubmit').click();
}, 1e3);
}, 30e3);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment