95 lines
2.7 KiB
JavaScript
95 lines
2.7 KiB
JavaScript
// 마우스 길게 누르는 function
|
|
var onlongclick = function ($target, time, callback) {
|
|
$($target).on("mousedown", function () {
|
|
const timer = setTimeout(callback, time);
|
|
$($target).on("mouseup", function () {
|
|
clearTimeout(timer);
|
|
});
|
|
});
|
|
}
|
|
|
|
|
|
var publishCommon = {
|
|
count: 0,
|
|
longMousePressCheck: function (checkTarget, checkTime, $target) {
|
|
// checkTarget → 체크박스([name='']) / checkTime → 몇초 간격으로 체크 될지
|
|
var checkLength = checkTarget.length; // 체크박스 몇개인지
|
|
var cnt = 0; // 몇개 체크됐는지
|
|
var checkEvent = setInterval(function () {
|
|
if (this.count == 0) {} else if (cnt >= checkLength) {
|
|
clearInterval(checkEvent); // 자동체크 끝.
|
|
}
|
|
$(checkTarget[cnt]).prop('checked', true); // 체크박스 체크.
|
|
//$(checkTarget[cnt]).attr("checked", "checked"); // 체크박스 체크.
|
|
$($target).on("mouseup", function () {
|
|
//마우스떼면 멈춤
|
|
clearInterval(checkEvent);
|
|
});
|
|
cnt++;
|
|
fnChkCallToChange();
|
|
}, checkTime);
|
|
},
|
|
clickCheck: function (checkTarget) {
|
|
// 한번 클릭 했을 때 체크, checkTarget → 체크박스([name=''])
|
|
|
|
$("input:checkbox[name='chkCallTo']").each(function () {
|
|
|
|
var chkSts = $(this).is(":checked");
|
|
|
|
if (!chkSts) {
|
|
//$(this).attr("checked", "checked");
|
|
$(this).prop("checked",true);
|
|
return false;
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
clickCheckAll: function () {
|
|
|
|
var chkCnt = $("input:checkbox[name='chkCallTo']").length;
|
|
var btnAllVal = $("#checkAll").val();
|
|
//var chkAllSts = $('input:checkbox[name="receipt_number_check"]').attr("checked");
|
|
|
|
if (chkCnt == 0) {
|
|
|
|
//alert("받는사람을 추가해 주세요.");
|
|
return false;
|
|
|
|
}
|
|
|
|
$("input:checkbox[name='chkCallTo']").each(function () {
|
|
|
|
if (btnAllVal == 'N') {
|
|
//$(this).attr("checked", "checked");
|
|
$(this).prop("checked",true);
|
|
|
|
} else {
|
|
//$(this).removeAttr("checked");
|
|
$(this).prop("checked",false);
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
clickCheckPrice: function () {
|
|
|
|
fnChkCallToChange();
|
|
|
|
},
|
|
toastsUtil: function (txt, cls, status) {
|
|
// txt - 문구 / cls - 활성화 clss / status - 초록색인지 빨간색인지
|
|
var toastText = txt;
|
|
$(".toast_popup").find(".title").text(toastText);
|
|
if ($(".toast_popup").hasClass("active") == true) {
|
|
$(".toast_popup").removeClass(cls).removeClass(status);
|
|
} else {
|
|
$(".toast_popup").fadeIn(400);
|
|
$(".toast_popup").addClass(cls).addClass(status);
|
|
setTimeout(function () {
|
|
$(".toast_popup").removeClass(cls).removeClass(status);
|
|
}, 2000)
|
|
}
|
|
}
|
|
|
|
} |