nnnjjj123
2020-11-17 1b2c1edb61190eeb19f465ff031eaa3b2a1b8dbc
1
2
3
4
5
6
7
8
9
10
11
12
//>>built
define("dojo/_base/kernel dojo/_base/lang dojo/_base/declare dojo/_base/query dojo/dom-construct dojo/io/script".split(" "),function(l,m,c,y,z,A){l.experimental("dojox.data.GoogleSearchStore");var d=c("dojox.data.GoogleSearchStore",null,{constructor:function(a){a&&(a.label&&(this.label=a.label),a.key&&(this._key=a.key),a.lang&&(this._lang=a.lang),"urlPreventCache"in a&&(this.urlPreventCache=a.urlPreventCache?!0:!1));this._id=dojox.data.GoogleSearchStore.prototype._id++},_id:0,_requestCount:0,_googleUrl:"http://ajax.googleapis.com/ajax/services/search/",
_storeRef:"_S",_attributes:"unescapedUrl url visibleUrl cacheUrl title titleNoFormatting content estimatedResultCount".split(" "),_aggregatedAttributes:{estimatedResultCount:"cursor.estimatedResultCount"},label:"titleNoFormatting",_type:"web",urlPreventCache:!0,_queryAttrs:{text:"q"},_assertIsItem:function(a){if(!this.isItem(a))throw Error("dojox.data.GoogleSearchStore: a function was passed an item argument that was not an item");},_assertIsAttribute:function(a){if("string"!==typeof a)throw Error("dojox.data.GoogleSearchStore: a function was passed an attribute argument that was not an attribute name string");
},getFeatures:function(){return{"dojo.data.api.Read":!0}},getValue:function(a,b,g){return(a=this.getValues(a,b))&&0<a.length?a[0]:g},getAttributes:function(a){return this._attributes},hasAttribute:function(a,b){return this.getValue(a,b)?!0:!1},isItemLoaded:function(a){return this.isItem(a)},loadItem:function(a){},getLabel:function(a){return this.getValue(a,this.label)},getLabelAttributes:function(a){return[this.label]},containsValue:function(a,b,g){a=this.getValues(a,b);for(b=0;b<a.length;b++)if(a[b]===
g)return!0;return!1},getValues:function(a,b){this._assertIsItem(a);this._assertIsAttribute(b);a=a[b];return m.isArray(a)?a:void 0!==a?[a]:[]},isItem:function(a){return a&&a[this._storeRef]===this?!0:!1},close:function(a){},_format:function(a,b){return a},fetch:function(a){function b(b){w++;r.content.context=r.content.start=b.start;b=A.get(r);t.push(b.ioArgs.id);b.addErrback(function(b){a.onError&&a.onError.call(g,b,a)})}a=a||{};var g=a.scope||l.global;if(!a.query&&a.onError)a.onError.call(g,Error(this.declaredClass+
": A query must be specified."));else{var c={},d;for(d in this._queryAttrs)c[d]=a.query[d];a={query:c,onComplete:a.onComplete,onError:a.onError,onItem:a.onItem,onBegin:a.onBegin,start:a.start,count:a.count};var p="GoogleSearchStoreCallback_"+this._id+"_"+ ++this._requestCount,c=this._createContent(c,p,a);if("undefined"===typeof a.start||null===a.start)a.start=0;a.count||(a.count=8);d={start:a.start-a.start%8};var u=this,r={url:this._googleUrl+this._type,preventCache:this.urlPreventCache,content:c},
k=[],v=0,m=!1,n=a.start-1,w=0,t=[],x=function(c,d){0<t.length&&y("#"+t.splice(0,1)).forEach(z.destroy);if(!m){var h=u._getItems(d),f=d?d.cursor:null;if(h){for(var e=0;e<h.length&&e+c<a.count+a.start;e++)u._processItem(h[e],d),k[e+c]=h[e];v++;if(1==v)for(d=(c=f?f.pages:null)?Number(c[c.length-1].start):0,a.onBegin&&(f=f?f.estimatedResultCount:h.length,a.onBegin.call(g,f?Math.min(f,d+h.length):d+h.length,a)),h=a.start-a.start%8+8,f=1;c&&c[f]&&!(Number(c[f].start)>=a.start+a.count);)Number(c[f].start)>=
h&&b({start:c[f].start}),f++;if(a.onItem&&k[n+1]){do n++,a.onItem.call(g,k[n],a);while(k[n+1]&&n<a.start+a.count)}v==w&&(m=!0,l.global[p]=null,a.onItem?a.onComplete.call(g,null,a):(k=k.slice(a.start,a.start+a.count),a.onComplete.call(g,k,a)))}}},e=[],q=d.start-1;l.global[p]=function(b,c,d,f){try{if(200!=d)a.onError&&a.onError.call(g,Error("Response from Google was: "+d),a),l.global[p]=function(){};else if(b==q+1){if(x(Number(b),c),q+=8,0<e.length)for(e.sort(u._getSort());0<e.length&&e[0].start==q+
1;)x(Number(e[0].start),e[0].data),e.splice(0,1),q+=8}else e.push({start:b,data:c})}catch(B){a.onError.call(g,B,a)}};b(d)}},_getSort:function(){return function(a,b){return a.start<b.start?-1:b.start<a.start?1:0}},_processItem:function(a,b){a[this._storeRef]=this;for(var c in this._aggregatedAttributes)a[c]=m.getObject(this._aggregatedAttributes[c],!1,b)},_getItems:function(a){return a.results||a},_createContent:function(a,b,c){b={v:"1.0",rsz:"large",callback:b,key:this._key,hl:this._lang};for(var d in this._queryAttrs)b[this._queryAttrs[d]]=
a[d];return b}}),C=c("dojox.data.GoogleWebSearchStore",d,{}),D=c("dojox.data.GoogleBlogSearchStore",d,{_type:"blogs",_attributes:"blogUrl postUrl title titleNoFormatting content author publishedDate".split(" "),_aggregatedAttributes:{}}),E=c("dojox.data.GoogleLocalSearchStore",d,{_type:"local",_attributes:"title titleNoFormatting url lat lng streetAddress city region country phoneNumbers ddUrl ddUrlToHere ddUrlFromHere staticMapUrl viewport".split(" "),_aggregatedAttributes:{viewport:"viewport"},
_queryAttrs:{text:"q",centerLatLong:"sll",searchSpan:"sspn"}}),F=c("dojox.data.GoogleVideoSearchStore",d,{_type:"video",_attributes:"title titleNoFormatting content url published publisher duration tbWidth tbHeight tbUrl playUrl".split(" "),_aggregatedAttributes:{}}),G=c("dojox.data.GoogleNewsSearchStore",d,{_type:"news",_attributes:"title titleNoFormatting content url unescapedUrl publisher clusterUrl location publishedDate relatedStories".split(" "),_aggregatedAttributes:{}}),H=c("dojox.data.GoogleBookSearchStore",
d,{_type:"books",_attributes:"title titleNoFormatting authors url unescapedUrl bookId pageCount publishedYear".split(" "),_aggregatedAttributes:{}});c=c("dojox.data.GoogleImageSearchStore",d,{_type:"images",_attributes:"title titleNoFormatting visibleUrl url unescapedUrl originalContextUrl width height tbWidth tbHeight tbUrl content contentNoFormatting".split(" "),_aggregatedAttributes:{}});return{Search:d,ImageSearch:c,BookSearch:H,NewsSearch:G,VideoSearch:F,LocalSearch:E,BlogSearch:D,WebSearch:C}});