Spaces:
Running
Running
Update index.html
Browse files12345678910111213141516171819<!doctype html><html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width" /><title>My static Space</title><link rel="stylesheet" href="style.css" /></head><body><div class="card"><h1>Welcome to your static Space!</h1><p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p><p>Also don't forget to check the<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.</p></div></body></html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Dynamic Boxes with Facets</title><link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"><style>body {font-family: Arial, sans-serif;background-color: #f8f9fa;}.container {margin-top: 50px;}.box {border: 1px solid #ddd;padding: 15px;margin-bottom: 10px;background-color: #fff;border-radius: 5px;}.box-title {font-weight: bold;}.result-box {border: 1px solid #28a745;padding: 15px;margin-top: 20px;background-color: #e8f5e9;border-radius: 5px;}</style></head><body><div class="container"><div class="row mb-4"><div class="col-md-12"><h2>Input Section</h2><div class="form-group"><label for="query">Query:</label><input type="text" id="query" class="form-control" placeholder="Enter your query"></div><div class="form-group"><label for="givenFacet">Given Facet:</label><input type="text" id="givenFacet" class="form-control" placeholder="Enter your facet in Python dictionary format"></div><button class="btn btn-primary" id="submitBtn">Submit</button></div></div><div class="row" id="outputSection" style="display: none;"><div class="col-md-12"><h2>Dynamic Boxes</h2><div id="facetBoxes"></div><button class="btn btn-success" id="getListBtn">Get List</button><div id="resultSection"></div></div></div></div><script src="https://code.jquery.com/jquery-3.5.1.min.js"></script><script>$(document).ready(function() {$('#submitBtn').click(function() {const query = $('#query').val();const givenFacet = $('#givenFacet').val();const outputSection = $('#outputSection');const facetBoxes = $('#facetBoxes');try {const facets = JSON.parse(givenFacet.replace(/'/g, '"'));facetBoxes.empty();$.each(facets, function(key, values) {const box = $('<div class="box"></div>');const title = $(`<div class="box-title">'${key}' <input type="checkbox" class="facet-checkbox" data-key="${key}"></div>`);box.append(title);$.each(values, function(index, value) {const valueItem = $('<div></div>').text(value);box.append(valueItem);});facetBoxes.append(box);});outputSection.show();} catch (e) {alert('Invalid JSON format');}});$('#getListBtn').click(function() {const checkboxes = $('.facet-checkbox');const selectedKeys = [];checkboxes.each(function() {if ($(this).is(':checked')) {const key = $(this).data('key');selectedKeys.push(`'${key}'`);}});const resultSection = $('#resultSection');resultSection.empty();const resultBox = $('<div class="result-box"></div>');resultBox.text(`Selected keys: [${selectedKeys.join(', ')}]`);resultSection.append(resultBox);});});</script></body></html>
index.html+115-18