").append(b.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){b.fn[t]=function(e){return this.on(t,e)}}),b.each(["get","post"],function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Nn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Mn(Mn(e,b.ajaxSettings),t):Mn(b.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,u,l,c,p=b.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?b(f):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=p.statusCode||{},y={},v={},x=0,T="canceled",N={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else N.always(e[N.status]);return this},abort:function(e){var t=e||T;return l&&l.abort(t),k(0,t),this}};if(h.promise(N).complete=g.add,N.success=N.done,N.error=N.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=b.trim(p.dataType||"*").toLowerCase().match(w)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?80:443))==(mn[3]||("http:"===mn[1]?80:443)))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=b.param(p.data,p.traditional)),qn(An,p,n,N),2===x)return N;u=p.global,u&&0===b.active++&&b.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Cn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(b.lastModified[o]&&N.setRequestHeader("If-Modified-Since",b.lastModified[o]),b.etag[o]&&N.setRequestHeader("If-None-Match",b.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&N.setRequestHeader("Content-Type",p.contentType),N.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)N.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,N,p)===!1||2===x))return N.abort();T="abort";for(i in{success:1,error:1,complete:1})N[i](p[i]);if(l=qn(jn,p,n,N)){N.readyState=1,u&&d.trigger("ajaxSend",[N,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){N.abort("timeout")},p.timeout));try{x=1,l.send(y,k)}catch(C){if(!(2>x))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t,a=i||"",N.readyState=e>0?4:0,r&&(w=_n(p,N,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=N.getResponseHeader("Last-Modified"),T&&(b.lastModified[o]=T),T=N.getResponseHeader("etag"),T&&(b.etag[o]=T)),204===e?(c=!0,C="nocontent"):304===e?(c=!0,C="notmodified"):(c=Fn(p,w),C=c.state,y=c.data,v=c.error,c=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),N.status=e,N.statusText=(n||C)+"",c?h.resolveWith(f,[y,C,N]):h.rejectWith(f,[N,C,v]),N.statusCode(m),m=t,u&&d.trigger(c?"ajaxSuccess":"ajaxError",[N,p,c?y:v]),g.fireWith(f,[N,C]),u&&(d.trigger("ajaxComplete",[N,p]),--b.active||b.event.trigger("ajaxStop")))}return N},getScript:function(e,n){return b.get(e,t,n,"script")},getJSON:function(e,t,n){return b.get(e,t,n,"json")}});function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(s in c)s in r&&(n[c[s]]=r[s]);while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(;r=u[++s];)if("*"!==r){if("*"!==l&&l!==r){if(i=a[l+" "+r]||a["* "+r],!i)for(n in a)if(o=n.split(" "),o[1]===r&&(i=a[l+" "+o[0]]||a["* "+o[0]])){i===!0?i=a[n]:a[n]!==!0&&(r=o[0],u.splice(s--,0,r));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+l+" to "+r}}}l=r}return{state:"success",data:t}}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),b.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||b("head")[0]||o.documentElement;return{send:function(t,i){n=o.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var On=[],Bn=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=On.pop()||b.expando+"_"+vn++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||b.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,On.push(o)),s&&b.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}b.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=b.ajaxSettings.xhr(),b.support.cors=!!Rn&&"withCredentials"in Rn,Rn=b.support.ajax=!!Rn,Rn&&b.ajaxTransport(function(n){if(!n.crossDomain||b.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=b.noop,$n&&delete Pn[a]),i)4!==u.readyState&&u.abort();else{p={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,l)},n.async?4===u.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},b(e).unload($n)),Pn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+x+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=Yn.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(b.cssNumber[e]?"":"px"),"px"!==r&&s){s=b.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,b.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(tr(c,l.opts.specialEasing);a>o;o++)if(r=Gn[o].call(l,e,c,l.opts))return r;return Zn(l,c),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e[i],b.isArray(n)&&(o=n[1],n=e[i]=n[0]),i!==r&&(e[r]=n,delete e[i]),a=b.cssHooks[r],a&&"expand"in a){n=a.expand(n),delete e[r];for(i in n)i in e||(e[i]=n[i],t[i]=o)}else t[r]=o}b.Animation=b.extend(er,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,u,l,c,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&nn(e);n.queue||(c=b._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,p=c.empty.fire,c.empty.fire=function(){c.unqueued||p()}),c.unqueued++,f.always(function(){f.always(function(){c.unqueued--,b.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(b.support.inlineBlockNeedsLayout&&"inline"!==un(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",b.support.shrinkWrapBlocks||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],Vn.exec(a)){if(delete t[i],u=u||"toggle"===a,a===(m?"hide":"show"))continue;g.push(i)}if(o=g.length){s=b._data(e,"fxshow")||b._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?b(e).show():f.done(function(){b(e).hide()}),f.done(function(){var t;b._removeData(e,"fxshow");for(t in h)b.style(e,t,h[t])});for(i=0;o>i;i++)r=g[i],l=f.createTween(r,m?s[r]:0),h[r]=s[r]||b.style(e,r),r in s||(s[r]=l.start,m&&(l.end=l.start,l.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}b.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?b.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),a=function(){var t=er(this,b.extend({},e),o);a.finish=function(){t.stop(!0)},(i||b._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,a=b._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&b.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=b._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,a=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}b.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=rr.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(Xn=b.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),Xn=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){Un||(Un=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(Un),Un=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,function(t){return e===t.elem}).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){b.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,b.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},b.offset={setOffset:function(e,t,n){var r=b.css(e,"position");"static"===r&&(e.style.position="relative");var i=b(e),o=i.offset(),a=b.css(e,"top"),s=b.css(e,"left"),u=("absolute"===r||"fixed"===r)&&b.inArray("auto",[a,s])>-1,l={},c={},p,f;u?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),b.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+p),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},b.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===b.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(n=e.offset()),n.top+=b.css(e[0],"borderTopWidth",!0),n.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-b.css(r,"marginTop",!0),left:t.left-n.left-b.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||o.documentElement;while(e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position"))e=e.offsetParent;return e||o.documentElement})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);b.fn[e]=function(i){return b.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?b(a).scrollLeft():o,r?o:b(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}b.each({Height:"height",Width:"width"},function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){b.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return b.access(this,function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,s):b.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=b,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return b})})(window);
\ No newline at end of file
diff --git a/html/options.html b/html/options.html
new file mode 100644
index 0000000..ea43ba6
--- /dev/null
+++ b/html/options.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
配置 | 小墨助手
+
+
+
+ 小墨助手 配置页
+
+
+
\ No newline at end of file
diff --git a/html/popup.html b/html/popup.html
new file mode 100644
index 0000000..70edac2
--- /dev/null
+++ b/html/popup.html
@@ -0,0 +1,66 @@
+
+
+
+
+
+
小墨助手
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
new file mode 100644
index 0000000..5d070cc
--- /dev/null
+++ b/manifest.json
@@ -0,0 +1 @@
+{"manifest_version":3,"name":"小墨助手","version":"1.0.0","action":{"default_icon":{"16":"resources/image/logo.png","24":"resources/image/logo.png","32":"resources/image/logo.png"},"default_title":"点击打开小墨助手 配置页面","default_popup":"html/popup.html"},"description":"便捷,易用的浏览器小助手","icons":{"16":"resources/image/logo.png","32":"resources/image/logo.png","48":"resources/image/logo.png","128":"resources/image/logo.png"},"background":{"service_worker":"background.js"},"chrome_url_overrides":{},"commands":{"_execute_action":{"suggested_key":{"default":"Alt+Comma"}},"toggle-feature-foo":{"suggested_key":{"default":"Ctrl+Shift+U","mac":"Command+Shift+U"},"description":"Toggle feature foo","global":true}},"content_scripts":[{"matches":["
","*://*/*"],"js":["scripts/advanced-search/content.js"],"css":[],"run_at":"document_start"},{"matches":["*://fanyi.qq.com/*","*://baike.baidu.com/*","*://fanyi.youdao.com/*","*://www.cnki.net/*","*://qikan.cqvip.com/*","*://lib.cqvip.com/*"],"js":["scripts/advanced-search/content-helper.js"],"run_at":"document_start"}],"content_security_policy":{},"cross_origin_embedder_policy":{},"cross_origin_opener_policy":{},"event_rules":[],"file_browser_handlers":[],"file_system_provider_capabilities":{},"host_permissions":[],"incognito":"spanning","input_components":[],"minimum_chrome_version":"107","omnibox":{"keyword":"ss"},"optional_host_permissions":[],"optional_permissions":[],"options_page":"html/options.html","options_ui":{},"permissions":["commands","bookmarks","contextMenus","storage","webNavigation"],"requirements":{},"sandbox":{},"storage":{},"tts_engine":{},"version_name":"1.0 beta","web_accessible_resources":[]}
\ No newline at end of file
diff --git a/nodemon.json b/nodemon.json
new file mode 100644
index 0000000..243aad9
--- /dev/null
+++ b/nodemon.json
@@ -0,0 +1,12 @@
+{
+ "ignore": [
+ ".git",
+ "node_modules",
+ ".gitignore"
+ ],
+ "env": {
+ "NODE_ENV": "development"
+ },
+ "ext": "js",
+ "__ext": "js,json"
+}
\ No newline at end of file
diff --git a/resources/image/logo.png b/resources/image/logo.png
new file mode 100644
index 0000000000000000000000000000000000000000..3213afa91f02b764fd213df0a9389efd8485a7e2
GIT binary patch
literal 24375
zcmZ6zd03NI(>Q!vL@X%Os^A8+FHh?NiVJHHFttKkMN~-GA&P>?4hcvg31ZbM0<|j0
zj#7gpfkcokY;i$UG=O*mvZ@FPVG|*MfxtI+@Oj_w`u)+X=G^DZneEJ(nKQ%XBZqBQ
zs%}t45M<@=zx{d)L6pSUf6JG_h+XcRkMO^5Lw<7!M-a8u*ndlqw2XBK;yL*HuXx9^
z86)z@uAV5oXts9uo)vra{%&F)691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~O{
zEdS0*;>DSK!t9+)f7$q66D-d^$BLmRtH*lVdN`u|!N(T82Vl`=&WlP^Eq0NpW@{=yGx$}RSPcRqs>^QIf
zo9Wj%b?(m=yl=x^RgDu~{8P-kxZ$)YQs%ut^Uqnc<+?VWwf43VW|k0S_l`Z^R{oFR
G`2PcsQA3LW
literal 0
HcmV?d00001
diff --git a/scripts/advanced-search/background.js b/scripts/advanced-search/background.js
new file mode 100644
index 0000000..efddd99
--- /dev/null
+++ b/scripts/advanced-search/background.js
@@ -0,0 +1,1097 @@
+/**
+ * ss 的寓意
+ *
+ * - 搜索 (sou suo)
+ *
+ * - 超级搜索 (super search)
+ * - 智慧搜索 (smart search)
+ * - 洞见搜索 (sagacious search)
+ * - 流畅搜索 (smooth search)
+ * - 安全搜索 (safe search)
+ *
+ * 当然还有...
+ * - 简单搜索 (simple search)
+ * - 愚蠢搜索 (stupid search)
+ *
+ * 即使有上面那么多的功能,但我们不往初心,
+ *
+ * - 开创探索 (seminal search)
+ * - 启航 (set sail)
+ */
+
+/**
+ * refer:
+ *
+ * omnibox 搜索
+ * GitHub demo: https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/mv2-archive/extensions/chrome_search
+ * Blog: https://www.cnblogs.com/cc11001100/p/12353361.html
+ * Debug: https://chrome.google.com/webstore/detail/omnibox-debug/nhgkpjdgjmjhgjhgjhgjhgjhgjhgjhgjhg
+ */
+
+
+
+/**
+ * ****************************************************************************************
+ *
+ * 搜索模式配置部分
+ *
+ * ****************************************************************************************
+ */
+
+/**
+ * 支持的搜索方式
+ *
+ * Notes:
+ * - 第一位需要保留为默认搜索方式(文字)
+ * - getSuggestions / search 方法传入参数应该是经过 getInputText 过滤前面搜索模式字符的字符串
+ */
+var omniboxSearchModes = [
+ // #############################################################################################################
+ {
+ key: "",
+ // 显示文字
+ showText: "文字",
+ // 搜索模式匹配
+ // match: function (text) { },
+ // 获取输入文字
+ getInputText: function (text, encodeText = true) {
+ return encodeText ? encodeXML(text) : text
+ },
+ // 搜索建议
+ getSuggestions: async function (text, suggest) {
+ // 如果前面已经有了 【[xx] 】,则先去掉
+ text = text.replace(/^\[.*?\]\s*/, "");
+ suggest([
+ { content: "[百度] " + text, description: "使用 [百度] 搜索 " + text + " ", deletable: false },
+ { content: "[搜狗] " + text, description: "使用 [搜狗] 搜索 " + text + " ", deletable: false },
+ { content: "[必应] " + text, description: "使用 [必应] 搜索 " + text + " ", deletable: false },
+ { content: "[360] " + text, description: "使用 [360] 搜索 " + text + " ", deletable: false },
+ { content: "[微博] " + text, description: "使用 [微博] 搜索 " + text + " ", deletable: false },
+ { content: "[知乎] " + text, description: "使用 [知乎] 搜索 " + text + " ", deletable: false },
+ { content: "[今日头条] " + text, description: "使用 [今日头条] 搜索 " + text + " ", deletable: false },
+ { content: "[中国搜索] " + text, description: "使用 [中国搜索] 搜索 " + text + " ", deletable: false },
+ ]);
+ return;
+
+ // var url = "https://code.google.com/p/chromium/codesearch#search/&type=cs&q=" + query +
+ // "&exact_package=chromium&type=cs";
+ // var req = new XMLHttpRequest();
+ // req.open("GET", url, true);
+ // req.setRequestHeader("GData-Version", "2");
+ // req.onreadystatechange = function () {
+ // if (req.readyState == 4) callback(req.responseXML);
+ // }
+ // req.send(null);
+ // // return req;
+
+
+ // suggestions.forEach((suggestion) => { suggestion.deletable = false /* 用户不可删除 */ });
+ // /**
+ // * SuggestResult
+ // * refer: https://developer.chrome.com/docs/extensions/reference/omnibox/
+ // * { content, description[, deletable] }
+ // */
+ // suggest(suggestions);
+
+ // // suggest([
+ // // { content: "one", description: "the aaa www first one", deletable: false },
+ // // { content: "number two", description: "the second entry", deletable: false }
+ // // ]);
+ },
+ // 执行搜索
+ search: function (text) {
+ let searchInput = /^(\[.*?\])?( )?(.*)$/.exec(text)
+ let searchType = /^\[(.*?)\]$/.exec((searchInput[1] ?? "[百度]"/* 默认百度搜索 */).trim())[0].trim()
+ let searchText = searchInput[3].trim()
+ console.log("[文字搜索开始]");
+ console.log(" 传入参数为:", text);
+ console.log(" searchInput为:", searchInput);
+ console.log(" searchType为:", searchType);
+ console.log(" searchText为:", searchText);
+ switch (searchType) {
+ default:
+ case "[百度]":
+ navigate("https://www.baidu.com/s?wd=" + encodeURIComponent(searchText), true);
+ break;
+ case "[搜狗]":
+ navigate("https://www.sogou.com/web?query=" + encodeURIComponent(searchText), true);
+ break;
+ case "[必应]":
+ navigate("https://cn.bing.com/search?q=" + encodeURIComponent(searchText), true);
+ break;
+ case "[360]":
+ navigate("https://www.so.com/s?q=" + encodeURIComponent(searchText), true);
+ break;
+ case "[微博]":
+ navigate("https://s.weibo.com/weibo?q=" + encodeURIComponent(searchText), true);
+ break;
+ case "[知乎]":
+ navigate("https://www.zhihu.com/search?type=content&q=" + encodeURIComponent(searchText), true);
+ break;
+ case "[今日头条]":
+ navigate("https://so.toutiao.com/search?dvpf=pc&keyword=" + encodeURIComponent(searchText), true);
+ break;
+ case "[中国搜索]":
+ navigate("http://www.chinaso.com/newssearch/all/allResults?q=" + encodeURIComponent(searchText), true);
+ break;
+ }
+ console.log("[文字搜索结束]");
+ }
+ },
+ // #############################################################################################################
+ {
+ key: "img",
+ // 显示文字
+ showText: "图片",
+ // 搜索模式匹配
+ match: function (text) {
+ return /^img( |:|\uff1a)?/i.test(text)
+ },
+ // 获取输入文字
+ getInputText: function (text, encodeText = true) {
+ let returnText = /^img(:| |\uff1a)?(.*)$/i.exec(text)[2].trim()
+ return encodeText ? encodeXML(returnText) : returnText
+ },
+ // 搜索建议
+ getSuggestions: async function (text, suggest) {
+ // 如果前面已经有了 【[xx] 】,则先去掉
+ text = text.replace(/^\[.*?\]\s*/, "");
+ suggest([
+ { content: "img: [百度] " + text, description: "使用 [百度图片] 搜索 " + text + " ", deletable: false },
+ { content: "img: [搜狗] " + text, description: "使用 [搜狗图片] 搜索 " + text + " ", deletable: false },
+ { content: "img: [必应] " + text, description: "使用 [必应图片] 搜索 " + text + " ", deletable: false },
+ { content: "img: [360] " + text, description: "使用 [360图片] 搜索 " + text + " ", deletable: false },
+ { content: "img: [微博] " + text, description: "使用 [微博图片] 搜索 " + text + " ", deletable: false },
+ { content: "img: [今日头条] " + text, description: "使用 [今日头条] 搜索 " + text + " ", deletable: false },
+ { content: "img: [中国搜索] " + text, description: "使用 [中国搜索图片] 搜索 " + text + " ", deletable: false },
+ ]);
+ return;
+ },
+ // 执行搜索
+ search: function (text) {
+ let searchInput = /^(\[.*?\])?( )?(.*)$/.exec(text)
+ let searchType = /^\[(.*?)\]$/.exec((searchInput[1] ?? "[百度]"/* 默认百度图片搜索 */).trim())[0].trim()
+ let searchText = searchInput[3].trim()
+ console.log("[图片搜索开始]");
+ console.log(" 传入参数为:", text);
+ console.log(" searchInput为:", searchInput);
+ console.log(" searchType为:", searchType);
+ console.log(" searchText为:", searchText);
+ switch (searchType) {
+ default:
+ case "[百度]":
+ navigate("https://image.baidu.com/search/index?tn=baiduimage&word=" + encodeURIComponent(searchText), true);
+ break;
+ case "[搜狗]":
+ navigate("https://pic.sogou.com/pics?query=" + encodeURIComponent(searchText), true);
+ break;
+ case "[必应]":
+ navigate("https://cn.bing.com/images/search?q=" + encodeURIComponent(searchText), true);
+ break;
+ case "[360]":
+ navigate("https://image.so.com/i?q=" + encodeURIComponent(searchText), true);
+ break;
+ case "[微博]":
+ navigate("https://s.weibo.com/pic?q=" + encodeURIComponent(searchText), true);
+ break;
+ case "[今日头条]":
+ navigate("https://so.toutiao.com/search?pd=atlas&dvpf=pc&keyword=" + encodeURIComponent(searchText), true);
+ break;
+ case "[中国搜索]":
+ navigate("http://www.chinaso.com/newssearch/image?q=" + encodeURIComponent(searchText), true);
+ break;
+
+ }
+ console.log("[图片搜索结束]");
+ }
+ },
+ // #############################################################################################################
+ {
+ key: "video",
+ // 显示文字
+ showText: "视频",
+ // 搜索模式匹配
+ match: function (text) {
+ return /^video( |:|\uff1a)?/i.test(text)
+ },
+ // 获取输入文字
+ getInputText: function (text, encodeText = true) {
+ let returnText = /^video(:| |\uff1a)?(.*)$/i.exec(text)[2].trim()
+ return encodeText ? encodeXML(returnText) : returnText
+ },
+ // 搜索建议
+ getSuggestions: async function (text, suggest) {
+ // 如果前面已经有了 【[xx] 】,则先去掉
+ text = text.replace(/^\[.*?\]\s*/, "");
+ suggest([
+ { content: "video: [B站] " + text, description: "使用 [哔哩哔哩动画] 搜索 " + text + " ", deletable: false },
+ { content: "video: [爱奇艺] " + text, description: "使用 [爱奇艺] 搜索 " + text + " ", deletable: false },
+ { content: "video: [腾讯视频] " + text, description: "使用 [腾讯视频] 搜索 " + text + " ", deletable: false },
+ { content: "video: [优酷] " + text, description: "使用 [优酷] 搜索 " + text + " ", deletable: false },
+ { content: "video: [百度] " + text, description: "使用 [百度视频] 搜索 " + text + " ", deletable: false },
+ { content: "video: [搜狗] " + text, description: "使用 [搜狗视频] 搜索 " + text + " ", deletable: false },
+ { content: "video: [微博] " + text, description: "使用 [微博视频] 搜索 " + text + " ", deletable: false },
+ { content: "video: [抖音] " + text, description: "使用 [抖音] 搜索 " + text + " ", deletable: false },
+ { content: "video: [必应] " + text, description: "使用 [必应视频] 搜索 " + text + " ", deletable: false },
+ // 以下内容超出9个不被显示
+ { content: "video: [360] " + text, description: "使用 [360视频] 搜索 " + text + " ", deletable: false },
+ { content: "video: [今日头条] " + text, description: "使用 [今日头条] 搜索 " + text + " ", deletable: false },
+ { content: "video: [快手] " + text, description: "使用 [快手] 搜索 " + text + " ", deletable: false },
+ { content: "video: [知乎] " + text, description: "使用 [知乎] 搜索 " + text + " ", deletable: false },
+ { content: "video: [搜狐] " + text, description: "使用 [搜狐视频] 搜索 " + text + " ", deletable: false },
+ { content: "video: [央视网] " + text, description: "使用 [央视网] 搜索 " + text + " ", deletable: false },
+ { content: "video: [中国搜索] " + text, description: "使用 [中国搜索视频] 搜索 " + text + " ", deletable: false },
+ ]);
+ return;
+ },
+ // 执行搜索
+ search: function (text) {
+ let searchInput = /^(\[.*?\])?( )?(.*)$/.exec(text)
+ let searchType = /^\[(.*?)\]$/.exec((searchInput[1] ?? "[B站]"/* 默认爱奇艺搜索 */).trim())[0].trim()
+ let searchText = searchInput[3].trim()
+ console.log("[视频搜索开始]");
+ console.log(" 传入参数为:", text);
+ console.log(" searchInput为:", searchInput);
+ console.log(" searchType为:", searchType);
+ console.log(" searchText为:", searchText);
+ switch (searchType) {
+ default:
+ case "[B站]":
+ navigate("https://search.bilibili.com/all?keyword=" + searchText);
+ break;
+ case "[爱奇艺]":
+ navigate("https://so.iqiyi.com/so/q_" + encodeURIComponent(searchText), true);
+ break;
+ case "[腾讯视频]":
+ navigate("https://v.qq.com/x/search/?q=" + encodeURIComponent(searchText), true);
+ break;
+ case "[优酷]":
+ navigate("https://so.youku.com/search_video/q_" + encodeURIComponent(searchText), true);
+ break;
+ case "[百度]":
+ navigate("https://v.baidu.com/v?word=" + encodeURIComponent(searchText), true);
+ break;
+ case "[搜狗]":
+ navigate("https://v.sogou.com/v?query=" + encodeURIComponent(searchText), true);
+ break;
+ case "[360]":
+ navigate("https://tv.360kan.com/s?q=" + encodeURIComponent(searchText), true);
+ break;
+ case "[微博]":
+ navigate("https://s.weibo.com/video?q=" + encodeURIComponent(searchText), true);
+ break;
+ case "[抖音]":
+ navigate("https://www.douyin.com/search/" + encodeURIComponent(searchText) + "?type=video", true);
+ break;
+ case "[必应]":
+ navigate("https://cn.bing.com/videos/search?q=" + encodeURIComponent(searchText), true);
+ break;
+ case "[今日头条]":
+ navigate("https://so.toutiao.com/search?pd=video&dvpf=pc&keyword=" + encodeURIComponent(searchText), true);
+ break;
+ case "[知乎]":
+ navigate("https://www.zhihu.com/search?type=zvideo&q=" + encodeURIComponent(searchText), true);
+ break;
+ case "[快手]":
+ navigate("https://www.kuaishou.com/search/video?searchKey=" + encodeURIComponent(searchText), true);
+ break;
+ case "[搜狐]":
+ navigate("https://so.tv.sohu.com/mts?wd=" + encodeURIComponent(searchText), true);
+ break;
+ case "[央视网]":
+ navigate("https://search.cctv.com/search.php?type=video&qtext=" + encodeURIComponent(searchText), true);
+ break;
+ case "[中国搜索]":
+ navigate("http://www.chinaso.com/newssearch/video?q=" + encodeURIComponent(searchText), true);
+ break;
+ }
+ console.log("[视频搜索结束]");
+ }
+ },
+ // #############################################################################################################
+ {
+ key: "news",
+ // 显示文字
+ showText: "新闻",
+ // 搜索模式匹配
+ match: function (text) {
+ return /^news( |:|\uff1a)?/i.test(text)
+ },
+ // 获取输入文字
+ getInputText: function (text, encodeText = true) {
+ let returnText = /^news(:| |\uff1a)?(.*)$/i.exec(text)[2].trim()
+ return encodeText ? encodeXML(returnText) : returnText
+ },
+ // 搜索建议
+ getSuggestions: async function (text, suggest) {
+ // 如果前面已经有了 【[xx] 】,则先去掉
+ text = text.replace(/^\[.*?\]\s*/, "");
+ suggest([
+ { content: "news: [今日头条] " + text, description: "使用 [今日头条] 搜索 " + text + " ", deletable: false },
+ { content: "news: [百度] " + text, description: "使用 [百度资讯] 搜索 " + text + " ", deletable: false },
+ { content: "news: [360] " + text, description: "使用 [360资讯] 搜索 " + text + " ", deletable: false },
+ { content: "news: [微博] " + text, description: "使用 [微博] 搜索 " + text + " ", deletable: false },
+ { content: "news: [人民网] " + text, description: "使用 [人民网] 搜索 " + text + " ", deletable: false },
+ { content: "news: [中国搜索] " + text, description: "使用 [中国搜索] 搜索 " + text + " ", deletable: false },
+ { content: "news: [快资讯] " + text, description: "使用 [快资讯] 搜索 " + text + " ", deletable: false },
+ ]);
+ return;
+ },
+ // 执行搜索
+ search: function (text) {
+ let searchInput = /^(\[.*?\])?( )?(.*)$/.exec(text)
+ let searchType = /^\[(.*?)\]$/.exec((searchInput[1] ?? "[今日头条]"/* 默认今日头条搜索 */).trim())[0].trim()
+ let searchText = searchInput[3].trim()
+ console.log("[新闻搜索开始]");
+ console.log(" 传入参数为:", text);
+ console.log(" searchInput为:", searchInput);
+ console.log(" searchType为:", searchType);
+ console.log(" searchText为:", searchText);
+ switch (searchType) {
+ default:
+ case "[今日头条]":
+ navigate("https://www.toutiao.com/search/?keyword=" + encodeURIComponent(searchText), true);
+ break;
+ case "[百度]":
+ navigate("https://www.baidu.com/s?tn=news&word=" + encodeURIComponent(searchText), true);
+ break;
+ case "[360]":
+ navigate("https://news.so.com/ns?q=" + encodeURIComponent(searchText), true);
+ break;
+ case "[微博]":
+ navigate("https://s.weibo.com/weibo/" + encodeURIComponent(searchText), true);
+ break;
+ case "[人民网]":
+ navigate("http://search.people.cn/s?keyword=" + encodeURIComponent(searchText) + "&st=0&_=" + Date.now(), true);
+ break;
+ case "[中国搜索]":
+ navigate("http://www.chinaso.com/newssearch/news?q=" + encodeURIComponent(searchText), true);
+ break;
+ case "[快资讯]":
+ navigate("https://www.360kuai.com/search?q=" + encodeURIComponent(searchText), true);
+ break;
+ }
+ console.log("[新闻搜索结束]");
+ }
+ },
+ // #############################################################################################################
+ {
+ key: "fanyi",
+ // 显示文字
+ showText: "翻译",
+ // 搜索模式匹配
+ match: function (text) {
+ return /^fanyi( |:|\uff1a)?/i.test(text)
+ },
+ // 获取输入文字
+ getInputText: function (text, encodeText = true) {
+ let returnText = /^fanyi(:| |\uff1a)?(.*)$/i.exec(text)[2].trim()
+ return encodeText ? encodeXML(returnText) : returnText
+ },
+ // 搜索建议
+ getSuggestions: async function (text, suggest) {
+ // 如果前面已经有了 【[xx] 】,则先去掉
+ text = text.replace(/^\[.*?\]\s*/, "");
+ suggest([
+ { content: "fanyi: [有道翻译] " + text, description: "翻译 | 使用 [有道翻译] 翻译 " + text + " ", deletable: false },
+ { content: "fanyi: [百度] " + text, description: "翻译 | 使用 [百度翻译] 翻译 " + text + " ", deletable: false },
+ { content: "fanyi: [腾讯] " + text, description: "翻译 | 使用 [腾讯翻译君] 翻译 " + text + " ", deletable: false },
+ { content: "fanyi: [DeepL] " + text, description: "翻译 | 使用 [DeepL翻译] 翻译 " + text + " ", deletable: false },
+ // 【需要注入自动翻译】 { content: "fanyi: [海词翻译] " + text, description: "翻译 | 使用 [海词翻译] 翻译 " + text + " ", deletable: false },
+ { content: "fanyi: [必应] " + text, description: "查词 | 使用 [必应词典] 查词 " + text + " ", deletable: false },
+ { content: "fanyi: [有道] " + text, description: "查词 | 使用 [有道] 查词 " + text + " ", deletable: false },
+ { content: "fanyi: [海词] " + text, description: "查词 | 使用 [海词] 查词 " + text + " ", deletable: false },
+ { content: "fanyi: [金山词霸] " + text, description: "查词 | 使用 [金山词霸] 查词 " + text + " ", deletable: false },
+ // 以下内容超出9个不被显示
+ { content: "fanyi: [360] " + text, description: "翻译 | 使用 [360翻译] 翻译 " + text + " ", deletable: false },
+ { content: "fanyi: [翻译狗] " + text, description: "翻译 | 使用 [翻译狗] 翻译 " + text + " ", deletable: false },
+ { content: "fanyi: [Google] " + text, description: "翻译 | 使用 [Google翻译] 翻译 " + text + " (Google翻译在中国大陆无法使用)", deletable: false },
+ ]);
+ return;
+ },
+ // 执行搜索
+ search: function (text) {
+ let searchInput = /^(\[.*?\])?( )?(.*)$/.exec(text)
+ let searchType = /^\[(.*?)\]$/.exec((searchInput[1] ?? "[有道翻译]"/* 默认有道翻译 */).trim())[0].trim()
+ let searchText = searchInput[3].trim()
+ console.log("[翻译搜索开始]");
+ console.log(" 传入参数为:", text);
+ console.log(" searchInput为:", searchInput);
+ console.log(" searchType为:", searchType);
+ console.log(" searchText为:", searchText);
+ switch (searchType) {
+ default:
+ case "[有道翻译]":
+ // 后面参数通过注入的js代码获取并在网页加载完后填入到翻译框中,点击翻译按钮
+ navigate("https://fanyi.youdao.com/index.html?__xiaomo_extension__=" + encodeURIComponent(searchText), true);
+ break;
+ case "[百度]":
+ // 百度翻译中英文会自动识别,所以不需要手动判断
+ navigate("https://fanyi.baidu.com/#en/zh/" + encodeURIComponent(searchText), true);
+ break;
+ case "[必应]":
+ navigate("https://cn.bing.com/dict/search?q=" + encodeURIComponent(searchText), true);
+ break;
+ case "[腾讯]":
+ // 网页加载好后自动点击翻译按钮
+ navigate("https://fanyi.qq.com/?text=" + encodeURIComponent(searchText), true);
+ break;
+ case "[DeepL]":
+ let hasChineseChar = /.*[\u4e00-\u9fa5]+.*$/.test(searchText)
+ navigate("https://www.deepl.com/translator#" + (hasChineseChar ? "zh/en/" : "en/zh/") + encodeURIComponent(searchText), true);
+ break;
+ // case "[海词翻译]":
+ // navigate("http://fanyi.dict.cn/" + encodeURIComponent(searchText), true);
+ // break;
+ case "[金山词霸]":
+ navigate("https://www.iciba.com/word?w=" + encodeURIComponent(searchText), true);
+ break;
+ case "[海词]":
+ navigate("https://dict.cn/" + encodeURIComponent(searchText), true);
+ break;
+ case "[有道]":
+ navigate("https://www.youdao.com/w/" + encodeURIComponent(searchText), true);
+ break;
+ case "[360]":
+ navigate("https://fanyi.so.com/#" + encodeURIComponent(searchText), true);
+ break;
+ case "[翻译狗]":
+ navigate("https://www.fanyigou.com/trans/totran/tranText.html?text=" + encodeURIComponent(searchText), true);
+ break;
+ case "[Google]":
+ navigate("https://translate.google.cn/?text=" + encodeURIComponent(searchText), true);
+ break;
+ }
+ console.log("[翻译搜索结束]");
+ }
+ },
+ // #############################################################################################################
+ {
+ key: "paper",
+ // 显示文字
+ showText: "学术论文",
+ // 搜索模式匹配
+ match: function (text) {
+ return /^paper( |:|\uff1a)?/i.test(text)
+ },
+ // 获取输入文字
+ getInputText: function (text, encodeText = true) {
+ let returnText = /^paper(:| |\uff1a)?(.*)$/i.exec(text)[2].trim()
+ return encodeText ? encodeXML(returnText) : returnText
+ },
+ // 搜索建议
+ getSuggestions: async function (text, suggest) {
+ // 如果前面已经有了 【[xx] 】,则先去掉
+ text = text.replace(/^\[.*?\]\s*/, "");
+ suggest([
+ { content: "paper: [知网] " + text, description: "使用 [中国知网] 搜索 " + text + " ", deletable: false },
+ { content: "paper: [万方] " + text, description: "使用 [万方数据] 搜索 " + text + " ", deletable: false },
+ { content: "paper: [维普] " + text, description: "使用 [维普期刊] 搜索 " + text + " ", deletable: false },
+ { content: "paper: [百度] " + text, description: "使用 [百度学术] 搜索 " + text + " ", deletable: false },
+ { content: "paper: [必应] " + text, description: "使用 [必应学术] 搜索 " + text + " ", deletable: false },
+ { content: "paper: [搜狗] " + text, description: "使用 [搜狗学术] 搜索 " + text + " ", deletable: false },
+ { content: "paper: [谷歌] " + text, description: "使用 [谷歌学术] 搜索 " + text + " (谷歌学术在中国大陆无法使用)", deletable: false },
+ ]);
+ return;
+ },
+ // 执行搜索
+ search: function (text) {
+ let searchInput = /^(\[.*?\])?( )?(.*)$/.exec(text)
+ let searchType = /^\[(.*?)\]$/.exec((searchInput[1] ?? "[知网]"/* 默认中国知网搜索 */).trim())[0].trim()
+ let searchText = searchInput[3].trim()
+ console.log("[学术论文搜索开始]");
+ console.log(" 传入参数为:", text);
+ console.log(" searchInput为:", searchInput);
+ console.log(" searchType为:", searchType);
+ console.log(" searchText为:", searchText);
+ switch (searchType) {
+ default:
+ case "[知网]":
+ // 后面参数通过注入的js代码获取并在网页加载完后填入到搜索框中,点击搜索按钮
+ navigate("https://www.cnki.net/?__xiaomo_extension__=" + encodeURIComponent(searchText), true);
+ break;
+ case "[万方]":
+ navigate("https://s.wanfangdata.com.cn/paper?q=" + encodeURIComponent(searchText), true);
+ break;
+ case "[维普]":
+ // 后面参数通过注入的js代码获取并在网页加载完后填入到搜索框中,点击搜索按钮
+ navigate("http://qikan.cqvip.com/?__xiaomo_extension__=" + encodeURIComponent(searchText), true);
+ break;
+ case "[百度]":
+ navigate("https://xueshu.baidu.com/s?wd=" + encodeURIComponent(searchText), true);
+ break;
+ case "[必应]":
+ navigate("https://cn.bing.com/academic/search?q=" + encodeURIComponent(searchText), true);
+ break;
+ case "[搜狗]":
+ navigate("https://scholar.sogou.com/xueshu?query=" + encodeURIComponent(searchText), true);
+ break;
+ case "[Google]":
+ navigate("https://scholar.google.com/scholar?q=" + encodeURIComponent(searchText), true);
+ break;
+ }
+ console.log("[学术论文搜索结束]");
+ }
+ },
+ // #############################################################################################################
+ {
+ key: "baike",
+ // 显示文字
+ showText: "百科",
+ // 搜索模式匹配
+ match: function (text) {
+ return /^baike( |:|\uff1a)?/i.test(text)
+ },
+ // 获取输入文字
+ getInputText: function (text, encodeText = true) {
+ let returnText = /^baike(:| |\uff1a)?(.*)$/i.exec(text)[2].trim()
+ return encodeText ? encodeXML(returnText) : returnText
+ },
+ // 搜索建议
+ getSuggestions: async function (text, suggest) {
+ // 如果前面已经有了 【[xx] 】,则先去掉
+ text = text.replace(/^\[.*?\]\s*/, "");
+ suggest([
+ { content: "baike: [百度] " + text, description: "使用 [百度百科] 搜索 " + text + " ", deletable: false },
+ { content: "baike: [搜狗] " + text, description: "使用 [搜狗百科] 搜索 " + text + " ", deletable: false },
+ { content: "baike: [360] " + text, description: "使用 [360百科] 搜索 " + text + " ", deletable: false },
+ ]);
+ return;
+ },
+ // 执行搜索
+ search: function (text) {
+ let searchInput = /^(\[.*?\])?( )?(.*)$/.exec(text)
+ let searchType = /^\[(.*?)\]$/.exec((searchInput[1] ?? "[百度]"/* 默认百度百科搜索 */).trim())[0].trim()
+ let searchText = searchInput[3].trim()
+ console.log("[百科搜索开始]");
+ console.log(" 传入参数为:", text);
+ console.log(" searchInput为:", searchInput);
+ console.log(" searchType为:", searchType);
+ console.log(" searchText为:", searchText);
+ switch (searchType) {
+ default:
+ case "[百度]":
+ // 后面参数通过注入的js代码获取并在网页加载完后填入到搜索框中,点击搜索按钮
+ navigate("https://baike.baidu.com/?__xiaomo_extension__=" + encodeURIComponent(searchText), true);
+ break;
+ case "[搜狗]":
+ //步骤一:创建异步对象
+ var ajax = new XMLHttpRequest();
+ //步骤二:设置请求的url参数,参数一是请求的类型,参数二是请求的url,可以带参数,动态的传递参数starName到服务端
+ ajax.open('get', 'https://baike.sogou.com/bapi/searchBarEnter?searchText=' + encodeURIComponent(searchText));
+ //步骤三:发送请求
+ ajax.send();
+ //步骤四:注册事件 onreadystatechange 状态改变就会调用
+ ajax.onreadystatechange = function () {
+ console.log("ajax result", ajax)
+ if (ajax.readyState == 4) {
+ if (ajax.status == 200) {
+ //步骤五 如果能够进到这个判断 说明 数据 完美的回来了,并且请求的页面是存在的
+ console.log(ajax.responseText);//输入相应的内容
+ navigate("https://baike.sogou.com" + ajax.responseText, true);
+ } else {
+ alert("搜索失败,可能是搜狗官网搜索相关api已变更,你的输入已经复制到剪切板,请手动粘贴搜索");
+ navigate("https://baike.sogou.com/", true);
+ }
+ }
+ }
+ break;
+ case "[360]":
+ navigate("https://baike.so.com/doc/search?word=" + encodeURIComponent(searchText), true);
+ break;
+ }
+ console.log("[百科搜索结束]");
+ }
+ },
+ // #############################################################################################################
+ {
+ key: "map",
+ // 显示文字
+ showText: "地图",
+ // 搜索模式匹配
+ match: function (text) {
+ return /^map( |:|\uff1a)?/i.test(text)
+ },
+ // 获取输入文字
+ getInputText: function (text, encodeText = true) {
+ let returnText = /^map(:| |\uff1a)?(.*)$/i.exec(text)[2].trim()
+ return encodeText ? encodeXML(returnText) : returnText
+ },
+ // 搜索建议
+ getSuggestions: async function (text, suggest) {
+ // 如果前面已经有了 【[xx] 】,则先去掉
+ text = text.replace(/^\[.*?\]\s*/, "");
+ suggest([
+ { content: "map: [百度] " + text, description: "使用 [百度地图] 搜索 " + text + " ", deletable: false },
+ { content: "map: [高德] " + text, description: "使用 [高德地图] 搜索 " + text + " ", deletable: false },
+ { content: "map: [必应] " + text, description: "使用 [必应地图] 搜索 " + text + " ", deletable: false },
+ { content: "map: [360] " + text, description: "使用 [360地图] 搜索 " + text + " ", deletable: false },
+ { content: "map: [搜狗] " + text, description: "使用 [搜狗地图] 搜索 " + text + " ", deletable: false },
+ ]);
+ return;
+ },
+ // 执行搜索
+ search: function (text) {
+ let searchInput = /^(\[.*?\])?( )?(.*)$/.exec(text)
+ let searchType = /^\[(.*?)\]$/.exec((searchInput[1] ?? "[百度]"/* 默认百度图片搜索 */).trim())[0].trim()
+ let searchText = searchInput[3].trim()
+ console.log("[地图搜索开始]");
+ console.log(" 传入参数为:", text);
+ console.log(" searchInput为:", searchInput);
+ console.log(" searchType为:", searchType);
+ console.log(" searchText为:", searchText);
+ switch (searchType) {
+ default:
+ case "[百度]":
+ navigate("https://map.baidu.com/search?querytype=s&wd=" + encodeURIComponent(searchText), true);
+ break;
+ case "[高德]":
+ navigate("https://www.amap.com/search?query=" + encodeURIComponent(searchText), true);
+ break;
+ case "[必应]":
+ navigate("https://cn.bing.com/maps?q=" + encodeURIComponent(searchText), true);
+ break;
+ case "[360]":
+ navigate("https://ditu.so.com/?k=" + encodeURIComponent(searchText), true);
+ break;
+ case "[搜狗]":
+ navigate("http://map.sogou.com/#lq=" + encodeURIComponent(searchText), true);
+ break;
+ }
+ console.log("[地图搜索结束]");
+ }
+ },
+ // 购物:https://s.taobao.com/search?q=搜索关键词
+ // #############################################################################################################
+ // {
+ // key: "jk",
+ // // 显示文字
+ // showText: "健康",
+ // // 搜索模式匹配
+ // match: function (text) {
+ // return /^jk( |:|\uff1a)?/i.test(text)
+ // },
+ // // 获取输入文字
+ // getInputText: function (text, encodeText = true) {
+ // let returnText = /^jk(:| |\uff1a)?(.*)$/i.exec(text)[2].trim()
+ // return encodeText ? encodeXML(returnText) : returnText
+ // },
+ // // 搜索建议
+ // getSuggestions: async function (text, suggest) {
+ // // 如果前面已经有了 【[xx] 】,则先去掉
+ // text = text.replace(/^\[.*?\]\s*/, "");
+ // suggest([
+ // { content: "jk: [免责声明] " + text, description: "[免责声明] 小墨助手仅提供快捷搜索功能,不对搜索结果承担责任。搜索结果仅供参考,请自行甄别,以免上当受骗。继续搜索代表您已知晓此声明。 ", deletable: false },
+ // { content: "jk: [丁香医生] " + text, description: "使用 [丁香医生] 搜索 " + text + " ", deletable: false },
+ // { content: "jk: [360] " + text, description: "使用 [360良医] 搜索 " + text + " ", deletable: false },
+ // { content: "jk: [好大夫] " + text, description: "使用 [好大夫在线] 搜索 " + text + " ", deletable: false },
+ // { content: "jk: [寻医问药] " + text, description: "使用 [寻医问药网] 搜索 " + text + " ", deletable: false },
+ // { content: "jk: [新华健康] " + text, description: "使用 [新华健康] 搜索 " + text + " ", deletable: false },
+ // // 腾讯医典没有网页版;中华网健康没有搜索功能:https://health.china.com/;搜狐健康搜索为全站搜索:https://health.sohu.com/
+ // ]);
+ // return;
+ // },
+ // // 执行搜索
+ // search: function (text) {
+ // let searchInput = /^(\[.*?\])?( )?(.*)$/.exec(text)
+ // let searchType = /^\[(.*?)\]$/.exec((searchInput[1] ?? "[免责声明]"/* 默认弹出免责声明 */).trim())[0].trim()
+ // let searchText = searchInput[3].trim()
+ // console.log("[学术论文搜索开始]");
+ // console.log(" 传入参数为:", text);
+ // console.log(" searchInput为:", searchInput);
+ // console.log(" searchType为:", searchType);
+ // console.log(" searchText为:", searchText);
+ // alert("[免责声明] 小墨助手仅提供快捷搜索功能,不对搜索结果承担责任。搜索结果仅供参考,请自行甄别,以免上当受骗。继续搜索代表您已知晓此声明。");
+ // switch (searchType) {
+ // default:
+ // case "[免责声明]":
+ // // Silence is gold.
+ // break;
+ // case "[丁香医生]":
+ // navigate("https://dxy.com/search/result?query=" + encodeURIComponent(searchText), true);
+ // break;
+ // case "[360]":
+ // navigate("https://ly.so.com/s?q=" + encodeURIComponent(searchText), true);
+ // break;
+ // case "[好大夫]":
+ // navigate("https://so.haodf.com/index/search?kw=" + encodeURIComponent(searchText), true);
+ // break;
+ // case "[寻医问药]":
+ // navigate("https://so.xywy.com/comse.php?keyword=" + encodeURIComponent(searchText), true);
+ // break;
+ // case "[新华健康]":
+ // navigate("http://so.xinhuanet.com/#search/0/" + encodeURIComponent(searchText) + "/1/", true);
+ // break;
+ // }
+ // console.log("[学术论文搜索结束]");
+ // }
+ // },
+ // #############################################################################################################
+ // {
+ // key: "yn",
+ // // 显示文字
+ // showText: "网页内搜索(Todo)",
+ // // 搜索模式匹配
+ // match: function (text) {
+ // return /^yn( |:|\uff1a)?/i.test(text)
+ // },
+ // // 获取输入文字
+ // getInputText: function (text, encodeText = true) {
+ // let returnText = /^yn(:| |\uff1a)?(.*)$/i.exec(text)[2].trim()
+ // return encodeText ? encodeXML(returnText) : returnText
+ // },
+ // // 搜索建议
+ // getSuggestions: async function (text, suggest) {
+ // return;
+ // },
+ // // 执行搜索
+ // search: function (text) {
+
+ // }
+ // },
+ // #############################################################################################################
+ // {
+ // key: "re",
+ // // 显示文字
+ // showText: "网页内正则表达式搜索(Todo)",
+ // // 搜索模式匹配
+ // match: function (text) {
+ // return /^re( |:|\uff1a)?/i.test(text)
+ // },
+ // // 获取输入文字
+ // getInputText: function (text, encodeText = true) {
+ // let returnText = /^re(:| |\uff1a)?(.*)$/i.exec(text)[2].trim()
+ // return encodeText ? encodeXML(returnText) : returnText
+ // },
+ // // 搜索建议
+ // getSuggestions: async function (text, suggest) {
+ // return;
+ // },
+ // // 执行搜索
+ // search: function (text) {
+
+ // }
+ // },
+ // #############################################################################################################
+ // {
+ // key: "ls",
+ // // 显示文字
+ // showText: "历史记录(Todo)",
+ // // 搜索模式匹配
+ // match: function (text) {
+ // return /^ls( |:|\uff1a)?/i.test(text)
+ // },
+ // // 获取输入文字
+ // getInputText: function (text, encodeText = true) {
+ // let returnText = /^ls(:| |\uff1a)?(.*)$/i.exec(text)[2].trim()
+ // return encodeText ? encodeXML(returnText) : returnText
+ // },
+ // // 搜索建议
+ // getSuggestions: async function (text, suggest) {
+ // return;
+ // },
+ // // 执行搜索
+ // search: function (text) {
+ // function onGot(historyItems) {
+ // for (item of historyItems) {
+ // console.log(item.url);
+ // console.log(new Date(item.lastVisitTime));
+ // }
+ // }
+
+ // var searching = browser.history.search({ text: text, startTime: 0 });
+
+ // searching.then(onGot);
+ // }
+ // },
+ // #############################################################################################################
+ // {
+ // key: "boss",
+ // // 显示文字
+ // showText: "召唤“小墨助手”",
+ // // 搜索模式匹配
+ // match: function (text) {
+ // // return text.trim() == "boss"
+ // return /^boss( |:|\uff1a)?$/i.test(text)
+ // },
+ // // 获取输入文字
+ // getInputText: (text) => "回车执行",
+ // // 搜索建议
+ // getSuggestions: async function (text, suggest) {
+ // return;
+ // },
+ // // 执行搜索
+ // search: function (text) {
+
+ // }
+ // }
+]
+
+
+
+/**
+ * ****************************************************************************************
+ *
+ * 全局变量定义部分
+ *
+ * ****************************************************************************************
+ */
+// 当前匹配的搜索模式的下标
+var currentSearchModeIndex = 0;
+
+// 当前正在向服务端进行的请求
+var currentRequest = null;
+
+//
+var ajaxUrl = "https://www.baidu.com/s?wd=";
+
+
+
+/**
+ * ****************************************************************************************
+ *
+ * 搜索模式配置部分
+ *
+ * ****************************************************************************************
+ */
+
+/**
+ * 用户开始输入文本
+ */
+chrome.omnibox.onInputStarted.addListener(async function () {
+ if (!await checkIsActived()) return;
+
+ console.log("chrome.omnibox.onInputStarted");
+ updateDefaultSuggestion('');
+});
+
+/**
+ * 搜索框失去焦点
+ */
+chrome.omnibox.onInputCancelled.addListener(async function () {
+ if (!await checkIsActived()) return;
+
+ console.log("chrome.omnibox.onInputCancelled");
+ updateDefaultSuggestion('');
+});
+
+/**
+ * 输入框文本改变事件
+ */
+chrome.omnibox.onInputChanged.addListener(async function (text, suggest) {
+ if (!await checkIsActived()) return;
+
+ console.log("chrome.omnibox.onInputChanged", text);
+
+ // 停止上一次搜索行为
+ if (currentRequest != null) {
+ currentRequest.onreadystatechange = null;
+ currentRequest.abort();
+ currentRequest = null;
+ }
+
+ // 更新输入框回显提示信息
+ updateDefaultSuggestion(text);
+
+ // 如果啥也没有输入就返回
+ if (text.trim() == '')
+ return;
+
+ // 访问后端服务获得搜索建议
+ var currentSearchMode = omniboxSearchModes[currentSearchModeIndex];
+ currentSearchMode.getSuggestions(currentSearchMode.getInputText(text), suggest);
+});
+
+/**
+ * 用户输入完成,按下回车键
+ */
+chrome.omnibox.onInputEntered.addListener(async function (text) {
+ if (!await checkIsActived()) return;
+
+ console.log("chrome.omnibox.onInputEntered");
+
+ // 更新输入框回显提示信息
+ // 注意:这里必须还要更新一次,因为用户在输入时使用上下键选择suggest项目时,会触发 chrome.omnibox.onInputChanged 事件
+ // 如果不执行,那么输入 ss img 之后上下选择对应搜索,按回车会被解析为文字搜索,而不是图片搜索
+ updateDefaultSuggestion(text);
+
+ var searchMode = omniboxSearchModes[currentSearchModeIndex];
+ var searchText = searchMode.getInputText(text);
+ searchMode.search(searchText);
+ console.log("用户输入:" + text);
+});
+
+
+
+/**
+ * ****************************************************************************************
+ *
+ * 公共函数部分
+ *
+ * ****************************************************************************************
+ */
+
+/**
+ * 读取功能开启状态,如果没有开启,则显示一个提示信息
+ * @returns
+ */
+async function checkIsActived() {
+ var isActived = await new Promise((resolve) => {
+ chrome.storage.sync.get('State_SSSearch', function (State) {
+ resolve(State.State_SSSearch);
+ });
+ });
+ console.log("Double S 快捷搜索功能开启状态:" + isActived);
+ if (!isActived) {
+ chrome.omnibox.setDefaultSuggestion({
+ description: "Double S 快捷搜索功能未开启,请在小墨助手扩展设置中开启后再试"
+ });
+ }
+ return isActived;
+}
+
+
+/**
+ *
+ * 将 & < > " ' 等特殊字符转义(中文不转义)
+ *
+ * XML中共有5个特殊的字符,分别为: & < > " '
+ * 如果配置文件中的值包括这些特殊字符,就需要进行特别处理
+ * refer: https://www.cnblogs.com/forestwolf/p/16832229.html
+ *
+ * 测试通过: [ re: 百度 <>!@#$%%^&*()_+-=[]{}|\:;'",./? ]
+ *
+ * @param string str
+ * @returns
+ */
+function encodeXML(str) {
+ let result = str
+ let map = {
+ "&": "&",
+ "<": "<",
+ ">": ">",
+ "\"": """,
+ "'": "'"
+ }
+ Object.keys(map).forEach((key) => result = result.replaceAll(key, map[key]))
+ return result
+
+ /**
+ * 以下方法在MV3扩展中已失效
+ *
+ * refer: https://www.javaroad.cn/questions/108186
+ */
+ // var holder = document.createElement('div');
+ // holder.textContent = str;
+ // return holder.innerHTML;
+}
+
+
+/**
+ * 将当前标签页导航到指定Url / 或者新建标签页
+ *
+ * @param String url 要导航到的url
+ * @param bool openInNewTab 是否打开新标签页 false - 当前标签页, true - 新标签页(当前标签页为newtab时使用当前标签页)
+ */
+function navigate(url, openInNewTab = false) {
+ chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
+ if (!openInNewTab || isCurrentNewTab(tabs)) {
+ // 如果不在新标签页打开,或者当前标签页是新标签页
+ chrome.tabs.update(tabs[0].id, { url: url });
+ } else {
+ // 如果在新标签页打开,且当前标签页不是新标签页
+ chrome.tabs.create({ url: url });
+ }
+ });
+}
+
+
+
+/**
+ * 获取当前是否是新标签页
+ * 需要先使用以下代码获取当前所有标签页
+ * chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) { });
+ *
+ * @param {*} tabs
+ */
+function isCurrentNewTab(tabs) {
+ let isNewTab = (tabs && tabs.length > 0 && !!tabs[0].url && /^(.*?):\/\/newtab\/$/.test(tabs[0].url));
+ console.log("当前标签页" + (isNewTab ? "是" : "不是") + "新标签页");
+ return isNewTab;
+}
+
+
+
+/**
+ * 更新下拉框中提示
+ * @param String text 用户输入文本
+ */
+function updateDefaultSuggestion(text) {
+
+ var description = [
+ '搜索方式 ',
+ ' [ ',
+ '' /* 文字搜索 显示文字占位 */
+ ];
+
+ // 如果用户输入不为空,先假设为文字搜索,如果后面匹配上了其他搜索方式,则更新
+ let isPlaintext = !!text.trim().length;
+ currentSearchModeIndex = 0; // 初始化搜索方式下标
+
+ // 默认第 0 个为文字搜索,除此之外的搜索方式如果都没有匹配到,则显示文字搜索
+ for (var i = 1, keyword; i < omniboxSearchModes.length; i++) {
+ keyword = omniboxSearchModes[i];
+
+ // 分隔符
+ description.push(' \| ');
+
+ // 通过用户输入文本匹配搜索方式
+ if (keyword.match(text)) {
+ // 是当前这种搜索模式
+ isPlaintext = false; // 说明不是文字搜索
+ currentSearchModeIndex = i; // 记录当前搜索模式的下标
+ description.push('' + keyword.showText + ':' + keyword.getInputText(text) + ' ');
+ } else {
+ // 不是当前这种搜索模式
+ description.push('' + keyword.key + ": " + keyword.showText + ' ');
+ }
+ }
+ description.push(' ] ');
+
+ if (text.trim().length != 0) {
+ description[2] = isPlaintext ? ('' + omniboxSearchModes[0].showText + ':' + text.trim() + ' ') : ('' + omniboxSearchModes[0].showText + ' ');
+ } else {
+ // 用户什么也没输入时,就高亮显示文字搜索关键字
+ description[2] = '' + omniboxSearchModes[0].showText + ' ';
+ }
+
+ console.log("[更新下拉框提示]",
+ "text:", text,
+ "匹配的搜索模式:", omniboxSearchModes[currentSearchModeIndex].showText);
+ console.log(" isPlaintext:", isPlaintext);
+ // console.log(description.join(''));
+ console.log("[更新下拉框提示结束]");
+
+ chrome.omnibox.setDefaultSuggestion({
+ description: description.join('')
+ });
+
+ // var isRegex = /^re:/.test(text);
+ // var isFile = /^file:/.test(text);
+ // var isHalp = (text == 'halp');
+ // var isPlaintext = text.length && !isRegex && !isFile && !isHalp;
+
+ // var description = '搜索方式 [ ';
+ // description += isPlaintext ? ('' + text + ' ') : '文字';
+ // description += ' | ';
+ // description += isRegex ? ('' + text + ' ') : 're: 正则';
+ // description += ' | ';
+ // description += isFile ? ('' + text + ' ') : 'file:文件';
+ // description += ' | ';
+ // description += isHalp ? 'halp ' : 'halp';
+ // description += ' ] ';
+
+ // chrome.omnibox.setDefaultSuggestion({
+ // description: description
+ // });
+}
diff --git a/scripts/advanced-search/content-helper.js b/scripts/advanced-search/content-helper.js
new file mode 100644
index 0000000..1c6b5a0
--- /dev/null
+++ b/scripts/advanced-search/content-helper.js
@@ -0,0 +1,139 @@
+console.log("[小墨助手]", "自动搜索模块加载成功")
+
+window.onload = () => {
+
+ /**
+ * 先处理不需要传入参数,只需要点击按钮的情况,然后再处理需要传入参数的情况
+ */
+
+ /**
+ * **********************************************************************************************
+ *
+ * 不需要传入参数情况
+ *
+ * **********************************************************************************************
+ */
+ switch (window.location.host) {
+
+ case "fanyi.qq.com": // 腾讯翻译君
+ document.getElementsByClassName("language-translate-button")[0].click()
+ // $(".language-translate-button")[0].click()
+ clearUrlParams();
+ return;
+
+ }
+
+ /**
+ * **********************************************************************************************
+ *
+ * 需要传入参数的情况
+ *
+ * **********************************************************************************************
+ */
+
+ /**
+ * 定义函数
+ */
+ // 获取 URL 参数
+ // refer: https://www.cnblogs.com/chen-lhx/p/5198612.html
+ function getUrlVar(name) {
+ var vars = [], hash;
+ let paramString = window.location.href.slice(window.location.href.indexOf('?') + 1)
+ if (paramString.includes("#"))
+ paramString = paramString.substring(0, paramString.indexOf("#"))
+ var hashes = paramString.split('&');
+ for (var i = 0; i < hashes.length; i++) {
+ hash = hashes[i].split('=');
+ vars.push(hash[0]);
+ vars[hash[0]] = hash[1];
+ }
+ return decodeURIComponent(vars[name] ?? "");
+ }
+
+ // 从URL参数中剔除指定参数
+ function clearUrlParams() {
+ // 参数获取完成后,清除页面参数
+ // History.replaceState() refer: https://developer.mozilla.org/zh-CN/docs/Web/API/History/replaceState
+ // history.replaceState({}, "", "/");
+ let urlParams = (location.search + "&").replace(/__xiaomo_extension__=.*?\&/, ""); // 在最后补上一个 & ,然后替换掉 __xiaomo_extension__=xxx&
+ urlParams = urlParams.substring(0, urlParams.length - 1); // 去掉最后一个 &
+ history.replaceState({}, "", location.pathname + urlParams);
+ }
+
+ /**
+ * 开始代码逻辑
+ */
+ // 获取参数
+ let transText = getUrlVar('__xiaomo_extension__')
+
+ console.log("[小墨助手]", "transText:", transText);
+
+ // 如果没有传递参数,那么就不执行
+ if (!transText || transText.trim() == "" || transText == "undefined")
+ return
+
+ switch (window.location.host) {
+ default:
+ break;
+
+ case "baike.baidu.com": // 百度百科
+ document.getElementById("query").value = transText
+ document.getElementById("search").click()
+ // 跳转新页面,所以不需要清除页面参数
+ break;
+
+ case "fanyi.youdao.com": // 有道翻译
+ // 插件获取不到 Vue 对象(window.$,DOM元素app的properties),但是在控制台可以
+ // console.log(JSON.stringify(Object.keys(window)))
+ // console.log(Object.getOwnPropertyDescriptors(app))
+ // console.log(Object.getOwnPropertyDescriptors(document.getElementById("app")))
+
+ // let youdaoVueApp = window.app // window.app.__vue_app__.value // window.$("#app").__vue_app__
+ // console.log(youdaoVueApp)
+
+ // 获取输入框
+ let input = document.getElementById("js_fanyi_input")
+ // let submit = document.querySelector(".transBtn.searchBtn.red-button") // 此时页面上没有显示翻译按钮,所以获取不到
+ // console.log(input)
+
+ // 输入文字
+ input.innerHTML = transText
+
+ // 输入框要触发输入事件,才能显示出按钮
+ // refer: https://blog.csdn.net/weixin_54051261/article/details/125752218
+ input.dispatchEvent(
+ new Event("input", {
+ view: window,
+ bubbles: true,
+ cancelable: true,
+ })
+ )
+
+ // 光标挪到最后
+ // refer: https://blog.csdn.net/weixin_44461275/article/details/126282272
+ function keepLastIndex(obj) {
+ obj.focus(); // 解决ff不获取焦点无法定位问题
+ var range = window.getSelection(); // 创建range
+ range.selectAllChildren(obj); // range 选择obj下所有子内容
+ range.collapseToEnd(); // 光标移至最后
+ }
+ keepLastIndex(input)
+
+ // 最后清理URL上的参数
+ clearUrlParams();
+ break;
+
+ case "www.cnki.net": // 中国知网
+ document.getElementById("txt_SearchText").value = transText
+ document.querySelector(".search-btn").click()
+ break;
+
+ case "qikan.cqvip.com": // 维普期刊
+ document.getElementById("searchKeywords").value = transText
+ document.getElementById("btnSearch").click()
+ break;
+
+ }
+
+ console.log("[小墨助手]", "自动搜索模块完成搜索 [" + transText + "]");
+}
diff --git a/scripts/advanced-search/content.js b/scripts/advanced-search/content.js
new file mode 100644
index 0000000..44f44b0
--- /dev/null
+++ b/scripts/advanced-search/content.js
@@ -0,0 +1 @@
+console.log("[小墨助手]", "高级搜索功能模块加载成功");