// ==UserScript== // @name TFS Changeset History Helper // @namespace http://jonas.ninja // @version 1.4.1 // @description Changeset reference utilities // @author @_jnblog // @match http://*/tfs/DefaultCollection/*/_versionControl* // @grant GM_addStyle // @downloadURL none // ==/UserScript== /* jshint -W097 */ /* global GM_addStyle */ /* jshint asi: true, multistr: true */ var $ = unsafeWindow.jQuery; var mergedChangesetRegex = /\(merge c\d{5,} to QA\)/gi waitForKeyElements('.history-result', doEverything, false) waitForKeyElements(".vc-page-title[title^=Changeset]", addChangesetIdCopyUtilities, true) $(document).on('mouseenter', '.history-result', highlightHistoryResult) .on('mouseleave', '.history-result', unhighlightHistoryResult) $(document).on('dblclick', 'input.ijg-copy-changeset-id', copyMessage) .on('click', 'input.ijg-copy-changeset-id', copyId) .on('dblclick', 'input.ijg-copy-changeset-page-link', copyPageMessage) .on('click', 'input.ijg-copy-changeset-page-link', copyPageId) function copyId(e) { if (e.ctrlKey) { var historyResult = $(this).closest('.history-result') copy(this, historyResult.data().ijgTaskId) } else { displayResult(copy(this), $(this).next('span.ijg-copy-message'), $(this).parent()) } } function copyMessage(e) { var historyResult = $(this).closest('.history-result') displayResult(copy(this, createCommitMessage(historyResult, this.value)), $(this).next('span.ijg-copy-message'), $(this).parent(), true) } function copyPageId(e) { if (e.ctrlKey) { var historyResult = $(this).closest('.history-result') copy(this, $('.vc-change-summary-comment').text().match(/t\d{3,}/gi)[0].replace('t', '')) } else { displayResult(copy(this), $(this).next('span.ijg-copy-message'), $(this).parent()) } } function copyPageMessage(e) { displayResult(copy(this, createCommitMessage(".vc-change-summary-comment", this.value)), $(this).next('span.ijg-copy-message'), $(this).parent(), true) } function doEverything(historyResult) { historyResult = $(historyResult) spanifyText(historyResult) addCopyUtilities(historyResult) createTaskContainers(historyResult) //fetchTaskLinks(historyResult) } function createTaskContainers(historyResult) { // makes a positioned div in the right place to hold Task info var tasks = historyResult.find('.ijg-task-id') if (tasks.size()) { // make a container and append rows var container = $('
') historyResult.find('.change-link-container').append(container) tasks.each(function() { var tasknum = $(this).data('ijgTaskId') var task = $('