summaryrefslogtreecommitdiffstats
path: root/static/functions/script_start.js
diff options
context:
space:
mode:
authorGit <git@what.cd>2013-10-11 08:01:04 +0000
committerGit <git@what.cd>2013-10-11 08:01:04 +0000
commit304a28d6e060f35d51bdf209e9d6b4f26bd5287a (patch)
treebc5654dec332f48e02dbbf2def75d38823de4866 /static/functions/script_start.js
parented6863ea3289511abf58110dd80b2072941bde22 (diff)
downloadGazelle-304a28d6e060f35d51bdf209e9d6b4f26bd5287a.zip
Gazelle-304a28d6e060f35d51bdf209e9d6b4f26bd5287a.tar.gz
Gazelle-304a28d6e060f35d51bdf209e9d6b4f26bd5287a.tar.bz2
Empty commit
Diffstat (limited to 'static/functions/script_start.js')
-rw-r--r--static/functions/script_start.js55
1 files changed, 27 insertions, 28 deletions
diff --git a/static/functions/script_start.js b/static/functions/script_start.js
index 434cb06..daf7d8c 100644
--- a/static/functions/script_start.js
+++ b/static/functions/script_start.js
@@ -225,24 +225,6 @@ function isNumberKey(e) {
return true;
}
-// jQuery plugin to prevent double submission of forms
-jQuery.fn.preventDoubleSubmission = function() {
- $(this).bind('submit', function(e){
- var $form = $(this);
-
- if ($form.data('submitted') === true) {
- // Previously submitted - don't submit again
- e.preventDefault();
- } else {
- // Mark it so that the next submit can be ignored
- $form.data('submitted', true);
- }
- });
-
- // Keep chainability
- return this;
-};
-
$.fn.extend({
results: function () {
return this.size();
@@ -325,24 +307,18 @@ $.fn.extend({
return this;
},
disable : function () {
- for (var i = 0, il = this.size(); i < il; i++) {
- this[i].disabled = true;
- }
+ $(this).prop('disabled', true);
return this;
},
enable : function () {
- for (var i = 0, il = this.size(); i < il; i++) {
- if (this[i].disabled == true) {
- this[i].disabled = false;
- }
- }
+ $(this).prop('disabled', false);
return this;
},
raw: function (number) {
- if (number === undefined) {
+ if (typeof number == 'undefined') {
number = 0;
}
- return this[number];
+ return $(this).get(number);
},
nextElementSibling: function () {
var here = this[0];
@@ -370,5 +346,28 @@ $.fn.extend({
} else {
$(this).attr('title', tooltip);
}
+ return this;
+ },
+
+ // Disable unset form elements to allow search URLs cleanups
+ disableUnset: function() {
+ $('input[value=""]:text, select[value=""]', this).disable();
+ return this;
+ },
+
+ // Prevent double submission of forms
+ preventDoubleSubmission: function() {
+ $(this).submit(function(e) {
+ var $form = $(this);
+ if ($form.data('submitted') === true) {
+ // Previously submitted - don't submit again
+ e.preventDefault();
+ } else {
+ // Mark it so that the next submit can be ignored
+ $form.data('submitted', true);
+ }
+ });
+ // Keep chainability
+ return this;
}
});