Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Codecrew
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
30
Merge Requests
2
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5ec07a05
authored
Sep 21, 2018
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If user scrolls iframe, we remove it
1 parent
7d108edd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
code/moya-angular/src/app/modules/old-moya/old-moya.component.html
code/moya-angular/src/app/modules/old-moya/old-moya.component.ts
code/moya-angular/src/app/modules/old-moya/old-moya.component.html
View file @
5ec07a0
<iframe
id=
"oldMoyaFrame"
[
src
]="
frameUrl
|
safe
"
[
height
]="
height
"
#
iframe
(
load
)="
changeUrl
()"
frameborder=
"0"
></iframe>
<iframe
id=
"oldMoyaFrame"
[
src
]="
frameUrl
|
safe
"
[
height
]="
height
"
#
iframe
(
load
)="
changeUrl
()"
frameborder=
"0"
></iframe>
code/moya-angular/src/app/modules/old-moya/old-moya.component.ts
View file @
5ec07a0
import
{
map
}
from
'rxjs/operators'
;
import
{
Component
,
OnInit
,
ViewChild
,
ElementRef
}
from
'@angular/core'
;
import
{
Component
,
OnInit
,
ViewChild
,
ElementRef
,
ApplicationRef
,
ChangeDetectorRef
}
from
'@angular/core'
;
import
{
Location
,
LocationStrategy
,
HashLocationStrategy
,
PathLocationStrategy
}
from
'@angular/common'
;
import
{
NavigationExtras
,
ActivatedRoute
,
Router
}
from
'@angular/router'
;
import
{
angularCoreEnv
}
from
"@angular/core/src/render3/jit/environment"
;
@
Component
({
selector
:
'moya-old'
,
...
...
@@ -22,10 +23,9 @@ export class OldMoyaComponent implements OnInit {
constructor
(
private
location
:
Location
,
private
route
:
ActivatedRoute
)
{
constructor
(
private
location
:
Location
,
private
route
:
ActivatedRoute
,
private
changeDetectionRef
:
ChangeDetectorRef
)
{
route
.
queryParamMap
.
pipe
(
map
(
a
=>
a
.
get
(
'p'
))).
subscribe
(
x
=>
{
console
.
log
(
x
);
if
(
x
)
{
this
.
frameUrl
=
'/MoyaWeb/'
+
x
.
replace
(
'::'
,
'?'
);
}
...
...
@@ -42,12 +42,18 @@ export class OldMoyaComponent implements OnInit {
this
.
location
.
replaceState
(
this
.
location
.
path
(
false
).
split
(
'?'
,
1
)[
0
]
+
'?p='
+
tmpFrameUrl
[
1
].
replace
(
'?'
,
'::'
)
);
}
this
.
iframe
.
nativeElement
.
contentWindow
.
onscroll
=
(()
=>
{
this
.
fixHeight
(
this
)});
console
.
log
(
this
.
iframe
.
nativeElement
.
contentWindow
.
document
.
body
.
height
);
this
.
height
=
(
this
.
iframe
.
nativeElement
.
contentWindow
.
document
.
body
.
scrollHeight
+
50
)
+
'px'
;
this
.
fixHeight
(
this
);
}
fixHeight
(
self
)
{
console
.
log
(
self
.
iframe
.
nativeElement
.
contentWindow
.
document
.
body
.
scrollHeight
);
if
(
self
.
height
!=
(
self
.
iframe
.
nativeElement
.
contentWindow
.
document
.
body
.
scrollHeight
+
50
)
+
'px'
)
{
self
.
height
=
(
self
.
iframe
.
nativeElement
.
contentWindow
.
document
.
body
.
scrollHeight
+
50
)
+
'px'
;
this
.
changeDetectionRef
.
detectChanges
();
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment