Add Trello Button

Añade trello a los tickets

目前為 2019-09-18 提交的版本,檢視 最新版本

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 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)