Last active
October 8, 2020 14:42
-
-
Save shorti1996/75b8c198038232170baf5f737676eeb4 to your computer and use it in GitHub Desktop.
Tampermonkey scripts
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
| // ==UserScript== | |
| // @name JIRA copy ID and name | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.2 | |
| // @description try to take over the world! | |
| // @author You | |
| // @match https://jira.bbqnx.net/browse/* | |
| // @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js | |
| // @grant GM_addStyle | |
| // ==/UserScript== | |
| var style = '#snackbar{visibility:hidden;min-width:250px;margin-left:-125px;background-color:#333;color:#fff;text-align:center;border-radius:2px;padding:16px;position:fixed;z-index:1;left:50%;bottom:30px}#snackbar.show{visibility:visible;-webkit-animation:fadein .5s,fadeout .5s 2.5s;animation:fadein .5s,fadeout .5s 2.5s}@-webkit-keyframes fadein{from{bottom:0;opacity:0}to{bottom:30px;opacity:1}}@keyframes fadein{from{bottom:0;opacity:0}to{bottom:30px;opacity:1}}@-webkit-keyframes fadeout{from{bottom:30px;opacity:1}to{bottom:0;opacity:0}}@keyframes fadeout{from{bottom:30px;opacity:1}to{bottom:0;opacity:0}}'; | |
| GM_addStyle(style); | |
| (function() { | |
| 'use strict'; | |
| // Your code here... | |
| // console.log("Works"); | |
| var $ = window.jQuery; | |
| //var script = document.createElement('script'); | |
| //script.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"; | |
| //document.getElementsByTagName('head')[0].appendChild(script); | |
| var copyElementId = "temp-copy-source"; | |
| var copyElementSelector = '#' + copyElementId; | |
| var copyButtonAnchorElementSelector = '.toolbar-split.toolbar-split-right .toolbar-item'; | |
| var copyButtonId = "copy-button"; | |
| var copyButtonSelector = "#" + copyButtonId; | |
| var copyIssueKeyButtonId = "copy-issue-key"; | |
| var copyIssueKeyButtonSelector = '#' + copyIssueKeyButtonId; | |
| var snackbarId = 'snackbar'; | |
| var snackbarSelector = '#' + snackbarId; | |
| $.fn.exists = function () { | |
| return this.length !== 0; | |
| } | |
| var observeDOM = (function() { | |
| var MutationObserver = window.MutationObserver || window.WebKitMutationObserver; | |
| var eventListenerSupported = window.addEventListener; | |
| return function(obj, onAddCallback, onRemoveCallback) { | |
| if (MutationObserver) { | |
| // define a new observer | |
| var mutationObserver = new MutationObserver(function(mutations, observer) { | |
| if (mutations[0].addedNodes.length && onAddCallback != undefined) | |
| onAddCallback(); | |
| if (mutations[0].removedNodes.length && onRemoveCallback != undefined) | |
| onRemoveCallback(); | |
| }); | |
| // have the observer observe foo for changes in children | |
| mutationObserver.observe(obj, { | |
| childList: true, | |
| subtree: true | |
| }); | |
| } else if (eventListenerSupported) { | |
| obj.addEventListener('DOMNodeInserted', onAddCallback, false); | |
| obj.addEventListener('DOMNodeRemoved', onRemoveCallback, false); | |
| } | |
| }; | |
| })(); | |
| var copyFunction = function(copyText) { | |
| //console.log("dupa"); | |
| var copyElement = $('<input type="text" id="' + copyElementId + '" /*style="height: 0; width: 0;"*/>').val(copyText).appendTo('body'); | |
| copyElement.select(); | |
| document.execCommand("copy"); | |
| $(copyElementSelector).remove(); | |
| var snackbar = $(snackbarSelector); | |
| snackbar.addClass('show'); | |
| setTimeout(function(){ snackbar.removeClass('show') }, 3000); | |
| }; | |
| var ff = function() { | |
| // $('.bbmc-i').each(function() { | |
| // $(this).width('100vw'); | |
| // }); | |
| if (!$(copyButtonSelector).exists() && $(copyButtonAnchorElementSelector).exists()) { | |
| var issueName = $('#summary-val').text(); | |
| var issueKey = $('#key-val').text(); | |
| var issueNameWithoutLabels = issueName.replace(/(\[.*\]\s*)*(.+)/, '$2') | |
| var toCopy = issueKey + ' ' + issueNameWithoutLabels; | |
| $($(copyButtonAnchorElementSelector)[0]).prepend('<li class="toolbar-item"><a class="toolbar-trigger "> <div id="' + copyButtonId + '" style="width: auto;visibility: visible;display: inline;">📄 Copy</div></a></li>') | |
| $(copyButtonSelector).on("click", (event) => { copyFunction(toCopy); }); | |
| $('body').append('<div id="' + snackbarId + '">Copied succesfully</div>'); | |
| $('.aui-nav-breadcrumbs .issue-link').parent().append('<div id="' + copyIssueKeyButtonId + '" style="display: inline;"> 📄</div>'); | |
| $(copyIssueKeyButtonSelector).on("click", (event) => { copyFunction(issueKey); }); | |
| } | |
| } | |
| var target = document.getElementsByTagName('body')[0]; | |
| observeDOM(target, /*onAdd*/ ff, /*onRemove*/ ff); | |
| })(); |
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
| // ==UserScript== | |
| // @name JIRA copy ID and name | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.2 | |
| // @description try to take over the world! | |
| // @author You | |
| // @match https://jira.bbqnx.net/browse/* | |
| // @match https://jojomobile.atlassian.net/* | |
| // @match https://jira.canaldigital.com/* | |
| // @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js | |
| // @grant GM_addStyle | |
| // ==/UserScript== | |
| var style = '#snackbar{visibility:hidden;min-width:250px;margin-left:-125px;background-color:#333;color:#fff;text-align:center;border-radius:2px;padding:16px;position:fixed;z-index:1;left:50%;bottom:30px}#snackbar.show{visibility:visible;-webkit-animation:fadein .5s,fadeout .5s 2.5s;animation:fadein .5s,fadeout .5s 2.5s}@-webkit-keyframes fadein{from{bottom:0;opacity:0}to{bottom:30px;opacity:1}}@keyframes fadein{from{bottom:0;opacity:0}to{bottom:30px;opacity:1}}@-webkit-keyframes fadeout{from{bottom:30px;opacity:1}to{bottom:0;opacity:0}}@keyframes fadeout{from{bottom:30px;opacity:1}to{bottom:0;opacity:0}}'; | |
| GM_addStyle(style); | |
| (function() { | |
| 'use strict'; | |
| // Your code here... | |
| // console.log("Works"); | |
| var $ = window.jQuery; | |
| //var script = document.createElement('script'); | |
| //script.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"; | |
| //document.getElementsByTagName('head')[0].appendChild(script); | |
| var copyElementId = "temp-copy-source"; | |
| var copyElementSelector = '#' + copyElementId; | |
| //var copyButtonAnchorElementSelector = '.toolbar-split.toolbar-split-right .toolbar-item'; | |
| var copyButtonAnchorElementSelector = '#opsbar-jira\\.issue\\.tools, .ghx-detail-summary'; | |
| var copyButtonId = "copy-button"; | |
| var copyButtonSelector = "#" + copyButtonId; | |
| var copyIssueKeyButtonId = "copy-issue-key"; | |
| var copyIssueKeyButtonSelector = '#' + copyIssueKeyButtonId; | |
| var snackbarId = 'snackbar'; | |
| var snackbarSelector = '#' + snackbarId; | |
| $.fn.exists = function () { | |
| return this.length !== 0; | |
| } | |
| var observeDOM = (function() { | |
| var MutationObserver = window.MutationObserver || window.WebKitMutationObserver; | |
| var eventListenerSupported = window.addEventListener; | |
| return function(obj, onAddCallback, onRemoveCallback) { | |
| if (MutationObserver) { | |
| // define a new observer | |
| var mutationObserver = new MutationObserver(function(mutations, observer) { | |
| if (mutations[0].addedNodes.length && onAddCallback != undefined) | |
| onAddCallback(); | |
| if (mutations[0].removedNodes.length && onRemoveCallback != undefined) | |
| onRemoveCallback(); | |
| }); | |
| // have the observer observe foo for changes in children | |
| mutationObserver.observe(obj, { | |
| childList: true, | |
| subtree: true | |
| }); | |
| } else if (eventListenerSupported) { | |
| obj.addEventListener('DOMNodeInserted', onAddCallback, false); | |
| obj.addEventListener('DOMNodeRemoved', onRemoveCallback, false); | |
| } | |
| }; | |
| })(); | |
| var copyFunction = function(copyText) { | |
| //console.log("dupa"); | |
| var copyElement = $('<input type="text" id="' + copyElementId + '" /*style="height: 0; width: 0;"*/>').val(copyText).appendTo('body'); | |
| copyElement.select(); | |
| document.execCommand("copy"); | |
| $(copyElementSelector).remove(); | |
| var snackbar = $(snackbarSelector); | |
| snackbar.addClass('show'); | |
| setTimeout(function(){ snackbar.removeClass('show') }, 3000); | |
| }; | |
| var ff = function() { | |
| // $('.bbmc-i').each(function() { | |
| // $(this).width('100vw'); | |
| // }); | |
| if (!$(copyButtonSelector).exists() && $(copyButtonAnchorElementSelector).exists()) { | |
| var issueName = $('#summary-val').text(); | |
| var issueKey = $('#key-val, #issuekey-val').text(); | |
| var issueNameWithoutLabels = issueName.replace(/(\[.*\]\s*)*(.+)/, '$2') | |
| var toCopy = issueKey + ' ' + issueNameWithoutLabels; | |
| //$($(copyButtonAnchorElementSelector)[0]).prepend('<li class="toolbar-item"><a class="aui-button toolbar-trigger"> <div id="' + copyButtonId + '" style="width: auto;visibility: visible;display: inline;">📄 Copy</div></a></li>') | |
| $($(copyButtonAnchorElementSelector)[0]).append('<a class="aui-button toolbar-trigger"> <div id="' + copyButtonId + '" style="width: auto;visibility: visible;display: inline;">📄 Copy</div></a>') | |
| $(copyButtonSelector).on("click", (event) => { copyFunction(toCopy); }); | |
| $('body').append('<div id="' + snackbarId + '">Copied succesfully</div>'); | |
| $('.aui-nav-breadcrumbs .issue-link, #issuekey-val').parent().append('<div id="' + copyIssueKeyButtonId + '" style="display: inline;">  📄</div>'); | |
| $(copyIssueKeyButtonSelector).on("click", (event) => { copyFunction(issueKey); }); | |
| } | |
| } | |
| var target = document.getElementsByTagName('body')[0]; | |
| observeDOM(target, /*onAdd*/ ff, /*onRemove*/ ff); | |
| })(); |
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
| // ==UserScript== | |
| // @name JIRA copy ID and name | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.4 | |
| // @description try to take over the world! | |
| // @author You | |
| // @match https://jira.bbqnx.net/browse/* | |
| // @match https://jojomobile.atlassian.net/* | |
| // @match https://jira.canaldigital.com/* | |
| // @match https://blueveery.atlassian.net/secure/* | |
| // @match https://blueveery.atlassian.net/jira/* | |
| // @match https://blueveery.atlassian.net/browse/* | |
| // @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js | |
| // @grant GM_addStyle | |
| // ==/UserScript== | |
| var style = '#snackbar{visibility:hidden;min-width:250px;margin-left:-125px;background-color:#333;color:#fff;text-align:center;border-radius:2px;padding:16px;position:fixed;z-index:1;left:50%;bottom:30px}#snackbar.show{visibility:visible;-webkit-animation:fadein .5s,fadeout .5s 2.5s;animation:fadein .5s,fadeout .5s 2.5s}@-webkit-keyframes fadein{from{bottom:0;opacity:0}to{bottom:30px;opacity:1}}@keyframes fadein{from{bottom:0;opacity:0}to{bottom:30px;opacity:1}}@-webkit-keyframes fadeout{from{bottom:30px;opacity:1}to{bottom:0;opacity:0}}@keyframes fadeout{from{bottom:30px;opacity:1}to{bottom:0;opacity:0}}'; | |
| GM_addStyle(style); | |
| (function () { | |
| 'use strict'; | |
| // Your code here... | |
| // console.log("Works"); | |
| var $ = window.jQuery; | |
| jQuery.expr[':'].regex = function (elem, index, match) { | |
| var matchParams = match[3].split(','), | |
| validLabels = /^(data|css):/, | |
| attr = { | |
| method: matchParams[0].match(validLabels) ? matchParams[0].split(':')[0] : 'attr', | |
| property: matchParams.shift().replace(validLabels, '') | |
| }, | |
| regexFlags = 'ig', | |
| regex = new RegExp(matchParams.join('').replace(/^\s+|\s+$/g, ''), regexFlags); | |
| return regex.test(jQuery(elem)[attr.method](attr.property)); | |
| } | |
| //var script = document.createElement('script'); | |
| //script.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"; | |
| //document.getElementsByTagName('head')[0].appendChild(script); | |
| var copyElementId = "temp-copy-source"; | |
| var copyElementSelector = toSelector(copyElementId); | |
| //var copyButtonAnchorElementSelector = '.toolbar-split.toolbar-split-right .toolbar-item'; | |
| var copyButtonAnchorElementSelector = "h2:contains('Description')"; | |
| var copyButtonId = "copy-button"; | |
| var copyButtonSelector = toSelector(copyButtonId); | |
| var copyBranchButtonId = "copy-branch-button"; | |
| var copyIssueKeyButtonId = "copy-issue-key"; | |
| var snackbarId = 'snackbar'; | |
| var snackbarSelector = toSelector(snackbarId); | |
| var buttonCopy; | |
| var buttonBranchCopy; | |
| function toSelector(id) { | |
| return "#" + id; | |
| } | |
| $.fn.exists = function () { | |
| return this.length !== 0; | |
| } | |
| var observeDOM = (function () { | |
| var MutationObserver = window.MutationObserver || window.WebKitMutationObserver; | |
| var eventListenerSupported = window.addEventListener; | |
| return function (obj, onAddCallback, onRemoveCallback) { | |
| if (MutationObserver) { | |
| // define a new observer | |
| var mutationObserver = new MutationObserver(function (mutations, observer) { | |
| if (mutations[0].addedNodes.length && onAddCallback != undefined) | |
| onAddCallback(); | |
| //if (mutations[0].removedNodes.length && onRemoveCallback != undefined) | |
| // onRemoveCallback(); | |
| }); | |
| // have the observer observe foo for changes in children | |
| mutationObserver.observe(obj, { | |
| childList: true//, | |
| //subtree: true | |
| }); | |
| } else if (eventListenerSupported) { | |
| obj.addEventListener('DOMNodeInserted', onAddCallback, false); | |
| //obj.addEventListener('DOMNodeRemoved', onRemoveCallback, false); | |
| } | |
| }; | |
| })(); | |
| var copyFunction = function (copyText, anchorElement) { | |
| //copyText = "saasassa"; | |
| //console.log("dupa"); | |
| //console.log(copyText); | |
| debugger; | |
| var copyElement = $('<input type="text" id="' + copyElementId + '"/>').val(copyText).appendTo(anchorElement); | |
| copyElement.select(); | |
| document.execCommand("copy"); | |
| // setTimeout(function () { | |
| // $(copyElement).remove(); | |
| // }, 100); | |
| $(copyElementSelector).remove(); | |
| var snackbar = $(snackbarSelector); | |
| snackbar.addClass('show'); | |
| setTimeout(function () { | |
| snackbar.removeClass('show') | |
| }, 3000); | |
| }; | |
| function createCopyButton(anchorElementSelector, buttonId, buttonText, copyText) { | |
| var button = $('<a></a>') | |
| .addClass('aui-button toolbar-trigger') | |
| .prepend($('<div></div>') | |
| .attr('id', buttonId) | |
| .css({ | |
| "width": "auto", | |
| "visibility": "visible", | |
| "display": "inline" | |
| }) | |
| .text(buttonText) | |
| ) | |
| .on("click", (event) => { | |
| copyFunction(copyText, $(anchorElementSelector)[0]); | |
| }); | |
| $($(anchorElementSelector)[0]).append(button); | |
| return button; | |
| } | |
| var ff = function () { | |
| setTimeout(function () { | |
| if ($(copyButtonAnchorElementSelector).exists() | |
| && buttonCopy === undefined | |
| || !$('#' + $('div', buttonCopy).attr('id'), $(copyButtonAnchorElementSelector)).exists()) { | |
| var issueName = $('[data-test-id="issue.views.issue-base.foundation.summary.heading"]').text(); | |
| var issueKey = $('div:regex(class, BreadcrumbsItem__BreadcrumbsItemElement-.*)').last().text(); | |
| var issueNameWithoutLabels = issueName.replace(/(\[.*\]\s*)*(.+)/, '$2') | |
| var toCopy = issueKey + ' ' + issueNameWithoutLabels; | |
| buttonCopy = createCopyButton(copyButtonAnchorElementSelector, copyButtonId, "📄 Copy", toCopy); | |
| var branchName = issueKey + "-" + issueNameWithoutLabels.replace(new RegExp('\\s', 'g'), '_'); | |
| buttonBranchCopy = createCopyButton(copyButtonAnchorElementSelector, copyBranchButtonId, "📄 Branch", branchName); | |
| // $('.aui-nav-breadcrumbs .issue-link, #issuekey-val').parent() | |
| // .append('<div id="' + copyIssueKeyButtonId + '" style="display: inline;">  📄</div>') | |
| // .on("click", (event) => { | |
| // copyFunction(issueKey, $(copyButtonAnchorElementSelector)); | |
| // }); | |
| $('body').append('<div id="' + snackbarId + '">Copied succesfully</div>'); | |
| } | |
| }, 0); | |
| } | |
| var target = document.getElementsByTagName('body')[0]; | |
| observeDOM(target, /*onAdd*/ ff, /*onRemove*/ ff); | |
| })(); |
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
| // ==UserScript== | |
| // @name JIRA copy ID and name | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description try to take over the world! | |
| // @author You | |
| // @match https://jira.bbqnx.net/browse* | |
| // @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js | |
| // @grant none | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| // Your code here... | |
| // console.log("Works"); | |
| var $ = window.jQuery; | |
| var script = document.createElement('script'); | |
| script.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"; | |
| document.getElementsByTagName('head')[0].appendChild(script); | |
| var observeDOM = (function() { | |
| var MutationObserver = window.MutationObserver || window.WebKitMutationObserver; | |
| var eventListenerSupported = window.addEventListener; | |
| return function(obj, onAddCallback, onRemoveCallback) { | |
| if (MutationObserver) { | |
| // define a new observer | |
| var mutationObserver = new MutationObserver(function(mutations, observer) { | |
| if (mutations[0].addedNodes.length && onAddCallback != undefined) | |
| onAddCallback(); | |
| if (mutations[0].removedNodes.length && onRemoveCallback != undefined) | |
| onRemoveCallback(); | |
| }); | |
| // have the observer observe foo for changes in children | |
| mutationObserver.observe(obj, { | |
| childList: true, | |
| subtree: true | |
| }); | |
| } else if (eventListenerSupported) { | |
| obj.addEventListener('DOMNodeInserted', onAddCallback, false); | |
| obj.addEventListener('DOMNodeRemoved', onRemoveCallback, false); | |
| } | |
| }; | |
| })(); | |
| var ff = function() { | |
| console.log('worrkrkrs'); | |
| $('.bbmc-i').each(function() { | |
| $(this).width('100vw'); | |
| }); | |
| $('#summary-val').each(function() { | |
| console.log($(this).textContent); | |
| }); | |
| } | |
| var target = document.getElementsByTagName('body')[0]; | |
| observeDOM(target, /*onAdd*/ ff, /*onRemove*/ ff); | |
| })(); |
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
| // ==UserScript== | |
| // @name Epand all commit messages- gitlab | |
| // @namespace http://tampermonkey.net/ | |
| // @version 1.0 | |
| // @description try to take over the world! | |
| // @author You | |
| // @match *://gitlab.com/* | |
| // @grant none | |
| // ==/UserScript== | |
| (function () { | |
| 'use strict'; | |
| const $ = window.jQuery; | |
| let expandButton = undefined; | |
| const triggerSelector = ".commits-tab.active"; | |
| function clickOnExpandButtons() { | |
| $(".text-expander.js-toggle-button").click(); | |
| } | |
| function appendExpandButton() { | |
| const buttonAnchor = $(".merge-request-tabs-holder"); | |
| if (buttonAnchor.length) { | |
| expandButton = $('<div class="btn gl-button js-issuable-edit qa-edit-button">Expand all commit messages</div>'); | |
| expandButton.click(clickOnExpandButtons); | |
| $(buttonAnchor).after(expandButton); | |
| } | |
| } | |
| function removeExpandButton() { | |
| expandButton.remove(); | |
| expandButton = undefined; | |
| } | |
| function onDomChanged() { | |
| setTimeout(function () { | |
| if ($(triggerSelector).length) { | |
| if (!expandButton) { | |
| appendExpandButton(); | |
| } | |
| } else if (expandButton) { | |
| removeExpandButton(); | |
| } | |
| }, 0); | |
| } | |
| function observeDOM(obj, onAddCallback, onRemoveCallback) { | |
| const MutationObserver = window.MutationObserver || window.WebKitMutationObserver; | |
| const eventListenerSupported = window.addEventListener; | |
| if (MutationObserver) { | |
| // define a new observer | |
| const mutationObserver = new MutationObserver(function (mutations, observer) { | |
| if (onAddCallback !== undefined) { | |
| onAddCallback(); | |
| } | |
| //if (mutations[0].removedNodes.length && onRemoveCallback != undefined) | |
| // onRemoveCallback(); | |
| }); | |
| // have the observer observe foo for changes in children | |
| mutationObserver.observe(obj, { | |
| // childList: true, | |
| subtree: true, | |
| attributeFilter: ["class"] | |
| }); | |
| } else if (eventListenerSupported) { | |
| obj.addEventListener('DOMNodeInserted', onAddCallback, false); | |
| obj.addEventListener('DOMNodeRemoved', onRemoveCallback, false); | |
| } | |
| } | |
| const target = document.getElementsByTagName('body')[0]; | |
| observeDOM(target, /*onAdd*/ onDomChanged, /*onRemove*/ onDomChanged); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment