autotolk 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aacdfc88653cd3aefdc2a7579ae07e0c963dd634
4
- data.tar.gz: cc6c387a087178af7dbec505323982563144df4a
3
+ metadata.gz: 05a89151960c946d0ee91034a75dee13bb1472c4
4
+ data.tar.gz: 15a5d1460cf1daf8267085ee324cfc3b80d4c82a
5
5
  SHA512:
6
- metadata.gz: 64844424b966835cb9d518bcb7ca66939443a98f8336a3a88b9da9620056e4d71d61f8b41eece362c4b2cc517d7f3cff7ac68c4b899b016714ff65a2a312db43
7
- data.tar.gz: f4660d4ffddc01349bdef1659c67a66219722181106954794fe9ccadbaa706791b6169aea3f5f638f31f827fd0a7b49b63abc04948259aa938720efba08d91fc
6
+ metadata.gz: 891d279c77b0caa274e1bb1b83d46496c98f40fd1c56e6d24ac67bf95132b10155db39818b42212a40126abfeee0848d478dcc3d3987b0dc520b01d711147194
7
+ data.tar.gz: b6920d50b0fc6e90b8cd592607d7d049bb59e141be8e8a5314af9e0acead1e8030de12050e25f68357ea153edc82f60d4347da2f3da8c8d28e568fa18781f384
@@ -1,20 +1,19 @@
1
1
  $(document).on 'ready page:load', ->
2
- if document.URL.includes("tolk/locales")
3
- alert "Double click anywhere to start autotranslating."
4
- autotranslatingClicked = 0
5
- $('#container').dblclick ->
6
- autotranslatingClicked += 1
7
- to_lang = document.URL.split('/').slice(-1).pop()
8
- $translation_rows = $('table.translations tbody tr:not(:first-child)')
9
- for $translation_row in $translation_rows
10
- original = $translation_row.querySelector('td.original textarea#translations__original_text').innerText
11
- $translationArea = $translation_row.querySelector('td.translation textarea')
12
- if $translationArea.innerText == '' && autotranslatingClicked == 1
13
- translate(original, to_lang, $translationArea)
2
+ $( "#container div.translations" ).prepend( "<div style='text-align: right;'><button onclick='startTranslating()'> Start autotranslating!</button></div>" )
3
+ autotranslatingClicked = 0
4
+
5
+ startTranslating = ->
6
+ autotranslatingClicked += 1
7
+ to_lang = document.URL.split('/').slice(-1).pop()
8
+ $translation_rows = $('table.translations tbody tr:not(:first-child)')
9
+ for $translation_row in $translation_rows
10
+ original = $translation_row.querySelector('td.original textarea#translations__original_text').innerText
11
+ $translationArea = $translation_row.querySelector('td.translation textarea')
12
+ if $translationArea.innerText == '' && autotranslatingClicked == 1
13
+ translate(original, to_lang, $translationArea)
14
14
 
15
15
  translate = (original, to, textarea) ->
16
16
  $.get '/translate', {original: original, to: to}, ((response) ->
17
- alert 'udalo sie'
18
17
  if response.status == 200
19
18
  textarea.innerText = response.translated
20
19
  ), 'json'
@@ -1,3 +1,3 @@
1
1
  module Autotolk
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autotolk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joanna Rajewska