-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee79fc9
commit ca3c39f
Showing
14 changed files
with
135 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
* { margin: 0; padding: 0; box-sizing: border-box; } | ||
body { font: 13px Helvetica, Arial; } | ||
div { background: #000000; padding: 1px; position: relative;right: 0; bottom: 0;width: 100%;border: 1px solid black } | ||
div input { border: 0; padding: 10px; width: 90%; margin-right: 1px; outline:none;border: 1px solid black;background: #ffffff; | ||
div input { border: 0; padding: 10px; width: 100%; margin-right: 1px; outline:none;border: 1px solid black;background: #ffffff; | ||
font-size: 15px;} | ||
div button { width: calc(10% - 1px); border: none;border-radius: 0} | ||
#conversation { list-style-type: none; margin: 0; padding: 0; } | ||
#conversation li { padding: 5px 10px; } | ||
.server { background: #444444; } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
* { margin: 0; padding: 0; box-sizing: border-box; } | ||
body { font: 13px Helvetica, Arial; } | ||
div { background: #000000; padding: 1px; position: relative;right: 0; bottom: 0;width: 100%;border: 1px solid black } | ||
div input { border: 0; padding: 10px; width: 90%; margin-right: 1px; outline:none;border: 1px solid black;background: #ffffff; | ||
div input { border: 0; padding: 10px; width: 100%; margin-right: 1px; outline:none;border: 1px solid black;background: #ffffff; | ||
font-size: 15px;} | ||
div button { width: calc(10% - 1px); border: none;border-radius: 0} | ||
#conversation { list-style-type: none; margin: 0; padding: 0; } | ||
#conversation li { padding: 5px 10px; } | ||
#conversation li:nth-child(odd) { background: #dddddd; } | ||
.server { background: #444444; } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
|
||
import { AuthGuardService } from './auth-guard.service'; | ||
|
||
describe('AuthGuardService', () => { | ||
beforeEach(() => TestBed.configureTestingModule({})); | ||
|
||
it('should be created', () => { | ||
const service: AuthGuardService = TestBed.get(AuthGuardService); | ||
expect(service).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { HomeComponent } from './../home/home.component' | ||
import { | ||
CanActivate, | ||
CanActivateChild, | ||
CanDeactivate, | ||
ActivatedRouteSnapshot, | ||
RouterStateSnapshot | ||
} from '@angular/router'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class AuthGuardService implements CanDeactivate<HomeComponent> { | ||
|
||
constructor() { } | ||
canDeactivate(component: HomeComponent) { | ||
// if ( window.confirm('Are you sure you want to leave the room?')) { | ||
// console.log('inside deactivate, Allowed'); | ||
// // load disconnect script | ||
// this.loadScript('../assets/socket.io/client/close-connection.js'); | ||
// return true; | ||
// } else { | ||
// console.log('inside deactivate, Not Allowed'); | ||
// return false; | ||
// } | ||
this.loadScript('../assets/socket.io/client/close-connection.js'); | ||
return true; | ||
} | ||
// load script function | ||
public loadScript(url: string) { | ||
const body = document.body as HTMLDivElement; | ||
const script = document.createElement('script'); | ||
script.innerHTML = ''; | ||
script.src = url; | ||
script.async = false; | ||
script.defer = true; | ||
body.appendChild(script); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// var sock; | ||
if(typeof socket !== 'undefined') { | ||
|
||
socket.emit('sendVisibility', false); | ||
console.log('connection is closed'); | ||
socket.disconnect(); | ||
}else{ | ||
console.log('no connection is open'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters