loading.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. // dark #326599
  2. // light #4591c4
  3. define([], function () {
  4. var loadingStyle = (function(){/*
  5. #cp-loading {
  6. transition: opacity 0.75s, visibility 0s 0.75s;
  7. visibility: visible;
  8. position: fixed;
  9. z-index: 10000000;
  10. top: 0px;
  11. bottom: 0px;
  12. left: 0px;
  13. right: 0px;
  14. background: linear-gradient(to right, #326599 0%, #326599 50%, #4591c4 50%, #4591c4 100%);
  15. color: #fafafa;
  16. font-size: 1.5em;
  17. opacity: 1;
  18. display: flex;
  19. flex-flow: column;
  20. justify-content: center;
  21. align-items: center;
  22. }
  23. #cp-loading.cp-loading-hidden {
  24. opacity: 0;
  25. visibility: hidden;
  26. }
  27. #cp-loading .cp-loading-logo {
  28. height: 300px;
  29. width: 300px;
  30. margin-top: 50px;
  31. flex: 0 1 auto;
  32. min-height: 0;
  33. text-align: center;
  34. }
  35. #cp-loading .cp-loading-logo img {
  36. max-width: 100%;
  37. max-height: 100%;
  38. }
  39. #cp-loading .cp-loading-container {
  40. width: 700px;
  41. max-width: 90vw;
  42. height: 500px;
  43. max-height: calc(100vh - 20px);
  44. margin: 50px;
  45. flex-shrink: 0;
  46. display: flex;
  47. flex-flow: column;
  48. justify-content: space-around;
  49. align-items: center;
  50. }
  51. @media screen and (max-height: 800px) {
  52. #cp-loading .cp-loading-container {
  53. height: auto;
  54. }
  55. }
  56. @media screen and (max-width: 600px) {
  57. #cp-loading .cp-loading-container {
  58. height: auto;
  59. }
  60. }
  61. #cp-loading .cp-loading-cryptofist {
  62. margin-left: auto;
  63. margin-right: auto;
  64. //height: 300px;
  65. max-width: 90vw;
  66. max-height: 300px;
  67. width: auto;
  68. height: auto;
  69. margin-bottom: 2em;
  70. }
  71. @media screen and (max-height: 500px) {
  72. #cp-loading .cp-loading-logo {
  73. display: none;
  74. }
  75. }
  76. #cp-loading-message {
  77. background: #FFF;
  78. padding: 20px;
  79. width: 100%;
  80. color: #000;
  81. text-align: center;
  82. display: none;
  83. }
  84. #cp-loading-password-prompt {
  85. font-size: 18px;
  86. }
  87. #cp-loading-password-prompt .cp-password-error {
  88. color: white;
  89. background: #9e0000;
  90. padding: 5px;
  91. margin-bottom: 15px;
  92. }
  93. #cp-loading-password-prompt .cp-password-info {
  94. text-align: left;
  95. margin-bottom: 15px;
  96. }
  97. #cp-loading-password-prompt .cp-password-form {
  98. display: flex;
  99. justify-content: space-around;
  100. flex-wrap: wrap;
  101. }
  102. #cp-loading-password-prompt .cp-password-form button,
  103. #cp-loading-password-prompt .cp-password-form .cp-password-input {
  104. background-color: #4591c4;
  105. color: white;
  106. border: 1px solid #4591c4;
  107. }
  108. #cp-loading-password-prompt .cp-password-form .cp-password-container {
  109. flex-shrink: 1;
  110. min-width: 0;
  111. }
  112. #cp-loading-password-prompt .cp-password-form input {
  113. flex: 1;
  114. padding: 0 5px;
  115. min-width: 0;
  116. text-overflow: ellipsis;
  117. }
  118. #cp-loading-password-prompt .cp-password-form button:hover {
  119. background-color: #326599;
  120. }
  121. #cp-loading .cp-loading-spinner-container {
  122. position: relative;
  123. height: 100px;
  124. }
  125. #cp-loading .cp-loading-spinner-container > div {
  126. height: 100px;
  127. }
  128. #cp-loading-tip {
  129. position: fixed;
  130. z-index: 10000000;
  131. top: 80%;
  132. left: 0;
  133. right: 0;
  134. text-align: center;
  135. transition: opacity 750ms;
  136. transition-delay: 3000ms;
  137. }
  138. @media screen and (max-height: 600px) {
  139. #cp-loading-tip {
  140. display: none;
  141. }
  142. }
  143. #cp-loading-tip span {
  144. background: #222;
  145. color: #fafafa;
  146. text-align: center;
  147. font-size: 1.5em;
  148. opacity: 0.7;
  149. font-family: 'Open Sans', 'Helvetica Neue', sans-serif;
  150. padding: 15px;
  151. max-width: 60%;
  152. display: inline-block;
  153. }
  154. .cp-loading-progress {
  155. width: 100%;
  156. margin: 20px;
  157. }
  158. .cp-loading-progress p {
  159. margin: 5px;
  160. overflow: hidden;
  161. white-space: nowrap;
  162. text-overflow: ellipsis;
  163. }
  164. .cp-loading-progress-bar {
  165. height: 24px;
  166. background: white;
  167. }
  168. .cp-loading-progress-bar-value {
  169. height: 100%;
  170. background: #5cb85c;
  171. }
  172. */}).toString().slice(14, -3);
  173. var urlArgs = window.location.href.replace(/^.*\?([^\?]*)$/, function (all, x) { return x; });
  174. var elem = document.createElement('div');
  175. elem.setAttribute('id', 'cp-loading');
  176. elem.innerHTML = [
  177. '<style>',
  178. loadingStyle,
  179. '</style>',
  180. '<div class="cp-loading-logo">',
  181. '<img class="cp-loading-cryptofist" src="/customize/loading-logo.png?' + urlArgs + '">',
  182. '</div>',
  183. '<div class="cp-loading-container">',
  184. '<div class="cp-loading-spinner-container">',
  185. '<span class="fa fa-spinner fa-pulse fa-4x fa-fw"></span>',
  186. '</div>',
  187. '<p id="cp-loading-message"></p>',
  188. '</div>'
  189. ].join('');
  190. return function () {
  191. var intr;
  192. var append = function () {
  193. if (!document.body) { return; }
  194. clearInterval(intr);
  195. document.body.appendChild(elem);
  196. };
  197. intr = setInterval(append, 100);
  198. append();
  199. };
  200. });