Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EBI-Framework
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ebiwd
EBI-Framework
Commits
5488cf12
Commit
5488cf12
authored
7 years ago
by
khawkins98
Browse files
Options
Downloads
Patches
Plain Diff
Compiled JS
parent
c3263f63
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
js/script.js
+21
-11
21 additions, 11 deletions
js/script.js
js/script.min.js
+1
-1
1 addition, 1 deletion
js/script.min.js
with
22 additions
and
12 deletions
js/script.js
+
21
−
11
View file @
5488cf12
...
...
@@ -474,10 +474,6 @@ function ebiFrameworkIncludeAnnouncements() {
// don't treat wwwdev as distinct from www
currentHost
=
currentHost
.
replace
(
/wwwdev/g
,
"
www
"
);
// for (var i = 0; i < Object.keys(messages).length; i++) {
// var currentKey = Object.keys(messages)[i]; // www.ebi.ac.uk/*, etc.
// }
// try to show any possible variations of the url
// Note: this is pretty simple stupid, but maybe it's more effective than a sophisticated solution?
injectAnnouncements
(
messages
[
currentHost
]);
...
...
@@ -485,15 +481,30 @@ function ebiFrameworkIncludeAnnouncements() {
injectAnnouncements
(
messages
[
currentHost
+
'
/*
'
]);
if
(
currentPath
.
length
>
1
)
{
// don't try to much no path or '/'
injectAnnouncements
(
messages
[
currentHost
+
currentPath
]);
injectAnnouncements
(
messages
[
currentHost
+
currentPath
+
'
*
'
]);
injectAnnouncements
(
messages
[
currentHost
+
currentPath
+
'
/*
'
]);
var
currentPathArray
=
currentPath
.
split
(
'
/
'
);
// construct a list of possible paths to match
// /style-lab/frag1/frag2 =
// - /style-lab/frag1/frag2
// - /style-lab/frag1
// - /style-lab
var
pathsToMatch
=
[
currentHost
+
'
/
'
+
currentPathArray
[
0
]];
for
(
var
i
=
1
;
i
<
currentPathArray
.
length
;
i
++
)
{
var
tempPath
=
pathsToMatch
[
i
-
1
];
pathsToMatch
.
push
(
tempPath
+
'
/
'
+
currentPathArray
[
i
])
}
for
(
var
i
=
0
;
i
<
pathsToMatch
.
length
;
i
++
)
{
// console.log('matching:',pathsToMatch[i]);
injectAnnouncements
(
messages
[
pathsToMatch
[
i
]]);
injectAnnouncements
(
messages
[
pathsToMatch
[
i
]
+
'
*
'
]);
injectAnnouncements
(
messages
[
pathsToMatch
[
i
]
+
'
/*
'
]);
}
}
}
// once an annocuncement has been matched to the current page, show it (if there is one)
function
injectAnnouncements
(
message
)
{
console
.
log
(
message
);
if
(
typeof
(
message
)
==
'
undefined
'
)
{
return
false
;
};
...
...
@@ -508,8 +519,8 @@ function ebiFrameworkIncludeAnnouncements() {
var
wrapper
=
document
.
createElement
(
'
div
'
);
// var inner = document.createElement('div');
// banner.id = "
cookie-banner
";
banner
.
className
=
"
row
"
;
// banner.id = "";
banner
.
className
=
"
notifications-js row margin-top-medium
"
;
wrapper
.
className
=
"
row callout
"
+
(
message
.
priority
||
""
);
wrapper
.
innerHTML
=
"
<h3>
"
+
message
.
headline
+
"
</h3>
"
+
message
.
message
+
...
...
@@ -536,7 +547,6 @@ function ebiFrameworkIncludeAnnouncements() {
}
loadRemote
(
'
https://dev.ebi.emblstatic.net/announcements.js
'
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
js/script.min.js
+
1
−
1
View file @
5488cf12
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment