MRQZ deploy URL helper for GITLAB

try to take over the world!

  1. // ==UserScript==
  2. // @name MRQZ deploy URL helper for GITLAB
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2.2
  5. // @description try to take over the world!
  6. // @author pullso
  7. // @match https://gitlab.com/marquiz/*/-/merge_requests/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. var info = window.location.pathname.split('/')
  15. var repName = info[2]
  16. var label = '`' + repName + '` '
  17. var deployUrl = 'https://deploy-preview-' + info.reverse()[0] + '--marquiz-'+ repName +'.netlify.app/\n\n'
  18.  
  19. var text = label + window.location.href + ' \n \r '
  20. if(repName !== 'backend') text += label + deployUrl
  21. navigator.clipboard.writeText(text)
  22.  
  23. var descriptionBlock = document.querySelector('.description p')
  24. if(!descriptionBlock) return
  25.  
  26. descriptionBlock.innerText = text + descriptionBlock.innerText
  27.  
  28. if(repName !== 'backend'){
  29. descriptionBlock.innerHTML = '<a href=' + deployUrl +
  30. ' target="_blank"> Открыть деплой в новой вкладке </a><br><br>' +
  31. descriptionBlock.innerHTML
  32. }
  33.  
  34. })();