Skip to content

Instantly share code, notes, and snippets.

@x3388638
Last active December 20, 2017 18:46
Show Gist options
  • Save x3388638/5856720a11b44fcac74f6f03dd68ff62 to your computer and use it in GitHub Desktop.
Save x3388638/5856720a11b44fcac74f6f03dd68ff62 to your computer and use it in GitHub Desktop.
仙境傳說 守護永的愛 RO 耶誕城揪伴裝飾你的聖誕樹 全自動拿序號 (Doc: https://hackmd.io/s/B1pB-7j-z)
// ==UserScript==
// @name RO_Seal_Auto.user.js
// @namespace YY
// @version 2.0
// @description RO Seal, auto get code
// @author Y.Y.
// @include /https:\/\/rom\.gnjoy\.com\.tw\/.*/
// @include /https://www.wegames.com.tw/site/login/
// @exclude https://rom.gnjoy.com.tw/fblike/getgift
// @grant none
// ==/UserScript==
(function() {
'use strict';
let _win;
window._alert = window.alert;
window.alert = function () {};
if (/https:\/\/rom\.gnjoy\.com\.tw\/event_xmastree(\/index(\/)?)?$/.test(window.location.href)) {
if (!!login) {
location.href = 'https://www.wegames.com.tw/site/login?store=1';
}
return;
}
if (window.location.href === 'https://rom.gnjoy.com.tw/event_xmastree/selectrole') {
$.ajax({
url: 'https://rom.gnjoy.com.tw/event_xmastree/selectrole',
type: 'post',
data: {
YII_CSRF_TOKEN: $('input[name="YII_CSRF_TOKEN"]').val(),
select_role: (Math.floor(Math.random() * 10e8)).toString(36)
},
success: function (data) {
window.location.href = 'https://rom.gnjoy.com.tw/event_xmastree/owner';
}
});
return;
}
if (window.location.href === 'https://rom.gnjoy.com.tw/event_xmastree/owner') {
if (!!$('.number2').size()) {
prompt('序號在此:', $('.number2').text().trim());
logout();
return;
}
let code;
$.ajax({
url: './',
type: 'get',
success: function (data) {
code = data.match(/https:\/\/rom\.gnjoy\.com\.tw\/event_xmastree\/frienddecorate\?code=([a-z0-9]+)/)[1];
window.location.href = 'https://rom.gnjoy.com.tw/rom/member/event_logout?redirect=https://rom.gnjoy.com.tw/event_xmastree/frienddecorate?code=' + code;
}
});
return;
}
if (/https:\/\/rom\.gnjoy\.com\.tw\/event_xmastree\/(frienddecorate)|(friendlogin)\?code=[a-z0-9]+/.test(window.location.href)) {
if (!!window.login) {
window.login();
} else {
if (!$('.btn_arrangement').size()) {
window.location.href = 'https://rom.gnjoy.com.tw/rom/member/event_logout?redirect=https://www.wegames.com.tw/site/login?retrieve=1';
return;
}
$.post('https://rom.gnjoy.com.tw/event_xmastree/frienddecorate?code=' + window.location.href.split('code=')[1],{
YII_CSRF_TOKEN: $('input[name="YII_CSRF_TOKEN"]').val()
}, window.logout);
}
return;
}
if (/https:\/\/www\.wegames\.com\.tw\/site\/login/.test(window.location.href)) {
let token_for_business = ((Math.random() * 10e17).toString(16) + (Math.random() * 10e17).toString(16)).substring(0, 16);
let name = Date.now().toString(16);
let id = Math.random() * 10e17;
if (window.location.href.split('store=')[1] === '1') {
window.localStorage._token_for_business = token_for_business;
window.localStorage._name = name;
window.localStorage._id = id;
}
if (window.location.href.split('retrieve=')[1] === '1') {
token_for_business = window.localStorage._token_for_business;
name = window.localStorage._name;
id = window.localStorage._id;
}
$.ajax({
url: 'https://www.wegames.com.tw/Third/facebook',
type: 'post',
data: {
token_for_business,
name,
id,
YII_CSRF_TOKEN: $('input[name="YII_CSRF_TOKEN"]').val()
},
success: function () {
if (window.location.href.split('store=')[1] === '1' ||
window.location.href.split('retrieve=')[1] === '1') {
window.location.href = 'https://rom.gnjoy.com.tw/rom/member/event_login?redirect=https%3A%2F%2From.gnjoy.com.tw%2Fevent_xmastree%2Findex';
} else {
window.location.href = 'https://www.wegames.com.tw/member/event_login_check';
}
}
});
return;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment