- Poprawiono interpretowanie pierwszego i ostatniego zdjęcia

- Zmieniono stronnicowanie
- Dodano buttony oraz przykładowe zdjęcia do testów skryptu
- Prowadzono 2 nowe pliki: functions.php - z funkcjami oraz config.php - konfiguracją
- Wprowadzono mniej ważne poprawki

git-svn-id: https://svn.pioder.pl/sg-svn@7 3ed2631f-fe0d-47e0-9194-a46bc0f18ee8
This commit is contained in:
pioder
2009-06-16 11:52:07 +00:00
parent 239589a41d
commit 04fdaa4ab6
31 changed files with 623 additions and 329 deletions

View File

@@ -1,20 +1,52 @@
<?php <?php
$i=intval($_GET['name'])+1; /**
require('init.php'); * @package Galeria Suczawa 2009
$result = mysql_query('SELECT * FROM photos WHERE id='.$i); * @file ask.php
$row = mysql_fetch_assoc($result); * @version $Id$
* @author chp1994 <chp1994@gmail.com>
if(!row) die('Error'); * @link http://suczawa.ath.cx/
**/
header('Content-Type: text/xml');
echo '<?xml version="1.0" encoding="utf-8"?>'; $i=intval($_GET['name']);
?> require('./init.php');
if ($i == 0)
<data> {
<name><?=$row['id']?>: <?=basename($row['photo_name'])?></name> blad('Zdjecie nie istnieje!');
<desc xmlns="http://www.w3.org/1999/xhtml"><p><?=$row['description']?></p></desc> }
<src><?=$row['photo_name']?></src> $sql = "SELECT * FROM `photos` WHERE `id`='$i'";
<author><?=$row['author']?></author> if (!$result = $DB->query($sql))
<?if($i==$count){?><last /><? } ?> {
<?if($i==0){?><first /><? } ?> blad('Nie mozna pobrac informacji o zdjeciu!');
</data> }
#sprawdź, czy zdjęcie istnieje
$cnt = $result->num_rows;
if ($result->num_rows == 0)
{
$row = array(
'author' => '--',
'description' => 'Zdjęcie usunięte',
'photo_name' => 'no_image.png',
'id' => $i
);
}
else
{
$row = $result->fetch_assoc();
$row['author'] = ($row['author']=='') ? 'Autor nieznany' : $row['author'];
$row['description'] = ($row['description']=='') ? 'Brak opisu' : $row['description'];
}
header('Content-Type: text/xml');
echo '<?xml version="1.0" encoding="utf-8"?>';
?>
<data>
<name><?=$row['id']?>: <?=basename($row['photo_name'])?></name>
<desc xmlns="http://www.w3.org/1999/xhtml"><p><?=$row['description']?></p></desc>
<src><?=$row['photo_name']?></src>
<author><?= $row['author']; ?></author>
<?if($i==$lastid){?><last /><? } ?>
<?if($i==$firstid){?><first /><? } ?>
</data>

17
robocze/config.php Normal file
View File

@@ -0,0 +1,17 @@
<?
/**
* @package Galeria Suczawa 2009
* @file config.php
* @version $Id$
* @author PioDer <pioder@wp.pl>
* @link http://suczawa.ath.cx/
**/
define('DB_HOST','localhost');
define('DB_USER','root');
define('DB_PASS','');
define('DB_NAME','galeria');
//liczba zdjęć na stronę
$per_page=3;
?>

64
robocze/dump.txt Normal file
View File

@@ -0,0 +1,64 @@
-- phpMyAdmin SQL Dump
-- version 3.1.3.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Czas wygenerowania: 16 Cze 2009, 12:36
-- Wersja serwera: 5.1.33
-- Wersja PHP: 5.2.9
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Baza danych: `galeria`
--
-- --------------------------------------------------------
--
-- Struktura tabeli dla `admins`
--
CREATE TABLE IF NOT EXISTS `admins` (
`id` smallint(1) NOT NULL,
`nick` varchar(20) NOT NULL,
`password` varchar(200) NOT NULL,
`email` varchar(20) NOT NULL,
`IP` varchar(14) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Zrzut danych tabeli `admins`
--
-- --------------------------------------------------------
--
-- Struktura tabeli dla `photos`
--
CREATE TABLE IF NOT EXISTS `photos` (
`id` smallint(4) NOT NULL,
`thumb_name` varchar(20) NOT NULL,
`photo_name` varchar(20) NOT NULL,
`author` varchar(30) NOT NULL,
`description` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Zrzut danych tabeli `photos`
--
INSERT INTO `photos` (`id`, `thumb_name`, `photo_name`, `author`, `description`) VALUES
(1, 'DSC_0026_m.png', 'DSC_0026.png', '', 'Pod zamkiem - grupowo'),
(2, 'DSC_0132_m.png', 'DSC_0132.png', '', 'Pod szko³¹'),
(3, 'DSC_0169_m.png', 'DSC_0169.png', '', 'Widoki na Monastyr'),
(4, 'DSC_0294_m.png', 'DSC_0294.png', '', 'Bukowina Po³udniowa'),
(5, 'DSC_0378_m.png', 'DSC_0378.png', '', 'Pani Monika :)'),
(6, 'DSC_0080_m.png', 'DSC_0080.png', '', 'Nasz Geniusz podczas rozdawania nagród ;)'),
(7, 'DSC_0672_m.png', 'DSC_0672.png', '', 'W¹wóz...'),
(8, 'DSCF0372_m.png', 'DSCF0372.png', '', 'Œwi¹tynia w Monastyrze'),
(9, 'DSCF0452_m.png', 'DSCF0452.png', '', 'Kolejna fotka z w¹wozu.');

67
robocze/functions.php Normal file
View File

@@ -0,0 +1,67 @@
<?
/**
* @package Galeria Suczawa 2009
* @file functions.php
* @version $Id$
* @author PioDer <pioder@wp.pl>
* @link http://suczawa.ath.cx/
**/
#wyświetl błąd
function blad($msg)
{
die('
<h1>Blad Galerii Zdjec Suczawa 2009!</h1>
<span style="color: red; font-weight: bold; font-size: 12pt">'.$msg.'</span>');
}
function GenerujListeStron()
{
global $cnt;
global $page;
$content = '';
if ($page>1)
{
$content .= '<a href="?page=1" title="Pierwsza strona">&lt;&lt;</a>';
$content .= '&nbsp;&nbsp;<a href="?page='.($page-1).'" title="Poprzednia strona">&lt;</a> ';
}
#wygeneruj strony
for ($i=1;$i<=$cnt;$i++)
{
if ($i==$page)
{
if ($i == $cnt)
{
$content .= '<span style="text-decoration: underline">'.$i.'</span>';
}
else
{
$content .= '<span style="text-decoration: underline">'.$i.'</span>'.' | ';
}
}
else
{
if ($i == $cnt)
{
$content .= '<a href="?page='.$i.'">'.$i.'</a> ';
}
else
{
$content .= '<a href="?page='.$i.'">'.$i.'</a> | ';
}
}
}
#dodaj linka "+1 strona" oraz do ostatniej
if ($page<$cnt)
{
$content .= '<a href="?page='.($page+1).'" title="Następna strona">&gt;</a>';
$content .= '&nbsp;&nbsp;<a href="?page='.$cnt.'" title="Ostatnia strona">&gt;&gt;</a>';
}
#dodaj linka do ostatniej strony
echo $content;
}
?>

View File

@@ -1,75 +1,90 @@
<?php <?php
$page=(isset($_GET['page']))?intval($_GET['page']):0; /**
$xhtml = preg_match('/application\/xhtml\+xml(?![+a-z])(;q=(0\.\d{1,3}|[01]))?/i', * @package Galeria Suczawa 2009
$_SERVER['HTTP_ACCEPT'], $xhtml) && (isset($xhtml[2])?$xhtml[2]:1) > 0 || * @file gallery.php
strpos($_SERVER["HTTP_USER_AGENT"], "W3C_Validator")!==false || * @version $Id$
strpos($_SERVER["HTTP_USER_AGENT"], "WebKit")!==false; * @author chp1994 <chp1994@gmail.com>
header('Content-Type: '.($xhtml?'application/xhtml+x':'text/ht').'ml; charset="utf-8"'); * @link http://suczawa.ath.cx/
require('init.php'); **/
echo '<?xml version="1.0" encoding="utf-8"?>'
?> $page= (isset($_GET['page'])) ? intval($_GET['page']) : 0;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> $xhtml = preg_match('/application\/xhtml\+xml(?![+a-z])(;q=(0\.\d{1,3}|[01]))?/i',
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl"> $_SERVER['HTTP_ACCEPT'], $xhtml) && (isset($xhtml[2])?$xhtml[2]:1) > 0 ||
<head> strpos($_SERVER["HTTP_USER_AGENT"], "W3C_Validator")!==false ||
<title>Galeria</title> strpos($_SERVER["HTTP_USER_AGENT"], "WebKit")!==false;
<link type="text/css" href="style.css" rel="stylesheet" /> header('Content-Type: '.($xhtml ? 'application/xhtml+x' : 'text/ht').'ml; charset="utf-8"');
<script type="text/javascript" src="script.js"></script>
</head> require('./init.php');
<body onload="javascipt:init()">
<div id="page"> echo '<?xml version="1.0" encoding="utf-8"?>';
<div id="images_outer">
<table id="images"><tr> ?>
<?php
$result = mysql_query('SELECT * FROM photos LIMIT '.($page*$per_page).', '.$per_page); <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
for($i=$page*$per_page; $row = mysql_fetch_assoc($result); $i++) { <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl">
echo '<td class="image_outer" onclick="javascript:previewImage('.$i.')"><img alt="'.$row['photo_name'].'" src="'.$row['thumb_name'].'" class="image" /></td>'; <head>
if($i%3==2 && $i!=$count-1) echo '</tr><tr>'; <title>Galeria Suczawa 2009</title>
<link type="text/css" href="style.css" rel="stylesheet" />
} <script type="text/javascript">
while($i%3) { <!--
$i++; sciezka = 'http://' + '<?= $_SERVER['HTTP_HOST']; ?>' + '/sg/robocze/';
echo '<td class="image_outer_black">&nbsp;</td>'; //-->
} </script>
?> <script type="text/javascript" src="script.js"><!-- AJAX Library by chp1994(c) //--></script>
</tr> </head>
</table> <body onload="javascipt:init()">
</div> <div id="page">
<div id="pages_outer"> <div id="images_outer">
<div id="pages">Strony: <table id="images"><tr>
<?php <?php
$pcount = ceil($count/$per_page)-1; //$sql = "SELECT * FROM `photos` LIMIT ".($page*$per_page).", $per_page";
for($i=0; $i<$page; $i++) { $sql = "SELECT * FROM `photos` $limit";
echo '<a href="?page='.$i.'">'.($i+1).'</a> | '; if (!$result = $DB->query($sql))
} {
if($page!=$pcount) echo ($page+1).' | '; blad('Nie mozna pobrac zdjec uzytkownikow!');
else echo ($page+1); }
for($i=$page+1; $i<$pcount; $i++) {
echo '<a href="?page='.$i.'">'.($i+1).'</a> | '; for($i=$page*$per_page; $row = $result->fetch_assoc(); $i++)
} {
if($page!=$pcount) echo '<a href="?page='.($pcount).'">'.($pcount+1).'</a>'; echo '<td class="image_outer" onclick="javascript:previewImage('.($row['id']).')"><img alt="'.$row['photo_name'].'" src="images/upload/'.$row['thumb_name'].'" class="image" /></td>';
?> if($i%3==2 && $i!=$count-1) echo '</tr><tr>';
</div>
</div> }
<div id="disp"> while($i%3) {
<div id="disp_middle"> $i++;
<div id="disp_inner"> echo '<td class="image_outer_black">&nbsp;</td>';
<div><h3 id="disp_name"> </h3></div> }
<div id="disp_top"> ?>
<img id="disp_prev" src="img/prev.png" onclick="javascript:prev()" alt="Poprzedni"></img> </tr>
<a id="disp_a" href=""><img id="disp_img" src="" alt="Zdjęcie" /></a> </table>
<img id="disp_next" src="img/next.png" onclick="javascript:next()" alt="Następny"></img> </div>
</div> <div id="pages_outer">
<div id="disp_info"></div> <div id="pages">Strony:
<div><b>Autor:</b> <a id="disp_author"> </a></div> <?php
<a id="disp_close" onclick="javascript:closeDisp()">Zamknij</a> GenerujListeStron();
</div> ?>
</div> </div>
</div> </div>
<div id="icons"> <div id="disp">
<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml11" alt="Valid XHTML 1.1" height="31" width="88" /></a> <div id="disp_middle">
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img width="88px" height="31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Poprawny CSS!" /></a> <div id="disp_inner">
</div> <div><h3 id="disp_name"> </h3></div>
</div> <div id="disp_top">
</body> <img id="disp_prev" src="images/prev.png" onclick="javascript:prev()" alt="Poprzedni"></img>
</html> <a id="disp_a" href=""><img id="disp_img" src="" alt="Zdjecie" /></a>
<img id="disp_next" src="images/next.png" onclick="javascript:next()" alt="Nastepny"></img>
</div>
<div id="disp_info"></div>
<div><b>Autor:</b> <a id="disp_author"> </a></div>
<a id="disp_close" onclick="javascript:closeDisp()">Zamknij</a>
</div>
</div>
</div>
<div id="icons">
<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml11" alt="Valid XHTML 1.1" height="31" width="88" /></a>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img width="88px" height="31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Poprawny CSS!" /></a>
</div>
</div>
</body>
</html>

BIN
robocze/images/next.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 B

BIN
robocze/images/next_i.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
robocze/images/prev.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 788 B

BIN
robocze/images/prev_i.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 402 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

View File

@@ -1,10 +1,105 @@
<? <?
mysql_pconnect('HOST', 'USER', 'PASS'); /**
mysql_select_db('DB'); * @package Galeria Suczawa 2009
mysql_query("SET NAMES 'utf8'"); * @file init.php
* @version $Id$
$per_page=6; * @author chp1994 <chp1994@gmail.com>
* @link http://suczawa.ath.cx/
$result = mysql_query('SELECT COUNT(id) FROM photos'); **/
$count= mysql_result($result, 0);
?> #dołącz plik konfiguracyjny oraz funkcje
require('./config.php');
require('./functions.php');
#sprawdź, czy jest wyłączone register globals oraz magic quotes?
if (ini_get('register_globals') == 1)
{
ini_set('register_globals', '0');
if (ini_get('register_globals') == 1)
{
blad('Could not disable register_globals.');
}
}
if (get_magic_quotes_gpc())
{
blad('Prosze wylaczyc magic_quotes_gpc w php.ini!');
}
#połącz z bazą danych
$DB = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
#sprawdź pomyślność połączenia
if ($DB->connect_error)
{
blad('Could not connect do database server ('.$DB->connect_errno.')'.$DB->connect_error);
}
if (!$DB->query("SET NAMES 'utf8'"))
{
blad('Could not set character to UTF-8');
}
#pobierz id pierwszego zdjęcia
$sql = "SELECT `id` FROM `photos` ORDER BY `id` LIMIT 1";
if (!$result = $DB->query($sql))
{
blad('Nie mozna odczytac id pierwszego zdjecia!');
}
$row = $result->fetch_assoc();
$firstid = $row['id'];
$result->free; //zwolnij pamięć
unset($row);
#pobierz id ostatniego zdjęcia
$sql = "SELECT `id` FROM `photos` ORDER BY `id` DESC LIMIT 1";
if (!$result = $DB->query($sql))
{
blad('Nie mozna odczytac id ostatniego zdjecia!');
}
$row = $result->fetch_assoc();
$lastid = $row['id'];
$result->free; //zwolnij pamięć
unset($row);
#pobierz liczbę zdjęć w galerii
$sql = "SELECT COUNT(`id`) AS `count` FROM `photos`";
if (!$result = $DB->query($sql))
{
blad('Nie mozna odczytac liczby zdjec!');
}
$row = $result->fetch_assoc();
$count = $row['count'];
$result->free; //zwolnij pamięć
//
//wygeneruj strone
//
if (isset($_GET['page'])&&($_GET['page']!=1))
{
if (!is_numeric($_GET['page']))
{
die('Hacking attempt');
}
$value = ($_GET['page']-1)*$per_page;
$limit = 'LIMIT '.$value . ', '.$per_page;
$page = $_GET['page'];
}
else
{
$limit = 'LIMIT 0, '.$per_page;
$page=1;
}
$cnt = ceil($count / $per_page);
if(isset($_GET['page']) && ($_GET['page']>$cnt))
{
blad('Podana strona nie istnieje!');
}
//
//koniec generowania stron
//
?>

View File

@@ -1,119 +1,118 @@
var ajax; var ajax;
var disp; var disp;
var disp_img; var disp_img;
var disp_info; var disp_info;
var disp_name; var disp_name;
var disp_author, disp_a; var disp_author, disp_a;
var curr, last, first; var curr, last, first;
function init() { function init() {
initAjax(); initAjax();
disp=document.getElementById("disp"); disp=document.getElementById("disp");
disp_a=document.getElementById("disp_a"); disp_a=document.getElementById("disp_a");
disp_name=document.getElementById("disp_name"); disp_name=document.getElementById("disp_name");
disp_author=document.getElementById("disp_author"); disp_author=document.getElementById("disp_author");
disp_img=document.getElementById("disp_img"); disp_img=document.getElementById("disp_img");
disp_info=document.getElementById("disp_info"); disp_info=document.getElementById("disp_info");
if (!document.importNode) { if (!document.importNode) {
document.importNode = function(node, allChildren) { document.importNode = function(node, allChildren) {
switch (node.nodeType) { switch (node.nodeType) {
case 1: case 1:
var newNode = document.createElement(node.nodeName); var newNode = document.createElement(node.nodeName);
/*if (node.attributes && node.attributes.length > 0) /*if (node.attributes && node.attributes.length > 0)
for (var i = 0; il = node.attributes.length; i < il) for (var i = 0; il = node.attributes.length; i < il)
newNode.setAttribute(node.attributes[i].nodeName, node.getAttribute(node.attributes[i++].nodeName));*/ newNode.setAttribute(node.attributes[i].nodeName, node.getAttribute(node.attributes[i++].nodeName));*/
//alert("Attr done"); //alert("Attr done");
if (allChildren && node.childNodes && node.childNodes.length > 0) { if (allChildren && node.childNodes && node.childNodes.length > 0) {
il=node.childNodes.length; il=node.childNodes.length;
for (var i = 0; i < il; i++) for (var i = 0; i < il; i++)
newNode.appendChild(document.importNode(node.childNodes[i], allChildren)); newNode.appendChild(document.importNode(node.childNodes[i], allChildren));
} }
return newNode; return newNode;
break; break;
default: default:
return document.createTextNode(node.nodeValue); return document.createTextNode(node.nodeValue);
break; break;
} }
}; };
} }
if(!disp_name.firstChild) if(!disp_name.firstChild)
disp_name.appendChild(document.createTextNode(' ')); disp_name.appendChild(document.createTextNode(' '));
if(!disp_author.firstChild) if(!disp_author.firstChild)
disp_author.appendChild(document.createTextNode(' ')); disp_author.appendChild(document.createTextNode(' '));
} }
function initAjax() { function initAjax() {
try { try {
if (window.XMLHttpRequest) { if (window.XMLHttpRequest) {
ajax = new XMLHttpRequest(); ajax = new XMLHttpRequest();
ajax.overrideMimeType('text/xml'); ajax.overrideMimeType('text/xml');
} }
else if (window.ActiveXObject) else if (window.ActiveXObject)
ajax = new ActiveXObject('Microsoft.XMLHTTP'); ajax = new ActiveXObject('Microsoft.XMLHTTP');
else throw 'AJAX Error'; else throw 'AJAX Error';
} }
catch (e) { catch (e) {
return false; return false;
} }
if (!ajax) { if (!ajax) {
alert('AJAX Error'); alert('AJAX Error');
return false; return false;
} }
return true; return true;
} }
function response() { function response() {
if (ajax.readyState != 4 || ajax.status != 200) if (ajax.readyState != 4 || ajax.status != 200)
return; return;
var xml = ajax.responseXML; var xml = ajax.responseXML;
while(disp_info.hasChildNodes()) disp_info.removeChild(disp_info.firstChild); while(disp_info.hasChildNodes()) disp_info.removeChild(disp_info.firstChild);
elemXML=xml.getElementsByTagName("desc")[0]; elemXML=xml.getElementsByTagName("desc")[0];
if(document.importNode) children=document.importNode(elemXML, true).childNodes; if(document.importNode) children=document.importNode(elemXML, true).childNodes;
else children=elemXML.childNodes; else children=elemXML.childNodes;
for(i=0; i<children.length; i++) { for(i=0; i<children.length; i++) {
disp_info.appendChild(children[i]); disp_info.appendChild(children[i]);
} }
disp_img.src=xml.getElementsByTagName("src")[0].firstChild.nodeValue; disp_img.src= 'images/upload/' + xml.getElementsByTagName("src")[0].firstChild.nodeValue;
disp_a.href=xml.getElementsByTagName("src")[0].firstChild.nodeValue; disp_a.href= 'images/upload/' + xml.getElementsByTagName("src")[0].firstChild.nodeValue;
disp_name.firstChild.nodeValue=xml.getElementsByTagName("name")[0].firstChild.nodeValue; disp_name.firstChild.nodeValue=xml.getElementsByTagName("name")[0].firstChild.nodeValue;
disp_author.firstChild.nodeValue=xml.getElementsByTagName("author")[0].firstChild.nodeValue; disp_author.firstChild.nodeValue=xml.getElementsByTagName("author")[0].firstChild.nodeValue;
if(xml.getElementsByTagName("last").length) { if(xml.getElementsByTagName("last").length) {
document.getElementById("disp_next").src="img/next_i.png"; document.getElementById("disp_next").src="images/next_i.png";
last=true; last=true;
} }
if(xml.getElementsByTagName("first").length) { if(xml.getElementsByTagName("first").length) {
document.getElementById("disp_prev").src="img/prev_i.png"; document.getElementById("disp_prev").src="images/prev_i.png";
first=true; first=true;
} }
disp.style.display="block"; disp.style.display="block";
} }
function previewImage(el) { function previewImage(el) {
curr=el; curr=el;
last=false; last=false;
first=false first=false
document.getElementById("disp_next").src="img/next.png"; document.getElementById("disp_next").src="images/next.png";
document.getElementById("disp_prev").src="img/prev.png"; document.getElementById("disp_prev").src="images/prev.png";
ajax.onreadystatechange = response; ajax.onreadystatechange = response;
ajax.open('GET', 'http://www.amharc.yoyo.pl/ask.php?name=' + el, true); ajax.open('GET', sciezka + 'ask.php?name=' + el, true);
ajax.send(null); ajax.send(null);
} }
function prev() {
function prev() { if(!first) previewImage(curr-1);
if(!first) previewImage(curr-1); }
}
function next() {
function next() { if(!last) previewImage(curr+1);
if(!last) previewImage(curr+1); }
}
function closeDisp() {
function closeDisp() { disp.style.display="none";
disp.style.display="none"; }
}

View File

@@ -1,105 +1,110 @@
body { body {
background-color: black; background-color: black;
text-align: center; text-align: center;
} }
#page { a {
margin: auto; text-decoration: none;
width: 700px; }
} a:hover {
.image_outer_black { text-decoration: underline;
width: 190px; }
height: 120px; #page {
padding: 7px; margin: auto;
margin: 5px; width: 700px;
display: inline-block; }
text-align: center; .image_outer_black {
} width: 190px;
.image_outer { height: 120px;
width: 190px; padding: 7px;
height: 120px; margin: 5px;
padding: 7px; display: inline-block;
margin: 5px; text-align: center;
background-color: gray; }
display: inline-block; .image_outer {
text-align: center; width: 190px;
cursor: pointer; height: 120px;
} padding: 7px;
.image_outer:hover { margin: 5px;
background-color: #F0F0F0; background-color: gray;
} display: inline-block;
.image { text-align: center;
max-width: 200px; cursor: pointer;
max-height: 120px; }
.image_outer:hover {
} background-color: #F0F0F0;
#images_outer { }
text-align: center; .image {
} max-width: 200px;
#images { max-height: 120px;
margin:auto;
} }
#disp { #images_outer {
width: 80%; text-align: center;
background-color: gray; }
border: solid 1px black; #images {
margin-left: auto; margin:auto;
margin-right: auto; }
position: fixed; #disp {
top: 10%; width: 80%;
left: 10%; background-color: gray;
display:none; border: solid 1px black;
text-align: center; margin-left: auto;
padding: 2px; margin-right: auto;
font-size: 8pt; position: fixed;
} top: 10%;
left: 10%;
#disp_close { display:none;
cursor: pointer; text-align: center;
} padding: 2px;
font-size: 8pt;
#disp_close:hover { }
text-decoration: underline;
} #disp_close {
cursor: pointer;
}
#disp_a, #disp_a img {
border: none; #disp_close:hover {
} text-decoration: underline;
}
#disp_prev, #disp_next {
margin-bottom: 15%;
} #disp_a, #disp_a img {
border: none;
#disp_img { }
text-align: center;
margin:auto; #disp_prev, #disp_next {
max-height: 300px; margin-bottom: 15%;
max-width: 80%; }
height: 300px;
} #disp_img {
text-align: center;
#disp_info { margin:auto;
clear: both; max-height: 300px;
} max-width: 80%;
height: 300px;
#icons { }
padding: 0px;
margin: 0px; #disp_info {
text-align: center; clear: both;
} }
#icons a, #icons img { #icons {
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
text-decoration: none; text-align: center;
border: none; }
}
#pages { #icons a, #icons img {
color: white; padding: 0px;
text-align: left; margin: 0px;
margin-left: 40px; text-decoration: none;
} border: none;
#pages a, #pages a:link, #pages a:hover, #pages a:visited { }
color: white; #pages {
} color: white;
text-align: left;
margin-left: 40px;
}
#pages a, #pages a:link, #pages a:hover, #pages a:visited {
color: white;
}