diff --git a/lbasov/.idea/encodings.xml b/lbasov/.idea/encodings.xml index 3987e0d..298a79e 100644 --- a/lbasov/.idea/encodings.xml +++ b/lbasov/.idea/encodings.xml @@ -1,7 +1,7 @@ - + diff --git a/lbasov/.idea/workspace.xml b/lbasov/.idea/workspace.xml deleted file mode 100644 index 9e91c80..0000000 --- a/lbasov/.idea/workspace.xml +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - XPath - - - XSLT - - - - - CoffeeScript - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1384287378160 - 1384287378160 - - - 1384367337135 - 1384367337135 - - - 1384593885421 - 1384593885421 - - - 1384595204405 - 1384595204405 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lbasov/basov.html b/lbasov/basov.html index 2b51b76..61aeef4 100644 --- a/lbasov/basov.html +++ b/lbasov/basov.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/lbasov/date.js b/lbasov/date.js index 3b30476..33f0c79 100644 --- a/lbasov/date.js +++ b/lbasov/date.js @@ -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; -} \ No newline at end of file +} + + +function startPrintingDate(){ + var printingFunction = function(){ + alert( getDateString( new Date() ) ); + }; + setInterval( printingFunction , 1000); + +} diff --git a/lbasov/script.js b/lbasov/homework/1-login.js similarity index 100% rename from lbasov/script.js rename to lbasov/homework/1-login.js diff --git a/lbasov/array-print.js b/lbasov/homework/2-array-print.js similarity index 100% rename from lbasov/array-print.js rename to lbasov/homework/2-array-print.js diff --git a/lbasov/homework/3-cook.html b/lbasov/homework/3-cook.html new file mode 100644 index 0000000..418ba18 --- /dev/null +++ b/lbasov/homework/3-cook.html @@ -0,0 +1,92 @@ + + + + + + + + + +
+
00:00
+
Кушать подано!
+
+ + + +
+
+ + \ No newline at end of file diff --git a/lbasov/homework/3-cook.js b/lbasov/homework/3-cook.js new file mode 100644 index 0000000..b3ff019 --- /dev/null +++ b/lbasov/homework/3-cook.js @@ -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'; +} diff --git a/lbasov/html-task-1.html b/lbasov/html-task-1.html new file mode 100644 index 0000000..217d685 --- /dev/null +++ b/lbasov/html-task-1.html @@ -0,0 +1,22 @@ + + + + + + + + +
+ Y + G +
+
+ Y! +
+ + Заменить href у ссылок в первом диве, во втором не менять.
+ Заменить текст ссылке во втором диве на "Yahoo!"

+ + + + \ No newline at end of file diff --git a/lbasov/html-task-1.js b/lbasov/html-task-1.js new file mode 100644 index 0000000..21a9dca --- /dev/null +++ b/lbasov/html-task-1.js @@ -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!'; + } + } +} \ No newline at end of file