Remove answerbox-specific sharing feature

This commit is contained in:
Andreas Nedbal 2023-10-16 15:19:45 +02:00 committed by Andreas Nedbal
parent 3feb827b16
commit 5ccdd9bbc2
3 changed files with 0 additions and 20 deletions

View File

@ -97,9 +97,3 @@
display: inline;
}
}
body:not(.cap-web-share) {
[name="ab-share"] {
display: none;
}
}

View File

@ -2,13 +2,11 @@ import registerEvents from 'utilities/registerEvents';
import registerAnswerboxCommentEvents from './comment';
import { answerboxDestroyHandler } from './destroy';
import { answerboxReportHandler } from './report';
import { shareEventHandler } from './share';
import { answerboxSmileHandler } from './smile';
import { answerboxSubscribeHandler } from './subscribe';
export default (): void => {
registerEvents([
{ type: 'click', target: '[name=ab-share]', handler: shareEventHandler, global: true },
{ type: 'click', target: '[data-action=ab-submarine]', handler: answerboxSubscribeHandler, global: true },
{ type: 'click', target: '[data-action=ab-report]', handler: answerboxReportHandler, global: true },
{ type: 'click', target: '[data-action=ab-destroy]', handler: answerboxDestroyHandler, global: true },

View File

@ -1,12 +0,0 @@
import noop from 'utilities/noop';
export function shareEventHandler(event: Event): void {
event.preventDefault();
const answerbox = (event.target as HTMLElement).closest('.answerbox');
navigator.share({
url: answerbox.querySelector<HTMLAnchorElement>('.answerbox__answer-date > a, a.answerbox__permalink').href
})
.then(noop)
.catch(noop)
}