Переход на пост автора по клику на ник в цитате (Deff, Alex_63)
HTML-низ
Возможно, кто-то захочет сделать поправки к cтилю Ника в Цитате. HTML-верх:
*Значения Красным - меняем на свои.
Модификация:
В HTML-низ
Дополнение:
В HTML-низ
Код
<!-- Цитата: переход на пост Автора по Клику на Ник -->
<script type="text/javascript">
$(".post-content .quote-box cite:contains('#p')").each(function (){
var b=$(this).text();var c=b.replace(/^#p[\d?]*,/,"");
if(b!=c){b=b.replace(','+c,'');c=(b+b).replace("#p","")+'">'+c+'</a>';
$(this).html('<a href="/viewtopic.php?pid='+c+'');};});
$(".post").each(function (){
var b='#'+$(this).attr("id");
pp=$(this).find("li.pl-quote");if(pp.html()!==null){
pp.html(pp.html().replace("ipt:quote('","ipt:quote('"+b+","))};});
</script><!--//End//Переход по клику на Ник-->
<script type="text/javascript">
$(".post-content .quote-box cite:contains('#p')").each(function (){
var b=$(this).text();var c=b.replace(/^#p[\d?]*,/,"");
if(b!=c){b=b.replace(','+c,'');c=(b+b).replace("#p","")+'">'+c+'</a>';
$(this).html('<a href="/viewtopic.php?pid='+c+'');};});
$(".post").each(function (){
var b='#'+$(this).attr("id");
pp=$(this).find("li.pl-quote");if(pp.html()!==null){
pp.html(pp.html().replace("ipt:quote('","ipt:quote('"+b+","))};});
</script><!--//End//Переход по клику на Ник-->
Возможно, кто-то захочет сделать поправки к cтилю Ника в Цитате. HTML-верх:
Цитата
<style>
.quote-box cite a{text-decoration:none!important;color:#FF0000!important;}
.quote-box cite a:hover{text-decoration:underline!important;color:#0000FF!important;}
</style>
.quote-box cite a{text-decoration:none!important;color:#FF0000!important;}
.quote-box cite a:hover{text-decoration:underline!important;color:#0000FF!important;}
</style>
*Значения Красным - меняем на свои.
Модификация:
Ccылка на авторский пост в цитате © Alex_63
Если цитируемый пост находится на текущей странице, переход на него через клик по ссылке в цитате происходит без перезагрузки страницы.
Если цитируемый пост находится на текущей странице, переход на него через клик по ссылке в цитате происходит без перезагрузки страницы.
В HTML-низ
Код
<!-- Ссылка на авторский пост в цитате // v.3 © Alex_63 -->
<script type="text/javascript">
$('.quote-box>cite:contains("#")').each(function() {
var cntq = $(this).text(), pid = cntq.split(',')[0], lnkq = '<a class="qc-post-link" href="';
if($('.post'+pid).length){$(this).html(lnkq+pid+'">'+cntq.split(',')[1]+'</a>');}
else{$(this).html(lnkq+'/viewtopic.php?pid='+pid.split('#p')[1]+pid+'">'+cntq.split(',')[1]+'</a>');}
});$('#pun-viewtopic .pl-quote>a').each(function() {
$(this).attr('href',$(this).attr('href').replace('(\'','(\'#'+$(this).parents('.post').attr('id')+','));
});
</script>
<script type="text/javascript">
$('.quote-box>cite:contains("#")').each(function() {
var cntq = $(this).text(), pid = cntq.split(',')[0], lnkq = '<a class="qc-post-link" href="';
if($('.post'+pid).length){$(this).html(lnkq+pid+'">'+cntq.split(',')[1]+'</a>');}
else{$(this).html(lnkq+'/viewtopic.php?pid='+pid.split('#p')[1]+pid+'">'+cntq.split(',')[1]+'</a>');}
});$('#pun-viewtopic .pl-quote>a').each(function() {
$(this).attr('href',$(this).attr('href').replace('(\'','(\'#'+$(this).parents('.post').attr('id')+','));
});
</script>
Дополнение:
Вариант с добавлением ссылки картинкой
В HTML-низ
Цитата
<!-- Ссылка на авторский пост в цитате // v.3 © Alex_63 -->
<script type="text/javascript">
var quote_img = 'http://dundel.ruhelp.com/files/0015/ec/20/41408.png'; //Кнопка "Перейти к сообщению" в цитате
$('.quote-box>cite').each(function() {
var cntq=$(this).text(),sp0='<span class="qcn">Сообщение от</span> ',
sp1='<span class="qc-uname">###</span>';
if(cntq.indexOf('#p')!=-1){var pid=cntq.split(',')[0],autq=cntq.split(',')[1].split(' написал')[0],
lnkq='<a class="qc-post-link" href="',imgq='<img src="'+quote_img+'" title="Перейти к сообщению"/>',
sp2=' <span class="qc-post-link">'+lnkq;sp1=sp1.replace('###',autq);
if($('.post'+pid).length){$(this).html(sp0+sp1+sp2+pid+'">'+imgq+'</a></span>');}else
{$(this).html(sp0+sp1+sp2+'/viewtopic.php?pid='+pid.split('#p')[1]+pid+'">'+imgq+'</a></span>');}
}else{var autq=cntq.split(' написал')[0];sp1=sp1.replace('###',autq);$(this).html(sp0+sp1);}
});$('#pun-viewtopic .pl-quote>a').each(function() {
$(this).attr('href',$(this).attr('href').replace('(\'','(\'#'+$(this).parents('.post').attr('id')+','));
});
</script>
<script type="text/javascript">
var quote_img = 'http://dundel.ruhelp.com/files/0015/ec/20/41408.png'; //Кнопка "Перейти к сообщению" в цитате
$('.quote-box>cite').each(function() {
var cntq=$(this).text(),sp0='<span class="qcn">Сообщение от</span> ',
sp1='<span class="qc-uname">###</span>';
if(cntq.indexOf('#p')!=-1){var pid=cntq.split(',')[0],autq=cntq.split(',')[1].split(' написал')[0],
lnkq='<a class="qc-post-link" href="',imgq='<img src="'+quote_img+'" title="Перейти к сообщению"/>',
sp2=' <span class="qc-post-link">'+lnkq;sp1=sp1.replace('###',autq);
if($('.post'+pid).length){$(this).html(sp0+sp1+sp2+pid+'">'+imgq+'</a></span>');}else
{$(this).html(sp0+sp1+sp2+'/viewtopic.php?pid='+pid.split('#p')[1]+pid+'">'+imgq+'</a></span>');}
}else{var autq=cntq.split(' написал')[0];sp1=sp1.replace('###',autq);$(this).html(sp0+sp1);}
});$('#pun-viewtopic .pl-quote>a').each(function() {
$(this).attr('href',$(this).attr('href').replace('(\'','(\'#'+$(this).parents('.post').attr('id')+','));
});
</script>
Просмотров: 894, Загрузок: 21, Комментарии: 6, Оценка: 5.0 (1)
Страницы: | |