TableTop.js - turn a google sheet into a JavaScript object
How do I make an tabletop.js - turn a google sheet into a javascript object?
What is a tabletop.js - turn a google sheet into a javascript object? How do you make a tabletop.js - turn a google sheet into a javascript object? This script and codes were developed by Stuart Allen on 18 January 2023, Wednesday.
TableTop.js - turn a google sheet into a JavaScript object - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>TableTop.js - turn a google sheet into a JavaScript object</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'>
</head>
<body> <!-- handlebars placeholders -->
<div id="listItems"></div>
<div id="modals"></div>
<!-- handlebars template scripts -->
<script id="entry-template" type="text/x-handlebars-template"> {{#eachByServiceId this}} <div class="list-item {{serviceType}} {{serviceProvider}} {{#each serviceStages}}{{this}} {{/each}}" data-toggle="modal" data-target="#{{serviceId}}-modal">{{serviceName}}{{#if serviceSubs}}<br><small class="list-item__serviceSubs">{{serviceSubs}}</small>{{/if}}</div> {{/eachByServiceId}}
</script>
<script id="serviceModal-template" type="text/x-handlebars-template"> {{#each this}} <div class="modal fade" id="{{serviceId}}-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">{{serviceName}}</h4> </div> <div class="modal-body"> <p>Info about {{serviceName}}</p> <a href="#">Link to {{serviceName}} site</a> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> </div> {{/each}}
</script> <script src='https://cdnjs.cloudflare.com/ajax/libs/tabletop.js/1.4.3/tabletop.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.5/handlebars.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
TableTop.js - turn a google sheet into a JavaScript object - Script Codes JS Codes
//
// Handlebars helpers
//
// Sort
Handlebars.registerHelper('eachByServiceId', function(data, options) { var output = ''; var contextSorted = data.concat() .sort(function(a, b) { return compareStrings(a.serviceType, b.serviceType); }) for (var i = 0, j = contextSorted.length; i < j; i++) { output += options.fn(contextSorted[i]); } return output;
});
// Sort helper
function compareStrings(a, b) { // case-insensitive comparison a = a.toLowerCase(); b = b.toLowerCase(); return (a < b) ? -1 : (a > b) ? 1 : 0;
}
// declare the google sheet using a published spreadsheet
var public_spreadsheet_url = 'https://docs.google.com/spreadsheets/d/1Fr1pMFJzPLujcD22Wx1PQsu3WBpI9h9-5rj0qwN4cRM/pubhtml';
function init() { Tabletop.init({ key: public_spreadsheet_url, callback: showInfo, simpleSheet: true })
}
function showInfo(data, tabletop) { var list = $("#listItems"), modals = $("#modals"); // get templates wrapped in scripts tags var source = $("#entry-template").html(), modalSource = $("#serviceModal-template").html(); // compile template with handlebars var template = Handlebars.compile(source), modalTemplate = Handlebars.compile(modalSource); // sort data by numerical attribute // data.sort( function(a,b) { return a.serviceId - b.serviceId; } ); list.html(template(data)); modals.html(modalTemplate(data));
}
init()
Developer | Stuart Allen |
Username | rarebush |
Uploaded | January 18, 2023 |
Rating | 3 |
Size | 2,681 Kb |
Views | 6,072 |
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 |
Aasld large links | 34,652 Kb |
Circle-graphic | 27,554 Kb |
Research ecosystem graphic-chord | 2,901 Kb |
Literatum Style Guide | 8,561 Kb |
Animated leaderboard - WOL home | 257,159 Kb |
One Wiley Colors | 2,664 Kb |
Dashboard Builder - piechart | 2,982 Kb |
Animated leaderboard | 5,701 Kb |
A Pen by Stuart Allen | 2,299 Kb |
Blur background on search focus | 2,833 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 |
Codero Sitemap | S1m0ne | 28,169 Kb |
Ionic - Wordpress REST API starter | Superpikar | 2,961 Kb |
Wikipedia Viewer | Thalpha | 4,426 Kb |
Highbrow Basic HTML Lesson 7 | Kimlarocca | 1,662 Kb |
Javascript Welcome | Peterlewicki | 1,573 Kb |
Colorful Sliders | Chanrith | 1,246 Kb |
Webkit decolorize | Fivera | 1,675 Kb |
Rotate Demo | Agelber | 3,061 Kb |
CSS3 iPad | Vikvarg | 1,766 Kb |
HEXAGON | Aurumlux | 1,684 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!