Skip to content

Instantly share code, notes, and snippets.

@liammclennan
Forked from brendankowitz/gist:4167197
Created November 29, 2012 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liammclennan/4167607 to your computer and use it in GitHub Desktop.
Save liammclennan/4167607 to your computer and use it in GitHub Desktop.
Better than revealing module pattern?
// don't really need the wrapper
var Site = function (el) {
'use strict';
// this.el = el; this
/* Private Methods */
function initSearch() {
el.find("#site-search-form").submit(function (e) {
var searchInput = $(this).find("input[type='text']");
var query = searchInput.val();
if (query.length > 0) {
window.location = $(this).find("select").val() + "?q=" + query;
} else {
el.find("#searchTerm").effect("highlight", {}, 3000);
}
return false;
});
}
function init3Col() {
if (el.find("#rightContentContainer").length > 0) {
el.find("#pageContainer").addClass("content3Col");
}
}
/* Public Methods */
this.init = function () {
initSearch();
init3Col();
};
};
$(function () {
var siteInstance = new Site(jQuery("body"));
siteInstance.init();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment