diff --git a/words/xxxxx.html b/app.html similarity index 82% rename from words/xxxxx.html rename to app.html index 1773c6a..7f60c53 100644 --- a/words/xxxxx.html +++ b/app.html @@ -6,12 +6,12 @@ -
+
- + diff --git a/bundle.js b/bundle.js index 011a810..d69ba60 100644 --- a/bundle.js +++ b/bundle.js @@ -7,16 +7,26 @@ window.leqsikoni = { } }, - words_xxxxx: function() { - window.leqsikoni.words_xxxxx_template() + app: function() { + if ($('#app').length === 0) return; - var word_id = Number(window.location.hash.substring(1)) + var path = String(window.location.hash).substring(1) + + var match = null + + if ((match = /^\/words\/(\d+)$/.exec(path))) { + window.leqsikoni.words_xxxxx(Number(match[1])) + } + }, + + words_xxxxx: function(word_id) { + window.leqsikoni.words_xxxxx_template() $.getJSON( 'http://localhost:4567/words/' + word_id, function(data) { document.title = window.leqsikoni.maybe_text(data.primary_form) || '' - $('#words-xxxxx').html(window.leqsikoni.words_xxxxx_template(data)) + $('#app').html(window.leqsikoni.words_xxxxx_template(data)) }, ) }, @@ -103,7 +113,7 @@ window.leqsikoni = { if (other_word_id !== null) { value = - '' + value + '' + '' + value + '' } items_html.push( @@ -164,6 +174,6 @@ window.leqsikoni = { } $(function() { - $('#words-xxxxx').each(window.leqsikoni.words_xxxxx) - window.addEventListener('hashchange', window.leqsikoni.words_xxxxx, false) + window.addEventListener('hashchange', window.leqsikoni.app, false) + window.leqsikoni.app() }) diff --git a/words.html b/words.html index 60c844c..199fcd5 100644 --- a/words.html +++ b/words.html @@ -10,12 +10,12 @@

Глаголы

    -
  1. არის - быть
  2. -
  3. აქვს - иметь (неодушевлённое)
  4. -
  5. ყავს - иметь (одушевлённое)
  6. -
  7. აქებს - хвалить
  8. -
  9. ცემს - бить
  10. -
  11. ხატავს - рисовать
  12. +
  13. არის - быть
  14. +
  15. აქვს - иметь (неодушевлённое)
  16. +
  17. ყავს - иметь (одушевлённое)
  18. +
  19. აქებს - хвалить
  20. +
  21. ცემს - бить
  22. +
  23. ხატავს - рисовать

Существительные