Campleaderboard

Size
4,119 Kb
Views
26,312

How do I make an campleaderboard?

What is a campleaderboard? How do you make a campleaderboard? This script and codes were developed by Neeilan Selvalingam on 13 September 2022, Tuesday.

Campleaderboard Previews

Campleaderboard - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>campleaderboard</title> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id = 'LeaderboardApp' class = "col-sm-offset-2 col-sm-8" /> <script src='https://fb.me/react-15.1.0.min.js'></script>
<script src='https://fb.me/react-dom-15.1.0.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Campleaderboard - Script Codes CSS Codes

.profilePic { width: 30px; height: 30px; border-radius: 50%; margin-right: 10px;
}
#LeaderboardApp { margin-top: 20px;
}

Campleaderboard - Script Codes JS Codes

'use strict';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var LeaderboardApp = function (_React$Component) { _inherits(LeaderboardApp, _React$Component); function LeaderboardApp(props) { _classCallCheck(this, LeaderboardApp); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props)); _this.state = { last30: true, data: [] }; _this.toggleSort = _this.toggleSort.bind(_this); return _this; } LeaderboardApp.prototype.componentWillMount = function componentWillMount() { this.request(); }; LeaderboardApp.prototype.render = function render() { var tableRows = this.state.data.map(function (user) { return React.createElement(TableRow, { key: user.username, username: user.username, recent: user.recent, alltime: user.alltime, img: user.img }); }); var sortedBy = this.state.last30 ? 'all-time score' : 'recent score'; return React.createElement( 'div', null, React.createElement( 'span', { className: 'btn btn-primary', onClick: this.toggleSort }, 'Sort by ', sortedBy ), React.createElement( 'table', { className: 'table table-striped' }, React.createElement( 'thead', null, React.createElement( 'tr', null, React.createElement( 'th', null, 'Camper' ), React.createElement( 'th', null, this.getLast30, 'Last 30' ), React.createElement( 'th', null, this.getAllTime, 'All time' ) ) ), React.createElement( 'tbody', null, tableRows ) ) ); }; LeaderboardApp.prototype.toggleSort = function toggleSort() { this.setState({ 'last30': !this.state.last30 }, this.request); }; LeaderboardApp.prototype.request = function request() { var _this2 = this; var url = 'https://fcctop100.herokuapp.com/api/fccusers/top/'; url += this.state.last30 ? 'recent' : 'alltime'; var xhr = new XMLHttpRequest(); xhr.open("GET", url, false); xhr.onreadystatechange = function () { if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) { _this2.setState({ data: JSON.parse(xhr.responseText) }); console.log(_this2.state); }; }; xhr.send(); }; return LeaderboardApp;
}(React.Component);
var TableRow = function (_React$Component2) { _inherits(TableRow, _React$Component2); function TableRow(props) { _classCallCheck(this, TableRow); return _possibleConstructorReturn(this, _React$Component2.call(this, props)); } TableRow.prototype.render = function render() { return React.createElement( 'tr', { key: this.props.username }, React.createElement( 'td', null, React.createElement('img', { className: 'profilePic', src: this.props.img }), this.props.username ), React.createElement( 'td', null, this.props.recent ), React.createElement( 'td', null, this.props.alltime ) ); }; return TableRow;
}(React.Component);
ReactDOM.render(React.createElement(LeaderboardApp, null), document.getElementById('LeaderboardApp'));
Campleaderboard - Script Codes
Campleaderboard - Script Codes
Home Page Home
Developer Neeilan Selvalingam
Username neeilan
Uploaded September 13, 2022
Rating 3
Size 4,119 Kb
Views 26,312
Do you need developer help for Campleaderboard?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Neeilan Selvalingam (neeilan) Script Codes
Name
Scribe
Simon Game
NeeilCalc
DecisionTree
NeeilWeather
NeeilTimer
Parallaxtest
RecipeBox
Portfolio Website
Fctest
Create amazing video scripts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!