From 0596bd24f2e68f15518575466ed68de421841a7d Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Sat, 25 Mar 2023 04:27:30 +0400 Subject: [PATCH] Completely dynamic word page --- bundle.js | 15 +++++++++++-- words.html | 12 +++++----- words/{არის.html => xxxxx.html} | 4 ++-- words/აქებს.html | 40 --------------------------------- words/აქვს.html | 40 --------------------------------- words/ყავს.html | 40 --------------------------------- words/ცემს.html | 40 --------------------------------- words/ხატავს.html | 40 --------------------------------- 8 files changed, 21 insertions(+), 210 deletions(-) rename words/{არის.html => xxxxx.html} (93%) delete mode 100644 words/აქებს.html delete mode 100644 words/აქვს.html delete mode 100644 words/ყავს.html delete mode 100644 words/ცემს.html delete mode 100644 words/ხატავს.html diff --git a/bundle.js b/bundle.js index 6b675bf..aff1cbc 100644 --- a/bundle.js +++ b/bundle.js @@ -1,7 +1,9 @@ $(function() { - $('#word').each(function(index, elem) { + $('#words-xxxxx').each(function() { + var word_id = Number(window.location.hash.substring(1)) + $.getJSON( - 'http://localhost:4567/words/' + $(elem).data('id'), + 'http://localhost:4567/words/' + word_id, function(data) { var primary_form = data['primary_form'] var part_of_speech = data['part_of_speech'] @@ -22,6 +24,13 @@ $(function() { data['inflections'].forEach(function(item) { var descr = item['descr'] var value = item['value'] || '' + var other_word_id = item['other_word_id'] + + if (other_word_id !== null) { + value = + '' + value + '' + } + inflections.push( '
  • ' + descr + ': ' + value + '
  • ' ) @@ -56,6 +65,8 @@ $(function() { ) }) + document.title = primary_form + $('#primary-form').text(primary_form) $('#part-of-speech').text(part_of_speech) diff --git a/words.html b/words.html index 32a4236..60c844c 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. ხატავს - рисовать

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

    diff --git a/words/არის.html b/words/xxxxx.html similarity index 93% rename from words/არის.html rename to words/xxxxx.html index 0b39d61..aa1a2e9 100644 --- a/words/არის.html +++ b/words/xxxxx.html @@ -2,11 +2,11 @@ - არის + -
    +

    diff --git a/words/აქებს.html b/words/აქებს.html deleted file mode 100644 index 359da27..0000000 --- a/words/აქებს.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - აქებს - - - -
    - -

    -

    - - - - - - - - - - - - - diff --git a/words/აქვს.html b/words/აქვს.html deleted file mode 100644 index 3ae8f59..0000000 --- a/words/აქვს.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - აქვს - - - -
    - -

    -

    - - - - - - - - - - - - - diff --git a/words/ყავს.html b/words/ყავს.html deleted file mode 100644 index 1ea5eb1..0000000 --- a/words/ყავს.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - ყავს - - - -
    - -

    -

    - - - - - - - - - - - - - diff --git a/words/ცემს.html b/words/ცემს.html deleted file mode 100644 index f9ea473..0000000 --- a/words/ცემს.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - ცემს - - - -
    - -

    -

    - - - - - - - - - - - - - diff --git a/words/ხატავს.html b/words/ხატავს.html deleted file mode 100644 index 7f3c84e..0000000 --- a/words/ხატავს.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - ხატავს - - - -
    - -

    -

    - - - - - - - - - - - - -