Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
internship
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Skripnikov
internship
Commits
a06f1446
Commit
a06f1446
authored
Feb 08, 2018
by
Alina Habibulina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+ shot date period
parent
b0acfdc3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
75 deletions
+19
-75
src/main/webapp/js/Player.js
src/main/webapp/js/Player.js
+19
-75
No files found.
src/main/webapp/js/Player.js
View file @
a06f1446
...
@@ -125,86 +125,30 @@ var portal = {
...
@@ -125,86 +125,30 @@ var portal = {
},
},
main
:
function
(
view
,
model
)
{
main
:
function
(
view
,
model
)
{
function
zeroCheck
(
num
){
if
(
num
<
10
)
{
num
=
"
0
"
+
num
;}
return
num
;
};
var
serverDateTime
=
portal
.
player
.
model
.
getModelWithId
(
"
ts_date_created
"
).
value
;
var
serverDateTime
=
portal
.
player
.
model
.
getModelWithId
(
"
ts_date_created
"
).
value
;
var
serverDate
=
serverDateTime
.
substr
(
0
,
serverDateTime
.
length
-
9
);
var
WeekDay
=
new
Date
(
serverDateTime
);
var
serverWeekDay
=
new
Date
(
serverDate
).
getDay
();
WeekDay
=
WeekDay
.
getDay
();
var
shift
=
7
-
WeekDay
;
switch
(
serverWeekDay
){
case
0
:
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_to
"
).
setValue
(
WeekCalculating
(
serverDate
,
7
));
//0 день воскресение прошлой недели
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_from
"
).
setValue
(
WeekCalculating
(
serverDate
,
1
));
// 1й день пндк нашей недели
break
;
case
1
:
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_to
"
).
setValue
(
WeekCalculating
(
serverDate
,
6
));
//0 день воскресение прошлой недели
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_from
"
).
setValue
(
WeekCalculating
(
serverDate
,
0
));
// 1й день пндк нашей недели
break
;
case
2
:
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_to
"
).
setValue
(
WeekCalculating
(
serverDate
,
5
));
//0 день воскресение прошлой недели
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_from
"
).
setValue
(
WeekCalculating
(
serverDate
,
(
-
1
)));
// 1й день пндк нашей недели
break
;
case
3
:
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_to
"
).
setValue
(
WeekCalculating
(
serverDate
,
4
));
//0 день воскресение прошлой недели
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_from
"
).
setValue
(
WeekCalculating
(
serverDate
,
(
-
2
)));
// 1й день пндк нашей недели
break
;
case
4
:
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_to
"
).
setValue
(
WeekCalculating
(
serverDate
,
3
));
//0 день воскресение прошлой недели
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_from
"
).
setValue
(
WeekCalculating
(
serverDate
,
(
-
3
)));
// 1й день пндк нашей недели
break
;
case
5
:
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_to
"
).
setValue
(
WeekCalculating
(
serverDate
,
2
));
//0 день воскресение прошлой недели
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_from
"
).
setValue
(
WeekCalculating
(
serverDate
,
(
-
4
)));
// 1й день пндк нашей недели
break
;
case
6
:
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_to
"
).
setValue
(
WeekCalculating
(
serverDate
,
1
));
//0 день воскресение прошлой недели
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_from
"
).
setValue
(
WeekCalculating
(
serverDate
,
(
-
5
)));
// 1й день пндк нашей недели
break
;
case
7
:
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_to
"
).
setValue
(
WeekCalculating
(
serverDate
,
0
));
//0 день воскресение прошлой недели
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_from
"
).
setValue
(
WeekCalculating
(
serverDate
,
(
-
6
)));
// 1й день пндк нашей недели
break
;
}
function
WeekCalculating
(
fullDate
,
shift
){
var
sunday
=
new
Date
(
serverDateTime
);
var
year
=
fullDate
.
substr
(
0
,
(
fullDate
.
length
-
6
));
sunday
.
setDate
(
sunday
.
getDate
()
+
shift
);
var
month
=
fullDate
.
substr
(
5
,
(
fullDate
.
length
));
var
monday
=
new
Date
(
serverDateTime
);
month
=
month
.
substr
(
0
,
(
month
.
length
-
3
));
monday
.
setDate
(
sunday
.
getDate
()
-
6
);
var
day
=
fullDate
.
substr
(
8
,
fullDate
.
length
);
day
=
parseInt
(
day
)
+
shift
;
var
StrSunday
=
sunday
.
getFullYear
()
+
"
-
"
+
zeroCheck
(
sunday
.
getMonth
()
+
1
)
+
"
-
"
+
zeroCheck
(
sunday
.
getDate
());
switch
(
month
){
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_to
"
).
setValue
(
StrSunday
);
case
"
01
"
:
case
"
03
"
:
var
StrMonday
=
monday
.
getFullYear
()
+
"
-
"
+
zeroCheck
(
monday
.
getMonth
()
+
1
)
+
"
-
"
+
zeroCheck
(
monday
.
getDate
());
case
"
05
"
:
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_from
"
).
setValue
(
StrMonday
);
case
"
07
"
:
case
"
08
"
:
case
"
10
"
:
case
"
12
"
:
if
(
parseInt
(
day
)
>
31
)
{
month
=
parseInt
(
month
)
+
1
;
day
=
"
01
"
;}
break
;
case
"
04
"
:
case
"
06
"
:
case
"
09
"
:
case
"
11
"
:
if
(
parseInt
(
day
)
>
30
)
{
month
=
parseInt
(
month
)
+
1
;
day
=
"
01
"
;}
break
;
case
"
02
"
:
if
((
parseInt
(
year
)
%
4
==
0
)
||
(
parseInt
(
year
)
%
400
==
0
))
{
if
(
parseInt
(
day
)
>
29
)
{
month
=
parseInt
(
month
)
+
1
;
day
=
"
01
"
;}
}
else
{
if
(
parseInt
(
day
)
>
28
)
{
month
=
parseInt
(
month
)
+
1
;
day
=
"
01
"
;}
}
break
;
}
if
((
parseInt
(
month
)
+
shift
)
>
12
)
{
month
=
"
01
"
;
year
=
year
+
1
;
}
/////если месяцев больше 12, то увелививаем год
if
(
parseInt
(
day
)
<
10
)
day
=
"
0
"
+
day
;
var
finalDate
=
year
+
"
-
"
+
month
+
"
-
"
+
day
;
return
finalDate
;
}
}
}
};
};
//переменные для WaitCircles();
//переменные для WaitCircles();
var
currentTime
=
Date
.
now
(),
var
currentTime
=
Date
.
now
(),
r
=
40
,
r
=
40
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment