Upgraded to suggest 1.2.1.

Fixed issue 160: Cancel button on Search for Match dialog sometimes not working.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@1587 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-10-17 20:49:54 +00:00
parent 7a6d53783b
commit a9a3944cbf
6 changed files with 16 additions and 11 deletions

View File

@ -164,7 +164,7 @@ function init() {
[
"externals/jquery-1.4.2.min.js",
"externals/jquery.cookie.js",
"externals/suggest/suggest-1.2.min.js",
"externals/suggest/suggest-1.2.1.min.js",
"externals/jquery-ui/jquery-ui-1.8.custom.min.js",
"externals/imgareaselect/jquery.imgareaselect.js",
"externals/date.js",
@ -222,7 +222,7 @@ function init() {
"project/styles",
module,
[
"externals/suggest/css/suggest-1.2.min.css",
"externals/suggest/css/suggest-1.2.1.min.css",
"externals/jquery-ui/css/ui-lightness/jquery-ui-1.8.custom.css",
"externals/imgareaselect/css/imgareaselect-default.css",

View File

@ -111,4 +111,4 @@ p.fbs-flyout-image-true,h3.fbs-flyout-image-true,h1.fbs-flyout-image-true{margin
* html .fbs-item-name{width:253px !important;}
* html .fbs-item-name{width:100%;}
* html .fbs-flyout-content:after{height:1px;}
/* Version:r94143M Built:Thu Apr 29 2010 by daepark */
/* Version:r94764M Built:Tue May 11 2010 by daepark */

View File

@ -44,10 +44,10 @@ a.metaKey||a.ctrlKey)){a=this.options;a=this.pane.is(":visible")&&c("."+a.css.it
this.options.css.item+":visible",this.list).length){this.updown(false);a.preventDefault()}else e||this.check_required(a)}}},shift_enter:function(){},escape:function(){this.hide_all()},up:function(a){this.updown(true,a.ctrlKey||a.shiftKey)},down:function(a){this.updown(false,null,a.ctrlKey||a.shiftKey)},updown:function(a,b,e){var i=this.options.css,d=this.list;if(this.pane.is(":visible")){var g=c("."+i.item+":visible",d);if(g.length){d=c(g[0]);g=c(g[g.length-1]);var f=this.get_selected()||[];clearTimeout(this.ignore_mouseover.timeout);
this._ignore_mouseover=false;if(a)if(b)this._goto(d);else if(f.length)if(f[0]==d[0]){d.removeClass(i.selected);this.input.val(this.input.data("original.suggest"));this.hoverout_list()}else this._goto(f.prevAll("."+i.item+":visible:first"));else this._goto(g);else if(e)this._goto(g);else if(f.length)if(f[0]==g[0]){g.removeClass(i.selected);this.input.val(this.input.data("original.suggest"));this.hoverout_list()}else this._goto(f.nextAll("."+i.item+":visible:first"));else this._goto(d)}}else a||this.textchange()},
_goto:function(a){a.trigger("mouseover.suggest");var b=a.data("data.suggest");this.input.val(b?b.name:this.input.data("original.suggest"));this.scroll_to(a)},scroll_to:function(a){var b=this.list,e=b.scrollTop(),i=e+b.innerHeight(),d=a.outerHeight();a=a.prevAll().length*d;d=a+d;if(a<e){this.ignore_mouseover();b.scrollTop(a)}else if(d>i){this.ignore_mouseover();b.scrollTop(e+d-i)}},textchange:function(){this.input.removeData("data.suggest");this.input.trigger("fb-textchange",this);var a=this.input.val();
if(a==="")this.status_start();else{this.status_loading();this.request(a)}},request:function(){},response:function(a){"cost"in a&&this.trackEvent(this.name,"response","cost",a.cost);if(this.check_response(a)){var b=[];if(c.isArray(a))b=a;else if("result"in a)b=a.result;var e=c.map(arguments,function(f){return f});this.response_hook.apply(this,e);var i=null,d=this,g=this.options;c.each(b,function(f,j){j=d.create_item(j,a).bind("mouseover.suggest",function(l){d.mouseover_item(l)}).data("data.suggest",
j);d.list.append(j);if(f===0)i=j});this.input.data("original.suggest",this.input.val());c("."+g.css.item,this.list).length===0&&g.nomatch&&this.list.append(c('<li class="fbs-nomatch">').html(g.nomatch).bind("click.suggest",function(f){f.stopPropagation()}));e.push(i);this.show_hook.apply(this,e);this.position();this.pane_show()}},pane_show:function(){var a=false;if(c("> li",this.list).length)a=true;a||this.pane.children(":not(."+this.options.css.list+")").each(function(){a=c(this).is(":visible");
return!a});if(a)if(this.options.animate){var b=this;this.pane.slideDown("fast",function(){b.input.trigger("fb-pane-show",b)})}else{this.pane.show();this.input.trigger("fb-pane-show",this)}else{this.pane.hide();this.input.trigger("fb-pane-hide",this)}},create_item:function(a){var b=this.options.css;li=c("<li>").addClass(b.item);var e=c("<label>").text(a.name);a.name=e.text();li.append(c("<div>").addClass(b.item_name).append(e));return li},mouseover_item:function(a){if(!this._ignore_mouseover){a=a.target;
if(a.nodeName.toLowerCase()!=="li")a=c(a).parents("li:first");var b=c(a),e=this.options.css;c("."+e.item,this.list).each(function(){this!==b[0]&&c(this).removeClass(e.selected)});if(!b.hasClass(e.selected)){b.addClass(e.selected);this.mouseover_item_hook(b)}}},mouseover_item_hook:function(){},hoverover_list:function(){},hoverout_list:function(){},check_response:function(){return true},response_hook:function(){this.list.empty()},show_hook:function(){this.status_select()},position:function(){var a=
if(a==="")this.status_start();else{this.status_loading();this.request(a)}},request:function(){},response:function(a){if(a){"cost"in a&&this.trackEvent(this.name,"response","cost",a.cost);if(this.check_response(a)){var b=[];if(c.isArray(a))b=a;else if("result"in a)b=a.result;var e=c.map(arguments,function(f){return f});this.response_hook.apply(this,e);var i=null,d=this,g=this.options;c.each(b,function(f,j){j=d.create_item(j,a).bind("mouseover.suggest",function(l){d.mouseover_item(l)}).data("data.suggest",
j);d.list.append(j);if(f===0)i=j});this.input.data("original.suggest",this.input.val());c("."+g.css.item,this.list).length===0&&g.nomatch&&this.list.append(c('<li class="fbs-nomatch">').html(g.nomatch).bind("click.suggest",function(f){f.stopPropagation()}));e.push(i);this.show_hook.apply(this,e);this.position();this.pane_show()}}},pane_show:function(){var a=false;if(c("> li",this.list).length)a=true;a||this.pane.children(":not(."+this.options.css.list+")").each(function(){if(c(this).css("display")!=
"none"){a=true;return false}});if(a)if(this.options.animate){var b=this;this.pane.slideDown("fast",function(){b.input.trigger("fb-pane-show",b)})}else{this.pane.show();this.input.trigger("fb-pane-show",this)}else{this.pane.hide();this.input.trigger("fb-pane-hide",this)}},create_item:function(a){var b=this.options.css;li=c("<li>").addClass(b.item);var e=c("<label>").text(a.name);a.name=e.text();li.append(c("<div>").addClass(b.item_name).append(e));return li},mouseover_item:function(a){if(!this._ignore_mouseover){a=
a.target;if(a.nodeName.toLowerCase()!=="li")a=c(a).parents("li:first");var b=c(a),e=this.options.css;c("."+e.item,this.list).each(function(){this!==b[0]&&c(this).removeClass(e.selected)});if(!b.hasClass(e.selected)){b.addClass(e.selected);this.mouseover_item_hook(b)}}},mouseover_item_hook:function(){},hoverover_list:function(){},hoverout_list:function(){},check_response:function(){return true},response_hook:function(){this.list.empty()},show_hook:function(){this.status_select()},position:function(){var a=
this.pane,b=this.options;if(!b.parent){if(!self._position){var e=this.input,i=e.offset(),d=e.outerWidth(true),g=e.outerHeight(true);i.top+=g;var f=a.outerWidth(),j=a.outerHeight(),l=i.top+j/2,h=c(window).scrollLeft();e=c(window).scrollTop();var k=c(window).width(),m=c(window).height()+e,o=true;if("left"==b.align)o=true;else if("right"==b.align)o=false;else if(i.left>h+k/2)o=false;if(!o){o=i.left-(f-d);if(o>h)i.left=o}if(l>m){b=i.top-g-j;if(b>e)i.top=b}this._position=i}a.css({top:this._position.top,
left:this._position.left})}},ignore_mouseover:function(){this._ignore_mouseover=true;var a=this;this.ignore_mouseover.timeout=setTimeout(function(){a.ignore_mouseover_reset()},1E3)},ignore_mouseover_reset:function(){this._ignore_mouseover=false},get_selected:function(){var a=null,b=this.options.css.selected;c("li",this.list).each(function(){var e=c(this);if(e.hasClass(b)&&e.is(":visible")){a=e;return false}});return a},onselect:function(a){var b=a.data("data.suggest");if(b){this.input.val(b.name).data("data.suggest",
b).trigger("fb-select",b);this.trackEvent(this.name,"fb-select","index",a.prevAll().length)}},trackEvent:function(a,b,e,i){this.input.trigger("fb-track-event",{category:a,action:b,label:e,value:i})},check_required:function(a){var b=this.options.required;if(b===true){b=this.input.val();if(!(b===""||b===this.input.attr("placeholder"))){this.input.trigger("fb-required",{domEvent:a});return false}}else if(b==="always"){this.input.trigger("fb-required",{domEvent:a});return false}return true},hide_all:function(){this.pane.hide();
@ -78,4 +78,4 @@ r=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u20
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){d=eval("("+d+")");return typeof g==="function"?f({"":d},""):d}throw new SyntaxError("JSON.parse");}})();
jQuery.suggest.version='Version:r94143M Built:Thu Apr 29 2010 by daepark';
jQuery.suggest.version='Version:r94764M Built:Tue May 11 2010 by daepark';

View File

@ -39,6 +39,7 @@ DialogSystem.dismissUntil = function(level) {
var layer = DialogSystem._layers[i];
layer.overlay.remove();
layer.container.remove();
layer.container.unbind();
if (layer.onCancel) {
try {

View File

@ -36,6 +36,7 @@ MenuSystem.dismissUntil = function(level) {
for (var i = MenuSystem._layers.length - 1; i >= level; i--) {
var layer = MenuSystem._layers[i];
layer.elmt.remove();
layer.elmt.unbind();
layer.onDismiss();
}
MenuSystem._layers = MenuSystem._layers.slice(0, level);

View File

@ -257,6 +257,12 @@ DataTableCellUI.prototype._searchForMatch = function(suggestOptions) {
var self = this;
var frame = $(DOM.loadHTML("core", "scripts/views/data-table/cell-recon-search-for-match.html"));
var elmts = DOM.bind(frame);
var level = DialogSystem.showDialog(frame);
var dismiss = function() {
DialogSystem.dismissUntil(level - 1);
};
elmts.cellTextSpan.text(this._cell.v);
var match = null;
@ -299,9 +305,6 @@ DataTableCellUI.prototype._searchForMatch = function(suggestOptions) {
elmts.newButton.click(commitNew);
elmts.cancelButton.click(dismiss);
var level = DialogSystem.showDialog(frame);
var dismiss = function() { DialogSystem.dismissUntil(level - 1); };
var suggestOptions2 = $.extend({ align: "left" }, suggestOptions || { all_types: true });
elmts.input
.attr("value", this._cell.v)