Всем доброго времени суток, сталкера-сайтостроители
Вот недавно химичил с кодом сообщений и попытался совместить невозможное. По этому за работу скрипта полностью я не ручаюсь, а также прошу его протестировать и написать здесь, так как делал быстро.
Вот сам код, пихаем в Нижнюю часть сайта:
Код
<script>
var go_down = jQuery('body');
jQuery(function() {
$("#Go_Top").hide().removeAttr("href");
if ($(window).scrollTop() >= "250") $("#Go_Top").fadeIn("slow")
var scrollDiv = $("#Go_Top");
$(window).scroll(function() {
if ($(window).scrollTop() <= "250") $(scrollDiv).fadeOut("slow")
else $(scrollDiv).fadeIn("slow")
});
$("#Go_Bottom").hide().removeAttr("href");
if ($(window).scrollTop() <= go_down.height()-"999") $("#Go_Bottom").fadeIn("slow")
var scrollDiv_2 = $("#Go_Bottom");
$(window).scroll(function() {
if ($(window).scrollTop() >= go_down.height()-"999") $(scrollDiv_2).fadeOut("slow")
else $(scrollDiv_2).fadeIn("slow")
});
$("#Go_Top").click(function() {
$("html, body").animate({scrollTop: 0}, "slow")
})
$("#Go_Bottom").click(function() {
$("html, body").animate({scrollTop: go_down.height()}, "slow")
})
});
</script>
<style>#banners img{opacity:.3;filter:alpha(opacity=30)} </style><script>
jQuery(function(){
$("#banners img").hover(function(){
$(this).stop().animate({opacity:'1.0'})},
function(){$(this).stop().animate({opacity:'.3'})}
);
});
</script>
<script type="text/javascript" src="http://www.prosto-stalker.at.ua/public/pm/ajaxPm.js"></script>
<script>
function tMess(n){var a=[' личное сообщение',' личных сообщения',' личных сообщений'];return a[n%10==1&&n%100!=11?0:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?1:2]};
function getPM(){
$.get("/index/14",function(a){
var s = $("b.unread",a).size();
if (s) {
var n=tMess(s), all=[], leg=(s==1) ? '' : '' ;
$("b.unread",a).each(function(){
var title = $(this).html();
var href = $(this).parent().attr("href");
var foo = localStorage[href];
if (foo != href) {
if ( ($.browser.mozilla) || ($.browser.opera) ) {
$('#music_ls').html('<audio src="http://www.prosto-stalker.at.ua/public/pm/pm_tip.wav" autoplay></audio>');
} else {
$('#music_ls').html('<audio src="http://www.prosto-stalker.at.ua/public/pm/pm_tip.mp3" autoplay></audio>');
}
}
localStorage[href] = href;
all.push('<br><a href="javascript://" onclick="ucodesru.init();">Прочитать: '+title+'</a><br>');
});
$.stickr({note:'<div id="shownewpmmessage"><div class="is_new_mp_message_class"><center>Получено '+s+n+':</center>'+leg+all.join("<br>")+'</div></div>',className:'classic'});
}}
);
}
$(function() {
getPM();
setInterval('getPM()',10000);
});
</script>
<script type="text/javascript" src="http://www.prosto-stalker.at.ua/public/pm/ls_2.js"></script>
<style type="text/css">
.stick {position:relative;z-index:2;}
#shownewpmmessage {display:block; z-index:9999;}
#jquery-stickers {z-index:9999;}
.is_new_mp_message_class {font: 11px Tahoma; color:#78866b; margin: 20px; padding:10px; background:url(/design/fon-20.png)#000; border:1px solid #222 !important; border-radius:7px;}
.is_new_mp_message_class a {text-decoration:none;}
</style>
<div id="music_ls" style="display:none;"></div>
Чтобы по ссылке на сообщения открывалась не страница с сообщениями а аякс пишем этот код:
Код
<a href="/index/14" onclick="ajaxPm.start();return false;">Мои сообщения</a>
Совмещал: Foxy
Тестили:...