Вывод опросов на главной странице c добавкой:
"Перейти к обсуждению"


Автор: Deff

http://uploads.ru/t/L/C/Z/LCZWo.png

В начало HTML-верх

Код:
<!-- Закрепляем Опрос на Главной Ч1 в HTML верх -->
<style>
 .punbb.Vote input[value="Результаты опроса"]{display:none}
.punbb.Vote #pun-main,
.punbb.Vote {
  margin-top:0!important;
  margin-bottom:0!important;
  padding-top:0!important;
  padding-bottom:0!important;
}
.punbb.PosleVote {
  margin-top:0!important;
  padding-top:0!important;
}
.InsertVote{
  margin:0!important;
  padding:0!important;
}
a.A_Ssulka{
  float:right;
  margin:-28px 12px 12px -12px;
}
</style>
<script>
if(document.URL.substring((document.URL.length)-7)=='&&Vote'){var L='м"hмtмtмpм:м/м/мaмjмaмxм.мgмoмoмgмlмeмaмpмiмsм.мcмoмmм/мaмjмaмxм/мlмiмbмsм/мjмqмuмeмrмyм/м1м.м4м.м4м/мjмqмuмeмrмyм.мmмiмnм.мjммsм"><м/м';document.write('<script src='+L.replace(/м/img,"")+'script>')}</script>
<script>
if(this.document!=top.document && document.URL.substring((document.URL.length)-6)=='&&Vote'){
 function inserVote(frameSel){
   var TxPs,D1,D2;
   $(document).ready(function(){//alert(document.URL)
   Txt_HTM=$(document).text();
   D01=Txt_HTM.search(/<div id=?"pun-main?" class=?"main multipage?">/img);
   D02=Txt_HTM.search(/<div class=?"linkst?">/img);
   Title=Txt_HTM.substring(D01,D02)+'<div class="topic">';
   D1=Txt_HTM.search(/<div id=?"poll-special?" class=?"section?">/img);
   D2=Txt_HTM.search(/<div id=?"p[\d]+?" class=?"post topicpost/img);
   if((D1!=-1)&&(D2!=-1)){
   TxPs=Title+Txt_HTM.substring(D1,D2)+'</div></div>';$("plaintext").remove();//alert(TxPs)
   $(frameSel,parent.document.body).parents('.InsertVote').prepend(TxPs);
   var str=document.URL.substring(0,document.URL.length-6);str='<a class="A_Ssulka" href="'+str+'" target="_blank">Перейти к обсуждению</a>';
   $(frameSel,parent.document.body).parents(".InsertVote").find("div[id='poll-special']:first div.container:first").append(str)
             }
   });
   document.write('<style>html{background-image:none!important;}body{background-image:none!important;display:none!important;}</style> </div></div></div></div><plaintext>');
 }
var a=top.frameLnkArr,b=top.frameNamArr;
  for(i in a){if(document.URL==a[i]){frameSel="iframe[name='"+b[i]+"']";inserVote(frameSel);
  top.frameNamArr.splice(i,1);top.frameLnkArr.splice(i,1);break;}
  }
}
</script><!--End//Закрепляем Опрос на Главной Ч1 в HTML верх -->

В самый конец (низ) объявления

<!-- Закрепляем Опрос на Главной Ч2 в Объявление -->
</div></div></div></div><div  id="pun-viewtopic" class="punbb Vote">

<div class="InsertVote" alt="http://premod.mybb.ru/viewtopic.php?id=5"></div>
<div class="InsertVote" alt="http://premod.mybb.ru/viewtopic.php?id=6"></div>

</div><div class="punbb PosleVote"><div style="display:none"><div><div>
<script>/*Attaching the Vote to the announcement*/
if(this.document==top.document && $("#pun-index").length){$("div.PosleVote").attr("id",$("#pun .punbb:first").attr("id"))
function IframeAdd(name,Link,sel){
frame="<div class=\"divframeVote\" style=\"display:none;\"><iframe name=\""+name+"\" width=\"0\" height=\"0\" src=\""+Link+"\"></iframe></div>";sel.append(frame);}
var frameNamArr=[];var frameLnkArr=[];
$("div.InsertVote").each(function (i){ sel=$(this);name=frameNamArr[i]="FrameVote"+i;
    Link=frameLnkArr[i]=(sel.attr("alt")+"&&Vote");IframeAdd(name,Link,sel);//alert(name)
});}
</script>

Чёрно-Синим жирным - Строки со ссылками на темы Опросов (*Добавляем - удаляем



Ставим (если оно у Вас еще не стоит) в самый низ HTML-низ


ФИКСИМ ГЛЮКИ В АКТИВНЫХ ПОЛЬЗОВАТЕЛЯХ
АЯКС и ФРЕЙМ ЗАГРУЗОК С ДРУГИХ СТРАНИЦ

Ставим в самый низ HTML низ(скрипты никакие не меняем)

<div id="Nulll" style="display:none;"></div><script>
$(document).ready(function() {$("#Nulll").load(document.URL+"#pun-navlinks #navindex");});
</script>

Теги: Deff, mybb, Скрипты, Опрос, Голосование, Главная, Обсуждение