if (!window['google']) { window['google'] = {}; } if (!window['google']['loader']) { window['google']['loader'] = {}; google.loader.ServiceBase = 'http://www.google.com/uds'; google.loader.GoogleApisBase = 'http://ajax.googleapis.com/ajax'; google.loader.ApiKey = 'notsupplied'; google.loader.KeyVerified = true; google.loader.LoadFailure = false; google.loader.Secure = false; google.loader.GoogleLocale = 'www.google.com'; google.loader.ClientLocation = null; google.loader.AdditionalParams = ''; google.loader.OriginalAppPath = 'http://localhost/jp-ip/'; (function() {var d=true,e=null,g=false,h=encodeURIComponent,j=window,k=google,m=undefined,n=document;function p(a,b){return a.load=b}var q="push",s="replace",t="charAt",u="ServiceBase",v="name",w="getTime",x="length",y="prototype",z="setTimeout",A="loader",B="substring",C="join",D="toLowerCase";function E(a){if(a in F)return F[a];return F[a]=navigator.userAgent[D]().indexOf(a)!=-1}var F={};function G(a,b){var c=function(){};c.prototype=b[y];a.S=b[y];a.prototype=new c} function H(a,b){var c=a.G||[];c=c.concat(Array[y].slice.call(arguments,2));if(typeof a.t!="undefined")b=a.t;if(typeof a.s!="undefined")a=a.s;var f=function(){var i=c.concat(Array[y].slice.call(arguments));return a.apply(b,i)};f.G=c;f.t=b;f.s=a;return f}function I(a){a=new Error(a);a.toString=function(){return this.message};return a}function J(a,b){a=a.split(/\./);for(var c=j,f=0;f2)throw I("Module: '"+r+"' not found!");else if(typeof o[1]!="undefined"){i=o[0];c.packages=c.packages||[];c.packages[q](o[1])}}var i=a;c=c||{};if(a instanceof Array||a&&typeof a=="object"&&typeof a[C]=="function"&&typeof a.reverse=="function")for(var l=0;l<\/script>");else(E("safari")||E("konqueror"))&&j[z](ca,10)}Q[q](a)} k[A].M=function(){var a=j.event.srcElement;if(a.readyState=="complete"){a.onreadystatechange=e;a.parentNode.removeChild(a);R()}};L("google.loader.domReady",k[A].M);var da={loaded:d,complete:d};function ca(){if(da[n.readyState])R();else Q[x]>0&&j[z](ca,10)}function R(){for(var a=0;a<\/script>');else a=="css"&&n.write('')}; L("google.loader.writeLoadTag",k[A].e);k[A].O=function(a){O=a};L("google.loader.rfm",k[A].O);k[A].Q=function(a){for(var b in a)if(typeof b=="string"&&b&&b[t](0)==":"&&!N[b])N[b]=new T(b[B](1),a[b])};L("google.loader.rpl",k[A].Q);k[A].P=function(a){if((a=a.specs)&&a[x])for(var b=0;b=0;r--){var o=c[r];f&&i.H(o);if(this.c[":"+o]){c.splice(r,1);f&&this.c[":"+o][q](i)}else l[q](o)}if(c[x]){if(b&&b.packages)b.packages=c.sort()[C](",");if(!b&&O[":"+this.a]!=e&&O[":"+this.a].versions[":"+a]!=e&&!k[A].AdditionalParams&&this.k){a=O[":"+this.a];k[this.a]=k[this.a]||{};for(var S in a.properties)if(S&&S[t](0)==":")k[this.a][S[B](1)]=a.properties[S];k[A].e("script",k[A][u]+a.path+ a.js,f);a.css&&k[A].e("css",k[A][u]+a.path+a.css,f)}else if(!b||!b.autoloaded)k[A].e("script",this.g(a,b),f);if(this.k){this.k=g;this.d=(new Date)[w]();if(this.d%100!=1)this.d=-1}for(r=0;r5?0:15E3)}},ga=function(){if(Z[x]){$(k[A][u]+"/stats?"+Z[C]("&")+"&nc="+(new Date)[w]()+"_"+((new Date)[w]()-fa));Z.length=0}},$=function(a){var b=new Image, c=ha++;ia[c]=b;b.onload=b.onerror=function(){delete ia[c]};b.src=a;b=e},ia={},ha=0;J("google.loader.recordStat",X);J("google.loader.createImageForLogging",$); }) ();google.loader.rm({"specs":[{"name":"books","baseSpec":{"uri":"http://books.google.com/books/api.js","ssl":null,"key":{"string":"key"},"version":{"string":"v"},"deferred":true,"params":{"callback":{"string":"callback"},"language":{"string":"hl"}}}},"feeds",{"name":"friendconnect","baseSpec":{"uri":"http://www.google.com/friendconnect/script/friendconnect.js","ssl":null,"key":{"string":"key"},"version":{"string":"v"},"deferred":false,"params":{}}},"spreadsheets","gdata","visualization",{"name":"sharing","baseSpec":{"uri":"http://www.google.com/s2/sharing/js","ssl":null,"key":{"string":"key"},"version":{"string":"v"},"deferred":false,"params":{"language":{"string":"hl"}}}},"search",{"name":"maps","baseSpec":{"uri":"http://maps.google.com/maps?file\u003dgoogleapi","ssl":"https://maps-api-ssl.google.com/maps?file\u003dgoogleapi","key":{"string":"key"},"version":{"string":"v"},"deferred":true,"params":{"callback":{"regex":"callback\u003d$1\u0026async\u003d2"},"language":{"string":"hl"}}},"customSpecs":[{"uri":"http://maps.google.com/maps/api/js","ssl":null,"key":{"string":"key"},"version":{"string":"v"},"deferred":true,"params":{"callback":{"string":"callback"},"language":{"string":"hl"}},"pattern":"^(3|3..*)$"}]},"annotations_v2","wave","orkut",{"name":"annotations","baseSpec":{"uri":"http://www.google.com/reviews/scripts/annotations_bootstrap.js","ssl":null,"key":{"string":"key"},"version":{"string":"v"},"deferred":true,"params":{"callback":{"string":"callback"},"language":{"string":"hl"},"country":{"string":"gl"}}}},"language","earth","ads","elements"]}); google.loader.rfm({":feeds":{"versions":{":1":"1",":1.0":"1"},"path":"/api/feeds/1.0/e291a634414cb5ef1c9f3b5424b8ac4b/","js":"default+ja.I.js","css":"default.css","properties":{":JSHash":"e291a634414cb5ef1c9f3b5424b8ac4b",":Version":"1.0"}},":search":{"versions":{":1":"1",":1.0":"1"},"path":"/api/search/1.0/5e8fbf48fd272a9d9731de33bdd7594f/","js":"default+ja.I.js","css":"default.css","properties":{":JSHash":"5e8fbf48fd272a9d9731de33bdd7594f",":NoOldNames":false,":Version":"1.0"}},":language":{"versions":{":1":"1",":1.0":"1"},"path":"/api/language/1.0/cd6e6992328d3619ee31352c39a90b10/","js":"default+ja.I.js","properties":{":JSHash":"cd6e6992328d3619ee31352c39a90b10",":Version":"1.0"}},":wave":{"versions":{":1":"1",":1.0":"1"},"path":"/api/wave/1.0/e9c040145229f4cf1050beef9877b18f/","js":"default.I.js","properties":{":JSHash":"e9c040145229f4cf1050beef9877b18f",":Version":"1.0"}},":spreadsheets":{"versions":{":0":"1",":0.3":"1"},"path":"/api/spreadsheets/0.3/8331b0bbcc74776270648505340e9200/","js":"default.I.js","properties":{":JSHash":"8331b0bbcc74776270648505340e9200",":Version":"0.3"}},":earth":{"versions":{":1":"1",":1.0":"1"},"path":"/api/earth/1.0/36b9e8d98246edaa2aac0e8ecc4dcec7/","js":"default.I.js","properties":{":JSHash":"36b9e8d98246edaa2aac0e8ecc4dcec7",":Version":"1.0"}},":annotations":{"versions":{":1":"1",":1.0":"1"},"path":"/api/annotations/1.0/191fcf59a77d2dafd70dd8ef38574e35/","js":"default+ja.I.js","properties":{":JSHash":"191fcf59a77d2dafd70dd8ef38574e35",":Version":"1.0"}}}); google.loader.rpl({":scriptaculous":{"versions":{":1.8.3":{"uncompressed":"scriptaculous.js","compressed":"scriptaculous.js"},":1.8.2":{"uncompressed":"scriptaculous.js","compressed":"scriptaculous.js"},":1.8.1":{"uncompressed":"scriptaculous.js","compressed":"scriptaculous.js"}},"aliases":{":1.8":"1.8.3",":1":"1.8.3"}},":yui":{"versions":{":2.6.0":{"uncompressed":"build/yuiloader/yuiloader.js","compressed":"build/yuiloader/yuiloader-min.js"},":2.7.0":{"uncompressed":"build/yuiloader/yuiloader.js","compressed":"build/yuiloader/yuiloader-min.js"},":2.8.0r4":{"uncompressed":"build/yuiloader/yuiloader.js","compressed":"build/yuiloader/yuiloader-min.js"}},"aliases":{":2":"2.8.0r4",":2.7":"2.7.0",":2.6":"2.6.0",":2.8":"2.8.0r4",":2.8.0":"2.8.0r4"}},":swfobject":{"versions":{":2.1":{"uncompressed":"swfobject_src.js","compressed":"swfobject.js"},":2.2":{"uncompressed":"swfobject_src.js","compressed":"swfobject.js"}},"aliases":{":2":"2.2"}},":ext-core":{"versions":{":3.1.0":{"uncompressed":"ext-core-debug.js","compressed":"ext-core.js"},":3.0.0":{"uncompressed":"ext-core-debug.js","compressed":"ext-core.js"}},"aliases":{":3":"3.1.0",":3.0":"3.0.0",":3.1":"3.1.0"}},":mootools":{"versions":{":1.2.3":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.1.1":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.2.4":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.2.1":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.2.2":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.1.2":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"}},"aliases":{":1":"1.1.2",":1.11":"1.1.1",":1.2":"1.2.4",":1.1":"1.1.2"}},":jqueryui":{"versions":{":1.7.2":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.6.0":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.7.0":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.7.1":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.5.3":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.8.0":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.5.2":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"}},"aliases":{":1.8":"1.8.0",":1.7":"1.7.2",":1.6":"1.6.0",":1":"1.8.0",":1.5":"1.5.3"}},":chrome-frame":{"versions":{":1.0.2":{"uncompressed":"CFInstall.js","compressed":"CFInstall.min.js"},":1.0.1":{"uncompressed":"CFInstall.js","compressed":"CFInstall.min.js"},":1.0.0":{"uncompressed":"CFInstall.js","compressed":"CFInstall.min.js"}},"aliases":{":1":"1.0.2",":1.0":"1.0.2"}},":prototype":{"versions":{":1.6.0.2":{"uncompressed":"prototype.js","compressed":"prototype.js"},":1.6.1.0":{"uncompressed":"prototype.js","compressed":"prototype.js"},":1.6.0.3":{"uncompressed":"prototype.js","compressed":"prototype.js"}},"aliases":{":1.6.1":"1.6.1.0",":1":"1.6.1.0",":1.6":"1.6.1.0",":1.6.0":"1.6.0.3"}},":jquery":{"versions":{":1.2.3":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.3.1":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.3.0":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.3.2":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.2.6":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.4.0":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.4.1":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.4.2":{"uncompressed":"jquery.js","compressed":"jquery.min.js"}},"aliases":{":1":"1.4.2",":1.4":"1.4.2",":1.3":"1.3.2",":1.2":"1.2.6"}},":dojo":{"versions":{":1.2.3":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.3.1":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.1.1":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.3.0":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.3.2":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.2.0":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.4.0":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.4.1":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"}},"aliases":{":1":"1.4.1",":1.4":"1.4.1",":1.3":"1.3.2",":1.2":"1.2.3",":1.1":"1.1.1"}}}); } if (window['google'] != undefined && window['google']['loader'] != undefined) { if (!window['google']['search']) { window['google']['search'] = {}; google.search.Version = '1.0'; google.search.NoOldNames = false; google.search.JSHash = '5e8fbf48fd272a9d9731de33bdd7594f'; google.search.LoadArgs = 'file\75uds.js\46v\0751.0\46source\75uds-nbw'; google.loader.ApiKey = 'notsupplied'; google.loader.KeyVerified = true; google.loader.LoadFailure = false; } google.loader.writeLoadTag("script", google.loader.ServiceBase + "/api/search/1.0/5e8fbf48fd272a9d9731de33bdd7594f/default+ja.I.js", false); } /** * Copyright (c) 2008 Google Inc. * * You are free to copy and use this sample. * License can be found here: http://code.google.com/apis/ajaxsearch/faq/#license */ function GSnewsBar(barRoot, options) { // IE fadein/fadeout is disabled // On IE6, when clear type is enabled, you MUST set a background color on // the element being tweaked. This is totally impractical. If you dont do this // the fonts look terrible/unreadable // // On IE7, they "fixed" the bug, but they did it by disable font smoothing so // once again, the results are terrible. Fix is to just don't do this on IE this.br_AgentContains_cache_ = {}; if (this.br_IsIE()) { this.startupDelay = 50; this.ieMode = true; } else { this.startupDelay = 0; this.ieMode = false; } this.CL_RESULTDIV = "resultDiv_gsnb"; this.CL_RESULTDIV_BOLD = "resultDiv_gsnb resultDivBold_gsnb"; // FF on win/mac has an interesting issue as well. As soon as opacity hits // 100%, the font size seems to change by a pixel or so for many fonts. // net result: visible jiggle. The "fix" is to never let ffwin/mac hit 100%... this.linkContainerClass = this.CL_RESULTDIV; if (this.br_IsNav() && (this.br_IsWin() || this.br_IsMac()) ) { if (this.br_IsMac()) { this.linkContainerClass = this.CL_RESULTDIV_BOLD; } this.shortOpacityMode = true; } else { this.shortOpacityMode = false; } this.setGlobals(); this.processArguments(barRoot, options); this.adjustGlobals(); this.buildSuperStructure(); this.buildSearchControl(); // build handlers for mousein/mouseout watchers // on this.resultsBox if ( !this.verticalMode ) { this.resultsBox.onmouseover = this.methodClosure(this, GSnewsBar.prototype.setMouseIn, [null]); this.resultsBox.onmouseout = this.methodClosure(this, GSnewsBar.prototype.setMouseOut, [null]); if (this.currentResultRoot) { this.currentResultRoot.onmouseover = this.methodClosure(this, GSnewsBar.prototype.setMouseIn, [null]); this.currentResultRoot.onmouseout = this.methodClosure(this, GSnewsBar.prototype.setMouseOut, [null]); } } // ie does not like this mode, so defer load on IE if (this.ieMode || this.startupDelay != 0) { var bootCompleteClosure = this.methodClosure(this, GSnewsBar.prototype.bootComplete, [null]); setTimeout(bootCompleteClosure, this.startupDelay); } else { this.bootComplete(); } } GSnewsBar.prototype.bootComplete = function() { // if we have an auto execute list, then start it up if (this.autoExecuteMode) { this.cycleTimeClosure = this.methodClosure(this, GSnewsBar.prototype.cycleTimeout, [null]); // if there is only a single item in the execute list, then // disable autoExecuteMode... if ( this.executeList.length == 1 || this.cycleTime == GSnewsBar.CYCLE_TIME_MANUAL ) { this.switchToListItem(0); } else { this.cycleTimeout(); } } } // cycle time for selecting a news set GSnewsBar.CYCLE_TIME_EXTRA_SHORT = 3000; GSnewsBar.CYCLE_TIME_SHORT = 10000; GSnewsBar.CYCLE_TIME_MEDIUM = 15000; GSnewsBar.CYCLE_TIME_LONG = 30000; GSnewsBar.CYCLE_TIME_MANUAL = 3000000; GSnewsBar.ONE_SECOND = 1000; GSnewsBar.THREE_SECONDS = 3000; GSnewsBar.FIVE_SECONDS = 5000; GSnewsBar.TEN_SECONDS = 10000; // cycle mode GSnewsBar.CYCLE_MODE_RANDOM = 1; GSnewsBar.CYCLE_MODE_LINEAR = 2; GSnewsBar.MAX_CACHE_LIFETIME = 50; GSnewsBar.MIN_CACHE_LIFETIME = 1; GSnewsBar.DEFAULT_CACHE_LIFETIME = 1; GSnewsBar.MAX_ERROR_COUNT = 1; GSnewsBar.DEFAULT_QUERY = "Google"; GSnewsBar.MIN_STARTUP_DELAY = 50; GSnewsBar.MAX_STARTUP_DELAY = 2000; // result style GSnewsBar.RESULT_STYLE_EXPANDED = 1; GSnewsBar.RESULT_STYLE_COMPRESSED = 2; GSnewsBar.prototype.processArguments = function(barRoot, opt_options) { this.totalFailures = 0; this.retries = 0; this.barRoot = barRoot; this.statusRoot = null; this.autoExecuteMode = false; this.executeList = new Array(); this.cycleTime = GSnewsBar.CYCLE_TIME_MANUAL; this.cycleMode = GSnewsBar.CYCLE_MODE_LINEAR; this.cycleNext = 0; this.cycleTimer = null; this.verticalMode = true; this.fadeTimer = null; this.mouseInResultArea = false; this.mouseOutCallFade = false; this.linkTarget = GSearch.LINK_TARGET_SELF; this.currentResultRoot = null; this.currentResultContainer = null; this.cacheLifetime = GSnewsBar.DEFAULT_CACHE_LIFETIME; this.fadeIncrement = 10; this.fadeTime = 400; this.fadeInCallback = GSnewsBar.methodCallback(this, GSnewsBar.prototype.fadeIn); this.fadeOutCallback = GSnewsBar.methodCallback(this, GSnewsBar.prototype.fadeOut); this.fadeOpacity = 0; // set defaults that are changable via options this.resultSetSize = GSearch.SMALL_RESULTSET; this.ST_TITLE = "In the news"; this.resultsBoxClass = this.CL_RESULTSBOX_EXPANDED; this.verticalMode = true; if (opt_options) { // horizontal if (opt_options.horizontal && opt_options.horizontal == true ) { this.verticalMode = false; } else { this.verticalMode = true; } // option.largetResultSet if (opt_options.largeResultSet && opt_options.largeResultSet == true ) { this.resultSetSize = GSearch.LARGE_RESULTSET; } else { this.resultSetSize = GSearch.SMALL_RESULTSET; } // option.resultStyle if (opt_options.resultStyle) { if (opt_options.resultStyle == GSnewsBar.RESULT_STYLE_EXPANDED) { this.resultsBoxClass = this.CL_RESULTSBOX_EXPANDED; } else if (opt_options.resultStyle == GSnewsBar.RESULT_STYLE_COMPRESSED) { this.resultsBoxClass = this.CL_RESULTSBOX_COMPRESSED; } } if (opt_options.linkTarget) { this.linkTarget = opt_options.linkTarget; } // if currentResult is specified AND we are in horizontal mode, // then pick it up. if (opt_options.currentResult && !this.verticalMode) { this.currentResultRoot = opt_options.currentResult; this.removeChildren(this.currentResultRoot); } if (opt_options.title) { this.ST_TITLE = opt_options.title; } // startupDelay if (opt_options.startupDelay && opt_options.startupDelay >= GSnewsBar.MIN_STARTUP_DELAY && opt_options.startupDelay <= GSnewsBar.MAX_STARTUP_DELAY) { this.startupDelay = opt_options.startupDelay; } // cacheLifetime if (opt_options.cacheLifetime && opt_options.cacheLifetime >= GSnewsBar.MIN_CACHE_LIFETIME && opt_options.cacheLifetime <= GSnewsBar.MAX_CACHE_LIFETIME ) { this.cacheLifetime = opt_options.cacheLifetime; } // the auto execute list contains // a cycleTime value, a cycleMode value, and an array // of searchExpressions if (opt_options.autoExecuteList) { // if specified and valid, then use it, otherwise // use default set above if (opt_options.autoExecuteList.cycleTime) { var cycleTime = opt_options.autoExecuteList.cycleTime; if (cycleTime == GSnewsBar.CYCLE_TIME_EXTRA_SHORT || cycleTime == GSnewsBar.CYCLE_TIME_SHORT || cycleTime == GSnewsBar.CYCLE_TIME_MEDIUM || cycleTime == GSnewsBar.CYCLE_TIME_LONG || cycleTime == GSnewsBar.CYCLE_TIME_MANUAL ) { this.cycleTime = cycleTime; } } // in vertical mode, cycleTime says how long // between new searches. In horizontal mode, // it's how long to keep a result up if (!this.verticalMode) { switch (this.cycleTime) { case GSnewsBar.CYCLE_TIME_EXTRA_SHORT: case GSnewsBar.CYCLE_TIME_SHORT: this.cycleTime = GSnewsBar.THREE_SECONDS; break; case GSnewsBar.CYCLE_TIME_MEDIUM: case GSnewsBar.CYCLE_TIME_MANUAL: this.cycleTime = GSnewsBar.FIVE_SECONDS; break; case GSnewsBar.CYCLE_TIME_LONG: this.cycleTime = GSnewsBar.TEN_SECONDS; break; } if (this.ieMode) { // since we are not fading in/out, lengthen the cycleTime by 1s this.cycleTime += GSnewsBar.ONE_SECOND; } } if (opt_options.autoExecuteList.cycleMode) { var cycleMode = opt_options.autoExecuteList.cycleMode; if (cycleMode == GSnewsBar.CYCLE_MODE_RANDOM || cycleMode == GSnewsBar.CYCLE_MODE_LINEAR) { this.cycleMode = cycleMode; } } // now grab the list... if (opt_options.autoExecuteList.executeList && opt_options.autoExecuteList.executeList.length > 0 ) { // grab from the list for (var i=0; i < opt_options.autoExecuteList.executeList.length; i++) { this.executeList.push( this.newListItem(opt_options.autoExecuteList.executeList[i])); } this.autoExecuteMode = true; this.currentIndex = 0; if (opt_options.autoExecuteList.statusRoot) { this.statusRoot = opt_options.autoExecuteList.statusRoot; } } } // horizontal mode MUST use autoExecute... if (!this.verticalMode && this.autoExecuteMode == false) { this.autoExecuteMode = true; this.currentIndex = 0; this.cycleTime = GSnewsBar.THREE_SECONDS; this.executeList.push(this.newListItem(GSnewsBar.DEFAULT_QUERY)); } } } GSnewsBar.prototype.testForDefaultQuery = function() { if (this.executeList.length == 1 && this.executeList[0].query == GSnewsBar.DEFAULT_QUERY) { return true; } else { return false; } } GSnewsBar.prototype.resetAutoExecuteListItems = function(newList) { if (this.autoExecuteMode && newList.length > 0) { // stop the timers... this.clearCycleTimer(); this.clearFadeTimer(); // clear the status area if (this.statusRoot) { this.removeChildren(this.statusRoot); } // nuke the old list this.executeList = new Array(); // build the new list for (var i=0; i < newList.length; i++) { this.executeList.push(this.newListItem(newList[i])); } this.currentIndex = 0; if (this.statusRoot) { this.populateStatusRoot(); } if ( this.executeList.length == 1) { this.switchToListItem(0); } else { this.cycleTimeout(); } } } GSnewsBar.prototype.adjustGlobals = function() { // horizontal mode changes certain globals... // - results are always compressed if (this.verticalMode == false) { this.resultsBoxClass = this.CL_RESULTSBOX_COMPRESSED; } } GSnewsBar.prototype.setGlobals = function() { // superstructure boxes this.CL_NEWSBARBOX = "newsBarBox_gsnb"; this.CL_NEWSBARBOXFULL = "newsBarBox_gsnb full_gsnb"; this.CL_NEWSBARBOXEMPTY = "newsBarBox_gsnb empty_gsnb"; this.CL_NEWSBARINNERBOX = "newsBarInnerBox_gsnb"; this.CL_VERTICAL = "vertical_gsnb"; this.CL_HORIZONTAL = "horizontal_gsnb"; // title this.CL_TITLEBOX = "titleBox_gsnb"; // results this.CL_RESULTSBOX_EXPANDED = "resultsBox_gsnb expanded_gsnb"; this.CL_RESULTSBOX_COMPRESSED = "resultsBox_gsnb compressed_gsnb"; this.CL_BRANDINGBOX = "brandingBox_gsnb"; this.CL_SNIPPET = "snippet_gsnb"; // status this.CL_STATUSBOXROOT = "statusBoxRoot_gsnb"; this.CL_STATUSBOX = "statusBox_gsnb"; this.CL_STATUSBOX_ONEITEM = "statusBox_gsnb oneitem_gsnb"; this.CL_STATUSITEMSEP = "statusItemSep_gsnb"; this.CL_STATUSITEM = "statusItem_gsnb"; this.CL_STATUSITEM_SELECTED = "statusItem_gsnb statusItemSelected_gsnb"; } GSnewsBar.prototype.getBarBoxClass = function(full) { var baseClass = full ? this.CL_NEWSBARBOXFULL : this.CL_NEWSBARBOXEMPTY; if (this.verticalMode) { baseClass += " " + this.CL_VERTICAL; } else { baseClass += " " + this.CL_HORIZONTAL; } return baseClass; } GSnewsBar.prototype.buildSuperStructure = function() { // create the newsBar box this.removeChildren(this.barRoot); this.barBox = this.createDiv(null, this.CL_NEWSBARBOX); this.barRoot.appendChild(this.barBox); this.innerBox = this.createDiv(null, this.CL_NEWSBARINNERBOX); this.barBox.appendChild(this.innerBox); // add in the title, statusBox, resultsBox, and branding // title this.titleBox = this.createDiv(this.ST_TITLE, this.CL_TITLEBOX); this.innerBox.appendChild(this.titleBox); // optional statusRoot, statusBox if (this.statusRoot == null) { this.statusRoot = this.createDiv(null, this.CL_STATUSBOXROOT); this.innerBox.appendChild(this.statusRoot); } this.populateStatusRoot(); // resultsBox this.resultsBox = this.createDiv(null, this.resultsBoxClass); this.innerBox.appendChild(this.resultsBox); if (this.currentResultRoot) { this.currentResultContainer = this.createDiv(null, this.CL_RESULTSBOX_EXPANDED); this.currentResultRoot.appendChild(this.currentResultContainer); } // branding var branding = this.createDiv(null, this.CL_BRANDINGBOX); this.barBox.appendChild(branding); var orientation = GSearch.HORIZONTAL_BRANDING; if (this.verticalMode == false) { orientation = GSearch.VERTICAL_BRANDING; } GSearch.getBranding(branding, orientation); this.cssSetClass(this.barBox, this.CL_NEWSBARBOXEMPTY); } GSnewsBar.prototype.buildSearchControl = function() { this.ns = new GnewsSearch(); this.ns.setResultSetSize(this.resultSetSize); this.ns.setSearcherSrc("uds-nb-" + (this.verticalMode ? "vertical" : "horizontal")); this.ns.setLinkTarget(this.linkTarget); this.ns.setSearchCompleteCallback(this, GSnewsBar.prototype.searchComplete, [true]); this.nsBypass = new GnewsSearch(); this.nsBypass.setResultSetSize(this.resultSetSize); this.nsBypass.setSearcherSrc("uds-nb-" + (this.verticalMode ? "vertical" : "horizontal")); this.nsBypass.setLinkTarget(this.linkTarget); this.nsBypass.setSearchCompleteCallback(this, GSnewsBar.prototype.searchComplete, [false]); } GSnewsBar.prototype.execute = function(query) { if (this.verticalMode == false) { this.clearFadeTimer(); this.resetAutoExecuteListItems([query]); } else { this.populateStatusRoot(); this.nsBypass.execute(query); } } GSnewsBar.prototype.executeInternal = function(query) { this.ns.execute(query); } GSnewsBar.prototype.clearAllResults = function() { this.cssSetClass(this.barBox, this.CL_NEWSBARBOXEMPTY); } GSnewsBar.prototype.searchComplete = function(fromListItem) { var ns; var cacheResults = false; var currentListItem = null; if (fromListItem) { currentListItem = this.executeList[this.currentIndex]; if (currentListItem.cacheCount == 0) { cacheResults = true; currentListItem.results = new Array(); } ns = this.ns; } else { ns = this.nsBypass; } if ( ns.results && ns.results.length > 0) { this.cssSetClass(this.barBox, this.getBarBoxClass(true)); this.removeChildren(this.resultsBox); if (!this.verticalMode) { // for horizontal mode, nuke the old results // and reset currentResultIndex this.results = new Array(); this.currentResult = 0; } // iterate over the results and capture the .html node // and append into the resultBox, OR just capture so that // we can fade it in/out for (var i = 0; i < ns.results.length; i++) { // if we are listItem based search, then cache results if (cacheResults) { currentListItem.cacheCount = 1; currentListItem.results.push(GSnewsBar.cloneObject(ns.results[i])); // reset error count based on sucessful search currentListItem.errorCount = 0; } var res = ns.results[i]; if (this.verticalMode) { var resultDiv = this.createDiv(null, this.CL_RESULTDIV); var node = res.html.cloneNode(true); this.resultsBox.appendChild(resultDiv); resultDiv.appendChild(node); } else { this.results[i] = res; } } // start the fadein, fadeout sequence if (!this.verticalMode) { this.linkContainer = this.createDiv(null, this.linkContainerClass); this.resultsBox.appendChild(this.linkContainer); this.link = document.createElement("a"); this.link.target = this.linkTarget; this.snippet = this.createSpan(" ", this.CL_SNIPPET); this.setHorizontalResultContent( this.results[this.currentResult]); this.setOpacity(this.linkContainer, 0); this.linkContainer.appendChild(this.snippet); this.linkContainer.appendChild(this.link); this.fadeOpacity = 0; this.fadeIn(); } } else { // no results, mark the container as empty this.cssSetClass(this.barBox, this.getBarBoxClass(true)); // retry another search expression if ( this.executeList.length == 1 || this.cycleTime == GSnewsBar.CYCLE_TIME_MANUAL ) { if (this.retries > 1) { // we failed the default query. Don't let this get caught // in a failure loop if (this.testForDefaultQuery()) { // stop the timers... this.clearCycleTimer(); this.clearFadeTimer(); // clear the status area if (this.statusRoot) { this.removeChildren(this.statusRoot); } return; } else { this.resetAutoExecuteListItems([GSnewsBar.DEFAULT_QUERY]); this.retries = 0; } } else { this.totalFailures++; this.retries++; } this.switchToListItem(0); } else { // this really means that this is a list item based search // that should have worked and if it had worked would have // produced results that we cache. in this case though, we // got no results so mark this, and if we get too many on // this term, throw away the search term if (cacheResults) { this.totalFailures++; currentListItem.errorCount++; // if we are getting excessive errors from this entry // then reset the list without this entry if (ns.completionStatus == 200) { currentListItem.errorCount = GSnewsBar.MAX_ERROR_COUNT + 1; } if (currentListItem.errorCount > GSnewsBar.MAX_ERROR_COUNT) { var newList = new Array(); for (var i=0; i= this.executeList.length) { this.cycleNext = 0; } } this.switchToListItem(index); if (this.verticalMode) { this.clearCycleTimer(); this.cycleTimer = setTimeout(this.cycleTimeClosure, this.cycleTime); } } } GSnewsBar.prototype.fadeIn = function() { if (this.ieMode) { // IE is very broken on the fade in/out // it ends up failing miserably on IE6 with cleartype on (well documented) // and on IE7, ends up turning off font-smoothing. So, on IE we do not // do the fade effect. this.clearFadeTimer(); this.fadeTimer = setTimeout(this.fadeOutCallback, this.cycleTime); } else { this.fadeOpacity = Math.min(this.fadeOpacity + this.fadeIncrement / this.fadeTime, 1); var fadeOpacity = this.fadeOpacity; // this trick prevents shifting on firefox/windows if (fadeOpacity >= 1 && this.shortOpacityMode) { fadeOpacity = 0.9999999; } this.setOpacity(this.linkContainer, fadeOpacity); if (this.fadeOpacity < 1) { this.fadeTimer = setTimeout(this.fadeInCallback, this.fadeIncrement); } else { this.fadeTimer = setTimeout(this.fadeOutCallback, this.cycleTime); } } } GSnewsBar.prototype.fadeOut = function() { if (this.mouseInResultArea) { this.mouseOutCallFade = true; return; } // see above if (this.ieMode) { this.fadeOpacity = 0; } else { this.mouseOutCallFade = false; this.fadeOpacity = Math.max(this.fadeOpacity - this.fadeIncrement / this.fadeTime, 0); this.setOpacity(this.linkContainer, this.fadeOpacity); if (this.fadeOpacity > 1) { this.fadeOpacity = 1; } } if (this.fadeOpacity > 0) { this.fadeTimer = window.setTimeout(this.fadeOutCallback, this.fadeIncrement); } else { if (this.currentResult+1 < this.results.length) { this.currentResult++; this.setHorizontalResultContent(this.results[this.currentResult]); this.fadeIn(); } else { this.cycleTimeout(); } } } /** * Autoexecute List Item Support */ GSnewsBar.prototype.newListItem = function(q) { var listItem = new Object(); listItem.node = null; listItem.query = q; listItem.results = new Array(); listItem.errorCount = 0; listItem.cacheCount = 0; return listItem; } GSnewsBar.prototype.switchToListItem = function(i) { // if this is from a static query term, then just return if (i == -1) { return false; } // reset selcted class of previous item // note, first time through this sets // node 0 if (this.executeList[this.currentIndex].node) { this.cssSetClass(this.executeList[this.currentIndex].node, this.CL_STATUSITEM); } this.currentIndex = i; if (this.executeList[this.currentIndex].node) { this.cssSetClass(this.executeList[this.currentIndex].node, this.CL_STATUSITEM_SELECTED); } var queryTerm = this.executeList[this.currentIndex].query; var cacheResults = false; var currentListItem = null; currentListItem = this.executeList[this.currentIndex]; // if the listItem has no cached results, OR if // we have used the cached results several times // already, initiate a real search if (currentListItem.cacheCount == 0 || currentListItem.cacheCount > this.cacheLifetime ) { currentListItem.cacheCount = 0; this.executeInternal(this.executeList[this.currentIndex].query); } else { // we have cached results and they are within the programmed // life time so use them. e.g., fake a search currentListItem.cacheCount++; this.ns.results = new Array(); for (var ri=0; ri < currentListItem.results.length; ri++) { this.ns.results.push(currentListItem.results[ri]); } this.searchComplete(true); } return false; } GSnewsBar.prototype.populateStatusRoot = function() { this.removeChildren(this.statusRoot); var sbClass = this.CL_STATUSBOX; if (this.executeList.length == 1) { sbClass = this.CL_STATUSBOX_ONEITEM; } this.statusBox = this.createDiv(null, sbClass); this.statusRoot.appendChild(this.statusBox); if ( this.executeList.length > 0) { for (var i=0; i < this.executeList.length; i++ ) { var listItem = this.executeList[i]; var displayTerm = listItem.query; var cl; if (this.verticalMode) { cl = this.createClickLink(displayTerm, null, this.CL_STATUSITEM); // add click handler... cl.onclick = this.methodClosure(this, GSnewsBar.prototype.switchToListItem, [i] ); } else { var gwsUrl = "http://news.google.com/nwshp?source=uds&q=" + encodeURIComponent(displayTerm); cl = this.createClickLink(displayTerm, gwsUrl, this.CL_STATUSITEM, GSearch.strings["more-results"] + ": " + displayTerm); } listItem.node = cl; this.statusBox.appendChild(cl); if (i+1 < this.executeList.length) { if (this.verticalMode) { this.statusBox.appendChild(this.createSpan(" ", this.CL_STATUSITEMSEP)); } } } } } /** * Static Helper Method */ GSnewsBar.methodCallback = function(object, method) { return function() { return method.apply(object, arguments); } } /** * Class methods */ GSnewsBar.prototype.methodClosure = function(object, method, opt_argArray) { return function() { return method.apply(object, opt_argArray); } } GSnewsBar.prototype.createDiv = function(opt_text, opt_className) { var el = document.createElement("div"); if (opt_text) { el.innerHTML = opt_text; } if (opt_className) { el.className = opt_className; } return el; } GSnewsBar.prototype.createSpan = function(opt_text, opt_className) { var el = document.createElement("span"); if (opt_text) { el.innerHTML = opt_text; } if (opt_className) { el.className = opt_className; } return el; } GSnewsBar.prototype.removeChildren = function(parent) { while (parent.firstChild) { parent.removeChild(parent.firstChild); } } GSnewsBar.prototype.removeChild = function(parent, child) { parent.removeChild(child); } GSnewsBar.prototype.cssSetClass = function(el, className) { el.className = className; } GSnewsBar.prototype.createClickLink = function(text, opt_href, opt_className, opt_tooltip) { var el = document.createElement("a"); if (opt_href) { el.href = opt_href; el.target = this.linkTarget; } else { el.href = "_nolink_"; } el.appendChild(document.createTextNode(text)); if (opt_className) { el.className = opt_className; } if (opt_tooltip) { el.title = opt_tooltip; } return el; } GSnewsBar.prototype.br_AgentContains_ = function(str) { if (str in this.br_AgentContains_cache_) { return this.br_AgentContains_cache_[str]; } return this.br_AgentContains_cache_[str] = (navigator.userAgent.toLowerCase().indexOf(str) != -1); } GSnewsBar.prototype.br_IsIE = function() { return this.br_AgentContains_('msie'); } GSnewsBar.prototype.br_IsKonqueror = function() { return this.br_AgentContains_('konqueror'); } GSnewsBar.prototype.br_IsOpera = function() { return this.br_AgentContains_('opera'); } GSnewsBar.prototype.br_IsSafari = function() { return this.br_AgentContains_('safari') || this.br_IsKonqueror(); } GSnewsBar.prototype.br_IsNav = function() { return !this.br_IsIE() && !this.br_IsSafari() && this.br_AgentContains_('mozilla'); } GSnewsBar.prototype.br_IsWin = function() { return this.br_AgentContains_('win'); } GSnewsBar.prototype.br_IsMac = function() { return this.br_AgentContains_('macintosh') || this.br_AgentContains_('mac_powerpc'); } GSnewsBar.prototype.br_IsLinux = function() { return this.br_AgentContains_('linux'); } GSnewsBar.prototype.setOpacity = function(element, opacity) { if (this.ieMode) { /* // on ie6, if the container doesn't have a background color // and cleartype is enabled, the text looks terrible // do not fade on ie6... // We tried limiting this to IE7, but that was a disaster // as well. IE7 seems to disable font-smoothing when you do this // making the newsbar look terrible. Fix is to just not do the // fade effect on IE at all if (navigator.userAgent.indexOf("MSIE 7") != -1) { var normalized = Math.round(opacity * 100); element.style.filter = "alpha(opacity=" + normalized + ");"; } */ return; } else { element.style.opacity = opacity; } } GSnewsBar.prototype.getNodeWidth = function(node) { return node.offsetWidth; } /** * Blogger B2 has a problem in its html/javascript widget * where it will throw away link tags. This is how the * wizards used to load their css. This piece of code does * its best to work around this problem and will try to * reload missing css */ GSnewsBar.checkAndFixBloggerCSS = function(){ if ( window._uds_nbw_donotrepair ) { return; } // same for all solutions var gsearchCssPattern = /http:\/\/www\.google\.com\/uds\/css\/gsearch\.css/; var gsearchCss = "http://www.google.com/uds/css/gsearch.css"; // adjust for each solution... var selfWizardPattern = /file=uds\.js.*?&source=uds-nbw/; var selfNewModePattern = /gsnewsbar.js\?mode=new/; var selfCss = "http://www.google.com/uds/solutions/newsbar/gsnewsbar.css"; var loadCss = function(css) { document.write(''); } var windowRef = window.location.href; var inBlogger = false; if (windowRef && windowRef != "" && windowRef.match(/http:\/\/.*?\.blogspot\.com/)) { inBlogger = true; } if (!inBlogger) { return; } // ok, so we are in blogger // now, look to see if we are running from our own // wizard code var selfNewMode = false; var selfWizard = false; var scripts = document.getElementsByTagName("script"); if (scripts && scripts.length > 0) { for (var i=0; i < scripts.length; i++) { var src = scripts[i].src; if (src.match(selfWizardPattern)) { selfWizard = true; } if (src.match(selfNewModePattern)) { selfNewMode = true; } } } if (!selfWizard) { return; } if (selfNewMode) { return; } // ok, we are running in our own wizard, in blogger // now, we need to make sure our CSS is loaded, only // we can't really know for sure, because the css tag // is next. So, what we do is look for gsearch.css (or // the global that says gsearch.css was missing because // another wizard already had to fix things up var gsearchCssMissing = true; var selfCssMissing = true; if ( !window._uds_wizards_gsearchCssMissing ) { // no other wizard discovered gsearch.css missing // so either no one else has run, or its not missing // look for gsearch.css. If its missing, load it and // load ourselves. If its found, assume ours is there as well var links = document.getElementsByTagName("link"); if (links && links.length > 0) { for (var i=0; i < links.length; i++) { if (links[i].href.match(gsearchCssPattern) ) { gsearchCssMissing = false; break; } } } if (gsearchCssMissing) { window._uds_wizards_gsearchCssMissing = true; loadCss(gsearchCss); loadCss(selfCss); } } else { // if someone else marked gsearch.css missing, then we should assume // that we are missing too and self load loadCss(selfCss); } } GSnewsBar.checkAndFixBloggerCSS(); GSnewsBar.cloneObject = function(obj) { var res = new Object(); for (var prop in obj) { switch(typeof(obj[prop])) { case "object": if (typeof(obj[prop].nodeType) == "undefined" || typeof(obj[prop].cloneNode) == "undefined") { res[prop] = GSnewsBar.cloneObject(obj[prop]); } else { try { res[prop] = obj[prop].cloneNode(true); } catch (e) { res[prop] = GSnewsBar.cloneObject(obj[prop]); } } break; default: res[prop] = obj[prop]; break; } } return res; }