Fixed various actor filters. Improved tag bar scroll behavior.

This commit is contained in:
DebaucheryLibrarian 2024-03-24 18:16:10 +01:00
parent 3f266630b4
commit 28a91efd33
6 changed files with 39 additions and 18 deletions

View File

@ -70,7 +70,7 @@
>Relevance</option>
<option value="name.asc">Name</option>
<option value="likes.desc">Likes</option>
<option value="likes.desc">Popular</option>
<option value="scenes.desc">Scenes</option>
</select>
</div>
@ -261,10 +261,19 @@ function updateFilter(prop, value, reload = true) {
align-items: stretch;
}
.actors-container {
display: flex;
flex-grow: 1;
flex-direction: column;
box-sizing: border-box;
padding: 0 1rem 1rem 1rem;
}
.actors-header {
display: flex;
align-items: center;
padding: .5rem 0 .25rem 2rem;
padding: .5rem 0 .25rem 2.25rem;
margin-bottom: .25rem;
}
.meta {
@ -274,14 +283,6 @@ function updateFilter(prop, value, reload = true) {
align-items: center;
}
.actors-container {
display: flex;
flex-grow: 1;
flex-direction: column;
box-sizing: border-box;
padding: 0 1rem 1rem 1rem;
}
.actors {
display: grid;
flex-grow: 1;

View File

@ -104,7 +104,7 @@
class="menu-button nolink"
>
<Icon icon="user7" />
View profile
My profile
</a>
</li>

View File

@ -461,7 +461,7 @@ async function unstash() {
}
.title {
margin: 0 .5rem 0 0;
margin: 0 .5rem 1rem 0;
line-height: 1.25;
display: -webkit-box;
-webkit-box-orient: vertical;

View File

@ -94,20 +94,25 @@ const categoryTitles = {
const activeCategory = ref(null);
function calculateActiveCategory() {
activeCategory.value = Array.from(document.querySelectorAll('.tags')).reduce((closest, element) => {
const newCategory = Array.from(document.querySelectorAll('.tags')).reduce((closest, element) => {
const { top } = element.getBoundingClientRect();
if (!closest || Math.abs(top) < Math.abs(closest.top)) {
if (!closest || Math.abs(top - 200) < Math.abs(closest.top)) { // slight offset to include bottom category
return { category: element.dataset.category, top };
}
return closest;
}, null).category;
if (newCategory === activeCategory.value) {
return;
}
activeCategory.value = newCategory;
const activeLink = document.querySelector(`a[href="#${activeCategory.value}"]`);
activeLink.scrollIntoView({
behavior: 'smooth',
inline: 'center',
});

View File

@ -32,6 +32,7 @@ const tagSlugs = {
'piercings',
],
lgbt: [
'lesbian',
'gay',
'bisexual',
'transsexual',

View File

@ -367,12 +367,24 @@ async function queryManticoreSql(filters, options, _reqUser) {
builder.whereRaw('match(\'@name :query:\', actors)', { query: filters.query });
}
['gender', 'country'].forEach((attribute) => {
// attribute filters
['country'].forEach((attribute) => {
if (filters[attribute]) {
builder.where(attribute, filters[attribute]);
}
});
if (filters.gender === 'other') {
builder.whereNull('gender');
} else if (filters.gender) {
builder.where('gender', filters.gender);
}
if (filters.age) {
builder.select('if(date_of_birth, floor((now() - date_of_birth) / 31556952), 0) as age');
}
// range filters
['age', 'height'].forEach((attribute) => {
if (filters[attribute]) {
builder
@ -396,9 +408,11 @@ async function queryManticoreSql(filters, options, _reqUser) {
const month = filters.dateOfBirth.getMonth() + 1;
const day = filters.dateOfBirth.getDate();
builder.select('month(date_of_birth) as month_of_birth, day(date_of_birth) as day_of_birth');
builder
.where('month(date_of_birth)', month)
.where('day(date_of_birth)', day);
.where('month_of_birth', month)
.where('day_of_birth', day);
}
if (filters.cup) {