Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d3m3vilurr/ee90da066f1f4649fb0237de5609945c to your computer and use it in GitHub Desktop.
Save d3m3vilurr/ee90da066f1f4649fb0237de5609945c to your computer and use it in GitHub Desktop.
Unlock waypoint limit of Kakao Map
// ==UserScript==
// @name Unlock waypoint limit of Kakao Map
// @namespace https://map.kakao.com/
// @updateURL https://gist.github.com/d3m3vilurr/ee90da066f1f4649fb0237de5609945c/raw/unlock_waypoint_limit_of_kakao_map.user.js
// @downloadURL https://gist.github.com/d3m3vilurr/ee90da066f1f4649fb0237de5609945c/raw/unlock_waypoint_limit_of_kakao_map.user.js
// @version 0.1
// @description Unlock waypoint limit of bike route planner of Kakao Map.
// @author Sunguk Lee <d3m3vilurr@gmail.com>
// @match https://map.kakao.com/*
// @exclude https://map.kakao.com/mapclick.html*
// @icon https://www.google.com/s2/favicons?sz=64&domain=kakao.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
const main = () => {
// bypass route limit
// original msg \uacbd\uc720\uc9c0\ub294 \ucd5c\ub300 5\uac1c\uae4c\uc9c0\ub9cc \ucd94\uac00 \uac00\ub2a5\ud569\ub2c8\ub2e4
Application.flagSearchController.flagSearch_.constructor.prototype.origGetViaCount = Application.flagSearchController.flagSearch_.constructor.prototype.getViaCount
// always pass the limit
Application.flagSearchController.flagSearch_.constructor.prototype.getViaCount = () => 1;
Application.flagSearchController.waypointSearchBoxController_.constructor.prototype.origSetFlagSearch = Application.flagSearchController.waypointSearchBoxController_.constructor.prototype.setFlagSearch;
const WaypointBoxView = window.waypointBoxView.constructor;
// remove route limit from original code
Application.flagSearchController.waypointSearchBoxController_.constructor.prototype.setFlagSearch = function(b){
var b = b.waypoints, d = b.length - 1;
if (this.boxViewList_.length > 0) {
this.boxViewList_.forEach(function() {
this.listDragController_.removeToNumber(0)
}, this);
this.boxViewList_.length = 0
}
this.addVia_ = true;
this.changeBox_.setVisible(d == 1);
this.viaBox_.removeClass("HIDDEN")
this.focusTargetNumber = null;
b.forEach(function(b, c) {
waypointBoxView = new WaypointBoxView(c, c == d);
waypointBoxView.onRemove.add(this.onRemove_, this);
waypointBoxView.onSearch.add(this.onSearch_, this);
if(b && b.name && b.name != "\uc8fc\uc18c\ub97c \uc81c\uacf5\ud558\uc9c0 \uc54a\ub294 \uc9c0\uc5ed") {
waypointBoxView.setValue(b.name);
} else{
var h = "";
if (b) {
h = c == 0 ? "\ucd9c\ubc1c" : c == d ? "\ub3c4\ucc29" : "\uacbd\uc720" + c;
b.name=h
} else if (this.focusTargetNumber == null) {
this.focusTargetNumber = c;
}
waypointBoxView.setValue(h)
}
this.boxViewList_.push(waypointBoxView);
this.listDragController_.add(waypointBoxView);
waypointBoxView.setSuggest();
if (b && b.name) {
var h = Application.historyController.TYPE_LIST, g = b.pointType, k = {
id:b.id,name:b.name,coords:b.coords
};
switch(b.pointType){
case "ADDRESS":
g = h.ADDRESS;
break;
case "PLACE":
g = h.PLACE;
break;
case "SUBWAY_STATION":
g = h.SUBWAY_STATION;
break;
case "BUS_STOP":
g = h.BUS_STOP
}
if (g == "NORMAL" && b.id) {
g = h.ADDRESS;
}
g && Application.historyController.addPoi(g, k)
}
}, this);
this.focusTargetNumber != null ? this.setFocus(this.focusTargetNumber) : this.onMethodFocus.notify();
// restore flag image
jQuery('img.flagImg').filter(function() {
return jQuery(this).attr('src') === "";
}).attr('src', '//t1.daumcdn.net/localimg/localimages/07/2018/pc/flagImg/green_b_5.png');
};
};
const setup = () => {
if (window.__unlock_waypoint_limit) {
return;
}
if (!window.Application) {
setTimeout(setup, 1000);
return;
}
window.__unlock_waypoint_limit = true;
main();
};
setTimeout(setup, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment