assoc_whisperer 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NWExNDJlZjU0N2I1ZmYyMmU3YTFmNTVhYzdiMDAwZTFjMmE0NjdlYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MmUzOGQwYWI0MjU4NjJlNDBiOGFhMzNmZmE2ZDExMjYwY2M1MThmYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTJiOWZmMTIzYjMyNGM0ZmZkYmZlMjg3NmEyNDUwNDc3MzdmNjEzYjk3NzAy
|
10
|
+
MmUxZTIwNzMzZTVkMjkwOGMzYjlkMGNjNjZjYzY0NjA3YzUwNjc0MzIxYzhj
|
11
|
+
NGYxOTY1OGMwYjg3NmE0NDU5YmE3MmJkM2Y1YzViNjdlMGJhZGU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjZmY2U0OTI2ZWYyOTgzNjRmZjQ5OTU1OGUwN2FhYmQxZDkxYjA1NjVkMzU0
|
14
|
+
MWVhNzRhNTM1NzQ2MjczNzA0OGE0M2JlNjBlOWIyYjAyN2U2OWQyNzljYThi
|
15
|
+
NzdjMjJlNjUxNTJmYTY5NmUwZjViMjYzN2E5NzllNGU4NGVmOTE=
|
@@ -1 +1 @@
|
|
1
|
-
(function(){var e,t=function(e,t){return function(){return e.apply(t,arguments)}};document.AssocWhispering={all:[],working:false,find:function(e){var t,n,r,i;i=document.AssocWhispering.all;for(n=0,r=i.length;n<r;n++){t=i[n];if(t._action===e){return t}}return null},selectTextFor:function(e,t){var n;n=document.AssocWhispering.find(t);n._last_input="§";return n.getList("",false,function(){return n.selectText(e)})},selectValueFor:function(e,t){var n;n=document.AssocWhispering.find(t);n._last_input="§";return n.getList("",false,function(){switch(e){case"#1":return n.select(n._list_tag.find("
|
1
|
+
(function(){var e,t=function(e,t){return function(){return e.apply(t,arguments)}};document.AssocWhispering={all:[],working:false,find:function(e){var t,n,r,i;i=document.AssocWhispering.all;for(n=0,r=i.length;n<r;n++){t=i[n];if(t._action===e){return t}}return null},selectTextFor:function(e,t){var n;n=document.AssocWhispering.find(t);n._last_input="§";return n.getList("",false,function(){return n.selectText(e)})},selectValueFor:function(e,t){var n;n=document.AssocWhispering.find(t);n._last_input="§";return n.getList("",false,function(){switch(e){case"#1":return n.select(n._list_tag.find("div:first"));default:return n.selectValue(e)}})}};$(document).ready(function(){return $(".assoc_whisperer").each(function(t,n){var r;r=new e(n);return document.AssocWhispering.all.push(r)})});e=function(){function e(e){this.setUnfilled=t(this.setUnfilled,this);this.selectText=t(this.selectText,this);this.selectValue=t(this.selectValue,this);this.select=t(this.select,this);this.removeList=t(this.removeList,this);this.deactivateList=t(this.deactivateList,this);this.showList=t(this.showList,this);this.getList=t(this.getList,this);this.controls_blur=t(this.controls_blur,this);this.dropdown_button_click=t(this.dropdown_button_click,this);this.text_field_keyup=t(this.text_field_keyup,this);this._tag=$(e);this._action=this._tag.attr("data-action");this._url=this._tag.attr("data-url");this._text_field=this._tag.children(".text_field");this._value_field=this._tag.children(".value_field");this._text_field.keyup(this.text_field_keyup);this._text_field.click(function(e){return function(){return e._text_field.select()}}(this));this._text_field.focus(function(e){return function(){return e._focus="text_field"}}(this));this._text_field.blur(this.controls_blur);this._tag.children(".dropdown_button").click(this.dropdown_button_click);this._is_filled=this._value_field.val()!==""}e.prototype._tag=null;e.prototype._text_field=null;e.prototype._value_field=null;e.prototype._list_tag=null;e.prototype._action=null;e.prototype._url=null;e.prototype._timeout=null;e.prototype._last_input="§";e.prototype._is_filled=false;e.prototype._focus=null;e.prototype.text_field_keyup=function(e){var t,n;if(e.keyCode===40){return}else if(e.keyCode===27){this.removeList();return}n=this._text_field.val();if(this._timeout){clearTimeout(this._timeout)}if(n!==this._last_input&&this._is_filled){this.setUnfilled()}if(n===""){this._last_input=n;return this.removeList()}else{t=function(e){return function(){return e.getList(n)}}(this);return this._timeout=setTimeout(t,700)}};e.prototype.dropdown_button_click=function(){this._last_input="§";if(this._is_filled){return this.getList("",true)}else{return this.getList(this._text_field.val(),true)}};e.prototype.controls_blur=function(){this._focus=null;return setTimeout(function(e){return function(){if(!e._focus){return e.removeList()}}}(this),100)};e.prototype.getList=function(e,t,n){if(t==null){t=false}if(n==null){n=null}if(e===this._last_input){return}this._last_input=e;this.deactivateList();document.AssocWhispering.working=true;return $.ajax(this._tag.attr("data-url"),{type:"GET",dataType:"html",data:{data_action:this._tag.attr("data-action"),input:e},error:this.removeList,success:function(e){return function(r){e.showList(r);if(t){e._list_tag.focus()}if(n){n()}return document.AssocWhispering.working=false}}(this)})};e.prototype.showList=function(e){var t;this.removeList();this._list_tag=$(e);this._list_tag.css("min-width",this._tag.width());this._list_tag.css("left",this._tag.offset().left);this._list_tag.css("top",this._tag.position().top+this._tag.outerHeight());this._tag.append(this._list_tag);this._list_tag.focus(function(e){return function(){return e._focus="list"}}(this));this._list_tag.blur(this.controls_blur);t=this._list_tag.find("div");return t.click(function(e){return function(t){return e.select($(t.currentTarget))}}(this))};e.prototype.deactivateList=function(){if(!this._list_tag){return}return this._list_tag.addClass("inactive")};e.prototype.removeList=function(){if(!this._list_tag){return}this._list_tag.detach();return this._list_tag=null};e.prototype.select=function(e){var t;if(e.length!==1){return}t=e.text();this._text_field.val(t);this._value_field.val(e.attr("data-value"));this._last_input=t;this._is_filled=true;this._text_field.removeClass("unfilled");return this.removeList()};e.prototype.selectValue=function(e){return this.select(this._list_tag.find("div[data-value="+e+"]"))};e.prototype.selectText=function(e){return this.select(this._list_tag.find('div:contains("'+e+'")'))};e.prototype.setUnfilled=function(){this._is_filled=false;this._value_field.val("");return this._text_field.addClass("unfilled")};return e}()}).call(this)
|
@@ -22,7 +22,7 @@ document.AssocWhispering = {
|
|
22
22
|
w._last_input = '§'
|
23
23
|
w.getList('', false, ->
|
24
24
|
switch value
|
25
|
-
when '#1' then w.select(w._list_tag.find('
|
25
|
+
when '#1' then w.select(w._list_tag.find('div:first'))
|
26
26
|
else w.selectValue(value)
|
27
27
|
)
|
28
28
|
}
|
@@ -135,7 +135,7 @@ class Whisperer
|
|
135
135
|
@_list_tag.focus => @_focus = 'list'
|
136
136
|
@_list_tag.blur @controls_blur
|
137
137
|
|
138
|
-
rows = @_list_tag.find('
|
138
|
+
rows = @_list_tag.find('div')
|
139
139
|
rows.click (el) => @select($(el.currentTarget))
|
140
140
|
|
141
141
|
# Adds a class 'inactive' to list to make it visualy distinguishable.
|
@@ -164,11 +164,11 @@ class Whisperer
|
|
164
164
|
|
165
165
|
# Selects row by given value.
|
166
166
|
selectValue: (value) =>
|
167
|
-
@select(@_list_tag.find('
|
167
|
+
@select(@_list_tag.find('div[data-value='+value+']'))
|
168
168
|
|
169
169
|
# Selects row by given text label.
|
170
170
|
selectText: (text) =>
|
171
|
-
@select(@_list_tag.find('
|
171
|
+
@select(@_list_tag.find('div:contains("'+text+'")'))
|
172
172
|
|
173
173
|
# Sets Whisperer to 'unfilled' state - no value has been selected (applies css class 'unfilled').
|
174
174
|
setUnfilled: =>
|