Created
March 28, 2010 04:32
-
-
Save amasses/346573 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = { | |
featureTimeoutHandle: -1, | |
setupUserDialog: function() { | |
jQuery(".user_placeholder").load("/members/current.js?r=" + location.href); | |
jQuery("a#signin_link").live("click", function(e) { | |
e.preventDefault(); | |
e.stopPropagation(); | |
jQuery("#login_dialog").fadeIn(); | |
}); | |
jQuery(document).bind("mouseup", function(e) { | |
if (jQuery(e.target).parents("#login, #login_dialog").length == 0) { | |
jQuery("#login_dialog").fadeOut(); | |
} | |
}); | |
}, | |
setupSmoothScroll: function() { | |
jQuery('a.smoothscroll').click(function() { | |
if (jQuery(this).hasClass("postReply")) return; | |
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') | |
&& location.hostname == this.hostname) { | |
var $target = jQuery(this.hash); | |
$target = $target.length && $target || jQuery('[name=' + this.hash.slice(1) + ']'); | |
if ($target.length) { | |
var targetOffset = $target.offset().top; | |
jQuery('html,body').animate({scrollTop: targetOffset}, 1000); | |
return false; | |
} | |
} | |
}); | |
}, | |
setupForumControls: function() { | |
jQuery(".post_reply").click(function() { | |
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') | |
&& location.hostname == this.hostname) { | |
var $target = jQuery(this.hash); | |
$target = $target.length && $target || jQuery('[name=' + this.hash.slice(1) + ']'); | |
if ($target.length) { | |
var targetOffset = $target.offset().top; | |
jQuery('html,body').animate({scrollTop: targetOffset}, 1000, function() { | |
jQuery("#post_text").focus(); | |
}); | |
return false; | |
} | |
} | |
}); | |
//* SNIPPED *// | |
jQuery(".report_post_options li a.save").live("click", function(e) { | |
e.preventDefault(); | |
var target = jQuery(this).parents("ul.report_post_options"); | |
var post_id = jQuery(this).attr("data-id"); | |
var report_reason = jQuery("input:checked", target).val(); | |
if (report_reason == "Other") { | |
var reasoning = jQuery("#flag_reason", target).val(); | |
if (reasoning.length < 10) { | |
jQuery("li.other", target).css({color: "#f66"}); | |
return false; | |
} | |
report_reason = report_reason + ": " + jQuery("#flag_reason", target).val(); | |
} | |
jQuery(this).before(jQuery("<img src='/images/spinner_black.gif' />")); | |
jQuery.post("/posts/" + post_id + "/report", {reason: report_reason}, function(data, status) { | |
if (data == "OK") { | |
target.fadeOut(); | |
target.parents("li.report_post").html("Post reported"); | |
} | |
}); | |
}); | |
}, | |
setupNavMenus: function() { | |
// Nav menus! | |
var navHoverConfig = { | |
sensitivity: 7, | |
interval: 100, | |
over: function() { | |
jQuery(this).find('ul:first').css({visibility: "visible",display: "none"}).show("fast"); | |
}, | |
timeout: 500, | |
out: function() { | |
jQuery(this).find('ul:first').css({visibility: "hidden"}); | |
} | |
}; | |
jQuery("#nav li").hoverIntent(navHoverConfig); | |
} | |
// * SNIPPED *// | |
}; | |
jQuery(function() { | |
app.setupUserDialog(); | |
app.setupAdvertising(); | |
app.setupSmoothScroll(); | |
app.setupForumControls(); | |
app.setupFeatureCarousel(); | |
app.setupLocations(); | |
app.loadWeatherConditions(); | |
app.setupJimbeamForm(); | |
app.setupNavMenus(); | |
app.setupAssetControls(); | |
app.setupSearchTabs(); | |
app.setupCommentsForm(); | |
jQuery("#tabs, #newstabs, #hometabs, #searchtabs, #livebuoytabs").fabtabs(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment