diff --git a/_includes/footer.html b/_includes/footer.html index 99bba09..6ab9190 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -19,4 +19,5 @@
Stay Connected
+ diff --git a/index.html b/index.html index 6666fa7..97d0a20 100755 --- a/index.html +++ b/index.html @@ -80,458 +80,6 @@

SDKs and Libraries

The open source versions of our SDKs with relevant links to learn more.
-
-
- -

Objective-C

-

- - - - - - - - -

-
- - - - - - - - - -
-
-
- -

Android

-

- - - - - - - - -

-
- - - - - - - - - - - -
-
-
- -

JavaScript

-

- - - - - - - - -

-
- - - - - - - - - - -
-
-
-
-
- -

Swift

-

- - - - - - - - -

-
- - - - - - - - - - -
-
-
- -

Flutter

-

- - - - - - - - -

-
- - - - - - - - - - -
-
-
- -

Dart

-

- - - - - - - - -

-
- - - - - - - - - - -
-
-
-
-
- -

PHP

-

- - - - - - - - -

-
- - - - - - - - - - -
-
-
- -

.NET + Xamarin

-

- - - - - - - - -

-
- - - - - - - - - - -
-
-
- -

Unity

-

- - - - - - - - -

-
- - - - - - - - - - -
-
-
-
-
- -

Arduino

-

- - - - - - - - -

-
- - - - - - - - - - -
-
-
- -

Embedded C

-

- - - - - - - - -

-
- - - - - - - - - - -
-
-
- -

Cloud Code

-
- - - -
-
-
-
-
- -

REST API

-
- - - -
-
-
- -

GraphQL API

-
- - - -
diff --git a/js/links.js b/js/links.js new file mode 100644 index 0000000..9e94293 --- /dev/null +++ b/js/links.js @@ -0,0 +1,225 @@ +const links = { + 'parse-server': { + image: 'https://parseplatform.org/img/cloudcode.svg', + }, + 'Parse-SDK-iOS-OSX': { + name: 'Objective-C', + image: 'https://parseplatform.org/img/ios.svg', + guides: [ + { + name: 'iOS Guide', + link: 'https://docs.parseplatform.org/ios/guide/', + }, + { + name: 'macOS Guide', + link: 'https://docs.parseplatform.org/macos/guide/', + }, + ], + modules: [ + { name: 'Live Query', link: 'https://github.com/parse-community/ParseLiveQuery-iOS-OSX' }, + ], + }, + 'Parse-SDK-Android': { + image: 'https://parseplatform.org/img/android.svg', + name: 'Android', + guide: 'https://docs.parseplatform.org/android/guide/', + modules: [ + { name: 'Parse UI', link: 'https://github.com/parse-community/ParseUI-Android' }, + { name: 'Live Query', link: 'https://github.com/parse-community/ParseLiveQuery-Android' }, + ], + }, + 'Parse-SDK-JS': { + image: 'https://parseplatform.org/img/javascript.svg', + guide: 'https://docs.parseplatform.org/js/guide/', + name: 'JavaScript', + }, + 'Parse-Swift': { + image: 'https://parseplatform.org/img/swiftColour.svg', + guide: 'https://github.com/parse-community/Parse-Swift#usage-guide', + name: 'Swift', + }, + 'Parse-SDK-Flutter': [ + { + image: 'https://parseplatform.org/img/flutter.svg', + guide: 'https://docs.parseplatform.org/flutter/guide/', + api: + 'https://parseplatform.org/Parse-SDK-Flutter/flutter/flutter_parse_sdk_flutter/flutter_parse_sdk_flutter-library.html', + name: 'Flutter', + }, + { + image: 'https://parseplatform.org/img/dart.svg', + guide: 'https://docs.parseplatform.org/dart/guide/', + api: + 'https://parseplatform.org/Parse-SDK-Flutter/flutter/flutter_parse_sdk_flutter/flutter_parse_sdk_flutter-library.html', + name: 'Dart', + }, + ], + 'parse-php-sdk': { + image: 'https://parseplatform.org/img/php.svg', + guide: 'https://docs.parseplatform.org/php/guide/', + api: 'https://parseplatform.org/parse-php-sdk/', + name: 'PHP', + }, + 'Parse-SDK-dotNET': [ + { + image: 'https://parseplatform.org/img/net.svg', + guide: 'https://docs.parseplatform.org/dotnet/guide/', + name: '.NET + Xaramin', + }, + { + image: 'https://parseplatform.org/img/unity.svg', + guide: 'https://docs.parseplatform.org/unity/guide/', + name: 'Unity', + }, + ], + 'Parse-SDK-Arduino': { + image: 'https://parseplatform.org/img/arduino.svg', + guide: 'https://docs.parseplatform.org/arduino/guide/', + name: 'Arduino', + }, + 'parse-embedded-sdks': { + image: 'https://parseplatform.org/img/c.svg', + guide: 'https://docs.parseplatform.org/embedded_c/guide/', + name: 'Embedded C', + }, +}; +const additionalMeta = [ + { + name: 'Cloud Code', + image: 'https://parseplatform.org/img/cloudcode.svg', + guide: 'https://docs.parseplatform.org/cloudcode/guide/', + other: [ + { title: 'Defined Schemas', link: 'https://docs.parseplatform.org/defined-schema/guide/' }, + ], + }, + { + name: 'REST API', + image: 'https://parseplatform.org/img/rest.svg', + guide: 'https://docs.parseplatform.org/rest/guide/', + }, + { + name: 'GraphQL API', + image: 'https://parseplatform.org/img/graphql.svg', + guide: 'https://docs.parseplatform.org/graphql/guide/', + }, +]; + +document.addEventListener("DOMContentLoaded", () => { + if (!gitJson) { + return; + } + gitJson = gitJson.sort((a, b) => b.stargazers_count - a.stargazers_count); + const formatNumber = new Intl.NumberFormat().format; + const repoRow = document.querySelector('.repoRow'); + for (const git of gitJson) { + const title = git.name; + const stars = parseInt(git.stargazers_count); + const forks = parseInt(git.forks_count); + const meta = links[title]; + if (!meta) { + continue; + } + for (const metaData of Array.isArray(meta) ? meta : [meta]) { + const formattedTitle = title + .split('-') + .map(string => string.charAt(0).toUpperCase() + string.slice(1)) + .join(' '); + const guideLink = metaData.guides + ? ` + ` + : ` + + + `; + const modules = metaData.modules + ? ` + ` + : ``; + const text = ` +
+
+ +

${metaData.name || formattedTitle}

+

+ + + ${formatNumber(stars)} + + + + ${formatNumber(forks)} + +

+
+ ${guideLink} + + + + + + + ${modules} +
+ + + +
+
`; + repoRow.insertAdjacentHTML('beforeend', text); + } + } + + for (const row of additionalMeta) { + const additonal = (row.other || []) + .map( + other => ` + + ` + ) + .join(''); + const text = ` +
+
+ +

${row.name}

+
+ + + + ${additonal} +
+
+
`; + repoRow.insertAdjacentHTML('beforeend', text); + } + const expandButtons = document.querySelectorAll('.expandableRepoLink') + for (const button of expandButtons) { + button.addEventListener('click', () => button.classList.toggle('expanded')); + } +}); diff --git a/js/main.js b/js/main.js index 8203091..eeff660 100755 --- a/js/main.js +++ b/js/main.js @@ -9,9 +9,9 @@ $(document).ready(function(){ // Use Jekyll Metadata to list the repos // (except for community repos) //====================================// - var totalStars = 0, - totalForks = 0, - totalRepos = 0; + let totalStars = 0; + let totalForks = 0; + let totalRepos = 0; //render repo to page function addToSection(sectionTitle, url, title, description, forks, stars, language){ @@ -22,22 +22,19 @@ $(document).ready(function(){ sectionTitle.append("

" + title + "

" + description + "

"); } + if (typeof gitJson !== 'undefined'){ - // Sort the gitJson by popularity - gitJson = gitJson.sort(function (a, b) { - return parseInt(a.stargazers_count) < parseInt(b.stargazers_count); - }); - for (var j = 0; j < gitJson.length; j++) { - var title = gitJson[j].name, - sortTitle = title.toLowerCase(), - url = gitJson[j].html_url, - hasIssues = gitJson[j].has_issues, - archived = gitJson[j].archived, - description = gitJson[j].description, - stars = parseInt(gitJson[j].stargazers_count), - forks = parseInt(gitJson[j].forks_count), - language = gitJson[j].language, - sortDescription = ""; + for (const git of gitJson) { + const title = git.name; + const sortTitle = title.toLowerCase(); + const url = git.html_url; + const hasIssues = git.has_issues; + const archived = git.archived; + const description = git.description; + const stars = parseInt(git.stargazers_count); + const forks = parseInt(git.forks_count); + let language = git.language; + let sortDescription = ""; // sortable description if (description !== null && description !== ""){ @@ -65,49 +62,7 @@ $(document).ready(function(){ //Sort SDK Repos //if title contains sdk hide it (since we hardcode them) - if (sortTitle.indexOf("sdk") >= 0 || sortTitle.indexOf("cli") >= 0 || sortTitle.indexOf("parse-swift") >= 0) { - //if title matches hardcoded repo title then use these forks/stars - if (sortTitle.includes("ios") === true){ - //ios stars/forks - $(".iosRepo .sdkRepoStar").text(stars); - $(".iosRepo .sdkRepoFork").text(forks); - } else if (sortTitle.includes("android") === true){ - $(".androidRepo .sdkRepoStar").text(stars); - $(".androidRepo .sdkRepoFork").text(forks); - } else if (sortTitle.includes("javascript") === true || sortTitle.includes("js") === true){ - $(".javascriptRepo .sdkRepoStar").text(stars); - $(".javascriptRepo .sdkRepoFork").text(forks); - } else if (sortTitle.includes("php") === true){ - $(".phpRepo .sdkRepoStar").text(stars); - $(".phpRepo .sdkRepoFork").text(forks); - } else if (sortTitle.includes("net") === true){ - //xamarin and dot net - $(".xamarinRepo .sdkRepoStar").text(stars); - $(".xamarinRepo .sdkRepoFork").text(forks); - - //Unity - $(".unityRepo .sdkRepoStar").text(stars); - $(".unityRepo .sdkRepoFork").text(forks); - } else if (sortTitle.includes("arduino") === true){ - $(".arduinoRepo .sdkRepoStar").text(stars); - $(".arduinoRepo .sdkRepoFork").text(forks); - } else if (sortTitle.includes("embedded") === true){ - $(".embeddedRepo .sdkRepoStar").text(stars); - $(".embeddedRepo .sdkRepoFork").text(forks); - } else if (sortTitle.includes("cli") === true){ - $(".cloudCodeRepo .sdkRepoStar").text(stars); - $(".cloudCodeRepo .sdkRepoFork").text(forks); - } else if (sortTitle.includes("swift") === true){ - $(".swiftRepo .sdkRepoStar").text(stars); - $(".swiftRepo .sdkRepoFork").text(forks); - } else if (sortTitle.includes("flutter") === true){ - $(".flutterRepo .sdkRepoStar").text(stars); - $(".flutterRepo .sdkRepoFork").text(forks); - $(".dartRepo .sdkRepoStar").text(stars); - $(".dartRepo .sdkRepoFork").text(forks); - } - continue; - } + //ignore repos with issues turned off if (hasIssues === false || archived === true || title === '.github' || title === 'Governance' || title === 'parse-community-peril' || title === 'parse-community.github.io' || title === 'blog' || title === 'relay-examples' || title === 'docs'|| title === 'parse-facebook-user-session'){ @@ -136,18 +91,10 @@ $(document).ready(function(){ } //write total forks, stars and repos into the page - $(".heroText .repoCount").text(totalRepos); - $(".heroText .starCount").text(totalStars); - $(".heroText .forkCount").text(totalForks); - - //====================================// - // expand/contract - //====================================// - $(".expandableRepoLink").click(function(){ - var clicked = $(this); - $(".expandableRepoLink").not(clicked).removeClass("expanded"); - clicked.toggleClass("expanded"); - }); + const formatNumber = new Intl.NumberFormat().format + $(".heroText .repoCount").text(formatNumber(totalRepos)); + $(".heroText .starCount").text(formatNumber(totalStars)); + $(".heroText .forkCount").text(formatNumber(totalForks)); //====================================// // Header animation