获取TAPD提交信息

自定义,用于git提交记录

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         获取TAPD提交信息
// @namespace    http://jsh.vimo.cloud/
// @version      1.2
// @description  自定义,用于git提交记录
// @author       Wizard <[email protected]>
// @include      *://www.tapd.cn/*/prong/stories/view/*
// @include      *://www.tapd.cn/*/prong/tasks/view/*
// @include      *://www.tapd.cn/*/bugtrace/bugs/view?bug_id=*
// @grant        none
// @license      GPL License
// ==/UserScript==

;(function() {
    'use strict';

    // Your code here...
    var view_position;
    var id;
    var title;
    var storyId;
    if($("#story_name_view").length > 0) {
        // 故事
        id = "s"+$("#story_name_view > .story-title-id").html().trim().substr(3, 7);
        title = $("#story_name_view > .editable-value").attr("title");
        view_position = "#locateForStoryInfo";
    } else if($("#task_name_view").length > 0) {
        // 任务
        storyId = parentStory.id.substr(12, 18);
        id = "s"+storyId+"-t"+$("#task_name_view > .task-title-id").html().trim().substr(3, 7);
        title = $("#task_name_view > .editable-value").attr("title");
        view_position = "#locateForTaskInfo";
    } else if($("#bug_title_view").length > 0) {
        // 缺陷
        storyId = default_value.BugStoryRelation_relative_id.id.substr(12, 18);
        id = "s"+storyId+"-b"+$("#bug_title_view > .bug-title-id").html().trim().substr(3, 7);
        title = $("#bug_title_view > .editable-value").attr("title");
        view_position = "#locateForBugInfo";
    }

    $(view_position).after("<h4>"+id+":"+title+"</h4>")
})();