This repository was archived by the owner on Nov 6, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 1212 < h1 id ="https-everywhere "> < img src ="../../images/banner-red.png " alt ="HTTPS Everywhere " /> </ h1 >
1313 < p data-i18n ="cancel_he_blocking_explainer "> </ p >
1414 < p id ="url-paragraph ">
15- < span id ="url-label "> URL: </ span > < a href =" # " id ="url-value "> PLACEHOLDER</ a >
15+ < span id ="url-label "> URL: </ span > < span id ="url-value "> PLACEHOLDER</ span >
1616 </ p >
1717 < p class ="actions ">
1818 < a href ="# " id ="open-url-button " data-i18n ="cancel_add_rule_and_open_insecurely "> Open insecurely and do not ask again</ a >
Original file line number Diff line number Diff line change @@ -16,6 +16,19 @@ document.addEventListener("DOMContentLoaded", () => {
1616 displayURL ( ) ;
1717} ) ;
1818
19+ /**
20+ * Highlights the content (text, images, etc.) of an element
21+ * @param {Element }
22+ * @returns {void }
23+ */
24+ function highlightElementContent ( element ) {
25+ if ( window . getSelection ) {
26+ var range = document . createRange ( ) ;
27+ range . selectNode ( element ) ;
28+ window . getSelection ( ) . addRange ( range ) ;
29+ }
30+ }
31+
1932function replaceLink ( explainer ) {
2033 observer . disconnect ( ) ;
2134 const linkText = chrome . i18n . getMessage ( "cancel_he_blocking_network" ) ;
@@ -32,9 +45,12 @@ function displayURL() {
3245 const openURLButton = document . getElementById ( 'open-url-button' ) ;
3346
3447 originURLLink . innerHTML = originURL ;
35- originURLLink . href = originURL ;
3648 openURLButton . href = originURL ;
3749
50+ originURLLink . addEventListener ( "click" , function ( event ) {
51+ highlightElementContent ( event . target ) ;
52+ } ) ;
53+
3854 openURLButton . addEventListener ( "click" , function ( event ) {
3955 event . preventDefault ( ) ;
4056
You can’t perform that action at this time.
0 commit comments