Skip to content

Commit

Permalink
fixing #5
Browse files Browse the repository at this point in the history
  • Loading branch information
ebekker committed Nov 16, 2018
1 parent 44bd223 commit ac7442a
Show file tree
Hide file tree
Showing 6 changed files with 203 additions and 1 deletion.
2 changes: 2 additions & 0 deletions FMRL/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using FMRL.Services.Impl;
using Microsoft.AspNetCore.Blazor.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.JSInterop;
using Sotsera.Blazor.Toaster.Core.Models;

namespace FMRL
Expand Down Expand Up @@ -32,6 +33,7 @@ public void ConfigureServices(IServiceCollection services)
public void Configure(IBlazorApplicationBuilder app)
{
app.AddComponent<App>("app");
((IJSInProcessRuntime)JSRuntime.Current).Invoke<bool>("_blazorXstartup.dnSetReady");
}
}
}
89 changes: 89 additions & 0 deletions FMRL/wwwroot/css/blazorx-startup-icon.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* From the Cube Grid from SpinKit by Tobias Ahlin:
* https://github.com/tobiasahlin/SpinKit/blob/master/examples/9-cube-grid.html
*/

.sk-cube-grid {
display: block;
width: 40px;
height: 40px;
margin: 100px auto;
}

.sk-cube-grid .sk-cube {
width: 33.33%;
height: 33.33%;
background-color: #333;
float: left;
-webkit-animation: sk-cubeGridScaleDelay 2.0s infinite ease-in-out;
animation: sk-cubeGridScaleDelay 2.0s infinite ease-in-out;
}

.sk-cube-grid .sk-cube1 {
-webkit-animation-delay: 0.2s;
animation-delay: 0.2s;
}

.sk-cube-grid .sk-cube2 {
-webkit-animation-delay: 0.3s;
animation-delay: 0.3s;
}

.sk-cube-grid .sk-cube3 {
-webkit-animation-delay: 0.4s;
animation-delay: 0.4s;
}

.sk-cube-grid .sk-cube4 {
-webkit-animation-delay: 0.1s;
animation-delay: 0.1s;
}

.sk-cube-grid .sk-cube5 {
-webkit-animation-delay: 0.2s;
animation-delay: 0.2s;
}

.sk-cube-grid .sk-cube6 {
-webkit-animation-delay: 0.3s;
animation-delay: 0.3s;
}

.sk-cube-grid .sk-cube7 {
-webkit-animation-delay: 0s;
animation-delay: 0s;
}

.sk-cube-grid .sk-cube8 {
-webkit-animation-delay: 0.1s;
animation-delay: 0.1s;
}

.sk-cube-grid .sk-cube9 {
-webkit-animation-delay: 0.2s;
animation-delay: 0.2s;
}

@-webkit-keyframes sk-cubeGridScaleDelay {
0%, 70%, 100% {
-webkit-transform: scale3D(1, 1, 1);
transform: scale3D(1, 1, 1);
}

35% {
-webkit-transform: scale3D(0, 0, 1);
transform: scale3D(0, 0, 1);
}
}

@keyframes sk-cubeGridScaleDelay {
0%, 70%, 100% {
-webkit-transform: scale3D(1, 1, 1);
transform: scale3D(1, 1, 1);
}

35% {
-webkit-transform: scale3D(0, 0, 1);
transform: scale3D(0, 0, 1);
}
}
28 changes: 28 additions & 0 deletions FMRL/wwwroot/css/blazorx-startup-word.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* From Effect13 from Moving Letters by Tobias Ahlin:
* http://tobiasahlin.com/moving-letters/#13
*/

.spinnerdiv {
width: 450px;
margin: 100px auto;
}

.ml13div {
width: 450px;
height: 40px;
margin: 100px auto;
text-align: center;
}

.ml13 {
font-size: 3em;
text-transform: uppercase;
letter-spacing: 0.5em;
font-weight: 900;
}

.ml13 .letter {
display: inline-block;
line-height: 1em;
}
26 changes: 25 additions & 1 deletion FMRL/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,38 @@
<base href="/" />
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="css/site.css" rel="stylesheet" />

<link href="css/blazorx-startup-icon.css" rel="stylesheet" />
<link href="css/blazorx-startup-word.css" rel="stylesheet" />
<script src="js/blazorx-startup-head.js"></script>
</head>
<body>
<app>Loading...</app>
<div id="blazorXstartupSpinner" class="spinnerdiv">
<div class="ml13div">
<h1 class="ml13">F M R L</h1>
</div>
<div class="sk-cube-grid">
<div class="sk-cube sk-cube1"></div>
<div class="sk-cube sk-cube2"></div>
<div class="sk-cube sk-cube3"></div>
<div class="sk-cube sk-cube4"></div>
<div class="sk-cube sk-cube5"></div>
<div class="sk-cube sk-cube6"></div>
<div class="sk-cube sk-cube7"></div>
<div class="sk-cube sk-cube8"></div>
<div class="sk-cube sk-cube9"></div>
</div>
</div>

<app id="blazorXstartupApp" style="display:none"></app>
<script src="_framework/blazor.webassembly.js"></script>

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/2.0.2/anime.min.js"></script>

<script src="js/blazorx-startup-body.js"></script>

</body>
</html>
35 changes: 35 additions & 0 deletions FMRL/wwwroot/js/blazorx-startup-body.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* From Effect13 from Moving Letters by Tobias Ahlin:
* http://tobiasahlin.com/moving-letters/#13
*/

// Wrap every letter in a span
$('.ml13').each(function () {
$(this).html($(this).text().replace(/([^\x00-\x80]|\w)/g, "<span class='letter'>$&</span>"));
});

anime.timeline({ loop: false })
.add({
targets: '.ml13 .letter',
translateY: [100, 0],
translateZ: 0,
opacity: [0, 1],
easing: "easeOutExpo",
duration: 500,
delay: function (el, i) {
return 300 + 30 * i * 3;
}
}).add({
targets: '.ml13 .letter',
translateY: [0, -100],
opacity: [1, 0],
easing: "easeInExpo",
duration: 500,
delay: function (el, i) {
return 100 + 30 * i * 2;
},
complete: function (anim) {
window._blazorXstartup.jsReady = true;
console.log("ready2run is go");
}
});
24 changes: 24 additions & 0 deletions FMRL/wwwroot/js/blazorx-startup-head.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Setup some state to coordinate the ready
// status of the JS spinner and the.NET runtime
window._blazorXstartup = {
jsReady: false,
dnReady: false,
dnSetReady: function () {
window._blazorXstartup.dnReady = true;
return false;
},
pollForReady: function () {
console.log("Checking for ready!");
if (window._blazorXstartup.jsReady && window._blazorXstartup.dnReady) {
console.log("Both are ready!");
document.getElementById("blazorXstartupSpinner").remove();
document.getElementById("blazorXstartupApp").style.display = "";
return;
}

// Keep running it till we're done
window.setTimeout(window._blazorXstartup.pollForReady, 500);
}
};
// Install a polling function to check the coordinated status
window.setTimeout(window._blazorXstartup.pollForReady, 500);

0 comments on commit ac7442a

Please sign in to comment.