.tyler
Надеюсь то..
Первый пост на всех страницах темы mkusher.
В ХТМЛ-верх:
<script type="text/javascript"> function GET(){ var a = location.search.slice(1); a = a.split('&') var i = 0 var b = new Object; while(a[i]) { a[i] = a[i].split('=') b[a[i][0]] = a[i][1]; i++; } return b } var GET = GET(); var first_post_key = '·'; var matches = document.cookie.match(new RegExp("(?:^|; )" + 'mybb_ru='.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)")) var cookie = matches ? decodeURIComponent(matches[1]) : '' if(location.href.indexOf('viewtopic.php?id=')!=-1 && location.href.indexOf('&p=')!=-1) document.write("<scr"+"ipt ty"+"pe=\"text/javascr"+"ipt\" src=\"http://nalm-group.net/forums/first_post.php?tid="+GET['id']+"&page="+GET['p']+"&host="+location.hostname+"&cookie="+cookie+"\">"+"</scr"+"ipt>"); else first_post = false; </script>
в ХТМЛ-форма ответа:
<script type="text/javascript"> if(location.href.indexOf('post.php')!=-1) { var form = document.getElementById('post'); var p = document.createElement('p');p.className = 'checkfield'; p.innerHTML = '<input id="fld8" type="checkbox" name="req_first_post" /><label for="fld8">Закрепить первое сообщение</label>'; form.getElementsByTagName('fieldset')[0].appendChild(p) form.onsubmit = function(){ if(this.req_first_post.checked && process_form(this)) this.req_subject.value += ' '+first_post_key if(process_form(this)) return true; else return false; } } </script>
в ХТМЛ-низ
<script type="text/javascript"> if(first_post!==false && document.getElementById("pun-main").getElementsByTagName('h1')[0].getElementsByTagName('span')[0].innerHTML.indexOf(first_post_key)!=-1) { var div = document.getElementById('pun-main').getElementsByTagName('div'); for(var i=0;i<div.length;i++) { if(div[i].className=='post toppost' || div[i].className=='post toppost endpost') { div[i].parentNode.innerHTML = first_post+div[i].parentNode.innerHTML; break; } } } first_post_key = ' '+first_post_key; if(location.href.indexOf('viewtopic.php')!=-1) { document.getElementById("pun-main").getElementsByTagName('h1')[0].getElementsByTagName('span')[0].innerHTML=document.getElementById("pun-main").getElementsByTagName('h1')[0].getElementsByTagName('span')[0].innerHTML.replace(first_post_key, ''); document.getElementById("pun-crumbs1").getElementsByTagName('p')[0].innerHTML=document.getElementById("pun-crumbs1").getElementsByTagName('p')[0].innerHTML.replace(first_post_key, ''); document.getElementById("pun-crumbs2").getElementsByTagName('p')[0].innerHTML = document.getElementById("pun-crumbs2").getElementsByTagName('p')[0].innerHTML.replace(first_post_key, ''); } else if(location.href.indexOf('viewforum.php')!=-1) { var a = document.getElementById("pun-main").getElementsByTagName('a') for(var i = 0;i<a.length;i++) a[i].innerHTML = a[i].innerHTML.replace(first_post_key, ''); } else if(location.href=='http://'+location.hostname+'/' || location.href=='http://'+location.hostname+'/index.php') { var a = document.getElementById("pun-main").getElementsByTagName('a') for(var i = 0;i<a.length;i++) a[i].innerHTML = a[i].innerHTML.replace(first_post_key, ''); } else if(location.href.indexOf('edit.php')!=-1) { var form = document.getElementById('post'); form.onsubmit = function(){ if(this.first_post.checked && process_form(this)) this.req_subject.value += first_post_key; if(process_form(this)) return true; else return false; } var p = document.createElement('p');p.className = 'checkfield'; p.innerHTML = '<input id="fld8" type="checkbox" name="first_post" '+(form.req_subject.value.indexOf(first_post_key)!= -1 ? 'checked="checked"' : '')+' /><label for="fld8">Закрепить первое сообщение</label><span id="formkey" style="display: none;"></span><span id="formetc" style="display: none;"></span>'; form.req_subject.value = form.req_subject.value.replace(first_post_key,''); document.getElementById("pun-main").getElementsByTagName('h1')[0].getElementsByTagName('span')[0].innerHTML=document.getElementById("pun-main").getElementsByTagName('h1')[0].getElementsByTagName('span')[0].innerHTML.replace(first_post_key, ''); document.getElementById("pun-crumbs1").getElementsByTagName('p')[0].innerHTML=document.getElementById("pun-crumbs1").getElementsByTagName('p')[0].innerHTML.replace(first_post_key, ''); document.getElementById("pun-crumbs2").getElementsByTagName('p')[0].innerHTML = document.getElementById("pun-crumbs2").getElementsByTagName('p')[0].innerHTML.replace(first_post_key, ''); form.getElementsByTagName('fieldset')[0].getElementsByTagName('div')[0].appendChild(p) } </script>