이미 추천 한 글 알터창 대신 추천 할때와 같이 메새지만 출력 하기 > 그누보드5 팁자료실

그누보드5 팁자료실

이미 추천 한 글 알터창 대신 추천 할때와 같이 메새지만 출력 하기 정보

이미 추천 한 글 알터창 대신 추천 할때와 같이 메새지만 출력 하기

본문

그누 원본은 추천을 하고 한번 더 추천 누르면
이미 추천 하신 글 입니다.
알터창이 뜹니다.
알터창 대신 추천 할때와 같이 메세지만 보여주기입니다.

 

사용하는 view.skin.php 하단 추천 스크립트 수정

function excute_good(href, $el, $tx) {
    $.post(
        href,
        { js: "on" },
        function(data) {
            if(data.error) {
                alert(data.error);
                return false;
            }
            if(data.count) {
                $el.find("strong").text(number_format(String(data.count)));
                if($tx.attr("id").search("nogood") > -1) {
                    $tx.text("이 글을 비추천하셨습니다.");
                    $tx.fadeIn(200).delay(2500).fadeOut(200);
                } else {
                    $tx.text("이 글을 추천하셨습니다.");
                    $tx.fadeIn(200).delay(2500).fadeOut(200);
                }
            }
        }, "json"
    );
}

를 아래 와 같이 수정

function excute_good(href, $el, $tx) {
    $.post(
        href,
        { js: "on" },
        function(data) {
            if(data.error) {
                $tx.text(data.error);
                $tx.fadeIn(200).delay(2500).fadeOut(200);
                return false;
            }
            if(data.count) {
                $el.find("strong").text(number_format(String(data.count)));
                if($tx.attr("id").search("nogood") > -1) {
                    $tx.text("이 글을 비추천하셨습니다.");
                } else {
                    $tx.text("이 글을 추천하셨습니다.");
                }
                $tx.fadeIn(200).delay(2500).fadeOut(200);
            }
        }, "json"
    );
}

 

참고로

if(data.error) {
    alert(data.error);
    return false;
}

를 아래처럼 수정 한겁니다.

if(data.error) {
        $tx.text(data.error);
        $tx.fadeIn(200).delay(2500).fadeOut(200);
        return false;
}
추천
5

댓글 10개


수정 전: alert(data.error);
수정 후: $tx.text(data.error); $tx.fadeIn(200).delay(2500).fadeOut(200);
전체 2,432 |RSS
그누보드5 팁자료실 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT