Download pool/shard006/JavaScript/0037687_index.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 1.42 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard006/JavaScript/0037687_index.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard006/JavaScript/0037687_index.js
-
curl -L -o 0037687_index.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard006/JavaScript/0037687_index.js
1.42 kB
| // We use an "Immediate Function" to initialize the application to avoid leaving anything behind in the global scope | |
| (function() { | |
| /* ---------------------------------- Local Variables ---------------------------------- */ | |
| var adapter = new JSONPAdapterFHNW(); | |
| adapter.initialize().done(function() { | |
| renderHomeView(); | |
| }); | |
| /* --------------------------------- Event Registration -------------------------------- */ | |
| document.addEventListener('deviceready', function() { | |
| FastClick.attach(document.body); | |
| }, false); | |
| /* ---------------------------------- Local Functions ---------------------------------- */ | |
| function findByName() { | |
| adapter.findByName($('.search-key').val()).done(function(employees) { | |
| var l = employees.length; | |
| var e; | |
| $('.employee-list').empty(); | |
| for (var i = 0; i < l; i++) { | |
| e = employees[i]; | |
| $('.employee-list').append('<li><a href="#employees/' + e.id + '">' + e.firstName + ' ' + e.lastName + '</a></li>'); | |
| } | |
| }); | |
| } | |
| function renderHomeView() { | |
| var html = | |
| "<h1>Directory</h1>" + | |
| "<input class='search-key' type='search' placeholder='Enter name'/>" + | |
| "<ul class='employee-list'></ul>"; | |
| $('body').html(html); | |
| $('.search-key').on('keyup', findByName); | |
| } | |
| }()); |