Javascript-форум (https://javascript.ru/forum/)
-   Общие вопросы Javascript (https://javascript.ru/forum/misc/)
-   -   Проблема с скриптом слайда (https://javascript.ru/forum/misc/57939-problema-s-skriptom-slajjda.html)

maxville 27.08.2015 04:21

Проблема с скриптом слайда
 
Доброй ночи, товарищи

На сайте по адресу russiancfg.ru находится первая страничка форума. В верхней части которого есть блок игрового мониторинга. При нажатии вроде как на любую область, кроме столбика адрес должно выдвигаться слайдом вниз область в которой отображается список играющих на сервере игроков включая их ники, фраги и прочее.

Но вот почему-то при этом нажатии ничего не происходит. Если посмотреть через код элемента, то в консоли высвечивается ошибка связанная с скриптиком monitoring.js его содержимое ниже:

// JavaScript Document
document.observe("dom:loaded", function() {
a='0'; });
function slide(element) {
if ($(element).empty()==false) {
if (a!='1') {    
a='1';
if (Element.visible(element)) {
$('p'+element).update('<img src=\'lgsl/img/add.png\' alt=\'Развернуть\'>');
new Effect.SlideUp(element, {duration:0.4}); } 
else { 
$('p'+element).update('<img src=\'lgsl/img/del.png\' alt=\'Свернуть\'>');
new Effect.SlideDown(element, {duration:0.4});}
setTimeout(function() { a='0'; }, 400);
}}}


на страничке ругается на 2-ю строку.

Нашел на просторах интернета вторую версию этого мониторинга, и там немного другое содержимое этого скрипта:

$(document).ready (function() {

a='0'; });
function slide(element) {
if ($(element).empty()==false) {
if (a!='1') {    
a='1';
if (Element.visible(element)) {
$('p'+element).update('<img src=\'lgsl/img/add.png\' alt=\'Развернуть\'>');
new Effect.SlideUp(element, {duration:0.4}); } 
else { 
$('p'+element).update('<img src=\'lgsl/img/del.png\' alt=\'Свернуть\'>');
new Effect.SlideDown(element, {duration:0.4});}
setTimeout(function() { a='0'; }, 400);
}

}};


С этим скриптом ошибки нет, но и так же ничего не работает. Если смотреть всё так же через код элемента то там видно что таблица из списка игроков есть, но вот на сайте при нажатии на блок мониторинга ничего так и не отображается. Возможно проблема решается очень просто и кто-то из профи сразу заметит в чём проблема и даст подсказку на что я очень надеюсь.

maxville 27.08.2015 04:21

Как я понял за то что должно выводиться отвечает php файлик:

<?php

//------------------------------------------------------------------------------------------------------------+

  require "lgsl_class.php";

  $server_list = lgsl_query_group();
  $server_list = lgsl_sort_servers($server_list);

//------------------------------------------------------------------------------------------------------------+

  $output .= "
  <style>
  .title{
	position:relative;
	z-index:1;
	zoom:1;
	
}
.title em{display:none;}
.title:hover em{
	display:block;
	position:absolute;
	z-index:1;
 	background-color:#000;
 	-webkit-border-radius:5px; 
 	-moz-border-radius:5px;
 	border-radius:5px;
	line-height:normal;
	color:#FFF;
	text-decoration:none;
	padding:3px 5px;
	bottom:22px;
	right:0;
	-webkit-box-shadow:0 0 5px #000; 
	-moz-box-shadow:0 0 5px #000;
	box-shadow:0 0 5px #000;
}
.title:hover em i{
	position:absolute;
	z-index:1;
	bottom:-7px;
	right:5px;
	border-top:7px solid #000;
	border-left:7px solid transparent;
	_border-left:7px solid #FDEFC6; 
	display:block;
	height:0;
	overflow:hidden;
}
.status-on {
background:#7BA60D url({$siteurl}lgsl/lgsl_files/bg-maintitle.png) repeat-x center left;
border: 1px solid #689E07;
text-shadow: -1px -1px 0 #689E07;
}
.status-off {
background:#BF1D00 url({$siteurl}lgsl/lgsl_files/bg-maintitle.png) repeat-x center left;
border: 1px solid #B00303;
text-shadow: -1px -1px 0 #B00303;
}
.status {
padding: 2px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.status {
font-size: 10.998px;
font-weight: bold;
line-height: 14px;
color: white;
white-space: nowrap;
vertical-align: baseline;
}
  .mtbl, .players{
 width:100%;
 border:1px solid #black;
 border-radius:3px;
-moz-border-radius:5px;
-webkit-border-radius:4px;
}
 .mtd, .mttl , .mtdl, .mtdp{
 text-align:center;
 height:23px;
 font-family:Verdana, Arial, Helvetica, sans-serif;
 font-size:11px; padding:5px;
}
 .mtd , .mtdl{
 border-right:1px solid rgb(52, 52, 52);
 border-top:1px solid rgb(52, 52, 52);
 }
 .mtdl{
 border-right:none;
}
 .mttl{
	background: #2b2c32;
	color: #a8a8aa;
	padding: 12px;
	font-size: 12px;
	font-weight: 700;
	-moz-border-radius: 1px;
	-webkit-border-radius: 1px;
	border-radius: 1px;
	-webkit-box-shadow: inset #778594 0px 1px 2px;
	-moz-box-shadow: inset #778594 0px 1px 2px;
	box-shadow: inset #778594 0px 1px 2px;
	overflow: hidden;
	margin-bottom: 2px;height:0px;
}
.mtdp{
 border-top:1px solid rgb(52, 52, 52);
}
 .topframe {
 border :#a6a6a6 1px solid;
 margin:0px;
 padding:0px;
 width:100%;
 height:110px;
}


.conn {
	width: 23px;
	height: 18px;
	background: url('{$siteurl}lgsl/img/conn_off.png') no-repeat;
	margin: 0px 0px 0px 0px;
	padding: 0px 0px 0px 0px;
}

.conn:hover{
	background: url('{$siteurl}lgsl/img/conn_on.png') no-repeat; 
}

#screenshot {
	background-color:#FFFFFF; 
	filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#ffffff',EndColorStr='#cbcaca');
	margin: 0;
	padding: 8px;
	position: absolute;
	border: 1px solid #e1e1e1;
	display: none;
	z-index: 200;
}
</style>
  
  
  
<script type=\"text/javascript\" src=\"{$siteurl}lgsl/monitoring.js\"></script>

 
 <div class='ipsLayout_content clearfix'>
				<div class='category_block block_wrap'>
						<h3 class='maintitle'>
							Наши серверы
						</h3>
 
<table class=\"mtbl\" class=\"moni\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
<tr class=\"mttl\">
<td></td>
<td>Статус</td>";
if ($lgsl_config['locations'])
        {
          $output .= "
		  <td></td>";
        }	
$output .= "		
<td>Адрес</td>
<td></td>
<td>Название</td>
<td>Карта</td>
<td>Игроки</td>
</tr>



";

    foreach ($server_list as $server)
    {
      $misc   = lgsl_server_misc($server);
      $server = lgsl_server_html($server);

      $output .= "
			
			<tr onclick=\"slide('r{$server['o']['id']}');\" style=\"cursor: pointer;\">
			
			<td class=\"mtd\">
			<center>
						<img src='{$misc['icon_game']}' style='vertical-align:middle alt='' data-tooltip='сервер Counter-Strike 1.6'/>
					</center>
			
			</td>
			
			<td	class=\"mtd\">
			
			";
if ($misc['icon_status'] == "{$siteurl}lgsl/lgsl_files/other/icon_online.gif")
{
$class = 'status-on';
$tooltip ='Сервер включен :)';
$statusserv = '  OnLine  ';
}
else
{
$class = 'status-off';
$tooltip ='Сервер выключен :(';
$statusserv = '  OffLine  ';
}

$output .= "
				
					<center>
						<div class='status {$class}' data-tooltip='{$tooltip}'>
							<nobr>
								{$statusserv}
							</nobr>
						</div>
					</center>
			
			</td>";
			
				if ($lgsl_config['locations'])
        {
          $output .= "
		  <td	class=\"mtd\">
          <a href='".lgsl_location_link($server['o']['location'])."' style='text-decoration:none'>
            <img alt='' src='{$misc['icon_location']}' style='vertical-align:middle; border:none' />
          </a>
		  </td>";
        }		
			$output .= "
			<td class=\"mtd\">
			
			<a href='{$misc['software_link']}' style='text-decoration:none' data-tooltip='conntect to server'>
						<nobr>
							{$server['b']['ip']}:{$server['b']['c_port']}
						</nobr>
					</a>
			
			</td>
			<td class=\"mtdp\" id='pr{$server['o']['id']}'>
			
			<img src=\"{$siteurl}lgsl/img/add.png\" alt=\"Развернуть\">
			
			</td>
			<td class=\"mtd\"><nobr>
							{$misc['name_filtered']}
						</nobr></td>
			<td class=\"mtd\"><center><span class='title'>{$server['s']['map']}<em>
			<img alt='' src='{$misc['image_map']}' style='vertical-align:middle' /></em></span></center></td>
			
			<td class=\"mtdl\">
			
			";
	 
$p = round(($server['s']['players']/$server['s']['playersmax']) * 100);
if ($misc['icon_status'] == "{$siteurl}lgsl/lgsl_files/other/icon_no_response.gif")
{
$playern = "Смена карты";
$color='#4C4B53';
$padd='0';
$p='0';
}
else
{
$playern = "<font color='#FFF'>{$server['s']['players']} / {$server['s']['playersmax']}</font>";
$padd='2';
$color ='#C6D8E9';
$tscolor ='#7EC0EE';
$bgcolor='#87ADD1';
$tsbgcolor='#5CACEE';

if(($p == 0) && ($misc['icon_status'] !== "{$siteurl}lgsl/lgsl_files/other/icon_no_response.gif"))
{
$padd='0';
}
}			 
					 
		$output .= "	 
					
						<div style='
							background: {$color} url({$siteurl}lgsl/lgsl_files/bg-maintitle.png) repeat-x center left;
							width: {$p}%;
							border-radius: 4px;
							border: 1px solid {$bgcolor};
							overflow: hidden;
							padding: {$padd}px;
							margin-left: -2px;'>
								&nbsp;
						</div>
						
						<div style='margin-top: -18px;'>
							
								<nobr>
									{$playern}
								</nobr>
							
						</div>
 						
					
			
			</td>
			</tr>
			
			<tr class=\"mttl\">";
				if ($lgsl_config['locations'])
        {
          $output .= "
		  <td style=\"padding:0px; \" align=\"center\" colspan=\"8\">";
        }
		else
		{
		$output .= "
		  <td style=\"padding:0px; \" align=\"center\" colspan=\"7\">";
		}
		$output .= "
			
			
			<div id=\"r{$server['o']['id']}\" style=\"display:none; border-top:#a1a1a1 1px solid; padding:3px;\">";
			if ($server['s']['players'] !== 0){
			$heightsub = 27 + 22*$server['s']['players'] ;
			}
			else
			{
			$heightsub = 15;
			}
			$output .= "
			<iframe src='{$siteurl}lgsl/mon.php?s={$server['o']['id']}' width='100%' frameborder='0' height='{$heightsub}px'></iframe>	
			
			</div>
			</td>
			</tr>
			
			
	";
    }

  if ($lgsl_config['list']['totals'])
  {
    $total = lgsl_group_totals($server_list);

    $output .= "
        <tr class=\"mttl\">";
			if ($lgsl_config['locations'])
        {
          $output .= "
		  <td colspan='6'></td>";
        }
		else
		{
		$output .= "
		  <td colspan='5'></td>";
		}
		$output .= "
		<td align='center'>Всего игроков:</td>
		<td align='center'>{$total['players']}/{$total['playersmax']}</td>
        </tr>
      ";
  }
//------------------------------------------------------------------------------------------------------------+


  $output .= "
    </table></div></div>&nbsp;<br>
  ";


Часовой пояс GMT +3, время: 10:03.