Last active
October 17, 2019 11:40
-
-
Save minhoryang/d47a041d2b48872361302df2559d8b83 to your computer and use it in GitHub Desktop.
Cyworld Club URL Strecther -- (Click 'raw' button for installing by Tampermonkey)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Cyworld Club URL Stretcher | |
// @namespace http://tampermonkey.net/ | |
// @version 0.2 | |
// @description Cyworld Club Byebye | |
// @author Minho Ryang | |
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.18.2/babel.js | |
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.16.0/polyfill.js | |
// @match http://club.cyworld.com/ClubV1/Home.cy/* | |
// @match http://club.cyworld.com/club/main/* | |
// @updateUrl https://gist.github.com/minhoryang/d47a041d2b48872361302df2559d8b83/raw/CyworldInternalUrl.user.js | |
// @downloadUrl https://gist.github.com/minhoryang/d47a041d2b48872361302df2559d8b83/raw/CyworldInternalUrl.user.js | |
// ==/UserScript== | |
var inline_src = (<><![CDATA[ | |
const transform = (deepLinkInfo) => { | |
let _ = deepLinkInfo.replace("ndrclick", "Array"); | |
_ = eval(_); | |
console.log("debug", _); | |
switch (_[3]) { | |
case 'M': | |
case 'm': | |
return 'javascript:zang_info();'; | |
case 'C': | |
case 'c': | |
return "/club/main/club_main_bridge.asp?rurl=" + _[2]; | |
default: | |
return _[2]; | |
}; | |
}; | |
const links = Array.from(document.querySelectorAll('a')); | |
const target_links = links.filter(_ => _.onclick); | |
target_links.map((this_link) => { | |
let link_detail = String(this_link.onclick); | |
let isDeepClickFound = link_detail.indexOf("ndrclick"); | |
if (isDeepClickFound !== -1) { | |
let deepClickInfoEnded = link_detail.indexOf("return"); | |
let deepClickInfo = link_detail.slice(isDeepClickFound, deepClickInfoEnded); | |
this_link.removeAttribute("onclick"); | |
this_link.setAttribute("href", transform(deepClickInfo)); | |
} | |
}); | |
]]></>).toString(); | |
var c = Babel.transform(inline_src, { presets: [ "es2015", "es2016" ] }); | |
eval(c.code); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment