Đăng Nhập

Vui lòng khai báo chính xác tên truy cập và mật khẩu!

Quên mật khẩu?

Đăng Ký

Bạn phải điền đầy đủ thông tin đăng ký!

  

[Code] Star rating

    Quản trị viên

    avatar

    Bài viết : 89

    Tài sản : 275

    Uy tín : 7

    #1

     on 21.08.15 21:19 

    Code:
    /* star rating */
    .ctrlcvote,.voteBfmvi{margin-top:4px;position:relative;float:left}
    .voteStar{background:url(http://i15.servimg.com/u/f15/16/58/89/73/star10.png) no-repeat scroll 0 0 transparent;width:16px;height:16px;display:block;float:left}
    .v0{background-position:0 0}
    .v1{background-position:0 -32px}
    .v2{background-position:0 -16px}
    .v4{background-position:0 -48px}
    .v3{background-position:0 -64px}
    .votebutton{right:-64px;position:absolute;top:-10px;z-index:10}
    .votebutton a{opacity:0.3;padding:0 7px}
    .votetip{text-align:center;background-color:#474747;margin-top:5px;padding:3px 7px}
    .voteBfmvi a:hover{opacity:1}
    .voteBfmvi:hover .voteshow{opacity:0.4}
    .fmvistar,.fmviminus{height:10px;position:absolute;right:0;top:0;width:10px;margin:0}
    .rootvote{height:10px;left:35px;position:absolute;top:9px;width:10px;url(http://i12.servimg.com/u/f12/17/70/81/78/13580710.png);url(http://i12.servimg.com/u/f12/17/70/81/78/sticky10.png);url(http://i12.servimg.com/u/f12/17/70/81/78/like_b11.png);url(http://i12.servimg.com/u/f12/17/70/81/78/dislik11.png);url(http://i12.servimg.com/u/f12/17/70/81/78/13581110.png);url(http://i12.servimg.com/u/f12/17/70/81/78/13581111.png);url(http://i12.servimg.com/u/f12/17/70/81/78/13581112.png);url(http://i12.servimg.com/u/f12/17/70/81/78/13581113.png);url(http://i12.servimg.com/u/f12/17/70/81/78/13581114.png);url(http://i12.servimg.com/u/f12/17/70/81/78/13581115.png)}
    Code:
    function sendWall(m, i, n) {
     $.post("/privmsg", {
     subject: "Bài viết hay",
     message: m,
     username: n,
     u: i,
     mode: "post_profile",
     folder: "profile",
     post: "Send"
     });
    }

    function voteblog(c, f) {
     $("#tooltip").css("visibility", "hidden");
     var a, d, h, b, e, g, j;
     a = $(c).parents(".voteBfmvi");
     d = parseInt(a.find(".bloglike").text());
     s = parseInt(a.find(".blogdlike").text());
     $.post($(c).attr("alt"));
     e = $(c).parents(".post");
     i = e.find(".user-poster a").attr("href").replace(/\/u(\d+)(\?tt=1)?/, "$1");
     n = e.find(".user-poster strong").text();
     q = "b\u00e0i vi\u1ebft c\u1ee7a [color=green][b][i]" + e.find(".authblog").text() + "[/i][/b][/color] t\u1ea1i [url=http://" + location.host + location.pathname + "#" + e.prev().attr("name") + "]" + document.title + "[/url]";
     "p" == f ? (b = d + 1, sendWall("th\u00edch " + q, i, n), a.prev(".rootvote").find(".fmvistar").show().each(function () {
     var b = $(this).attr("alt").split(",");
     $(this).animate({
     right: b[0],
     width: b[1],
     height: b[1],
     top: b[2],
     opacity: 0
     }, 1E3, function () {
     a.prev(".rootvote").remove()
     })
     })) : (h = s + 1, sendWall("kh\u00f4ng th\u00edch " + q, i, n), a.prev(".rootvote").find(".fmviminus").show().animate({
     right: -20,
     width: 50,
     height: 50,
     top: -20,
     opacity: 0
     }, 1E3, function () {
     a.prev(".rootvote").remove()
     }));
     a.find(".bloglike").text(b);
     a.find(".blogdlike").text(h);
     d = parseInt(a.find(".bloglike").text());
     h = parseInt(a.find(".blogdlike").text());
     b = Math.round(100 * (d / (d + h)));
     e = Math.floor(b / 20);
     g = Math.round(b / 20);
     j = b / 20;
     d < h && 0 == d ? (g = e = -1, b = 0) : j > e && g > e ? g = e : (g = e, e = -1);
     setstar(a, g, e, "v1", "v3", "", d, h, b, "<span style='color:#FF5B5B'>Kh\u00f4ng th\u1ec3 b\u00ecnh ch\u1ecdn b\u00e0i vi\u1ebft n\u00e0y!</span>")
    }

    function setstar(c, f, a, d, h, b, e, g, j, k) {
     c.html(b + "<div class='voteshow' onmouseover='show_tooltip(this, $(this).parent().find("div:last").html(), "FMvi.vn")'><div class='voteStar'></div><div class='voteStar'></div><div class='voteStar'></div><div class='voteStar'></div><div class='voteStar'></div></div><div style='display:none'><h3 class='tiplFMvi' style='color:#0099FF'>TH\u00d4NG TIN B\u00ccNH CH\u1eccN</h3><p><strong>Th\u00edch:</strong> <span class='bloglike' style='color:#FF66CC'>" + e + "</span> l\u01b0\u1ee3t</p><p><strong>Kh\u00f4ng th\u00edch:</strong> <span class='blogdlike' style='color:#009933'>" + g + "</span> l\u01b0\u1ee3t</p><p><strong>T\u1ec9 l\u1ec7 b\u00ecnh ch\u1ecdn:</strong> <span class='blogtlike' style='color:#FF6600'>" + j + "</span>%</p><p class='votetip'>" + k + "</p></div>").fadeIn(300);
     c.find(".voteStar:lt(" + f + ")").addClass(d);
     c.find(".voteStar:eq(" + a + ")").addClass(h)
    }

    $(".voteBfmvi").each(function () {
     var c, f, a, d, h, b, e, g, j, k;
     c = $(this).find(".vote-bar").attr("title");
     /Message reputation :/.test(c) ? (f = c.split(/\W/), b = f[4], c = Math.round(b / 100 * f[7]), f = f[7] - c, a = Math.floor(b / 20), d = Math.round(b / 20), h = b / 20) : c = f = 0;
     k = $(this).find(".vote-button");
     k.length ? (e = "v4", g = "v2", j = "<span style='color:#E2FE6C'>B\u1ea1n ch\u01b0a b\u00ecnh ch\u1ecdn b\u00e0i vi\u1ebft n\u00e0y!</span>", k = "<div class='votebutton'>" + k.html() + "</div>") : (e = "v3", g = "v1", j = "<span style='color:#FF5B5B'>Kh\u00f4ng th\u1ec3 b\u00ecnh ch\u1ecdn b\u00e0i vi\u1ebft n\u00e0y!</span>", k = "");
     void 0 == a || c < f && 0 == c ? (a = d = -1, b = 0) : h > a && d > a ? a = d = a : d = -1;
     setstar($(this), a, d, g, e, k, c, f, b, j)
    });

    Tags: #code
    You cannot reply to topics in this forum