first commit

This commit is contained in:
s2
2024-12-13 08:53:01 +01:00
commit 2746dc9c4e
5477 changed files with 682458 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
<ul>
<% for (var i=0; i<texts.length; i++) { %>
<li data-id="<%= texts[i].id %>" class="js-link"><%= texts[i].description %></li>
<% } %>
</ul>

36
app/text/text.js Normal file
View File

@@ -0,0 +1,36 @@
(function() {
// globals
MyApp.Text = {};
// utility functions
// app functions
MyApp.Text.renderTextPage = function() {
$('.js-page-container').html(ejs.rr('/app/text/templates/sometext.ejs', {
texts: [
{
id: 100,
description: 'Some text with id 100'
},
{
id: 200,
description: 'Some other text with id 200. Click it!'
}
]
}));
};
// events
$(document).on('click', '.js-link', function(ev) {
var el = $(ev.currentTarget);
var linkId = el.attr('data-id');
new Noty({
type: 'success',
text: 'The text you clicked had id ' + linkId + '. Maybe next time I will do something with this id.',
timeout: 5000
}).show();
});
// app startup
page('/text', MyApp.Text.renderTextPage);
})();