Unpin preview with middle click

This commit is contained in:
Mr. Stallion 2021-03-25 16:54:10 -05:00
parent 34cb62b1ad
commit ac52f30679
10 changed files with 51 additions and 11 deletions

View File

@ -1,7 +1,13 @@
# Changelog
## 1.12.0
* Post length preference is now part of the profile match score
* Improved kink match scoring
* Middle click a link to pin or unpin preview
## 1.11.0
* Kinks are now part of the profile matching score
* Kinks are now part of the profile match score
* Merged with the latest official F-Chat codebase
* Fixed broken `[collapse]` when wrapped in `[heading]`

View File

@ -93,6 +93,7 @@ This repository contains a heavily customized version of the mainline F-Chat 3.0
* Sexual preference
* Dominance preference
* Human/anthro preference
* Post length preference
* Non-custom kinks
* Species
1. Maching for non-binary genders relies on kinks. For example, if your non-binary character has a preference for females, make sure 'females' are listed as a favorite kink.

View File

@ -5,7 +5,7 @@
@mouseover.prevent="show()"
@mouseenter.prevent="show()"
@mouseleave.prevent="dismiss()"
@click.middle.prevent="toggleStickyness()"
@click.middle.prevent.stop="toggleStickyness()"
@click.right.passive="dismiss(true)"
@click.left.passive="dismiss(true)"
><img :src="`${Utils.staticDomain}images/avatar/${character.toLowerCase()}.png`" class="character-avatar icon" :title="character" :alt="character" v-once></a>

View File

@ -11,7 +11,7 @@
@mouseover.prevent="show()"
@mouseenter.prevent="show()"
@mouseleave.prevent="dismiss()"
@click.middle.prevent="toggleStickyness()"
@click.middle.prevent.stop="toggleStickyness()"
>{{text}}</a>
<span
class="link-domain bbcode-pseudo"

View File

@ -20,7 +20,7 @@
</div>
</div>
</div>
<chat v-else></chat>
<chat ref="chatview" v-else></chat>
<modal :action="l('chat.disconnected.title')" :buttonText="l('action.cancel')" ref="reconnecting" @submit="cancelReconnect"
:showCancel="false" buttonClass="btn-danger">
<div class="alert alert-danger" v-show="error">{{error}}</div>
@ -220,6 +220,10 @@
core.connection.connect(this.selectedCharacter.name);
}
getChatView(): ChatView | undefined {
return this.$refs['chatview'] as ChatView;
}
}
</script>

View File

@ -34,7 +34,7 @@
<a v-for="conversation in conversations.privateConversations" href="#" @click.prevent="conversation.show()"
:class="getClasses(conversation)" :data-character="conversation.character.name" data-touch="false"
class="list-group-item list-group-item-action item-private" :key="conversation.key"
@click.middle.prevent="conversation.close()">
@click.middle.prevent.stop="conversation.close()">
<img :src="characterImage(conversation.character.name)" v-if="showAvatars"/>
<div class="name">
<span>{{conversation.character.name}}</span>
@ -54,7 +54,7 @@
<div class="list-group conversation-nav" ref="channelConversations">
<a v-for="conversation in conversations.channelConversations" href="#" @click.prevent="conversation.show()"
:class="getClasses(conversation)" class="list-group-item list-group-item-action item-channel" :key="conversation.key"
@click.middle.prevent="conversation.close()">
@click.middle.prevent.stop="conversation.close()">
<span class="name">{{conversation.name}}</span>
<span>
<span v-if="conversation.hasAutomatedAds()" class="fas fa-ad" :class="{'active': conversation.isSendingAutomatedAds()}" aria-label="Toggle ads"
@ -129,6 +129,7 @@
import PrivateConversation = Conversation.PrivateConversation;
import * as _ from 'lodash';
import NoteStatus from '../site/NoteStatus.vue';
// import { EventBus } from './preview/event-bus';
const unreadClasses = {
[Conversation.UnreadState.None]: '',
@ -366,6 +367,10 @@
isColorblindModeActive(): boolean {
return core.state.settings.risingColorblindMode;
}
getImagePreview(): ImagePreview | undefined {
return this.$refs['imagePreview'] as ImagePreview;
}
}
</script>

View File

@ -1,5 +1,5 @@
<!-- Linebreaks inside this template will break BBCode views -->
<template><span :class="userClass" v-bind:bbcodeTag.prop="'user'" v-bind:character.prop="character" v-bind:channel.prop="channel" @mouseover.prevent="show()" @mouseenter.prevent="show()" @mouseleave.prevent="dismiss()" @click.middle.prevent="toggleStickyness()" @click.right.passive="dismiss(true)" @click.left.passive="dismiss(true)"><span v-if="!!statusClass" :class="statusClass"></span><span v-if="!!rankIcon" :class="rankIcon"></span>{{character.name}}<span v-if="!!matchClass" :class="matchClass">{{getMatchScoreTitle(matchScore)}}</span></span></template>
<template><span :class="userClass" v-bind:bbcodeTag.prop="'user'" v-bind:character.prop="character" v-bind:channel.prop="channel" @mouseover.prevent="show()" @mouseenter.prevent="show()" @mouseleave.prevent="dismiss()" @click.middle.prevent.stop="toggleStickyness()" @click.right.passive="dismiss(true)" @click.left.passive="dismiss(true)"><span v-if="!!statusClass" :class="statusClass"></span><span v-if="!!rankIcon" :class="rankIcon"></span>{{character.name}}<span v-if="!!matchClass" :class="matchClass">{{getMatchScoreTitle(matchScore)}}</span></span></template>
<script lang="ts">

View File

@ -169,8 +169,16 @@
const eventUrl = this.jsMutator.mutateUrl(this.negotiateUrl(eventData.url as string || ''));
if ((this.url === eventUrl) && (this.visible))
if (
((eventData.force === true) || (this.url === eventUrl))
&& (this.visible)
) {
this.sticky = !this.sticky;
if (eventData.force) {
this.hide();
}
}
}
);

View File

@ -1,5 +1,5 @@
<template>
<div @mouseover="onMouseOver" id="page" style="position:relative;padding:5px 10px 10px" :class="getThemeClass()" @auxclick.prevent>
<div @mouseover="onMouseOver" id="page" style="position:relative;padding:5px 10px 10px" :class="getThemeClass()" @auxclick.prevent @click.middle="unpinUrlPreview">
<div v-html="styling"></div>
<div v-if="!characters" style="display:flex; align-items:center; justify-content:center; height: 100%;">
<div class="card bg-light" style="width: 400px;">
@ -138,6 +138,7 @@
import BBCodeTester from '../bbcode/Tester.vue';
// import ImagePreview from '../chat/preview/ImagePreview.vue';
// import Bluebird from 'bluebird';
// import Connection from '../fchat/connection';
// import Notifications from './notifications';
@ -555,6 +556,21 @@
async openDefinitionWithWikipedia(): Promise<void> {
(this.$refs.wordDefinitionLookup as any).setMode('wikipedia');
}
unpinUrlPreview(e: Event): void {
const imagePreview = (this.$refs['chat'] as Chat)?.getChatView()?.getImagePreview();
// const imagePreview = this.$refs['imagePreview'] as ImagePreview;
if ((imagePreview) && (imagePreview.isVisible()) && (imagePreview.sticky)) {
e.stopPropagation();
e.preventDefault();
EventBus.$emit('imagepreview-toggle-stickyness', {force: true});
}
}
}
</script>

View File

@ -94,7 +94,7 @@
async mounted(): Promise<void> {
log.debug('init.window.mounting');
// top bar devtools
browserWindow.webContents.openDevTools({ mode: 'detach' });
// browserWindow.webContents.openDevTools({ mode: 'detach' });
updateSupportedLanguages(browserWindow.webContents.session.availableSpellCheckerLanguages);
@ -262,7 +262,7 @@
);
// tab devtools
view.webContents.openDevTools();
// view.webContents.openDevTools();
// console.log('ADD TAB LANGUAGES', getSafeLanguages(this.settings.spellcheckLang), this.settings.spellcheckLang);
view.webContents.session.setSpellCheckerLanguages(getSafeLanguages(this.settings.spellcheckLang));