помогите вмонтировать код в скрипт

Sportmas
На сайте с 20.08.2008
Offline
271
1226

Очень долго искал как сделать, что бы при переходе по "поиску яндекс для сайта" при переходе внутри фрейма обновлялась вся страница сайта, в результате админ яндекс кинул следующей код который необходимо вставить:

$(function() {

$('#ya-site-results').delegate('.b-link_type_htmlcss', 'click', function(e) {

location.reload();

});

});

У меня настраница на сайте, в ней код поиска:

<div id="ya-site-results" onclick="return {'tld': 'ru','language': 'ru','encoding': ''}"></div><script type="text/javascript">(function(w,d,c){var s=d.createElement('script'),h=d.getElementsByTagName('script')[0];s.type='text/javascript';s.async=true;s.charset='utf-8';s.src=(d.location.protocol==='https:'?'https:':'http:')+'//site.yandex.net/v2.0/js/all.js';h.parentNode.insertBefore(s,h);(w[c]||(w[c]=[])).push(function(){Ya.Site.Results.init();})})(window,document,'yandex_site_callbacks');</script>

И куда вставлять те строки, и вообще код их может кривой, я вставлял и вначало и вконец, страница .php помогите плииз советом что не так. Можно ещё код поиска такой применять:

<div id="ya-site-results" onclick="return {'tld': 'ru','language': 'ru','encoding': '','htmlcss': '1.x','updatehash': false}"></div><script type="text/javascript">(function(w,d,c){var s=d.createElement('script'),h=d.getElementsByTagName('script')[0];s.type='text/javascript';s.async=true;s.charset='utf-8';s.src=(d.location.protocol==='https:'?'https:':'http:')+'//site.yandex.net/v2.0/js/all.js';h.parentNode.insertBefore(s,h);(w[c]||(w[c]=[])).push(function(){Ya.Site.Results.init();})})(window,document,'yandex_site_callbacks');</script>

<style>
#ya-site-results
{
color: #000000;
background: #FFFFFF;
}

#ya-site-results .b-pager__current,
#ya-site-results .b-serp-item__number
{
color: #000000 !important;
}

#ya-site-results
{
font-family: Arial !important;
}

#ya-site-results :visited,
#ya-site-results .b-pager :visited,
#ya-site-results .b-foot__link:visited,
#ya-site-results .b-copyright__link:visited
{
color: #999999;
}

#ya-site-results a:link,
#ya-site-results a:active,
#ya-site-results .b-pseudo-link,
#ya-site-results .b-head-tabs__link,
#ya-site-results .b-head-tabs__link:link,
#ya-site-results .b-head-tabs__link:visited,
#ya-site-results .b-dropdown__list .b-pseudo-link,
#ya-site-results .b-dropdowna__switcher .b-pseudo-link,
.b-popupa .b-popupa__content .b-menu__item,
#ya-site-results .b-foot__link:link,
#ya-site-results .b-copyright__link:link,
#ya-site-results .b-serp-item__mime,
#ya-site-results .b-pager :link
{
color: #ff0000;
}

#ya-site-results :link:hover,
#ya-site-results :visited:hover,
#ya-site-results .b-pseudo-link:hover
{
color: #FF0000 !important;
}

#ya-site-results .l-page,
#ya-site-results .b-bottom-wizard
{
font-size: 13px;
}

#ya-site-results .b-pager
{
font-size: 1.25em;
}

#ya-site-results .b-serp-item__text,
#ya-site-results .ad
{
font-style: normal;
font-weight: normal;
}

#ya-site-results .b-serp-item__title-link,
#ya-site-results .ad .ad-link
{
font-style: normal;
font-weight: normal;
}

#ya-site-results .ad .ad-link a
{
font-weight: bold;
}

#ya-site-results .b-serp-item__title,
#ya-site-results .ad .ad-link
{
font-size: 16px;
}

#ya-site-results .b-serp-item__title-link:link,
#ya-site-results .b-serp-item__title-link
{
font-size: 1em;
}

#ya-site-results .b-serp-item__number
{
font-size: 13px;
}

#ya-site-results .ad .ad-link a
{
font-size: 0.88em;
}

#ya-site-results .b-serp-url,
#ya-site-results .b-direct .url,
#ya-site-results .b-direct .url a:link,
#ya-site-results .b-direct .url a:visited
{
font-size: 13px;
font-style: normal;
font-weight: normal;
color: #000000;
}

#ya-site-results .b-serp-item__links-link
{
font-size: 13px;
font-style: normal;
font-weight: normal;
color: #000000 !important;
}

#ya-site-results .b-pager__inactive,
#ya-site-results .b-serp-item__from,
#ya-site-results .b-direct__head-link,
#ya-site-results .b-image__title,
#ya-site-results .b-video__title
{
color: #000000 !important;
}

#ya-site-results .b-pager__current,
#ya-site-results .b-pager__select
{
background: #ffffff;
}

#ya-site-results .b-foot,
#ya-site-results .b-line
{
border-top-color: #ffffff;
}

#ya-site-results .b-dropdown__popup .b-dropdown__list,
.b-popupa .b-popupa__content
{
background-color: #FFFFFF;
}

.b-popupa .b-popupa__tail
{
border-color: #ffffff transparent;
}

.b-popupa .b-popupa__tail-i
{
border-color: #FFFFFF transparent;
}

.b-popupa_direction_left.b-popupa_theme_ffffff .b-popupa__tail-i,
.b-popupa_direction_right.b-popupa_theme_ffffff .b-popupa__tail-i
{
border-color: transparent #FFFFFF;
}

#ya-site-results .b-dropdowna__popup .b-menu_preset_vmenu .b-menu__separator
{
border-color: #ffffff;
}

.b-specification-list,
.b-specification-list .b-pseudo-link,
.b-specification-item__content label,
.b-specification-item__content .b-link,
.b-specification-list .b-specification-list__reset .b-link
{
color: #000000 !important;
font-family: Arial;
font-size: 13px;
font-style: normal;
font-weight: normal;
}

.b-specification-item__content .b-calendar__title
{
font-family: Arial;
color: #000000;
font-size: 13px;
font-style: normal;
font-weight: normal;
}

.b-specification-item__content .b-calendar-month__day_now_yes
{
color: #ffffff;
}

.b-specification-item__content .b-calendar .b-pseudo-link
{
color: #000000;
}

.b-specification-item__content
{
font-family: Arial !important;
font-size: 13px;
}

.b-specification-item__content :visited
{
color: #999999;
}

.b-specification-item__content .b-pseudo-link:hover,
.b-specification-item__content :visited:hover
{
color: #FF0000 !important;
}

#ya-site-results .b-popupa .b-popupa__tail-i
{
background: #FFFFFF;
border-color: #ffffff !important;
}
</style>

Но тут тоже я не нашёл к чему привязывать.

T
На сайте с 10.01.2010
Offline
37
#1

Между тегами <head>

<head>

<script>

Код

</script>

</head>

Или в отдельный фаил js

Sportmas
На сайте с 20.08.2008
Offline
271
#2

Не работают оба варианта с пропиской в голову и в отдельный файл, что ещё можно попробовать?

totamon
На сайте с 12.05.2007
Offline
437
#3
Sportmas:
Не работают оба варианта с пропиской в голову и в отдельный файл, что ещё можно попробовать?

а jquery то подключен на странице?

Домены и хостинг https://8fn.ru/regru | Дедик от 3000р https://8fn.ru/73 | VPS в Москве https://8fn.ru/72 | Лучшие ВПС, ТП огонь, все страны! https://8fn.ru/inferno | ХОСТИНГ №1 РОССИИ https://8fn.ru/beget
Sportmas
На сайте с 20.08.2008
Offline
271
#4

как узнать?

я не силён в php

Sportmas
На сайте с 20.08.2008
Offline
271
#5

На мой вопрос ответа нет?

totamon
На сайте с 12.05.2007
Offline
437
#6

ссылка на пациента бы помогла...

надо в хедере подключить jquery, чтобы код

$(function() {
$('#ya-site-results').delegate('.b-link_type_htmlcss', 'click', function(e) {
location.reload();
});
});

работал, типа

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
Sportmas
На сайте с 20.08.2008
Offline
271
#7

Пациент: center-yf.ru

Что хочу полный вопрос: http://clubs.ya.ru/sitesearch/replies.xml?item_no=2427

totamon
На сайте с 12.05.2007
Offline
437
#8

попробуйте вставить в шаблон между тегами <head> </head> под строкой

<link rel="canonical" href="http://center-yf.ru/index.php">

 

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
$('#ya-site-results').delegate('.b-link_type_htmlcss', 'click', function(e) {
location.reload();
});
});
</script>
Sportmas
На сайте с 20.08.2008
Offline
271
#9

Всё равно не обновляет

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий