Skip to content

Commit

Permalink
매크로 진행 도중 창을 닫았을 경우, 다시 검색이 되지 않는 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
KayKwon committed Jan 18, 2017
1 parent 718b0e4 commit b96518b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 42 deletions.
42 changes: 21 additions & 21 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ if (document.URL.substring(0, dsturl1.length) == dsturl1) {
$(document).ready(function() {
injectJs(chrome.extension.getURL('inject.js'));

var coachSelected = JSON.parse(localStorage.getItem('coachSelected'));
var firstSelected = JSON.parse(localStorage.getItem('firstSelected'));
var coachSelected = JSON.parse(sessionStorage.getItem('coachSelected'));
var firstSelected = JSON.parse(sessionStorage.getItem('firstSelected'));
if (coachSelected == null) coachSelected = [];
if (firstSelected == null) firstSelected = [];
console.log("coach:" + coachSelected);
console.log("first:" + firstSelected);

if (localStorage.getItem('macro') == "true") {
if (sessionStorage.getItem('macro') == "true") {
$("div.button").append('<a href="#" onclick="macrostop();" style="margin-left:5px;"><img src="' + chrome.extension.getURL('images/btn_stop.png') + '"></a>');
} else {
$("div.button").append('<a href="#" onclick="macro();" style="margin-left:5px;"><img src="' + chrome.extension.getURL('images/btn_start.png') + '"></a>');
Expand Down Expand Up @@ -54,15 +54,15 @@ if (document.URL.substring(0, dsturl1.length) == dsturl1) {
}
}

if (localStorage.getItem('macro') == "true") {
if (sessionStorage.getItem('macro') == "true") {
// Restores user preferences
$("#psgInfoPerPrnb1").val(localStorage.getItem('psgInfoPerPrnb1'));
$("#psgInfoPerPrnb5").val(localStorage.getItem('psgInfoPerPrnb5'));
$("#psgInfoPerPrnb4").val(localStorage.getItem('psgInfoPerPrnb4'));
$("#psgInfoPerPrnb2").val(localStorage.getItem('psgInfoPerPrnb2'));
$("#psgInfoPerPrnb3").val(localStorage.getItem('psgInfoPerPrnb3'));
$("#locSeatAttCd1").val(localStorage.getItem('locSeatAttCd1'));
$("#rqSeatAttCd1").val(localStorage.getItem('rqSeatAttCd1'));
$("#psgInfoPerPrnb1").val(sessionStorage.getItem('psgInfoPerPrnb1'));
$("#psgInfoPerPrnb5").val(sessionStorage.getItem('psgInfoPerPrnb5'));
$("#psgInfoPerPrnb4").val(sessionStorage.getItem('psgInfoPerPrnb4'));
$("#psgInfoPerPrnb2").val(sessionStorage.getItem('psgInfoPerPrnb2'));
$("#psgInfoPerPrnb3").val(sessionStorage.getItem('psgInfoPerPrnb3'));
$("#locSeatAttCd1").val(sessionStorage.getItem('locSeatAttCd1'));
$("#rqSeatAttCd1").val(sessionStorage.getItem('rqSeatAttCd1'));

if ($("#search-list").length != 0) {
var rows = $('#search-list table tr');
Expand Down Expand Up @@ -106,16 +106,16 @@ if (document.URL.substring(0, dsturl1.length) == dsturl1) {
}

if (succeed == true) {
localStorage.removeItem('macro');
localStorage.removeItem('coachSelected');
localStorage.removeItem('firstSelected');
localStorage.removeItem('psgInfoPerPrnb1');
localStorage.removeItem('psgInfoPerPrnb5');
localStorage.removeItem('psgInfoPerPrnb4');
localStorage.removeItem('psgInfoPerPrnb2');
localStorage.removeItem('psgInfoPerPrnb3');
localStorage.removeItem('locSeatAttCd1');
localStorage.removeItem('rqSeatAttCd1');
sessionStorage.removeItem('macro');
sessionStorage.removeItem('coachSelected');
sessionStorage.removeItem('firstSelected');
sessionStorage.removeItem('psgInfoPerPrnb1');
sessionStorage.removeItem('psgInfoPerPrnb5');
sessionStorage.removeItem('psgInfoPerPrnb4');
sessionStorage.removeItem('psgInfoPerPrnb2');
sessionStorage.removeItem('psgInfoPerPrnb3');
sessionStorage.removeItem('locSeatAttCd1');
sessionStorage.removeItem('rqSeatAttCd1');
chrome.extension.sendMessage({type: 'playSound'}, function(data) { });
} else {
setTimeout(function() {
Expand Down
42 changes: 21 additions & 21 deletions inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ function macro() {
} else {
alert("매크로를 시작합니다.\n트럼펫 소리가 나면 바로 결제를 해주셔야 합니다.");

localStorage.setItem('macro', true);
localStorage.setItem('coachSelected', JSON.stringify(coachSelected));
localStorage.setItem('firstSelected', JSON.stringify(firstSelected));
sessionStorage.setItem('macro', true);
sessionStorage.setItem('coachSelected', JSON.stringify(coachSelected));
sessionStorage.setItem('firstSelected', JSON.stringify(firstSelected));

// Stores user preferences.
localStorage.setItem('psgInfoPerPrnb1', document.getElementsByName('psgInfoPerPrnb1')[0].value);
localStorage.setItem('psgInfoPerPrnb5', document.getElementsByName('psgInfoPerPrnb5')[0].value);
localStorage.setItem('psgInfoPerPrnb4', document.getElementsByName('psgInfoPerPrnb4')[0].value);
localStorage.setItem('psgInfoPerPrnb2', document.getElementsByName('psgInfoPerPrnb2')[0].value);
localStorage.setItem('psgInfoPerPrnb3', document.getElementsByName('psgInfoPerPrnb3')[0].value);
localStorage.setItem('locSeatAttCd1', document.getElementsByName('locSeatAttCd1')[0].value);
localStorage.setItem('rqSeatAttCd1', document.getElementsByName('rqSeatAttCd1')[0].value);
sessionStorage.setItem('psgInfoPerPrnb1', document.getElementsByName('psgInfoPerPrnb1')[0].value);
sessionStorage.setItem('psgInfoPerPrnb5', document.getElementsByName('psgInfoPerPrnb5')[0].value);
sessionStorage.setItem('psgInfoPerPrnb4', document.getElementsByName('psgInfoPerPrnb4')[0].value);
sessionStorage.setItem('psgInfoPerPrnb2', document.getElementsByName('psgInfoPerPrnb2')[0].value);
sessionStorage.setItem('psgInfoPerPrnb3', document.getElementsByName('psgInfoPerPrnb3')[0].value);
sessionStorage.setItem('locSeatAttCd1', document.getElementsByName('locSeatAttCd1')[0].value);
sessionStorage.setItem('rqSeatAttCd1', document.getElementsByName('rqSeatAttCd1')[0].value);

location.reload();
}
Expand All @@ -35,16 +35,16 @@ function macro() {
function macrostop() {
alert("매크로를 중지합니다.\n조건을 변경하여 재조회하신 후 다시 시작하실 수 있습니다.");

localStorage.removeItem('macro');
localStorage.removeItem('coachSelected');
localStorage.removeItem('firstSelected');
localStorage.removeItem('psgInfoPerPrnb1');
localStorage.removeItem('psgInfoPerPrnb5');
localStorage.removeItem('psgInfoPerPrnb4');
localStorage.removeItem('psgInfoPerPrnb2');
localStorage.removeItem('psgInfoPerPrnb3');
localStorage.removeItem('locSeatAttCd1');
localStorage.removeItem('rqSeatAttCd1');
sessionStorage.removeItem('macro');
sessionStorage.removeItem('coachSelected');
sessionStorage.removeItem('firstSelected');
sessionStorage.removeItem('psgInfoPerPrnb1');
sessionStorage.removeItem('psgInfoPerPrnb5');
sessionStorage.removeItem('psgInfoPerPrnb4');
sessionStorage.removeItem('psgInfoPerPrnb2');
sessionStorage.removeItem('psgInfoPerPrnb3');
sessionStorage.removeItem('locSeatAttCd1');
sessionStorage.removeItem('rqSeatAttCd1');

location.reload();
}
}

0 comments on commit b96518b

Please sign in to comment.