Greasy Fork 还支持 简体中文。

Redmine helper buttons: List page

Copy multiple Redmine URL links

  1. // ==UserScript==
  2. // @name Redmine helper buttons: List page
  3. // @namespace Redmine
  4. // @icon https://dev.sun-asterisk.com/favicon.ico?1528612569
  5. // @description Copy multiple Redmine URL links
  6. // @run-at document-start
  7. // @match *://dev.sun-asterisk.com/projects/*
  8. // @match *://*redmine.sun-asterisk.vn/projects/*
  9. // @grant GM_setClipboard
  10. // @grant GM_notification
  11. // @version 1.1.1
  12. // ==/UserScript==
  13.  
  14. document.addEventListener("DOMContentLoaded", function (event) {
  15. var host = location.protocol + '//' + location.host;
  16. $('#query_form_with_buttons p.buttons').append('<a class="icon icon-copy ticket-urls" href="javascript:void(0)">Copy URLs</a>')
  17. .append('<a class="icon icon-copy hide-sidebar" href="javascript:void(0)">Hide sidebar</a>');
  18. $('.ticket-urls').on('click', function () {
  19. var ticketUrls = [];
  20. $('input:checkbox[name="ids[]"]:checked').each(function () {
  21. ticketUrls.push(host + $(this).closest('tr').find('td.id a').attr('href'));
  22. });
  23. var joinedUrls = ticketUrls.join("\n");
  24. if (joinedUrls) {
  25. GM_setClipboard(joinedUrls);
  26. GM_notification ( {title: 'Redmine URL copied', text: joinedUrls, image: 'https://dev.sun-asterisk.com/favicon.ico?1528612569'} );
  27. }
  28. });
  29. $('.hide-sidebar').on('click', function () {
  30. var sidebar = $('#sidebar')
  31. content = $('#content');
  32. if (sidebar.is(':visible')) {
  33. sidebar.hide();
  34. $('#content').css('width', '100%');
  35. } else {
  36. sidebar.show();
  37. $('#content').css('width', '');
  38. }
  39. });
  40. $('table.list td.parent a').each(function () { $(this).text($(this).prop('title')); $(this).parent('td').css('text-align', 'left')});
  41. });