Skip to content

Commit 187b2a6

Browse files
committed
Gitlab new style compatibility
1 parent 785d91f commit 187b2a6

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/js/main.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const ideWebsitesList = [
6262
title: 'Gitpod',
6363
name: 'gitpod',
6464
baseurl: `https://gitpod.io/#https://${platform}.com/`,
65-
platforms: ['github', 'gitlab'],
65+
platforms: ['github'],
6666
openInNewTab: true,
6767
icon: '<svg width="16" height="16" viewBox="0 0 32 32"><path fill="var(--color-fg-default)" d="M18.748 1.594a3.16 3.16 0 01-1.178 4.313l-9.437 5.387a.8.8 0 00-.403.695v8.456a.8.8 0 00.403.695l7.47 4.264a.8.8 0 00.794 0l7.47-4.264a.8.8 0 00.403-.695v-5.259l-6.715 3.785a3.167 3.167 0 01-4.312-1.2 3.16 3.16 0 011.202-4.308l9.607-5.415c2.927-1.65 6.548.463 6.548 3.82v9.22a6.016 6.016 0 01-3.035 5.224l-8.576 4.895a6.03 6.03 0 01-5.978 0l-8.576-4.895A6.016 6.016 0 011.4 21.087v-9.74a6.016 6.016 0 013.035-5.225L14.43.417a3.167 3.167 0 014.318 1.177z"/></svg>'
6868
},
@@ -158,7 +158,6 @@ async function init () {
158158
}
159159
case 'gitlab': {
160160
addGitLabSelectMenu();
161-
localStorage.setItem('gl-web-ide-button-selected', 'webide');
162161
break;
163162
}
164163
default: {
@@ -218,20 +217,20 @@ function addGitHubSelectMenu () {
218217
}
219218

220219
function addGitLabSelectMenu () {
221-
const webIDEDropdown = document.querySelector('.tree-controls .gl-new-dropdown .dropdown-menu .gl-new-dropdown-contents');
220+
const webIDEDropdown = document.querySelector('.tree-controls .gl-new-dropdown-panel .gl-new-dropdown-inner .edit-dropdown-group-width ul');
222221
if (!webIDEDropdown || document.querySelector('#open-in-web-ide')) {
223222
return;
224223
}
225224

226225
const gitLabHtml = `${ideWebsitesList.filter(filterItems).map((item) =>
227-
`<li data-toggle-for="open-in-web-ide"><a href="${item.baseurl}${repoUrlPath}" class="dropdown-item" target="_blank">
228-
${item.icon}
229-
${item.title}
230-
</a></li>`).join('')}`;
226+
`<li tabindex="0" data-testid="gitpod-menu-item" class="gl-new-dropdown-item"><a href="${item.baseurl}${repoUrlPath}" class="gl-new-dropdown-item-content" target="_blank">
227+
<span class="gl-new-dropdown-item-text-wrapper"><div class="gl-display-flex gl-flex-direction-column"><span class="gl-display-flex gl-justify-content-space-between gl-align-items-center gl-mb-2"><span data-testid="action-primary-text" class="gl-font-weight-bold">
228+
${item.title}
229+
</span>
230+
</div></span></a></li>`).join('')}`;
231231

232232
webIDEDropdown.setAttribute('id', 'open-in-web-ide');
233-
webIDEDropdown.setAttribute('style', '--color-fg-default: currentColor');
234-
webIDEDropdown.innerHTML = gitLabHtml;
233+
webIDEDropdown.innerHTML += gitLabHtml;
235234
}
236235

237236
window.onload = init;

0 commit comments

Comments
 (0)