您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Plugin to allow moving tasks in JIRA
当前为
- // ==UserScript==
- // @name JIRA task mover plugin
- // @description Plugin to allow moving tasks in JIRA
- // @version 0.3
- // @author Max Schlüssel <lokoxe@gmail.com>
- // @namespace https://ghostkernel.org/
- // @match *://*/*
- // @grant GM_addStyle
- // ==/UserScript==
- (function($) {
- 'use strict';
- GM_addStyle(" \
- .issuerow .dragger { \
- display: block; \
- height: 10px; \
- margin-top: 15px; \
- margin-right: 5px; \
- border: none !important;\
- cursor: move; \
- background: repeating-linear-gradient(0, \
- transparent 0%, \
- transparent 2%, #aaa 2%, \
- #aaa 3%, transparent 3%);\
- } \
- .issuerow.dragged { \
- background-color: #eee !important; \
- } \
- ");
- $(document).ready(function() {
- if(!$("body").is("#jira")) {
- return;
- }
- var issueRows = $(".issuerow");
- var draggedRow = null;
- var dropSequence = null;
- var insertAfter = false;
- issueRows.each(function() {
- var issueRow = $(this);
- var dragger = $("<td>");
- dragger.addClass("dragger");
- issueRow.prepend(dragger);
- dropSequence = null;
- dragger.bind("mousedown.drag", function(e) {
- e.preventDefault();
- draggedRow = dragger.parent();
- draggedRow.addClass("dragged");
- });
- });
- $(document).bind("mousemove.drag", function(e) {
- e.preventDefault();
- if(draggedRow == null) {
- return;
- }
- var el = $(e.target);
- var hoveredRow = el.closest(".issuerow");
- if(hoveredRow.length > 0) {
- if(!draggedRow.is(hoveredRow)) {
- draggedRow.detach();
- if(e.offsetY < 20) {
- insertAfter = false;
- draggedRow.insertBefore(hoveredRow);
- } else {
- insertAfter = true;
- draggedRow.insertAfter(hoveredRow);
- }
- }
- dropSequence = draggedRow.index();
- }
- });
- $(document).bind("mouseup.drag", function(e) {
- e.preventDefault();
- if(draggedRow != null && dropSequence != null) {
- var moveUrl = draggedRow.find(".subtask-reorder a").first().attr("href");
- var currentSequence = moveUrl.substring(moveUrl.indexOf("¤tSubTaskSequence=") + "¤tSubTaskSequence=".length, moveUrl.indexOf("&subTaskSequence="));
- if(currentSequence != dropSequence) {
- var id = moveUrl.substring(moveUrl.indexOf("id=") + "id=".length, moveUrl.indexOf("¤tSubTaskSequence="));
- var newLink = "/secure/MoveIssueLink.jspa?id=" + id + "¤tSubTaskSequence=" + currentSequence + "&subTaskSequence=" + dropSequence;
- window.location = newLink;
- }
- // Reset dragged row
- draggedRow.removeClass("dragged");
- draggedRow = null;
- }
- });
- });
- })($);