Skip to content

Commit 7ce466b

Browse files
AddisonSchillercslzchen
authored andcommitted
Update default MFR loading spinner to follow OSF style
Users prefer the pulsing ball to the COS-logo spinner. Please see https://centerforopenscience.github.io/osf-style/style.html#loader This doesn't really affect the iframe content served by MFR. Instead, this changes happens in the mfr.js and mfr.css files loaded from MFR by the site hosting the iframe. The fact that mfr.js is included in most iframe content templates is a development artifact and will be eventually removed.
1 parent ead3389 commit 7ce466b

File tree

3 files changed

+39
-73
lines changed

3 files changed

+39
-73
lines changed

mfr/server/static/css/mfr.css

Lines changed: 31 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,40 @@
1-
.mfr-logo-spin {
2-
-webkit-animation: mfr-spin 3s infinite linear, mfr-opacity 3s infinite linear;
3-
-moz-animation: mfr-spin 3s infinite linear mfr-opacity 3s infinite linear;
4-
animation: mfr-spin 3s infinite linear, mfr-opacity 3s infinite linear;
5-
position: absolute;
6-
top: 0;
7-
left: 50%;
8-
z-index: -1;
9-
}
10-
@-moz-keyframes mfr-spin {
11-
from {
12-
-moz-transform: rotate(0deg);
13-
}
14-
to {
15-
-moz-transform: rotate(360deg);
16-
}
1+
2+
/*The osf will ask for this file. It is never actually linked to anything specific in MFR.
3+
This CSS was stripped out of base.css from the osf-style repo.
4+
*/
5+
6+
.ball-pulse > div:nth-child(0) {
7+
-webkit-animation: scale 0.75s -0.36s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);
8+
animation: scale 0.75s -0.36s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);
179
}
18-
@-webkit-keyframes mfr-spin {
19-
from {
20-
-webkit-transform: rotate(0deg);
21-
}
22-
to {
23-
-webkit-transform: rotate(360deg);
24-
}
10+
.ball-pulse > div:nth-child(1) {
11+
-webkit-animation: scale 0.75s -0.24s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);
12+
animation: scale 0.75s -0.24s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);
2513
}
26-
@keyframes mfr-spin {
27-
from {
28-
-webkit-transform: rotate(0deg);
29-
transform:rotate(0deg);
30-
}
31-
to {
32-
-webkit-transform: rotate(360deg);
33-
transform:rotate(360deg);
34-
}
14+
.ball-pulse > div:nth-child(2) {
15+
-webkit-animation: scale 0.75s -0.12s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);
16+
animation: scale 0.75s -0.12s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);
3517
}
36-
@-moz-keyframes mfr-opacity {
37-
0% {
38-
opacity : 0.1
39-
}
40-
50% {
41-
opacity: 1
42-
}
43-
100% {
44-
opacity: 0.1
45-
}
18+
.ball-pulse > div:nth-child(3) {
19+
-webkit-animation: scale 0.75s 0s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);
20+
animation: scale 0.75s 0s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);
4621
}
47-
@-webkit-keyframes mfr-opacity {
48-
0% {
49-
opacity : 0.1
50-
}
51-
50% {
52-
opacity: 1
53-
}
54-
100% {
55-
opacity: 0.1
56-
}
22+
.ball-pulse > div {
23+
background-color: #fff;
24+
width: 15px;
25+
height: 15px;
26+
border-radius: 100%;
27+
margin: 2px;
28+
-webkit-animation-fill-mode: both;
29+
animation-fill-mode: both;
30+
display: inline-block;
5731
}
58-
@keyframes mfr-opacity {
59-
0% {
60-
opacity : 0.1
61-
}
62-
50% {
63-
opacity: 1
64-
}
65-
100% {
66-
opacity: 0.1
67-
}
32+
33+
34+
.ball-dark > div {
35+
background-color: #337AB7;
6836
}
6937

7038
.embed-responsive-pdf {
7139
padding-bottom: 95%;
72-
}
40+
}
-5.95 KB
Binary file not shown.

mfr/server/static/js/mfr.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,12 @@
4545
return el;
4646
}
4747

48-
function _createSpinner(url, imgName) {
49-
var parser = document.createElement('a');
50-
parser.href = url;
51-
48+
function _createSpinner() {
49+
// The the OSF asks for the CSS for this spinner (/static/css/mfr)
50+
// MFR itself does not use it anywhere
5251
var spinner = document.createElement('div');
53-
var img = document.createElement('img');
54-
spinner.setAttribute('class', 'mfr-logo-spin text-center');
55-
imgName = imgName || 'loading.png';
56-
img.setAttribute('src', parser.protocol + '//' + parser.host + '/static/images/' + imgName);
57-
spinner.appendChild(img);
52+
spinner.setAttribute('class', 'ball-scale ball-dark ball-scale-blue text-center');
53+
spinner.appendChild(document.createElement('div'));
5854
return spinner;
5955
}
6056

@@ -68,11 +64,13 @@
6864
* @param {String} imgName The filename of an image in mfr/server/static/images/ to use as a loading spinner
6965
*/
7066
lib.Render = function (id, url, config, imgName) {
67+
// we no longer use this, but need to support it as an arg till the OSF side is fixed
68+
imgName = undefined;
7169
var self = this;
7270
self.id = id;
7371
self.url = url;
7472
self.config = config;
75-
self.spinner = _createSpinner(url, imgName);
73+
self.spinner = _createSpinner();
7674

7775
self.init = function () {
7876
self.pymParent = new pym.Parent(self.id, self.url, self.config);

0 commit comments

Comments
 (0)