Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Cyworld Club URL Strecther -- (Click 'raw' button for installing by Tampermonkey)
// ==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