Add Trello Button

Añade trello a los tickets

当前为 2019-09-18 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Add Trello Button
// @version      0.1
// @namespace    http://tampermonkey.net/ 
// @description  Añade trello a los tickets
// @author       SirFerra
// @match        http://soporte.flexxus.com.ar/requests/show/index/id/*
// @grant        none
// ==/UserScript==

var token= ''

const keyTrello = '6b3e1745ff9c1e2eb51ff9d2f6cd421c';
const urlSoporteFlexxus = "http://soporte.flexxus.com.ar/requests/show/index/id/";

var linkParaGenerarToken='https://trello.com/1/authorize?expiration=never&scope=read,write,account&response_type=token&name=Server%20Token&key=6b3e1745ff9c1e2eb51ff9d2f6cd421c';

var idBoardDesarollo = 'fU8FuZwl';
var idBoardTest= 'OSN6wyaX';

var idCardCoso = '5ae2640d8dc583715d6b86ca';
var idCardAsignados = '5a7af3f5f1083724255f2a87';
function createCard(){
   // console.log("https://api.trello.com/1/cards?idList="+idCardCoso+"&keepFromSource=all&key="+keyTrello+"&token="+token)
    var data = null;
    var xhr = new XMLHttpRequest();
    xhr.addEventListener("readystatechange", function () {
        if (this.readyState === this.DONE) {
            console.log(this.responseText);
        }
    });
    var numt = $('.requestViewId').text().replace('#','');
    var name = $('.requestViewTitle').text() + " #" +numt;
    var desc = urlSoporteFlexxus + numt;
    var date = new Date($('div[title^="Resolución"] .itemCont span').data('countdown')* 1000)
    var month = parseInt(date.getMonth())+1
    var url = "https://api.trello.com/1/cards?name=" + name;
    url += "&desc="+ desc
    url += "&due=" + date.getFullYear() + "-" + ("0" + month).slice(-2) + "-" + ("0" + date.getDate()).slice(-2)
    url += "&pos=top"
    url += "&idList="+idCardAsignados
    url += "&keepFromSource=all"
    url += "&key=" + keyTrello
    url += "&token=" + token;
    url = encodeURI(url);
    url = url.replace('#','%23');
    //nsole.log(url);
    xhr.open("POST",url);
    xhr.send(data);
}


var btn = '<div id="trello" class="requestViewAction" title="Trello"><img src="https://a.trellocdn.com/prgb/dist/images/header-logo-2x.01ef898811a879595cea.png" style="width: 61px;height: auto;padding-top: 8px;"/></div>';

$('.requestViewActions').append(btn);
$('#trello').click(createCard)