-
-
Save liammclennan/4167607 to your computer and use it in GitHub Desktop.
Better than revealing module pattern?
This file contains hidden or 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
// 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