From 803c7d4b4d2fe2c210f361831974f735995eb802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Sat, 12 Dec 2015 15:57:44 +0100 Subject: [PATCH] Prevents hosts from accidentally clicking the pairing links --- index.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/index.html b/index.html index 3769e25..0b577aa 100644 --- a/index.html +++ b/index.html @@ -271,6 +271,9 @@ var pairingQueryString = '?name=' + encodeURIComponent( name ) + '&key=' + key + '&pairing=' + encryptedPairing; tdName.innerText = name; + + link.addEventListener( 'click', protect ); + link.setAttribute( 'data-name', name ); link.href = window.location.protocol + '//' + window.location.host + pairingPath + pairingQueryString; link.innerText = link.href; @@ -336,6 +339,16 @@ } + function protect( e ) { + + var name = e.currentTarget.getAttribute( 'data-name' ); + + if ( ! confirm( 'If you click this link, you will be revealed ' + name + '\'s pairing! Are you sure you want to do this? Only do this if you\'re actually ' + name + '.\n\nUse right-click to copy the link target instead.' ) ) { + e.preventDefault(); + } + + } +