{"size": 14209, "ext": "js", "max_stars_repo_path": "tests/testdata/feedgadget-min.js", "max_stars_repo_name": "Dyhzy/reducisaurus", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "tests/testdata/feedgadget-min.js", "max_issues_repo_name": "Dyhzy/reducisaurus", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tests/testdata/feedgadget-min.js", "max_forks_repo_name": "Dyhzy/reducisaurus", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 14209.0, "max_line_length": 14209, "alphanum_fraction": 0.6807657119}
(function(){var b=new gadgets.Prefs();function a(){if(gadgets.rpc){var g=gadgets.rpc.getRelayUrl("..");if(g){gadgets.window.adjustHeight()}}}function d(g,k,i,h){var j={};j[gadgets.io.RequestParameters.CONTENT_TYPE]=i;if(i==gadgets.io.ContentType.FEED){j[gadgets.io.RequestParameters.GET_SUMMARIES]=true}if(h){j[gadgets.io.RequestParameters.NUM_ENTRIES]=h}gadgets.io.makeRequest(g,k,j)}function f(g,i,h){d(g,function(j){i(j.data)},gadgets.io.ContentType.FEED,h)}function c(g,h){d(g,function(i){h(i.text)},gadgets.io.ContentType.TEXT)}var e=function(g){this.targetId=g;this.target=jQuery(this.targetId);this.target.addSection=e._appendSection;this.sections=[];this.finished=[];this.feeds=b.getArray("feeds");this.opt_defer=b.getBool("defer");this.opt_random=b.getBool("random");this.opt_gadgetTitle=b.getString("gadgetTitle");this.opt_cssUrl=b.getString("cssUrl");this.opt_maxFeeds=b.getInt("maxFeeds");this.opt_showaddbutton=b.getBool("showaddbutton");return this};e.prototype={targetId:null,target:null,feeds:b.getArray("feeds"),finished:null,opt_defer:b.getBool("defer"),opt_random:b.getBool("random"),opt_openIndex:b.getInt("openIndex"),opt_gadgetTitle:b.getString("gadgetTitle"),opt_cssUrl:b.getString("cssUrl"),opt_maxFeeds:b.getInt("maxFeeds"),opt_maxFeaturedFeeds:b.getInt("maxFeaturedFeeds"),opt_minFeaturedChrome:b.getBool("minFeaturedChrome"),opt_animate:b.getBool("animate"),sections:null,checkFinished:function(){if(this.opt_defer){if(this.finished.length>=1){jQuery(this).trigger("allComplete",[this])}}else{if(this.finished.length==this.feeds.length){jQuery(this).trigger("allComplete",[this])}}},setGadgetTitle:function(g){this.target.find("h2.fg-maintitle").html(e.msgValue(g))},getGadgetTitle:function(){return this.target.find("h2.fg-maintitle").text()},applySectionEvents:function(h){var g=this.opt_animate;h.open=function(){e._sectionOpen.call(h,null,g)};h.close=function(){e._sectionClose.call(h,null,g)};h.toggle=function(){e._sectionToggle.call(h,null,g)};h.find(".fg-subheader").bind("click",{animate:g},e._sectionToggle);return h},applyDeferEvent:function(g,i,h,j){i.find(".fg-subheader").one("deferred",{index:g,feed:h,gadget:this,section:i},j);i.find(".fg-subheader").one("deferred",{gadget:this},function(k){k.data.gadget.checkFinished()})},createRawSection:function(i,h){var g=jQuery(e.content_html);if(this.feeds.length==1){g.find(".fg-subheader:first").hide();this.setGadgetTitle(i||"")}(g.title=e._setSectionTitle).call(g,i||"");(g.content=e._setEntryHTML).call(g,h||"");g._sectionType=e.SECTION_RAW;this.applySectionEvents(g);return g},createFeedSection:function(k,j,h,i){var g=jQuery(e.feed_html);if(this.feeds.length==1){g.find(".fg-subheader:first").hide().find(".fg-subscribe").appendTo(this.target.find(".fg-header"));this.setGadgetTitle(k||"")}(g.title=e._setSectionTitle).call(g,k||"");(g.subscribe=e._setSectionSubscribeUrl).call(g,j||"#");(g.readMore=e._setSectionReadMoreUrl).call(g,i||"");(g.entry=e._setSectionEntry).call(g,h||"");g._sectionType=e.SECTION_FEED;this.applySectionEvents(g);return g},drawChrome:function(){this.target.append(jQuery(e.gadget_html).hide());this.setGadgetTitle(this.opt_gadgetTitle);var h=this.opt_openIndex||0;if(this.opt_random&&this.feeds.length>1){h=Math.ceil(this.feeds.length*Math.random())-1}jQuery(this).one("renderComplete",function(i,j){j.sections[h].open()});jQuery(this).one("allComplete",function(i,j){jQuery("#gc-blog-gadget").show();a()});var g=this;jQuery.each(this.feeds,function(j,o){var k;if((k=/(raw|escaped):(.*?):(.*)/i.exec(o))){var l;g.target.addSection((l=g.createRawSection(k[2])));if(g.opt_defer){g.applyDeferEvent(j,l,o,g._handleRawData)}else{g._handleRawData({data:{index:j,feed:o,gadget:g,section:l}})}g.sections.push(l)}else{if((k=/html:(.*?):(.*)/i.exec(o))){var l;g.target.addSection(l=g.createRawSection(k[1],k[2]));g.sections.push(l);g.finished.push({url:"n/a",section:l});g.checkFinished()}else{if((k=/frame:(.*?):(.*)/i.exec(o))){var l,n=jQuery(['<iframe src="',k[2],'" ','frameborder="0" width="100%"></iframe>'].join(""));g.target.addSection(l=g.createRawSection(k[1],n));g.sections.push(l);g.finished.push({url:k[2],section:l});g.checkFinished()}else{if((k=/featured:(.*?):(.*)/i.exec(o))){var l,m=k[1],i=k[2];g.target.addSection(l=g.createFeedSection(m));l.title(m);l.subscribe(i);if(g.opt_defer){g.applyDeferEvent(j,l,i,g._handleFeaturedContent)}else{g._handleFeaturedContent({data:{index:j,feed:i,gadget:g,section:l}})}g.sections.push(l)}else{var l,k,m;if((k=/([^:]*?):(.*:.*)/.exec(o))){m=k[1];o=k[2]}g.target.addSection(l=g.createFeedSection(m));l.title(m);l.subscribe(o);if(g.opt_defer){g.applyDeferEvent(j,l,o,g._handleFeed)}else{g._handleFeed({data:{index:j,feed:o,gadget:g,section:l}})}g.sections.push(l)}}}}});this._handleAddButton();jQuery(this).trigger("renderComplete",[this])},_handleAddButton:function(){if(this.opt_showaddbutton){jQuery(function(){var i=["http://fusion.google.com/ig/add?","synd=open&","source=ggyp&","moduleurl=",b.getString("prodGadgetUrl")].join("");var h=_args();for(var g in h){if(g.indexOf("up_")==0){i=[i,"&",g,"=",h[g]].join("")}}jQuery("#google-code-feed-gadget .fg-footer").append(['<a href="',i,'" target="_top">','<img src="http://gmodules.com/ig/images/plus_google.gif" ','style="border:none">',"</a>"].join("")).css({height:"auto",textAlign:"right",padding:"1px 0 1px 0"})})}},_handleRawData:function(j,l){var h=/(raw|escaped)\:(.*?)\:(.*)/i.exec(j.data.feed);var i=h[2],g=h[3],k=j.data.gadget;j.data.section.find(".fg-loading").show();c(g,function(m){j.data.section.find(".fg-loading").hide();j.data.section.content(i=="raw"?m:_hesc(m));if(l){l()}k.postProcess(j.data.section);k.finished.push({url:g,section:j.data.section});k.checkFinished()})},_handleFeed:function(h,k){var j=h.data.gadget;var l=h.data.feed.replace(" ","+");var g=h.data.index;var i=h.data.section;i.find(".fg-loading").show();f(l,function(n){i.find(".fg-loading").hide();if(i.title()==""){i.title(n.Title)}var m="";if(typeof n.Link=="string"){m=n.Link}else{if(typeof n.URL=="string"){m=n.URL}}m=jQuery.trim(m);i.subscribe(m);i.readMore(m);i.entry(e._buildFeedEntries(n),"last");if(k){k()}j.postProcess(i);j.finished.push({url:l,section:i});j.checkFinished()},j.opt_maxFeeds)},_handleFeaturedContent:function(h,k){var j=h.data.gadget;var l=h.data.feed.replace(" ","+");var g=h.data.index;var i=h.data.section;i.find(".fg-loading").show();f(l,function(s){i.find(".fg-loading").hide();i.subscribe(l);var u=jQuery(e.featured_content_container_html);var n=i.find(".fg-entries").addClass("fcg");u=n.empty().append(u);if(!s){u.find(".fcg-contents").append(b.getMsg("error.loading"))}else{if(j.opt_minFeaturedChrome){u.addClass("fcg-minimal");u.find(".fcg-corner").remove()}var o=[],p=u.find(".fcg-contents");for(var q=0,t;q<s.Entry.length;q++){t=jQuery("<div>").addClass("fcg-feature"+(q==0?" fcg-first-feature":""));t.html(jQuery(s.Entry[q].Summary).eq(0).html());t.append('<div class="fcg-clear"></div>');t.find("img[width=1][height=1]").css({position:"absolute"});p.append(t);o.push(t)}var r=i.find(".fcg-feature");var m=0;u.find(".fcg-previous").click(function(x){var w;var y=r.eq(m);var v=parseInt(i.css("width"));m=m==0?r.length-1:m-1;w=r.eq(m);y.hide();if(j.opt_animate){w.css({left:(v*-1)}).show().animate({left:0})}else{w.show()}}).attr("href",'javascript:void("Previous")').css("z-index","2");u.find(".fcg-next").click(function(x){var w;var y=r.eq(m);var v=i.css("width");m=m+1==r.length?0:m+1;w=r.eq(m);y.hide();if(j.opt_animate){w.css({left:v}).show().animate({left:0})}else{w.show()}}).attr("href",'javascript:void("Next")').css("z-index","2");o._feed=s}if(k){k()}j.postProcess(i);j.finished.push({url:l,section:i});j.checkFinished()},j.opt_maxFeaturedFeeds)},postProcess:function(l){var k=l.find(".fcg-contents a, .fg-entry a");var g;var h;for(var j=0;j<k.length;j++){h=k.eq(j);g=e.scrubUrl(h.attr("href"));h.attr("href",g);h.attr("target","_top")}}};jQuery.extend(e,{SECTION_RAW:"raw",SECTION_FEED:"feed",SECTION_FEATURED:"raw",SECTION_CUSTOM:"custom",gadget_html:['<div id="gc-blog-gadget" class="roundbox solidbox">','<div class="fg-header">','<h2 class="fg-maintitle"></h2>',"</div>",'<div class="fg-clearer"></div>','<div class="fg-divider"></div>','<div class="fg-footer"></div>',"</div>"].join(""),feed_html:['<div class="fg-section">','<div class="fg-subheader">','<img class="fg-sign" src="@cleardot"/>',"<span></span>",'<span class="fg-loading" style="display: none;">'," (@loading)","</span>",'<div class="fg-subscribe">','<a href="#" target="_top" title="@subscribeAltText">','<img alt="@subscribeAltText" src="@cleardot"/>',"</a>","</div>","</div>",'<div class="fg-entries">','<div class="fg-subfooter">','<a href="#" target="_top">@readmoreText</a>',"</div>","</div>",'<div class="fg-divider"></div>',"</div>"].join("").replace(/@cleardot/g,b.getString("cleardot")).replace(/@loading/g,b.getMsg("loading")).replace(/@subscribeAltText/g,b.getMsg("subscribe")).replace(/@readmoreText/g,b.getMsg("read.more")+" &#x00BB;"),feed_entry_html:['<div class="fg-entry">','<h3 class="fg-maintitle">','<a href="@titleUrl" target="_top">@titleText</a>',"</h3>",'<div class="fg-byline">',"@byline","</div>",'<div class="fg-snippet">',"@snippet","</div>","</div>",'<div class="fg-divider"></div>'].join(""),featured_content_container_html:['<a class="fcg-previous" title="@prevTitle" href="">&#x00AB;</a>','<div class="fcg-contents"></div>','<a class="fcg-next" title="@nextTitle" href="">&#x00BB;</a>','<div class="fcg-footer"></div>','<div class="fcg-corner fcg-tl"></div>','<div class="fcg-corner fcg-tr"></div>','<div class="fcg-corner fcg-bl"></div>','<div class="fcg-corner fcg-br"></div>'].join("").replace(/@prevTitle/g,b.getMsg("previous")).replace(/@nextTitle/g,b.getMsg("next")),content_html:['<div class="fg-section">','<div class="fg-subheader">','<img class="fg-sign" src="@cleardot"/>',"<span></span>",'<span class="fg-loading" style="display: none;">'," (@loading)","</span>","</div>",'<div class="fg-entries">','<div class="fg-entry"></div>',"</div>",'<div class="fg-divider"></div>',"</div>"].join("").replace(/@cleardot/g,b.getString("cleardot")).replace(/@loading/g,b.getMsg("loading")),msgValue:function(h){var g=/__MSG_(.*?)__/.exec(h);return g?b.getMsg(g[1]):h},scrubUrl:function(g){return g.replace(/^(%20)*(.*?)(%20)*$/,"$2")},_sectionOpen:function(k,g){var j=jQuery(this);var i=j.data("events");var l=g?"slideDown":"show";if(!j.is(".fg-subheader")){j=j.find(".fg-subheader");i=j.data("events")}var h=function(){if(j.is(":not(.fg-expanded)")){j.addClass("fg-expanded").siblings(".fg-entries:first")[l]()}a()};if(i&&i.deferred){j.trigger("deferred",[h])}else{h()}},_sectionClose:function(i,g){var h=jQuery(this);if(h.is(".fg-expanded")){h.removeClass("fg-expanded").siblings(".fg-entries:first")[g?"slideUp":"hide"]()}a()},_sectionToggle:function(k,g){var j=jQuery(this);if(k&&k.data&&k.data.animate){g=true}if(j.is(".fg-expanded")){e._sectionClose.call(this,null,g)}else{e._sectionOpen.call(this,null,g)}var l=j.parent().siblings(".fg-section").children(".fg-subheader.fg-expanded");for(var h=0;h<l.length;h++){e._sectionClose.call(l[h],null,g)}a()},_setSectionTitle:function(h,g){var i=this.find(".fg-subheader").eq(g||0);if(!i.is(":visible")){i=this.parents("#gc-blog-gadget").find(".fg-maintitle");if(!i.length){return}}if(!h){return i.find("span:first").html()}else{i.find("span:first").html(e.msgValue(h))}return this},_setSectionEntry:function(h,g){if(!h){return this.find(".fg-entry").eq(parseInt(g)||0)}if(!parseInt(g)&&g=="last"){if(this.find(".fg-entry").length==0){return this.find(".fg-subfooter").before(h).end()}else{return this.find(".fg-entries .fg-entry:last").after(h).end()}}else{g=0}if(this.find(".fg-entry").length==0){return this.find(".fg-entries").prepend(h).end()}else{return this.find(".fg-entries .fg-entry").eq(parseInt(g)||0).prepend(h).end()}},_buildFeedEntries:function(j){var o=[];if(!j||!j.Entry){o.push(['<div class="fg-entry">',"<b>Error loading feed!</b>","</div>",'<div class="fg-divider"></div>'].join(""));return o}for(var x=0,i;x<j.Entry.length;x++){var w=j.Entry[x].Summary;var g=w.length>120?"...":"";var B=j.Entry[x].Title;var r=j.Entry[x].Link;var k=null;var z=null;var n=null;var y=null;var h="";if(j.URL.indexOf("spreadsheets.google.com")!=-1){var l=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"];for(var v=0;v<l.length;v++){l[l[v]]=v}var C=w.split(",");var q={};for(var s=0,t,A,u;s<C.length;s++){t=C[s].split(":");A=jQuery.trim(t[0]);t.splice(0,1);u=jQuery.trim(t.join(":"));q[A]=u}B=q.title||"";r=q.link||"";w=q.content||"";k=/(^\d{1,2})-(.*?)-(\d*)/.exec(q.date);if(k){z=l[k[2].toLowerCase()];y=b.getMsg("month."+z)+" "+k[1]+", "+k[3]}else{y=""}}else{if(!y&&j.Entry[x].Date){k=new Date(j.Entry[x].Date);if(k.getFullYear){n=k.getFullYear()}else{n=k.getYear();if(n<2000){n+=1900}}y=b.getMsg("month."+k.getMonth())+" "+k.getDate()+", "+n}else{y=""}}w=w.replace(/<.*?>/g," ").substr(0,120)+g;if(y.length){h+=y}i=this.feed_entry_html.replace(/@titleText/g,B).replace(/@byline/g,h).replace(/@titleUrl/g,r).replace(/@snippet/g,w);o.push(i)}return o.join("")},_appendSection:function(g){if(!g){return}return this.find(".fg-section:last, .fg-divider:first").eq(0).after(g)},_setSectionSubscribeUrl:function(k,h,j){var g=this.find(".fg-subscribe").eq(j||0);if(!g.length){g=this.parent().find(".fg-header .fg-subscribe");if(g.length==0){return}}if(!k){return g.find("a:first").attr("href")}var i=e.scrubUrl(k);g.find("a:first").attr("href",e.msgValue(i)).end().end();if(h){g.find("a:first").attr("title",e.msgValue(h)).find("img:first").attr("alt",e.msgValue(h)).end().end()}return this},_setSectionReadMoreUrl:function(i,h){if(!i){return this.find(".fg-subfooter").eq(h||0).find("a:first").attr("href")}var g=e.scrubUrl(i);return this.find(".fg-subfooter").eq(h||0).find("a:first").attr("href",e.msgValue(g)).end().end()},_setEntryTitle:function(h,g){if(!h){return this.find(".fg-maintitle").eq(g||0).find("a:first").text()}return this.find(".fg-maintitle").eq(g||0).find("a:first").html(e.msgValue(h)).end().end()},_setEntryHTML:function(h,g){if(!h){return this.find(".fg-entry").eq(g||0)}return this.find(".fg-entry").eq(g||0).html(e.msgValue(h)).end()}});window.FeedGadget=e})();