repo.ui.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. function showBugsBlock(bugs)
  2. {
  3. if(!bugs.length) return;
  4. $('#reviewBugContainer').show();
  5. $('#monacoEditor').css('width', '75%');
  6. $('.view-bugs').css('left', getViewBugIconLeft() + 'px');
  7. const link = $.createLink('repo', 'ajaxGetBugs', 'repoID=' + repoID + '&bugList=' + bugs.join(','));
  8. $('#reviewBugContainer').html("<iframe class='bug-iframe' src='" + link + "' width='100%' height='100%'></iframe>");
  9. }
  10. window.removeReviewBug = function()
  11. {
  12. $('#reviewBugContainer').hide();
  13. $('#reviewBugContainer').html('');
  14. $('#monacoEditor').css('width', '100%');
  15. setTimeout(() => {
  16. $('.view-bugs').css('left', getViewBugIconLeft() + 'px');
  17. }, 100);
  18. };
  19. function getViewBugIconLeft()
  20. {
  21. var monacoWidth = $('#codeContainer').width();
  22. var minimapWidth = $('.minimap-decorations-layer').width();
  23. var overlaysWidth = $('.margin-view-overlays').width();
  24. var bugContainerWitdh = $('#reviewBugContainer').width()
  25. var oldBugLeft = parseInt($('.view-bugs').css('left'));
  26. var viewBugsLeft = monacoWidth - minimapWidth - overlaysWidth - 65;
  27. if(bugContainerWitdh > 50 && oldBugLeft - viewBugsLeft < 50) return oldBugLeft;
  28. if(typeof pageType !== 'undefined' && pageType === 'diff') viewBugsLeft = viewBugsLeft - 70;
  29. return viewBugsLeft;
  30. }
  31. window.addEventListener('resize', function()
  32. {
  33. setTimeout(() => {
  34. $('.view-bugs').css('left', getViewBugIconLeft() + 'px');
  35. }, 100);
  36. });