(function(){"use strict";var a=typeof window!="undefined"?window:global;if(typeof a.require=="function")return;var b={},c={},d=function(a,b){return{}.hasOwnProperty.call(a,b)},e=function(a,b){var c=[],d,e;/^\.\.?(\/|$)/.test(b)?d=[a,b].join("/").split("/"):d=b.split("/");for(var f=0,g=d.length;f=h;0<=h?d++:d--){g=this.users.at(d);if((g.get("username").toLowerCase()===a.toLowerCase()||g.get("email").toLowerCase()===a.toLowerCase())&&g.get("pwd")===b)return c&&c(null,g),g}return c&&(f="Wrong username and/or password",c(f,null)),f},a.prototype.getUserByCid=function(a,b){var c,d,e,f,g;d=this.users.length;for(c=0,g=d-1;0<=g?c<=g:c>=g;0<=g?c++:c--){f=this.users.at(c);if(f.cid===a)return b&&b(null,f),f}return b&&(e="Cid not found",b(e,null)),e},a.prototype.insertUser=function(a,b){this.users.add(a);if(b)return b(null,a)},a.prototype.updateUser=function(a,b,c){var d,e,f,g;e=this.users.length;for(d=0,g=e-1;0<=g?d<=g:d>=g;0<=g?d++:d--){f=this.users.at(d);if(f.cid===a)return f.set(b),c&&c(null,f),f}return c&&c("Wrong user",null),null},a}(),c.exports=new a})).call(this)}),require.register("initialize",function(a,b,c){((function(){var a;window.app=a=b("application"),$(function(){return a.initialize()})})).call(this)}),require.register("lib/router",function(a,b,c){((function(){var a,d,e,f,g,h,i=function(a,b){return function(){return a.apply(b,arguments)}},j=Object.prototype.hasOwnProperty,k=function(a,b){function d(){this.constructor=a}for(var c in b)j.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};h=b("application"),e=b("views/HomeView"),d=b("views/ContentsView"),a=b("views/AboutView"),f=b("views/ReaderView"),c.exports=g=function(b){function c(){this.edituser=i(this.edituser,this),this.newuser=i(this.newuser,this),this.logout=i(this.logout,this),this.about=i(this.about,this),this.contents=i(this.contents,this),this.reader=i(this.reader,this),this.home=i(this.home,this),c.__super__.constructor.apply(this,arguments)}return k(c,b),c.prototype.routes={"":"home",contents:"contents","contents/:path":"contents","contents/:path/:page":"contents",about:"about",reader:"reader","reader/:comic":"reader","reader/:comic/:page":"reader","reader/:comic/:page/:zoom":"reader",dologout:"logout",newuser:"newuser",edituser:"edituser"},c.prototype.home=function(){var a;return $(document.body).off("keyup"),a=new e,h.vent.trigger("navigation",{href:"",view:a})},c.prototype.reader=function(a,b,c){var d;if(h.dontReloadReader){h.currentView.page=parseInt(b),h.currentView.setImage();return}return $(document.body).off("keyup"),b||(b=0),c||(c=70),d=new f({model:new Backbone.Model({comic:a,page:b,zoom:c})}),h.vent.trigger("navigation",{href:"reader",view:d})},c.prototype.contents=function(a,b){var c,e;return $(document.body).off("keyup"),((e=h.currentView)!=null?e.constructor.name:void 0)==="ContentsView"?c=h.currentView:c=new d,h.contentsView=c,h.vent.trigger("navigation",{href:"contents",view:c,path:a||"_",page:b||"0"})},c.prototype.about=function(){var b;return $(document.body).off("keyup"),b=new a,h.vent.trigger("navigation",{href:"about",view:b})},c.prototype.logout=function(){return $(document.body).off("keyup"),h.vent.trigger("logout"),this.navigate(h.menuView.currentRoute,{trigger:!0})},c.prototype.newuser=function(){return $(document.body).off("keyup"),h.vent.trigger("newuser"),this.navigate(h.menuView.currentRoute,{trigger:!0})},c.prototype.edituser=function(){return $(document.body).off("keyup"),h.vent.trigger("edituser"),this.navigate(h.menuView.currentRoute,{trigger:!0})},c}(Backbone.Router)})).call(this)}),require.register("lib/utils",function(a,b,c){((function(){var a;a={butlast:function(a){var b,c,d,e,f;e=a.slice(0,a.length-1),f=[];for(c=0,d=e.length;c=c;1<=c?a++:a--)d.push({shown:a,real:a-1});return d},b.prototype.toJSON=function(){var a,b;return a=_.clone(this.attributes),a.isDirectory=this.isDirectory(),a.isComic=this.isComic(),a.ancestryNames=this.splitNames(),a.ancestryPaths=this.breadcrumbs(),a.ancestryObjs=function(){var c,d;d=[];for(b=0,c=a.ancestryNames.length-1;0<=c?b<=c:b>=c;0<=c?b++:b--)d.push({name:a.ancestryNames[b],path:a.ancestryPaths[b]});return d}(),a.bareName=this.hideExtension(),a.pageNumbers=this.pageNumbers(),a},b}(Backbone.Model)})).call(this)}),require.register("models/items",function(a,b,c){((function(){var a,d,e=function(a,b){return function(){return a.apply(b,arguments)}},f=Object.prototype.hasOwnProperty,g=function(a,b){function d(){this.constructor=a}for(var c in b)f.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};a=b("models/item"),c.exports=d=function(b){function c(){this.maxPage=e(this.maxPage,this),this.parse=e(this.parse,this),this.toJSON=e(this.toJSON,this),c.__super__.constructor.apply(this,arguments)}return g(c,b),c.prototype.model=a,c.prototype.firstPage=0,c.prototype.currentPage=0,c.prototype.perPage=5,c.prototype.toJSON=function(){var a,b;return b=this.currentPage*this.perPage,a=b+this.perPage,this.models.slice(b,a)},c.prototype.parse=function(){return new Backbone.Collection(this.toJSON())},c.prototype.maxPage=function(){return Math.ceil(this.models.length/this.perPage)-1},c}(Backbone.Collection)})).call(this)}),require.register("models/model",function(a,b,c){((function(){var a,b=Object.prototype.hasOwnProperty,d=function(a,c){function e(){this.constructor=a}for(var d in c)b.call(c,d)&&(a[d]=c[d]);return e.prototype=c.prototype,a.prototype=new e,a.__super__=c.prototype,a};c.exports=a=function(a){function b(){b.__super__.constructor.apply(this,arguments)}return d(b,a),b}(Backbone.Model)})).call(this)}),require.register("models/styles",function(a,b,c){((function(){var a,b=Object.prototype.hasOwnProperty,d=function(a,c){function e(){this.constructor=a}for(var d in c)b.call(c,d)&&(a[d]=c[d]);return e.prototype=c.prototype,a.prototype=new e,a.__super__=c.prototype,a};c.exports=a=function(a){function b(){b.__super__.constructor.apply(this,arguments)}return d(b,a),b.prototype.url="/styles",b}(Backbone.Collection)})).call(this)}),require.register("models/user",function(a,b,c){((function(){var a,b=Object.prototype.hasOwnProperty,d=function(a,c){function e(){this.constructor=a}for(var d in c)b.call(c,d)&&(a[d]=c[d]);return e.prototype=c.prototype,a.prototype=new e,a.__super__=c.prototype,a};a=function(a){function b(){b.__super__.constructor.apply(this,arguments)}return d(b,a),b.prototype.idAttribute="_id",b.prototype.urlRoot="/users",b.prototype.defaults={fullname:"",username:"",birth:"",pwd:"",email:"",role:"user"},b.prototype.initialize=function(){if(!this.birth)return this.birth=moment().format("YYYY-MM-DD")},b.prototype.validate=function(){if(!this.get("fullname"))return bootbox.alert("Can't save.\nReason: User full name can't be blank.",{dropback:!1}),!0;if(!this.get("nick"))return bootbox.alert("Can't save.\nReason: username can't be blank."),!0;if(!this.get("pwd"))return bootbox.alert("Can't save.\nReason: password can't be blank."),!0;if(!this.get("birth"))return bootbox.alert("Can't save.\nReason: birth date can't be null."),!0;if(!this.get("email")||!this.get("email").match(/^\w+@\w+(\.\w+)*$/))return bootbox.alert("Can't save.\nReason: user email is wrong."),!0},b}(Backbone.Model),c.exports=a})).call(this)}),require.register("views/AboutView",function(a,b,c){((function(){var a,d,e=Object.prototype.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};d=b("./templates/about"),c.exports=a=function(a){function b(){b.__super__.constructor.apply(this,arguments)}return f(b,a),b.prototype.id="about-view",b.prototype.template=d,b}(Backbone.Marionette.ItemView)})).call(this)}),require.register("views/AppLayout",function(a,b,c){((function(){var a,d,e=Object.prototype.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};d=b("application"),c.exports=a=function(a){function c(){c.__super__.constructor.apply(this,arguments)}return f(c,a),c.prototype.template=b("views/templates/appLayout"),c.prototype.el="body",c.prototype.regions={menu:"#menu",content:"#content",footer:"#footer",popup:"#popup"},c}(Backbone.Marionette.Layout)})).call(this)}),require.register("views/ComicsReaderView",function(a,b,c){((function(){var a,d,e,f=function(a,b){return function(){return a.apply(b,arguments)}},g=Object.prototype.hasOwnProperty,h=function(a,b){function d(){this.constructor=a}for(var c in b)g.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};d=b("views/GenericPopupView"),e=b("views/templates/comicsreaderview"),c.exports=a=function(a){function b(){this.next=f(this.next,this),this.prev=f(this.prev,this),this.last=f(this.last,this),this.first=f(this.first,this),this.maxPage=f(this.maxPage,this),this.onBtnClick=f(this.onBtnClick,this),this.resize=f(this.resize,this),this.onRender=f(this.onRender,this),this.renderPage=f(this.renderPage,this),this.onKeyUp=f(this.onKeyUp,this),this.initialize=f(this.initialize,this),b.__super__.constructor.apply(this,arguments)}return h(b,a),b.prototype.template=e,b.prototype.initialize=function(){return this.model.on("change",this.renderPage),this.$(".modal-body").on("keyup",this.onKeyUp)},b.prototype.onKeyUp=function(a){return console.log(a.which)},b.prototype.renderPage=function(){return this.$("#page-show").attr("src","page?page="+this.model.get("currentPage")+"&at="+this.model.get("path")),this.$(".pagination li").removeClass("active"),this.$('li[data-number="'+this.model.get("currentPage")+'"]').addClass("active"),this.$(".modal-body")[0].scrollTop=0,this.$(".modal-footer a").tooltip()},b.prototype.onRender=function(a){return this.renderPage()},b.prototype.resize=function(a){var b,c,d;return c=a==="btn-zoom-plus"?1:-1,b=parseInt(this.$("#page-show").attr("width")),d=b+10*c,d>100&&(d=100),d<10&&(d=10),this.$("#page-show").attr({width:""+d+"%",height:""+d+"%"})},b.prototype.onBtnClick=function(a){var b,c,d,e;return typeof a.preventDefault=="function"&&a.preventDefault(),b="",a.target.className.match(/btn-save/)&&(b="save"),a.target.className.match(/btn-cancel/)&&(b="cancel"),b?this.$("div.modal").modal("hide"):(c=$(a.target).text(),(d=c.toLowerCase())==="first"||d==="prev"||d==="next"||d==="last"?this[c.toLowerCase()]():(e=$(a.target).attr("id"))==="btn-zoom-plus"||e==="btn-zoom-minus"?this.resize($(a.target).attr("id")):this.model.set("currentPage",parseInt(c)-1))},b.prototype.maxPage=function(){return this.model.get("pages").length-1},b.prototype.first=function(){return this.model.set("currentPage",0)},b.prototype.last=function(){return this.model.set("currentPage",this.maxPage())},b.prototype.prev=function(){var a;return a=parseInt(this.model.get("currentPage"))-1,a<0&&(a=0),this.model.set("currentPage",a)},b.prototype.next=function(){var a;return a=parseInt(this.model.get("currentPage"))+1,a>this.maxPage()&&(a=this.maxPage()),this.model.set("currentPage",a)},b}(d)})).call(this)}),require.register("views/ContentsBCView",function(a,b,c){((function(){var a,d,e,f,g,h=function(a,b){return function(){return a.apply(b,arguments)}},i=Object.prototype.hasOwnProperty,j=function(a,b){function d(){this.constructor=a}for(var c in b)i.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};g=b("./templates/contents_bc"),d=b("models/item"),e=b("models/items"),f=b("application"),c.exports=a=function(a){function b(){this.onRender=h(this.onRender,this),this.onClick=h(this.onClick,this),this.reload=h(this.reload,this),this.initialize=h(this.initialize,this),b.__super__.constructor.apply(this,arguments)}return j(b,a),b.prototype.template=g,b.prototype.initialize=function(){var a=this;return f.vent.on("item:loaded",function(b){return a.model=b,a.render()}),this.reload()},b.prototype.reload=function(){return this.model=f.item},b.prototype.events={"click a":"onClick"},b.prototype.onClick=function(a){return typeof a.preventDefault=="function"&&a.preventDefault(),this.model=new d({path:$(a.target).attr("data-path")}),f.vent.trigger("item:selected",this.model),!1},b.prototype.onRender=function(a){return this.$("li:last").addClass("active"),this.$("span.divider:last").remove()},b}(Backbone.Marionette.ItemView)})).call(this)}),require.register("views/ContentsMainView",function(a,b,c){((function(){var a,d,e,f,g,h,i=function(a,b){return function(){return a.apply(b,arguments)}},j=Object.prototype.hasOwnProperty,k=function(a,b){function d(){this.constructor=a}for(var c in b)j.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};h=b("./templates/contents_main"),d=b("models/item"),f=b("models/items"),e=b("views/ItemListView"),g=b("application"),c.exports=a=function(a){function b(){this.goto=i(this.goto,this),this.next=i(this.next,this),this.prev=i(this.prev,this),this.last=i(this.last,this),this.first=i(this.first,this),this.onNavigate=i(this.onNavigate,this),this.onRender=i(this.onRender,this),this.doSlide=i(this.doSlide,this),this.onDeferImgResolve=i(this.onDeferImgResolve,this),this.onDeferImgProgress=i(this.onDeferImgProgress,this),this.doDeferImgNotify=i(this.doDeferImgNotify,this),this.loadItems=i(this.loadItems,this),this.reload=i(this.reload,this),this.onKeyUp=i(this.onKeyUp,this),this.initialize=i(this.initialize,this),b.__super__.constructor.apply(this,arguments)}return k(b,a),b.prototype.template=h,b.prototype.itemViewContainer="#dir-list",b.prototype.itemView=e,b.prototype.initialize=function(){var a=this;return this.direction="left",$(document.body).on("keyup",this.onKeyUp),g.vent.on("item:loaded",function(b){return a.reload()}),g.vent.on("thumb:loaded",this.doDeferImgNotify),this.$el.on("click",".btn",this.onNavigate),this.reload()},b.prototype.onKeyUp=function(a){switch(a.which){case 36:case 103:return this.first(),!1;case 35:case 97:return this.last(),!1;case 37:case 100:return this.prev(),!1;case 39:case 102:return this.next(),!1;default:return!0}},b.prototype.reload=function(){return this.model=g.item,this.loadItems()},b.prototype.loadItems=function(a){return this.fullCollection=new f(this.model.get("files")),this.fullCollection.currentPage=this.model.get("currentPage"),this.collection=this.fullCollection.parse(),this.render()},b.prototype.doDeferImgNotify=function(){return this.$deferImg.notify()},b.prototype.onDeferImgProgress=function(){this.imgLoaded+=1,console.log("Loaded "+this.imgLoaded+" images out of "+this.imgLen),this.$("#progress-bar").css({width:""+(this.imgLoaded+1)/this.imgLen*100+"%"});if(this.imgLoaded>=this.imgLen-1)return this.$deferImg.resolve()},b.prototype.onDeferImgResolve=function(){var a=this;return setTimeout(function(){return a.$("#progress-wrapper").hide(),a.doSlide(),$("html").removeClass("busy")},0)},b.prototype.doSlide=function(){return console.log("Sliding thumbs in the "+this.direction+" direction"),this.$(".thumbnails").effect("slide",{direction:this.direction})},b.prototype.onRender=function(){var a,b,c,d,e,f,g;return $("html").addClass("busy"),b=((d=this.fullCollection)!=null?d.currentPage:void 0)*((e=this.fullCollection)!=null?e.perPage:void 0)+1,a=b+((f=this.fullCollection)!=null?f.perPage:void 0)-1,c=(g=this.fullCollection)!=null?g.length:void 0,a>c&&(a=c),this.$("#page-status").text(""+b+" - "+a+" of "+c),this.imgLen=this.$("img").length,this.imgLoaded=0,this.$deferImg=new $.Deferred,this.$deferImg.progress(this.onDeferImgProgress),this.$deferImg.done(this.onDeferImgResolve),this.$("img").on("load",this.doDeferImgNotify),this.$("img").on("error",this.doDeferImgNotify)},b.prototype.onNavigate=function(a){return this[$(a.target).attr("data-nav")]()},b.prototype.first=function(){return this.goto(0)},b.prototype.last=function(){return this.goto(this.fullCollection.maxPage())},b.prototype.prev=function(){return this.goto(this.fullCollection.currentPage-1)},b.prototype.next=function(){return this.goto(this.fullCollection.currentPage+1)},b.prototype.goto=function(a){var b;a<0&&(a=0),b=this.fullCollection.maxPage(),a>b&&(a=b);if(a===this.fullCollection.currentPage)return;return this.direction=a>this.fullCollection.currentPage?"left":"right",this.fullCollection.currentPage=a,this.model.set("currentPage",a),g.vent.trigger("item:selected",this.model,this.direction)},b}(Backbone.Marionette.CompositeView)})).call(this)}),require.register("views/ContentsView",function(a,b,c){((function(){var a,d,e,f,g,h,i=function(a,b){return function(){return a.apply(b,arguments)}},j=Object.prototype.hasOwnProperty,k=function(a,b){function d(){this.constructor=a}for(var c in b)j.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};h=b("./templates/contents"),g=b("application"),d=b("./ContentsBCView"),e=b("./ContentsMainView"),a=b("./ComicsReaderView"),c.exports=f=function(a){function b(){this.onRender=i(this.onRender,this),this.initialize=i(this.initialize,this),b.__super__.constructor.apply(this,arguments)}return k(b,a),b.prototype.template=h,b.prototype.regions={breadcrumbs:"#contents-bc",main:"#contents-main",comics_reader:"#comics-popup"},b.prototype.initialize=function(){var a,b=this;return this.item=g.item,this.bcView=new d(this.item),this.mainView=new e(this.item),this.readerView=null,a=this,this.nickName="ContentsView",g.vent.on("comics:selected",function(a){return a.fetch({success:function(b,c){var d;return d="reader.html?page=0&at="+a.get("path")+"&pages="+a.get("pages").length,g.optExternalReader===!0?(window.popup=window.open(d,a.get("name"),"location=0, directories=0, status=0, menubar=0, resizable=0"),typeof popup.requestFullScreen=="function"?popup.requestFullScreen():void 0):g.vent.trigger("reader",{comic:b,page:0})},error:function(a){return bootbox.alert("Cannot retrieve item
Server possibly down.")}})})},b.prototype.onRender=function(a){return this.breadcrumbs.show(this.bcView),this.main.show(this.mainView)},b}(Backbone.Marionette.Layout)})).call(this)}),require.register("views/FooterView",function(a,b,c){((function(){var a,d,e,f=function(a,b){return function(){return a.apply(b,arguments)}},g=Object.prototype.hasOwnProperty,h=function(a,b){function d(){this.constructor=a}for(var c in b)g.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};e=b("./templates/footer"),d=b("application"),a=function(a){function b(){this.onRender=f(this.onRender,this),this.initialize=f(this.initialize,this),b.__super__.constructor.apply(this,arguments)}return h(b,a),b.prototype.initialize=function(){},b.prototype.onRender=function(a){return d.getVisitors(function(a){return this.$("#visitor-number").text("Visitor Number "+a)})},b.prototype.template=e,b}(Backbone.Marionette.ItemView),c.exports=a})).call(this)}),require.register("views/GenericPopupView",function(a,b,c){((function(){var a,d,e=function(a,b){return function(){return a.apply(b,arguments)}},f=Object.prototype.hasOwnProperty,g=function(a,b){function d(){this.constructor=a}for(var c in b)f.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};d=b("views/templates/genericpopupview"),c.exports=a=function(a){function b(){this.render=e(this.render,this),this.onBtnClick=e(this.onBtnClick,this),b.__super__.constructor.apply(this,arguments)}return g(b,a),b.prototype.template=d,b.prototype.onBtnClick=function(a){return console.log("Clicked on a link"),typeof a.preventDefault=="function"&&a.preventDefault(),this.$("div.modal").modal("hide")},b.prototype.render=function(){return Backbone.Marionette.ItemView.prototype.render.apply(this,arguments),console.log("GenericPopupView render"),this.$("a").on("click",this.onBtnClick),this.$("div.modal").modal()},b}(Backbone.Marionette.ItemView)})).call(this)}),require.register("views/HomeView",function(a,b,c){((function(){var a,d,e=function(a,b){return function(){return a.apply(b,arguments)}},f=Object.prototype.hasOwnProperty,g=function(a,b){function d(){this.constructor=a}for(var c in b)f.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};d=b("./templates/home"),c.exports=a=function(a){function b(){this.onBeforeClose=e(this.onBeforeClose,this),this.initialize=e(this.initialize,this),b.__super__.constructor.apply(this,arguments)}return g(b,a),b.prototype.id="home-view",b.prototype.template=d,b.prototype.initialize=function(){var a;return a=function(){return $.get("/legionthumb",function(a){return $("#home-img").attr("src","/zoompage?zoom=16&page=0&at=/"+a),$("#random-link").attr("href","/#reader/"+a.replace(/\//g,"_")+"/0/70")})},a(),this.refresh_img_timer=setInterval(a,1e4)},b.prototype.onBeforeClose=function(){return clearInterval(this.refresh_img_timer),!0},b}(Backbone.Marionette.ItemView)})).call(this)}),require.register("views/ItemListView",function(a,b,c){((function(){var a,d,e,f=function(a,b){return function(){return a.apply(b,arguments)}},g=Object.prototype.hasOwnProperty,h=function(a,b){function d(){this.constructor=a}for(var c in b)g.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};e=b("./templates/itemlist"),d=b("application"),c.exports=a=function(a){function b(){this.onClick=f(this.onClick,this),this.onThumb=f(this.onThumb,this),this.initialize=f(this.initialize,this),b.__super__.constructor.apply(this,arguments)}return h(b,a),b.prototype.template=e,b.prototype.tagName="li",b.prototype.className="span2",b.prototype.events={click:"onClick"},b.prototype.initialize=function(){return this.$el.on("load error","img",this.onThumb)},b.prototype.onThumb=function(){return console.log("Thumb loaded"),d.vent.trigger("thumb:loaded")},b.prototype.onClick=function(a){var b;return typeof a.preventDefault=="function"&&a.preventDefault(),(b=this.model.get("type"))==="rarfile"||b==="zipfile"?(this.model.set("currentPage",0),d.libraryPath=location.href,d.vent.trigger("comics:selected",this.model)):d.vent.trigger("item:selected",this.model),!1},b}(Backbone.Marionette.ItemView)})).call(this)}),require.register("views/MenuView",function(a,b,c){((function(){var a,d,e,f,g,h=function(a,b){return function(){return a.apply(b,arguments)}},i=Object.prototype.hasOwnProperty,j=function(a,b){function d(){this.constructor=a}for(var c in b)i.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};g=b("./templates/menu"),d=b("models/styles"),e=b("views/StylesView"),f=b("application"),c.exports=a=function(a){function b(){this.setContentsRoute=h(this.setContentsRoute,this),this.highlight=h(this.highlight,this),this.onRender=h(this.onRender,this),this.setFakeUser=h(this.setFakeUser,this),this.submit=h(this.submit,this),this.setReader=h(this.setReader,this),this.setTheme=h(this.setTheme,this),b.__super__.constructor.apply(this,arguments)}return j(b,a),b.prototype.template=g,b.prototype.events={submit:"submit","change #cbo-styles":"setTheme","change #opt-external-reader":"setReader"},b.prototype.setTheme=function(a){return f.setTheme(this.$("#cbo-styles").val())},b.prototype.setReader=function(a){return f.setReader($(a.target).is(":checked"))},b.prototype.submit=function(a){return typeof a.preventDefault=="function"&&a.preventDefault(),!this.$(".username-input").val()||!this.$(".pwd-input").val()?!1:(this.setFakeUser({username:this.$(".username-input").val(),pwd:this.$(".pwd-input").val()}),!1)},b.prototype.setFakeUser=function(a){var b=this;return this.options.dataSource.getUser(a.username,a.pwd,function(a,c){return c?b.options.vent.trigger("login",c):bootbox.alert(a)})},b.prototype.onRender=function(){var a,b=this;return this.highlight({href:this.currentRoute}),this.$('a[href="/comics/#newuser"], a[href="/comics/#edituser"]').tooltip({placement:"bottom"}),a=new d,a.fetch({success:function(){var c,d,e;for(d=0,e=a.length-1;0<=e?d<=e:d>=e;0<=e?d++:d--)c=$(""));return this.$("#status-label2").text("of "+(this.maxPage+1)),this.$("#cbo-pages").val(""+this.page)},b.prototype.onRender=function(a){if(!this.loaded)return;return this.$("#btn-library").attr("href",e.libraryPath),this.$(".btn").tooltip(),this.setImage(),this.$("#cbo-pages").on("change",this.onCboChange)},b.prototype.setImage=function(){var a;return $("html").addClass("busy"),a="page?page="+this.page+"&at="+this.path+"&pages="+(this.maxPage+1),this.$("#current-img").off("load"),this.$("#current-img").on("load",this.onLoadImg),this.$("#current-img").attr({src:a,width:""+this.zoom+"%",height:""+this.zoom+"%"}),this.showStatus()},b}(Backbone.Marionette.ItemView)})).call(this)}),require.register("views/StylesView",function(a,b,c){((function(){var a,d,e,f=function(a,b){return function(){return a.apply(b,arguments)}},g=Object.prototype.hasOwnProperty,h=function(a,b){function d(){this.constructor=a}for(var c in b)g.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};e=b("./templates/styleslist"),d=b("application"),c.exports=a=function(a){function b(){this.initialize=f(this.initialize,this),b.__super__.constructor.apply(this,arguments)}return h(b,a),b.prototype.template=e,b.prototype.initialize=function(){var a=this;return this.el=this.options.el,this.collection.fetch({success:function(){return console.log("Styles collection has "+a.collection.length+" elements"),a.render()},error:function(){return console.log("Couldn't retrieve styles from the server ;-(")}})},b}(Backbone.Marionette.ItemView)})).call(this)}),require.register("views/UserItemView",function(a,b,c){((function(){var a,d,e,f=function(a,b){return function(){return a.apply(b,arguments)}},g=Object.prototype.hasOwnProperty,h=function(a,b){function d(){this.constructor=a}for(var c in b)g.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};a=b("views/GenericPopupView"),e=b("views/templates/useritemview"),c.exports=d=function(a){function b(){this.onBtnClick=f(this.onBtnClick,this),this.onRender=f(this.onRender,this),b.__super__.constructor.apply(this,arguments)}return h(b,a),b.prototype.template=e,b.prototype.onRender=function(a){console.log("Custom post-rendering of UserItemView");if(this.options.mode==="insert")return this.$("div.modal-header>h3").text("New User");if(this.options.mode==="update")return this.$("div.modal-header>h3").text("Edit user "+this.model.get("fullname"))},b.prototype.onBtnClick=function(a){var b,c=this;typeof a.preventDefault=="function"&&a.preventDefault(),b="",a.target.className.match(/btn-save/)&&(b="save"),a.target.className.match(/btn-cancel/)&&(b="cancel");if(b==="save"){if(!(this.$("#txt-username").val()&&this.$("#txt-fullname").val()&&this.$("#txt-email").val()&&this.$("#txt-pwd").val()))return;this.model.set({username:this.$("#txt-username").val(),fullname:this.$("#txt-fullname").val(),email:this.$("#txt-email").val(),pwd:this.$("#txt-pwd").val()}),this.options.mode==="insert"?this.options.dataSource.insertUser(this.model,function(a,b){if(!a)return c.options.vent.trigger("login",b)}):this.options.mode==="update"&&this.options.dataSource.updateUser(this.model.cid,this.model.toJSON(),function(a,b){if(!a)return c.options.vent.trigger("login",b)})}if(b)return this.$("div.modal").modal("hide")},b}(a)})).call(this)}),require.register("views/templates/about",function(a,b,c){c.exports=Handlebars.template(function(a,b,c,d,e){c=c||a.helpers;var f,g=this;return'
\n
\n

About Silver Age Comics

\n
\n
\n

\n All the heroes.\n

\n

\n All the villains.\n

\n
\n
\n
\n
\n \n

 

\n Wow! It\'s been a long time now...but...
\n

We\'re back!

\n And now... stronger than ever!
\n Now, besides the classic Legion of Superheroes and Crisis on Infinite Earths
\n You get...
\n
    \n
  • The complete Adventure Comics Collection!
  • \n
  • The complete Action Comics Collection!
  • \n
  • The complete Superboy Collection!
  • \n
\n And, as of May 2013, a lot more! Just browse through it!
\n
\n
\n
\n\n '})}),require.register("views/templates/appLayout",function(a,b,c){c.exports=Handlebars.template(function(a,b,c,d,e){c=c||a.helpers;var f,g=this;return'\n\n
\n\n'})}),require.register("views/templates/comicsreaderview",function(a,b,c){c.exports=Handlebars.template(function(a,b,c,d,e){function p(a,b){var c="",d;return c+='\n \n ",c}c=c||a.helpers;var f="",g,h,i,j,k=this,l="function",m=c.helperMissing,n=void 0,o=this.escapeExpression;f+='",f})}),require.register("views/templates/contents",function(a,b,c){c.exports=Handlebars.template(function(a,b,c,d,e){c=c||a.helpers;var f,g=this;return'\n
\n BreadCrumbs\n
\n\n
\n Main Contents\n
\n\n
\n\n
\n'})}),require.register("views/templates/contents_bc",function(a,b,c){c.exports=Handlebars.template(function(a,b,c,d,e){function p(a,b){var d="",e,f;d+='\n
  • \n \n ',e=a.name,f=c["if"],j=k.program(2,q,b),j.hash={},j.fn=j,j.inverse=k.program(4,r,b),e=f.call(a,e,j);if(e||e===0)d+=e;return d+='\n \n
  • \n / \n ',d}function q(a,b){var c="",d;return c+="\n ",d=a.name,typeof d===l?d=d.call(a,{hash:{}}):d===n&&(d=m.call(a,"this.name",{hash:{}})),c+=o(d)+"\n ",c}function r(a,b){return"\n Silver Age Comics Library\n "}c=c||a.helpers;var f="",g,h,i,j,k=this,l="function",m=c.helperMissing,n=void 0,o=this.escapeExpression;f+='
    \n
    \n \n
    \n
    \n\n",f})}),require.register("views/templates/contents_main",function(a,b,c){c.exports=Handlebars.template(function(a,b,c,d,e){c=c||a.helpers;var f,g=this;return'
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n \n \n \n \n \n \n \n
    \n
    \n \n
    \n'})}),require.register("views/templates/footer",function(a,b,c){c.exports=Handlebars.template(function(a,b,c,d,e){c=c||a.helpers;var f,g=this;return'\n'})}),require.register("views/templates/genericpopupview",function(a,b,c){c.exports=Handlebars.template(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i=this,j="function",k=c.helperMissing,l=void 0,m=this.escapeExpression;return f+='',f})}),require.register("views/templates/home",function(a,b,c){c.exports=Handlebars.template(function(a,b,c,d,e){c=c||a.helpers;var f,g=this;return' \n\n
    \n
    \n

    Silver Age of Comics Home

    \n
    \n
    \n
    \n

    This site is devoted to preserve the rich heritage of the Silver Age of Comics.

    \n

    Here you\'ll be able to read online some of the greatest comics of the Silver Age

    \n

    We hope this encourages you to buy your own copies of these fine comics and by so doing adding to the preserving mission.

    \n

    For further info regarding comics acquisition, visit DC Comics

    \n

    Don\'t let the flame extinguish!

    \n
    \n
    \n \n \n
    \n
    \n
    \n Your contributions to help us keep up and running will be greatly appreciated.

    \n
    \n \n \n \n \n
    \n
    \n
    \n Stop the Hollyweb! No DRM in HTML5.\n
    \n
    \n
    \n
    \n '})}),require.register("views/templates/itemlist",function(a,b,c){c.exports=Handlebars.template(function(a,b,c,d,e){function p(a,b){return'\n \n '}function q(a,b){var d="",e,f;d+="\n ",i=c.isComic,e=i||a.isComic,f=c["if"],j=k.program(4,r,b),j.hash={},j.fn=j,j.inverse=k.noop,e=f.call(a,e,j);if(e||e===0)d+=e;return d+="\n ",d}function r(a,b){var d="",e;return d+='\n \n ',d}c=c||a.helpers;var f="",g,h,i,j,k=this,l="function",m=c.helperMissing,n=void 0,o=this.escapeExpression;f+='\n ',i=c.isDirectory,g=i||b.isDirectory,h=c["if"],j=k.program(1,p,e),j.hash={},j.fn=j,j.inverse=k.program(3,q,e),g=h.call(b,g,j);if(g||g===0)f+=g;return f+="\n ",i=c.name,g=i||b.name,typeof g===l?g=g.call(b,{hash:{}}):g===n&&(g=m.call(b,"name",{hash:{}})),f+=o(g)+"\n",f})}),require.register("views/templates/menu",function(a,b,c){c.exports=Handlebars.template(function(a,b,c,d,e){function p(a,b){var d="",e;return d+='\n \n ',d}function q(a,b){return'\n \n \n '}c=c||a.helpers;var f="",g,h,i,j,k=this,l="function",m=c.helperMissing,n=void 0,o=this.escapeExpression;f+=' \n",f})}),require.register("views/templates/reader",function(a,b,c){c.exports=Handlebars.template(function(a,b,c,d,e){c=c||a.helpers;var f,g=this;return'
    \n
    \n \n
    \n
    \n \n
    \n \n \n Page \n \n \n \n \n
    \n
    \n \n \n
    \n
    \n
    '})}),require.register("views/templates/styleslist",function(a,b,c){c.exports=Handlebars.template(function(a,b,c,d,e){function p(a,b){var c="",d;return c+='\n \n",c}c=c||a.helpers;var f="",g,h,i,j,k=this,l="function",m=c.helperMissing,n=void 0,o=this.escapeExpression;i=c.collection,g=i||b.collection,h=c.each,j=k.program(1,p,e),j.hash={},j.fn=j,j.inverse=k.noop,g=h.call(b,g,j);if(g||g===0)f+=g;return f+="\n\n",f})}),require.register("views/templates/useritemview",function(a,b,c){c.exports=Handlebars.template(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i=this,j="function",k=c.helperMissing,l=void 0,m=this.escapeExpression;return f+='',f})})