Last active
December 23, 2019 14:17
-
-
Save beevk/a3edce3480d835795b8effd1f0227aab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: (function () { | |
function AddTaskId() { | |
var project = document.getElementsByClassName('TopbarPageHeaderStructure-title')[0].textContent; | |
project = project.replace("BCHU ", "") | |
.replace("Runway", "STORE") | |
.toUpperCase() | |
.replace("IOS APP", "iOS"); | |
var d = new Date(); | |
var month = ('0' + (d.getMonth() + 1)).slice(-2); | |
var day = ('0' + d.getDate()).slice(-2); | |
var prefix = String(month) + day; | |
var pattern = /\[[0-9]*\-[A-Z]*\]/g; | |
var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
var suffix = ''; | |
for (var i = 0; i < 3; i++) { | |
suffix += possible.charAt(Math.floor(Math.random() * possible.length)); | |
} /*and end removing here*/ | |
var taskString = '[' + project + '-' + prefix + '-' + suffix + ']'; | |
var element = document.activeElement; | |
if (!element.value.match(pattern)) { | |
element.value = taskString + ' ' + element.value; | |
} | |
} | |
if (document.activeElement.nodeName === 'INPUT' || document.activeElement.nodeName === 'TEXTAREA') { | |
AddTaskId(); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment