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