This commit is contained in:
tmshv committed 2014-11-04 21:50:09 +03:00
1 parent 6909a25e1b
commit 7e30f7f278
20 files changed
+1250 -228

No files matched your search

+111 -41
View File
@@ -1,57 +1,127 @@
* {
// position: absolute;
// width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
.norm{
font-weight: normal;
body {
font-family: "PT Sans";
}
.bold{
font-weight: bold;
.norm {
font-weight: 400;
}
.menu{
width: 100%;
height: 45px;
background-color: white;
&.opac{
position:fixed;
opacity: 0.9;
box-shadow: 0 0 10px rgba(0,0,0,0.5);
}
h1{
padding:10px 0 0 25px;
font-size: 14pt;
color: black;
}
.bold {
font-weight: 700;
}
iframe{
// display: absolute;
width: 100%;
height: 100%;
border:none;
#page-container > div {
/* box-shadow: 1px 1px 3px 1px #333;*/
}
.doclist{
// width: 100%;
padding-top: 70px;
.menu {
position: fixed;
width: 100%;
height: 45px;
background-color: #fff;
z-index: 100;
box-shadow: 0 1px 5px 0px rgba(0, 0, 0, 0.5);
&.opac {
opacity: .97;
}
.panel {
width: auto;
display: inline-block;
margin: 10px 25px 0;
&.right {
float: right;
}
}
h1 {
font-size: 14pt;
}
}
img{
max-width: 90%;
height: auto;
.controls {
display: inline-block;
margin-top: -4px;
/* vertical-align: middle;*/
.block {
display: inline-block;
/* height: 100%;*/
margin: 0px 5px;
vertical-align: middle;
}
input {
width: 30px;
height: 30px;
margin: 0 2px;
text-align: center;
font-size: .9em;
}
button {
display: inline-block;
height: 30px;
padding: 0 10px;
border-radius: 6px;
border: 2px solid #bbb;
color: #555;
background-color: white;
font-size: 1.3em;
text-align: center;
outline: none;
&:hover {
/* border: 1px solid #666;*/
/* background-color: #eee;*/
border: 2px solid #4d62d9;
color: #4d62d9;
}
&:active {
border: 2px solid #3d4fb2;
color: #3d4fb2;
background-color: rgba(61, 79, 178, 0.3);
}
}
a.download {
width: 22px;
height: 22px;
padding: 5px 8px;
display: inline-block;
background: #f3f3f3 url(download-icon.png) no-repeat;
background-position: 50%;
border-radius: 3px;
border: 1px solid #e0e0e0;
}
}
margin-left: auto;
margin-right: auto;
#page-container {
background-color: #c3bfa3;
transition: left 500ms;
}
display: block;
margin-bottom: 50px;
.pf {
margin: 60px auto 20px;
/* box-shadow: 1px 1px 3px 1px #333;*/
box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.9);
border-collapse: separate;
}
// border: 1px solid #999;
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.2);
}
iframe {
width: 100%;
height: 100%;
border: 0;
}
.doclist {
padding-top: 70px;
img {
max-width: 90%;
height: auto;
margin-left: auto;
margin-right: auto;
display: block;
margin-bottom: 50px;
-webkit-box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.2);
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.2);
}
}
+179
View File
@@ -0,0 +1,179 @@
#page-container {
position: absolute;
top: 0;
left: 0;
margin: 0;
padding: 0;
border: 0;
}
@media screen {
#page-container {
bottom: 0;
right: 0;
overflow: auto;
}
.loading-indicator {
display: none;
&.active {
display: block;
position: absolute;
width: 64px;
height: 64px;
top: 50%;
left: 50%;
margin-top: -32px;
margin-left: -32px;
}
img {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
}
}
@media print {
@page {
margin: 0;
}
html {
margin: 0;
}
body {
margin: 0;
-webkit-print-color-adjust: exact;
}
#page-container {
width: auto;
height: auto;
overflow: visible;
background-color: transparent;
}
.d {
display: none;
}
}
.pf {
position: relative;
background-color: white;
overflow: hidden;
margin: 0;
border: 0;
}
.pc {
position: absolute;
border: 0;
padding: 0;
margin: 0;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
display: block;
transform-origin: 0 0;
-ms-transform-origin: 0 0;
-webkit-transform-origin: 0 0;
&.opened {
display: block;
}
}
.bf {
position: absolute;
border: 0;
margin: 0;
top: 0;
bottom: 0;
width: 100%;
height: 100%;
-ms-user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
}
.bi {
position: absolute;
border: 0;
margin: 0;
-ms-user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
}
@media print {
.pf {
margin: 0;
box-shadow: none;
page-break-after: always;
page-break-inside: avoid;
}
@-moz-document url-prefix() {
.pf {
overflow: visible;
border: 1px solid #fff;
}
.pc {
overflow: visible;
}
}
}
.c {
position: absolute;
border: 0;
padding: 0;
margin: 0;
overflow: hidden;
display: block;
}
.t {
position: absolute;
white-space: pre;
font-size: 1px;
transform-origin: 0 100%;
-ms-transform-origin: 0 100%;
-webkit-transform-origin: 0 100%;
unicode-bidi: bidi-override;
-moz-font-feature-settings: "liga" 0;
}
._ {
color: transparent;
z-index: -1;
}
::selection {
background: rgba(127, 255, 255, 0.4);
}
::-moz-selection {
background: rgba(127, 255, 255, 0.4);
}
.pi {
display: none;
}
.d {
position: absolute;
transform-origin: 0 100%;
-ms-transform-origin: 0 100%;
-webkit-transform-origin: 0 100%;
}
// .@CSS_LINK_CN span {
// position: relative;
// vertical-align: baseline;
// display: inline-block;
// unicode-bidi: bidi-override;
// }
+7 -10
View File
@@ -1,10 +1,11 @@
.schedule{
position: relative;
margin: 30px auto 0 auto;
text-align: center;
table{
position: relative;
margin: 0 auto 0 auto;
margin: 30px auto 0 auto;
border-spacing: 0px;
text-align: center;
@@ -28,25 +29,21 @@
position: relative;
vertical-align:baseline;
p{
p.name{
// position: absolute;
width:30px;
height: 30px;
left: 0;
right: 0;
margin: 7px auto 0 auto;
margin: 7px auto 10px auto;
padding: 7px;
border: 1px solid #e8e8e8;
background-color: white;
// background-color: white;
border-radius: 50%;
font-size: 1.4em;
}
}
}
tr:nth-child(even) td.group p{
background-color: #f9f9fd;
}
}
thead{
@@ -72,8 +69,8 @@
}
}
tbody tr:nth-child(odd){
background-color: #f9f9fd;
tbody tr:nth-child(even){
background-color: #f3f3fd;
}
.lesson{
+132
View File
@@ -0,0 +1,132 @@
var Doc = (function(){
var Document = function(baseURL){
this.pages = [];
this.baseURL = baseURL;
}
Document.prototype.hasPage = function(index){
return index >= 0 && index < this.pages.length;
}
Document.prototype.getPageURL = function(pageNumber){
var s = pageNumber <2 ? "" : "/" + pageNumber;
return this.baseURL + s;
}
Document.prototype.page = function(index){
return index + 1;
}
return Document;
})();
(function(){
const PAGES = [];
var currentPageIndex = 0;
var doc = new Doc(location.pathname.replace(/\/\d+$/, ""));
$(document).ready(function(){
try{
var hrefPage = /\/(\d+)$/.exec(location.href)[1];
currentPageIndex = parseInt(hrefPage) - 1;
}catch(error){
}
$("#buttonNext").click(function(event){
loadNext();
});
$("#buttonPrev").click(function(event){
loadPrevious();
});
$("#page-container .pf").each(function(index, elem){
var url = $(elem).data("page-url");
doc.pages.push(url);
});
$("#currentPage").attr("max", doc.pages.length);
$("#totalPages").text(doc.pages.length);
$("#currentPage").change(function(){
var i = parseInt($(this).val()) - 1;
if(i && doc.hasPage(i)){
loadPage(i);
}
});
$("#page-container").html("");
loadPage(currentPageIndex);
window.addEventListener("popstate", function(event){
console.log("pops");
console.log(event);
var i = event.state;
loadPage(i);
});
});
function loadNext(){
var i = currentPageIndex + 1;
if(doc.hasPage(i)){
loadPage(i);
}else{
}
}
function loadPrevious(){
var i = currentPageIndex - 1;
if(doc.hasPage(i)){
loadPage(i);
}else{
}
}
function loadPage(index){
if(doc.hasPage(index)){
var url = doc.pages[index];
// $.ajax(
// url,
// {
// xhrFields: {
// crossDomain: true,
// withCredentials: true
// },
// success: function(data, status){
// currentPageIndex = index;
// $("#currentPage").val(doc.page(currentPageIndex));
// $("#page-container").html(data);
// var p = doc.page(currentPageIndex);
// console.log("look at page ", p);
// window.history.pushState(
// currentPageIndex,
// "State 2013 — " + p,
// doc.getPageURL(p)
// );
// },
// error: function(xhr, aaa, error){
// console.log(error);
// }
// }
// );
$.get(url, function(data){
currentPageIndex = index;
$("#currentPage").val(doc.page(currentPageIndex));
$("#page-container").html(data);
var p = doc.page(currentPageIndex);
console.log("look at page ", p);
window.history.pushState(
currentPageIndex,
"State 2013 — " + p,
doc.getPageURL(p)
);
});
}
}
})();
+33 -14
View File
@@ -11,11 +11,11 @@ $(document).ready(function(){
var now = new Date();
var day = now.getDay();
if(day < 7) selectDay(day);
else deselectDays();
// day = 3;
if(day == 0) deselectDays();
else selectDay(day);
var dates = getDates(day);
// var dates = [45, 53, 53, 23, 53, 64];
var dates = getDates(day);
$(".schedule thead .date").each(function(index, elem){
$(elem).text(dates[index]);
});
@@ -38,21 +38,40 @@ $(document).ready(function(){
}
});
/**
* Generates list of numbers
* @param {Number} start starting value
* @param {Number} num amount of numbers in list
* @param {Number} step difference value
* @return {Array} list of numbers
*/
function range(start, num, step){
var list= [];
var val = start;
for(var i = 0; i<num; i++){
list.push(val);
val += step;
}
return list;
var list= [];
var val = start;
for(var i = 0; i<num; i++){
list.push(val);
val += step;
}
return list;
}
/**
* Monday date of current week
* @param {[type]} d [description]
* @return {[type]} [description]
*/
function getMonday(d) {
d = new Date(d);
var day = d.getDay();
var diff = d.getDate() - day + (day == 0 ? -6:1); // adjust when day is sunday
return new Date(d.setDate(diff));
}
function getDates(day){
var dates = [];
var prev = day - 1;
var next = 6 - day;
var dayMask = range(-1, 1, -1).concat([0]).concat(range(1, next, 1));
var prev = day == 0 ? 0 : day - 1;
var next = 6 - prev;
var dayMask = range(-1, prev, -1).concat([0]).concat(range(1, next, 1));
console.log("day mask", dayMask);
dayMask.forEach(function(m){
var time = Date.now() + (1000 * 60 * 60 * 24) * m;
+10 -73
View File
@@ -1,87 +1,24 @@
var populate = require("./utils/populate").populate;
const MENU = require("./models/menu.json");
const DOCUMENTS = require("./models/documents.json");
const SCHEDULE = require("./models/schedule-2014-early.json");
const team = require("./models/team");
const course = require("./models/course");
const document = require("./models/document");
const schedule = require("./models/schedule");
module.exports = {
port: 18010,
pub: "./",
data:{
menu: MENU,
documents: DOCUMENTS,
documents: document.docs,
team: team.team,
courses: course.courses,
schedule: schedule(SCHEDULE),
schedule: schedule([
populate(team.short, "teacher"),
populate(course.name, "lesson")
])
}
}
function schedule(_schedule){
var days = function(group){
var result = [];
var list = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
list.forEach(function(i){
var lesson = group[i];
if(lesson){
result.push(
lol(lesson)
.fun(time())
.fun(populate(team.short, "teacher"))
.fun(populate(course.name, "lesson"))
.data()
)
}else{
result.push(null);
}
});
return result;
}
var time = function(){
return function(lesson){
for(var i=0; i < lesson.time.length; i++){
lesson.time[i] = lesson.time[i].replace(" ", "—");
}
return lesson;
}
}
var result = [];
_schedule.forEach(function(group){
result.push({
name: group.name,
days: days(group)
});
});
return result;
}
function lol(data){
var Fun = function(data){
this._data = data;
}
Fun.prototype = {
fun: function(fun){
if(typeof fun == "function"){
this._data = fun(this._data);
}
return this;
},
data: function(){
return this._data;
}
};
var fun = new Fun(data);
return fun;
}
function populate(find, field){
return function(lesson){
var id = lesson[field];
var val = find(id);
if(val) lesson[field] = val;
return lesson;
}
}
+1 -1
View File
@@ -26,7 +26,7 @@ gulp.task("copy", function(){
gulp.task("uglify", function(){
gulp.src("./client/*.js")
.pipe(uglify())
// .pipe(uglify())
.pipe(gulp.dest("./public/c"));
});
+5 -1
View File
@@ -11,4 +11,8 @@ function gatherNotFoundCollection (dir) {
});
}
return [];
}
}
var config = require("./config").populate({
});
+68
View File
@@ -0,0 +1,68 @@
const DOCS = require("./documents.json");
exports.docs = DOCS;
exports.doc = getDocByName;
exports.cap = makeCap;
// exports.extra = populateExtra;
function getDocByName(name){
if(name && typeof name == "string"){
for(var i=0; i<DOCS.length; i++){
var doc = DOCS[i];
if(doc.name == name){
return clone(doc);
}
}
return null;
}else if(name && name instanceof Array){
var docs = [];
name.forEach(function(i){
var d = getDocByName(i);
if(d){
docs.push(d);
}
});
return docs;
}else{
return null;
}
}
function clone(obj){
if(obj == null || typeof(obj) != 'object')
return obj;
var temp = obj.constructor(); // changed
for(var key in obj)
temp[key] = clone(obj[key]);
return temp;
}
/**
* Capitalize first letter of document name
* Process doc object or array of objects
* @param {Object | Array} doc document object or array of document objects
* @return {[type]} document object or array of document objects with capitalized first letter of document name
*/
function makeCap(doc){
if(doc instanceof Array){
for(var i=0; i<doc.length; i++){
doc[i] = makeCap(doc[i]);
}
}else{
var n = doc.name;
doc.name = n.charAt(0).toUpperCase() + n.substring(1);
}
return doc;
}
// function populateExtra(doc, extra){
// if(!doc.extra) doc.extra = {};
// for(var i in extra){
// if(!doc.extra[i]) doc.extra[i] = [];
// doc.extra[i] = doc.extra[i].concat(extra[i]);
// }
// return doc;
// }
+36 -33
View File
@@ -6,35 +6,38 @@
"preview": "/img/preview/statue-2013.png",
"download": "http://static.shburg.org/art/docs/hudozhka_statue-2013.pdf",
"url": [
"http://static.shburg.org/art/docs/hudozhka_statue-2013-1.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-2.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-3.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-4.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-5.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-6.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-7.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-8.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-9.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-10.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-11.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-12.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-13.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-14.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-15.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-16.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-17.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-18.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-19.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-20.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-21.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-22.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-23.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-24.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-25.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-26.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-27.page"
"/f/hudozhka_statue-2013-1.page",
"/f/hudozhka_statue-2013-2.page",
"/f/hudozhka_statue-2013-3.page",
"/f/hudozhka_statue-2013-4.page",
"/f/hudozhka_statue-2013-5.page",
"/f/hudozhka_statue-2013-6.page",
"/f/hudozhka_statue-2013-7.page",
"/f/hudozhka_statue-2013-8.page",
"/f/hudozhka_statue-2013-9.page",
"/f/hudozhka_statue-2013-10.page",
"/f/hudozhka_statue-2013-11.page",
"/f/hudozhka_statue-2013-12.page",
"/f/hudozhka_statue-2013-13.page",
"/f/hudozhka_statue-2013-14.page",
"/f/hudozhka_statue-2013-15.page",
"/f/hudozhka_statue-2013-16.page",
"/f/hudozhka_statue-2013-17.page",
"/f/hudozhka_statue-2013-18.page",
"/f/hudozhka_statue-2013-19.page",
"/f/hudozhka_statue-2013-20.page",
"/f/hudozhka_statue-2013-21.page",
"/f/hudozhka_statue-2013-22.page",
"/f/hudozhka_statue-2013-23.page",
"/f/hudozhka_statue-2013-24.page",
"/f/hudozhka_statue-2013-25.page",
"/f/hudozhka_statue-2013-26.page",
"/f/hudozhka_statue-2013-27.page"
],
"view":"frame"
"extra": {
"style": ["http://static.shburg.org/art/docs/preview/hudozhka_statue-2013.css"]
},
"viewer": "default"
},
{
"name": "edu-license",
@@ -46,7 +49,7 @@
"http://static.shburg.org/art/docs/hudozhka_license_edu_back.jpg",
"http://static.shburg.org/art/docs/hudozhka_license_edu_attachment.jpg"
],
"view":"page"
"viewer": "img-sheet"
},
{
"name": "gov-certificate",
@@ -54,7 +57,7 @@
"path": "/document/gov-certificate",
"preview": "/img/preview/certificate_gov.png",
"url": ["http://static.shburg.org/art/docs/hudozhka_certificate_gov.jpg"],
"view":"page"
"viewer": "img-sheet"
},
{
"name": "VAT",
@@ -62,7 +65,7 @@
"path": "/document/VAT",
"preview": "/img/preview/vatin.png",
"url": ["http://static.shburg.org/art/docs/hudozhka_vatin.jpg"],
"view":"page"
"viewer": "img-sheet"
},
{
"name": "EGRYL1",
@@ -70,7 +73,7 @@
"path": "/document/EGRYL1",
"preview": "/img/preview/certificate_egryl1.png",
"url": ["http://static.shburg.org/art/docs/hudozhka_certificate_egryl1.jpg"],
"view":"page"
"viewer": "img-sheet"
},
{
"name": "EGRYL2",
@@ -78,6 +81,6 @@
"path": "/document/EGRYL2",
"preview": "/img/preview/certificate_egryl2.png",
"url": ["http://static.shburg.org/art/docs/hudozhka_certificate_egryl2.jpg"],
"view":"page"
"viewer": "img-sheet"
}
]
+438
View File
@@ -0,0 +1,438 @@
[
{
"name": "1-1",
"tuesday": {
"lesson": "composition",
"teacher": "vv-voronova",
"time": [
"15:00 – 15:45",
"15:55 – 16:40"
]
},
"thursday": {
"lesson": "painting",
"teacher": "od-gogoleva",
"time": [
"15:00 – 15:45",
"15:55 – 16:40"
]
},
"saturday": {
"lesson": "sculpting",
"teacher": "in-vturina",
"time": [
"11:00 – 11:45",
"11:55 – 12:40"
]
}
},
{
"name": "1-2",
"tuesday": {
"lesson": "composition",
"teacher": "vv-voronova",
"time": [
"17:00 – 17:45",
"17:55 – 18:40"
]
},
"thursday": {
"lesson": "painting",
"teacher": "od-gogoleva",
"time": [
"17:00 – 17:45",
"17:55 – 18:40"
]
},
"saturday": {
"lesson": "sculpting",
"teacher": "in-vturina",
"time": [
"13:00 – 13:45",
"13:55 – 14:40"
]
}
},
{
"name": "1-3",
"monday": {
"lesson": "painting",
"teacher": "od-gogoleva",
"time": [
"15:00 – 15:45",
"15:55 – 16:40"
]
},
"friday": {
"lesson": "composition",
"teacher": "vv-voronova",
"time": [
"15:00 – 15:45",
"15:55 – 16:40"
]
},
"saturday": {
"lesson": "sculpting",
"teacher": "in-vturina",
"time": [
"15:00 – 15:45",
"15:55 – 16:40"
]
}
},
{
"name": "2-1",
"monday": {
"lesson": "composition",
"teacher": ".",
"time": [
"15:00 – 15:45",
"15:55 – 16:40"
]
},
"wednesday": {
"lesson": "painting",
"teacher": "od-gogoleva",
"time": [
"15:00 – 15:45",
"15:55 – 16:40"
]
},
"saturday": {
"lesson": "composition",
"teacher": "Тимашева А.С.",
"time": [
"11:00 – 11:45",
"11:55 – 12:40"
]
}
},
{
"name": "2-2",
"monday": {
"lesson": "composition",
"teacher": "nv-andreeva",
"time": [
"17:00 – 17:45",
"17:55 – 18:40"
]
},
"wednesday": {
"lesson": "painting",
"teacher": "od-gogoleva",
"time": [
"17:00 – 17:45",
"17:55 – 18:40"
]
},
"saturday": {
"lesson": "composition",
"teacher": "Тимашева А.С.",
"time": [
"13:00 – 13:45",
"13:55 – 14:40"
]
}
},
{
"name": "2-3",
"monday": {
"lesson": "painting",
"teacher": " ",
"time": [
"17:00 – 17:45",
"17:55 – 18:40"
]
},
"thursday": {
"lesson": "cg",
"teacher": "nv-andreeva",
"time": [
"15:00 – 15:45",
"15:55 – 16:40"
]
},
"friday": {
"lesson": "composition",
"teacher": "Тимашева А.С.",
"time": [
"15:00 – 15:45",
"15:55 – 16:40"
]
}
},
{
"name": "3-1",
"monday": {
"lesson": "drawing",
"teacher": "sa-latipova",
"time": [
"15:00 – 15:45",
"15:55 – 16:40"
]
},
"tuesday": {
"lesson": "composition",
"teacher": "nv-andreeva",
"time": [
"15:00 – 15:45",
"15:55 – 16:40"
]
},
"wednesday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"17:00 – 17:45",
""
]
},
"thursday": {
"lesson": "painting",
"teacher": "sa-latipova",
"time": [
"15:00 – 15:45",
"15:55 – 16:40"
]
},
"saturday": {
"lesson": "cg",
"teacher": "rk-timashev",
"time": [
"13:00 – 13:45",
"13:55 – 14:40"
]
}
},
{
"name": "3-2",
"monday": {
"lesson": "drawing",
"teacher": "sa-latipova",
"time": [
"17:00 – 17:45",
"17:55 – 18:40"
]
},
"tuesday": {
"lesson": "composition",
"teacher": "nv-andreeva",
"time": [
"17:00 – 17:45",
"17:55 – 18:40"
]
},
"wednesday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"17:00 – 17:45",
""
]
},
"thursday": {
"lesson": "painting",
"teacher": ".",
"time": [
"17:00 – 17:45",
"17:55 – 18:40"
]
},
"saturday": {
"lesson": "cg",
"teacher": "rk-timashev",
"time": [
"15:00 – 15:45",
"15:55 – 16:40"
]
}
},
{
"name": "3-3",
"wednesday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"17:00 – 17:45",
""
]
},
"thursday": {
"lesson": "composition",
"teacher": "nv-andreeva",
"time": [
"17:00 – 17:45",
"17:55 – 18:40"
]
},
"friday": {
"lesson": "painting",
"teacher": "Тимашева А.С.",
"time": [
"17:00 – 17:45",
"17:55 – 18:40"
]
},
"saturday": {
"lesson": "drawing",
"teacher": "Тимашева А.С.",
"time": [
"15:00 – 15:45",
"15:55 – 16:40"
]
}
},
{
"name": "4-1",
"monday": {
"lesson": "composition",
"teacher": "vv-voronova",
"time": [
"15:00 – 15:45",
"15:55 – 16:40"
]
},
"tuesday": {
"lesson": "painting",
"teacher": "va-sarzhin",
"time": [
"15:00 – 15:45",
"15:55 – 16:40"
]
},
"wednesday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"18:00 – 18:45",
""
]
},
"friday": {
"lesson": "drawing",
"teacher": "sa-latipova",
"time": [
"15:00 – 15:45",
"15:55 – 16:40"
]
}
},
{
"name": "4-2",
"monday": {
"lesson": "composition",
"teacher": "vv-voronova",
"time": [
"17:00 – 17:45",
"17:55 – 18:40"
]
},
"tuesday": {
"lesson": "painting",
"teacher": "va-sarzhin",
"time": [
"17:00 – 17:45",
"17:55 – 18:40"
]
},
"wednesday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"18:00 – 18:45",
""
]
},
"friday": {
"lesson": "drawing",
"teacher": "sa-latipova",
"time": [
"17:00 – 17:45",
"17:55 – 18:40"
]
}
},
{
"name": "5-1",
"monday": {
"lesson": "painting",
"teacher": ".",
"time": [
"15:00 – 15:45",
"15:55 – 16:40"
]
},
"thursday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"17:00 – 17:45",
""
]
}
},
{
"name": "5-2",
"monday": {
"lesson": "painting",
"teacher": "va-sarzhin",
"time": [
"17:00 – 17:45",
"17:55 – 18:40"
]
},
"tuesday": {
"lesson": "drawing",
"teacher": "mg-timasheva",
"time": [
"17:00 – 17:45",
"17:55 – 18:40"
]
},
"thursday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"17:00 – 17:45",
""
]
}
},
{
"name": "6-1",
"wednesday": {
"lesson": "painting",
"teacher": "va-sarzhin",
"time": [
"17:00 – 17:45",
"17:55 – 18:40"
]
},
"thursday": {
"lesson": "drawing",
"teacher": "mg-timasheva",
"time": [
"16:00 – 17:45",
""
]
},
"friday": {
"lesson": "composition",
"teacher": "vv-voronova",
"time": [
"17:00 – 17:45",
"17:55 18:40"
]
}
},
{
"thursday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"18:00 – 18:45",
""
]
}
}
]
+61
View File
@@ -0,0 +1,61 @@
var pop = require("../utils/populate").pop;
var populate = require("../utils/populate").populate;
const SCHEDULE = require("./schedule-2014-early.json");
const WEEK = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
module.exports = schedule;
function schedule(pops){
var days = function(group){
var result = [];
WEEK.forEach(function(i){
var lesson = group[i];
if(lesson){
result.push(
pop(lesson)
.populate(time())
.populate(pops)
.result()
)
}else{
result.push(null);
}
});
return result;
}
var time = function(){
return function(lesson){
for(var i=0; i < lesson.time.length; i++){
lesson.time[i] = lesson.time[i].replace(" ", "—");
}
return lesson;
}
}
var mondayTime = function(group){
var day;
for(var i=0; i<WEEK.length; i++){
if(group[WEEK[i]]){
day = WEEK[i];
break;
}
}
if(day){
return group[day].time[0].substr(0, 5);
}else{
return "00:00"
}
}
var result = [];
SCHEDULE.forEach(function(group){
result.push({
name: group.name,
days: days(group),
time: mondayTime(group)
});
});
return result;
}
+2 -1
View File
@@ -1,5 +1,6 @@
{
"name": "www.hudozka.su",
"name": "app",
"private": true,
"version": "0.1.0",
"description": "",
"main": "main.js",
+51 -8
View File
@@ -1,14 +1,57 @@
extends ../layout
block custom_head
link(rel="stylesheet", href="/s/document.css")
if doc.viewer == "default"
link(rel='stylesheet', href='/s/pdf.css')
link(rel='stylesheet', href='/s/document.css')
if doc.extra && doc.extra.style
for style in doc.extra.style
link(rel='stylesheet', href='#{style}')
if doc.viewer == "default"
script(src='http://code.jquery.com/jquery-2.1.0.min.js')
script(src='/c/document.js')
if doc.extra && doc.extra.script
for script in doc.extra.script
script(src='#{script}')
block content
.menu.opac
h1
span.bold ДХШ
span.norm Шлиссельбурга,
span.norm #{doc.title}
.doclist
for a in doc.url
img(src='#{a}')
.panel
h1
span.bold ДХШ
span.norm Шлиссельбурга,
span.norm #{doc.title}
.panel.right
if doc.viewer == "default" && doc.url.length > 1
.controls
p.block
span Страница
input#currentPage(pattern='[0-9]{,3}')
| из
span#totalPages
p.block
button#buttonPrev ←
button#buttonNext →
if doc.download
p.block
a.download(href='#{doc.download}')
if doc.viewer == "default"
div(id='page-container')
for url in doc.url
//- p #{url}
.pf(data-page-url='#{url}')
//- img(src='#{url}')
//- //- for url in doc.url
//- //- .pf
//- //- //-
if doc.viewer == "img-sheet"
.doclist
for url in doc.url
img(src='#{url}')
+13 -10
View File
@@ -3,20 +3,22 @@ extends ../layout
block custom_head
link(rel='stylesheet', href='/s/animate.min.css')
link(rel='stylesheet', href='/s/schedule.css')
script(src='http://code.jquery.com/jquery-2.1.0.min.js')
//- script(src='http://code.jquery.com/jquery-2.1.0.min.js')
script(src='/c/jquery-2.1.0.js')
script(src='/c/schedule.js')
block content
include ../menu
.schedule
ul
li
a(href='') 2012, осень
li
a(href='') 2013, весна
li
a(href='') 2013, осень
li.current 2014, весна
p Расписание весеннего семестра 2014 года
//- ul
//- li
//- a(href='') 2012, осень
//- li
//- a(href='') 2013, весна
//- li
//- a(href='') 2013, осень
//- li.current 2014, весна
table
thead
- var days = ["Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"];
@@ -31,7 +33,8 @@ block content
for group in groups
tr
td.group
p #{group.name}
p.name #{group.name}
p.time #{group.time}
for day in group.days
td
if day
+46
View File
@@ -0,0 +1,46 @@
var Router = require("express").Router;
var route = require("./route");
var document = require("../models/document");
var router = new Router();
module.exports = router.middleware;
router.get("/docs", function(req, res){
var url = "/docs";
res.render("docs/docs", {
menu: route.menu(url),
blocks: [
{
type: "documents",
name: "Лицензии, свидетельства и уставы",
items: document.cap(
document.doc(
["statue-2013", "edu-license", "gov-certificate", "VAT", "EGRYL1", "EGRYL2"]
)
)
}
]
});
});
router.get("/document/:doc/:page?", function(req, res){
var name = req.param("doc");
var doc = document.doc(name);
// doc = document.extra(doc, {
// "style": [
// "/s/pdf.css"
// ],
// "script": [
// "http://code.jquery.com/jquery-2.1.0.min.js",
// "/c/document.js"
// ]
// });
if(doc){
doc.startPage = req.param("page");
res.render("document/document", {doc: doc});
}else{
res.error(404);
}
});
-33
View File
@@ -1,41 +1,9 @@
const config = require("../config")
const DOCUMENTS = config.data.documents;
function getMenu(){
return clone(config.data.menu);
}
function getDoc(name, capitalFirstLetter){
if(name && typeof name == "string"){
for(var i=0; i<DOCUMENTS.length; i++){
var doc = DOCUMENTS[i];
if(doc.name == name){
if(capitalFirstLetter) return makeCap(clone(doc));
else return clone(doc);
}
}
return null;
}else if(name && name instanceof Array){
var docs = [];
name.forEach(function(i){
var d = getDoc(i, capitalFirstLetter);
if(d){
docs.push(d);
}
});
return docs;
}else{
return null;
}
}
function makeCap(doc){
var n = doc.name;
// doc.name = n.substr(0, 1).toUpperCase() + n.substr(1);
doc.name = n.charAt(0).toUpperCase() + n.substring(1);
return doc;
}
function clone(obj){
if(obj == null || typeof(obj) != 'object')
return obj;
@@ -55,7 +23,6 @@ exports.menu = function(url){
return m;
}
exports.doc = getDoc;
exports.team = function(processor) {
var list = [];
config.data.team.forEach(function(m){
+15
View File
@@ -0,0 +1,15 @@
var Router = require("express").Router;
var config = require("../config");
var route = require("./route");
var router = new Router();
module.exports = router.middleware;
router.get("/schedule", function(req, res){
var url = "/schedule";
res.render("schedule/schedule", {
menu: route.menu(url),
groups: config.data.schedule
});
});
+4 -3
View File
@@ -22,9 +22,10 @@ server.get("/", function(req, res){
});
});
server.use(require("./routers/schedule.router").middleware);
server.use(require("./routers/schedule"));
server.use(require("./routers/team.router").middleware);
server.use(require("./routers/doc.router").middleware);
server.use(require("./routers/docs"));
server.listen(config.port);
console.log("welcome!");
console.log("welcome!");
// console.log(JSON.stringify(config.data.schedule, null, "\t"));
+38
View File
@@ -0,0 +1,38 @@
exports.pop = pop;
exports.populate = populate;
function pop(data){
var Populator = function(data){
this.target = data;
}
Populator.prototype = {
populate: function(p){
var self = this;
if(typeof p == "function"){
self.target = p(self.target);
}else if(p instanceof Array){
p.forEach(function(i){
self.target = self.populate(i).result();
});
}
return self;
},
result: function(){
return this.target;
}
};
var fun = new Populator(data);
return fun;
}
function populate(find, field){
return function(lesson){
var id = lesson[field];
var val = find(id);
if(val) lesson[field] = val;
return lesson;
}
}