Git Product home page Git Product logo

Comments (6)

mkaply avatar mkaply commented on June 10, 2024

There's a Firefox function called "whereToOpenLink" that does this. So we would need to override this in wc.js. Something like:

function ourWhereToOpenLink( e, ignoreButton, ignoreAlt ) {
var where = theirWhereToOpenLink(e, ignoreButton, ignoreAlt);
if (where == "window") {
where = "tab";
}
return where;
}

var theirWhereToOpenLink;
var theirWhereToOpenLink = whereToOpenLink;
whereToOpenLink = ourWhereToOpenLink;

The other possibilities for where are:
current, tabshifted, tab, save, window

We might want to handle those as well.

tabshifted is a new tab in the background.

from webconverger-addon.

kaihendry avatar kaihendry commented on June 10, 2024

"var theirWhereToOpenLink;" looks weird... surely that can't be the way one overrides? 😕

Anyway, I hope we can get a solution together quickly. This one is high priority.

from webconverger-addon.

mkaply avatar mkaply commented on June 10, 2024

Well we need to override their function, but we still need to call their function. I don't know of any other way to do that.

from webconverger-addon.

kaihendry avatar kaihendry commented on June 10, 2024

Ok, could you please flesh it out and I'll happily test it and try improve on it. Got to teach me to fish a bit maybe. ;)

from webconverger-addon.

mkaply avatar mkaply commented on June 10, 2024

Well there isn't much to flesh out :).

So basically the situation here is that Firefox has a function that attempts to figure out where to open a link:

http://mxr.mozilla.org/mozilla-central/source/browser/base/content/utilityOverlay.js#114

We have two choices.

  1. Implement our own version of that function (which might not be terrible - it doesn't do much).
  2. Override that function with our own version that calls it and then modifies the results that we don't like (which is what I wrote).

There's not really a way to make it more elegant...

from webconverger-addon.

mkaply avatar mkaply commented on June 10, 2024

Well, I can make it look more elegant:

var ffWhereToOpenLink = whereToOpenLink;

whereToOpenLink = function(e, ignoreButton, ignoreAlt) {
var where = ffWhereToOpenLink(e, ignoreButton, ignoreAlt);
if (where == "window") {
where = "tab";
}
return where;
}

This is my final version. It should cover our needs.

from webconverger-addon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.