Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Д/з №6 — Жевак Антон #3

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
254 changes: 254 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,254 @@
body
{
margin: 0 40px;

font: 14px/normal sans-serif;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А normal !== 1?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По рекомендациями W3C 1.0 < normal < 1.2 (http://www.w3.org/TR/CSS21/visudet.html#propdef-line-height)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

С точки зрения «однозначности», пожалуй, лучше все-таки задавать конкретно. Но в данном случае да, можно и так. Ок

}


.tabs
{
margin: 10px 0 20px;
padding: 0;

list-style: none;
}

.tabs__tab
{
display: inline;

margin: 0 15px 0 0;
}


.pictures__title
{
margin: 0 0 20px;

font-size: 40px;
font-weight: 400;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А зачем это задавать?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Чтоб перекрыть браузерные h1-стили.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А, ок!

}

.pictures__title:first-letter
{
color: red;
}

.pictures__items
{
margin: -10px -10px 80px;
padding: 0;

list-style: none;

text-align: justify;

font: 0/0 a;
}

.pictures__items:after
{
display: inline-block;

width: 100%;
height: 0;

content: "";
}


.picture
{
position: relative;

display: inline-block;

margin: 10px;

vertical-align: top;
}

.picture__link
{
position: relative;
z-index: 1;

display: block;
overflow: hidden;

height: 100px;

cursor: pointer;
}

.picture__preview
{
display: block;
}

.picture__info
{
position: absolute;
top: -10px;
left: -10px;

display: none;

width: 100%;
padding: 120px 10px 10px;

text-align: left;

color: #fff;
background: #2b2b2b;
box-shadow: 0 2px 9px rgba(0,0,0, .6);

font: 12px/16px sans-serif;
}

.picture__title
{
overflow: hidden;

margin: 0 0 5px;

text-overflow: ellipsis;
}

.picture_active_yes,
.picture_hovered_yes
{
position: relative;
z-index: 100;
}

.picture_active_yes .picture__info,
.picture_hovered_yes .picture__info
{
display: block;
}


.preview
{
position: relative;

display: none;
overflow: hidden;

background: #2b2b2b;

font: 14px/normal sans-serif;
}

.preview__close
{
position: absolute;
top: 10px;
right: 10px;

overflow: hidden;

height: 28px;

cursor: pointer;

color: #888;

font-size: 48px;
font-weight: 700;
line-height: 28px;
}

.preview__close:hover
{
color: #ddd;
}

.preview__slider
{
margin: 10px 330px 10px 10px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10px 330px 10px

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну, со всеми бывает :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вот, кстати, и нет — это не одно и то же :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тьфу, да, мы обычно такое задаём вот так:
margin: 10px; margin-right: 330px;


text-align: center;
}

.preview__info
{
position: absolute;
top: 50px;
right: 10px;

width: 300px;

text-align: left;

color: #eee;
}

.preview__props
{
margin: 0;
padding: 0;

list-style: none;
}

.preview__prop
{
margin: 0 0 10px;
}

.preview__title
{
margin: 0 0 15px;

color: #fff;
}

.preview__author
{
color: #24a323;
}

.preview__author:hover
{
color: red;
}

.preview__slider
{
position: relative;
}

.preview__next,
.preview__prev
{
position: absolute;
top: 50%;

margin: -30px 0 0;

color: #666;

font-size: 60px;
line-height: 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

О! Внезапно)

}

.preview__next:hover,
.preview__prev:hover
{
cursor: pointer;

color: #ddd;
}

.preview__next
{
right: 0;
}

.preview__prev
{
left: 0;
}
23 changes: 23 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8">
<title>Домашнее задание №6</title>
<link href="css/main.css" rel="stylesheet">
<script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.9/require.min.js" data-main="js/main.js"></script>
</head>
<body>
<ul class="tabs">
<li class="tabs__tab">
<a class="tabs__link" href="#top">Популярные фотографии</a>
</li>
<li class="tabs__tab">
<a class="tabs__link" href="#recent">Новые интересные фотографии</a>
</li>
<li class="tabs__tab">
<a class="tabs__link" href="#podhistory">Фото дня</a>
</li>
</ul>
<div id="content"></div>
</body>
</html>
22 changes: 22 additions & 0 deletions js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
define([
'jquery',
'underscore',
'backbone',
'router'
], function($, _, Backbone, Router) {

return function() {

this.router = new Router;

this.vent = _.extend({}, Backbone.Events);

var self = this;
$('a[href]').on('click', function(event) {
self.router.navigate($(this).attr('href'), { trigger : true });
return false;
});

};

});
24 changes: 24 additions & 0 deletions js/collections/picture.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
define([
'jquery',
'underscore',
'backbone',
'models/picture'
], function($, _, Backbone, Picture) {

return Backbone.Collection.extend({

model : Picture,

url : 'http://api-fotki.yandex.ru/api/{{type}}/?format=json',

initialize : function(options) {
this.url = this.url.replace('{{type}}', options.type);
},

parse : function(response) {
return response.entries;
}

});

});
18 changes: 18 additions & 0 deletions js/helpers/helper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
define(function() {

return {

leadZero : function(num) {
return num < 10 ? '0' + num : num;
},

formatDate : function(date) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не смотрел на http://momentjs.com/?

Для текущего функционала, конечно, оверкилл, но если брать навырост — самое то.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну, библиотека может и крутая, но это какой вырост должен быть :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

«Библиотека отличная» – я бы сказал

date = new Date(date);
return date.getDate() + ' ' +
('января,февраля,марта,апреля,мая,июня,июля,августа,сентября,октября,ноября,декабря'.split(',')[date.getMonth()]) + ' ' +
date.getFullYear() + ' в ' + this.leadZero(date.getHours()) + ':' + this.leadZero(date.getMinutes());
}

}

});
28 changes: 28 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
requirejs.config({
paths : {
underscore : '//yandex.st/underscore/1.5.2/underscore-min',
backbone : '//yandex.st/backbone/1.1.0/backbone-min',
jquery : '//yandex.st/jquery/1.10.2/jquery.min',
text : '//cdnjs.cloudflare.com/ajax/libs/require-text/2.0.10/text.min'
},
shim : {
underscore : {
exports : '_'
},
backbone : {
deps : ['jquery', 'underscore'],
exports : 'Backbone'
}
}
});

require([
'backbone',
'app'
], function(Backbone, App) {

window.app = new App;

Backbone.history.start();

});
Loading