В этой теме оставляем интересные и полезные проверенные скрипты с пояснениями.
Скрипты для форумов MyBB
Сообщений 1 страница 13 из 13
Поделиться223.03.2019 23:37:36
Рейтинг Темы Звёздочками:
<!--Рейтинг темы звездочками--><script type="text/javascript">
of_Stars=1000 //Кол-во просмотров на одну звезду;
var records=0;var Select=$("#pun-main div.forum table:first");var Rang_TR=[];
Select.find("td.tc3").each(function(){L=parseFloat($(this).text());
if(!($(this).parent('tr:first').find("td.tcl span.stickytext").length)){Rang_TR[L]=true;
$(this).parent('tr:first').attr('alt',L);if(L>records){records=L;};L=Math.round(L/of_Stars);
if(L){var SS='',s='<img src="http://forumstatic.ru/files/000e/0d/f8/83698.png" style="width:16px;height:16px;margin-right:0px"/>'
for(i=0; i<L; i++){SS+=s;}$(this).html(SS);}};});
for(i=0; i<(records+1); i++){
if(typeof(Rang_TR[i])!='undefined'){
Select.find("tr.[alt='"+i+"']").each(function(){
a=Select.find("tr[alt]:first")
if($(this).html()!=a.html()){$(this).insertBefore(a)};});}}
Rang_TR='';
</script><!--End//Рейтинг темы звездочками-->Поделиться323.03.2019 23:39:14
Сворачивание/разворачивание объявления:
<script type="text/javascript">
document.getElementById('pun-announcement').getElementsByTagName("div")[0].id="annbody"
function lookCook()
{
if (document.cookie.indexOf("announce")!=-1)
{var an1=document.cookie.substr(document.cookie.indexOf("announce"))
var an=an1.substr(an1.indexOf("id")+2, 2)
if (an=="op")
{document.getElementById('annbody').style.display="block"
var knopka="Скрыть объявление"}
else if (an=="cl")
{document.getElementById('annbody').style.display="none"
var knopka="Показать объявление"}}
else if (document.cookie.indexOf("announce")==-1)
{document.getElementById('annbody').style.display="block"
var knopka="Скрыть объявление"}
document.getElementById('pun-announcement').getElementsByTagName("h2")[0].innerHTML+="<div align='right'>"+"<input type='button'"+" id='hider'"+" value='"+knopka+"' "+"onclick='hideAnn() ; wCook()' /></div>"}
lookCook()
function hideAnn()
{
if (document.getElementById('annbody').style.display!="none")
{document.getElementById('annbody').style.display="none"
document.getElementById('hider').value="Показать объявление"}
else
{document.getElementById('annbody').style.display="block"
document.getElementById('hider').value="Скрыть объявление"}
}
function wCook()
{
var ann="announce=id"
if (document.getElementById('annbody').style.display!="none")
{ann+="op"}
else
{ann+="cl"}
var d=new Date()
d.setDate(d.getDate()+1)
ann+=";expires="+d.toGMTString()
document.cookie=ann}
</script>Поделиться423.03.2019 23:40:39
Отделение важных тем в отдельный блок:
<script type="text/javascript">
<!--
if (document.URL.indexOf("viewforum")!=-1){
var trs=document.getElementById('pun-main').getElementsByTagName("table")[0].rows
for (io=1; io<=(trs.length-1); io++){
if ((trs[io].className.indexOf("isticky")!=-1)&&(trs[io+1].className.indexOf('isticky')==-1))
{var normal=document.getElementById('pun-main').getElementsByTagName("table")[0].insertRow(io+1)
for(j=0;j<4;j++){
nl=normal.insertCell(0)
nl.className="tc2"
nl.innerHTML=" "
nl.style.borderLeft="0px"}
nl.innerHTML="<b>Темы форума</b>"
nl.style.textAlign="left"
}}}
-->
</script>Поделиться523.03.2019 23:41:33
Замена основного фона:
<style type="text/css">
HTML, BODY {background-image: url("ссылка на картинку")!important; background-repeat: repeat !important;}
</style>Поделиться623.03.2019 23:55:30
Логотип форума:
<style type="text/css">
#pun-title .title-logo {background-image : url(ссылка на картинку);
background-repeat : no-repeat; height : 132px;
}
</style>132px - высота картинки
Поделиться723.03.2019 23:57:23
Иконки сообщений;
Иконка "Нет новых сообщений":
<style type="text/css"> Div.icon {
background-image : url(ссылка на картинку);
background-repeat: no-repeat;
}
</style>Поделиться823.03.2019 23:58:09
Данные пользователя делаем по центру:
<style type="text/css">
.pa-adnote{ text-align: center;}
.pa-from{ text-align: center;}
.pa-reg{ text-align: center;}
.pa-posts{ text-align: center;}
.pa-reputation{ text-align: center;}
.pa-sex{ text-align: center;}
.pa-icq{ text-align: center;}
.pa-ip{ text-align: center;}
.pa-online{ text-align: center;}
.pa-age{ text-align: center;}
.pa-mailagent{ text-align: center;}
.pa-reg { text-align: center;}
.pa-avatar, .pa-title, .pa-author { text-align: center;}
.pa-time-visit{ text-align: center;}
.pa-last-visit{ text-align: center;}
.pa-fld1{ text-align: center;}
.pa-fld2{ text-align: center;}
.pa-fld3{ text-align: center;}
</style>Поделиться923.03.2019 23:59:07
Код для картинки около статистики:
<style type="text/css">
#pun-stats ul.container {
background-image:url(ссылка на картинку); padding-left:80px; height : 192px; background-repeat: no-repeat}
</style>Поделиться1023.03.2019 23:59:41
Всё на форуме по центру:
<style>
HTML, BODY , #pun, #pun #pun-index #pun-main .category .container table thead tr .tcl, #pun-main .category .container table .hasicon .alt1 .tcl .intd .tclcon,
#pun-main .category .container table .hasicon .alt2 .tcl .intd .tclcon {text-align: center}
</style>Поделиться1124.03.2019 00:18:47
Переключение раскладки выделенного текста (Rus/Lat)
<!--Переключение раскладки выделенного текста -->
<style>#button-transL{background-image:url(http://uploads.ru/i/X/j/Z/XjZW7.png)}</style>
<script type="text/javascript">S='<img src="http://forum.mybb.ru/i/blank.gif" title="Lat↔ Русс" onclick="bbcode(\'[Lat-Rus]\',\'[/Rus-Lat]\');LatRus();"/>';
$("#button-font").after('<td id=button-transL>'+S+'</td>');var TxtTrans1='lat';
function LatRus(){if(TxtTrans1=='lat'){TxtTrans1='rus'}else{TxtTrans1='lat'};
lat0='qwertyuiopasdfghjkl;\'zxcvbnm\,QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>`~[].'.split('');
lat='qwertyuiopasdfghjkl;\'zxcvbnm\,QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>`~'.split('');
lat.push('\\[');lat.push('\\]');lat.push('\\.');
rus=('йцукенгшщзфывапролджэячсмитьбЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮёЁхъю').split('');
function transF(p){ar1=lat;ar2=rus;if(TxtTrans1=='lat'){ar2=lat0;ar1=rus}for(var i=0; i<ar1.length; i++){trans='/'+ar1[i]+'/g';p=p.replace(eval(trans), ar2[i])}return p;}L=$('#main-reply').val();L=L.replace(/\[Lat-Rus\]([\s\S]*)\[\/Rus-Lat\]/mg,function(a,b,c){return transF(b);});$('#main-reply').val(L);}
</script>Поделиться1227.03.2019 19:57:12
Удобный поиск по форуму с маркированием найденного контекста:
<!--Поиск-->
<style>
.splContR {
z-index:-1;
width:255px!important; /*ширина окна*/
height:auto; /*высота окна*/
border-radius: 22px;
background: rgba(250,214,165,.8);
background-clip: padding-box;
box-shadow: 3px 0 15px #D48D00 inset,-5px 4px 10px #D48D00!important;
top:-6px; /*отступ окна от верха кнопки*/
right:-7px; /*отступ окна от правого края монитора*/
padding:12px 40px 12px 21px!important;
color:#55271A; /*цвет шрифта*/
font: normal normal 400 12px/normal Georgia;
font-family:Georgia; /*шрифт*/
}
.splLinkR {
cursor:pointer;
}
.post-content span.mark{
background-color:#FFFE00;
}
</style>
<div id="seaDrom" style="position:fixed;right:8px;top:100px;z-index:100">
<img class=splLinkR title="Искать!" src="http://s6.uploads.ru/tCs8Q.png" width="38" border="0" onclick="PanelToggleR5($('form.splContR'))"/>
<form class=splContR data="0" style="position:absolute;margin-right:-360px" id="punbbsearch" method="get" action="/search.php">
<input type="hidden" name="action" value="search">
<input type="text" id="fld1s" name="keywords" size="30" placeholder=" Поиск по форуму " maxlength="100" oninput="$('form.splContR').addClass('active')" style="min-width:222px;margin-left:13px;padding:4px; box-shadow: -1px 1px 4px #D48D00 inset;">
</form></div>
<script type="text/javascript" src="http://forumstatic.ru/files/0010/b4/f8/88155.js"></script>Поделиться1327.03.2019 20:02:53
Автоматический перевод медиа-ссылок в контент при публикации (видео, музыка, изображения) как Вконтакте:
<!-- Автораспознавание ссылок -->
<script>
$('div.post-content p a[rel="nofollow"]').map(function(){
var link = $(this).attr('href');
var hrfstr = link.replace(/^.+?click.php\?/i,'');$(this).attr('href',hrfstr);
if(hrfstr.indexOf($(this).html().split(' … ')[0])==0){
if( /\.(?:gif|png|jpg)$/ig.test(hrfstr)){
$(this).html('<br><center><img src="'+hrfstr+'" style="max-width: 100%"></center>');
}
if(hrfstr.indexOf(".mp3")!= -1) {
$(this).replaceWith('<br /><embed src="http://forumstatic.ru/files/000f/5f/a4/48643.swf" type="application/x-shockwave-flash" allowscriptaccess="always" wmode="transparent" flashvars="comment=track&st=http://forumstatic.ru/files/000f/5f/a4/15057.txt&file='+hrfstr+'" width="400" height="25">' );
}
if(hrfstr.indexOf("youtu")!= -1) {
var End = hrfstr.slice(hrfstr.indexOf('?v=') +3);
$(this).replaceWith('<br /><center><iframe class="youtube-player" src="http://www.youtube.com/embed/'+End+'" frameborder="0" allowfullscreen="true" width="480" height="284"></iframe></center>');
}}
});
</script>