CINXE.COM

Showcase — Google Developers

<!DOCTYPE html> <html lang="en" class="devsite"> <head><script type="text/javascript" src="/_static/js/bundle-playback.js?v=HxkREWBo" charset="utf-8"></script> <script type="text/javascript" src="/_static/js/wombat.js?v=txqj7nKC" charset="utf-8"></script> <script>window.RufflePlayer=window.RufflePlayer||{};window.RufflePlayer.config={"autoplay":"on","unmuteOverlay":"hidden"};</script> <script type="text/javascript" src="/_static/js/ruffle/ruffle.js"></script> <script type="text/javascript"> __wm.init("https://web.archive.org/web"); __wm.wombat("https://developers.google.com/showcase/","20130122003613","https://web.archive.org/","web","/_static/", "1358814973"); </script> <link rel="stylesheet" type="text/css" href="/_static/css/banner-styles.css?v=S1zqJCYt" /> <link rel="stylesheet" type="text/css" href="/_static/css/iconochive.css?v=3PDvdIFv" /> <!-- End Wayback Rewrite JS Include --> <meta charset="utf-8"/> <script src="/web/20130122003613js_/https://developers.google.com/_static/js/script_head.js"></script> <link rel="stylesheet" type="text/css" href="/web/20130122003613cs_/https://developers.google.com/_static/css/screen.css"/> <link rel="shortcut icon" href="/web/20130122003613im_/https://developers.google.com/_static/images/favicon.ico"> <link rel="apple-touch-icon" href="/web/20130122003613im_/https://developers.google.com/_static/images/apple-touch-icon.png"> <link href="//web.archive.org/web/20130122003613cs_/https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet" type="text/css"> <script src="//web.archive.org/web/20130122003613js_/https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> <script id="jqueryui" src="//web.archive.org/web/20130122003613js_/https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"></script> <script src="//web.archive.org/web/20130122003613js_/https://www.google.com/jsapi?key=AIzaSyCZfHRnq7tigC-COeQRmoa9Cxr0vbrK6xw"></script> <script type="text/javascript" src="//web.archive.org/web/20130122003613js_/https://www.gstatic.com/feedback/api.js"></script> <script type="text/javascript" src="/web/20130122003613js_/https://developers.google.com/jsi18n/"></script> <!--[if lt IE 9]> <script src="/_static/js/html5shim/html5.js"></script> <![endif]--> <title>Showcase &mdash; Google Developers</title> <meta property="og:title" content="Google Developer Showcase"/> <meta property="og:image" content="https://web.archive.org/web/20130122003613im_/https://developers.google.com/_static/images/developers-logo.png"/> <meta property="og:description" content="Be inspired by how others are using Google technologies."/> </head> <body class="showcase"> <div id="sandbar"> <a href="/web/20130122003613/https://developers.google.com/sandbar?q=&amp;page_url=/showcase/"></a> <div id="gc-googlebar"></div> <img src="/web/20130122003613im_/https://developers.google.com/_static/images/google-logo.png" style="display:none;"/> </div> <div id="gc-wrapper"> <input id="gc-analytics" type="hidden" value="UA-24532603-1"/> <div id="gc-topnav"> <div> <ul> <li class=""><a href="/web/20130122003613/https://developers.google.com/">Home</a></li> <li class=""><a href="/web/20130122003613/https://developers.google.com/products/">Products</a></li> <li class=""><a href="/web/20130122003613/https://developers.google.com/events/">Conferences</a></li> <li class="active"><a href="/web/20130122003613/https://developers.google.com/showcase/">Showcase</a></li> <li class=""><a href="/web/20130122003613/https://developers.google.com/live/">Live</a></li> <li class=""><a href="/web/20130122003613/https://developers.google.com/groups/">Groups</a></li> </ul> </div> </div> <div id="gc-appbar"> <h1>Showcase <div id="notification-container"> <div id="notification">Loading...</div> </div> </h1> <div id="kicker"><h4 style="float:left">Discover cool stuff that other developers have built</h4> <span id="embed-showcase-container" class="embed-showcase-panel" style="display: block"></span> </div> </div> <div id="gc-main"> <div id="gc-content"> <div class="widget-overlay" id="widget-overlay"></div> <div id="showcase"> <div id="tag-component"></div> <div id="showcaseappview"> <div id="viewpane"> <div id="viewpane-toolbar" class="viewpane-toolbar"></div> <div id="viewpane-content" class="viewpane-content"> <div id="content-template" class="detail-panel-content" style="display: none"> <div class="detail-panel-content-inner"> <table class="detail-table"> <tr> <td class="header-col" colspan="2"> <div class="float-right header-right"></div> <div class="header-left"> <h1 class="float-left project-title" id="project-title"> </h1> </div> </td> </tr> <tr> <td class="col-1"> <div class="project-details-menu"> <div class="project-details-menu-item project-details-menu-item-selected project-info-button"> Project Info </div> <div class="project-details-menu-item how-to-button"> How To </div> </div> <div class="project-info"> <div class="project-developer"> </div> <div class="project-description"> </div> <div class="project-tags"> </div> </div> <div class="how-to">How To</div> </td> <td class="col-2"> <div class="project-image"> <img src="/web/20130122003613im_/https://developers.google.com/showcase/" alt="project image"> </div> </td> </tr> </table> </div> </div> </div> </div> </div> <div id="notification-container-bottom"> <div id="notification-bottom" style="display: none;"> Loading... </div> </div> </div> </div> </div> <footer id="gc-footer"> <div id="gc-copyright"> <a href="/web/20130122003613/https://developers.google.com/"> <img id="developers-logo-footer" src="/web/20130122003613im_/https://developers.google.com/_static/images/developers-logo-footer.png" alt="Google Developers logo" style="vertical-align: center; float: left"/> </a> <ul> <li><a href="https://web.archive.org/web/20130122003613/http://www.google.com/">Google</a></li> <li><a href="/web/20130122003613/https://developers.google.com/readme/terms">Terms of Service</a></li> <li><a href="https://web.archive.org/web/20130122003613/http://www.google.com/intl/en/privacy/">Privacy Policy</a></li> <li><a href="/web/20130122003613/https://developers.google.com/jobs">Jobs</a></li> <li><a class="google-feedback" data-p="81425" data-b="Showcase" data-v="devsite-20130118-rc00.364681418466479150" href="">Report a bug</a></li> </ul> </div> <div id="gc-language"> <ul> <li> <form id="setlang" action="/web/20130122003613/https://developers.google.com/i18n/setlang/" method="post"> <div style="display:none"><input type="hidden" name="csrfmiddlewaretoken" value="faa06506f23c50523e6062c26806c828"/></div> <select id="footer_language" name="language"> <option value="ar"> العربيّة </option> <option value="bg"> български </option> <option value="ca"> català </option> <option value="zh-cn"> 简体中文 </option> <option value="zh-tw"> 繁體中文 </option> <option value="hr"> Hrvatski </option> <option value="cs"> česky </option> <option value="da"> Dansk </option> <option value="nl"> Nederlands </option> <option value="en" selected="selected"> English </option> <option value="fa"> فارسی </option> <option value="fi"> suomi </option> <option value="fr"> Français </option> <option value="de"> Deutsch </option> <option value="el"> Ελληνικά </option> <option value="he"> עברית </option> <option value="hi"> Hindi </option> <option value="hu"> Magyar </option> <option value="id"> Bahasa Indonesia </option> <option value="it"> italiano </option> <option value="ja"> 日本語 </option> <option value="ko"> 한국어 </option> <option value="lv"> latviešu </option> <option value="lt"> Lithuanian </option> <option value="nb"> Norsk (bokmål) </option> <option value="nn"> Norsk (nynorsk) </option> <option value="pl"> polski </option> <option value="pt-br"> Português Brasileiro </option> <option value="pt"> Português </option> <option value="ro"> Română </option> <option value="ru"> Русский </option> <option value="sr"> српски </option> <option value="sk"> slovenský </option> <option value="sl"> Slovenščina </option> <option value="es"> español </option> <option value="sv"> Svenska </option> <option value="th"> Thai </option> <option value="tr"> Türkçe </option> <option value="uk"> Українська </option> <option value="vi"> Vietnamese </option> </select> </form> </li> </ul> </div> </footer> </div> <div id="needAuth" class="msgDialogContent"> <h1>Authentication required</h1> <div> You need to be signed in with <a href="https://web.archive.org/web/20130122003613/http://www.google.com/+">Google+</a> to do that. </div> <button>Sign in</button> <button>Cancel</button> </div> <div id="signingIn" class="msgDialogContent"> <h1>Signing you in...</h1> <div> Google Developers needs your permission to do that. </div> <button>Try again</button> <button>Cancel</button> </div> <script src="/web/20130122003613js_/https://developers.google.com/_static/js/script_foot.js"></script> <script> (function($) { devsite.devsite.Init($, null, ''); })(jQuery); devsite.localInit = function() { // Initialize widget creator only if user is admin. devsite.showcase.init(); var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://web.archive.org/web/20130122003613/https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); window.___gcfg = { parsetags: 'explicit' }; }; var d=!0,f=null,k=!1,l,m=window.devsite||{};window.devsite=m;var _gaq=_gaq||[];WebFontConfig={google:{families:["Open+Sans"]}};m.location=window.location;m.reloadWindow=function(){m.location.reload()};m.openWindow=window.open;m.devsite=m.devsite||{};m.devsite.dialogConfig={autoOpen:k,modal:d,show:"fade",dialogClass:"msgDialog",closeText:"",resizable:k,draggable:k,zIndex:9999};m.KD_FADE_LONG=218;m.KD_FADE_SHORT=130;m.permanentUrl=m.permanentUrl||{};m.permanentUrl.Widget=function(a){this.parentContainer_=a;this.addButton()};l=m.permanentUrl.Widget.prototype;l.addButton=function(){this.buttonContainer_=$("<div />").addClass("permanent-url-button");var a=$("<div />").addClass("permanent-url-icon");this.buttonContainer_.append(a);this.setButtonEvents_();this.parentContainer_.append(this.buttonContainer_)}; l.setButtonEvents_=function(){var a=this;this.buttonContainer_.bind("click",function(b){b.stopPropagation();a.popupContainer_?a.popupContainer_.toggle():(a.addPopUp(),a.setPopupTextBox(),a.popupContainer_.show());a.popupContainer_.find("input").select()});$("body").bind("click",function(){a.hidePopUp()})}; l.addPopUp=function(){this.popupContainer_=$("<div />").addClass("permanent-url-popup");this.popUpTextBox_=$("<input />");this.popUpTextBox_.click(function(a){a.stopPropagation();this.focus();this.select()});this.popupContainer_.append(this.popUpTextBox_);this.parentContainer_.append(this.popupContainer_);var a=this.buttonContainer_.outerHeight(),b=this.buttonContainer_.outerWidth(),a=this.buttonContainer_.offset().top+a,b=this.buttonContainer_.offset().left-this.popupContainer_.outerWidth()+b;this.popupContainer_.offset({top:a, left:b});this.popupContainer_.hide()};l.hidePopUp=function(){this.popupContainer_&&this.popupContainer_.hide()};l.setPermanentUrl=function(a){this.permanentUrl_=m.location.host+m.location.pathname+a.replace(/\s+/g,"+")};l.getPermanentUrl=function(){return this.permanentUrl_};l.setPopupTextBox=function(){this.popUpTextBox_&&this.popUpTextBox_.length&&this.popUpTextBox_.attr("value",this.permanentUrl_)};m.tag=m.tag||{};m.tag.Widget=m.tag.Widget||{};window.gettext=function(a){return a};m.tag.Widget=function(a,b,c,e,g){this.module_=c;this.modelClass_=e;this.categoryTagName_=b;this.parentContainer_=$("#tag-component");this.optHidePermalink_=g;this.container_=this.buildBar();this.filters_=[];this.OTHER_CATEGORY_NAME_="others";this.selectedTabIndex_=0;this.init()};l=m.tag.Widget.prototype; l.init=function(){$("#tag-component").bind("update_tags",$.proxy(this,"handleClickedTag"));this.parentContainer_.append(this.container_);this.updateFilters("",0)}; l.updateFilters=function(a,b,c){var e="/tags/filters",g="";a&&(g=a.join(","));$("#notification").show();$.post(e,{module:this.module_,entity:this.modelClass_,filters:g},$.proxy(function(e){var g=this;if(e.success&&(g.filters_=e.result1,g.container_.show(),b)){e=g.buildFilterList(a);$("#filter-options").html()&&$("#filter-options").remove();g.container_.append(e);this.adjustHeight_();for(var i in a)g.updateSelectedTagsBar(a[i]);$("#notification").hide();g.optHidePermalink_||(g.permanentUrl_.setPermanentUrl(a&& a.length?"#tags="+a.join(","):""),g.permanentUrl_.setPopupTextBox(),a&&a.length?(g.permanentUrlContainer.show(),g.clearButton_.show()):g.permanentUrlContainer.hide(),c&&this.toggleButton_.click());$("#filter-options").removeClass("filter-option-click-disabled");$("#selected-tags").removeClass("filter-option-click-disabled")}},this))}; l.buildBar=function(){var a=$("<div />").addClass("filter-bar filter-bar-fixed").attr({id:"filter-bar"});this.toggleButton_=$("<div/>").text("Add a Filter").attr("class","button button-blue toggle-button");this.clearButton_=$("<div/>").text("Clear all Filters").attr("class","button clear-button").hide();this.header_right=$("<div />").addClass("header-right").addClass("float-right");this.optHidePermalink_||(this.permanentUrlContainer=$("<div />").addClass("permanent-url-container"),this.header_right.append(this.permanentUrlContainer), this.permanentUrl_=new m.permanentUrl.Widget(this.permanentUrlContainer),this.permanentUrlContainer.hide());this.header_right.append(this.clearButton_).append(this.toggleButton_);this.currentFilterList=$("<div />").addClass("header-element current-filters");this.resultsCounter=$("<div />").addClass("header-element results-counter").attr("id","result-counter");this.header_left=$("<div />").addClass("header-left");this.header_left.append(this.currentFilterList).append(this.resultsCounter);this.selectedTags= $("<div />").addClass("header-element").attr("id","selected-tags");this.selectedTags.append($("<span />").text("Selected Filters:").attr("class","tag-text"));this.header_left.append(this.selectedTags);var b=this;this.toggleButton_.click(function(){if($("#filter-options").html())"none"==$("#filter-options").css("display")?(a=$("#filter-options").height(),$("#filter-options").css("height",0),$("#filter-options").show(),$("#filter-options").animate({height:a},"slow"),b.toggleButton_.text("Hide Filters")): ($("#filter-options").height(),$("#filter-options").hide(),b.toggleButton_.text("Add a Filter"));else{a=b.buildFilterList();b.container_.append(a);b.adjustHeight_();var a=$("#filter-options").height();$("#filter-options").css("height",0);$("#filter-options").animate({height:a},"slow");b.toggleButton_.text("Hide Filters")}});this.clearButton_.click(function(){b.updateFilters("",1,$("#filter-options").is(":hidden"));$("#tag-component").trigger("tag_changed",{tags:[]});$(".selected-tag").parent().remove(); $("#selected-tags").css("display","none");b.clearButton_.hide()});a.append(this.header_right);a.append(this.header_left);a.hide();return a}; l.buildFilterList=function(a){var b=this.filters_,c=$("<div />").addClass("filter-list").attr("id","filter-options"),e=$("<div>Filter By:</div>").attr("class","tag-text");c.append(e);a=a||[];var g=$("<div />").attr("id","vtab"),h=$("<ul></ul>");g.append(h);var j=this.getSortedCategoryTabs_(b),i;for(i in j){var n=j[i],r=$.trim(n);h.append($("<li>").text(r));for(var r=$('<div id="cat-div" style="display: none;">'),n=b[n],v=this.getSortedTags_(n),s=0;s<v.length;s++){var t=$("<div />").addClass("filter-tag"), q,u=v[s];q=n[u];var w=q.name,A=q.count,x=$("<label />").attr({"for":u,id:u+"-label"});0==A?(q=this.getCheckBox_(w,u,k),x.addClass("disabled"),x.text(w)):(q=this.getCheckBox_(w,u,d),x.text(w+" ("+A+")"));t.append(q);t.append(x);-1!=a.indexOf(u)&&(q.attr("checked",d),q.attr("disabled",k));var z=this;q.bind("change",function(a){z.checkBoxChangeHandler_(a)});r.append(t)}g.append(r);c.append(e)}var y=h.children();y.eq(this.selectedTabIndex_).addClass("selected");z=this;y.click(function(a){z.tabChangeHandler_(a, y,g)});c.append(g);y.eq(this.selectedTabIndex_).click();return c};l.handleClickedTag=function(a,b){var c=b.tags;this.updateFilters(c,1,b.isHideWidget);for(var e in c)this.updateSelectedTagsBar(c[e]);this.clearButton_.show();this.toggleButton_.text("Hide Filters")}; l.updateSelectedTagsBar=function(a){var b=this;$("#selected-tags").is(":visible")||($("#selected-tags").show(),$("#selected-tags").css("display","inline-block"));if($("#"+a).is(":checked")){var c=$("#"+a).attr("value");if(!$("#tag-"+a).length){var e=$("<span />").addClass("selected-tag").text(c),c=$("<span />").addClass("selected-tag close-span").attr("id","tag-"+a).text("x"),e=$("<span />").append(e,c),b=this;$(c).click(function(){$("#"+a).removeAttr("checked");$("#"+a).triggerHandler("change"); b.updateSelectedTagsBar(a);$("#filter-options").is(":visible")||b.toggleButton_.click()});$("#selected-tags").append(e)}}else $("#tag-"+a).parent().remove(),$(".selected-tag")[0]||$("#selected-tags").hide()};l.getSortedCategoryTabs_=function(a){var b=[],c="",e;for(e in a)$.trim(e).toLowerCase()==this.OTHER_CATEGORY_NAME_?c=e:b.push(e);b.sort();c&&b.push(c);return b};l.getSortedTags_=function(a){var b=[],c;for(c in a)b.push(c);return b.sort(function(a,b){return a.toLowerCase().localeCompare(b.toLowerCase())})}; l.getCheckBox_=function(a,b,c){a=$("<input/>").attr({type:"checkbox",name:"filters",id:b,value:a,"class":"kd-checkbox"});c||(a.addClass("tag-check"),a.attr("disabled","true"));return a}; l.checkBoxChangeHandler_=function(a){var b=[],c=$(a.target),e=c.attr("id");c.is(":checked")?(b.push(e),this.container_.find("#"+e).attr("checked","checked")):this.container_.find("#"+e).removeAttr("checked");this.container_.find('input:checkbox[name="filters"]:checked').each(function(){var a=$(this).attr("id");-1==$.inArray(a,b)&&b.push(a)});b.length?this.clearButton_.show():this.clearButton_.hide();$("#tag-component").trigger("tag_changed",{tags:b});$("#filter-options").addClass("filter-option-click-disabled"); $("#selected-tags").addClass("filter-option-click-disabled");this.updateFilters(b,1);this.updateSelectedTagsBar($(a.target).attr("id"))};l.tabChangeHandler_=function(a,b,c){b.removeClass("selected");$(a.target).addClass("selected");a=b.index($(a.target));c.children("div").hide().eq(a).show();this.selectedTabIndex_=a;this.adjustHeight_();c=$("#filter-options").find(".tag-text").eq(0).height();a=$("#vtab").height();c+=a;$("#filter-options").animate({height:c},"fast")}; l.adjustHeight_=function(){var a=$("#vtab").find("#cat-div").height(),b=$("#vtab").find("ul").height();a<b&&$("#vtab").find("#cat-div").css("min-height",b)};m.tag.Widget.SetResultCounterText=function(a,b){var c;c=b?gettext("%s results"):gettext("All %s results");c=interpolate(c,[a]);$("#result-counter").html(c)};m.showcase=m.showcase||{};m.showcase.init=function(){new m.tag.Widget("tag-component","projects","showcase","ShowcaseItem");var a="next",b=m.location.hash.substr(1);0<b.length&&"item"===b.substr(0,4)&&(a=a+"?"+b);$.get(a,function(a){a.success&&new m.showcase.Showcase(a.result,$("#viewpane").get(0),a.result.title)})}; m.showcase.Showcase=function(a,b,c){function e(a){g.onKeyPress(a)}this.model=p.getInstance();this.mainView=new m.showcase.ShowcaseView(b,a.cursor,a.count);this.model.init(c,a.projects);this.historyManager=new m.showcase.ShowcaseHistory;this.init();var g=this;$(document).unbind("keyup",e);$(document).bind("keyup",e)};m.showcase.fixResourceProtocol=function(a){var b=a.match(/^(https?:)\/\//i);b&&(b[1]&&b[1]!==m.location.protocol)&&(a=a.replace(b[1],m.location.protocol));return a}; m.showcase.Showcase.prototype.init=function(){this.mainView.renderer();this.historyManager.updateShowcaseState()};m.showcase.Showcase.prototype.onKeyPress=function(a){var b={ARROW_LEFT:37,ARROW_UP:38,ARROW_RIGHT:39,ARROW_DOWN:40};a.keyCode==b.ARROW_LEFT?this.model.getCurrentList().setPrevious():a.keyCode==b.ARROW_UP?this.model.getCurrentList().setPreviousRow():a.keyCode==b.ARROW_RIGHT?this.model.getCurrentList().setNext():a.keyCode==b.ARROW_DOWN&&this.model.getCurrentList().setNextRow()}; jQuery.inherit=function(a,b){function c(){}c.prototype=b.prototype;a.superClass_=b.prototype;a.prototype=new c;a.prototype.constructor=a};function p(a){p.getInstance||(p.getInstance=function(){return a},a=this);this.MAX_SPOTLIGHT_ITEMS=12;this.permanentCurrentItemName_=this.currentItemId_=this.currentList_=this.spotlightData_=this.data_=this.title_=f}new p;l=p.prototype;l.init=function(a,b){this.title_=a;this.data_=b.slice();this.filters_=[];this.checkData();$("#tag-component").unbind("tag_changed");$("#tag-component").bind("tag_changed",$.proxy(this,"handleFilteredChange"))}; l.handleFilteredChange=function(a,b){this.setCurrentItemId(f);this.setPermanentCurrentItemName(f);this.filters_=b.tags;$(this).trigger("filtersChanged")};l.getListData=function(){for(var a=[],b=this.data_.length,c=0;c<b;c++)!this.data_[c].spotlight&&!this.data_[c].spotlight_featured&&a.push(this.data_[c]);return a}; l.getSpotlightData=function(){this.spotlightData_=[];for(var a=this.data_.length,b=0;b<a;b++)this.data_[b].spotlight_featured&&this.spotlightData_.push(this.data_[b]);this.spotlightData_.sort(function(a,b){var g=a.created_on,h=b.created_on;return g<h?1:g>h?-1:0});return this.spotlightData_.slice(0,this.MAX_SPOTLIGHT_ITEMS)}; l.updateData=function(a){var b=this.data_.length;if(this.permanentCurrentItemName_){for(var c=k,e=0,g=a.length;e<g;e++)a[e].name!=this.permanentCurrentItemName_?this.data_.push(a[e]):c=d;c&&this.setPermanentCurrentItemName(f)}else this.data_=this.data_.concat(a);this.checkData();return a=this.data_.slice(b)}; l.checkData=function(){for(var a=this.data_.length,b=0;b<a;b++){this.data_[b].id=b;this.data_[b].images?this.data_[b].images.split&&(this.data_[b].images=this.data_[b].images.split("|")):this.data_[b].images=["default.jpg"];if(!this.data_[b].thumb||""==this.data_[b].thumb)this.data_[b].thumb="default.jpg";this.data_[b].thumb=this.data_[b].thumb}}; l.setCurrentList=function(a){this.currentList_&&(this.currentList_!=a&&this.currentList_.currentSpacer)&&this.currentList_.closeItem();this.currentList_=a};l.getCurrentList=function(){return this.currentList_};l.setCurrentItemId=function(a){this.currentItemId_=a;$(this).trigger("currentItemChanged",[a])};l.getCurrentItemId=function(){return this.currentItemId_};l.setPermanentCurrentItemName=function(a){this.permanentCurrentItemName_=a};l.getPermanentCurrentItemName=function(){return this.permanentCurrentItemName_}; l.getData=function(){return this.data_};l.setData=function(a){this.data_=a;this.checkData()};l.getFilters=function(){return this.filters_};l.getItemByName=function(a){for(var b=0;b<this.data_.length;b++)if(this.data_[b].project_name==a)return this.data_[b];return f};m.showcase=m.showcase||{};m.showcase.ShowcaseThumbnail=function(a,b){this.model=p.getInstance();this.init(a,b)};l=m.showcase.ShowcaseThumbnail.prototype;l.init=function(a,b){this.id=a;this.container=this.image=this.title=f;this.list=b;this.overlay=this.hoverTarget=f;var c=this;$(this.model).unbind("currentItemChanged.Thumbnail");$(this.model).bind("currentItemChanged.Thumbnail",function(a,b){c.checkState(b)})}; l.getThumbElement=function(a){var b=a.thumb?a.thumb:a.images[0],b=m.showcase.fixResourceProtocol(b),b=$("<img />").attr("src",b).attr("width","215").attr("height","121");this.image=$("<div>").addClass("image").append(b);this.title=$("<div>");this.title.addClass("title").text(a.project_name);this.container=$("<div>").addClass("list-item").append(this.image).append(this.title);var c=this;this.container.bind("click",function(){c.itemClick()});b.bind("mouseenter",function(){c.addHover()});return this.container}; l.itemClick=function(){this.model.getCurrentItemId()==this.id?this.model.setCurrentItemId(f):(this.list.wrapper&&this.list.wrapper.trigger("mouseleave"),this.model.setCurrentList(this.list),this.model.setCurrentItemId(this.id))};l.setSize=function(a,b){b||(b=Math.round(9*a/16+60));this.container.width(a).height(b)};l.checkState=function(a){a=a==this.id?d:k;this.setState(a)};l.setState=function(a){this.container.toggleClass("list-item-selected",a)}; l.addHover=function(){if(this.model.getCurrentItemId()!=this.id){var a=this;this.list.wrapper||(this.list.wrapper=$("<div />").attr("id","wrapper").addClass("list-item list-hover-item"),this.list.container.append(this.list.wrapper),this.list.wrapper.bind("mouseleave",function(){$(this).stop(d,d).mouseenter();$(this).hide()}));this.list.wrapper.unbind("click");this.list.wrapper.bind("click",function(){a.itemClick()});var b=this.list.wrapper;b.html(this.container.html());var c=this.container.position(); b.css({top:c.top,left:c.left});var e=this.container.height(),g=this.container.width();b.width(g).height(e);b.show();var g=this.list.wrapper.css("padding-top"),g=parseInt(g,10),h=this.list.wrapper.css("border-left-width"),h=parseInt(h,10),e=c.left-g-h,c=c.top-g-h;b.css({top:c,left:e})}};m.showcase=m.showcase||{};m.showcase.ShowcaseList=function(a,b){this.model=p.getInstance();this.init(a,b)};l=m.showcase.ShowcaseList.prototype; l.init=function(a,b){this.id=a;this.data=b;this.container=$("<div />",{"class":"list-container",id:"list-container-"+a});this.thumbs=[];var c=this;this.data&&("spotlight"===a?($(this.model).unbind("currentItemChanged.SpotlightList"),$(this.model).bind("currentItemChanged.SpotlightList",function(a,b){if(f==b||c.model.getData()[b].spotlight_featured)c.onChange(b)})):($(this.model).unbind("currentItemChanged.List"),$(this.model).bind("currentItemChanged.List",function(a,b){if(f==b||k==c.model.getData()[b].spotlight_featured)c.onChange(b)}))); $(window).resize(function(){c.onResize()})};l.buildList=function(a){var b="list-container-clear",c=$("#"+b);c.length&&c.remove();c=this.thumbs.length;a=a||this.data;for(var e=0,g=a.length;e<g;e++){this.thumbs.push(new m.showcase.ShowcaseThumbnail(a[e].id,this));var h=this.thumbs[c++].getThumbElement(a[e]);this.container.append(h)}this.onResize();this.container.append($("<div />").addClass("clear").attr({id:b}));this.logHeight();$("#notification").hide()}; l.updateList=function(a){this.data=this.data.concat(a);this.buildList(a)};l.getItemsCount=function(){return this.data?this.data.length:0};l.getContainer=function(){return this.container};l.onChange=function(a){if(a==f)this.closeItem();else{var b=$.inArray(this.model.getData()[a],this.data);-1!=b&&this.model.getCurrentList()!=this&&this.model.setCurrentList(this);this.model.getCurrentList()!=this?this.closeItem():this.openItem(a)}}; l.openItem=function(a){this.currentNextRow||(this.currentNextRow=this.data[0]);var b=this.getNextRow(this.model.getData()[a])||"LAST_ROW",c=b!=this.currentNextRow;this.currentSpacer&&(this.oldSpacer=this.currentSpacer);if(c){this.closeSpacer();this.currentSpacer=$("<div />").addClass("list-spacer");var e=this;this.currentSpacer.bind("click",function(){e.closeItem()});!b||"LAST_ROW"==b?this.container.append(this.currentSpacer):this.currentSpacer.insertBefore(b.container)}this.currentNextRow=b;b=new m.showcase.ShowcaseDetail(a, this);b.open(c);this.detail=b;var c=c?0:this.currentSpacer.height(),g=b.endHeight+b.detailPadding.top+b.detailPadding.bottom;this.currentSpacer.height(c).animate({height:g},200);c=this.container.offset();a=$.inArray(this.model.getData()[a],this.data);-1!=a&&(a=this.thumbs[a].container.height(),b=b.endY+c.top-a,this.model.mainView.spotlight_&&(this.model.mainView.spotlight_.container.is(":visible")&&"spotlight"!=this.id)&&(a=this.model.mainView.spotlight_.container.height()-this.model.mainView.spotlight_.inactiveHeight, b-=a),$(window).scrollTop(b))};l.closeItem=function(){this.model.getCurrentList()==this&&this.model.getCurrentItemId()&&this.model.setCurrentItemId(f);this.closeSpacer()};l.getNextRow=function(a){var b=$.inArray(a,this.data);if(-1==b)return f;a=this.data.length;for(var c=0,e=this.thumbs[b].container.position();b<a;b++){var g=this.thumbs[b].container.position();g.top>e.top+10&&(c=this.thumbs[b],b=a)}return c}; l.closeSpacer=function(){if(this.currentSpacer&&(this.currentSpacer.animate({height:0},250,function(){$(this).remove()}),!this.model.getCurrentItemId()||this.model.getCurrentList()!=this))this.currentSpacer=this.oldSpacer=this.currentNextRow=f};l.onResize=function(){for(var a=this.getItemWidth(),b=0;b<this.thumbs.length;b++)this.thumbs[b].setSize(a)};l.getItemWidth=function(){var a=this.container.width(),b=a/this.getColumnCount(),a=3*a/100;return b=Math.floor(b-a)}; l.getColumnCount=function(a){a=a?a.width():$(this.model.mainView.container_).width();return 1800<=a?6:1280<=a?5:960<=a?4:700<=a?3:2};l.setNext=function(){var a=$.inArray(this.model.getData()[this.model.getCurrentItemId()],this.data),a=-1==a?0:a,a=a+1;if(a>=this.data.length)return k;this.model.setCurrentItemId(this.data[a].id)};l.setPrevious=function(){var a=$.inArray(this.model.getData()[this.model.getCurrentItemId()],this.data),a=-1==a?0:a,a=a-1;if(0>a)return k;this.model.setCurrentItemId(this.data[a].id)}; l.setPreviousRow=function(){var a=this.getColumnCount(),b=$.inArray(this.model.getData()[this.model.getCurrentItemId()],this.data),b=-1==b?0:b,a=Math.max(b-a,0);this.model.setCurrentItemId(this.data[a].id)};l.setNextRow=function(){var a=this.getColumnCount(),b=$.inArray(this.model.getData()[this.model.getCurrentItemId()],this.data),b=-1==b?0:b,a=Math.min(b+a,this.data.length-1);this.model.setCurrentItemId(this.data[a].id)};l.logHeight=function(){this.inactiveHeight=this.container.height()};m.showcase=m.showcase||{};m.showcase.ShowcaseSpotlightThumbnail=function(a,b){m.showcase.ShowcaseThumbnail.call(this,a,b)};$.inherit(m.showcase.ShowcaseSpotlightThumbnail,m.showcase.ShowcaseThumbnail);l=m.showcase.ShowcaseSpotlightThumbnail.prototype; l.getSpotLightThumbnail=function(a){if(!this.container){var b=a.thumb?a.thumb:a.images[0],b=m.showcase.fixResourceProtocol(b),b=$("<img />").attr("src",b).css("width","100%").css("height","auto");this.image=$("<div />").addClass("image").append(b);this.title=$("<div />").addClass("title").text(a.project_name);this.overlay=$("<div />").addClass("overlay").append(this.title);this.hoverTarget=$("<a />").addClass("hover-target");this.container=$("<div />").addClass("list-item").append(this.image).append(this.overlay).append(this.hoverTarget); var c=this;this.container.bind("click",function(){c.itemClick()});this.container.bind("mouseover",function(){c.itemMouseOver()});this.container.bind("mouseout",function(){c.itemMouseOut()})}return this.container};l.itemClick=function(){this.model.getCurrentItemId()==this.id?this.model.setCurrentItemId(f):(this.model.setCurrentList(this.list),this.model.setCurrentItemId(this.id))};l.setSize=function(a,b){b||(b=Math.round(9*a/16));this.container.width(a).height(b)}; l.itemMouseOver=function(){this.overlay.height();var a=this.container.height();this.overlay.animate({height:a},150);this.title.position();this.title.animate({top:a/2-5},150)};l.itemMouseOut=function(){this.model.getCurrentItemId()!=this.id&&(this.overlay.animate({height:"45px"},150),this.title.animate({top:"13px"},150))};l.setState=function(a){a?this.itemMouseOver():this.itemMouseOut()};m.showcase=m.showcase||{};m.showcase.ShowcaseSpotlight=function(a,b){m.showcase.ShowcaseList.call(this,a,b);this.detailPadding={top:20,right:0,bottom:16,left:0}};$.inherit(m.showcase.ShowcaseSpotlight,m.showcase.ShowcaseList); m.showcase.ShowcaseSpotlight.prototype.buildList=function(){this.thumbs=[];for(var a=this.data.length,b=0;b<a;b++){this.thumbs.push(new m.showcase.ShowcaseSpotlightThumbnail(this.data[b].id,this));var c=this.thumbs[b].getSpotLightThumbnail(this.data[b]);this.container.append(c)}this.onResize();this.container.append($("<div />").addClass("clear"));this.logHeight()};m.showcase.ShowcaseSpotlight.prototype.getContainer=function(){return this.container}; m.showcase.ShowcaseSpotlight.prototype.getItemWidth=function(){return Math.floor(this.container.width()*(100/this.getColumnCount()-1)/100)};m.showcase.ShowcaseSpotlight.prototype.getColumnCount=function(a){a=a?a.width():$(window).width();return 1800<=a?4:1280<=a?4:960<=a?3:700<=a?2:1};m.showcase=m.showcase||{};m.tag=m.tag||{};m.showcase.ShowcaseView=function(a,b,c){this.model_=p.getInstance();this.count_=0;this.container_=a;this.model_.mainView=this;this.showcaseList_=f;this.dataCount_=c;this.cursor_=b;this.isFetching_=k;$(this.model_).bind("filtersChanged",$.proxy(this,"updateData"))};l=m.showcase.ShowcaseView.prototype;l.renderer=function(){this.updateLists()}; l.updateLists=function(){var a=0;$("div.list-container").html()&&$("div.list-container").remove();0<this.model_.filters_.length||(this.model_.filters_=[]);this.addSpotlight();a=this.model_.spotlightData_.length;m.tag.Widget.SetResultCounterText(this.dataCount_,this.model_.filters_.length);var b=this.model_.getListData();if(a>this.model_.MAX_SPOTLIGHT_ITEMS){for(var c=this.model_.spotlightData_.slice(this.model_.MAX_SPOTLIGHT_ITEMS),e=0,g=c.length;e<g;e++)c[e].spotlight_featured=k;b=c.concat(b);a= this.model_.MAX_SPOTLIGHT_ITEMS}this.showcaseList_=new m.showcase.ShowcaseList(this.count_.toString(),b);$(this.container_).append(this.showcaseList_.getContainer());this.showcaseList_.buildList();this.model_.setCurrentList(this.showcaseList_);var h=this;$(window).unbind("scroll");$(window).scroll(function(){if($(window).scrollTop()==$(document).height()-$(window).height()&&!h.isFetching_){var b=h.showcaseList_.getItemsCount();if(b+a<h.dataCount_){h.isFetching_=d;var b=m.location.protocol+"//"+m.location.host+ "/showcase/next",c=h.model_.getFilters();0<c.length&&(b+="/"+c.join(","));h.cursor_&&(b+="?c="+h.cursor_);$("#notification-bottom").show();$.get(b,function(a){if(a.success){h.cursor_=a.result.cursor;a=a.result.projects;for(var b=0,c=a.length;b<c;b++)a[b].spotlight_featured=k;a=h.model_.updateData(a);h.showcaseList_.updateList(a)}h.isFetching_=k;$("#notification-bottom").hide()})}}})}; l.updateData=function(){this.model_.setCurrentItemId(f);var a=m.location.protocol+"//"+m.location.host+"/showcase/next",b=this.model_.getFilters();0<b.length&&(a+="/"+encodeURIComponent(b.join(",")));var c=this,e=p.getInstance().getFilters().join();$.get(a,function(a){var b=p.getInstance().getFilters().join();a.success&&e===b&&(c.cursor_=a.result.cursor,c.model_.setData(a.result.projects),c.dataCount_=a.result.count,c.updateLists())})}; l.addSpotlight=function(){this.spotlightContainer_=$("<div />").addClass("showcase-spotlight");$(this.container_).append(this.spotlightContainer_);this.spotlight_=new m.showcase.ShowcaseSpotlight("spotlight",this.model_.getSpotlightData());this.spotlightContainer_.append(this.spotlight_.getContainer());this.spotlight_.buildList()}; l.updateNavigation=function(){this.showcaseNavigation||(this.showcaseNavigation=new m.showcase.ShowcaseNavigation);this.model_.getCurrentItemId()==f?this.showcaseNavigation.hide():this.showcaseNavigation.show()};l.hideNavigation=function(){this.showcaseNavigation&&this.showcaseNavigation.hide()};m.showcase.ShowcaseDetail=function(a,b){this.model_=p.getInstance();this.id_=a;this.list_=b;this.projectInfoState_=d;this.DETAIL_PANEL_WIDTH=932;this.DETAIL_PAGE_HEIGHT=457;this.detailPadding=this.list_.detailPadding?this.list_.detailPadding:{top:6,right:0,bottom:16,left:0};var c=this;$(this.model_).unbind("currentItemChanged.Detail");$(this.model_).bind("currentItemChanged.Detail",function(a,b){c.checkState(b)})};l=m.showcase.ShowcaseDetail.prototype; l.formatContent=function(){var a=$("div.detail-panel");a.html()&&a.remove();var a=this.model_.getData(),b=$("#content-template"),b=b.html(),b=$("<div />").attr({"class":"detail-panel-content",id:"detail"+this.id_}).append(b),c=b.find(".header-left"),e=b.find(".header-right"),g=b.find(".project-title");b.find(".project-developer");var h=b.find(".project-description"),j=b.find(".project-image"),i=b.find(".how-to");this.projectInfoButton_=b.find(".project-info-button");this.howToButton_=b.find(".how-to-button"); this.projectTags_=b.find(".project-tags");this.projectInfoContainer_=h;this.howToContainer_=i;a[this.id_].project_url&&(this.projectLinkButton_=$("<div />").addClass("button button-red").text("View Site"),e.append(this.projectLinkButton_),this.projectLinkButton_.css("margin-right","0"),this.projectLinkButton_.css("cursor","pointer"),this.plusoneContainer_=$("<div />").attr({id:"plusone-container","class":"float-left plusone-container"}).css("padding-left","10px"),e=$("<div />").attr({id:"plusone-div", "class":"g-plusone","data-href":a[this.id_].project_url,"data-size":"medium","data-annotation":"bubble","data-source":"google:developers"}),this.plusoneContainer_.append(e),c.append(this.plusoneContainer_));this.permanentUrl_=new m.permanentUrl.Widget(c);this.permanentUrl_.setPermanentUrl("#item="+a[this.id_].project_name);c=$("<a />").text(a[this.id_].project_name);a[this.id_].project_url&&c.attr("href",a[this.id_].project_url);g.append(c);a[this.id_].project_description&&h.text(a[this.id_].project_description); this.buildTags(a[this.id_].tags);j.html("");this.buildImages(j);i.html(this.getHowTo());this.setButtonEvents_();this.projectInfoButton_.unbind("click");this.howToButton_.hide();return b}; l.open=function(a){var b=this.formatContent();b.css({display:"none",opacity:"0"});var c=$("<div />").addClass("detail-panel-triangle-inner"),c=$("<div />").addClass("detail-panel-triangle").append(c);this.closeButton=$("<div />").addClass("close-button").css("opacity",0.5);var e=$.inArray(this.model_.getData()[this.id_],this.list_.data);if(-1!=e){var g=this.list_.thumbs[e].container,h=g.position(),j=$(window).width(),e=h.top+g.height()+this.detailPadding.top,j=Math.round((j-this.DETAIL_PANEL_WIDTH)/ 2-48);j>h.left+g.width()-50&&(j=h.left+g.width()-50);j+this.DETAIL_PANEL_WIDTH<h.left+50&&(j=h.left+50-this.DETAIL_PANEL_WIDTH);g=Math.min(Math.round(h.left-j+g.width()/2-14),this.DETAIL_PANEL_WIDTH-40);g=Math.max(10,g);c.css("left",g);var i=this;$(this.closeButton).bind("mouseout",function(a){i.onCloseButton(a)});$(this.closeButton).bind("mouseover",function(a){i.onCloseButton(a)});$(this.closeButton).bind("click",function(a){i.onCloseButton(a)});this.domElement=$("<div />").addClass("detail-panel").append(c).append(this.closeButton).append(b); this.list_.container.append(this.domElement);window.gapi&&(window.gapi.plus&&window.gapi.plus.go)&&window.gapi.plusone.go();this.domElement.width(this.DETAIL_PANEL_WIDTH);this.domElement.height(this.DETAIL_PAGE_HEIGHT);this.domElement.css("left",j).css("top",e);this.endY=e;this.endHeight=b.height();this.list_.oldSpacer&&this.list_.currentSpacer.position().top>this.list_.oldSpacer.position().top&&(this.endY=e-this.list_.oldSpacer.height(),"spotlight"!=this.list_.id&&(this.endY-=17),this.domElement.animate({top:this.endY}, 200));a?this.domElement.animate({height:"auto"},260,function(){b.show();b.animate({opacity:1},1E3,function(){});b.fadeIn("slow");i.model_.mainView.updateNavigation()}):b.css("display","inline")}};l.onCloseButton=function(a){"click"==a.type?($("div.detail-panel").remove(),this.model_.setCurrentItemId(f)):"mouseover"==a.type?this.closeButton.css("opacity",1):"mouseout"==a.type&&this.closeButton.css("opacity",0.5)}; l.buildImages=function(a){var b=this.model_.getData(),c=b[this.id_].images,b=c.length;this.images_=[];this.imageContainer_=$("<div />").addClass("project-images-container");a.append(this.imageContainer_);for(var e,g=0;g<b;g++)c[g]=m.showcase.fixResourceProtocol(c[g]),e=0<=c[g].indexOf("youtube")?$("<iframe />").attr({src:c[g],width:510,height:287,frameborder:"0",allowfullscreen:"true"}):$("<img />").attr({src:c[g],"class":"project-image"}),0<g&&e.css("display","none"),this.imageContainer_.append(e), this.images_.push(e);if(1<b){var h=this;this.imageContainer_.bind("click",function(){h.setNextImage()});this.imageContainer_.css("cursor","pointer");this.previousButtonContainer_=$("<input />").attr("type","button").addClass("pagination-btn previous-btn");c=$("<div />").addClass("project-images-menu");this.previousButtonContainer_.click(function(){h.setPreviousImage()});c.append(this.previousButtonContainer_);this.nextButtonContainer_=$("<input />").attr("type","button").addClass("pagination-btn next-btn"); this.nextButtonContainer_.click(function(){h.setNextImage()});c.append(this.nextButtonContainer_);this.imageCounter_=$("<div />").addClass("project-images-counter").text("1 of "+b);c.append(this.imageCounter_);a.append(c)}1<this.images_.length&&this.setImage(0)};l.getHowTo=function(){return'<span class="grey">Coming Soon</span>'}; l.toggleProjectInfo=function(){this.projectInfoState_?(this.projectInfoState_=k,this.projectInfoContainer_.hide(),this.projectTags_.hide(),this.howToContainer_.show(),this.projectInfoButton_.removeClass("project-details-menu-item-selected"),this.howToButton_.addClass("project-details-menu-item-selected")):(this.projectInfoState_=d,this.projectInfoContainer_.show(),this.projectTags_.show(),this.howToContainer_.hide(),this.projectInfoButton_.addClass("project-details-menu-item-selected"),this.howToButton_.removeClass("project-details-menu-item-selected"))}; l.setButtonEvents_=function(){var a=this;this.model_.getData()[this.id_].project_url&&this.projectLinkButton_.bind("click",function(){a.launchProjectLink()});this.projectInfoButton_.bind("click",function(){a.toggleProjectInfo()});this.howToButton_.bind("click",function(){a.toggleProjectInfo()})};l.setPreviousImage=function(){this.setImage(-1)};l.setNextImage=function(){this.setImage(1)}; l.setImage=function(a){void 0==this.currentImage_&&(this.currentImage_=0);a=this.currentImage_+a;0<=a&&a<this.images_.length&&(0<=this.images_[this.currentImage_].attr("src").indexOf("youtube")&&(this.imageContainer_.find("iframe").remove(),this.imageContainer_.append(this.images_[this.currentImage_])),this.images_[this.currentImage_].css("display","none"),this.images_[a].css("display","block"),this.currentImage_=a,this.imageCounter_.text(a+1+" of "+this.images_.length));this.checkImageButtons()}; l.launchProjectLink=function(){this.openWindow_=window.open(this.model_.getData()[this.id_].project_url)};l.checkImageButtons=function(){var a=this.currentImage_,b=this.images_.length;0==a?(this.previousButtonContainer_.attr("disabled",d),this.nextButtonContainer_.removeAttr("disabled")):a==b-1?(this.previousButtonContainer_.removeAttr("disabled"),this.nextButtonContainer_.attr("disabled","")):(this.previousButtonContainer_.removeAttr("disabled"),this.nextButtonContainer_.removeAttr("disabled"))}; l.close=function(){this.domElement&&this.domElement.remove()};l.checkState=function(a){(!a||a==this.id_)&&this.close()}; l.buildTags=function(a){var b;if(a.length){this.projectTags_.append($("<span/>").addClass("gray").html("Tags: "));for(var c=0;c<a.length;c++){var e=$.trim(a[c].id);b=$.trim(a[c].name);b=$("<a />").html(b);var g=this;b.bind("click",{id:e},function(a){a.stopPropagation();a=a.data;var b=g.model_.getFilters();-1==b.indexOf(a.id)&&b.push(a.id);$("#tag-component").trigger("tag_changed",{tags:b});$("#tag-component").trigger("update_tags",{tags:b});g.model_.setCurrentItemId(f);$("html, body").animate({scrollTop:$("#tag-component").offset().top}, 300)});this.projectTags_.append(b);c<a.length-1&&this.projectTags_.append($("<span/>").html(", "))}}};m.showcase.ShowcaseNavigation=function(){this.model_=p.getInstance();var a='<a class="next"></a>';this.nextButton_=$("<div />");this.nextButton_.addClass("next-button").html(a);a='<a class="prev"></a>';this.previousButton_=$("<div />");this.previousButton_.addClass("prev-button").html(a);this.container_=$("<div />").addClass("showcase-menu").append(this.nextButton_).append(this.previousButton_);$(this.model_.mainView.container_).append(this.container_);var b=this;this.nextButton_.bind("click",function(){b.setNext()}); this.previousButton_.bind("click",function(){b.setPrevious()});$(this.model_).unbind("currentItemChanged.Navigation");$(this.model_).bind("currentItemChanged.Navigation",function(){b.updateNavigation()})};l=m.showcase.ShowcaseNavigation.prototype;l.hide=function(){this.container_.hide()};l.show=function(){this.container_.show();this.updatePosition()};l.setPrevious=function(){this.model_.getCurrentList().setPrevious()};l.setNext=function(){this.model_.getCurrentList().setNext()}; l.updatePosition=function(){var a=this.model_.getCurrentList().currentSpacer;if(a){var b=a.offset(),a=b.left,b=b.top;this.container_.offset({left:a,top:b})}};l.updateNavigation=function(){this.model_.getCurrentItemId()===f&&this.hide();this.checkState()}; l.checkState=function(){var a=this.model_.getCurrentList();if(a){var b=$.inArray(this.model_.getData()[this.model_.getCurrentItemId()],a.data),a=a.data.length;0==b?(this.previousButton_.hide(),this.nextButton_.show()):b==a-1?(this.previousButton_.show(),this.nextButton_.hide()):(this.previousButton_.show(),this.nextButton_.show())}};m.showcase=m.showcase||{};m.showcase.ShowcaseHistory=function(){this.model_=p.getInstance();var a=this;$(this.model_).unbind(".History");$(this.model_).bind("currentItemChanged.History filtersChanged.History",function(){a.updateToken()})}; m.showcase.ShowcaseHistory.prototype.updateShowcaseState=function(){var a=this.getUrlParam("tags"),b=this.getUrlParam("item");a&&(a=a.split(","),$("#tag-component").trigger("tag_changed",{tags:a}),$("#tag-component").trigger("update_tags",{tags:a,isHideWidget:1}));if(b&&(b=this.model_.getItemByName(unescape(b.replace(/\+/g," ")))))this.model_.setCurrentItemId(b.id),this.model_.setPermanentCurrentItemName(b.name)}; m.showcase.ShowcaseHistory.prototype.updateToken=function(){var a=[],b=this.model_.getFilters(),c=this.model_.getData(),e=this.model_.getCurrentItemId(),c=c[e];0<b.length&&a.push("tags=",b.join(","));e!=f&&(a.length&&a.push("&"),a.push("item=",c.project_name.replace(/\s+/g,"+")));m.location.href=m.location.protocol+"//"+m.location.host+"/showcase/#"+a.join("")}; m.showcase.ShowcaseHistory.prototype.getUrlParam=function(a){a="[\\#&]"+a+"=([^<>&#\"']*)";a=RegExp(a);return(a=a.exec(m.location.hash))?a[1]:f};m.showcase=m.showcase||{};m.showcase.WidgetCreator=m.showcase.WidgetCreator||{};m.showcase.WidgetCreator=function(a){this.tags_=[];this.parentContainer_=$("#"+a);$("#tag-component").bind("tag_changed",$.proxy(this,"updateTags"))};l=m.showcase.WidgetCreator.prototype;l.updateTags=function(a,b){b&&((this.tags_=b.tags)&&this.tags_.length?$("#create-wiget-container").html()?(this.parentContainer_.show(),this.buttonContainer_.show()):this.addButton():(this.parentContainer_.toggle(),this.buttonContainer_.toggle()))}; l.addButton=function(){this.buttonContainer_=$("<div />").attr({id:"embed-button-container"});var a="Create Widget";this.buttonContainer_.addClass("button button-red").text(a);this.setButtonEvents();this.parentContainer_.append(this.buttonContainer_);a=m.location.protocol+"//"+m.location.host+"/showcase/widget";$.get(a,{},$.proxy(function(a){a&&a.success&&(a=a.content,$("#gc-content").append(a))},this))}; l.setButtonEvents=function(){var a=this;this.buttonContainer_.bind("click",function(b){b.stopPropagation();a.addPopup();a.overlay_.show();a.popupContainer_.show();a.updateTagList();a.getEmbedCode()})}; l.addPopup=function(){var a=this;this.popupContainer_=$("#showcase-widget-template");var b=this.popupContainer_.find(".widget-detail-panel");this.overlay_=$("#widget-overlay");this.overlay_.css({width:$(window).width(),height:$(window).height()});this.closeButton_=b.find(".widget-close-button");this.closeButton_.bind("click",function(b){b.stopPropagation();a.popupContainer_.hide();a.overlay_.hide();a.spotlightOnly_.removeAttr("checked");a.sizeSelect_.find("option:first").attr("selected",d)});this.widgetDiv_= b.find(".widget-container-div");this.widgetDiv_.attr({id:"wid_con_div"});this.showcaseWidgetCode_=b.find(".widget-code-input");this.sizeSelect_=b.find(".widget-dimension");this.sizeSelect_.bind("change",function(){a.getEmbedCode()});this.spotlightOnly_=b.find(".widget-spotlight-only");this.spotlightOnly_.bind("click",function(){a.getEmbedCode()});this.tagsRow_=b.find(".widget-selected-tags").hide();this.tagsDiv_=b.find(".widget-tags-list")}; l.updateTagList=function(){var a=this.tags_;a.length?(this.tagsRow_.show(),this.tagsDiv_.text(a.join(", "))):this.tagsRow_.hide()}; l.getEmbedCode=function(){this.widgetDiv_.empty();var a=$("<script />"),b=this.spotlightOnly_.is(":checked"),c=this.sizeSelect_.val().split("x"),e=parseInt(c[0],10),c=parseInt(c[1],10),b='var widget = new devsite.showcase.Widget("wid_con_div", ["'+this.tags_.join('","')+'"], '+b+", "+e+", "+c+");";a.text(b);b="<script>"+b+"\x3c/script>";this.showcaseWidgetCode_.val(b);this.widgetDiv_.append(a)};m.showcase=m.showcase||{};m.showcase.Widget=m.showcase.Widget||{};m.showcase.Widget=function(a,b,c,e,g){this.parentContainer_=$("#"+a);0<!this.parentContainer_.length&&(this.parentContainer_=$("<div />"),this.parentContainer_.attr({id:a}),$("body").append(this.parentContainer_));this.spotlightOnly_=c;this.tags_=b;this.height_=g;this.width_=e;this.items_=[];this.current_=0;this.init()};l=m.showcase.Widget.prototype;l.init=function(){this.addWidget();this.getItemList()}; l.addWidget=function(){this.parentContainer_.css("height",this.height_).css("width",this.width_);var a=$("<section />").addClass("carousel").attr({"data-aspect":"19:6"}).css("width",this.width_).css("height",this.height_).css("visibility","visible"),b=$("<div />").addClass("widget-navigation"),c=this;this.prevContainer_=$("<a />").addClass("prev left");this.prevContainer_.bind("click",function(){c.setPrevious()});this.prevContainer_.append(b);b=$("<div />").addClass("widget-navigation");this.nextContainer_= $("<a />").addClass("next right");this.nextContainer_.bind("click",function(){c.setNext()});this.nextContainer_.append(b);var b=$("<div />").addClass("frame").css("width",this.width_).css("height",this.height_),e=$("<div />").addClass("items"),g=$("<article />");this.projectLink_=$("<a />").attr({target:"_blank"});this.image_=$("<img />").attr({id:"img-thumbnail"});this.image_.css("width",this.width_).css("height",this.height_);this.projectName_=$("<div />").addClass("widget-project").css("width", this.width_);this.projectLink_.append(this.image_);g.append(this.projectLink_);e.append(g);b.append(e);b.append(this.projectName_);a.append(this.prevContainer_);a.append(b);a.append(this.nextContainer_);this.parentContainer_.append(a)}; l.getItemList=function(){var a=m.location.protocol+"//"+m.location.host+"/showcase/get",b=this,c="";0<this.tags_.length&&(c=this.tags_.join(","),a+="/"+c);$.get(a,{},$.proxy(function(a){if(a.success){a=a.result.projects;for(var c=0,h=a.length;c<h;c++){var j=d;if(!b.spotlightOnly_||a[c].spotlight_featured){for(var i=0,n=b.tags_.length;i<n;i++)if(-1==$.inArray(b.tags_[i],a[c].tags)){j=k;break}j&&b.items_.push(a[c])}}b.setItemUrl(0);b.prevContainer_.addClass("disabled");1==b.items_.length&&b.nextContainer_.addClass("disabled")}}, this))};l.setItemUrl=function(a){if(this.items_.length){this.image_.fadeIn("fast");var b=this;this.image_.fadeOut("fast",function(){b.image_.attr("src",b.items_[a].thumb);b.image_.fadeIn("fast")});var c=this.items_[a].project_name,e=[];e.push("tags=",this.tags_.join(","),"&item=",c);e=m.location.protocol+"//"+m.location.host+"/showcase/#"+e.join("");this.projectLink_.attr("href",e.replace(/\s+/g,"+"));this.projectName_.html(c)}else c="No showcase item to display.",this.projectName_.text(c),this.nextContainer_.addClass("disabled")}; l.setNext=function(){this.current_<this.items_.length-1&&(this.current_+=1,this.setItemUrl(this.current_),this.prevContainer_.removeClass("disabled"),this.current_==this.items_.length-1&&this.nextContainer_.addClass("disabled"))};l.setPrevious=function(){0<this.current_&&(this.current_-=1,this.setItemUrl(this.current_),this.nextContainer_.removeClass("disabled"),0==this.current_&&this.prevContainer_.addClass("disabled"))};m.showcase=m.showcase||{};m.showcase.admin=m.showcase.admin||{};m.showcase.admin.addImportJobToTaskQueue=k; m.showcase.admin.importShowcase=function(a){a=a.target;var b=a.csv.value,c=-1;b&&(c=b.indexOf(","));b&&-1!=c?(b=m.showcase.admin.addImportJobToTaskQueue?"addImportJob":"import",$.post(b,$(a).serialize(),function(a){(a.result||a.status_key)&&!a.error?m.showcase.admin.addImportJobToTaskQueue?setTimeout(function(){m.showcase.admin.getTaskStatus(a.status_key)},3E3):m.showcase.admin.displayResult(a.result):a.error&&$("#result").html(a.error);m.showcase.admin.addImportJobToTaskQueue=k})):(b&&-1==c?$("#result").html("Please enter valid csv data."): $("#result").html("Please enter data to import."),m.showcase.admin.addImportJobToTaskQueue=k)};m.showcase.admin.displayResult=function(a){var b=a.failures;a=['<div class="header">Results:</div>',a.saved," out of ",a.total," imported successfully."];if(b&&b.length){a.push('<div class="header error">',"Errors:</div><div>");for(var c=0;c<b.length;c++)a.push(b[c]);a.push("</div>")}$("#result").html(a.join(""))}; m.showcase.admin.getTaskStatus=function(a){var b="getImportStatus?status_key="+a;$.get(b,function(b){b.success?m.showcase.admin.displayResult(b.result):b.error?$("#result").html(b.error+": Import Task not found, please import again."):setTimeout(function(){m.showcase.admin.getTaskStatus(a)},2E3)})};m.showcase.admin.addShowcaseItem=function(a){a=a.target;var b="add/"+encodeURIComponent(a.name.value);$.post(b,$(a).serialize(),function(a){$("#result").html(a.success?"Success.":a.error)})}; m.showcase.admin.getShowcaseItems=function(){$.get("get",function(a){a.success?$("#result").empty().append(m.showcase.admin.makeShowcaseDisplay_(a.result)):$("#result").html(a.error)})};m.showcase.admin.flushMemcache=function(){$.get("flushMemcache",function(a){a.success?$("#result").empty().append(m.showcase.admin.makeShowcaseDisplay_(a.result)):$("#result").html(a.error)})}; m.showcase.admin.another_=function(a,b,c){a=$("<input type=text />").attr("name",a);var e=$("<button>x</button>").click(function(a){a.preventDefault();$(this).parent().remove()}),e=$("<label class=another>").append("<br/>").append(a).append(e);if(-1!=["number","email","url"].indexOf(b))a.addClass(b);else if("string"!=b)throw"Invalid type: "+b;c.before(e);a.focus()}; m.showcase.admin.toString_=function(a,b){var c=b||"";if(f==a)return"null";if("boolean"==typeof a)return a?"true":"false";if("number"==typeof a||a.charAt)return a;if(a.push){for(var e=Array(a.length),g=0;g<a.length;g++)e[g]=m.showcase.admin.toString_(a[g],c+" ");return"["+e.join(",\n"+c)+"]"}e=[];for(g in a)e.push("<b>"+g+"</b>:"+m.showcase.admin.toString_(a[g],c+" "));return"{"+e.join(",\n"+c)+"}"};m.showcase.admin.makeShowcaseDisplay_=function(a){return a=$("<pre class=showcaseItem />").append(m.showcase.admin.toString_(a))}; m.showcase.admin.errorPanel_=$("<div class=error />");m.showcase.admin.validation=function(a,b){return function(){var c=m.showcase.admin.errorPanel_;this.value?a.test(this.value)?($(this.form).data("invalid",k),c.detach()):(c.text(b),$(this).before(c),$(this.form).data("invalid",d)):($(this.form).data("invalid",k),c.detach())}}; m.showcase.admin.init=function(){function a(a){return function(c){c.preventDefault();$(this).data("invalid")?($("#result").html("Please fix your validation errors."),m.showcase.admin.addImportJobToTaskQueue=k):($("#result").html("Working.."),a(c))}}$("#taskQueueImport").click(function(){m.showcase.admin.addImportJobToTaskQueue=d});$("#getShowcaseItems").submit(a(m.showcase.admin.getShowcaseItems));$("#addShowcaseItem").submit(a(m.showcase.admin.addShowcaseItem));$("#importShowcase").submit(a(m.showcase.admin.importShowcase)); $("#clearMemcache").submit(a(m.showcase.admin.flushMemcache));$(".url").live("blur",m.showcase.admin.validation(/^((https?:)\/\/)?[\w._-]+\/([^ ]+)$/,"Invalid url."));$(".email").live("blur",m.showcase.admin.validation(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/,"Invalid email."));$(".number").live("blur",m.showcase.admin.validation(/^[0-9]+$/,"Invalid number."));$("button.more").click(function(a){a.preventDefault();a=$(a.target);m.showcase.admin.another_((a.attr("data-name")||"").toString(),(a.attr("data-type")|| "").toString(),$(this))})};m=m||{};m.tag=m.tag||{}; m.tag.AutocompleteWidget=function(a,b,c,e,g,h){this.KEY_LEFT=37;this.KEY_RIGHT=39;this.KEY_BACKSPACE=8;this.KEY_DELETE=46;this.KEY_ENTER=13;this.KEY_COMMA=188;var j=this,i=$("#"+a);this.requireValid_=b;this.maxTags_=e;this.tags_=g;this.init_=function(a){j.tags_?this.Autocomplete_(j.tags_):$.get("/tags/gettags",this.Autocomplete_);for(var b=0;b<a.length;b++)a[b]&&this.AddChosenTag(a[b].trim());i.focusin(function(a){$(this).addClass("focus");$(a.target).hasClass("tag-autocomplete")&&i.children("input").focus()}).focusout(function(){i.removeClass("focus")}); var c;i.click(function(){c&&(c.children().removeClass("selected"),c=f)});i.siblings(".too-many-tags").children(".max-tags").text(j.maxTags_);this.defaultComparator_=function(){for(var a="ul.tag-autocomplete-suggestions",b=i.children(a).children(),c=i.children("input").val().toLowerCase(),e=$(),g=0,h=b.length;g<=h;++g){var j=$(b[g]),n=j.text().toLowerCase();0===n.indexOf(c)&&(e=e.add(j))}i.children(a).prepend(e)};i.bind("autocompleteopen",h||this.defaultComparator_);i.children("input").keydown(function(a){var b= a.keyCode,e=$(this).val(),g=i.siblings(".tags-not-found");a=i.siblings(".too-many-tags");var h=i.children(".chosen-tags");g.addClass("hidden");a.addClass("hidden");if(!e&&h.children().length)b==j.KEY_BACKSPACE||b==j.KEY_DELETE?c?(b=c,c=c.next(),j.RemoveTag_(b)):b==j.KEY_BACKSPACE&&(c=h.children(":last-child")):b==j.KEY_LEFT||b==j.KEY_RIGHT?(e=":"+(37==b?"last":"first")+"-child",c?(c.children().removeClass("selected"),c=37==b?c.prev():c.next()):c=h.children(e)):c&&c.length&&(c.children().removeClass("selected"), c=f),c&&!c.length?c=f:c&&c.children().addClass("selected");else if(e&&(b==j.KEY_ENTER||b==j.KEY_COMMA))return!j.requireValid_||0<=j.GetNamesFromResponse_(j.tags_).indexOf(e)?j.AddChosenTag(e):g&&g.children(".tag-list")&&(g.children(".tag-list").text(e),g.removeClass("hidden")),i.children("input").autocomplete("close"),k;if(j.maxTags_&&j.GetNumberOfChosenTags_()>=j.maxTags_)return a.removeClass("hidden"),i.children("input").autocomplete("option","disabled",d),k})};this.Autocomplete_=function(a){var b= i.attr("id");j.tags_=a;var c=$.Event(b+"-tags-loaded");c.tags=a;i.trigger(c);i.children("input").autocomplete({minLength:1,source:j.GetNamesFromResponse_(a),appendTo:"#"+b,create:function(){$(this).siblings(".ui-autocomplete").addClass("tag-autocomplete-suggestions")},focus:function(a,b){$(".ui-autocomplete").children("li").each(function(a,c){$(c).children().text()==b.item.label?$(c).addClass("selected"):$(c).removeClass("selected")})},select:function(a,b){j.AddChosenTag(b.item.label);return k}})}; this.AddChosenTag=function(a){var b=i.find(".chosen-tags a.left"),b=b.filter(function(){return $(this).text()===a}).parent();b.length?(b.detach(),i.children(".chosen-tags").append(b)):(b=i.children("input"),m.chips.AddChip(a,b,i.children(".chosen-tags"),d));i.children("input").val("")};this.RemoveTag_=function(a){a.remove();i.children("input").autocomplete("option","disabled",k)};this.GetTagNames=function(){for(var a=[],b=[],c=i.children(".chosen-tags").children().children("a.left"),e=0;e<c.length;e++)a.push($(c[e]).text()), j.requireValid_&&!j.tags_[a[e]]&&b.push(a[e]);if(i.children(".tag-autocomplete-input").length&&(c=i.children(".tag-autocomplete-input").val()))a.push(c),j.requireValid_&&!j.tags_[c]&&b.push(c);return b.length?(a=i.siblings(".tags-not-found"),a.children(".tag-list").text(b.join(", ")),a.removeClass("hidden"),k):a};this.GetTagKeys=function(){var a=j.GetTagNames();if(!a)return k;for(var b=[],c=0;c<a.length;c++)b[c]=j.tags_[a[c]];return b};this.ClearAllTags=function(){i.children(".chosen-tags").empty()}; this.GetNamesFromResponse_=function(a){var b=[],c;for(c in a)b.push(c);return b};this.GetNumberOfChosenTags_=function(){return i.children(".chosen-tags").children("li").length};this.init_((c||"").split(","));return{AddChosenTag:this.AddChosenTag,GetTagNames:this.GetTagNames,GetTagKeys:this.GetTagKeys,ClearAllTags:this.ClearAllTags}};m.chips=m.chips||{};m.chips.AddChip=function(a,b,c,e,g,h){var j=$("<li></li>"),i=$("<a></a>");i.addClass("button button-blue mini");e&&i.addClass("left");i.text(a);g||(g=function(a,b){b.length&&b.val(a.children("a.left").text());a.remove()});i.click(function(){g(j,b)});j.append(i);e&&(a=$("<a><span>x</span></a>"),a.addClass("button button-blue small right mini"),j.append(a),h||(h=function(a){a.remove()}),a.click(function(){h(j,b)}));c.append(j);return j};m.pagination=m.pagination||{};m.pagination.defaults={fetchUrl:"",navSelector:".paging-nav",containerSelector:".paging-content",entryElement:"li",pageHashKey:"p",renderFunction:function(a){return a}}; m.pagination.Pager=function(a){a=$.extend($.extend({},m.pagination.defaults),a);this.nav_=$(a.navSelector);this.contentContainer_=$(a.containerSelector);this.fetchUrl_=a.fetchUrl;this.entryElement_=a.entryElement;this.anchor_=a.pageHashKey;this.renderFunction_=a.renderFunction;this.cache_={};this.hashPattern_=RegExp("(^#.*|&)"+this.anchor_+"=(\\d+)(.*)$");this.query_=(a=m.location.search)?a.substr(1):"";var b=this;this.nav_.find("button").unbind();this.nav_.find("button.next").click(function(){b.next()}); this.nav_.find("button.previous").click(function(){b.previous()});this.nav_.find("button.first").click(function(){b.first()});a=(a=this.hashPattern_.exec(m.location.hash))?+a[2]:1;if(this.contentContainer_.html().trim()){this.page_=1;this.cache_[1]=this.contentContainer_.children().clone(d);var c=this.contentContainer_.find(".paging-cursor").data("cursor");1<a&&c&&this.recursiveFetch_(2,a,c)}else this.recursiveFetch_(1,a,"")};l=m.pagination.Pager.prototype; l.recursiveFetch_=function(a,b,c){c=this.query_?this.query_+"&c="+c:"c="+c;var e=this;$.get(this.fetchUrl_,c,function(c){e.cache_[a]=$(e.renderFunction_(c));c=$(c).find(".paging-cursor").data("cursor");!c||a==b?e.showPage_(a):e.recursiveFetch_(a+1,b,c)})};l.next=function(){var a=this.page_+1,b=this.cache_[a];b?this.showPage_(a):(b=this.contentContainer_.find(".paging-cursor").data("cursor"),this.recursiveFetch_(a,a,b))};l.previous=function(){this.showPage_(this.page_-1)};l.first=function(){this.showPage_(1)}; l.showPage_=function(a){var b=this.cache_[a];b&&(this.contentContainer_.children().detach(),this.contentContainer_.append(b),this.page_=a,this.updateRange_(),this.updateButtons_(),this.updateHash_(this.page_))};l.updateHash_=function(a){if(m.location.hash){var b=this.hashPattern_.exec(m.location.hash);m.location.hash=b?[b[1],this.anchor_,"=",a,b[3]].join(""):[m.location.hash,"&",this.anchor_,"=",a].join("")}else m.location.hash=["#",this.anchor_,"=",a].join("")}; l.updateRange_=function(){var a=this.nav_.data("itemsperpage"),b=this.contentContainer_.find(this.entryElement_).size();this.nav_.find(".paging-range .first").html((this.page_-1)*a+1);this.nav_.find(".paging-range .last").html((this.page_-1)*a+b)}; l.updateButtons_=function(){1==this.page_?(this.nav_.find("button.previous").addClass("disabled"),this.nav_.find("button.first").addClass("disabled")):(this.nav_.find("button.previous").removeClass("disabled"),this.nav_.find("button.first").removeClass("disabled"));this.contentContainer_.find(".paging-cursor").data("cursor")?this.nav_.find("button.next").removeClass("disabled"):this.nav_.find("button.next").addClass("disabled")};m.showcase=m.showcase||{};m.showcase.Tabs={ALL:-1,PENDING:0,APPROVED:1,REJECTED:2}; m.showcase.Dashboard=function(){var a=this,b=$("#options").find("a");$.each(b,function(b,c){$(c).click(function(){a.changeTab_(this)})});this.tabSelected=m.showcase.Tabs.ALL;this.tags_=[];$.get("getDistinctTags","",function(b){b&&b.result&&(a.tags_=b.result)});this.selectedTags_=[];this.showcaseItems=[];$("#tag-component").bind("tag_changed",$.proxy(this,"updateTags"));a.addItemDialog_=new m.showcase.AddShowCaseItemDialog($("#bt-add-item"));var c=function(b){b.preventDefault();b=$("#bt-search-query").val(); a.searchShowcaseItem(b)};$("#bt-search-item").click(c);$("#bt-search-query").keyup(function(a){13==a.keyCode&&c(a)})};l=m.showcase.Dashboard.prototype;l.changeTab_=function(a){var b=$(a).attr("name");this.tabSelected!=m.showcase.Tabs[b.toUpperCase()]&&(this.tabSelected=m.showcase.Tabs[b.toUpperCase()],this.setTabs_(),$(a).addClass("inactive"),this.getShowcaseItems(this.tabSelected))}; l.getShowcaseItems=function(a,b,c){$("#options").css("visibility","hidden");$("#notification").show();b=b||"";a=a||"";var e=this.selectedTags_?this.selectedTags_.join(","):"",g="",g=c?"get?item="+c:["get?c=",b,"&review=",a,"&tags=",e].join(""),h=this;a={fetchUrl:m.location.pathname+g,containerSelector:"#showcase-entries",entryElement:"#showcase-table tbody tr",renderFunction:function(a){if(a.success)return $("#options").css("visibility","visible"),$("#notification").hide(),h.showAllItems_(a);$("#result").html(a.error); $("#result").css("display","inline");return $()}};this.pager&&this.pager.contentContainer_.empty();this.pager=new m.pagination.Pager(a)}; l.showAllItems_=function(a){this.showcaseItems=a||this.showcaseItems;var b=$("<table />").attr("id","showcase-table");b.addClass("decorated");a=$("<thead />");var c=$("<tr />").append($("<th />"),$("<th />").text("Project name").addClass("title"),$("<th />").text("Spotlight Featured"),$("<th />").text("Approval Status"),$("<th />"),1==this.tabSelected||2==this.tabSelected?"":$("<th />"),$("<th />"),$("<th />"));a.append(c);b.append(a);a=this.showcaseItems.result;var e=this;$.each(a,function(a,c){var j= ["Pending","Approved","Rejected"],i={};i.review=e.showcaseItems.review_status;e.showcaseItems.current_cursor&&(i.c=e.showcaseItems.current_cursor);var n=$("<input />").attr({name:"approve",type:"button",value:"Approve","class":"button-gray button"});n.click(function(){i.review_status=1;e.updateShowcaseElement_(a,i)});var r=$("<input />").attr({name:"reject",type:"button",value:"Reject","class":"button-gray button"});r.click(function(){i.review_status=2;e.updateShowcaseElement_(a,i)});var v=$("<input />").attr({name:"make-spotlight", type:"button",value:"Make Spotlight","class":"button-gray button"});v.click(function(){i.spotlight_featured=d;e.updateShowcaseElement_(a,i)});var s=$("<input />").attr({name:"make-non-spotlight",type:"button",value:"Make Non-Spotlight","class":"button-gray button"});s.click(function(){i.spotlight_featured=k;e.updateShowcaseElement_(a,i)});var t=$("<input />").attr({name:"edit",type:"button",value:"Edit","class":"button-gray button"});t.bind("click",function(b){b.preventDefault();e.showEditItemPanel(a, c,e.showcaseItems.current_cursor,e.showcaseItems.review_status)});b.append($("<tr>").append($("<td />").addClass("align-center").append(e.makePreviewLink_(a)),$("<td />").text(c.project_name),$("<td />").text(c.spotlight_featured||"false"),$("<td />").text(j[c.review_status]),e.tabSelected!=m.showcase.Tabs.APPROVED?$("<td />").append(n):"",e.tabSelected!=m.showcase.Tabs.REJECTED?$("<td />").append(r):"",$("<td />").append(c.spotlight_featured==d?s:v),$("<td />").append(t)))});a.length||b.append($("<tr>").append($("<td />").text("No Items").addClass("no-items").attr("colspan", 6)));if(a=this.showcaseItems.next_cursor)a=$("<div>").addClass("paging-cursor").data("cursor",a).hide(),b=b.add(a);return b};l.makePreviewLink_=function(a){var b=this,c=$("<a />");c.html("Preview").attr("href","javascript:void(0)");c.click(function(){b.showPreview_(a)});return c}; l.showPreview_=function(a){var b=this,c=$("#overlay"),e=$(document);c.css({width:e.width(),height:e.height()});c.show();c=$("#preview-container");c.html($("#preview-template").html());a=this.showcaseItems.result[a];$("#preview-container").find(".title").html(a.project_name);$("#preview-container").find(".thumbnail").append($("<img />").attr("src",a.thumb));$("#preview-container").find(".info").html(a.project_description);$("#preview-container").find(".close-button").click(function(){b.closePreview_()}); c.show()};l.closePreview_=function(){$("#preview-container").hide();$("#overlay").hide()};l.updateShowcaseElement_=function(a,b){var c=this.showcaseItems.result[a];b.filters=this.selectedTags_.join(",");$.extend(c,b);var e="update/"+encodeURIComponent(c.name),g=this;$("#result").html("Saving...");$("#result").css("display","inline");$.post(e,c,function(a){$("#result").html(a.success?"Successfully updated item.":a.error);$("#result").css("display","inline");g.showAllItems_(a);$("#result").delay(2500).fadeOut("slow")})}; l.updateItemDetail=function(){var a=this.validation();if(a)$("#edit-item-errors").html("Please enter valid values for "+a+"."),$("#edit-item-errors").show();else{var a=this.editItemPanel.find("form"),b="edit/"+encodeURIComponent($("#name").val()),c=this;$("#result").html("Saving...");$("#result").css("display","inline");this.selectedTags_&&$("#filters").val(this.selectedTags_.join(","));$.post(b,a.serialize(),function(a){$("#result").html(a.success?"Successfully updated item.":a.error);c.showAllItems_(a); $("#result").delay(2500).fadeOut("slow")});this.editItemPanel.remove();this.editItemPanel=f}};l.setTabs_=function(){$("#all").removeClass("inactive");$("#approved").removeClass("inactive");$("#rejected").removeClass("inactive");$("#pending").removeClass("inactive")}; l.showEditItemPanel=function(a,b,c,e){if(!this.editItemPanel){a=$("#edit-item-template");this.editItemPanel=$("<div />");this.editItemPanel.addClass("add-item-panel").html((a.val()||"").toString());this.editItemPanel.dialog($.extend({},m.devsite.dialogConfig));this.editItemPanel.dialog("open");a=$(window).height();var g=$(window).width(),h=$(this.editItemPanel).height(),j=$(this.editItemPanel).width(),i=$(window).scrollTop(),g=Math.round((g-j)/2);a=Math.round((a-h)/2)+i;this.editItemPanel.offset({left:g, top:a});$("#item-name-row").hide();$("#item-spotlight-row").hide();$("#edit-item-heading").show();$("#add-item-heading").hide();$("#dashboard-tag-autocomplete").hide();$("#dashboard-tag-autocomplete").siblings(".tags-loading").removeClass("hidden");$("#dashboard-tag-autocomplete").bind("dashboard-tag-autocomplete-tags-loaded",function(){$("#dashboard-tag-autocomplete").show();$("#dashboard-tag-autocomplete").siblings(".tags-loading").addClass("hidden")});var n=this;a=b.tags.map(function(a){return a.name}); n.autocomplete=new m.tag.AutocompleteWidget("dashboard-tag-autocomplete",d,a.join(","));a=$("#add-item-cancel");a.bind("click",function(a){a.preventDefault();$(n.editItemPanel).remove();n.editItemPanel=f});a=$("#add-item-submit");a.bind("click",function(a){a.preventDefault();n.updateItemDetail()});a=$(".close-button");a.bind("click",function(){$(n.editItemPanel).remove();n.editItemPanel=f});$("button.more").click(function(a){a.preventDefault();a=$(a.target);n.addAnother_(a.data("name"),$(this))}); $("#name").val(b.name);$("#project_name").val(b.project_name);$("#developer_name").val(b.developer_name);$("#project_description").val(b.project_description);$("#project_url").val(b.project_url);$("#instruction").val(b.instruction);$("#thumb").val(b.thumb);$("#review_status").val(b.review_status);$("#spotlight_featured").val(b.spotlight_featured?"true":"");$("#c").val(c);$("#review").val(e);for(c=0;c<b.images.length;c++)$('input[name$="images[]"]')[c]&&($('input[name$="images[]"]')[c].value=b.images[c]), c<b.images.length-1&&$("#images-more").trigger("click")}}; l.validation=function(){var a=[],b=[],c=this,e=/^((https?:)\/\/)?[\w._-]+\/([^ ]+)$/,g=/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/;$("#project_name").val()||(a.push("project name"),b.push($("#project_name")));$("#project_description").val()||(a.push("project description"),b.push($("#project_description")));g.test($("#project_url").val())||(a.push("project url"),b.push($("#project_url")));(c=c.autocomplete.GetTagNames())?$("#tags").val(c):(a.push("tags"),b.push($("#dashboard-tag-autocomplete"))); $("input[name=images\\[\\]]").each(function(){if(!e.test($(this).val()))return a.push("images"),b.push(this),k});e.test($("#thumb").val())||(a.push("project thumbnail url"),b.push($("#thumb")));0<b.length&&b[0].focus();return a.length?a.join(", "):""}; l.addAnother_=function(a,b){var c=$("<input type=text />");c.attr("name",a).addClass("kd-textinput kd-custom-textinput");var e=$("<button>x</button>");e.addClass("button-gray button close").click(function(a){a.preventDefault();$(this).parent().remove()});var g=$("<label class=another>");g.append("<br/>").append(c).append(e);b.before(g);c.focus()};l.updateTags=function(a,b){b&&(this.selectedTags_=b.tags,this.getShowcaseItems(this.tabSelected))}; l.searchShowcaseItem=function(a){a=$.trim(a);if(a.length||2>this.showcaseItems.result.length)a=encodeURIComponent(a.replace(/ /g,"-")),this.getShowcaseItems(f,f,a)};m.showcase=m.showcase||{};m.showcase.AddShowCaseItemDialog=function(a){this.model_=p.getInstance();this.bindAddItemEvent(a);this.tags_=[];var b=this;a="getDistinctTags";$.get(a,"",function(a){b.tags_=a.result})};l=m.showcase.AddShowCaseItemDialog.prototype;l.bindAddItemEvent=function(a){this.addItemButtonContainer=a;var b=this;this.addItemButtonContainer.bind("click",function(){b.showAddItemPanel()})}; l.showAddItemPanel=function(){if(!this.addItemPanel){var a=$("#edit-item-template");this.addItemPanel=$("<div />").addClass("add-item-panel").html((a.val()||"").toString());this.addItemPanel.dialog($.extend({},m.devsite.dialogConfig));this.addItemPanel.dialog("open");var a=$(window).height(),b=$(window).width(),c=$(this.addItemPanel).height(),e=$(this.addItemPanel).width(),g=$(window).scrollTop(),b=Math.round((b-e)/2),a=Math.max(44,Math.round((a-c)/2))+g;this.addItemPanel.offset({left:b,top:a});$("#edit-item-heading").hide(); $("#add-item-heading").show();var h=this;$("#dashboard-tag-autocomplete").hide();$("#dashboard-tag-autocomplete").siblings(".tags-loading").removeClass("hidden");$("#dashboard-tag-autocomplete").bind("dashboard-tag-autocomplete-tags-loaded",function(){$("#dashboard-tag-autocomplete").show();$("#dashboard-tag-autocomplete").siblings(".tags-loading").addClass("hidden")});h.autocomplete=new m.tag.AutocompleteWidget("dashboard-tag-autocomplete",d);a=$("#add-item-cancel");a.bind("click",function(a){a.preventDefault(); $(h.addItemPanel).remove();h.addItemPanel=f});a=$("#add-item-submit");a.bind("click",function(a){a.preventDefault();h.addShowcaseItem(h)});a=$("#close-button");a.bind("click",function(){$(h.addItemPanel).remove();h.addItemPanel=f});$("button.more").click(function(a){a.preventDefault();a=$(a.target);h.addAnother_(a.attr("data-name"),$(this))})}}; l.addShowcaseItem=function(a){var b=this.validation(a);if(b)$("#edit-item-errors").html("Please enter valid values for "+b+"."),$("#edit-item-errors").show();else{$("#edit-item-errors").hide();var b=this.addItemPanel.find("form"),c=$(b).find("#name").val(),c=c.replace(/ /g,"-");$("#name").val(c);c="/admin/showcase/add/"+encodeURIComponent(c);$.post(c,$(b).serialize(),function(a){$("#result").html(a.success?"Successfully added item.":a.error);$("#result").css("display","inline");$("#result").delay(3E3).fadeOut(1E3); m.reloadWindow()});$(a.addItemPanel).remove();a.addItemPanel=f}}; l.validation=function(a){var b=[],c=[];a=this;var e=/^[\w.,?!]+$/,g=/^[ \w.,?!'"-]+$/,h=/^((https?:)\/\/)?[\w._-]+\/([^ ]+)$/,j=/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/;e.test($("#name").val())||(b.push("name"),c.push($("#name")));g.test($("#project_name").val())||(b.push("project name"),c.push($("#project_name")));g.test($("#project_description").val())||(b.push("project description"),c.push($("#project_description")));j.test($("#project_url").val())||(b.push("project url"), c.push($("#project_url")));(a=a.autocomplete.GetTagNames())?$("#tags").val(a):(b.push("tags"),c.push($("#dashboard-tag-autocomplete")));$("input[name=images\\[\\]]").each(function(){if(!h.test($(this).val()))return b.push("images"),c.push(this),k});h.test($("#thumb").val())||(b.push("project thumbnail url"),c.push($("#thumb")));0<c.length&&c[0].focus();return b.length?b.join(", "):""}; l.addAnother_=function(a,b){var c=$("<input type=text />");c.attr("name",a).addClass("kd-textinput kd-custom-textinput");var e=$("<button>x</button>");e.addClass("button-gray button close").click(function(a){a.preventDefault();$(this).parent().remove()});var g=$("<label class=another>");g.append("<br/>").append(c).append(e);b.before(g);c.focus()}; </script> <!-- Google Code for PXL - Developers - Codesite - HP - 90d Remarketing List --> <script type="text/javascript"> $('#setlang select').each(function() { if ($.browser.msie) { $(this).change(function() { $('#setlang').submit(); }); } else { $(this).kdSelect({'change': function() { $('#setlang').submit(); }}); } }); </script> <script type="text/javascript"> /* <![CDATA[ */ var google_conversion_id = 992540712; var google_conversion_language = "en"; var google_conversion_format = "3"; var google_conversion_color = "ffffff"; var google_conversion_label = "qio2CKCPwQMQqPCj2QM"; var google_conversion_value = 0; /* ]]> */ </script> <script type="text/javascript" src="//web.archive.org/web/20130122003613js_/https://www.googleadservices.com/pagead/conversion.js"> </script> <script> google.load('visualization', '1', {packages: ['table']}); </script> <noscript> <div style="display:inline;"> <img height="1" width="1" style="border-style:none;" alt="" src="//web.archive.org/web/20130122003613im_/https://www.googleadservices.com/pagead/conversion/992540712/?label=qio2CKCPwQMQqPCj2QM&amp;guid=ON&amp;script=0"/> </div> </noscript> </body> </html> <!-- FILE ARCHIVED ON 00:36:13 Jan 22, 2013 AND RETRIEVED FROM THE INTERNET ARCHIVE ON 17:32:06 Nov 28, 2024. JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. SECTION 108(a)(3)). --> <!-- playback timings (ms): captures_list: 0.612 exclusion.robots: 0.033 exclusion.robots.policy: 0.023 esindex: 0.011 cdx.remote: 49.545 LoadShardBlock: 314.06 (3) PetaboxLoader3.datanode: 200.18 (4) PetaboxLoader3.resolve: 201.212 (3) load_resource: 113.504 -->

Pages: 1 2 3 4 5 6 7 8 9 10