diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-12-29 20:45:58 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-12-29 20:45:58 -0200 |
commit | 97e689213ff4e829f251af526ed4e796a3cc2b71 (patch) | |
tree | b04d03ec56305041216b72328fc9b5afde27bc76 /mod/html5/vendors/jquery/jquery.placeholder-1.0.1.js | |
parent | 0ab6351abb7a602d96c62b0ad35413c88113a6cf (diff) | |
parent | 69e2d8c5d8732042c9319aef1fdea45a82b63e42 (diff) | |
download | elgg-97e689213ff4e829f251af526ed4e796a3cc2b71.tar.gz elgg-97e689213ff4e829f251af526ed4e796a3cc2b71.tar.bz2 |
Merge branch 'master' into saravea
Conflicts:
.gitmodules
mod/admins
mod/assemblies
mod/audio_html5
mod/beechat
mod/crud
mod/elgg-activitystreams
mod/elggman
mod/elggpg
mod/favorites
mod/federated-objects
mod/friendly_time
mod/group_alias
mod/group_operators
mod/languages
mod/lightpics
mod/openid_client
mod/spotlight
mod/suicide
mod/tasks
mod/videolist
Diffstat (limited to 'mod/html5/vendors/jquery/jquery.placeholder-1.0.1.js')
-rw-r--r-- | mod/html5/vendors/jquery/jquery.placeholder-1.0.1.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/mod/html5/vendors/jquery/jquery.placeholder-1.0.1.js b/mod/html5/vendors/jquery/jquery.placeholder-1.0.1.js new file mode 100644 index 000000000..61dfb87e6 --- /dev/null +++ b/mod/html5/vendors/jquery/jquery.placeholder-1.0.1.js @@ -0,0 +1,58 @@ +/**
+ * jQuery.placeholder - Placeholder plugin for input fields
+ * Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
+ * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
+ * Date: 2008/10/14
+ *
+ * @author Blair Mitchelmore
+ * @version 1.0.1
+ *
+ **/
+new function($) {
+ $.fn.placeholder = function(settings) {
+ settings = settings || {};
+ var key = settings.dataKey || "placeholderValue";
+ var attr = settings.attr || "placeholder";
+ var className = settings.className || "placeholder";
+ var values = settings.values || [];
+ var block = settings.blockSubmit || false;
+ var blank = settings.blankSubmit || false;
+ var submit = settings.onSubmit || false;
+ var value = settings.value || "";
+ var position = settings.cursor_position || 0;
+
+
+ return this.filter(":input").each(function(index) {
+ $.data(this, key, values[index] || $(this).attr(attr));
+ }).each(function() {
+ if ($.trim($(this).val()) === "")
+ $(this).addClass(className).val($.data(this, key));
+ }).focus(function() {
+ if ($.trim($(this).val()) === $.data(this, key))
+ $(this).removeClass(className).val(value)
+ if ($.fn.setCursorPosition) {
+ $(this).setCursorPosition(position);
+ }
+ }).blur(function() {
+ if ($.trim($(this).val()) === value)
+ $(this).addClass(className).val($.data(this, key));
+ }).each(function(index, elem) {
+ if (block)
+ new function(e) {
+ $(e.form).submit(function() {
+ return $.trim($(e).val()) != $.data(e, key)
+ });
+ }(elem);
+ else if (blank)
+ new function(e) {
+ $(e.form).submit(function() {
+ if ($.trim($(e).val()) == $.data(e, key))
+ $(e).removeClass(className).val("");
+ return true;
+ });
+ }(elem);
+ else if (submit)
+ new function(e) { $(e.form).submit(submit); }(elem);
+ });
+ };
+}(jQuery);
|