Skip to content

Commit 6481210

Browse files
committed
Merge branch 'feature/revert-spinner-changes' into develop
* The fix to update MFR spinners to use pulsers was accidentally breaking the OSF's own use of pulsers. The mfr.css file where the spinner code exists is included on the OSF-side of the iframe, not inside where MFR reigns. As a result mfr.css was overriding some OSF-defined styles and causing weird behavior anywhere it was included (currently the file view and wiki pages). Revert the whole shebang, and head back to the drawing board for this ticket.
2 parents 7150e66 + c0776e4 commit 6481210

File tree

4 files changed

+75
-61
lines changed

4 files changed

+75
-61
lines changed

mfr/server/static/css/mfr.css

Lines changed: 62 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,72 @@
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);
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;
99
}
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);
10+
@-moz-keyframes mfr-spin {
11+
from {
12+
-moz-transform: rotate(0deg);
13+
}
14+
to {
15+
-moz-transform: rotate(360deg);
16+
}
1317
}
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);
18+
@-webkit-keyframes mfr-spin {
19+
from {
20+
-webkit-transform: rotate(0deg);
21+
}
22+
to {
23+
-webkit-transform: rotate(360deg);
24+
}
1725
}
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);
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+
}
2135
}
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;
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+
}
3146
}
32-
33-
34-
.ball-dark > div {
35-
background-color: #337AB7;
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+
}
3657
}
37-
38-
.ball-scale {
39-
position: absolute;
40-
display: flex;
41-
justify-content: center;
42-
align-items: center;
43-
width: 100%;
44-
height: 250px;
45-
top: 0;
46-
left: 0;
58+
@keyframes mfr-opacity {
59+
0% {
60+
opacity : 0.1
61+
}
62+
50% {
63+
opacity: 1
64+
}
65+
100% {
66+
opacity: 0.1
67+
}
4768
}
4869

4970
.embed-responsive-pdf {
5071
padding-bottom: 95%;
51-
}
52-
53-
#mfrIframe iframe {
54-
opacity: 0.0;
55-
}
56-
57-
#mfrIframe {
58-
min-height: 250px;
59-
}
72+
}
5.95 KB
Loading

mfr/server/static/js/mfr.child.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717
});
1818
});
19-
}, false);
19+
});
2020

2121
window.addEventListener('resize', function () {
2222
window.pymChild.sendHeight();

mfr/server/static/js/mfr.js

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

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
48+
function _createSpinner(url, imgName) {
49+
var parser = document.createElement('a');
50+
parser.href = url;
51+
5152
var spinner = document.createElement('div');
52-
spinner.setAttribute('class', 'ball-scale ball-dark ball-scale-blue text-center');
53-
spinner.appendChild(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);
5458
return spinner;
5559
}
5660

@@ -64,13 +68,11 @@
6468
* @param {String} imgName The filename of an image in mfr/server/static/images/ to use as a loading spinner
6569
*/
6670
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;
6971
var self = this;
7072
self.id = id;
7173
self.url = url;
7274
self.config = config;
73-
self.spinner = _createSpinner();
75+
self.spinner = _createSpinner(url, imgName);
7476

7577
self.init = function () {
7678
self.pymParent = new pym.Parent(self.id, self.url, self.config);
@@ -80,10 +82,9 @@
8082
self.pymParent.iframe.setAttribute('sandbox', 'allow-scripts allow-popups allow-same-origin');
8183

8284
self.pymParent.el.appendChild(self.spinner);
83-
$(self.pymParent.iframe).on('load', function() {
85+
$(self.pymParent.iframe).on('load', function () {
8486
self.pymParent.el.removeChild(self.spinner);
85-
this.style.opacity = "1.0"
86-
})
87+
});
8788

8889
self.pymParent.onMessage('embed', function(message) {
8990
_addClass(self.pymParent.el, 'embed-responsive');

0 commit comments

Comments
 (0)