mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
clean create event page, stop video, event list box
This commit is contained in:
@@ -24,13 +24,54 @@ export class DomSanitizerService {
|
||||
}
|
||||
|
||||
private encodeSpecialCharacters(input: string): string {
|
||||
const specialCharactersMap: Record<string, string> = {
|
||||
'!': '!',
|
||||
'@': '@',
|
||||
'#': '#',
|
||||
'$': '$',
|
||||
'%': '%',
|
||||
'^': '^',
|
||||
'&': '&',
|
||||
'*': '*',
|
||||
'(': '(',
|
||||
')': ')',
|
||||
'-': '-',
|
||||
'_': '_',
|
||||
'+': '+',
|
||||
'=': '=',
|
||||
'{': '{',
|
||||
'}': '}',
|
||||
'|': '|',
|
||||
'\\': '\',
|
||||
':': ':',
|
||||
';': ';',
|
||||
'"': '"',
|
||||
"'": ''',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
',': ',',
|
||||
'.': '.',
|
||||
'?': '?',
|
||||
'/': '/',
|
||||
'ã': 'ã', // ã
|
||||
'ç': 'ç', // ç
|
||||
'Â': 'Â', // Â
|
||||
'â': 'â', // â
|
||||
'Ã': 'Ã', // Ã
|
||||
};
|
||||
|
||||
return input.replace(/[!@#$%^&*()-_+=\{\}|\\:;"'<>,.?/ãçÂâÃ]/g, match => specialCharactersMap[match] || match);
|
||||
}
|
||||
|
||||
|
||||
// private encodeSpecialCharacters(input: string): string {
|
||||
// You can use a library like DOMPurify to encode special characters
|
||||
return DOMPurify.sanitize(input);
|
||||
// return DOMPurify.sanitize(input);
|
||||
|
||||
// If you don't want to use an external library, you can manually encode
|
||||
// Here's a simple example, you may need to extend this based on your requirements
|
||||
/* return input.replace(/</g, '<').replace(/>/g, '>'); */
|
||||
}
|
||||
// }
|
||||
|
||||
/* sanitizeInput(input: string): string {
|
||||
return this.sanitizer.sanitize(SecurityContext.HTML, input);
|
||||
|
||||
@@ -15,6 +15,9 @@ export class VisibilityDirective {
|
||||
threshold: 0.5 // Adjust as needed
|
||||
};
|
||||
|
||||
|
||||
console.log(this.elementRef.nativeElement.parentElement, "=1=")
|
||||
|
||||
this.intersectionObserver = new IntersectionObserver(entries => {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting) {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import { VisibilityDirective } from './visibility.directive';
|
||||
|
||||
describe('VisibilityDirective', () => {
|
||||
it('should create an instance', () => {
|
||||
const directive = new VisibilityDirective();
|
||||
expect(directive).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,36 @@
|
||||
import { Directive, ElementRef, Input } from '@angular/core';
|
||||
|
||||
@Directive({
|
||||
selector: '[appVisibility]'
|
||||
})
|
||||
export class VisibilityDirective {
|
||||
|
||||
intersectionObserver: IntersectionObserver;
|
||||
@Input() appVisibility: (arg: any) => void;
|
||||
|
||||
constructor(private elementRef: ElementRef) {
|
||||
const options = {
|
||||
root: null,
|
||||
rootMargin: '0px',
|
||||
threshold: 0.5 // Adjust as needed
|
||||
};
|
||||
|
||||
|
||||
console.log(this.elementRef.nativeElement.parentElement, "=1=")
|
||||
|
||||
this.intersectionObserver = new IntersectionObserver(entries => {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting) {
|
||||
this.appVisibility(true);
|
||||
} else {
|
||||
this.elementRef.nativeElement.pause()
|
||||
// Pause video when not visible
|
||||
this.appVisibility(false); // You can implement pause logic here
|
||||
}
|
||||
});
|
||||
}, options);
|
||||
|
||||
this.intersectionObserver.observe(this.elementRef.nativeElement);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user