@@ -29,19 +29,22 @@ define(function (require, exports, module) {
2929 "use strict" ;
3030
3131 var AppInit = require ( "utils/AppInit" ) ,
32- Global = require ( "utils/Global" ) ,
3332 BuildInfoUtils = require ( "utils/BuildInfoUtils" ) ,
34- Commands = require ( "command/Commands" ) ,
3533 CommandManager = require ( "command/CommandManager" ) ,
34+ Commands = require ( "command/Commands" ) ,
3635 Dialogs = require ( "widgets/Dialogs" ) ,
37- Strings = require ( "strings" ) ,
38- UpdateNotification = require ( "utils/UpdateNotification" ) ,
3936 FileUtils = require ( "file/FileUtils" ) ,
37+ Global = require ( "utils/Global" ) ,
4038 NativeApp = require ( "utils/NativeApp" ) ,
39+ Strings = require ( "strings" ) ,
4140 StringUtils = require ( "utils/StringUtils" ) ,
41+ UpdateNotification = require ( "utils/UpdateNotification" ) ,
4242 AboutDialogTemplate = require ( "text!htmlContent/about-dialog.html" ) ,
4343 ContributorsTemplate = require ( "text!htmlContent/contributors-list.html" ) ;
4444
45+ /** @const This is the thirdparty API's (GitHub) maximum contributors per page limit */
46+ var CONTRIBUTORS_PER_PAGE = 100 ;
47+
4548 var buildInfo ;
4649
4750
@@ -76,39 +79,78 @@ define(function (require, exports, module) {
7679 Dialogs . showModalDialogUsingTemplate ( Mustache . render ( AboutDialogTemplate , templateVars ) ) ;
7780
7881 // Get containers
79- var $dlg = $ ( ".about-dialog.instance" ) ,
80- $contributors = $dlg . find ( ".about-contributors" ) ,
81- $spinner = $dlg . find ( ".spinner" ) ;
82+ var $dlg = $ ( ".about-dialog.instance" ) ,
83+ $contributors = $dlg . find ( ".about-contributors" ) ,
84+ $spinner = $dlg . find ( ".spinner" ) ,
85+ contributorsUrl = brackets . config . contributors_url ,
86+ page ;
87+
88+ if ( contributorsUrl . indexOf ( "{1}" ) !== - 1 ) { // pagination enabled
89+ page = 1 ;
90+ }
8291
8392 $spinner . addClass ( "spin" ) ;
8493
85- // Get all the project contributors and add them to the dialog
86- $ . getJSON ( brackets . config . contributors_url ) . done ( function ( contributorsInfo ) {
87-
88- // Populate the contributors data
89- var totalContributors = contributorsInfo . length ;
90- var contributorsCount = 0 ;
91-
92- $contributors . html ( Mustache . render ( ContributorsTemplate , contributorsInfo ) ) ;
93-
94- // This is used to create an opacity transition when each image is loaded
95- $contributors . find ( "img" ) . one ( "load" , function ( ) {
96- $ ( this ) . css ( "opacity" , 1 ) ;
97-
98- // Count the contributors loaded and hide the spinner once all are loaded
99- contributorsCount ++ ;
100- if ( contributorsCount >= totalContributors ) {
101- $spinner . removeClass ( "spin" ) ;
102- }
103- } ) . each ( function ( ) {
104- if ( this . complete ) {
105- $ ( this ) . trigger ( "load" ) ;
106- }
94+ function loadContributors ( rawUrl , page , contributors , deferred ) {
95+ deferred = deferred || new $ . Deferred ( ) ;
96+ contributors = contributors || [ ] ;
97+ var url = StringUtils . format ( rawUrl , CONTRIBUTORS_PER_PAGE , page ) ;
98+
99+ $ . ajax ( {
100+ url : url ,
101+ dataType : "json" ,
102+ cache : false
103+ } )
104+ . done ( function ( response ) {
105+ contributors = contributors . concat ( response || [ ] ) ;
106+ if ( page && response . length === CONTRIBUTORS_PER_PAGE ) {
107+ loadContributors ( rawUrl , page + 1 , contributors , deferred ) ;
108+ } else {
109+ deferred . resolve ( contributors ) ;
110+ }
111+ } )
112+ . fail ( function ( ) {
113+ if ( contributors . length ) { // we weren't able to fetch this page, but previous fetches were successful
114+ deferred . resolve ( contributors ) ;
115+ } else {
116+ deferred . reject ( ) ;
117+ }
118+ } ) ;
119+ return deferred . promise ( ) ;
120+ }
121+
122+ loadContributors ( contributorsUrl , page ) // Load the contributors
123+ . done ( function ( allContributors ) {
124+ // Populate the contributors data
125+ var totalContributors = allContributors . length ,
126+ contributorsCount = 0 ;
127+
128+ allContributors . forEach ( function ( contributor ) {
129+ // remove any UrlParams delivered via the GitHub API
130+ contributor . avatar_url = contributor . avatar_url . split ( "?" ) [ 0 ] ;
131+ } ) ;
132+
133+ $contributors . html ( Mustache . render ( ContributorsTemplate , allContributors ) ) ;
134+
135+ // This is used to create an opacity transition when each image is loaded
136+ $contributors . find ( "img" ) . one ( "load" , function ( ) {
137+ $ ( this ) . css ( "opacity" , 1 ) ;
138+
139+ // Count the contributors loaded and hide the spinner once all are loaded
140+ contributorsCount ++ ;
141+ if ( contributorsCount >= totalContributors ) {
142+ $spinner . removeClass ( "spin" ) ;
143+ }
144+ } ) . each ( function ( ) {
145+ if ( this . complete ) {
146+ $ ( this ) . trigger ( "load" ) ;
147+ }
148+ } ) ;
149+ } )
150+ . fail ( function ( ) {
151+ $spinner . removeClass ( "spin" ) ;
152+ $contributors . html ( Mustache . render ( "<p class='dialog-message'>{{ABOUT_TEXT_LINE6}}</p>" , Strings ) ) ;
107153 } ) ;
108- } ) . fail ( function ( ) {
109- $spinner . removeClass ( "spin" ) ;
110- $contributors . html ( Mustache . render ( "<p class='dialog-message'>{{ABOUT_TEXT_LINE6}}</p>" , Strings ) ) ;
111- } ) ;
112154 }
113155
114156 // Read "build number" SHAs off disk immediately at APP_READY, instead
0 commit comments