rfmacedo / Pipefy branch name

// ==UserScript==
// @name         Pipefy branch name
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Set the name for the git branch
// @author       Rafael Macedo
// @match        https://app.pipefy.com/pipes/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    $('body').append('<div style="position:fixed;top:0;z-index:100;width:100%"><div onclick="nomeBranch();" style="cursor:pointer;margin:5px auto 0;width:15px;height:15px;border-radius:15px;border:none;background-color:#f0f0f0;"></div></div>');

    window.nomeBranch = function(){
        var url = window.location.href.split('/');
        var id = url[url.length - 1];
        var nome = $('#edit-card-title').html().replace(/ /g,'_').replace('.', '');
        var branch = id + '→' + nome;
        if ($('#nomeBranch').html() === undefined) $('#edit-card-title').parent().append('<div id="nomeBranch" style="font-size:14px;">'+branch+'</div>');
        else $('#nomeBranch').html(branch);
    }
})();