-
Notifications
You must be signed in to change notification settings - Fork 0
/
8988.html
88 lines (80 loc) · 3.4 KB
/
8988.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<!DOCTYPE html>
<html>
<head>
<title>Looker Studio Report Navigation</title>
<style>
/* Set the background color to #232323 */
body {
background-color: #232323;
}
/* Dropdown styling */
#pageSelector {
font-family: 'Roboto', sans-serif; /* Set font to Roboto */
font-size: 18px; /* Set font size */
font-weight: bold; /* Make the font bold */
color: #ffffff; /* Set the text color to white */
background-color: #232323; /* Set the dropdown background color */
border: 2px solid #ffffff; /* Add 2px white outline */
border-radius: 5px; /* Add border radius for rounded corners */
outline: none; /* Remove the default outline */
padding: 8px; /* Add some padding inside the dropdown */
width: 100%; /* Ensure the dropdown takes full width of its container */
}
/* Remove any default shadow or outline on focus or hover */
#pageSelector:focus,
#pageSelector:hover {
border: 2px solid #ffffff; /* Keep the 2px white border on hover and focus */
outline: none; /* No outline on focus */
box-shadow: none; /* Remove any shadow */
}
</style>
<script>
// Define the report pages and their corresponding URLs
const reportPages = {
"Oversikt": "https://lookerstudio.google.com/u/0/reporting/e3748d2c-f523-479e-b374-c5b5e7c52a2e/page/sPKDD",
"Tabell": "https://lookerstudio.google.com/u/0/reporting/e3748d2c-f523-479e-b374-c5b5e7c52a2e/page/p_52ztn77p2c",
"Tidslinje": "https://lookerstudio.google.com/u/0/reporting/e3748d2c-f523-479e-b374-c5b5e7c52a2e/page/p_dwfwna8p2c",
"Filter": "https://lookerstudio.google.com/u/0/reporting/e3748d2c-f523-479e-b374-c5b5e7c52a2e/page/p_gav8g5st3c"
};
// Function to handle page navigation when a selection is made
function navigateToPage() {
const selectedPage = document.getElementById("pageSelector").value;
const pageUrl = reportPages[selectedPage];
console.log("Selected Page:", selectedPage);
console.log("Page URL:", pageUrl);
// If the URL is valid, navigate to the selected page in the parent window (full report)
if (pageUrl) {
console.log("Navigating to:", pageUrl);
window.top.location.href = pageUrl;
} else {
console.log("No matching URL found for the selected page.");
}
}
// Function to detect and set the current page in the dropdown
function setCurrentPage() {
const currentUrl = window.top.location.href; // Use top-level window URL for comparison
console.log("Current URL:", currentUrl);
// Loop through the reportPages to find the matching URL
for (const [pageName, pageUrl] of Object.entries(reportPages)) {
if (currentUrl.includes(pageUrl)) {
document.getElementById("pageSelector").value = pageName; // Set dropdown to the current page
console.log("Current page set to:", pageName);
break;
}
}
}
// Call the setCurrentPage function when the page loads
window.onload = setCurrentPage;
</script>
</head>
<body>
<!-- Dropdown for selecting a report page -->
<select id="pageSelector" onchange="navigateToPage()">
<option value="" disabled>Select a page</option>
<option value="Oversikt">Oversikt</option>
<option value="Tabell">Tabell</option>
<option value="Tidslinje">Tidslinje</option>
<option value="Filter">Filter</option>
</select>
</body>
</html>