Skip to content

Commit

Permalink
Merge pull request #4 from gubug0/master
Browse files Browse the repository at this point in the history
메크로 실행시 "showModalDialog is not defined" 에러 발생 및 confirmation alert으로 동작하지 않는 문제 해결
  • Loading branch information
kswchoo committed Feb 16, 2016
2 parents 408c42f + 9ff309a commit fa05b91
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ function injectJs(srcFile) {
document.getElementsByTagName('head')[0].appendChild(scr);
}

function redirectPage(href) {
if (href.indexOf("javascript:") == 0) {
href = "window.showModalDialog=window.showModalDialog || function(url, arg, opt) {window.open(url, arg, opt);};window.confirm=function (str) {return true;};" + href.substring(11, href.length);
location.href = "javascript:" + href;
} else {
location.href = href;
}
}

var dsturl1 = "http://www.letskorail.com/ebizprd/EbizPrdTicketPr21111_i1.do";
var dsturl2 = "http://www.letskorail.com/ebizprd/EbizPrdTicketpr21100W_pr21110.do";
if (document.URL.substring(0, dsturl1.length) == dsturl1 ||
Expand Down Expand Up @@ -79,7 +88,7 @@ if (document.URL.substring(0, dsturl1.length) == dsturl1 ||
img = $(coachSpecials[j]).children('img');
src = $(img).attr('src');
if (src == "/docs/2007/img/common/icon_apm_yes.gif") {
location.href = $(coachSpecials[j]).attr('href');
redirectPage($(coachSpecials[j]).attr('href'));
succeed = true;
break;
}
Expand All @@ -95,7 +104,7 @@ if (document.URL.substring(0, dsturl1.length) == dsturl1 ||
img = $(firstSpecials[j]).children('img');
src = $(img).attr('src');
if (src == "/docs/2007/img/common/icon_apm_spe_yes.gif") {
location.href = $(firstSpecials[j]).attr('href');
redirectPage($(coachSpecials[j]).attr('href'));
succeed = true;
break;
}
Expand Down

0 comments on commit fa05b91

Please sign in to comment.