// ==UserScript== // @name TFS Helper // @namespace http://jonas.ninja // @version 1.6.2 // @description Adds styles and moves things around so that oft-used functions are easier // @author @_jnblog // @match http://*/tfs/DefaultCollection/*/_backlogs* // @match http://*/tfs/DefaultCollection/*/_versionControl* // @match http://*/tfs/DefaultCollection/*/_workitems* // @require https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js // @grant GM_addStyle // @downloadURL none // ==/UserScript== /* jshint -W097 */ /* global GM_addStyle */ /* jshint asi: true, multistr: true */ var $ = unsafeWindow.jQuery; var topClass = "makeTfsNotAwful" $('body').addClass(topClass) waitForKeyElements("div.tab-page[rawtitle=Links]", doEverything, false) $(document).on('click', 'input.task-identifier', copyId) .on('dblclick', 'input.task-identifier', copyMessage) function copyId(e) { displayResult(copy(this), $(this).next('span.copy-message'), $(this).parent()) } function copyMessage(e) { var optMessage = makeMessage(this) displayResult(copy(this, optMessage), $(this).next('span.copy-message'), $(this).parent(), true) } function makeMessage(el) { var parent = $(el).closest('.info-text-wrapper') if (parent.length === 0) { console.error("The userscript _TFS Helper_ could not identify this task's name") } return 't' + parent.children('a.caption').text().match(/\d{5,}/)[0] + ' ' + parent.children('.info-text').text().replace(/^dev: /i, "") } function doEverything(linksPane) { if ($(linksPane).data('moved')) { return } showLinksPane(linksPane) stackAllTabs(linksPane) addBlockedButton(linksPane) window.setTimeout(function() { addTaskIdCopyUtilities(linksPane) changeDialogBorderColor(linksPane) }, 250) refreshNowAndLater(); } function showLinksPane(linksPane) { $(linksPane).data('moved', true) .addClass('linksPanel') .prepend($("