Zentao Utils

7/27/2021, 4:53:18 PM

Від 29.07.2021. Дивіться остання версія.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

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        Zentao Utils
// @namespace   Violentmonkey Scripts
// @match       http://zentao.inovance.com/pro/*
// @grant       all
// @version     1.0
// @author      sbw <[email protected]>
// @description 7/27/2021, 4:53:18 PM
// ==/UserScript==


(function() {
  
  // 显示 alert 对话框
  function show_alert(message)
  {
    bootAlert(message);
  }
  
  // 显示对话框
  function show_dialog(title, content)
  {
    $('#dialog .modal-title').html(title);
    $('#dialog .modal-body').html(content);
  }
  
  // 获取当前项目中的模块分类
  function fetch_all_module()
  {
    
  }
  
  // 更新任务所属模块
  function update_jobs_module(e)
  {
    // 禁止默认的响应
    e.preventDefault();
    
    // 获取选中的任务列表
    $('#bugList tr').filter('.checked').each(function () {
      var id = $(this).find('.c-id input').val();
      var title = $(this).find('.text-left').attr('title');
      if (typeof(title) === "undefined") {
        title = $(this).find('.text-left > a').attr('title');
      }
    });
    
    var content = $("<div class='dropdown'><button class='btn' type='button' data-toggle='dropdown'>所属模块<span class='caret'></span></button><ul class=dropdown-menu></ul></div>");
    
    show_dialog('更新模块', content);
  }
  
  // 添加对话框
  $("body").append("<div class='modal fade' id='dialog'><div class='modal-dialog modal-sm'><div class='modal-content'><div class='modal-header'><h4 class='modal-title'></h4></div><div class='modal-body'></div><div class='modal-footer'><button type='button' class='btn btn-default' data-dismiss='modal'>关闭</button><button type='button' class='btn btn-primary'>保存</button></div></div></div></div>");
  
  // 添加模块修改按钮
  $('.table-actions').append('<button class="btn" id="update-module" data-toggle="modal" data-target="#dialog">所属模块</button>');
  // 点击的事件
  $('#update-module').click(update_jobs_module);
})();