2017-11-13 01:23:39 -05:00
|
|
|
<template lang="html">
|
2018-03-30 17:58:56 -04:00
|
|
|
<div class="ffz--menu-page">
|
|
|
|
<header class="tw-mg-b-1">
|
|
|
|
<span v-for="i in breadcrumbs" :key="i.full_key">
|
2019-10-04 14:57:13 -04:00
|
|
|
<a v-if="i !== item" href="#" @click="$emit('change-item', i, false)">{{ t(i.i18n_key, i.title) }}</a>
|
|
|
|
<strong v-if="i === item">{{ t(i.i18n_key, i.title) }}</strong>
|
2018-03-30 17:58:56 -04:00
|
|
|
<template v-if="i !== item">» </template>
|
|
|
|
</span>
|
|
|
|
</header>
|
2019-10-09 16:02:25 -04:00
|
|
|
<section v-if="(! context.currentProfile.live || ! context.currentProfile.toggled) && item.profile_warning !== false" class="tw-border-t tw-pd-t-1 tw-pd-b-2">
|
2018-03-30 17:58:56 -04:00
|
|
|
<div class="tw-c-background-accent tw-c-text-overlay tw-pd-1">
|
|
|
|
<h3 class="ffz-i-attention">
|
2019-10-09 16:02:25 -04:00
|
|
|
{{ t('setting.profiles.inactive', "This profile is not active.") }}
|
2018-03-30 17:58:56 -04:00
|
|
|
</h3>
|
2017-11-13 01:23:39 -05:00
|
|
|
|
2019-10-09 16:02:25 -04:00
|
|
|
<span v-if="! context.currentProfile.toggled">
|
|
|
|
{{ t('setting.profiles.disabled.description',
|
|
|
|
"This profile has been disabled, so you won't see changes you make here reflected on Twitch.")
|
|
|
|
}}
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<span v-else>
|
|
|
|
{{ t('setting.profiles.inactive.description',
|
|
|
|
"This profile's rules don't match the current context and it therefore isn't currently active, so you " +
|
|
|
|
"won't see changes you make here reflected on Twitch.")
|
|
|
|
}}
|
|
|
|
</span>
|
2018-03-30 17:58:56 -04:00
|
|
|
</div>
|
|
|
|
</section>
|
2021-03-02 16:55:25 -05:00
|
|
|
<section v-if="context.currentProfile.url && ! context.currentProfile.pause_updates && item.profile_warning !== false" class="tw-border-t tw-pd-t-1 tw-pd-b-2">
|
|
|
|
<div class="tw-c-background-accent tw-c-text-overlay tw-pd-1">
|
|
|
|
<h3 class="ffz-i-attention">
|
|
|
|
{{ t('setting.profiles.updates', 'This profile will update automatically.') }}
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
<span>
|
|
|
|
{{ t('setting.profile.updates-about',
|
|
|
|
'This profile is set to automatically update. When it does, any changed settings within it will be reset. Profile Rules will be reset as well.')
|
|
|
|
}}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</section>
|
2018-07-18 18:58:05 -04:00
|
|
|
<section v-if="context.has_update" class="tw-border-t tw-pd-t-1 tw-pd-b-2">
|
|
|
|
<div class="tw-c-background-accent tw-c-text-overlay tw-pd-1">
|
|
|
|
<h3 class="ffz-i-arrows-cw">
|
|
|
|
{{ t('setting.update', 'There is an update available.') }}
|
|
|
|
</h3>
|
|
|
|
|
|
|
|
{{ t('setting.update.description',
|
|
|
|
'Please refresh your page to receive the latest version of FrankerFaceZ.')
|
|
|
|
}}
|
|
|
|
</div>
|
|
|
|
</section>
|
2018-03-30 17:58:56 -04:00
|
|
|
<section
|
|
|
|
v-if="item.description"
|
|
|
|
class="tw-border-t tw-pd-y-1"
|
2018-10-01 15:36:38 -04:00
|
|
|
>
|
2019-10-04 14:57:13 -04:00
|
|
|
<markdown :source="t(item.desc_i18n_key || `${item.i18n_key}.description`, item.description)" />
|
2018-10-01 15:36:38 -04:00
|
|
|
</section>
|
2021-03-02 16:55:25 -05:00
|
|
|
<template v-if="! item.contents || ! item.contents.length || item.always_list_pages">
|
2018-03-30 17:58:56 -04:00
|
|
|
<ul class="tw-border-t tw-pd-y-1">
|
2018-07-05 20:27:17 -04:00
|
|
|
<li
|
2021-05-13 15:54:21 -04:00
|
|
|
v-for="i in visibleItems"
|
2018-07-05 20:27:17 -04:00
|
|
|
:key="i.full_key"
|
|
|
|
:class="{'ffz-unmatched-item': ! shouldShow(i)}"
|
|
|
|
class="tw-pd-x-1"
|
|
|
|
>
|
2018-03-30 17:58:56 -04:00
|
|
|
<a href="#" @click="$emit('change-item', i, false)">
|
2019-10-04 14:57:13 -04:00
|
|
|
{{ t(i.i18n_key, i.title) }}
|
2021-05-13 15:54:21 -04:00
|
|
|
<span v-if="filter" class="ffz-pill ffz-pill--overlay">{{ countMatches(i) }}</span>
|
|
|
|
<span v-else-if="i.unseen" class="ffz-pill ffz-pill--overlay">{{ i.unseen }}</span>
|
2018-03-30 17:58:56 -04:00
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</template>
|
2018-07-05 20:27:17 -04:00
|
|
|
<div
|
2021-05-13 15:54:21 -04:00
|
|
|
v-for="i in visibleContents"
|
2018-03-30 17:58:56 -04:00
|
|
|
:key="i.full_key"
|
2018-07-05 20:27:17 -04:00
|
|
|
:class="{'ffz-unmatched-item': ! shouldShow(i)}"
|
|
|
|
>
|
|
|
|
<component
|
|
|
|
:is="i.component"
|
2019-06-20 15:15:54 -04:00
|
|
|
ref="children"
|
2018-07-05 20:27:17 -04:00
|
|
|
:context="context"
|
|
|
|
:item="i"
|
2021-12-01 16:48:10 -05:00
|
|
|
:nav-keys="navKeys"
|
2018-07-05 20:27:17 -04:00
|
|
|
:filter="filter"
|
|
|
|
@change-item="changeItem"
|
2019-05-03 22:36:26 -04:00
|
|
|
@mark-seen="markSeen"
|
2018-07-05 20:27:17 -04:00
|
|
|
@navigate="navigate"
|
|
|
|
/>
|
|
|
|
</div>
|
2017-11-13 01:23:39 -05:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
export default {
|
2021-12-01 16:48:10 -05:00
|
|
|
props: ['item', 'context', 'filter', 'navKeys'],
|
2017-11-13 01:23:39 -05:00
|
|
|
|
|
|
|
computed: {
|
|
|
|
breadcrumbs() {
|
|
|
|
const out = [];
|
|
|
|
let current = this.item;
|
|
|
|
while(current) {
|
|
|
|
out.unshift(current);
|
|
|
|
current = current.parent;
|
|
|
|
}
|
|
|
|
|
|
|
|
return out;
|
2021-05-13 15:54:21 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
visibleItems() {
|
|
|
|
if ( ! this.item || ! this.item.items )
|
|
|
|
return [];
|
|
|
|
|
|
|
|
if ( ! this.context.matches_only )
|
|
|
|
return this.item.items;
|
|
|
|
|
|
|
|
return this.item.items.filter(item => this.shouldShow(item));
|
|
|
|
},
|
|
|
|
|
|
|
|
visibleContents() {
|
|
|
|
if ( ! this.item || ! this.item.contents )
|
|
|
|
return [];
|
|
|
|
|
|
|
|
if ( ! this.context.matches_only )
|
|
|
|
return this.item.contents;
|
|
|
|
|
|
|
|
return this.item.contents.filter(item => this.shouldShow(item));
|
2017-11-13 01:23:39 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2018-07-05 20:27:17 -04:00
|
|
|
shouldShow(item) {
|
|
|
|
if ( ! this.filter || ! this.filter.length || ! item.search_terms )
|
|
|
|
return true;
|
|
|
|
|
2019-06-01 02:11:22 -04:00
|
|
|
return item.no_filter || item.search_terms.includes(this.filter);
|
2018-07-05 20:27:17 -04:00
|
|
|
},
|
|
|
|
|
2021-05-13 15:54:21 -04:00
|
|
|
countMatches(item, seen) {
|
|
|
|
if ( ! this.filter || ! this.filter.length || ! item )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if ( seen && seen.has(item) )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if ( ! seen )
|
|
|
|
seen = new Set;
|
|
|
|
|
|
|
|
seen.add(item);
|
|
|
|
|
|
|
|
let count = 0;
|
|
|
|
|
|
|
|
for(const key of ['tabs', 'contents', 'items'])
|
|
|
|
if ( item[key] )
|
|
|
|
for(const thing of item[key])
|
|
|
|
count += this.countMatches(thing, seen);
|
|
|
|
|
|
|
|
if ( item.setting && item.search_terms && item.search_terms.includes(this.filter) )
|
|
|
|
count++;
|
|
|
|
|
|
|
|
return count;
|
|
|
|
},
|
|
|
|
|
2019-05-03 22:36:26 -04:00
|
|
|
markSeen(item) {
|
|
|
|
this.$emit('mark-seen', item);
|
|
|
|
},
|
|
|
|
|
2017-11-13 01:23:39 -05:00
|
|
|
changeItem(item) {
|
|
|
|
this.$emit('change-item', item);
|
|
|
|
},
|
|
|
|
|
|
|
|
navigate(...args) {
|
|
|
|
this.$emit('navigate', ...args);
|
|
|
|
},
|
|
|
|
|
|
|
|
onBeforeChange(current, new_item) {
|
2021-02-12 15:27:12 -05:00
|
|
|
if ( this.$refs.children )
|
|
|
|
for(const child of this.$refs.children)
|
|
|
|
if ( child && child.onBeforeChange ) {
|
|
|
|
const res = child.onBeforeChange(current, new_item);
|
|
|
|
if ( res !== undefined )
|
|
|
|
return res;
|
|
|
|
}
|
2017-11-13 01:23:39 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|