duongdev / Atlasian Tabs

// ==UserScript==
// @name         Atlasian Tabs
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       Dương Đỗ
// @copyright    2018, duongdev (https://openuserjs.org//users/duongdev)
// @license      MIT
// @include      https://jira.targeek.io/*
// @include      https://bitbucket.org/targeek/*
// @grant        none
// ==/UserScript==

(function () {
  'use strict';

  $("body").on("click", "a", function (e) {
    console.log('click', e.target)
    const href = e.target.href

    if (!window.location.href.startsWith('https://bitbucket.org/targeek') && href.startsWith('https://bitbucket.org/targeek')) {
      e.preventDefault()
      window.open(href, '__bbucket_targeek__')
    }
    if (!window.location.href.startsWith('https://jira.targeek.io') && href.startsWith('https://jira.targeek.io')) {
      e.preventDefault()
      window.open(href, '__jira_targeek__')
    }
  });
})();