Skip to content

Commit 79b858e

Browse files
committed
Add For me on GitHub ribbon - Fix; IntelliJ docs
1 parent 9dd80eb commit 79b858e

4 files changed

Lines changed: 129 additions & 29 deletions

File tree

.github/copilot-instructions.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@
2121
- config/vscode.txt: one VS Code extension ID per line; ignore blanks/comments.
2222
- config/dock_apps.txt: full app path per line; `--` prefix removes; `SPACER` inserts spacer; ignore blanks.
2323

24+
## Fork ribbon (site-wide)
25+
- A small "Fork me" ribbon is injected site-wide from `_includes/head-custom.html`.
26+
- It uses `site.social.github` (owner/repo) or `site.github` in `_config.yml` to build the GitHub URL.
27+
- New pages automatically receive the ribbon without editing layouts. To disable the ribbon for a single page, add the following to the page's front matter:
28+
29+
```yaml
30+
fork_ribbon: false
31+
```
32+
33+
And then in `_includes/head-custom.html` you can check `page.fork_ribbon` and skip injection if set to `false`.
34+
2435
## Tests and CI
2536
- Local: `zsh scripts/macos/run_tests.sh`; `pwsh scripts/windows/run_tests.ps1`.
2637
- Lint: ShellCheck for `.sh`; PSScriptAnalyzer for `.ps1` (add to CI when available).

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ A lightweight bootstrap script (`scripts/windows/setup_env_min.ps1`) is availabl
143143
2. Open **PowerShell as Administrator**
144144
3. Allow script execution for this session: <kbd>Set-ExecutionPolicy Bypass -Scope Process -Force</kbd>
145145
4. cd <kbd>dev-tools</kbd>
146-
5. Run the script as shown above
146+
5. Run the script picking one of the options, Interactive or Silent, as shown above
147147
6. Restart your terminal to apply PATH and `JAVA_HOME` changes
148148
7. Run <kbd>./scripts/windows/run_vscode_setup.ps1</kbd> to install required (and some optional) VS Code extensions. The list is in `config/vscode.txt` if you prefer to add or remove extensions.
149149
8. *(Optional)* Launch IntelliJ IDEA once to complete its first-run setup

_includes/head-custom.html

Lines changed: 92 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
{ label: 'FAQ', href: '{{ "/faq/" | relative_url }}' },
9191
{ label: 'Scripts', href: '{{ "/scripts/" | relative_url }}' },
9292
{ label: 'Details', href: '{{ "/details/" | relative_url }}' },
93+
{ label: 'IntelliJ IDEA', href: '{{ "/docs/intellij-idea/" | relative_url }}' },
9394
{ label: 'Details - VS Code', href: '{{ "/docs/vscode-info/" | relative_url }}' }
9495
];
9596

@@ -176,21 +177,22 @@
176177
});
177178
</script>
178179

180+
{% if page.fork_ribbon != false %}
179181
<!-- Fork ribbon styles + injector -->
180182
<style>
181-
/* Ribbon container positioned near top-left to avoid colliding with the site menu */
183+
/* Ribbon container positioned near top-left or top-right to avoid colliding with the site menu */
182184
.fork-ribbon {
183185
position: fixed;
184186
top: 12px;
185-
left: -52px;
186187
z-index: 10000;
187188
pointer-events: none; /* let underlying controls receive clicks except the link */
189+
overflow: visible;
188190
}
189191

190192
.fork-ribbon a {
191193
pointer-events: auto;
192194
display: block;
193-
width: 220px;
195+
width: 160px; /* width tuned for visibility */
194196
background: #151513; /* GitHub-like dark ribbon */
195197
color: #fff;
196198
text-decoration: none;
@@ -199,15 +201,10 @@
199201
line-height: 1.4;
200202
padding: 6px 0;
201203
text-align: center;
202-
transform: rotate(-45deg);
203204
box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
204205
border-radius: 2px;
205206
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
206-
}
207-
208-
.fork-ribbon a:hover,
209-
.fork-ribbon a:focus {
210-
background: #0b0b0b;
207+
transform-origin: 0 0;
211208
}
212209

213210
/* Hide ribbon on small screens where it can obstruct content */
@@ -217,28 +214,95 @@
217214
</style>
218215

219216
<script>
220-
document.addEventListener('DOMContentLoaded', function () {
221-
// Avoid inserting multiple times
222-
if (document.querySelector('.fork-ribbon')) return;
217+
(function () {
218+
function injectForkRibbon() {
219+
// Avoid inserting multiple times
220+
if (document.querySelector('.fork-ribbon')) return;
223221

224-
// Prefer site.social.github (format: owner/repo), fall back to site.github if present
225-
var repo = "{{ site.social.github | default: site.github | escape }}";
226-
if (!repo) return;
222+
// Prefer site.social.github (format: owner/repo), fall back to site.github if present
223+
var repo = "{{ site.social.github | default: site.github | escape }}";
224+
if (!repo) return;
227225

228-
var url = 'https://github.com/' + repo;
226+
var url = 'https://github.com/' + repo;
229227

230-
var container = document.createElement('div');
231-
container.className = 'fork-ribbon';
228+
var container = document.createElement('div');
229+
container.className = 'fork-ribbon';
232230

233-
var anchor = document.createElement('a');
234-
anchor.href = url;
235-
anchor.target = '_blank';
236-
anchor.rel = 'noopener noreferrer';
237-
anchor.setAttribute('aria-label', 'Fork me on GitHub');
238-
anchor.textContent = 'Fork me on GitHub';
231+
var anchor = document.createElement('a');
232+
anchor.href = url;
233+
anchor.target = '_blank';
234+
anchor.rel = 'noopener noreferrer';
235+
anchor.setAttribute('aria-label', 'Fork me on GitHub');
236+
237+
// Detect floating site menu to avoid collision
238+
var hasSiteMenu = !!document.querySelector('[data-site-menu]');
239+
240+
// Build the inner HTML (SVG icon + text)
241+
var svg = '<svg aria-hidden="true" focusable="false" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" style="vertical-align:middle;fill:currentColor;">\n <path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.539 2.292 6.532 5.47 7.594.4.073.547-.173.547-.385 0-.19-.007-.693-.01-1.36-2.225.483-2.695-1.073-2.695-1.073-.364-.924-.89-1.171-.89-1.171-.727-.497.055-.487.055-.487.803.056 1.226.825 1.226.825.714 1.223 1.872.87 2.329.665.072-.517.28-.87.508-1.07-1.777-.202-3.644-.888-3.644-3.952 0-.873.312-1.587.824-2.148-.083-.203-.357-1.019.078-2.124 0 0 .672-.215 2.2.82.638-.177 1.322-.266 2.003-.269.68.003 1.365.092 2.004.269 1.527-1.035 2.198-.82 2.198-.82.437 1.105.163 1.92.08 2.124.513.561.823 1.275.823 2.148 0 3.073-1.87 3.748-3.65 3.946.287.247.543.733.543 1.479 0 1.068-.01 1.932-.01 2.196 0 .214.145.462.55.384C13.71 14.53 16 11.538 16 8c0-4.42-3.58-8-8-8z"/></svg>';
242+
anchor.innerHTML = svg + '<span class="fork-text">Fork me</span>';
243+
244+
// Add small icon/text styles
245+
anchor.style.display = 'inline-flex';
246+
anchor.style.alignItems = 'center';
247+
anchor.style.justifyContent = 'center';
248+
anchor.style.gap = '8px';
249+
anchor.style.color = '#fff';
250+
anchor.style.textDecoration = 'none';
251+
252+
if (hasSiteMenu) {
253+
// Place on left and rotate -45deg
254+
container.style.left = '-44px';
255+
anchor.style.transform = 'rotate(-45deg)';
256+
anchor.style.transformOrigin = '0 0';
257+
} else {
258+
// Place on right and rotate 45deg
259+
container.style.right = '-44px';
260+
anchor.style.transform = 'rotate(45deg)';
261+
anchor.style.transformOrigin = '100% 0';
262+
}
239263

240-
container.appendChild(anchor);
241-
document.body.appendChild(container);
242-
});
243-
</script>
264+
container.appendChild(anchor);
265+
266+
// If body exists, append normally
267+
if (document.body) {
268+
document.body.appendChild(container);
269+
return;
270+
}
271+
272+
// If document isn't parsed yet, attempt document.write as a fallback so the element ends up in the document
273+
try {
274+
if (typeof document.write === 'function' && document.readyState === 'loading') {
275+
var posAttr = hasSiteMenu ? 'left:-44px' : 'right:-44px';
276+
var rotation = hasSiteMenu ? 'transform:rotate(-45deg);transform-origin:0 0;' : 'transform:rotate(45deg);transform-origin:100% 0;';
277+
var html = '<div class="fork-ribbon" style="top:12px;' + posAttr + '"><a style="display:block;width:160px;' + rotation + '" href="' + url + '" target="_blank" rel="noopener noreferrer">' + svg + '<span style="display:inline-block;margin-left:8px;vertical-align:middle;color:#fff">Fork me</span></a></div>';
278+
document.write(html);
279+
return;
280+
}
281+
} catch (e) {
282+
// ignore and continue to last-resort append below
283+
}
284+
285+
// As a last resort, append to documentElement
286+
(document.documentElement || document).appendChild(container);
287+
}
244288

289+
// Run immediately if DOM is already available, otherwise wait for DOMContentLoaded.
290+
if (document.readyState === 'loading') {
291+
document.addEventListener('DOMContentLoaded', function () {
292+
injectForkRibbon();
293+
});
294+
// Also run on window.load to catch pages that defer document modifications
295+
window.addEventListener('load', function () { injectForkRibbon(); });
296+
// Fallback in case DOMContentLoaded doesn't fire for some reason in certain pages
297+
setTimeout(function () { injectForkRibbon(); }, 3000);
298+
} else {
299+
try {
300+
injectForkRibbon();
301+
} catch (e) {
302+
// If anything goes wrong, try again shortly
303+
setTimeout(injectForkRibbon, 3000);
304+
}
305+
}
306+
})();
307+
</script>
308+
{% endif %}

docs/intellij-idea.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: IntelliJ IDEA Setup
3+
permalink: /docs/intellij-idea/
4+
---
5+
6+
# IntelliJ IDEA Post Install Setup
7+
8+
> You don't need to install JDK on your machine explicitly. If you don't have one, you can download a JDK, such as Java 11, directly inside the **Project Structure** menu by navigating to `Project Settings | Project` and choosing `Download JDK`.
9+
10+
This page contains recommended steps post installation.
11+
12+
## Steps
13+
14+
15+
## Recommended Plugins
16+
17+
- .ignore
18+
- Azure Toolkit for IntelliJ
19+
- Scala
20+
- Markdown
21+
- Database Tools (if you work with databases)
22+
23+
24+
25+

0 commit comments

Comments
 (0)