From 9ff309a79cc2bc2fd97bf13d698c62e7d00c1536 Mon Sep 17 00:00:00 2001 From: gubug Date: Wed, 3 Feb 2016 20:02:35 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A9=94=ED=81=AC=EB=A1=9C=20=EC=8B=A4?= =?UTF-8?q?=ED=96=89=EC=8B=9C=20"showModalDialog=20is=20not=20defined"=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EB=B0=9C=EC=83=9D=20=EB=B0=8F=20confirmat?= =?UTF-8?q?ion=20alert=EC=9C=BC=EB=A1=9C=20=EB=8F=99=EC=9E=91=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 직접 "예약하기" 버튼을 클릭하는 경우 정상 동작하지만, 메크로로 예약하는 경우 "showModalDialog is not defined" 에러 발생 문제 해결 * 메크로 동작시 confirmation alert 이 발생하면서 메크로 동작이 멈추는 문제 해결 resolve #1, #2 --- content.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/content.js b/content.js index 2078c64..9a27a09 100644 --- a/content.js +++ b/content.js @@ -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 || @@ -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; } @@ -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; }