Removed init and loading-error css and logic

Because all pages are complete pages that can be viewed with or without
javascript, the 'init' and 'loading-error' classes should not be set on
the '#page-content' div. Similarly the 'loading' class should not be set
on '#nav'. All associated logic and css for the 'init' and 'loading'
classes is also unused. This commit removes the aforementioned.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
This commit is contained in:
Collin J. Doering 2015-08-12 22:12:49 -04:00
parent a21fe60c9e
commit bc1cfaabeb
5 changed files with 7 additions and 50 deletions

View File

@ -155,22 +155,6 @@ pageContent = do
transition "opacity" (sec 1) easeIn (sec 0.5)
opacity 1
"#page-content" # ".loading-error" ** p ? do
backgroundColor "#fd6f6f"
backgroundImage $ url "/images/error-loading.png"
backgroundRepeat noRepeat
backgroundPosition $ positioned (pct 50) (pct 50)
height (px 200)
fontWeight bold
lineHeight (px 200)
textAlign $ alignSide sideCenter
"#page-content" # ".init" # ".loading" ? do
backgroundImage $ url "/images/init-loading.gif"
backgroundRepeat noRepeat
backgroundPosition $ positioned (pct 50) (pct 50)
height (px 125)
"#page-content" ** ul |> (li # ":before") ? do
content $ stringContent "\\2192"
paddingRight (em 0.5)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

View File

@ -189,9 +189,6 @@ _paq.push(['enableLinkTracking']);
type: 'GET',
dataType: 'html',
beforeSend: function (xhr, settings) {
// Remove loading error from page-content
$('#page-content').removeClass('loading-error');
// Add .loading to #page-content and #nav to facilitate a loading animation
$('#page-content, #nav').removeClass('loading-done').addClass('loading');
@ -203,9 +200,6 @@ _paq.push(['enableLinkTracking']);
console.log('beforeSend a.menuitem');
},
success: function (dta) {
// Remove the initial loading gif (if its there)
$('#page-content').removeClass('init');
// Remove any status message errors or successes
$('#status').slideUp('normal', function () {
$('#status').removeClass('error').removeClass('success').children('p.message').remove();
@ -261,20 +255,13 @@ _paq.push(['enableLinkTracking']);
},
error: function (xhr, status) {
/* Remove .loading from #page-content and #nav to stop the loading
* animation. Then add .loading-error to #page-content if its the sites
* first load (#page-content has class .init). Finally, display an error
* message in #status.
* animation. Finally, display an error message in #status.
*/
$('#page-content, #nav').removeClass('loading');
if ($('#page-content.init')[0]) {
// TODO: instead of immediately displaying error, check if the content is stored in local storage
$('#page-content').addClass('loading-error').html('<p class="container border-box">Error initially loading blog.rekahsoft.ca. Check the url! Given "' + page_href + '"</p>');
} else if ($('#status.error')[0]) {
$('#status').prepend('<p class="message">Error retrieving page ' + page_href + '</p>');
} else {
$('#status').prepend('<p class="message">Error retrieving page ' + page_href + '</p>');
$('#status').addClass('error').slideDown();
}
// TODO: instead of immediately displaying error, check if the content is stored in local storage
$('#status').prepend('<p class="message">Error retrieving page ' + page_href + '</p>');
$('#status').addClass('error').slideDown();
// Run current handles onError callback (if it exists)
if (handlerCallback.hasOwnProperty('onError') && typeof handlerCallback.onError === 'function') {

View File

@ -21,20 +21,6 @@
<!-- Favicons -->
<link href="/images/favicon.ico" rel="shortcut icon">
<noscript>
<style>
#page-content.init.loading {
opacity: 1;
height: 100%;
background-position: -100px -100px
}
#nav.loading {
animation-play-state: paused;
}
</style>
</noscript>
</head>
<body>
@ -49,7 +35,7 @@
<a class="close-button">Close</a>
</div>
<div class="init loading" id="page-content">
<div id="page-content">
<noscript>
<div class="container" id="noscript-alert">
<h1>This site requires javascript!</h1>

View File

@ -1,4 +1,4 @@
<div class="loading" id="nav">
<div id="nav">
<ul class="container" id="nav-menu">
$for(pagesFirst)$
<li>