1Repository = function(repo) { 2 // attributes 3 this.name = repo.name; 4 this.language = repo.language; 5 this.url = repo.html_url; 6 this.description = repo.description; 7 this.fork = repo.fork; 8 this.watchers = repo.watchers; 9 this.forks = repo.forks; 10} 11 12Repository.prototype.blogPost = function() { 13 if (oss_projects[this.name] && oss_projects[this.name].blog_post) { 14 return oss_projects[this.name].blog_post; 15 } 16} 17 18Repository.prototype.featured = function() { 19 return oss_projects[this.name] && oss_projects[this.name].featured; 20} 21 22Repository.prototype.deprecated = function() { 23 return oss_projects[this.name] && oss_projects[this.name].deprecated; 24} 25 26Repository.prototype.position = function() { 27 if (oss_projects[this.name] && oss_projects[this.name].position) { 28 return oss_projects[this.name].position; 29 } 30} 31 32Repository.prototype.logo = function() { 33 if (oss_projects[this.name] && oss_projects[this.name].logo) { 34 return oss_projects[this.name].logo; 35 } 36} 37 38Repository.prototype.background = function() { 39 if (oss_projects[this.name] && oss_projects[this.name].background) { 40 return oss_projects[this.name].background; 41 } 42} 43 44Repository.prototype.classes = function() { 45 if (this.featured()) { 46 return 'featured-project'; 47 } else if (this.deprecated()) { 48 return 'deprecated-project'; 49 } 50} 51 52Repository.prototype.getBlogLink = function() { 53 if (this.blogPost()) { 54 return '<a href="'+ this.blogPost() +'" target="_blank"><span class="octicon octicon-file-text"></span> Blog post</a> '; 55 } 56} 57 58Repository.prototype.getContainer = function(index) { 59 var last = ''; 60 if (index % 4 == 0) { last = 'last-in-row' } 61 62 return [ 63 '<div class="project island-light island-stack island ', this.language, ' ', this.classes(), ' ', last, '">', 64 this.featuredImage(), 65 this.repoContent(), 66 this.bottomLinks(), 67 '</div>' 68 ].join(''); 69} 70 71Repository.prototype.featuredImage = function() { 72 if (this.featured()) { 73 return [ 74 '<div class="island-item featured-image">', 75 '<img src="/img/', this.background() ,'">', 76 '</div>' 77 ].join(''); 78 } 79} 80 81Repository.prototype.headerLogo = function() { 82 if (this.logo()) { 83 return '<img src="/img/' + this.logo() + '" height="21px" width="26px" class="logo"> '; 84 } 85} 86 87Repository.prototype.repoContent = function() { 88 return [ 89 '<div class="island-item">', 90 '<h3>', 91 '<a href="', this.url, '" target="_blank">', this.headerLogo(), this.name, '</a>', 92 '</h3>', 93 '<div class="repo-info">', 94 '<span><i class="octicon octicon-star"></i> ', this.watchers, '</span> ', 95 '<span><i class="octicon octicon-repo-forked"></i> ', this.forks, '</span>', 96 '<span class="language ', this.language ,'">', this.language, '</span>', 97 '</div>', 98 '<p>', this.description, '</p>', 99 '</div>' 100 ].join(''); 101} 102 103Repository.prototype.bottomLinks = function() { 104 if (this.blogPost()) { 105 return [ 106 '<div class="island-item bottom-links">', 107 this.getBlogLink(), 108 '</div>' 109 ].join(''); 110 } 111} 112 113// vim: sw=2 sts=2 expandtab
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.