landing pages: update spam words list

This commit is contained in:
argirok 2021-08-13 11:43:26 +03:00
parent f51e47afa0
commit 01edbef93c
1 changed files with 54 additions and 54 deletions

View File

@ -46,20 +46,20 @@ export class ResultLandingComponent {
public relation: string = 'trust'; public relation: string = 'trust';
public id: string; public id: string;
public title: string; public title: string;
/*Show all organizations*/ /*Show all organizations*/
public showAll: boolean = false; public showAll: boolean = false;
// Links for SEO // Links for SEO
public linkToLandingPage: string = null; public linkToLandingPage: string = null;
public canonicalUrl: string = null; public canonicalUrl: string = null;
public linkToSearchPage: string = null; public linkToSearchPage: string = null;
public thresholdDescription: number = 670; public thresholdDescription: number = 670;
public showNumDescription: number = 670; public showNumDescription: number = 670;
public citeThisClicked: boolean; public citeThisClicked: boolean;
// Metrics tab variables // Metrics tab variables
public metricsClicked: boolean; public metricsClicked: boolean;
public hasAltMetrics: boolean = false; public hasAltMetrics: boolean = false;
@ -68,7 +68,7 @@ export class ResultLandingComponent {
public totalViews: number; public totalViews: number;
public totalDownloads: number; public totalDownloads: number;
public pageViews: number; public pageViews: number;
// Custom tab paging variables // Custom tab paging variables
public referencesPage: number = 1; public referencesPage: number = 1;
public bioentitiesPage: number = 1; public bioentitiesPage: number = 1;
@ -79,7 +79,7 @@ export class ResultLandingComponent {
public organizationsPage: number = 1; public organizationsPage: number = 1;
public openCitationsPage: number = 1; public openCitationsPage: number = 1;
public pageSize: number = 10; public pageSize: number = 10;
// Map counting variables // Map counting variables
public bioentitiesNum: number = 0; public bioentitiesNum: number = 0;
public relatedResultsNum: number = 0; public relatedResultsNum: number = 0;
@ -89,7 +89,7 @@ export class ResultLandingComponent {
public errorMessage = ""; public errorMessage = "";
public showLoading: boolean = true; public showLoading: boolean = true;
public dashboard = properties.isDashboard; public dashboard = properties.isDashboard;
public routerHelper: RouterHelper = new RouterHelper(); public routerHelper: RouterHelper = new RouterHelper();
public activeTab: string = null; public activeTab: string = null;
private reloadEnermapsDetails: boolean = true; private reloadEnermapsDetails: boolean = true;
@ -129,7 +129,7 @@ export class ResultLandingComponent {
private _location: Location, private _location: Location,
private indexInfoService: IndexInfoService) { private indexInfoService: IndexInfoService) {
} }
ngOnInit() { ngOnInit() {
if (typeof document !== 'undefined') { if (typeof document !== 'undefined') {
this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => { this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
@ -231,7 +231,7 @@ export class ResultLandingComponent {
})); }));
} }
} }
private getDivContents() { private getDivContents() {
if (this.communityId) { if (this.communityId) {
this.subscriptions.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { this.subscriptions.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
@ -248,13 +248,13 @@ export class ResultLandingComponent {
}); });
this._vocabulariesService.clearSubscriptions(); this._vocabulariesService.clearSubscriptions();
} }
public pidInit(event) { public pidInit(event) {
this.pid = event; this.pid = event;
this.cdr.detectChanges(); this.cdr.detectChanges();
} }
public getTypeName(): string { public getTypeName(): string {
if (this.type === "dataset") { if (this.type === "dataset") {
return "research data"; return "research data";
@ -264,7 +264,7 @@ export class ResultLandingComponent {
return this.type; return this.type;
} }
} }
public removeUnknown(array: string[], type: boolean = false): string[] { public removeUnknown(array: string[], type: boolean = false): string[] {
if (type) { if (type) {
return this.removeDuplicates(array).filter(value => value.toLowerCase() !== 'unknown'); return this.removeDuplicates(array).filter(value => value.toLowerCase() !== 'unknown');
@ -272,12 +272,12 @@ export class ResultLandingComponent {
return array.filter(value => value.toLowerCase() !== 'unknown'); return array.filter(value => value.toLowerCase() !== 'unknown');
} }
} }
public removeDuplicates(array: string[]): string[] { public removeDuplicates(array: string[]): string[] {
let type = this.getTypeName(); let type = this.getTypeName();
return array.filter(value => value.toLowerCase() !== type); return array.filter(value => value.toLowerCase() !== type);
} }
private getOpenCitations() { private getOpenCitations() {
this.subscriptions.push(this._resultLandingService.getOpenCitations(this.id, this.properties).subscribe( this.subscriptions.push(this._resultLandingService.getOpenCitations(this.id, this.properties).subscribe(
data => { data => {
@ -288,7 +288,7 @@ export class ResultLandingComponent {
} }
)); ));
} }
private getProvenanceVocabularyAndResultLandingInfo() { private getProvenanceVocabularyAndResultLandingInfo() {
this.warningMessage = ''; this.warningMessage = '';
this.errorMessage = ''; this.errorMessage = '';
@ -306,9 +306,9 @@ export class ResultLandingComponent {
} else { } else {
this.getResultLandingInfo(null); this.getResultLandingInfo(null);
} }
} }
private setActiveTab() { private setActiveTab() {
if (this.hasPrimaryInfo || this.hasSecondaryInfo) { if (this.hasPrimaryInfo || this.hasSecondaryInfo) {
this.activeTab = 'summary'; this.activeTab = 'summary';
@ -326,7 +326,7 @@ export class ResultLandingComponent {
this.activeTab = "enermaps"; this.activeTab = "enermaps";
} }
} }
// private get numberOfTabs(): number { // private get numberOfTabs(): number {
// let numberOfTabs = 0; // let numberOfTabs = 0;
// if(this.hasPrimaryInfo || this.hasSecondaryInfo) { // if(this.hasPrimaryInfo || this.hasSecondaryInfo) {
@ -348,7 +348,7 @@ export class ResultLandingComponent {
// } // }
// return numberOfTabs; // return numberOfTabs;
// } // }
private getResultLandingInfo(provenanceActionVocabulary: any) { private getResultLandingInfo(provenanceActionVocabulary: any) {
if(this.resultFromInput && this.resultLandingInfo){ if(this.resultFromInput && this.resultLandingInfo){
this.showLoading = false; this.showLoading = false;
@ -385,7 +385,7 @@ export class ResultLandingComponent {
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subscriptions.push(this._piwikService.trackViewForCustomUrl(this.properties, this.resultLandingInfo.title, this.linkToLandingPage.split("?")[1] + this.id ,this.piwikSiteId).subscribe()); this.subscriptions.push(this._piwikService.trackViewForCustomUrl(this.properties, this.resultLandingInfo.title, this.linkToLandingPage.split("?")[1] + this.id ,this.piwikSiteId).subscribe());
} }
let bioentitiesNum = 0; let bioentitiesNum = 0;
if (this.resultLandingInfo.bioentities != undefined) { if (this.resultLandingInfo.bioentities != undefined) {
this.resultLandingInfo.bioentities.forEach(function (value, key, map) { this.resultLandingInfo.bioentities.forEach(function (value, key, map) {
@ -421,7 +421,7 @@ export class ResultLandingComponent {
if (err.status == 404) { if (err.status == 404) {
this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": this.type}}); this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": this.type}});
} }
if (this.type == "publication" || this.type == "software") { if (this.type == "publication" || this.type == "software") {
this.errorMessage = 'No ' + this.type + ' found'; this.errorMessage = 'No ' + this.type + ' found';
} else if (this.type == "dataset") { } else if (this.type == "dataset") {
@ -434,32 +434,32 @@ export class ResultLandingComponent {
} }
)); ));
} }
public metricsResults($event) { public metricsResults($event) {
this.totalViews = $event.totalViews; this.totalViews = $event.totalViews;
this.totalDownloads = $event.totalDownloads; this.totalDownloads = $event.totalDownloads;
this.pageViews = $event.pageViews; this.pageViews = $event.pageViews;
} }
public get hasPrimaryInfo(): boolean { public get hasPrimaryInfo(): boolean {
return !!this.resultLandingInfo && (!!this.resultLandingInfo.description || !!this.resultLandingInfo.identifiers || !!this.resultLandingInfo.subjects); return !!this.resultLandingInfo && (!!this.resultLandingInfo.description || !!this.resultLandingInfo.identifiers || !!this.resultLandingInfo.subjects);
} }
public get hasSecondaryInfo(): boolean { public get hasSecondaryInfo(): boolean {
return (this.resultLandingInfo.fundedByProjects && this.resultLandingInfo.fundedByProjects.length > 0) || return (this.resultLandingInfo.fundedByProjects && this.resultLandingInfo.fundedByProjects.length > 0) ||
(this.resultLandingInfo.contexts && this.resultLandingInfo.contexts.length > 0) || (this.resultLandingInfo.contexts && this.resultLandingInfo.contexts.length > 0) ||
(this.resultLandingInfo.hostedBy_collectedFrom && this.resultLandingInfo.hostedBy_collectedFrom.length > 0); (this.resultLandingInfo.hostedBy_collectedFrom && this.resultLandingInfo.hostedBy_collectedFrom.length > 0);
} }
public get hasMetrics(): boolean { public get hasMetrics(): boolean {
return !(this.totalViews && this.totalDownloads && this.pageViews) || this.totalViews > 0 || this.totalDownloads > 0 || this.pageViews > 0; return !(this.totalViews && this.totalDownloads && this.pageViews) || this.totalViews > 0 || this.totalDownloads > 0 || this.pageViews > 0;
} }
private updateDescription(description: string) { private updateDescription(description: string) {
this._meta.updateTag({content: description.substring(0, 160)}, "name='description'"); this._meta.updateTag({content: description.substring(0, 160)}, "name='description'");
this._meta.updateTag({content: description.substring(0, 160)}, "property='og:description'"); this._meta.updateTag({content: description.substring(0, 160)}, "property='og:description'");
} }
private updateTitle(title: string) { private updateTitle(title: string) {
var _prefix = ""; var _prefix = "";
// if(!this.communityId) { // if(!this.communityId) {
@ -469,11 +469,11 @@ export class ResultLandingComponent {
this._title.setTitle(title); this._title.setTitle(title);
this._meta.updateTag({content: title}, "property='og:title'"); this._meta.updateTag({content: title}, "property='og:title'");
} }
private updateUrl(url: string) { private updateUrl(url: string) {
this._meta.updateTag({content: url}, "property='og:url'"); this._meta.updateTag({content: url}, "property='og:url'");
} }
public totalPages(totalResults: number): number { public totalPages(totalResults: number): number {
let totalPages: any = totalResults / this.pageSize; let totalPages: any = totalResults / this.pageSize;
if (!(Number.isInteger(totalPages))) { if (!(Number.isInteger(totalPages))) {
@ -481,39 +481,39 @@ export class ResultLandingComponent {
} }
return totalPages; return totalPages;
} }
public updateReferencesPage($event) { public updateReferencesPage($event) {
this.referencesPage = $event.value; this.referencesPage = $event.value;
} }
public updateBioentitiesPage($event) { public updateBioentitiesPage($event) {
this.bioentitiesPage = $event.value; this.bioentitiesPage = $event.value;
} }
public updateRelatedPage($event) { public updateRelatedPage($event) {
this.relatedPage = $event.value; this.relatedPage = $event.value;
} }
public updateSimilarPage($event) { public updateSimilarPage($event) {
this.similarPage = $event.value; this.similarPage = $event.value;
} }
public updateSupplementaryPage($event) { public updateSupplementaryPage($event) {
this.supplementaryPage = $event.value; this.supplementaryPage = $event.value;
} }
public updateSupplementedByPage($event) { public updateSupplementedByPage($event) {
this.supplementedByPage = $event.value; this.supplementedByPage = $event.value;
} }
public updateOrganizationsPage($event) { public updateOrganizationsPage($event) {
this.organizationsPage = $event.value; this.organizationsPage = $event.value;
} }
public updateOpenCitationsPage($event) { public updateOpenCitationsPage($event) {
this.openCitationsPage = $event.value; this.openCitationsPage = $event.value;
} }
public accessClass(accessMode: string): string { public accessClass(accessMode: string): string {
if (accessMode.toLowerCase().indexOf('open') !== -1) { if (accessMode.toLowerCase().indexOf('open') !== -1) {
return 'open'; return 'open';
@ -523,7 +523,7 @@ export class ResultLandingComponent {
return 'closed'; return 'closed';
} }
} }
public keysToArray(bioentities: Map<string, string>): string[] { public keysToArray(bioentities: Map<string, string>): string[] {
let keys: string[] = []; let keys: string[] = [];
bioentities.forEach(function (value, key, map) { bioentities.forEach(function (value, key, map) {
@ -531,15 +531,15 @@ export class ResultLandingComponent {
}); });
return keys; return keys;
} }
public getKeys(map) { public getKeys(map) {
return Array.from(map.keys()); return Array.from(map.keys());
} }
public scroll() { public scroll() {
HelperFunctions.scroll(); HelperFunctions.scroll();
} }
private handleError(message: string, error) { private handleError(message: string, error) {
if (this.type == "publication") { if (this.type == "publication") {
console.error("Publication Landing Page: " + message, error); console.error("Publication Landing Page: " + message, error);
@ -553,7 +553,7 @@ export class ResultLandingComponent {
console.error("Landing Page: " + message, error); console.error("Landing Page: " + message, error);
} }
} }
isRouteAvailable(routeToCheck: string) { isRouteAvailable(routeToCheck: string) {
for (let i = 0; i < this.router.config.length; i++) { for (let i = 0; i < this.router.config.length; i++) {
let routePath: string = this.router.config[i].path; let routePath: string = this.router.config[i].path;
@ -563,7 +563,7 @@ export class ResultLandingComponent {
} }
return false; return false;
} }
openDeletedByInference() { openDeletedByInference() {
this.deleteByInferenceOpened = true; this.deleteByInferenceOpened = true;
this.alertModalDeletedByInference.cancelButton = false; this.alertModalDeletedByInference.cancelButton = false;
@ -571,11 +571,11 @@ export class ResultLandingComponent {
this.alertModalDeletedByInference.alertTitle = "Other versions of"; this.alertModalDeletedByInference.alertTitle = "Other versions of";
this.alertModalDeletedByInference.open(); this.alertModalDeletedByInference.open();
} }
public getResultPreview(result: RelationResult): ResultPreview { public getResultPreview(result: RelationResult): ResultPreview {
return ResultPreview.relationResultConvert(result, this.relation); return ResultPreview.relationResultConvert(result, this.relation);
} }
updateUrlWithType(pid) { updateUrlWithType(pid) {
this.type = this.resultLandingInfo.resultType; this.type = this.resultLandingInfo.resultType;
@ -601,7 +601,7 @@ export class ResultLandingComponent {
// this._location.go(this.linkToLandingPage.split("?")[0] + "?pid=" + this.identifier.id); // this._location.go(this.linkToLandingPage.split("?")[0] + "?pid=" + this.identifier.id);
// } // }
} }
public getReferenceUrl(id: Id): string { public getReferenceUrl(id: Id): string {
if (id.type === "doi") { if (id.type === "doi") {
return this.properties.doiURL + id.value; return this.properties.doiURL + id.value;
@ -615,7 +615,7 @@ export class ResultLandingComponent {
return null; return null;
} }
} }
public getReferenceIdName(id: Id): string { public getReferenceIdName(id: Id): string {
if (id.type === "doi") { if (id.type === "doi") {
return 'DOI' return 'DOI'
@ -629,14 +629,14 @@ export class ResultLandingComponent {
return null; return null;
} }
} }
public openLinkModal() { public openLinkModal() {
this.linkModal.cancelButton = false; this.linkModal.cancelButton = false;
this.linkModal.okButton = false; this.linkModal.okButton = false;
this.linkModal.alertTitle = "Link this " + this.getTypeName() + " to"; this.linkModal.alertTitle = "Link this " + this.getTypeName() + " to";
this.linkModal.open(); this.linkModal.open();
} }
public openCiteModal() { public openCiteModal() {
this.citeThisClicked = true; this.citeThisClicked = true;
this.citeModal.cancelButton = false; this.citeModal.cancelButton = false;
@ -678,8 +678,8 @@ export class ResultLandingComponent {
);*/ );*/
let allow = true; let allow = true;
// console.log("rich content " + allow) // console.log("rich content " + allow)
//spam words to exclude //spam words to exclude - need to be in lower case
let title_authors_words = ["movie","hd","film","kimetsu", "1080p","4k","call of duty", "mobile hack", "TUBYDI", "电影","電影","download ebook","download [ebook]","Düşük Hapı"]; let title_authors_words = ["movie","hd","film","kimetsu", "1080p","4k","call of duty", "mobile hack", "tubydi", "电影","電影","download ebook","download [ebook]","düşük hapı", "düşük hapi"];
let abstract_words = ["operacao-feliz-natal.blogspot.com", "moviedouban.site", "hack-expert-solution.link"]; let abstract_words = ["operacao-feliz-natal.blogspot.com", "moviedouban.site", "hack-expert-solution.link"];
allow = allow && !( allow = allow && !(
(this.hasKeyword(resultLandingInfo.title,title_authors_words) || (resultLandingInfo.authors && this.hasKeyword(resultLandingInfo.authors.map(o => o.fullName).join(" "),title_authors_words)) (this.hasKeyword(resultLandingInfo.title,title_authors_words) || (resultLandingInfo.authors && this.hasKeyword(resultLandingInfo.authors.map(o => o.fullName).join(" "),title_authors_words))