From 60ab8ccfe9a4544afc856e26094873f837996380 Mon Sep 17 00:00:00 2001 From: Simon Elvery Date: Mon, 31 Oct 2022 14:27:59 +1000 Subject: [PATCH] News web now has a generator meta tag for all outputs --- src/index.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/index.ts b/src/index.ts index aff99a4..1a5b2c3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -74,8 +74,6 @@ const isSelectable = (selector: string): boolean => !!document.querySelector(selector); const isGeneratedBy = (generatorName: string): boolean => isSelectable(`[name="generator"][content="${generatorName}"]`); -const hasIconFrom = (slug: string): boolean => - isSelectable(`[rel*="icon"][href^="/${slug}/"]`); const memoize = (fn: (cache?: boolean) => T) => { let cached: T; return (cache: boolean = true) => @@ -96,14 +94,10 @@ const memoize = (fn: (cache?: boolean) => T) => { // tag. // * Phase 2 and most Presentation Layer applications have a // tag with a distinct "content" property value. -// * Presentation Layer's News Web application doesn't have a -// tag with a distinct "content" property value -// when rendering ABC News App articles, so we look for an icon -// with a distinct asset path. // * Checks are made in order of likelihood, to save unnecessary DOM reads export const getApplication = memoize( function _getApplication(): APPLICATIONS | null { - return hasIconFrom('news-web') + return isGeneratedBy('PL NEWS WEB') ? APPLICATIONS.PLN : isSelectable('[name="HandheldFriendly"]') ? APPLICATIONS.P1M