Toggle navigation
Toggle navigation
This project
Loading...
Sign in
최원석
/
2021-1-database-project
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
1seok2
2021-03-09 23:02:13 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1d5c330497853e0066003444abbd51f0167d02fa
1d5c3304
1 parent
0df4ad29
add scss loader & SPA animation
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
148 additions
and
17 deletions
app/package.json
app/src/App.ts
app/src/assets/style/App.css → app/src/assets/style/App.scss
app/src/assets/style/PageTransition.scss
app/src/components/pageTransition.ts
app/src/config/url.ts
app/src/index.ts
app/webpack.config.js
server.py
app/package.json
View file @
1d5c330
...
...
@@ -26,6 +26,8 @@
"file-loader"
:
"^6.2.0"
,
"gts"
:
"^3.1.0"
,
"html-webpack-plugin"
:
"^5.3.0"
,
"node-sass"
:
"^5.0.0"
,
"sass-loader"
:
"^11.0.1"
,
"style-loader"
:
"^2.0.0"
,
"ts-loader"
:
"^8.0.17"
,
"typescript"
:
"^4.0.3"
,
...
...
app/src/App.ts
View file @
1d5c330
...
...
@@ -9,6 +9,8 @@
import
Header
from
"./views/header/Header"
;
import
Body
from
"./views/body/Body"
;
import
Footer
from
"./views/footer/Footer"
;
import
'./assets/style/App.scss'
;
import
'./assets/style/PageTransition.scss'
;
const
App
=
(
pathname
:
string
)
:
string
=>
{
history
.
pushState
(
''
,
''
,
pathname
);
...
...
app/src/assets/style/App.css
→
app/src/assets/style/App.
s
css
View file @
1d5c330
body
{
background-color
:
beige
;
margin
:
0
;
padding
:
0
;
}
\ No newline at end of file
...
...
app/src/assets/style/PageTransition.scss
0 → 100644
View file @
1d5c330
@keyframes
page-initial-bottom
{
0
%
{
opacity
:
1
;
background-color
:
white
;
}
100
%
{
opacity
:
0
;
background-color
:
white
;
}
}
@keyframes
page-blink-bottom
{
0
%
{
opacity
:
0
;
top
:
50%
;
left
:
50%
}
40
%
{
opacity
:
1
;
left
:
50%
;
}
50
%
{
left
:
50%
;
}
100
%
{
opacity
:
1
;
left
:
-70%
;
}
}
@keyframes
page-top-left
{
0
%
{
left
:
50%
;
top
:
170%
;
}
50
%
{
top
:
50%
;
left
:
50%
;
}
100
%
{
top
:
50%
;
left
:
-70%
;
}
}
.page-transition
{
width
:
120%
;
height
:
120%
;
position
:
fixed
;
left
:
50%
;
top
:
50%
;
transform
:
translate
(
-50%
,-
50%
);
background-color
:
#353535
;
z-index
:
1
;
display
:
none
;
&
.transition-0
{
animation
:
ease-in-out
1
.2s
page-initial-bottom
;
}
&
.transition-1
{
animation
:
ease-in-out
2
.4s
page-blink-bottom
;
}
&
.transition-2
{
animation
:
ease-in-out
2
.4s
page-top-left
;
}
}
\ No newline at end of file
app/src/components/pageTransition.ts
0 → 100644
View file @
1d5c330
/**
* @author : wonseog
* @date : 2021/03/09
* @description : 페이지 이동 효과 주는 함수
**/
let
$div
:
HTMLDivElement
|
null
;
const
pageTransitionClassList
=
[
"transition-0"
,
"transition-1"
,
"transition-2"
]
const
getDivs
=
()
:
HTMLDivElement
|
null
=>
document
.
querySelector
(
'.page-transition'
);
const
turnOnAndOff
=
(
idx
:
number
)
=>
{
$div
&&
(()
=>
{
$div
.
classList
.
toggle
(
pageTransitionClassList
[
idx
]);
$div
.
style
.
display
=
'block'
;
setTimeout
(()
=>
{
$div
&&
(()
=>
{
$div
.
style
.
display
=
'none'
;
$div
.
classList
.
toggle
(
pageTransitionClassList
[
idx
]);
})()
},
idx
===
0
?
1000
:
2400
);
})()
}
export
const
initialTrantition
=
()
=>
{
$div
=
$div
||
getDivs
();
$div
&&
turnOnAndOff
(
0
);
}
export
const
randomTransition
=
()
=>
{
$div
=
$div
||
getDivs
();
const
randomIndex
=
Math
.
floor
(
Math
.
random
()
*
(
pageTransitionClassList
.
length
-
1
)
+
1
);
$div
&&
turnOnAndOff
(
randomIndex
);
}
\ No newline at end of file
app/src/config/url.ts
View file @
1d5c330
export
const
BASE_URL
=
'http://localhost:
500
0/'
;
export
const
BASE_URL
=
'http://localhost:
808
0/'
;
...
...
app/src/index.ts
View file @
1d5c330
...
...
@@ -3,20 +3,46 @@
* @date : 2021/03/08
* @description : 현재 pathname을 파악 후 App으로 전달
**/
import
App
from
'./App'
;
import
{
BASE_URL
}
from
'./config/url'
;
import
{
initialTrantition
,
randomTransition
}
from
"./components/pageTransition"
;
window
.
addEventListener
(
'DOMContentLoaded'
,
()
=>
{
/* add div for page transitions */
(()
=>
{
const
$div
=
document
.
createElement
(
'div'
);
$div
.
className
=
"page-transition"
;
document
.
body
.
appendChild
(
$div
);
initialTrantition
();
})();
const
$App
=
document
.
querySelector
(
'#App'
);
const
pathname
=
window
.
location
.
pathname
.
split
(
'/'
)[
1
];
/* change url */
window
.
addEventListener
(
'popstate'
,
()
=>
{
$App
&&
(
$App
.
innerHTML
=
App
(
pathname
))
});
/* initial render */
$App
&&
(
$App
.
innerHTML
=
App
(
pathname
));
document
.
body
.
addEventListener
(
'click'
,
async
(
e
)
=>
{
e
.
stopPropagation
();
/* add navigation click event */
if
((
e
.
target
as
HTMLAnchorElement
).
matches
(
"[data-link]"
)){
const
href
=
(
e
.
target
as
HTMLAnchorElement
).
href
.
split
(
BASE_URL
)[
1
];
const
href
:
string
=
(
e
.
target
as
HTMLAnchorElement
).
href
.
split
(
BASE_URL
)[
1
];
e
.
preventDefault
();
$App
&&
(
$App
.
innerHTML
=
App
(
href
));
}
else
if
((
e
.
target
as
HTMLAnchorElement
).
id
===
'update-button'
)
{
setTimeout
(()
=>
{
$App
&&
(
$App
.
innerHTML
=
App
(
href
));
},
1200
);
randomTransition
();
}
/* add POST event for button */
else
if
((
e
.
target
as
HTMLAnchorElement
).
id
===
'update-button'
)
{
let
result
:
any
=
null
;
const
insta_id
=
(
document
.
querySelector
(
'#id-input'
)
as
HTMLInputElement
).
value
;
...
...
@@ -32,10 +58,4 @@ window.addEventListener('DOMContentLoaded', () => {
}
}
});
window
.
addEventListener
(
'popstate'
,
()
=>
{
$App
&&
(
$App
.
innerHTML
=
App
(
pathname
))
});
$App
&&
(
$App
.
innerHTML
=
App
(
pathname
));
})
\ No newline at end of file
...
...
app/webpack.config.js
View file @
1d5c330
...
...
@@ -15,8 +15,8 @@ module.exports = {
exclude
:
/node_modules/
,
},
{
test
:
/
\.
css$/
,
use
:
[
'style-loader'
,
'css-loader'
],
test
:
/
\.
s
css$/
,
use
:
[
'style-loader'
,
'css-loader'
,
'sass-loader'
],
},
{
test
:
/
\.(
png|jpe
?
g|gif|jp2|webp
)
$/
,
...
...
server.py
View file @
1d5c330
...
...
@@ -2,9 +2,6 @@ import os
from
flask
import
Flask
,
render_template
,
request
,
jsonify
,
send_from_directory
from
crawler.crawler_instagram
import
crawler_instagram
# my_path = '/Users/choewonseog/Documents/check-your-instagram/app/public'
# my_path = 'C:/Users/goesnow/Documents/study/check-your-instagram/app/public'
root_dir
=
os
.
path
.
dirname
(
os
.
getcwd
())
my_path
=
os
.
path
.
join
(
root_dir
,
'check-your-instagram'
,
'app'
,
'public'
)
app
=
Flask
(
__name__
,
static_folder
=
os
.
path
.
abspath
(
my_path
))
...
...
@@ -39,4 +36,4 @@ if __name__ == "__main__":
print
(
" server is start"
)
print
(
"-"
*
60
)
app
.
run
(
debug
=
True
)
app
.
run
(
host
=
"localhost"
,
port
=
8080
,
debug
=
True
)
...
...
Please
register
or
login
to post a comment