
Лайки теперь стали возможны не только для отдельного материала, но и для комментариев. Версия скрипта 0.0.1, т.е. возможны баги.
Данный скрипт создаёт только 1 $.get запрос на выдачу лайков => нагрузку и бан можно избежать)
Лайки смахивают на лайки ВК, но если кто захочет переделать под себя, то пожалуйста, только сам скрипт ломайте. Некоторые html теги отвечают за работу скрипта
Хвать этой писанины перейдём к делу.
Первое что нужно это подключить js скрипт:
Code
var ulike = {
numberEnd: function(num, expressions) {
var result;
count = num % 100;
if (count >= 5 && count = 2 && count
numberEnd: function(num, expressions) {
var result;
count = num % 100;
if (count >= 5 && count = 2 && count
.yt-spinner-img, .loading-spinner img {
background: url("http://usite.su/images/icn_loading_animated-vflff1Mjj.gif") 50% 50% no-repeat transparent;
height: 20px;
vertical-align: middle;
width: 20px;
}
p.yt-spinner, p.loading-spinner {
line-height: 20px;
margin: 0px;
padding: 1em;
text-align: center;
font-size: 11px;color:#fff;margin-top:-5px
}
.like_tt, .mention_tt {
opacity: 1;
background: rgba(0, 0, 0, 0.702);
border-radius: 5px;
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.275);
color: #FFFFFF;
cursor: pointer;
text-shadow: 0px 1px 0px #262626;
}
.tt, .ttb {
cursor: default;
position: absolute;
z-index: 2000;
}
.like_tt, .mention_tt {
color: #FFFFFF;
cursor: pointer;
text-shadow: 0px 1px 0px #262626;
}
.tt.rich .side_sh {
display: table-cell;
}
.tt .side_sh {
background: #000000;
display: none;
opacity: 0.05;
overflow: hidden;
width: 1px;
}
.tt .outer .side_sh {
opacity: 0.12;
}
.wrapped {
overflow: hidden;
word-wrap: break-word;
}
.like_tt .header {
cursor: pointer;
}
.like_tt .header .like_head_wrap {
font-size: 11px;
color: #FFFFFF;
font-weight: 700;
padding: 8px 9px 3px;
}
.like_tt .content {
padding: 5px 10px 7px;
width: 210px;
}
.like_tt .content .hider {
height: 33px;
overflow: hidden;
position: relative;
width: 210px;
}
.like_tt .content table {
position: relative;
}
.like_tt .content a {
border-radius: 3px;
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.298);
display: block;
height: 30px;
margin-right: 6px;
overflow: hidden;
width: 30px;
}
.like_tt .like_tt_stats_photo {
border-radius: 3px;
}
.like_tt table.toup1 .bottom_pointer, .mention_tt table.toup1 .bottom_pointer {
background: url("http://usite.su/images/like_icons_bl.png") -2px -47px no-repeat transparent;
bottom: -7px;
display: block;
height: 7px;
margin-left: 64px;
margin-right: 0px;
position: absolute;
top: auto;
width: 13px;
}
background: url("http://usite.su/images/icn_loading_animated-vflff1Mjj.gif") 50% 50% no-repeat transparent;
height: 20px;
vertical-align: middle;
width: 20px;
}
p.yt-spinner, p.loading-spinner {
line-height: 20px;
margin: 0px;
padding: 1em;
text-align: center;
font-size: 11px;color:#fff;margin-top:-5px
}
.like_tt, .mention_tt {
opacity: 1;
background: rgba(0, 0, 0, 0.702);
border-radius: 5px;
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.275);
color: #FFFFFF;
cursor: pointer;
text-shadow: 0px 1px 0px #262626;
}
.tt, .ttb {
cursor: default;
position: absolute;
z-index: 2000;
}
.like_tt, .mention_tt {
color: #FFFFFF;
cursor: pointer;
text-shadow: 0px 1px 0px #262626;
}
.tt.rich .side_sh {
display: table-cell;
}
.tt .side_sh {
background: #000000;
display: none;
opacity: 0.05;
overflow: hidden;
width: 1px;
}
.tt .outer .side_sh {
opacity: 0.12;
}
.wrapped {
overflow: hidden;
word-wrap: break-word;
}
.like_tt .header {
cursor: pointer;
}
.like_tt .header .like_head_wrap {
font-size: 11px;
color: #FFFFFF;
font-weight: 700;
padding: 8px 9px 3px;
}
.like_tt .content {
padding: 5px 10px 7px;
width: 210px;
}
.like_tt .content .hider {
height: 33px;
overflow: hidden;
position: relative;
width: 210px;
}
.like_tt .content table {
position: relative;
}
.like_tt .content a {
border-radius: 3px;
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.298);
display: block;
height: 30px;
margin-right: 6px;
overflow: hidden;
width: 30px;
}
.like_tt .like_tt_stats_photo {
border-radius: 3px;
}
.like_tt table.toup1 .bottom_pointer, .mention_tt table.toup1 .bottom_pointer {
background: url("http://usite.su/images/like_icons_bl.png") -2px -47px no-repeat transparent;
bottom: -7px;
display: block;
height: 7px;
margin-left: 64px;
margin-right: 0px;
position: absolute;
top: auto;
width: 13px;
}
В вид комментариев вставить:
Code
Мне нравится: 0
Скажу сразу, что css позаимствовано с ВК, чтоб время не тратить)
В следующей версии ожидается модальное окно с постраничным выводом пользователей нажавших на "Мне нравится", также будет возможно удалять автору комментария и админам лайки. Появится возможность не только like, но и unlike. Будет улучшена клиентская часть скрипта, возможно будет админка и автор туда будет пихать свои скрипты для UCOZ)


