MCPcopy Create free account
hub / github.com/SnapDrop/snapdrop / WebShareTargetUI

Class WebShareTargetUI

client/scripts/ui.js:509–526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

507}
508
509class WebShareTargetUI {
510 constructor() {
511 const parsedUrl = new URL(window.location);
512 const title = parsedUrl.searchParams.get('title');
513 const text = parsedUrl.searchParams.get('text');
514 const url = parsedUrl.searchParams.get('url');
515
516 let shareTargetText = title ? title : '';
517 shareTargetText += text ? shareTargetText ? ' ' + text : text : '';
518
519 if(url) shareTargetText = url; // We share only the Link - no text. Because link-only text becomes clickable.
520
521 if (!shareTargetText) return;
522 window.shareTargetText = shareTargetText;
523 history.pushState({}, 'URL Rewrite', '/');
524 console.log('Shared Target Text:', '"' + shareTargetText + '"');
525 }
526}
527
528
529class Snapdrop {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected