mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-03 00:18:31 +00:00
Separate simple view logic from filter logic
This commit is contained in:
parent
8d2e58500d
commit
f4febe6ee0
5 changed files with 56 additions and 55 deletions
|
@ -147,8 +147,6 @@ export default {
|
|||
let query = this.query.toLowerCase();
|
||||
|
||||
let flags = new Set;
|
||||
if ( this.context.simple_view )
|
||||
flags.add('simple_view');
|
||||
query = query.replace(/(?<=^|\s)@(\S+)(?:\s+|$)/g, (match, flag, index) => {
|
||||
if ( VALID_FLAGS.includes(flag) ) {
|
||||
flags.add(flag);
|
||||
|
|
|
@ -58,20 +58,23 @@ export default {
|
|||
},
|
||||
|
||||
shouldShow(item, is_walking = false) {
|
||||
if ( ! this.filter || item.no_filter )
|
||||
if ( item.no_filter )
|
||||
return true;
|
||||
|
||||
if ( this.context.simple_view ) {
|
||||
for(const key of ['tabs', 'contents', 'items'])
|
||||
if ( item[key] )
|
||||
for(const thing of item[key])
|
||||
if ( this.shouldShow(thing) )
|
||||
return true;
|
||||
if ( ! item.setting || ! item.simple )
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! this.filter )
|
||||
return true;
|
||||
|
||||
if ( this.filter.flags ) {
|
||||
if ( this.filter.flags.has('simple_view') ) {
|
||||
for(const key of ['tabs', 'contents', 'items'])
|
||||
if ( item[key] )
|
||||
for(const thing of item[key])
|
||||
if ( this.shouldShow(thing) )
|
||||
return true;
|
||||
if ( ! item.setting || ! item.simple )
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( this.filter.flags.has('modified') ) {
|
||||
// We need to tree walk for this one.
|
||||
if ( ! is_walking ) {
|
||||
|
@ -82,9 +85,6 @@ export default {
|
|||
return true;
|
||||
}
|
||||
|
||||
if ( this.context.simple_view && ! item.simple )
|
||||
return false;
|
||||
|
||||
if ( ! item.setting || ! this.context.currentProfile.has(item.setting) )
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -187,20 +187,23 @@ export default {
|
|||
|
||||
methods: {
|
||||
shouldShow(item, is_walking = false) {
|
||||
if ( ! this.filter || item.no_filter )
|
||||
if ( item.no_filter )
|
||||
return true;
|
||||
|
||||
if ( this.context.simple_view ) {
|
||||
for(const key of ['tabs', 'contents', 'items'])
|
||||
if ( item[key] )
|
||||
for(const thing of item[key])
|
||||
if ( this.shouldShow(thing) )
|
||||
return true;
|
||||
if ( ! item.setting || ! item.simple )
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! this.filter )
|
||||
return true;
|
||||
|
||||
if ( this.filter.flags ) {
|
||||
if ( this.filter.flags.has('simple_view') ) {
|
||||
for(const key of ['tabs', 'contents', 'items'])
|
||||
if ( item[key] )
|
||||
for(const thing of item[key])
|
||||
if ( this.shouldShow(thing) )
|
||||
return true;
|
||||
if ( ! item.setting || ! item.simple )
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( this.filter.flags.has('modified') ) {
|
||||
// We need to tree walk for this one.
|
||||
if ( ! is_walking ) {
|
||||
|
@ -211,9 +214,6 @@ export default {
|
|||
return true;
|
||||
}
|
||||
|
||||
if ( this.context.simple_view && ! item.simple )
|
||||
return false;
|
||||
|
||||
if ( ! item.setting || ! this.context.currentProfile.has(item.setting) )
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -112,20 +112,23 @@ export default {
|
|||
|
||||
methods: {
|
||||
shouldShow(item, is_walking = false) {
|
||||
if ( ! this.filter || this.containsCurrent(item) )
|
||||
if ( item.no_filter )
|
||||
return true;
|
||||
|
||||
if ( this.context.simple_view ) {
|
||||
for(const key of ['tabs', 'contents', 'items'])
|
||||
if ( item[key] )
|
||||
for(const thing of item[key])
|
||||
if ( this.shouldShow(thing) )
|
||||
return true;
|
||||
if ( ! item.setting || ! item.simple )
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! this.filter )
|
||||
return true;
|
||||
|
||||
if ( this.filter.flags ) {
|
||||
if ( this.filter.flags.has('simple_view') ) {
|
||||
for(const key of ['tabs', 'contents', 'items'])
|
||||
if ( item[key] )
|
||||
for(const thing of item[key])
|
||||
if ( this.shouldShow(thing) )
|
||||
return true;
|
||||
if ( ! item.setting || ! item.simple )
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( this.filter.flags.has('modified') ) {
|
||||
// We need to tree walk for this one.
|
||||
if ( ! is_walking ) {
|
||||
|
@ -136,9 +139,6 @@ export default {
|
|||
return true;
|
||||
}
|
||||
|
||||
if ( this.context.simple_view && ! item.simple )
|
||||
return false;
|
||||
|
||||
if ( ! item.setting || ! this.context.currentProfile.has(item.setting) )
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -210,20 +210,23 @@ export default {
|
|||
},
|
||||
|
||||
shouldShow(item, is_walking = false) {
|
||||
if ( ! this.filter || item.no_filter )
|
||||
if ( item.no_filter )
|
||||
return true;
|
||||
|
||||
if ( this.context.simple_view ) {
|
||||
for(const key of ['tabs', 'contents', 'items'])
|
||||
if ( item[key] )
|
||||
for(const thing of item[key])
|
||||
if ( this.shouldShow(thing) )
|
||||
return true;
|
||||
if ( ! item.setting || ! item.simple )
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! this.filter )
|
||||
return true;
|
||||
|
||||
if ( this.filter.flags ) {
|
||||
if ( this.filter.flags.has('simple_view') ) {
|
||||
for(const key of ['tabs', 'contents', 'items'])
|
||||
if ( item[key] )
|
||||
for(const thing of item[key])
|
||||
if ( this.shouldShow(thing) )
|
||||
return true;
|
||||
if ( ! item.setting || ! item.simple )
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( this.filter.flags.has('modified') ) {
|
||||
// We need to tree walk for this one.
|
||||
if ( ! is_walking ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue