@@ -8,58 +8,32 @@ $(document).ready(function() {
8
8
} ) ;
9
9
} ) ;
10
10
11
- function getNextRow ( $row ) {
11
+ function get_next_row ( $row ) {
12
12
$row = $row . next ( )
13
13
if ( $row . find ( "button.btn-verify[data-verified=0]" ) . size ( ) > 0 ) {
14
14
console . log ( $row . find ( "button.btn-verify[data-verified=0]" ) . size ( ) )
15
15
return $row
16
16
}
17
- return getNextRow ( $row )
17
+ return get_next_row ( $row )
18
18
}
19
19
20
- function getNextTranslation ( $currentElement ) {
21
- $row = getNextRow ( $currentElement . closest ( '.row' ) )
20
+ function get_next_translation ( $currentElement ) {
21
+ $row = get_next_row ( $currentElement . closest ( '.row' ) )
22
22
return $row . find ( '.translated' )
23
23
}
24
24
25
- function getParameterByName ( name ) {
25
+ function get_parameter_by_name ( name ) {
26
26
name = name . replace ( / [ \[ ] / , "\\[" ) . replace ( / [ \] ] / , "\\]" ) ;
27
27
var regex = new RegExp ( "[\\?&]" + name + "=([^&#]*)" ) ,
28
28
results = regex . exec ( location . search ) ;
29
29
return results === null ? "" : decodeURIComponent ( results [ 1 ] . replace ( / \+ / g, " " ) ) ;
30
30
}
31
31
32
- frappe . ready ( function ( ) {
33
- if ( location . pathname == "/translator/view" ) {
34
- $ ( ".page-header h2" ) . html ( "Translate " + window . language_name ) ;
35
- document . title = "Translate " + window . language_name ;
36
- $ ( "[data-char='" + ( get_url_arg ( "c" ) || "*" ) + "']" ) . addClass ( "active" ) ;
37
- }
38
-
39
- $ ( ".message-ts" ) . each ( function ( ) {
40
- var ts = $ ( this ) . attr ( "data-timestamp" ) ;
41
- $ ( this ) . html ( "Last Updated: "
42
- + ( comment_when ( ts ) || ts ) ) ;
43
- } ) ;
44
-
45
- $ ( "input#search-box" ) . keyup ( function ( event ) {
46
- if ( event . keyCode == 13 ) {
47
- search_param = $ ( this ) . val ( )
48
- lang = getParameterByName ( 'lang' )
49
- if ( search_param && lang ) {
50
- window . location = "/translator/view?lang=" + lang + "&search=" + search_param
51
- }
52
- }
53
- } ) ;
54
-
55
- } ) ;
56
-
57
-
58
32
var translator = {
59
33
next : function ( $next ) {
60
34
var $txt = $ ( ".edit-value" )
61
35
if ( ! $next ) {
62
- $next = getNextTranslation ( $txt )
36
+ $next = get_next_translation ( $txt )
63
37
}
64
38
$next . trigger ( 'click' )
65
39
} ,
@@ -94,7 +68,7 @@ var translator = {
94
68
} ,
95
69
callback : function ( data ) {
96
70
if ( ! data . exc ) {
97
- $next = getNextTranslation ( $txt )
71
+ $next = get_next_translation ( $txt )
98
72
$txt . parent ( ) . removeClass ( "active" ) . html ( val ) ;
99
73
translator . next ( $next )
100
74
}
@@ -128,7 +102,7 @@ var translator = {
128
102
$cancel = $ ( '<button class="btn btn-default btn-small">Next</button>' )
129
103
. appendTo ( $p )
130
104
. on ( "click" , function ( e ) {
131
- $next = getNextTranslation ( $txt )
105
+ $next = get_next_translation ( $txt )
132
106
translator . next ( )
133
107
translator . next ( $next )
134
108
} ) ;
0 commit comments