81 lines
24 KiB
JavaScript
81 lines
24 KiB
JavaScript
|
/******************************************************************************
|
||
|
* All source and examples in this project are subject to the
|
||
|
* following copyright, unless specifically stated otherwise
|
||
|
* in the file itself:
|
||
|
*
|
||
|
* Copyright (c) 2007-2009, Metaweb Technologies, Inc.
|
||
|
* All rights reserved.
|
||
|
*
|
||
|
* Redistribution and use in source and binary forms, with or without
|
||
|
* modification, are permitted provided that the following conditions
|
||
|
* are met:
|
||
|
* * Redistributions of source code must retain the above copyright
|
||
|
* notice, this list of conditions and the following disclaimer.
|
||
|
* * Redistributions in binary form must reproduce the above
|
||
|
* copyright notice, this list of conditions and the following
|
||
|
* disclaimer in the documentation and/or other materials provided
|
||
|
* with the distribution.
|
||
|
*
|
||
|
* THIS SOFTWARE IS PROVIDED BY METAWEB TECHNOLOGIES ``AS IS'' AND ANY
|
||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL METAWEB TECHNOLOGIES BE
|
||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||
|
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
|
*****************************************************************************/
|
||
|
|
||
|
|
||
|
(function(c,q){if(!("console"in window)){var n=window.console={};n.log=n.warn=n.error=n.debug=function(){}}c.suggest=function(a,b){c.fn[a]=function(e){this.length||console.warn("Suggest: invoked on empty element set");return this.each(function(){if(this.nodeName)if(this.nodeName.toUpperCase()==="INPUT")this.type&&this.type.toUpperCase()!=="TEXT"&&console.warn("Suggest: unsupported INPUT type: "+this.type);else console.warn("Suggest: unsupported DOM element: "+this.nodeName);var i=c.data(this,a);i&&
|
||
|
i._destroy();c.data(this,a,new c.suggest[a](this,e))._init()})};c.suggest[a]=function(e,i){var d=this,g=this.options=c.extend(true,{},c.suggest.defaults,c.suggest[a].defaults,i),f=g.css_prefix=g.css_prefix||"",j=g.css;this.name=a;c.each(j,function(h){j[h]=f+j[h]});g.ac_param={};c.each(["type","type_strict","mql_filter","as_of_time","exclude_guids","category","all_types"],function(h,k){h=g[k];if(!(h===null||h==="")){if(typeof h==="object")h=JSON.stringify(h);g.ac_param[k]=h}});if(g.ac_param.type)this.options._type=
|
||
|
c.map(g.ac_param.type.split(/[, ]/),function(h){return h.replace(/[\"\[\]]/g,"")});this._status={START:"",LOADING:"",SELECT:"",ERROR:""};if(g.status&&g.status instanceof Array&&g.status.length>=3){this._status.START=g.status[0]||"";this._status.LOADING=g.status[1]||"";this._status.SELECT=g.status[2]||"";if(g.status.length===4)this._status.ERROR=g.status[3]||""}i=this.status=c('<div style="display:none;">').addClass(j.status);var l=this.list=c("<ul>").addClass(j.list);f=this.pane=c('<div style="display:none;" class="fbs-reset">').addClass(j.pane);
|
||
|
f.append(i).append(l);if(g.parent)c(g.parent).append(f);else{f.css("position","absolute");g.zIndex&&f.css("z-index",g.zIndex);c(document.body).append(f)}f.bind("mousedown",function(h){d.input.data("dont_hide",true);h.stopPropagation()}).bind("mouseup",function(h){d.input.data("dont_hide")&&d.input.focus();d.input.removeData("dont_hide");h.stopPropagation()}).bind("click",function(h){h.stopPropagation();if(h=d.get_selected()){d.onselect(h,true);d.hide_all()}});l.hover(function(h){d.hoverover_list(h)},
|
||
|
function(h){d.hoverout_list(h)});this.input=c(e).attr("autocomplete","off").unbind(".suggest").bind("keydown.suggest",function(h){d.keydown(h)}).bind("keypress.suggest",function(h){d.keypress(h)}).bind("keyup.suggest",function(h){d.keyup(h)}).bind("blur.suggest",function(h){d.blur(h)}).bind("textchange.suggest",function(){d.textchange()}).bind("focus.suggest",function(h){d.focus(h)}).bind(c.browser.msie?"paste.suggest":"input.suggest",function(){clearTimeout(d.paste_timeout);d.paste_timeout=setTimeout(function(){d.textchange()},
|
||
|
0)});this.input.placeholder();this.onresize=function(){d.invalidate_position();if(f.is(":visible")){d.position();if(g.flyout&&d.flyoutpane&&d.flyoutpane.is(":visible")){var h=d.get_selected();h&&d.flyout_position(h)}}};c(window).bind("resize.suggest",this.onresize).bind("scroll.suggest",this.onresize)};c.suggest[a].prototype=c.extend({},c.suggest.prototype,b)};c.suggest.prototype={_init:function(){},_destroy:function(){this.pane.remove();this.list.remove();this.input.unbind(".suggest");c(window).unbind("resize.suggest",
|
||
|
this.onresize).unbind("scroll.suggest",this.onresize);this.input.removeData("data.suggest")},invalidate_position:function(){self._position=null},status_start:function(){this.hide_all();this.status.siblings().hide();if(this._status.START){this.status.text(this._status.START).show();if(!this.pane.is(":visible")){this.position();this.pane_show()}}this._status.LOADING&&this.status.removeClass("loading")},status_loading:function(){this.status.siblings().show();if(this._status.LOADING){this.status.addClass("loading").text(this._status.LOADING).show();
|
||
|
if(!this.pane.is(":visible")){this.position();this.pane_show()}}else this.status.hide()},status_select:function(){this.status.siblings().show();this._status.SELECT?this.status.text(this._status.SELECT).show():this.status.hide();this._status.LOADING&&this.status.removeClass("loading")},status_error:function(){this.status.siblings().show();this._status.ERROR?this.status.text(this._status.ERROR).show():this.status.hide();this._status.LOADING&&this.status.removeClass("loading")},focus:function(a){var b=
|
||
|
this.input.val();b===""||b===this.input.attr("placeholder")?this.status_start():this.focus_hook(a)},focus_hook:function(){if(!this.input.data("data.suggest")&&!this.pane.is(":visible")&&c("."+this.options.css.item,this.list).length){this.position();this.pane_show()}},keydown:function(a){var b=a.keyCode;if(b===9)this.tab(a);else if(b===38||b===40)a.shiftKey||a.preventDefault()},keypress:function(a){var b=a.keyCode;if(b===38||b===40)a.shiftKey||a.preventDefault();else b===13&&this.enter(a)},keyup:function(a){var b=
|
||
|
a.keyCode;if(b===38){a.preventDefault();this.up(a)}else if(b===40){a.preventDefault();this.down(a)}else if(a.ctrlKey&&b===77)c(".fbs-more-link",this.pane).click();else if(c.suggest.is_char(a)){clearTimeout(this.keypress.timeout);var e=this;this.keypress.timeout=setTimeout(function(){e.textchange()},0)}else b===27&&this.escape(a);return true},blur:function(a){if(!this.input.data("dont_hide")){this.input.data("data.suggest")||this.check_required(a);this.hide_all()}},tab:function(a){if(!(a.shiftKey||
|
||
|
a.metaKey||a.ctrlKey)){a=this.options;a=this.pane.is(":visible")&&c("."+a.css.item,this.list).length;var b=this.get_selected();if(a&&b){this.onselect(b);this.hide_all()}}},enter:function(a){var b=this.options;if(this.pane.is(":visible"))if(a.shiftKey){this.shift_enter(a);a.preventDefault()}else if(c("."+b.css.item,this.list).length){var e=this.get_selected();if(e){this.onselect(e);this.hide_all();a.preventDefault()}else{e=this.input.data("data.suggest");if(b.soft)e||this.check_required(a);else if(c("."+
|
||
|
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=
|
||
|
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();
|
||
|
this.input.trigger("fb-pane-hide",this)}};c.extend(c.suggest,{defaults:{status:["Start typing to get suggestions...","Searching...","Select an item from the list:","Sorry, something went wrong. Please try again later"],required:false,soft:false,nomatch:"no matches",css:{pane:"fbs-pane",list:"fbs-list",item:"fbs-item",item_name:"fbs-item-name",selected:"fbs-selected",status:"fbs-status"},css_prefix:null,parent:null,animate:false,zIndex:null},$$:function(a,b){return c("."+a,b)},use_jsonp:function(a){if(!a)return false;
|
||
|
var b=window.location.href;b=b.substr(0,b.length-window.location.pathname.length);if(b===a)return false;return true},strongify:function(a,b){var e=a,i=a.toLowerCase().indexOf(b.toLowerCase());if(i>=0){b=b.length;e=c("<div>").text(a.substring(0,i)).append(c("<strong>").text(a.substring(i,i+b))).append(document.createTextNode(a.substring(i+b))).html()}return e},keyCode:{CAPS_LOCK:20,CONTROL:17,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ENTER:108,PAGE_DOWN:34,PAGE_UP:33,RIGHT:39,
|
||
|
SHIFT:16,SPACE:32,TAB:9,UP:38,OPTION:18,APPLE:224},is_char:function(a){if(a.type==="keypress")if((a.metaKey||a.ctrlKey)&&a.charCode===118)return true;else{if("isChar"in a)return a.isChar}else{var b=c.suggest.keyCode.not_char;if(!b){b={};c.each(c.suggest.keyCode,function(e,i){b[""+i]=1});c.suggest.keyCode.not_char=b}return!(""+a.keyCode in b)}}});var p={_destroy:c.suggest.prototype._destroy,show_hook:c.suggest.prototype.show_hook};c.suggest("suggest",{_init:function(){var a=this,b=this.options;if(!b.flyout_service_url)b.flyout_service_url=
|
||
|
b.service_url;this.jsonp=c.suggest.use_jsonp(b.service_url);if(!c.suggest.cache)c.suggest.cache={};if(b.flyout){this.flyoutpane=c('<div style="display:none;" class="fbs-reset">').addClass(b.css.flyoutpane);if(b.flyout_parent)c(b.flyout_parent).append(this.flyoutpane);else{this.flyoutpane.css("position","absolute");b.zIndex&&this.flyoutpane.css("z-index",b.zIndex);c(document.body).append(this.flyoutpane)}this.flyoutpane.hover(function(e){a.hoverover_list(e)},function(e){a.hoverout_list(e)}).bind("mousedown.suggest",
|
||
|
function(e){e.stopPropagation();a.pane.click()});if(!c.suggest.flyout)c.suggest.flyout={};if(!c.suggest.flyout.cache)c.suggest.flyout.cache={}}},_destroy:function(){p._destroy.call(this);this.flyoutpane&&this.flyoutpane.remove();this.input.removeData("request.count.suggest");this.input.removeData("flyout.request.count.suggest")},shift_enter:function(a){if(this.options.suggest_new){this.suggest_new();this.hide_all()}else this.check_required(a)},hide_all:function(){this.pane.hide();this.flyoutpane&&
|
||
|
this.flyoutpane.hide();this.input.trigger("fb-pane-hide",this);this.input.trigger("fb-flyoutpane-hide",this)},request:function(a,b){var e=this,i=this.options;if(this.ac_xhr){this.ac_xhr.abort();this.ac_xhr=null}a={prefix:a};if(b)a.start=b;c.extend(a,i.ac_param);var d=i.service_url+i.service_path+"?"+c.param(a),g=c.suggest.cache[d];if(g)this.response(g,b?b:-1,true);else{clearTimeout(this.request.timeout);var f={url:i.service_url+i.service_path,data:a,beforeSend:function(){var j=e.input.data("request.count.suggest")||
|
||
|
0;j||e.trackEvent(e.name,"start_session");j+=1;e.trackEvent(e.name,"request","count",j);e.input.data("request.count.suggest",j)},success:function(j){c.suggest.cache[d]=j;e.response(j,b?b:-1)},error:function(j){e.status_error();e.trackEvent(e.name,"request","error",{url:this.url,response:j?j.responseText:""});e.input.trigger("fb-error",Array.prototype.slice.call(arguments))},complete:function(j){j&&e.trackEvent(e.name,"request","tid",j.getResponseHeader("X-Metaweb-TID"))},dataType:e.jsonp?"jsonp":
|
||
|
"json",cache:true};this.request.timeout=setTimeout(function(){e.ac_xhr=c.ajax(f)},i.xhr_delay)}},create_item:function(a,b){var e=this.options.css,i=c("<li>").addClass(e.item);b=c("<div>").addClass(e.item_name).append(c("<label>").append(c.suggest.strongify(a.name||a.guid,b.prefix)));a.name=b.text();i.append(b);var d=a["n:type"]||a["notable:type"];if(d)if(typeof d==="object")b.prepend(c("<div>").addClass(e.item_type).text(d.name));else{var g,f,j=false;c.each(a.type,function(l,h){if(h.id===d)g=h.name;
|
||
|
if(h.id==="/common/topic")j="Topic";else if(!f)f=h.name});if(g||f||j)b.prepend(c("<div>").addClass(e.item_type).text(g||f||j))}return i},mouseover_item_hook:function(a){a=a.data("data.suggest");this.options.flyout&&a&&this.flyout_request(a)},check_response:function(a){return a.prefix===this.input.val()},response_hook:function(a,b){this.flyoutpane&&this.flyoutpane.hide();b>0?c(".fbs-more",this.pane).remove():this.list.empty()},show_hook:function(a,b,e){p.show_hook.apply(this,[a]);var i=this.options,
|
||
|
d=this,g=this.pane,f=this.list,j=a.result,l=c(".fbs-more",g),h=c(".fbs-suggestnew",g);if(j&&j.length&&"start"in a){if(!l.length){j=c('<a class="fbs-more-link" href="#" title="(Ctrl+m)">view more</a>');l=c('<div class="fbs-more">').append(j);j.bind("click.suggest",function(k){k.preventDefault();k.stopPropagation();k=c(this).parent(".fbs-more");d.more(k.data("start.suggest"))});f.after(l)}l.data("start.suggest",a.start);l.show()}else l.remove();if(i.suggest_new){if(!h.length){a=c('<button class="fbs-suggestnew-button">');
|
||
|
a.text(i.suggest_new);h=c('<div class="fbs-suggestnew">').append('<div class="fbs-suggestnew-description">Your item not in the list?</div>').append(a).append('<span class="fbs-suggestnew-shortcut">(Shift+Enter)</span>').bind("click.suggest",function(k){k.stopPropagation();d.suggest_new(k)});g.append(h)}h.show()}else h.remove();if(e&&e.length&&b>0){b=e.prevAll().length*e.outerHeight();f.scrollTop();f.animate({scrollTop:b},"slow",function(){e.trigger("mouseover.suggest")})}},suggest_new:function(){var a=
|
||
|
this.input.val();if(!(a===""||a===this.input.attr("placeholder"))){this.input.data("data.suggest",a).trigger("fb-select-new",a);this.trackEvent(this.name,"fb-select-new","index","new");this.hide_all()}},more:function(a){if(a){var b=this.input.data("original.suggest");b!==null&&this.input.val(b);this.request(this.input.val(),a);this.trackEvent(this.name,"more","start",a)}return false},flyout_request:function(a){var b=this;if(this.flyout_xhr){this.flyout_xhr.abort();this.flyout_xhr=null}var e=this.options,
|
||
|
i=this.flyoutpane.data("data.suggest");if(i&&a.id===i.id){if(!this.flyoutpane.is(":visible")){this.flyout_position(this.get_selected());this.flyoutpane.show();this.input.trigger("fb-flyoutpane-show",this)}}else if(i=c.suggest.flyout.cache[a.id])this.flyout_response(i);else{var d={id:a.id};if(e.as_of_time)d.as_of_time=e.as_of_time;var g={url:e.flyout_service_url+e.flyout_service_path,data:d,beforeSend:function(){var f=b.input.data("flyout.request.count.suggest")||0;f+=1;b.trackEvent(b.name,"flyout.request",
|
||
|
"count",f);b.input.data("flyout.request.count.suggest",f)},success:function(f){f=b.jsonp?f:{id:d.id,html:f};c.suggest.flyout.cache[f.id]=f;b.flyout_response(f)},error:function(f){b.trackEvent(b.name,"flyout","error",{url:this.url,response:f?f.responseText:""})},complete:function(f){f&&b.trackEvent(b.name,"flyout","tid",f.getResponseHeader("X-Metaweb-TID"))},dataType:b.jsonp?"jsonp":"html",cache:true};clearTimeout(this.flyout_request.timeout);this.flyout_request.timeout=setTimeout(function(){b.flyout_xhr=
|
||
|
c.ajax(g)},e.xhr_delay)}},flyout_response:function(a){var b=this.pane,e=this.get_selected()||[];if(b.is(":visible")&&e.length)if((b=e.data("data.suggest"))&&a.id===b.id){this.flyoutpane.html(a.html);this.flyout_position(e);this.flyoutpane.show().data("data.suggest",b);this.input.trigger("fb-flyoutpane-show",this)}},flyout_position:function(a){if(!this.options.flyout_parent){var b=this.pane,e=this.flyoutpane,i=this.options.css,d=q,g={top:parseInt(e.css("top"),10),left:parseInt(e.css("left"),10)},f=
|
||
|
b.offset(),j=b.outerWidth(),l=e.outerHeight(),h=e.outerWidth();if(this.options.flyout==="bottom"){d=f;j=this.input.offset();if(f.top<j.top)d.top-=l;else d.top+=b.outerHeight();e.addClass(i.flyoutpane+"-bottom")}else{d=a.offset();a=a.outerHeight();d.left+=j;var k=d.left+h;b=c(document.body).scrollLeft();var m=c(window).width()+b;d.top=d.top+a-l;if(d.top<f.top)d.top=f.top;if(k>m){f=d.left-(j+h);if(f>b)d.left=f}e.removeClass(i.flyoutpane+"-bottom")}d.top===g.top&&d.left===g.left||e.css({top:d.top,left:d.left})}},
|
||
|
hoverout_list:function(){this.flyoutpane&&!this.get_selected()&&this.flyoutpane.hide()}});c.extend(c.suggest.suggest,{defaults:{type:null,type_strict:"any",mql_filter:null,as_of_time:null,service_url:"http://www.freebase.com",service_path:"/private/suggest",align:null,flyout:true,flyout_service_url:null,flyout_service_path:"/private/flyout",flyout_parent:null,suggest_new:null,nomatch:'<em class="fbs-nomatch-text">No suggested matches.</em><h3>Tips on getting better suggestions:</h3><ul class="fbs-search-tips"><li>Enter more or fewer characters</li><li>Add words related to your original search</li><li>Try alternate spellings</li><li>Check your spelling</li></ul>',
|
||
|
css:{item_type:"fbs-item-type",flyoutpane:"fbs-flyout-pane"},xhr_delay:200,all_types:false}});var r=document.createElement("input");c.fn.placeholder=function(){return this.each(function(){var a=c(this);if(a.attr("placeholder")&&!("placeholder"in r)){a.unbind(".placeholder").bind("focus.placeholder",function(){var b=c(this);b.val()===b.attr("placeholder")?b.val(""):b.select();b.removeClass("fbs-placeholder")}).bind("blur.placeholder",function(){var b=c(this);b.val()===""&&b.val(b.attr("placeholder")).addClass("fbs-placeholder")});
|
||
|
a.val()===""&&a.val(a.attr("placeholder")).addClass("fbs-placeholder")}})}})(jQuery);"JSON"in window&&window.JSON||(JSON={});
|
||
|
(function(){function c(d){return d<10?"0"+d:d}function q(d){r.lastIndex=0;return r.test(d)?'"'+d.replace(r,function(g){var f=e[g];return typeof f==="string"?f:"\\u"+("0000"+g.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+d+'"'}function n(d,g){var f,j,l=a,h,k=g[d];if(k&&typeof k==="object"&&typeof k.toJSON==="function")k=k.toJSON(d);if(typeof i==="function")k=i.call(g,d,k);switch(typeof k){case "string":return q(k);case "number":return isFinite(k)?String(k):"null";case "boolean":case "null":return String(k);
|
||
|
case "object":if(!k)return"null";a+=b;h=[];if(Object.prototype.toString.apply(k)==="[object Array]"){j=k.length;for(d=0;d<j;d+=1)h[d]=n(d,k)||"null";g=h.length===0?"[]":a?"[\n"+a+h.join(",\n"+a)+"\n"+l+"]":"["+h.join(",")+"]";a=l;return g}if(i&&typeof i==="object"){j=i.length;for(d=0;d<j;d+=1){f=i[d];if(typeof f==="string")if(g=n(f,k))h.push(q(f)+(a?": ":":")+g)}}else for(f in k)if(Object.hasOwnProperty.call(k,f))if(g=n(f,k))h.push(q(f)+(a?": ":":")+g);g=h.length===0?"{}":a?"{\n"+a+h.join(",\n"+a)+
|
||
|
"\n"+l+"}":"{"+h.join(",")+"}";a=l;return g}}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return this.getUTCFullYear()+"-"+c(this.getUTCMonth()+1)+"-"+c(this.getUTCDate())+"T"+c(this.getUTCHours())+":"+c(this.getUTCMinutes())+":"+c(this.getUTCSeconds())+"Z"};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var p=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||
|
r=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,a,b,e={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},i;if(typeof JSON.stringify!=="function")JSON.stringify=function(d,g,f){var j;b=a="";if(typeof f==="number")for(j=0;j<f;j+=1)b+=" ";else if(typeof f==="string")b=f;if((i=g)&&typeof g!=="function"&&(typeof g!=="object"||typeof g.length!=="number"))throw new Error("JSON.stringify");return n("",
|
||
|
{"":d})};if(typeof JSON.parse!=="function")JSON.parse=function(d,g){function f(j,l){var h,k,m=j[l];if(m&&typeof m==="object")for(h in m)if(Object.hasOwnProperty.call(m,h)){k=f(m,h);if(k!==undefined)m[h]=k;else delete m[h]}return g.call(j,l,m)}p.lastIndex=0;if(p.test(d))d=d.replace(p,function(j){return"\\u"+("0000"+j.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(d.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
|
||
|
"]").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';
|