unfeature: nuke MBFC from Photon, close #436
This commit is contained in:
1 parent
3f93285392
commit
47cd2a0fea
5 files changed
+2
-224
No files matched your search
@@ -19,8 +19,6 @@
|
||||
export let embed_description: string | undefined = undefined
|
||||
export let view: View = 'cozy'
|
||||
|
||||
let openMediaBias = false
|
||||
|
||||
$: richURL = parseURL(url)
|
||||
</script>
|
||||
|
||||
@@ -106,7 +104,7 @@
|
||||
class="bg-white dark:bg-zinc-900 border border-slate-200 dark:border-zinc-800
|
||||
rounded-full flex p-1 relative -top-7 min-[384px]:mx-3 mt-8 min-[384px]:mt-0 mx-auto -mb-7 w-max max-w-full overflow-auto"
|
||||
>
|
||||
<PostLinkSources {url} view="cozy" bind:openMediaBias>
|
||||
<PostLinkSources {url}>
|
||||
<Button
|
||||
color="tertiary"
|
||||
slot="target"
|
||||
@@ -125,27 +123,10 @@
|
||||
{$t('post.actions.link.actions')}
|
||||
</Button>
|
||||
</PostLinkSources>
|
||||
<Button
|
||||
color="tertiary"
|
||||
size="sm"
|
||||
class="w-max text-slate-600 dark:text-zinc-400 block
|
||||
text-xs flex-shrink-0"
|
||||
on:click={() => (openMediaBias = !openMediaBias)}
|
||||
rounding="pill"
|
||||
>
|
||||
<Icon
|
||||
src={CheckBadge}
|
||||
size="16"
|
||||
micro
|
||||
slot="prefix"
|
||||
class="flex-shrink-0"
|
||||
/>
|
||||
{$t('post.actions.more.mediaBias')}
|
||||
</Button>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="flex items-center gap-1">
|
||||
<PostLinkSources {url} view="compact">
|
||||
<PostLinkSources {url}>
|
||||
<Button
|
||||
color="ghost"
|
||||
slot="target"
|
||||
|
||||
@@ -41,12 +41,9 @@
|
||||
import { t } from '$lib/translations'
|
||||
import { Menu, MenuButton, MenuDivider } from 'mono-svelte'
|
||||
import type { MediaType } from '../helpers'
|
||||
import { CheckBadge, Icon } from 'svelte-hero-icons'
|
||||
import type { View } from '$lib/settings'
|
||||
|
||||
export let url: string
|
||||
export let type: MediaType = 'embed'
|
||||
export let view: View = 'cozy'
|
||||
|
||||
export let openMediaBias = false
|
||||
|
||||
@@ -71,11 +68,4 @@
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{/each}
|
||||
{#if view == 'compact'}
|
||||
<MenuDivider>{$t('post.actions.link.actions')}</MenuDivider>
|
||||
<MenuButton on:click={() => (openMediaBias = !openMediaBias)}>
|
||||
<Icon src={CheckBadge} size="16" micro slot="prefix" />
|
||||
{$t('post.actions.more.mediaBias')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
</Menu>
|
||||
@@ -1,137 +0,0 @@
|
||||
<script lang="ts" context="module">
|
||||
// Courtesy of https://github.com/asimons04
|
||||
export interface MBFCReport {
|
||||
bias: string
|
||||
credibility: string
|
||||
domain: string
|
||||
facebook?: string
|
||||
twitter?: string
|
||||
name: string
|
||||
popularity?: number
|
||||
questionable: string[]
|
||||
reporting: string
|
||||
url: string
|
||||
// biases?: MBFCBiases
|
||||
score?: number
|
||||
}
|
||||
|
||||
export const findSource = async (
|
||||
target: string,
|
||||
dataset: any
|
||||
): Promise<MBFCReport | undefined> => {
|
||||
if (!target) return undefined
|
||||
let left = 0
|
||||
let right = dataset.length
|
||||
|
||||
while (left <= right) {
|
||||
const middle = Math.floor((left + right) / 2)
|
||||
const foundDomain = dataset[middle].domain
|
||||
if (foundDomain == target) return dataset[middle]
|
||||
else if (foundDomain < target) left = middle + 1
|
||||
else if (foundDomain > target) right = middle - 1
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
import { Badge, Modal, Spinner } from 'mono-svelte'
|
||||
import Placeholder from '../ui/Placeholder.svelte'
|
||||
import { Icon, QuestionMarkCircle, Link as Chain } from 'svelte-hero-icons'
|
||||
import Link from '../input/Link.svelte'
|
||||
import Expandable from '../ui/Expandable.svelte'
|
||||
import Visualization from './Visualization.svelte'
|
||||
|
||||
export let open: boolean = false
|
||||
export let domain: string = ''
|
||||
|
||||
let ratings = ['left', 'left-center', 'center', 'right-center', 'right']
|
||||
let altRatings = [
|
||||
'conspiracy-pseudoscience',
|
||||
'pro-science',
|
||||
'satire',
|
||||
'fake-news',
|
||||
]
|
||||
|
||||
let reporting = [
|
||||
'very-low',
|
||||
'low',
|
||||
'mixed',
|
||||
'mostly-factual',
|
||||
'high',
|
||||
'Very-high',
|
||||
]
|
||||
</script>
|
||||
|
||||
<Modal title={$t('post.actions.more.mediaBias')} {...$$restProps} bind:open>
|
||||
{#await import('./data.json')}
|
||||
<div class="w-full h-64 flex flex-col gap-2 justify-center items-center">
|
||||
<Spinner width={48} />
|
||||
<span>{$t('post.actions.mediaBias.downloading')}</span>
|
||||
</div>
|
||||
{:then json}
|
||||
{#await findSource(domain, json.sources)}
|
||||
<span>{$t('post.actions.mediaBias.loading')}</span>
|
||||
{:then data}
|
||||
{#if data}
|
||||
<h2 class="font-semibold text-xl">{data.name}</h2>
|
||||
<Visualization
|
||||
data={ratings.includes(data.bias) ? ratings : altRatings}
|
||||
alt={!ratings.includes(data.bias)}
|
||||
selected={data.bias}
|
||||
name={json.biases.find((b) => b.bias == data.bias)?.name ?? data.bias}
|
||||
/>
|
||||
|
||||
<Expandable open>
|
||||
<span slot="title">{$t('post.actions.mediaBias.description')}</span>
|
||||
<p class="text-sm">
|
||||
{json.biases.find((b) => b.bias == data.bias)?.description}
|
||||
</p>
|
||||
</Expandable>
|
||||
{#if data.questionable?.length > 0}
|
||||
<div class="flex items-center flex-wrap gap-2">
|
||||
{#each data.questionable as questionable}
|
||||
<Badge color="red-subtle">
|
||||
<span>
|
||||
{json.questionable.find((q) => q.questionable == questionable)
|
||||
?.name}
|
||||
</span>
|
||||
</Badge>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
<h3 class="font-semibold text-lg">
|
||||
{$t('post.actions.mediaBias.reporting')}
|
||||
</h3>
|
||||
|
||||
<Visualization
|
||||
data={reporting}
|
||||
alt
|
||||
width={24}
|
||||
selected={data.reporting}
|
||||
name={json.reporting.find((b) => b.reporting == data.reporting)
|
||||
?.name ?? data.reporting}
|
||||
/>
|
||||
{:else}
|
||||
<Placeholder
|
||||
icon={QuestionMarkCircle}
|
||||
title={$t('post.actions.mediaBias.noData.title')}
|
||||
description={$t('post.actions.mediaBias.noData.description')}
|
||||
/>
|
||||
{/if}
|
||||
{#if data}
|
||||
<Link
|
||||
target="_blank"
|
||||
href="https://mediabiasfactcheck.com/{data.name}"
|
||||
class="text-sm text-slate-700 dark:text-zinc-300"
|
||||
>
|
||||
<Icon src={Chain} micro size="14" />
|
||||
mediabiasfactcheck.com
|
||||
</Link>
|
||||
{/if}
|
||||
{/await}
|
||||
{/await}
|
||||
</Modal>
|
||||
@@ -1,55 +0,0 @@
|
||||
<script lang="ts">
|
||||
type T = $$Generic
|
||||
|
||||
export let data: T[]
|
||||
export let selected: T
|
||||
export let name: string
|
||||
export let alt: boolean = false
|
||||
export let width: number = 48
|
||||
</script>
|
||||
|
||||
<div class="flex items-start gap-4 mx-auto mb-6">
|
||||
{#each data as rating, index}
|
||||
<div
|
||||
class="flex flex-col gap-2 items-center relative"
|
||||
style=" width: {width}px; height: {width}px;"
|
||||
>
|
||||
<div
|
||||
class="w-12 h-12 {alt
|
||||
? 'bg-red-500'
|
||||
: 'bg-blue-500 border-blue-700'} opacity-50 transition-all cursor-pointer duration-100 {rating ==
|
||||
selected
|
||||
? 'current-bias'
|
||||
: 'hover:opacity-100 rounded-full'}"
|
||||
style="filter: hue-rotate({index *
|
||||
30}deg); width: {width}px; height: {width}px;"
|
||||
></div>
|
||||
{#if rating == selected}
|
||||
<span
|
||||
class="capitalize font-medium whitespace-nowrap max-w-max absolute -bottom-8 left-1/2 -translate-x-1/2"
|
||||
>
|
||||
{name}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(-180deg);
|
||||
opacity: 0.5;
|
||||
border-radius: 64px;
|
||||
}
|
||||
100% {
|
||||
transform: rotate(45deg);
|
||||
opacity: 1;
|
||||
border-radius: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.current-bias {
|
||||
animation: spin 1s forwards cubic-bezier(0.075, 0.82, 0.165, 1);
|
||||
}
|
||||
</style>
|
||||
@@ -1 +0,0 @@
|
||||
{"aliases":{"politi.co":"politico.com","bbc.co.uk":"bbc.com","cbs.com":"cbsnews.com","moveon.org":"front.moveon.org"},"biases":[{"bias":"left","code":"L","description":"These media sources are moderately to strongly biased toward liberal causes through story selection and/or political affiliation. They may utilize strong loaded words (wording that attempts to influence an audience by using appeal to emotion or stereotypes), publish misleading reports and omit reporting of information that may damage liberal causes. Some sources in this category may be untrustworthy.","name":"Left Bias","pretty":"Left","url":"https://mediabiasfactcheck.com/left/"},{"bias":"left-center","code":"LC","description":"These media sources have a slight to moderate liberal bias. They often publish factual information that utilizes loaded words (wording that attempts to influence an audience by using appeal to emotion or stereotypes) to favor liberal causes. These sources are generally trustworthy for information, but may require further investigation. ","name":"Left-Center Bias","pretty":"Left-Center","url":"https://mediabiasfactcheck.com/leftcenter/"},{"bias":"center","code":"C","description":"These sources have minimal bias and use very few loaded words (wording that attempts to influence an audience by using appeal to emotion or stereotypes). The reporting is factual and usually sourced. These are the most credible media sources. ","name":"Least Biased","pretty":"Center","url":"https://mediabiasfactcheck.com/center/"},{"bias":"right-center","code":"RC","description":"These media sources are slightly to moderately conservative in bias. They often publish factual information that utilizes loaded words (wording that attempts to influence an audience by using appeal to emotion or stereotypes) to favor conservative causes. These sources are generally trustworthy for information, but may require further investigation. ","name":"Right-Center Bias","pretty":"Right-Center","url":"https://mediabiasfactcheck.com/right-center/"},{"bias":"right","code":"R","description":"These media sources are moderately to strongly biased toward conservative causes through story selection and/or political affiliation. They may utilize strong loaded words (wording that attempts to influence an audience by using appeal to emotion or stereotypes), publish misleading reports and omit reporting of information that may damage conservative causes. Some sources in this category may be untrustworthy.","name":"Right Bias","pretty":"Right","url":"https://mediabiasfactcheck.com/right/"},{"bias":"pro-science","code":"PS","description":"These sources consist of legitimate science or are evidence based through the use of credible scientific sourcing. Legitimate science follows the scientific method, is unbiased and does not use emotional words. These sources also respect the consensus of experts in the given scientific field and strive to publish peer reviewed science. Some sources in this category may have a slight political bias, but adhere to scientific principles.","name":"Pro-Science","pretty":"Pro-Science","url":"https://mediabiasfactcheck.com/pro-science/"},{"bias":"conspiracy-pseudoscience","code":"CP","description":"Sources in the Conspiracy-Pseudoscience category may publish unverifiable information that is not always supported by evidence. These sources may be untrustworthy for credible/verifiable information, therefore fact checking and further investigation is recommended on a per article basis when obtaining information from these sources. ","name":"Conspiracy-Pseudoscience","pretty":"Conspiracy-Pseudoscience","url":"https://mediabiasfactcheck.com/conspiracy/"},{"bias":"satire","code":"S","description":"These sources exclusively use humor, irony, exaggeration, or ridicule to expose and criticize people’s stupidity or vices, particularly in the context of contemporary politics and other topical issues. Primarily these sources are clear that they are satire and do not attempt to deceive.","name":"Satire","pretty":"Satire","url":"https://mediabiasfactcheck.com/satire/"},{"bias":"fake-news","code":"FN","description":"A questionable source exhibits one or more of the following: extreme bias, overt propaganda, poor or no sourcing to credible information and/or is fake news. Fake News is the deliberate attempt to publish hoaxes and/or disinformation for the purpose of profit or influence (Learn More). Sources listed in the Questionable Category may be very untrustworthy and should be fact checked on a per article basis. Please note sources on this list are not considered fake news unless specifically written in the notes section for that source.","name":"Questionable Sources","pretty":"Fake-News","url":"https://mediabiasfactcheck.com/fake-news/"}],"credibility":[{"code":"H","credibility":"high-credibility","name":"High Credibility","pretty":"High Credibility"},{"code":"M","credibility":"medium-credibility","name":"Medium CredibLine truncated
|
||||
Reference in new issue
Block a user