Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion lbasov/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

336 changes: 0 additions & 336 deletions lbasov/.idea/workspace.xml

This file was deleted.

2 changes: 1 addition & 1 deletion lbasov/basov.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html><head> <meta charset="utf-8"> <script src="script.js"></script> <script src="array-print.js"></script> <script src="code-style.js"></script> <script src="date.js"></script></head><body> <button onclick="auth()">Авторизация</button> <button onclick="console.log(printArray(sample));">Распечатать массив</button> <button onclick="alert(printDate())">Текущая дата</button></body></html>
<!doctype html><html><head> <meta charset="utf-8"> <script src="homework/1-login.js"></script> <script src="homework/2-array-print.js"></script> <script src="code-style.js"></script> <script src="date.js"></script></head><body> <button onclick="auth()">Авторизация</button> <button onclick="console.log(printArray(sample));">Распечатать массив</button> <button onclick="startPrintingDate()">Текущая дата</button></body></html>
Expand Down
16 changes: 12 additions & 4 deletions lbasov/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@
*/

// 00:00 01.03 2119 года
function printDate() {
var d = new Date();
function getDateString( d ) {
var dateString = d.getHours() +":"+ d.getMinutes()+" ";
dateString += d.getDate()+"."+ d.getUTCMonth()+ " "+ d.getFullYear() + " года";
dateString += d.getDate()+"."+ d.getMonth()+ " "+ d.getFullYear() + " года";
return dateString;
}
}


function startPrintingDate(){
var printingFunction = function(){
alert( getDateString( new Date() ) );
};
setInterval( printingFunction , 1000);

}
File renamed without changes.
File renamed without changes.
92 changes: 92 additions & 0 deletions lbasov/homework/3-cook.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
#center {
width: 300px;
height: 110px;
overflow: auto;
margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
}

#time_countdown {
text-align: center;
font-size: 30pt;
color: lightgray;
margin-top: 10px;
}

#buttons {
text-align: center;
position: absolute;
bottom: 10px;
left: 0;
right: 0;
margin: auto;
}

.foodReady {
background-color: #CFFFCF;
-webkit-transition: background-color 300ms linear;
-moz-transition: background-color 300ms linear;
-o-transition: background-color 300ms linear;
-ms-transition: background-color 300ms linear;
transition: background-color 300ms linear;
}

.foodCooking {
background-color: white;
-webkit-transition: background-color 300ms linear;
-moz-transition: background-color 300ms linear;
-o-transition: background-color 300ms linear;
-ms-transition: background-color 300ms linear;
transition: background-color 300ms linear;

}

.hide {
opacity: 0;
-webkit-transition: opacity 300ms linear;
-moz-transition: opacity 300ms linear;
-o-transition: opacity 300ms linear;
-ms-transition: opacity 300ms linear;
transition: opacity 300ms linear;
}

.show {
opacity: 1;
-webkit-transition: opacity 300ms linear;
-moz-transition: opacity 300ms linear;
-o-transition: opacity 300ms linear;
-ms-transition: opacity 300ms linear;
transition: opacity 300ms linear;
}

#congrad {
position: absolute;
top: 10px;
left: 0;
right: 0;
text-align: center;
font-size: 30pt;
}

</style>
<script src="3-cook.js"></script>
</head>
<body>
<div id="center">
<div id="time_countdown">00:00</div>
<div id="congrad" class="hide">Кушать подано!</div>
<div id="buttons">
<button onclick="setupCountdown('time_countdown', 6.5)">Яйцо всмятку</button>
<button onclick="setupCountdown('time_countdown', 10)">Яйцо вкрутую</button>
<button onclick="setupCountdown('time_countdown', 12)">Пельмени</button>
</div>
</div>
</body>
</html>
62 changes: 62 additions & 0 deletions lbasov/homework/3-cook.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* Created by prt on 21.11.13.
*/


getId = function(id) {
return document.getElementById(id);
};

getTags = function(tagName) {
return document.getElementsByTagName(tagName);
};

intervalId = 0; // We need this global var to correctly process situation when we need
// start new timer while previous is still running.

function setupCountdown(id ,minutes){
var element = getId(id),
endDate = new Date( new Date().getTime() + minutes * 60000 );

clearInterval(intervalId);
restorePageStatus();

var tickFunction = function(){
var totalSecondsLeft = Math.round( (endDate.getTime() - new Date().getTime()) / 1000);
if(totalSecondsLeft > 0){
var minLeft = parseInt( totalSecondsLeft / 60);
var secondsLeft = parseInt( totalSecondsLeft % 60 );
var secondsText = secondsLeft < 10 ? '0'+secondsLeft.toString() : secondsLeft.toString();
element.innerText = minLeft +":"+secondsText;
}else {
clearInterval(intervalId);
finalizeCountDown(id);
}
};
tickFunction();
intervalId = setInterval(tickFunction, 1000);
}


function finalizeCountDown(id) {
var element = getId(id);
element.innerText = '0:00';
element.className = 'hide';

var body = getTags('body')[0];
body.className = 'foodReady';

var congrad = getId('congrad');
congrad.className = 'show';

}

function restorePageStatus() {
var body = getTags('body')[0],
timer = getId('time_countdown'),
congrad = getId('congrad');

body.className = 'foodCooking';
timer.className = 'show';
congrad.className = 'hide';
}
22 changes: 22 additions & 0 deletions lbasov/html-task-1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="html-task-1.js"></script>
</head>
<body>
<div id="container">
<a href="http://ya.ru">Y</a>
<a href="http://google.ru">G</a>
</div>
<div id="secondContainer">
<a href="http://yahoo.com">Y!</a>
</div>

Заменить href у ссылок в первом диве, во втором не менять.<br />
Заменить текст ссылке во втором диве на "Yahoo!"<br /><br />

<button onclick="replaceHrefs()">Сделать замены!</button>
</body>
</html>
16 changes: 16 additions & 0 deletions lbasov/html-task-1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Created by prt on 20.11.13.
*/


function replaceHrefs(){
var tagList = document.getElementsByTagName('a');
for(var i=0; i < tagList.length; i++){
var currentLink = tagList[i];
if( currentLink.parentNode.id === 'container' ){
currentLink.href = '#';
}else if(currentLink.parentNode.id === 'secondContainer') {
currentLink.innerText = 'Yahoo!';
}
}
}