force anchor links on a page to open in new tab?

is there any way to make this anchor open in new tab?

superbe.am

التعليقات

  • تم تعديل 2017/12/07 Firefox

    a class="" href="javascript:void(0)" onclick="view_tree_element('subscription','45592063',1);focusit('1_45592063',true);">superbe.am

  • I tried and it didn't work, I get a return in the first if statement, I don't know why is that
  • You're probably using Greasemonkey 4, which is a bug fest. Try with Tampermonkey for Firefox, it works perfectly. If it doesn't for you, I would need a sample site URL to test it myself and see if I can fix the script.

  • I'm running GS 3.17, maybe because I'm on firefox esr 52.5.0, I think it has to do with the function? I tried with middle click as someone suggested and it shows javascript:void(0) in the address bar
  • The script works for me in GM3.17 + FF52.5. Like I said, I would need a sample site URL to test it myself and see if I can fix the script.

  • Ah, I see the script intentionally skips javascript: links. Try editing the script code and remove the following line:

            (link.getAttribute('href') || '').match(/^(javascript|#|$)/) ||
    
  • thanks for the support,

    still goes into this:
    if (e.button > 1 || e.altKey || e.target != clickedElement)
    return;
    var link = e.target.closest('a');
    if (!link ||
    link.href.replace(/#.*/, '') == location.href.replace(/#.*/, '')
    )
    alert('1');
    return;

    have you heard of inoreader?
    this is the url:
    https://www.inoreader.com/dashboard

    you may need an account and then go over to dashboard url and click on a link on recommended sources for example
  • What about this:

    // ==UserScript==
    // @name         Open jQuery links in new tab
    // @match        https://www.inoreader.com/feed/*
    // @grant        none
    // ==/UserScript==
    
    window.addEventListener('load', () => {
      const listeners = (window.jQuery && jQuery._data(document, 'events') || {}).mousedown || [];
      listeners.splice(listeners.findIndex(({handler}) => /article_content/.test(handler)), 1);
    
      window.addEventListener('mousedown', event => {
        const a = event.target.closest('a');
        if (!a)
          return;
        a.onmousedown = null;
        a.target = '_blank';
      }, true);
    
    }, {once: true});
    
  • it didn't work either...

    maybe you should try the url/site yourself, or include debugging code for me to see what happens..
  • Well, it worked for me...

  • maybe you pressed (and the code refers to) an article? I want the subscriptions to open in a new tab, not the articles
  • Subscriptions is not a link, it's dynamically constructed by the inoreader page script, there's simply nothing to open in a new tab.

  • no you still didn't understand, I meant a specific subscription, not the subscriptions you see on the left pane, if you've never used inoreader before, search for a subject in the top left search field, subscribe to it and then go to the dashboard (again left pane, on the bottom) and look for suggestions/suggested subscriptions, something like that and try to push that, it's an anchor like the one I posted on the second post
  • yeah I have no idea what you're talking about, just tried in FF and Chrome and there's no <a> link with that excerpt you posted originally.

    image

  • here it is
    Clipboard01.jpg
    1027 x 467 - 56K
  • تم تعديل 2017/12/08 Chrome

    Despite <a> element being used (bad programming decision), that's not a link to a page. It just builds the feed's UI using page script.

  • ahh, ok, I see, thanks again for your help