푸른산타

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

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

 

사용하는 view.skin.php 하단 추천 스크립트 수정
[code]
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"
    );
}
[/code]
를 아래 와 같이 수정
[code]
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"
    );
}
[/code]

 

참고로
[code]
if(data.error) {
    alert(data.error);
    return false;
}
[/code]
를 아래처럼 수정 한겁니다.
[code]
if(data.error) {
        $tx.text(data.error);
        $tx.fadeIn(200).delay(2500).fadeOut(200);
        return false;
}
[/code]

|

댓글 10개

[http://sir.kr/data/editor/2310/f388d55de0ab7664fccc399cafe2ece5_1696322554_9919.gif]
수정 전: alert(data.error);
수정 후: $tx.text(data.error); $tx.fadeIn(200).delay(2500).fadeOut(200);
@sinbi 추천감사합니다.
산타님 간만이시네요. 추천합니다.
@비타주리 네~ 잘지내시죠?^^
추천 감사합니다.
좋아요, 감사 합니다.
@들레아빠 추천 감사합니다.
공유 감사드립니다. 추천꾹!!
@marty72 추천 감사합니다.
@미키손 감사합니다.
댓글을 작성하시려면 로그인이 필요합니다.

그누보드5 팁자료실

+
제목 글쓴이 날짜 조회
2년 전 조회 1,642
2년 전 조회 1,757
2년 전 조회 1,587
2년 전 조회 1,473
2년 전 조회 2,593
2년 전 조회 2,749
2년 전 조회 1,653
2년 전 조회 1,368
2년 전 조회 1,864
2년 전 조회 2,546
2년 전 조회 1,778
2년 전 조회 1,316
2년 전 조회 2,778
2년 전 조회 1,350
2년 전 조회 1,549
2년 전 조회 1,838
2년 전 조회 2,146
2년 전 조회 2,481
2년 전 조회 4,064
2년 전 조회 2,197
2년 전 조회 1,554
2년 전 조회 2,789
2년 전 조회 3,609
2년 전 조회 2,278
2년 전 조회 1,642
2년 전 조회 2,423
2년 전 조회 1,453
2년 전 조회 2,330
2년 전 조회 1,783
2년 전 조회 1,535