Skip to content

Commit 72c01f7

Browse files
committed
Merge branch 'user_guide_updates' into user_guide_updates_bbgui_analysis_panel
2 parents 650e82d + 2cbef9f commit 72c01f7

File tree

18 files changed

+338
-450
lines changed

18 files changed

+338
-450
lines changed

docs/javascripts/config.js

Lines changed: 22 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ window.MathJax = {
1111
}
1212
};
1313

14-
/* Make all "clickImg" images a hyperref to themselves.
14+
/* Make all "clickImg" images a hyperref to themselves.
1515
Do not use too many (i.e. hundreds) of them, as each of them get's a listener, which might slow down the page. */
1616
document$.subscribe(function () {
1717
var elements = document.getElementsByClassName("clickImg");
@@ -36,69 +36,25 @@ document$.subscribe(function () {
3636
};
3737
})
3838

39-
// /* Create logbook links from logbook, date and id as . */
40-
// document$.subscribe(function createLogbookLinks() {
41-
// var elements = document.getElementsByClassName('logbook-link');
42-
// for (var i = 0; i < elements.length; i++) {
43-
// var element = elements[i];
44-
// // alternative method: key value pairs directly in attributes: [Link](#){logbook='xxx' date='yyy' event_id='zzz' .logbook-link}
45-
// // var logbook = element.getAttribute('logbook');
46-
// // var date = element.getAttribute('date');
47-
// // var event_id = element.getAttribute('event_id');
48-
// // element.href = 'https://be-op-logbook.web.cern.ch/elogbook-server/#/logbook?logbookId=' + logbook + '&dateFrom=' + date + 'T00%3A00%3A00&dateTo=' + date + 'T23%3A59%3A59&eventToHighlight=' + event_id;
49-
//
50-
// // key value pairs as single string: [Link](logbook=xxx,date=yyy,event_id=zzz) (works also with [LINK][linkname]{.logbook-link} -> [linkname]: logbook=xxx,date=yyy,event_id=zzz)
51-
// var keyValuePairs = element.href.split(",");
52-
// var result = {};
53-
// for (var i = 0; i < keyValuePairs.length; i++) {
54-
// var pair = keyValuePairs[i].split('=');
55-
// var aux_key = pair[0].split('/');
56-
// var key = aux_key[aux_key.length - 1].trim();
57-
// var value = pair[1].trim();
58-
// result[key] = value;
59-
// };
60-
// // console.log(result)
61-
// element.href = 'https://be-op-logbook.web.cern.ch/elogbook-server/#/logbook?logbookId=' + result["logbook"] + '&dateFrom=' + result["date"] + 'T00%3A00%3A00&dateTo=' + result["date"] + 'T23%3A59%3A59&eventToHighlight=' + result["event_id"];
62-
63-
// element.target = "_blank";
64-
// element.classList.add('cern_login');
65-
// };
66-
// })
67-
68-
69-
/* Create logbook links from date, logbook and event_id as list: [Link](date,logbook,event_id){.logbook-link}. */
70-
document$.subscribe(function createLogbookLinks() {
71-
var elements = document.getElementsByClassName('logbook-link');
72-
for (var i = 0; i < elements.length; i++) {
73-
var element = elements[i];
74-
75-
var parts = element.href.split(",");
76-
var trimmed = parts.map(function(part) {
77-
// console.log(part);
78-
var aux = part.split('/');
79-
return aux[aux.length - 1].trim().replace('%20', '');
80-
})
81-
82-
var date = trimmed[0];
83-
var logbook = trimmed[1];
84-
var event_id = trimmed[2];
85-
element.href = 'https://be-op-logbook.web.cern.ch/elogbook-server/#/logbook?logbookId=' + logbook + '&dateFrom=' + date + 'T00%3A00%3A00&dateTo=' + date + 'T23%3A59%3A59&eventToHighlight=' + event_id;
86-
element.setAttribute("alt_href", 'https://logbook.cern.ch/elogbook-server/#/logbook?logbookId=' + logbook + '&dateFrom=' + date + 'T00%3A00%3A00&dateTo=' + date + 'T23%3A59%3A59&eventToHighlight=' + event_id);
87-
88-
element.target = "_blank";
89-
element.classList.add('cern_login');
90-
element.addEventListener("click", function(event) {
91-
// Check if the alt key is pressed
92-
if (event.altKey) {
93-
event.preventDefault(); // Prevent default link behavior
94-
var altDestination = this.getAttribute("alt_href");
95-
if (altDestination) {
96-
window.open(altDestination, '_blank'); // Open link in a new tab
97-
}
39+
/* Create logbook links from date, logbook and event_id as list: [Link](logbook://date,logbook,event_id). */
40+
document$.subscribe(function () {
41+
document.querySelectorAll('a[href^="logbook://"]').forEach(function (a) {
42+
const [date, logbook, event_id] = a.getAttribute("href").slice("logbook://".length).split(",").map(s => s.trim());
43+
const main = `https://be-op-logbook.web.cern.ch/elogbook-server/#/logbook?logbookId=${logbook}&dateFrom=${date}T00%3A00%3A00&dateTo=${date}T23%3A59%3A59&eventToHighlight=${event_id}`;
44+
const alt = `https://logbook.cern.ch/elogbook-server/#/logbook?logbookId=${logbook}&dateFrom=${date}T00%3A00%3A00&dateTo=${date}T23%3A59%3A59&eventToHighlight=${event_id}`;
45+
a.href = main;
46+
a.target = "_blank";
47+
a.classList.add("cern_login");
48+
a.setAttribute("alt_href", alt);
49+
a.addEventListener("click", function(e) {
50+
// Check if the alt key is pressed
51+
if (e.altKey){
52+
e.preventDefault(); // Prevent default link behavior
53+
var altDestination = this.getAttribute("alt_href");
54+
if (altDestination) {
55+
window.open(altDestination, '_blank'); // Open link in a new tab
9856
}
99-
});
100-
};
101-
})
102-
103-
104-
57+
}
58+
});
59+
});
60+
});

docs/logbook/AD/2023_ad.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
| Start Date | End Date | Shifts | Type | Contact | Shift Purpose | Logbook Link |
44
|:----------------:|:--------:|:------:|:----:|:--------:|:---------------------------------:|:-------------------------------------------------:|
5-
<!-- Logbook Links: [LINK_NAME](date, logbook_id, event_id){.logbook-link} -->
5+
<!-- Logbook Links: [LINK_NAME](logbook://date, logbook_id, event_id) -->
66

77
--8<-- "docs/logbook/footer_shifts"

docs/logbook/AD/2024_ad.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Timeline of AD optics measurements in 2024
22

33
<!--
4-
Logbook Links: [LINK_NAME](date, logbook_id, event_id){.logbook-link}
4+
Logbook Links: [LINK_NAME](logbook://date, logbook_id, event_id)
55
Shifts: W - Weekdays (Day) WN - Weekdays (Night) H - Holidays or weekend (Day) HN - Holidays or weekend (Night)
66
Tooltips: *[SHIFT PURPOSE TEXT]: Text inside the tooltip
77
-->

docs/logbook/LEIR/2023_leir.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
| Start Date | End Date | Shifts | Type | Contact | Shift Purpose | Logbook Link |
55
|:----------------:|:--------:|:------:|:----:|:--------:|:---------------------------------:|:-------------------------------------------------:|
6-
<!-- Logbook Links: [LINK_NAME](date, logbook_id, event_id){.logbook-link} -->
6+
<!-- Logbook Links: [LINK_NAME](logbook://date, logbook_id, event_id) -->
77

88
--8<-- "docs/logbook/footer_shifts"

docs/logbook/LEIR/2024_leir.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Timeline of LEIR optics measurements in 2024
33

44
<!--
5-
Logbook Links: [LINK_NAME](date, logbook_id, event_id){.logbook-link}
5+
Logbook Links: [LINK_NAME](logbook://date, logbook_id, event_id)
66
Shifts: W - Weekdays (Day) WN - Weekdays (Night) H - Holidays or weekend (Day) HN - Holidays or weekend (Night)
77
Tooltips: *[SHIFT PURPOSE TEXT]: Text inside the tooltip
88
-->

0 commit comments

Comments
 (0)