JSFiddle - React, Tailwind, and code Playground
by Artem Borovikov
JavaScript
window.App = {
baseURL: "http://okkapi.agency/",
lng: "",
loaded: !1,
mapLoaded: !1,
Models: {},
Views: {},
Collections: {},
Router: {},
pages: [],
mob: !1,
template: function(e) {
return Handlebars.compile($("#" + e).html())
},
appLoaded: function() {
App.mainModel.set("loaded", !0)
},
loadApp: function() {
App.detectOS(), App.lng = new App.Models.Lng({
lng: ""
}), App.router = new App.Router, Backbone.history.start({
pushState: !0
})
},
detectOS: function() {
-1 !== navigator.appVersion.indexOf("Android") && (App.mob = !0), -1 !== navigator.appVersion.indexOf("iPhone") && (App.mob = !0)
},
loadData: function(e, t) {
App.mainModel = new App.Models.App, App.mainView = new App.Views.Main({
model: App.mainModel,
lng: App.lng
}), App.pages.home = new App.Views.Home({
model: new App.Models.Home,
lng: App.lng
}), App.pages.agency = new App.Views.Agency({
model: new App.Models.Agency,
lng: App.lng
}), App.pages.works = new App.Views.Works({
model: new App.Models.Works,
lng: App.lng,
work: t
}), App.pages.contact = new App.Views.Contact({
model: new App.Models.Contact,
lng: App.lng
}), App.pages.notfound = new App.Views.Notfound({
model: new App.Models.Notfound,
lng: App.lng
}), App.loaded = !0, "function" == typeof e && e()
},
showPage: function(e) {
null !== e && void 0 !== e || (e = "home"), "works" === e ? $("html").addClass("works") : $("html").removeClass("works"), "home" === e ? App.mainModel.set("currentPage", "") : (App.mainModel.set("currentPage", e), App.pages.home.kldStop()), "404" === e ? e = "notfound" : App.pages.notfound.noiseStop(), void 0 !== App.pages[e] ?...