CodePen

HTML

            
              
            
          
!

CSS

            
              
            
          
!
? ?
? ?
Must be a valid URL.
+ add another resource
via CSS Lint

JS

            
                  fetchContent : function (settings) {
        if(this.modalEvent) $.unsubscribe(this.modalEvent);
        $(".apidown").remove();
        var optionsDefault = {
            container : ".page",
            pushContent : false
        };
        var options     = $.extend(optionsDefault, settings, true),
            self        = this,
            htmlId      = ".module_" + settings.module_name,
            contentUrl  = "/" +  Backbone.history.fragment;
        
        var content = mailapp.cache.get({
            url : Backbone.history.fragment,
            type : "html"
        });

        $.pageload.show();

        if(!this.contentExist(htmlId)){
            if(content){
                self.loadContent(content, options);
                pushContent = true;
            }
            // Always load content even if we load in cache to get latest version
            $.ajax({
                url: contentUrl,
                cache: false,
                type: 'get',
                data: {},
                success: function(data,statusText, xhr) {
                    if (xhr.getResponseHeader('X-Ajax-Redirect') && xhr.status == 200) {
                        mailapp.routing.navigate(xhr.getResponseHeader('X-Ajax-Redirect'),{trigger:true});
                        return false;
                    }
                    if(options.pushContent) {
                        mailapp.cache.set({
                            url     : Backbone.history.fragment,
                            content :  data,
                            type    : "html"
                        });
                    }
                    self.loadContent(data, options);
                },
                error : function(xhr) {
                    $.pageload.hide();
                    if (xhr.getResponseHeader('X-Ajax-Redirect')) {
                        mailapp.routing.navigate(xhr.getResponseHeader('X-Ajax-Redirect'),{trigger:true});
                        return false;
                    }
                    $(".footer").addClass("hidden");
                    if(xhr.status == 503){
                        content = _.template( $("#tpl_api_down").html(), {} );
                        $(options.container).empty();
                        $("body").append(content);
                        setTimeout(function(){window.location.reload();}, 60000);
                    }
                    if(xhr.status == 404){
                        content = _.template( $("#tpl_404").html(), {} );
                        $(options.container).empty();
                        $("body").append(content);
                    }
                }
            });

        }else{
            self.loadJS(options);
        }
            
          
!
Must be a valid URL.
+ add another resource
via JS Hint
Loading ..................