Forrst Javascript APP Architecture
This is Forrst's main bit of javascript code. This is commercial property, so this fiddles intention is strictly for understanding and implementing high performance javascript objects.
by jakie8
JavaScript
var Comments = {};
var Forrst = {};
var Code = {};
var Stream = {};
var PostForm = {};
var People = {};
var Posts = {};
var Payments = {};
var Settings = {};
var Notifications = {};
var MembershipApplication = {};
var Discussions = {};
var Leaderboard = {};
var UserCards = {};
var Jobs = {};
Forrst = {
showingTopClicker: false,
currentUserID: -1,
currentUsername: -1,
formKey: "",
footerMarginShift: "-44px",
init: function() {
$(document).ready(function() {
if ($("#stream").length) {
$("#footer").addClass("sticky");
$("#footer").css({
marginBottom: Forrst.footerMarginShift
})
}
Forrst.formKey = $("meta[name=forrst-form-key]").attr("content");
Forrst.currentUserID = $("meta[name=forrst-userid]").attr("content");
Forrst.currentUsername = $("meta[name=forrst-username]").attr("content");
Notifications.poll();
Forrst.applyLibs();
Stream.init();
$("#promo-excerpt").jTruncate({
length: 95
});
$(".notice-bar a.close").click(function() {
return Forrst.hideNoticeBar()
});
PostForm.init();
People.init();
Comments.init();
Posts.init();
Settings.init();
Leaderboard.init();
if ($(".payment-form:not(.jobs)").length) {
Payments.init()
}
if ($("#flash a.close").length && $("#flash").is(":visible")) {
setTimeout('$("#flash a.close").click();', 7000)
}
$("#back-to-top a").click(function() {
$.scrollTo("#header", "fast");
window.location.hash = "";
return false
});
$(window).scroll(function() {
if ($(window).scrollTop() >= 350) {
if...