wmosakowskicraft / Jira Task to Clipboard

// ==UserScript==
// @name         Jira Task to Clipboard
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  This script is written to allow easy copying of Task Title and Description to Clipboard
// @author       Wieslaw Mosakowski
// @updateURL    https://openuserjs.org/meta/wmosakowskicraft/Jira_Task_to_Clipboard.meta.js  
// @match        https://jira.atlassian.com/browse/*
// @match        http://jira.intranet.roche.com/jira/browse/*
// @match        http://jira.intranet.roche.com/jira/projects/MEDINF/issues/*
// @require      https://cdn.jsdelivr.net/npm/clipboard@1/dist/clipboard.min.js
// @require      https://rawgit.com/notifyjs/notifyjs/master/dist/notify.js
// ==/UserScript==

var clipboard = new Clipboard('.btn', {
    text: function(trigger) {
        return $('#key-val').text() + ' \n' + $('#summary-val').text();
    }
});

clipboard.on('success', function(e) {
    $.notify("Copied to clipboard", "success");
    $.notify($('#key-val').text() + ' \n' + $('#summary-val').text(), "success");

});

clipboard.on('error', function(e) {
    $.notify("Access granted", "error");
});

$(document).ajaxComplete(function() {

    if(!$('#clipboardBtn').next().length) {

        $('#clipboardBtn').remove();
        $('.toolbar-split-left').append("<button id='clipboardBtn' class='btn aui-button aui-button-primary aui-style'>Copy to clipboard</button>");
    }

});

(function() {
    'use strict';



})();