Campleaderboard
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 - 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'));
Developer | Neeilan Selvalingam |
Username | neeilan |
Uploaded | September 13, 2022 |
Rating | 3 |
Size | 4,119 Kb |
Views | 26,312 |
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!
Name | Size |
Scribe | 3,525 Kb |
Simon Game | 3,313 Kb |
NeeilCalc | 3,209 Kb |
DecisionTree | 2,521 Kb |
NeeilWeather | 2,971 Kb |
NeeilTimer | 2,836 Kb |
Parallaxtest | 1,152 Kb |
RecipeBox | 6,082 Kb |
Portfolio Website | 3,847 Kb |
Fctest | 14,173 Kb |
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!
Name | Username | Size |
See Through | Larrygeams | 77,410 Kb |
Exploring css spinners | Akagr | 3,569 Kb |
Highbrow Basic HTML Lesson 8 | Kimlarocca | 2,094 Kb |
A Pen by Huan Nghiem | Nightshade | 10,646 Kb |
Flex Chart | James_zedd | 4,111 Kb |
Image Stack Test SCSS | CalvinMorett | 2,799 Kb |
Fun animations with CSS3 | Minimalmonkey | 2,360 Kb |
Use the Twitchtv JSON API | Roksanaop | 3,561 Kb |
Resume | Rottingroom | 5,483 Kb |
Google Chrome Icon using Pure CSS in one DIV | Grssam | 3,627 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!