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
// Plugin to get query params as an object | |
jQuery.extend({ | |
getQueryParameters : function(str) { | |
return (str || document.location.search).replace(/(^\?)/,'').split("&").map(function(n){return n = n.split("="),this[n[0]] = n[1],this}.bind({}))[0]; | |
} | |
}); | |
// EXAMPLE | |
// http://codepen.io/chriscoyier/pen/uszCr?lunch=sandwich&dinner=stirfry | |
var queryParams = $.getQueryParameters(); |
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
// Requires underscore or lodash for isUndefined() | |
var $cache = {}; | |
/** | |
* Returns the page title element and will set the page title element when it doesn't exist | |
* @param {String} selector | |
* @returns {jQuery} | |
*/ | |
getElement: function getElement(selector) { | |
if (typeof selector !== 'string') { |
OlderNewer