-
Notifications
You must be signed in to change notification settings - Fork 12
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
6b09be7
2d358d6
7f71513
09d2c39
1ec6032
5287987
26002d3
f5d43d6
d1fdd36
11506e3
2414408
a83b56c
e6ce43c
f225854
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,254 @@ | ||
body | ||
{ | ||
margin: 0 40px; | ||
|
||
font: 14px/normal sans-serif; | ||
} | ||
|
||
|
||
.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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. А зачем это задавать? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Чтоб перекрыть браузерные h1-стили. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 10px 330px 10px There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ну, со всеми бывает :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Вот, кстати, и нет — это не одно и то же :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Тьфу, да, мы обычно такое задаём вот так: |
||
|
||
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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
} |
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> |
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; | ||
}); | ||
|
||
}; | ||
|
||
}); |
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; | ||
} | ||
|
||
}); | ||
|
||
}); |
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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Не смотрел на http://momentjs.com/? Для текущего функционала, конечно, оверкилл, но если брать навырост — самое то. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ну, библиотека может и крутая, но это какой вырост должен быть :) There was a problem hiding this comment. Choose a reason for hiding this commentThe 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()); | ||
} | ||
|
||
} | ||
|
||
}); |
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(); | ||
|
||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А normal !== 1?
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
С точки зрения «однозначности», пожалуй, лучше все-таки задавать конкретно. Но в данном случае да, можно и так. Ок