Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6171135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:09:43+00:00 2026-05-23T23:09:43+00:00

I would like to make an addon to browser, that would show image of

  • 0

I would like to make an addon to browser, that would show image of question mark if something was selected, and to show a tooltip with translation upon click on the image. Something like on nytimes web page when reading articles, but more user friendly. For showing the image I use this:

function ShowQuestionMark(e)                       
  {
  if (window.getSelection().toString() != "")
    { 
      /* add an img tag */
      document.onmouseup = RemoveQuestionMark;
    }
  }

function RemoveQuestionMark(e)
{ 
  /* remove img tag */  
  document.onmouseup = ShowQuestionMark; 
}

document.onmouseup = ShowQuestionMark;

My goal is to make it work on every web page (or at as many as possible).

Now my first question. I assume, when I use it this way and load a page, which by default have a handler for onmouseup event, I override it and whatever was the handler, it won’t be executed when firing onmouseup event. Am I correct?
Second question, how can I guarantee, that my script won’t override/break any default behavior? Should I use binding? Or should I create new unique event? Or something entirely else?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:09:43+00:00Added an answer on May 23, 2026 at 11:09 pm

    I don’t know the answer to your first question, because I’ve never directly assigned an event handler like that while writing an extension, knowing a conflict would occur. But I think the page’s event handler would override yours. Either way, you need to avoid the conflict.

    Anyway, here’s how you avoid the conflict: use addEventListener():

    function ShowQuestionMark(e) {
      if (window.getSelection().toString() != "") {
          document.removeEventListener("mouseup", ShowQuestionMark);
          /* add an img tag */
          yourImgTag.addEventListener("click", RemoveQuestionMark);
      }
    }
    
    function RemoveQuestionMark(e) {
      yourImgTag.removeEventListener("click", RemoveQuestionMark);
      /* remove img tag */  
      document.addEventListener("mouseup", ShowQuestionMark); 
    }
    
    document.addEventListener("mouseup", ShowQuestionMark);
    

    Now, if the page is kind enough not to override or cancel the event (which it can still do), both your event handler and the page’s event handler will be run.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i would like make an UIView, with an alpha and with a label. but
I would like to make my own dialog, completely drawn myself, as a custom
I would like to make use of java.io.Console . I am trying to do
I would like to make two pairs from pairs. A pair consists of two
Kinda a random question, but our company uses Jenkins http://jenkins-ci.org/ Anyways there is a
Possible Duplicate: MSI Install Fails because “Another version of this product is already installed”
I am building a customized add in for our CRM system. When end users
Okay I've been trying to figure this out for a while now. I have
I'm building a website and I'll be charging my customers to use it. I'm
I'm working on a project with Node.js and the server-side code is becoming large

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.