|
3 | 3 | var pluginName = "github",
|
4 | 4 | document = window.document,
|
5 | 5 | defaults = {
|
6 |
| - propertyName: "value" |
| 6 | + iconStars: true, |
| 7 | + iconForks: true, |
| 8 | + iconIssues: false |
7 | 9 | };
|
8 | 10 |
|
9 | 11 | function Plugin( element, options ) {
|
|
19 | 21 | self._name = pluginName;
|
20 | 22 |
|
21 | 23 | self.init();
|
| 24 | + self.displayIcons(); |
22 | 25 | }
|
23 | 26 |
|
24 | 27 | // Initializer
|
|
34 | 37 | }
|
35 | 38 | };
|
36 | 39 |
|
| 40 | + // Display or hide icons |
| 41 | + Plugin.prototype.displayIcons = function () { |
| 42 | + $iconStars = $( ".repo-stars" ); |
| 43 | + $iconForks = $( ".repo-forks" ); |
| 44 | + $iconIssues = $( ".repo-issues" ); |
| 45 | + |
| 46 | + if ( this.options.iconStars ) { |
| 47 | + $iconStars.css( "display", "inline-block" ); |
| 48 | + } else { |
| 49 | + $iconStars.css( "display", "none" ); |
| 50 | + } |
| 51 | + |
| 52 | + if ( this.options.iconForks ) { |
| 53 | + $iconForks.css( "display", "inline-block" ); |
| 54 | + } else { |
| 55 | + $iconForks.css( "display", "none" ); |
| 56 | + } |
| 57 | + |
| 58 | + if ( this.options.iconIssues ) { |
| 59 | + $iconIssues.css( "display", "inline-block" ); |
| 60 | + } else { |
| 61 | + $iconIssues.css( "display", "none" ); |
| 62 | + } |
| 63 | + }; |
| 64 | + |
37 | 65 | // Apply results to HTML template
|
38 | 66 | Plugin.prototype.applyTemplate = function ( repo ) {
|
39 | 67 | var self = this,
|
|
110 | 138 | <div class='github-stats'> \
|
111 | 139 | <a class='repo-stars' title='Stars' data-icon='7' href='" + repo_url + "/watchers'>" + repo.watchers + "</a> \
|
112 | 140 | <a class='repo-forks' title='Forks' data-icon='f' href='" + repo_url + "/network'>" + repo.forks + "</a> \
|
| 141 | + <a class='repo-issues' title='Issues' data-icon='i' href='" + repo_url + "/issues'>" + repo.open_issues + "</a> \ |
113 | 142 | </div> \
|
114 | 143 | </div> \
|
115 | 144 | <div class='github-box-content'> \
|
|
0 commit comments