Copy Redmine URL links

Copy multiple Redmine URL links

ของเมื่อวันที่ 26-11-2019 ดู เวอร์ชันล่าสุด

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey to install this script.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name Copy Redmine URL links
// @namespace Redmine
// @icon https://dev.sun-asterisk.com/favicon.ico?1528612569
// @description Copy multiple Redmine URL links
// @run-at document-start
// @match *://dev.sun-asterisk.com/projects/*
// @grant GM_setClipboard
// @grant GM_notification
// @version 1.0.0
// ==/UserScript==

document.addEventListener("DOMContentLoaded", function (event) {
    var host = location.protocol + '//' + location.host;
  
    $('#query_form_with_buttons p.buttons').append('<a class="icon icon-copy ticket-urls" href="javascript:void(0)">Copy URLs</a>');
  
    $('.ticket-urls').on('click', function () {
        var ticketUrls = [];
        $('input:checkbox[name="ids[]"]:checked').each(function () {
          ticketUrls.push(host + $(this).closest('tr').find('td.id a').attr('href'));
        });
        var joinedUrls = ticketUrls.join("\n");
        if (joinedUrls) {
          GM_setClipboard(joinedUrls);
          GM_notification ( {title: 'Redmine URL copied', text: joinedUrls, image: 'https://dev.sun-asterisk.com/favicon.ico?1528612569'} );
        }
    });
});