/* * The Strangecode Codebase - a general application development framework for PHP * For details visit the project site: * Copyright © 2014 Strangecode, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ // Codebase functions will be under the Strangecode namespace, unless they are added to the jQuery object for chaining. var Strangecode = Strangecode || {}; /* * Emulates a sprintf function. --------------------------------------------------------------------- "{0} is dead, but {1} is alive! {0} {2}".format("ASP", "ASP.NET") outputs ASP is dead, but ASP.NET is alive! ASP {2} --------------------------------------------------------------------- * * @access public * @param string multiple Strings to pass to the formatted string. * @author http://stackoverflow.com/questions/610406/javascript-printf-string-format/4673436#4673436 * @version 1.0 * @since 30 May 2014 18:02:39 */ if (!String.prototype.format) { String.prototype.format = function() { var args = arguments; return this.replace(/{(\d+)}/g, function(match, number) { return typeof args[number-1] != 'undefined' ? args[number-1] : match; }); }; } /* * Displays 'user at domain dot com' as 'user@domain.com'. --------------------------------------------------------------------- --------------------------------------------------------------------- * * @access public * @version 2.0 * @since 30 Jun 2008 12:32:19 */ jQuery.fn.nospam = function() { return this.each(function(){ $(this).text($(this).text().replace(' at ', '@').replace(' dot ', '.')); if (this.href) { this.href = this.href.replace(' at ', '@').replace(' dot ', '.'); } }); }; /* * Encode HTML by proxying content via an in-memory div, setting its inner text which jQuery automatically encodes. Then we pull the encoded contents back out. The div never exists on the page. --------------------------------------------------------------------- $('select').append($('