diff options
Diffstat (limited to 'pyload/web/app/scripts/views/input/clickInput.js')
-rw-r--r-- | pyload/web/app/scripts/views/input/clickInput.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/pyload/web/app/scripts/views/input/clickInput.js b/pyload/web/app/scripts/views/input/clickInput.js new file mode 100644 index 000000000..873c81ce7 --- /dev/null +++ b/pyload/web/app/scripts/views/input/clickInput.js @@ -0,0 +1,43 @@ +define(['jquery', 'backbone', 'underscore', 'helpers/gettext', './inputView'], function($, Backbone, _, gettext, inputView) { + 'use strict'; + + return inputView.extend({ + + tagName: 'input', + events: { + 'keyup': 'onChange', + 'focus': 'showTooltip', + 'focusout': 'hideTooltip' + }, + + renderInput: function() { + this.$el.attr('disabled', 'on'); + this.$el.attr('type', 'text'); + this.$el.attr('name', 'textInput'); + + if (this.default_value) + this.$el.attr('placeholder', this.default_value); + else + this.$el.attr('placeholder', gettext('Please click on the right position in the captcha.')); + + if (this.value) + this.$el.val(this.value); + + return this; + }, + + onClick: function(x,y) { + this.$el.val(x + "," + y); + this.onChange(); + }, + + clear: function() { + this.$el.val(''); + }, + + onChange: function(e) { + this.setVal(this.$el.val()); + } + + }); +});
\ No newline at end of file |