Version Description
Download this release
Release Info
Developer | rm2773 |
Plugin | Google Language Translator |
Version | 5.0.27 |
Comparing to | |
See all releases |
Code changes from version 5.0.26 to 5.0.27
- css/toolbar.css +169 -170
- google-language-translator.php +28 -12
- js/admin.js +16 -0
- js/{flags.js → load-flags.js} +3 -1
- js/load-sortable-flags.js +0 -17
- js/load-toolbar.js +318 -23
- js/toolbar.js +0 -242
- readme.txt +5 -1
css/toolbar.css
CHANGED
@@ -1,170 +1,169 @@
|
|
1 |
-
#glt-toolbar { display:none; }
|
2 |
-
#glt-translate-trigger {
|
3 |
-
position:fixed;
|
4 |
-
bottom:0px;
|
5 |
-
top:auto;
|
6 |
-
right: 20px;
|
7 |
-
z-index:200002;
|
8 |
-
padding:6px 20px 3px;
|
9 |
-
font-size:16px;
|
10 |
-
font-family:Arial;
|
11 |
-
font-weight:700;
|
12 |
-
color:#fff;
|
13 |
-
text-shadow:0px -1px 0px rgba(0,0,0,0.25);
|
14 |
-
text-decoration:none;
|
15 |
-
text-align:center;
|
16 |
-
border-top-left-radius:5px;
|
17 |
-
border-top-right-radius:5px;
|
18 |
-
-webkit-border-top-left-radius:5px;
|
19 |
-
-webkit-border-top-right-radius:5px;
|
20 |
-
-moz-border-top-left-radius:5px;
|
21 |
-
-moz-border-top-right-radius:5px;
|
22 |
-
box-shadow:0px 0px 9px rgba(0,0,0,0.3)
|
23 |
-
|
24 |
-
|
25 |
-
box-sizing:content-box !important;
|
26 |
-
-webkit-box-sizing:content-box !important;
|
27 |
-
-moz-box-sizing:content-box !important;
|
28 |
-
background:linear-gradient(center top, #fbb450, #f89406);
|
29 |
-
background: -webkit-gradient(linear, center top, center bottom, from(#fbb450), to(#f89406));
|
30 |
-
background: -webkit-linear-gradient(#fbb450, #f89406);
|
31 |
-
background: -moz-linear-gradient(#fbb450, #f89406);
|
32 |
-
background: -o-linear-gradient(#fbb450, #f89406);
|
33 |
-
background: -ms-linear-gradient(#fbb450, #f89406);
|
34 |
-
background: linear-gradient(#fbb450, #f89406);
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
background-color
|
41 |
-
background: -
|
42 |
-
background: -
|
43 |
-
background:
|
44 |
-
background:
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
border-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
border-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
background: #a79f9f;
|
96 |
-
background: -
|
97 |
-
background: -
|
98 |
-
background:
|
99 |
-
background:
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
border-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
border-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
border-bottom-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
border-top-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
border-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
}
|
1 |
+
#glt-toolbar { display:none; }
|
2 |
+
#glt-translate-trigger {
|
3 |
+
position:fixed;
|
4 |
+
bottom:0px;
|
5 |
+
top:auto;
|
6 |
+
right: 20px;
|
7 |
+
z-index:200002;
|
8 |
+
padding:6px 20px 3px;
|
9 |
+
font-size:16px;
|
10 |
+
font-family:Arial;
|
11 |
+
font-weight:700;
|
12 |
+
color:#fff;
|
13 |
+
text-shadow:0px -1px 0px rgba(0,0,0,0.25);
|
14 |
+
text-decoration:none;
|
15 |
+
text-align:center;
|
16 |
+
border-top-left-radius:5px;
|
17 |
+
border-top-right-radius:5px;
|
18 |
+
-webkit-border-top-left-radius:5px;
|
19 |
+
-webkit-border-top-right-radius:5px;
|
20 |
+
-moz-border-top-left-radius:5px;
|
21 |
+
-moz-border-top-right-radius:5px;
|
22 |
+
box-shadow:0px 0px 9px rgba(0,0,0,0.3)
|
23 |
+
-webkit-box-shadow:0px 0px 9px rgba(0,0,0,0.3);
|
24 |
+
-moz-box-shadow:0px 0px 9px rgba(0,0,0,0.3);
|
25 |
+
box-sizing:content-box !important;
|
26 |
+
-webkit-box-sizing:content-box !important;
|
27 |
+
-moz-box-sizing:content-box !important;
|
28 |
+
background:linear-gradient(center top, #fbb450, #f89406);
|
29 |
+
background: -webkit-gradient(linear, center top, center bottom, from(#fbb450), to(#f89406));
|
30 |
+
background: -webkit-linear-gradient(#fbb450, #f89406);
|
31 |
+
background: -moz-linear-gradient(#fbb450, #f89406);
|
32 |
+
background: -o-linear-gradient(#fbb450, #f89406);
|
33 |
+
background: -ms-linear-gradient(#fbb450, #f89406);
|
34 |
+
background: linear-gradient(#fbb450, #f89406);
|
35 |
+
background: -o-linear-gradientcenter (center top, #fbb450, #f89406); /* For Opera 11.1 to 12.0 */
|
36 |
+
}
|
37 |
+
|
38 |
+
.tool-container {
|
39 |
+
background-color: #d0cbcb;
|
40 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(14%, #d0cbcb), color-stop(100%, #e9e5e5));
|
41 |
+
background: -moz-linear-gradient(top, #d0cbcb 14%, #e9e5e5 100%);
|
42 |
+
background: -ms-linear-gradient(top, #d0cbcb 14%,#e9e5e5 100%);
|
43 |
+
background: linear-gradient(to bottom, #d0cbcb 14%,#e9e5e5 100%);
|
44 |
+
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIxNCUiIHN0b3AtY29sb3I9IiNkMGNiY2IiIHN0b3Atb3BhY2l0eT0iMSIvPgogICAgPHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjZTllNWU1IiBzdG9wLW9wYWNpdHk9IjEiLz4KICA8L2xpbmVhckdyYWRpZW50PgogIDxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9InVybCgjZ3JhZC11Y2dnLWdlbmVyYXRlZCkiIC8+Cjwvc3ZnPg==);
|
45 |
+
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d0cbcb', endColorstr='#e9e5e5',GradientType=0 );
|
46 |
+
background-size: 100% 100%;
|
47 |
+
border-radius: 3px;
|
48 |
+
box-shadow: 0px 0px 15px #000;
|
49 |
+
position: absolute;
|
50 |
+
}
|
51 |
+
|
52 |
+
.tool-container.tool-top, .tool-container.tool-bottom {
|
53 |
+
border-bottom: 1px solid #beb8b8 ; /* #B1A9A9 */
|
54 |
+
}
|
55 |
+
|
56 |
+
.tool-items {
|
57 |
+
height: 100%;
|
58 |
+
}
|
59 |
+
|
60 |
+
.tool-top .tool-item, .tool-bottom .tool-item {
|
61 |
+
float: left;
|
62 |
+
/*border-right: 1px solid #e2dfdf;
|
63 |
+
border-left: 1px solid #9f9898;*/
|
64 |
+
}
|
65 |
+
|
66 |
+
.tool-left .tool-item, .tool-right .tool-item {
|
67 |
+
height: 34px;
|
68 |
+
border-top: 1px solid #e2dfdf;
|
69 |
+
border-bottom: 1px solid #9f9898;
|
70 |
+
}
|
71 |
+
|
72 |
+
|
73 |
+
.tool-item {
|
74 |
+
height: 100%;
|
75 |
+
display: block;
|
76 |
+
width: 34px;
|
77 |
+
text-align: center;
|
78 |
+
}
|
79 |
+
|
80 |
+
.tool-item:first-child {
|
81 |
+
border-left: none;
|
82 |
+
}
|
83 |
+
|
84 |
+
.tool-left .tool-item:first-child, .tool-right .tool-item:first-child {
|
85 |
+
border-top: 1px solid transparent;
|
86 |
+
}
|
87 |
+
|
88 |
+
.tool-item:last-child {
|
89 |
+
border-right: none;
|
90 |
+
border-bottom: none;
|
91 |
+
}
|
92 |
+
|
93 |
+
.tool-item.selected, .tool-item:hover {
|
94 |
+
background: #a79f9f;
|
95 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #a79f9f), color-stop(93%, #e2dfdf));
|
96 |
+
background: -moz-linear-gradient(top, #a79f9f 0%, #e2dfdf 93%);
|
97 |
+
background: -ms-linear-gradient(top, #a79f9f 0%, #e2dfdf 93%);
|
98 |
+
background: linear-gradient(to bottom, #a79f9f 0%, #e2dfdf 93%);
|
99 |
+
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2E3OWY5ZiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjkzJSIgc3RvcC1jb2xvcj0iI2UyZGZkZiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);
|
100 |
+
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a79f9f', endColorstr='#e2dfdf',GradientType=0 );
|
101 |
+
}
|
102 |
+
|
103 |
+
.tool-top .tool-item:last-child:hover, .tool-bottom .tool-item:last-child:hover {
|
104 |
+
border-top-right-radius: 4px;
|
105 |
+
border-bottom-right-radius: 4px;
|
106 |
+
}
|
107 |
+
|
108 |
+
.tool-top .tool-item:first-child:hover, .tool-bottom .tool-item:first-child:hover {
|
109 |
+
border-top-left-radius: 4px;
|
110 |
+
border-bottom-left-radius: 4px;
|
111 |
+
}
|
112 |
+
|
113 |
+
.tool-left .tool-item:last-child:hover, .tool-right .tool-item:last-child:hover {
|
114 |
+
border-bottom-right-radius: 4px;
|
115 |
+
border-bottom-left-radius: 4px;
|
116 |
+
}
|
117 |
+
|
118 |
+
.tool-left .tool-item:first-child:hover, .tool-right .tool-item:first-child:hover {
|
119 |
+
border-top-right-radius: 4px;
|
120 |
+
border-top-left-radius: 4px;
|
121 |
+
}
|
122 |
+
|
123 |
+
.tool-container .arrow {
|
124 |
+
width:0;
|
125 |
+
height:0;
|
126 |
+
position: absolute;
|
127 |
+
border-width:7px;
|
128 |
+
border-style:solid;
|
129 |
+
}
|
130 |
+
|
131 |
+
.tool-container.tool-top .arrow {
|
132 |
+
border-color: #e9e5e5 transparent transparent;
|
133 |
+
left: 50%;
|
134 |
+
bottom: -14px;
|
135 |
+
margin-left: -7px;
|
136 |
+
}
|
137 |
+
|
138 |
+
.tool-container.tool-bottom .arrow {
|
139 |
+
border-color: transparent transparent #e9e5e5;
|
140 |
+
left: 50%;
|
141 |
+
top: -14px;
|
142 |
+
margin-left: -7px;
|
143 |
+
}
|
144 |
+
|
145 |
+
.tool-container.tool-left .arrow {
|
146 |
+
border-color: transparent transparent transparent #E9E5E5;
|
147 |
+
top: 50%;
|
148 |
+
right: -14px;
|
149 |
+
margin-top: -7px;
|
150 |
+
}
|
151 |
+
|
152 |
+
.tool-container.tool-right .arrow {
|
153 |
+
border-color: transparent #E9E5E5 transparent transparent;
|
154 |
+
top: 50%;
|
155 |
+
left: -14px;
|
156 |
+
margin-top: -7px;
|
157 |
+
}
|
158 |
+
|
159 |
+
.demo-link {
|
160 |
+
color: #89CDE4;
|
161 |
+
text-decoration: underline;
|
162 |
+
cursor: pointer;
|
163 |
+
margin-left: 30px;
|
164 |
+
}
|
165 |
+
|
166 |
+
.demo-link:hover {
|
167 |
+
text-decoration: none;
|
168 |
+
cursor: pointer;
|
169 |
+
}
|
|
google-language-translator.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Google Language Translator
|
4 |
Plugin URI: http://www.studio88design.com/plugins/google-language-translator
|
5 |
-
Version: 5.0.
|
6 |
Description: The MOST SIMPLE Google Translator plugin. This plugin adds Google Translator to your website by using a single shortcode, [google-translator]. Settings include: layout style, hide/show specific languages, hide/show Google toolbar, and hide/show Google branding. Add the shortcode to pages, posts, and widgets.
|
7 |
Author: Rob Myrick
|
8 |
Author URI: http://www.wp-studio.net/
|
@@ -164,6 +164,7 @@ class google_language_translator {
|
|
164 |
add_option('googlelanguagetranslator_spanish_flag_choice','');
|
165 |
add_option('googlelanguagetranslator_portuguese_flag_choice','');
|
166 |
add_option('googlelanguagetranslator_floating_widget_text', 'Translate »');
|
|
|
167 |
delete_option('googlelanguagetranslator_manage_translations',0);
|
168 |
}
|
169 |
|
@@ -211,10 +212,8 @@ class google_language_translator {
|
|
211 |
|
212 |
public function enqueue_admin_js(){
|
213 |
wp_enqueue_script( 'my-admin-script', plugins_url('js/admin.js',__FILE__), array('jquery'));
|
214 |
-
wp_enqueue_script( 'my-flag-script', plugins_url('js/flags.js',__FILE__), array('jquery'));
|
215 |
|
216 |
if (get_option ('googlelanguagetranslator_floating_widget') == 'yes') {
|
217 |
-
wp_enqueue_script( 'glt-toolbar', plugins_url('js/toolbar.js',__FILE__), array('jquery'));
|
218 |
wp_enqueue_script( 'glt-load-toolbar', plugins_url('js/load-toolbar.js',__FILE__), array('jquery'));
|
219 |
wp_register_style( 'glt-toolbar-styles', plugins_url('css/toolbar.css', __FILE__) );
|
220 |
wp_enqueue_style( 'glt-toolbar-styles' );
|
@@ -222,17 +221,16 @@ class google_language_translator {
|
|
222 |
|
223 |
wp_enqueue_script( 'jquery-ui-core');
|
224 |
wp_enqueue_script( 'jquery-ui-sortable');
|
225 |
-
wp_enqueue_script( '
|
226 |
wp_register_style( 'jquery-ui.css', plugins_url('css/jquery-ui.css',__FILE__) );
|
227 |
wp_register_style( 'style.css', plugins_url('css/style.css', __FILE__) );
|
228 |
wp_enqueue_style( 'style.css' );
|
229 |
}
|
230 |
|
231 |
public function flags() {
|
232 |
-
wp_enqueue_script( 'glt-flags', plugins_url('js/flags.js',__FILE__), array('jquery'));
|
233 |
|
234 |
if (get_option ('googlelanguagetranslator_floating_widget') == 'yes') {
|
235 |
-
wp_enqueue_script( 'glt-toolbar', plugins_url('js/toolbar.js',__FILE__), array('jquery'));
|
236 |
wp_enqueue_script( 'glt-load-toolbar', plugins_url('js/load-toolbar.js',__FILE__), array('jquery'));
|
237 |
wp_register_style( 'glt-toolbar-styles', plugins_url('css/toolbar.css', __FILE__) );
|
238 |
wp_enqueue_style( 'glt-toolbar-styles' );
|
@@ -330,10 +328,11 @@ class google_language_translator {
|
|
330 |
$get_flag_choices_count = count($get_flag_choices);
|
331 |
$floating_widget = get_option ('googlelanguagetranslator_floating_widget');
|
332 |
$floating_widget_text = get_option ('googlelanguagetranslator_floating_widget_text');
|
|
|
333 |
$is_active = get_option ( 'googlelanguagetranslator_active' );
|
334 |
$is_multilanguage = get_option('googlelanguagetranslator_multilanguage');
|
335 |
$str = ''; ?>
|
336 |
-
<script>jQuery(document).ready(function($) {
|
337 |
|
338 |
<?php
|
339 |
|
@@ -342,7 +341,7 @@ class google_language_translator {
|
|
342 |
foreach ($get_flag_choices as $flag_choice_key) {}
|
343 |
|
344 |
if ($floating_widget=='yes' && $get_language_option != 'specific') {
|
345 |
-
$str.='<div id="glt-translate-trigger"><span>'.(empty($floating_widget_text) ? 'Translate »' : $floating_widget_text).'</span></div>';
|
346 |
$str.='<div id="glt-toolbar"></div>';
|
347 |
} //endif $floating_widget
|
348 |
|
@@ -605,10 +604,7 @@ class google_language_translator {
|
|
605 |
add_settings_section('glt_settings','Settings','','google_language_translator');
|
606 |
|
607 |
$settings_name_array = array (
|
608 |
-
'googlelanguagetranslator_active','googlelanguagetranslator_language','googlelanguagetranslator_language_option','language_display_settings','googlelanguagetranslator_flags','flag_display_settings','googlelanguagetranslator_translatebox','googlelanguagetranslator_display','googlelanguagetranslator_toolbar','googlelanguagetranslator_showbranding','googlelanguagetranslator_flags_alignment','googlelanguagetranslator_analytics','googlelanguagetranslator_analytics_id','googlelanguagetranslator_css','googlelanguagetranslator_multilanguage','googlelanguagetranslator_floating_widget','googlelanguagetranslator_flag_size','googlelanguagetranslator_flags_order','googlelanguagetranslator_english_flag_choice','googlelanguagetranslator_spanish_flag_choice','googlelanguagetranslator_portuguese_flag_choice','googlelanguagetranslator_floating_widget_text'
|
609 |
-
);
|
610 |
-
|
611 |
-
$settings_callback_array = array ( 'googlelanguagetranslator_active_cb','googlelanguagetranslator_language_cb','googlelanguagetranslator_language_option_cb','language_display_settings_cb','googlelanguagetranslator_flags_cb','flag_display_settings_cb','googlelanguagetranslator_translatebox_cb','googlelanguagetranslator_display_cb','googlelanguagetranslator_toolbar_cb','googlelanguagetranslator_showbranding_cb','googlelanguagetranslator_flags_alignment_cb','googlelanguagetranslator_analytics_cb','googlelanguagetranslator_analytics_id_cb','googlelanguagetranslator_css_cb','googlelanguagetranslator_multilanguage_cb','googlelanguagetranslator_floating_widget_cb','googlelanguagetranslator_flag_size_cb','googlelanguagetranslator_flags_order_cb','googlelanguagetranslator_english_flag_choice_cb','googlelanguagetranslator_spanish_flag_choice_cb','googlelanguagetranslator_portuguese_flag_choice_cb','googlelanguagetranslator_floating_widget_text_cb'
|
612 |
);
|
613 |
|
614 |
foreach ($settings_name_array as $setting) {
|
@@ -805,6 +801,21 @@ class google_language_translator {
|
|
805 |
|
806 |
<?php }
|
807 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
808 |
public function googlelanguagetranslator_translatebox_cb() {
|
809 |
|
810 |
$option_name = 'googlelanguagetranslator_translatebox' ;
|
@@ -1161,6 +1172,11 @@ $('.choose_flags').find('input:checkbox').prop('checked', false); }); });</scrip
|
|
1161 |
<td><?php $this->googlelanguagetranslator_floating_widget_text_cb(); ?></td>
|
1162 |
</tr>
|
1163 |
|
|
|
|
|
|
|
|
|
|
|
1164 |
<tr class="notranslate">
|
1165 |
<td>Show or hide the langauge switcher?</td>
|
1166 |
<td><?php $this->googlelanguagetranslator_translatebox_cb(); ?></td>
|
2 |
/*
|
3 |
Plugin Name: Google Language Translator
|
4 |
Plugin URI: http://www.studio88design.com/plugins/google-language-translator
|
5 |
+
Version: 5.0.27
|
6 |
Description: The MOST SIMPLE Google Translator plugin. This plugin adds Google Translator to your website by using a single shortcode, [google-translator]. Settings include: layout style, hide/show specific languages, hide/show Google toolbar, and hide/show Google branding. Add the shortcode to pages, posts, and widgets.
|
7 |
Author: Rob Myrick
|
8 |
Author URI: http://www.wp-studio.net/
|
164 |
add_option('googlelanguagetranslator_spanish_flag_choice','');
|
165 |
add_option('googlelanguagetranslator_portuguese_flag_choice','');
|
166 |
add_option('googlelanguagetranslator_floating_widget_text', 'Translate »');
|
167 |
+
add_option('googlelanguagetranslator_floating_widget_text_allow_translation', 0);
|
168 |
delete_option('googlelanguagetranslator_manage_translations',0);
|
169 |
}
|
170 |
|
212 |
|
213 |
public function enqueue_admin_js(){
|
214 |
wp_enqueue_script( 'my-admin-script', plugins_url('js/admin.js',__FILE__), array('jquery'));
|
|
|
215 |
|
216 |
if (get_option ('googlelanguagetranslator_floating_widget') == 'yes') {
|
|
|
217 |
wp_enqueue_script( 'glt-load-toolbar', plugins_url('js/load-toolbar.js',__FILE__), array('jquery'));
|
218 |
wp_register_style( 'glt-toolbar-styles', plugins_url('css/toolbar.css', __FILE__) );
|
219 |
wp_enqueue_style( 'glt-toolbar-styles' );
|
221 |
|
222 |
wp_enqueue_script( 'jquery-ui-core');
|
223 |
wp_enqueue_script( 'jquery-ui-sortable');
|
224 |
+
wp_enqueue_script( 'load_flags', plugins_url('js/load-flags.js',__FILE__), array('jquery'));
|
225 |
wp_register_style( 'jquery-ui.css', plugins_url('css/jquery-ui.css',__FILE__) );
|
226 |
wp_register_style( 'style.css', plugins_url('css/style.css', __FILE__) );
|
227 |
wp_enqueue_style( 'style.css' );
|
228 |
}
|
229 |
|
230 |
public function flags() {
|
231 |
+
wp_enqueue_script( 'glt-flags', plugins_url('js/load-flags.js',__FILE__), array('jquery'));
|
232 |
|
233 |
if (get_option ('googlelanguagetranslator_floating_widget') == 'yes') {
|
|
|
234 |
wp_enqueue_script( 'glt-load-toolbar', plugins_url('js/load-toolbar.js',__FILE__), array('jquery'));
|
235 |
wp_register_style( 'glt-toolbar-styles', plugins_url('css/toolbar.css', __FILE__) );
|
236 |
wp_enqueue_style( 'glt-toolbar-styles' );
|
328 |
$get_flag_choices_count = count($get_flag_choices);
|
329 |
$floating_widget = get_option ('googlelanguagetranslator_floating_widget');
|
330 |
$floating_widget_text = get_option ('googlelanguagetranslator_floating_widget_text');
|
331 |
+
$floating_widget_text_translation_allowed = get_option ('googlelanguagetranslator_floating_widget_text_allow_translation');
|
332 |
$is_active = get_option ( 'googlelanguagetranslator_active' );
|
333 |
$is_multilanguage = get_option('googlelanguagetranslator_multilanguage');
|
334 |
$str = ''; ?>
|
335 |
+
<script>jQuery(document).ready(function($) { $('#flags a, a.single-language, .tool-items a').each(function() { $(this).attr('data-lang', $(this).attr('title')); }); $("a.flag").on("click",function(){function l(){doGoogleLanguageTranslator(default_lang+"|"+default_lang); }function n(){doGoogleLanguageTranslator(default_lang+"|"+lang_prefix); } lang_text=$(this).attr('data-lang'),default_lang="<?php echo get_option('googlelanguagetranslator_language'); ?>",lang_prefix=$(this).attr("class").split(" ")[2],$(".tool-container").hide(),lang_prefix==default_lang?l():n()}),0==$("body > #google_language_translator").length&&$("#glt-footer").html("<div id='google_language_translator'></div>")});</script>
|
336 |
|
337 |
<?php
|
338 |
|
341 |
foreach ($get_flag_choices as $flag_choice_key) {}
|
342 |
|
343 |
if ($floating_widget=='yes' && $get_language_option != 'specific') {
|
344 |
+
$str.='<div id="glt-translate-trigger"><span'.($floating_widget_text_translation_allowed != 1 ? ' class="notranslate"' : ' class="translate"').'>'.(empty($floating_widget_text) ? 'Translate »' : $floating_widget_text).'</span></div>';
|
345 |
$str.='<div id="glt-toolbar"></div>';
|
346 |
} //endif $floating_widget
|
347 |
|
604 |
add_settings_section('glt_settings','Settings','','google_language_translator');
|
605 |
|
606 |
$settings_name_array = array (
|
607 |
+
'googlelanguagetranslator_active','googlelanguagetranslator_language','googlelanguagetranslator_language_option','language_display_settings','googlelanguagetranslator_flags','flag_display_settings','googlelanguagetranslator_translatebox','googlelanguagetranslator_display','googlelanguagetranslator_toolbar','googlelanguagetranslator_showbranding','googlelanguagetranslator_flags_alignment','googlelanguagetranslator_analytics','googlelanguagetranslator_analytics_id','googlelanguagetranslator_css','googlelanguagetranslator_multilanguage','googlelanguagetranslator_floating_widget','googlelanguagetranslator_flag_size','googlelanguagetranslator_flags_order','googlelanguagetranslator_english_flag_choice','googlelanguagetranslator_spanish_flag_choice','googlelanguagetranslator_portuguese_flag_choice','googlelanguagetranslator_floating_widget_text','googlelanguagetranslator_floating_widget_text_allow_translation'
|
|
|
|
|
|
|
608 |
);
|
609 |
|
610 |
foreach ($settings_name_array as $setting) {
|
801 |
|
802 |
<?php }
|
803 |
|
804 |
+
public function googlelanguagetranslator_floating_widget_text_allow_translation_cb() {
|
805 |
+
$option_name = 'googlelanguagetranslator_floating_widget_text_allow_translation' ;
|
806 |
+
$new_value = 0;
|
807 |
+
|
808 |
+
if ( get_option( $option_name ) === false ) {
|
809 |
+
// The option does not exist, so we update it.
|
810 |
+
update_option( $option_name, $new_value );
|
811 |
+
}
|
812 |
+
|
813 |
+
$options = get_option (''.$option_name.'');
|
814 |
+
|
815 |
+
$html = '<input type="checkbox" name="googlelanguagetranslator_floating_widget_text_allow_translation" id="googlelanguagetranslator_floating_widget_text_allow_translation" value="1" '.checked(1,$options,false).'/> Check to allow';
|
816 |
+
echo $html;
|
817 |
+
}
|
818 |
+
|
819 |
public function googlelanguagetranslator_translatebox_cb() {
|
820 |
|
821 |
$option_name = 'googlelanguagetranslator_translatebox' ;
|
1172 |
<td><?php $this->googlelanguagetranslator_floating_widget_text_cb(); ?></td>
|
1173 |
</tr>
|
1174 |
|
1175 |
+
<tr class="floating_widget_text notranslate">
|
1176 |
+
<td>Allow floating widget text to translate?:</td>
|
1177 |
+
<td><?php $this->googlelanguagetranslator_floating_widget_text_allow_translation_cb(); ?></td>
|
1178 |
+
</tr>
|
1179 |
+
|
1180 |
<tr class="notranslate">
|
1181 |
<td>Show or hide the langauge switcher?</td>
|
1182 |
<td><?php $this->googlelanguagetranslator_translatebox_cb(); ?></td>
|
js/admin.js
CHANGED
@@ -87,5 +87,21 @@ jQuery(document).ready(function($){
|
|
87 |
$('#footer-thankyou').addClass('notranslate');
|
88 |
}); //jQuery
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
|
87 |
$('#footer-thankyou').addClass('notranslate');
|
88 |
}); //jQuery
|
89 |
|
90 |
+
jQuery(document).ready(function($) {
|
91 |
+
$("#sortable,#sortable-toolbar").sortable({
|
92 |
+
opacity: 0.7,
|
93 |
+
distance: 10,
|
94 |
+
helper: "clone",
|
95 |
+
forcePlaceholderSize:true,
|
96 |
+
update: function(event,ui) {
|
97 |
+
var newOrder = $(this).sortable('toArray').toString();
|
98 |
+
$.post("options.php",{order: newOrder});
|
99 |
+
$('#order').val(newOrder);
|
100 |
+
},
|
101 |
+
});
|
102 |
+
|
103 |
+
$("#sortable,#sortable-toolbar").disableSelection();
|
104 |
+
});
|
105 |
+
|
106 |
|
107 |
|
js/{flags.js → load-flags.js}
RENAMED
@@ -55,4 +55,6 @@ function doGoogleLanguageTranslator(lang_pair) {
|
|
55 |
}
|
56 |
}
|
57 |
}
|
58 |
-
/* ]]> */
|
|
|
|
55 |
}
|
56 |
}
|
57 |
}
|
58 |
+
/* ]]> */
|
59 |
+
|
60 |
+
|
js/load-sortable-flags.js
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function($) {
|
2 |
-
$("#sortable,#sortable-toolbar").sortable({
|
3 |
-
opacity: 0.7,
|
4 |
-
distance: 10,
|
5 |
-
helper: "clone",
|
6 |
-
forcePlaceholderSize:true,
|
7 |
-
update: function(event,ui) {
|
8 |
-
var newOrder = $(this).sortable('toArray').toString();
|
9 |
-
$.post("options.php",{order: newOrder});
|
10 |
-
$('#order').val(newOrder);
|
11 |
-
},
|
12 |
-
});
|
13 |
-
|
14 |
-
$("#sortable,#sortable-toolbar").disableSelection();
|
15 |
-
});
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/load-toolbar.js
CHANGED
@@ -1,28 +1,323 @@
|
|
1 |
jQuery(document).ready(function($) {
|
2 |
-
$('#glt-translate-trigger').toolbar({
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
$('.tool-rounded').css('top','auto !important');
|
10 |
-
|
11 |
-
});
|
12 |
-
|
13 |
-
$('#glt-translate-trigger').on('toolbarHidden',function(event) {
|
14 |
-
$('.tool-rounded').css('position','absolute');
|
15 |
-
|
16 |
});
|
17 |
|
18 |
$('#glt-translate-trigger').on('toolbarItemClick',function(event) {
|
19 |
-
|
20 |
-
|
21 |
-
$(this).removeClass('pressed');
|
22 |
-
|
23 |
-
$('.tool-container').hide();
|
24 |
});
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
jQuery(document).ready(function($) {
|
2 |
+
$('#glt-translate-trigger,#glt-translate-trigger font').toolbar({
|
3 |
+
content: '#flags',
|
4 |
+
position: 'top',
|
5 |
+
hideOnClick: true,
|
6 |
+
event: 'click',
|
7 |
+
style: 'primary',
|
8 |
+
adjustment: 110
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
});
|
10 |
|
11 |
$('#glt-translate-trigger').on('toolbarItemClick',function(event) {
|
12 |
+
$(this).removeClass('pressed');
|
|
|
|
|
|
|
|
|
13 |
});
|
14 |
+
|
15 |
+
});
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Toolbar.js
|
19 |
+
*
|
20 |
+
* @fileoverview jQuery plugin that creates tooltip style toolbars.
|
21 |
+
* @link http://paulkinzett.github.com/toolbar/
|
22 |
+
* @author Paul Kinzett (http://kinzett.co.nz/)
|
23 |
+
* @version 1.1.0
|
24 |
+
* @requires jQuery 1.7+
|
25 |
+
*
|
26 |
+
* @license jQuery Toolbar Plugin v1.1.0
|
27 |
+
* http://paulkinzett.github.com/toolbar/
|
28 |
+
* Copyright 2013 - 2015 Paul Kinzett (http://kinzett.co.nz/)
|
29 |
+
* Released under the MIT license.
|
30 |
+
* <https://raw.github.com/paulkinzett/toolbar/master/LICENSE.txt>
|
31 |
+
*/
|
32 |
+
|
33 |
+
if ( typeof Object.create !== 'function' ) {
|
34 |
+
Object.create = function( obj ) {
|
35 |
+
function F() {}
|
36 |
+
F.prototype = obj;
|
37 |
+
return new F();
|
38 |
+
};
|
39 |
+
}
|
40 |
+
|
41 |
+
(function( $, window, document, undefined ) {
|
42 |
+
|
43 |
+
var ToolBar = {
|
44 |
+
init: function( options, elem ) {
|
45 |
+
var self = this;
|
46 |
+
self.elem = elem;
|
47 |
+
self.$elem = $( elem );
|
48 |
+
self.options = $.extend( {}, $.fn.toolbar.options, options );
|
49 |
+
self.metadata = self.$elem.data();
|
50 |
+
self.overrideOptions();
|
51 |
+
self.toolbar = $('<div class="tool-container" />')
|
52 |
+
.addClass('tool-'+self.options.position)
|
53 |
+
.addClass('toolbar-'+self.options.style)
|
54 |
+
.append('<div class="tool-items" />')
|
55 |
+
.append('<div class="arrow" />')
|
56 |
+
.appendTo('body')
|
57 |
+
.css('opacity', 0)
|
58 |
+
.hide();
|
59 |
+
self.toolbar_arrow = self.toolbar.find('.arrow');
|
60 |
+
self.initializeToolbar();
|
61 |
+
},
|
62 |
+
|
63 |
+
overrideOptions: function() {
|
64 |
+
var self = this;
|
65 |
+
$.each( self.options, function( $option ) {
|
66 |
+
if (typeof(self.$elem.data('toolbar-'+$option)) != "undefined") {
|
67 |
+
self.options[$option] = self.$elem.data('toolbar-'+$option);
|
68 |
+
}
|
69 |
+
});
|
70 |
+
},
|
71 |
+
|
72 |
+
initializeToolbar: function() {
|
73 |
+
var self = this;
|
74 |
+
self.populateContent();
|
75 |
+
self.setTrigger();
|
76 |
+
self.toolbarWidth = self.toolbar.width();
|
77 |
+
},
|
78 |
+
|
79 |
+
setTrigger: function() {
|
80 |
+
var self = this;
|
81 |
+
|
82 |
+
if (self.options.event != 'click') {
|
83 |
+
|
84 |
+
var moveTime;
|
85 |
+
function decideTimeout () {
|
86 |
+
if (self.$elem.hasClass('pressed')) {
|
87 |
+
moveTime = setTimeout(function() {
|
88 |
+
self.hide();
|
89 |
+
}, 150);
|
90 |
+
} else {
|
91 |
+
clearTimeout(moveTime);
|
92 |
+
};
|
93 |
+
};
|
94 |
+
|
95 |
+
self.$elem.on({
|
96 |
+
mouseenter: function(event) {
|
97 |
+
if (self.$elem.hasClass('pressed')) {
|
98 |
+
clearTimeout(moveTime);
|
99 |
+
} else {
|
100 |
+
self.show();
|
101 |
+
}
|
102 |
+
}
|
103 |
+
});
|
104 |
+
|
105 |
+
self.$elem.parent().on({
|
106 |
+
mouseleave: function(event){ decideTimeout(); }
|
107 |
+
});
|
108 |
+
|
109 |
+
$('.tool-container').on({
|
110 |
+
mouseenter: function(event){ clearTimeout(moveTime); },
|
111 |
+
mouseleave: function(event){ decideTimeout(); }
|
112 |
+
});
|
113 |
+
}
|
114 |
+
|
115 |
+
if (self.options.event == 'click') {
|
116 |
+
self.$elem.on('click', function(event) {
|
117 |
+
event.preventDefault();
|
118 |
+
if(self.$elem.hasClass('pressed')) {
|
119 |
+
self.hide();
|
120 |
+
} else {
|
121 |
+
self.show();
|
122 |
+
}
|
123 |
+
});
|
124 |
+
|
125 |
+
if (self.options.hideOnClick) {
|
126 |
+
$('html').on("click.toolbar", function ( event ) {
|
127 |
+
if (event.target != self.elem &&
|
128 |
+
self.$elem.has(event.target).length === 0 &&
|
129 |
+
self.toolbar.has(event.target).length === 0 &&
|
130 |
+
self.toolbar.is(":visible")) {
|
131 |
+
self.hide();
|
132 |
+
}
|
133 |
+
});
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
if (self.options.hover) {
|
138 |
+
var moveTime;
|
139 |
+
|
140 |
+
function decideTimeout () {
|
141 |
+
if (self.$elem.hasClass('pressed')) {
|
142 |
+
moveTime = setTimeout(function() {
|
143 |
+
self.hide();
|
144 |
+
}, 150);
|
145 |
+
} else {
|
146 |
+
clearTimeout(moveTime);
|
147 |
+
};
|
148 |
+
};
|
149 |
+
|
150 |
+
self.$elem.on({
|
151 |
+
mouseenter: function(event) {
|
152 |
+
if (self.$elem.hasClass('pressed')) {
|
153 |
+
clearTimeout(moveTime);
|
154 |
+
} else {
|
155 |
+
self.show();
|
156 |
+
}
|
157 |
+
}
|
158 |
+
});
|
159 |
+
|
160 |
+
self.$elem.parent().on({
|
161 |
+
mouseleave: function(event){ decideTimeout(); }
|
162 |
+
});
|
163 |
+
|
164 |
+
$('.tool-container').on({
|
165 |
+
mouseenter: function(event){ clearTimeout(moveTime); },
|
166 |
+
mouseleave: function(event){ decideTimeout(); }
|
167 |
+
});
|
168 |
+
}
|
169 |
+
|
170 |
+
$(window).resize(function( event ) {
|
171 |
+
event.stopPropagation();
|
172 |
+
if ( self.toolbar.is(":visible") ) {
|
173 |
+
self.toolbarCss = self.getCoordinates(self.options.position, 20);
|
174 |
+
self.collisionDetection();
|
175 |
+
self.toolbar.css( self.toolbarCss );
|
176 |
+
self.toolbar_arrow.css( self.arrowCss );
|
177 |
+
}
|
178 |
+
});
|
179 |
+
},
|
180 |
+
|
181 |
+
populateContent: function() {
|
182 |
+
var self = this;
|
183 |
+
var location = self.toolbar.find('.tool-items');
|
184 |
+
var content = $(self.options.content).clone( true ).find('a').addClass('tool-item');
|
185 |
+
location.html(content);
|
186 |
+
location.find('.tool-item').on('click', function(event) {
|
187 |
+
event.preventDefault();
|
188 |
+
self.$elem.trigger('toolbarItemClick', this);
|
189 |
+
});
|
190 |
+
},
|
191 |
+
|
192 |
+
calculatePosition: function() {
|
193 |
+
var self = this;
|
194 |
+
self.arrowCss = {};
|
195 |
+
self.toolbarCss = self.getCoordinates(self.options.position, self.options.adjustment);
|
196 |
+
self.toolbarCss.position = 'absolute';
|
197 |
+
self.toolbarCss.zIndex = self.options.zIndex;
|
198 |
+
self.collisionDetection();
|
199 |
+
self.toolbar.css(self.toolbarCss);
|
200 |
+
self.toolbar_arrow.css(self.arrowCss);
|
201 |
+
},
|
202 |
+
|
203 |
+
getCoordinates: function( position, adjustment ) {
|
204 |
+
var self = this;
|
205 |
+
self.coordinates = self.$elem.offset();
|
206 |
+
|
207 |
+
if (self.options.adjustment && self.options.adjustment[self.options.position]) {
|
208 |
+
adjustment = self.options.adjustment[self.options.position] + adjustment;
|
209 |
+
}
|
210 |
+
|
211 |
+
switch(self.options.position) {
|
212 |
+
case 'top':
|
213 |
+
return {
|
214 |
+
left: self.coordinates.left-(self.toolbar.width()/2)+(self.$elem.outerWidth()/2),
|
215 |
+
top: self.coordinates.top-self.$elem.outerHeight()-adjustment,
|
216 |
+
right: 'auto'
|
217 |
+
};
|
218 |
+
case 'left':
|
219 |
+
return {
|
220 |
+
left: self.coordinates.left-(self.toolbar.width()/2)-(self.$elem.outerWidth()/2)-adjustment,
|
221 |
+
top: self.coordinates.top-(self.toolbar.height()/2)+(self.$elem.outerHeight()/2),
|
222 |
+
right: 'auto'
|
223 |
+
};
|
224 |
+
case 'right':
|
225 |
+
return {
|
226 |
+
left: self.coordinates.left+(self.toolbar.width()/2)+(self.$elem.outerWidth()/2)+adjustment,
|
227 |
+
top: self.coordinates.top-(self.toolbar.height()/2)+(self.$elem.outerHeight()/2),
|
228 |
+
right: 'auto'
|
229 |
+
};
|
230 |
+
case 'bottom':
|
231 |
+
return {
|
232 |
+
left: self.coordinates.left-(self.toolbar.width()/2)+(self.$elem.outerWidth()/2),
|
233 |
+
top: self.coordinates.top+self.$elem.outerHeight()+adjustment,
|
234 |
+
right: 'auto'
|
235 |
+
};
|
236 |
+
}
|
237 |
+
},
|
238 |
+
|
239 |
+
collisionDetection: function() {
|
240 |
+
var self = this;
|
241 |
+
var edgeOffset = 20;
|
242 |
+
if(self.options.position == 'top' || self.options.position == 'bottom') {
|
243 |
+
self.arrowCss = {left: '50%', right: '50%'};
|
244 |
+
if( self.toolbarCss.left < edgeOffset ) {
|
245 |
+
self.toolbarCss.left = edgeOffset;
|
246 |
+
self.arrowCss.left = self.$elem.offset().left + self.$elem.width()/2-(edgeOffset);
|
247 |
+
}
|
248 |
+
else if(($(window).width() - (self.toolbarCss.left + self.toolbarWidth)) < edgeOffset) {
|
249 |
+
self.toolbarCss.right = edgeOffset;
|
250 |
+
self.toolbarCss.left = 'auto';
|
251 |
+
self.arrowCss.left = 'auto';
|
252 |
+
self.arrowCss.right = ($(window).width()-self.$elem.offset().left)-(self.$elem.width()/2)-(edgeOffset)-5;
|
253 |
+
}
|
254 |
+
}
|
255 |
+
},
|
256 |
+
|
257 |
+
show: function() {
|
258 |
+
var self = this;
|
259 |
+
self.$elem.addClass('pressed');
|
260 |
+
self.calculatePosition();
|
261 |
+
self.toolbar.show().css({'opacity': 1}).addClass('animate-'+self.options.animation);
|
262 |
+
self.$elem.trigger('toolbarShown');
|
263 |
+
},
|
264 |
+
|
265 |
+
hide: function() {
|
266 |
+
var self = this;
|
267 |
+
var animation = {'opacity': 0};
|
268 |
+
|
269 |
+
self.$elem.removeClass('pressed');
|
270 |
+
|
271 |
+
switch(self.options.position) {
|
272 |
+
case 'top':
|
273 |
+
animation.top = '+=20';
|
274 |
+
break;
|
275 |
+
case 'left':
|
276 |
+
animation.left = '+=20';
|
277 |
+
break;
|
278 |
+
case 'right':
|
279 |
+
animation.left = '-=20';
|
280 |
+
break;
|
281 |
+
case 'bottom':
|
282 |
+
animation.top = '-=20';
|
283 |
+
break;
|
284 |
+
}
|
285 |
+
|
286 |
+
self.toolbar.animate(animation, 200, function() {
|
287 |
+
self.toolbar.hide();
|
288 |
+
});
|
289 |
+
|
290 |
+
self.$elem.trigger('toolbarHidden');
|
291 |
+
},
|
292 |
+
|
293 |
+
getToolbarElement: function () {
|
294 |
+
return this.toolbar.find('.tool-items');
|
295 |
+
}
|
296 |
+
};
|
297 |
+
|
298 |
+
$.fn.toolbar = function( options ) {
|
299 |
+
if ($.isPlainObject( options )) {
|
300 |
+
return this.each(function() {
|
301 |
+
var toolbarObj = Object.create( ToolBar );
|
302 |
+
toolbarObj.init( options, this );
|
303 |
+
$(this).data('toolbarObj', toolbarObj);
|
304 |
+
});
|
305 |
+
} else if ( typeof options === 'string' && options.indexOf('_') !== 0 ) {
|
306 |
+
var toolbarObj = $(this).data('toolbarObj');
|
307 |
+
var method = toolbarObj[options];
|
308 |
+
return method.apply(toolbarObj, $.makeArray(arguments).slice(1));
|
309 |
+
}
|
310 |
+
};
|
311 |
+
|
312 |
+
$.fn.toolbar.options = {
|
313 |
+
content: '#myContent',
|
314 |
+
position: 'top',
|
315 |
+
hideOnClick: false,
|
316 |
+
zIndex: 120,
|
317 |
+
hover: false,
|
318 |
+
style: 'default',
|
319 |
+
animation: 'standard',
|
320 |
+
adjustment: 10
|
321 |
+
};
|
322 |
+
|
323 |
+
}) ( jQuery, window, document );
|
js/toolbar.js
DELETED
@@ -1,242 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Toolbar.js
|
3 |
-
*
|
4 |
-
* @fileoverview jQuery plugin that creates tooltip style toolbars.
|
5 |
-
* @link http://paulkinzett.github.com/toolbar/
|
6 |
-
* @author Paul Kinzett (http://kinzett.co.nz/)
|
7 |
-
* @version 1.0.4
|
8 |
-
* @requires jQuery 1.7+
|
9 |
-
*
|
10 |
-
* @license jQuery Toolbar Plugin v1.0.4
|
11 |
-
* http://paulkinzett.github.com/toolbar/
|
12 |
-
* Copyright 2013 Paul Kinzett (http://kinzett.co.nz/)
|
13 |
-
* Released under the MIT license.
|
14 |
-
* <https://raw.github.com/paulkinzett/toolbar/master/LICENSE.txt>
|
15 |
-
*/
|
16 |
-
|
17 |
-
if ( typeof Object.create !== 'function' ) {
|
18 |
-
Object.create = function( obj ) {
|
19 |
-
function F() {}
|
20 |
-
F.prototype = obj;
|
21 |
-
return new F();
|
22 |
-
};
|
23 |
-
}
|
24 |
-
|
25 |
-
(function( $, window, document, undefined ) {
|
26 |
-
|
27 |
-
var ToolBar = {
|
28 |
-
init: function( options, elem ) {
|
29 |
-
var self = this;
|
30 |
-
self.elem = elem;
|
31 |
-
self.$elem = $( elem );
|
32 |
-
self.options = $.extend( {}, $.fn.toolbar.options, options );
|
33 |
-
self.toolbar = $('<div class="tool-container gradient" />')
|
34 |
-
.addClass('tool-'+self.options.position)
|
35 |
-
.addClass('tool-rounded')
|
36 |
-
.append('<div class="tool-items" />')
|
37 |
-
.append('<div class="arrow" />')
|
38 |
-
.appendTo('body')
|
39 |
-
.css('opacity', 0)
|
40 |
-
.hide();
|
41 |
-
self.toolbar_arrow = self.toolbar.find('.arrow');
|
42 |
-
self.initializeToolbar();
|
43 |
-
},
|
44 |
-
|
45 |
-
initializeToolbar: function() {
|
46 |
-
var self = this;
|
47 |
-
self.populateContent();
|
48 |
-
self.setTrigger();
|
49 |
-
self.toolbarWidth = self.toolbar.width();
|
50 |
-
},
|
51 |
-
|
52 |
-
setTrigger: function() {
|
53 |
-
var self = this;
|
54 |
-
|
55 |
-
self.$elem.on('click', function(event) {
|
56 |
-
event.preventDefault();
|
57 |
-
if(self.$elem.hasClass('pressed')) {
|
58 |
-
self.hide();
|
59 |
-
} else {
|
60 |
-
self.show();
|
61 |
-
}
|
62 |
-
});
|
63 |
-
|
64 |
-
if (self.options.hideOnClick) {
|
65 |
-
$('html').on("click.toolbar", function ( event ) {
|
66 |
-
if (event.target != self.elem &&
|
67 |
-
self.$elem.has(event.target).length === 0 &&
|
68 |
-
self.toolbar.has(event.target).length === 0 &&
|
69 |
-
self.toolbar.is(":visible")) {
|
70 |
-
self.hide();
|
71 |
-
}
|
72 |
-
});
|
73 |
-
}
|
74 |
-
|
75 |
-
$(window).resize(function( event ) {
|
76 |
-
event.stopPropagation();
|
77 |
-
if ( self.toolbar.is(":visible") ) {
|
78 |
-
self.toolbarCss = self.getCoordinates(self.options.position, 20);
|
79 |
-
self.collisionDetection();
|
80 |
-
self.toolbar.css( self.toolbarCss );
|
81 |
-
self.toolbar_arrow.css( self.arrowCss );
|
82 |
-
}
|
83 |
-
});
|
84 |
-
},
|
85 |
-
|
86 |
-
populateContent: function() {
|
87 |
-
var self = this;
|
88 |
-
var location = self.toolbar.find('.tool-items');
|
89 |
-
var content = $(self.options.content).clone( true ).find('a').addClass('tool-item gradient');
|
90 |
-
location.html(content);
|
91 |
-
location.find('.tool-item').on('click', function(event) {
|
92 |
-
event.preventDefault();
|
93 |
-
self.$elem.trigger('toolbarItemClick', this);
|
94 |
-
});
|
95 |
-
},
|
96 |
-
|
97 |
-
calculatePosition: function() {
|
98 |
-
var self = this;
|
99 |
-
self.arrowCss = {};
|
100 |
-
self.toolbarCss = self.getCoordinates(self.options.position, 0);
|
101 |
-
self.toolbarCss.position = 'absolute';
|
102 |
-
self.toolbarCss.zIndex = self.options.zIndex;
|
103 |
-
self.collisionDetection();
|
104 |
-
self.toolbar.css(self.toolbarCss);
|
105 |
-
self.toolbar_arrow.css(self.arrowCss);
|
106 |
-
},
|
107 |
-
|
108 |
-
getCoordinates: function( position, adjustment ) {
|
109 |
-
var self = this;
|
110 |
-
self.coordinates = self.$elem.offset();
|
111 |
-
|
112 |
-
if (self.options.adjustment && self.options.adjustment[self.options.position]) {
|
113 |
-
adjustment = self.options.adjustment[self.options.position] + adjustment;
|
114 |
-
}
|
115 |
-
|
116 |
-
switch(self.options.position) {
|
117 |
-
case 'top':
|
118 |
-
return {
|
119 |
-
left: self.coordinates.left-(self.toolbar.width()/2)+(self.$elem.outerWidth()/2),
|
120 |
-
//top: self.coordinates.top-self.$elem.height()-adjustment,
|
121 |
-
right: 'auto'
|
122 |
-
};
|
123 |
-
case 'left':
|
124 |
-
return {
|
125 |
-
left: self.coordinates.left-(self.toolbar.width()/2)-(self.$elem.width()/2)-adjustment,
|
126 |
-
top: self.coordinates.top-(self.toolbar.height()/2)+(self.$elem.outerHeight()/2),
|
127 |
-
right: 'auto'
|
128 |
-
};
|
129 |
-
case 'right':
|
130 |
-
return {
|
131 |
-
left: self.coordinates.left+(self.toolbar.width()/2)+(self.$elem.width()/3)+adjustment,
|
132 |
-
top: self.coordinates.top-(self.toolbar.height()/2)+(self.$elem.outerHeight()/2),
|
133 |
-
right: 'auto'
|
134 |
-
};
|
135 |
-
case 'bottom':
|
136 |
-
return {
|
137 |
-
left: self.coordinates.left-(self.toolbar.width()/2)+(self.$elem.outerWidth()/2),
|
138 |
-
top: self.coordinates.top+self.$elem.height()+adjustment,
|
139 |
-
right: 'auto'
|
140 |
-
};
|
141 |
-
}
|
142 |
-
},
|
143 |
-
|
144 |
-
collisionDetection: function() {
|
145 |
-
var self = this;
|
146 |
-
var edgeOffset = 20;
|
147 |
-
if(self.options.position =='top' || self.options.position == 'bottom') {
|
148 |
-
self.arrowCss = {left: '50%', right: '50%'};
|
149 |
-
if( self.toolbarCss.left < edgeOffset ) {
|
150 |
-
self.toolbarCss.left = edgeOffset;
|
151 |
-
self.arrowCss.left = self.$elem.offset().left + self.$elem.width()/2-(edgeOffset);
|
152 |
-
}
|
153 |
-
else if(($(window).width() - (self.toolbarCss.left + self.toolbarWidth)) < edgeOffset) {
|
154 |
-
self.toolbarCss.right = edgeOffset;
|
155 |
-
self.toolbarCss.left = 'auto';
|
156 |
-
self.arrowCss.left = 'auto';
|
157 |
-
self.arrowCss.right = ($(window).width()-self.$elem.offset().left)-(self.$elem.width()/2)-(edgeOffset)-5;
|
158 |
-
}
|
159 |
-
}
|
160 |
-
},
|
161 |
-
|
162 |
-
show: function() {
|
163 |
-
var self = this;
|
164 |
-
var animation = {'opacity': 1};
|
165 |
-
|
166 |
-
self.$elem.addClass('pressed');
|
167 |
-
self.calculatePosition();
|
168 |
-
|
169 |
-
switch(self.options.position) {
|
170 |
-
case 'top':
|
171 |
-
//animation.top = '-=20';
|
172 |
-
break;
|
173 |
-
case 'left':
|
174 |
-
animation.left = '-=20';
|
175 |
-
break;
|
176 |
-
case 'right':
|
177 |
-
animation.left = '+=20';
|
178 |
-
break;
|
179 |
-
case 'bottom':
|
180 |
-
animation.top = '+=20';
|
181 |
-
break;
|
182 |
-
}
|
183 |
-
|
184 |
-
self.toolbar.show().animate(animation, 200 );
|
185 |
-
self.$elem.trigger('toolbarShown');
|
186 |
-
},
|
187 |
-
|
188 |
-
hide: function() {
|
189 |
-
var self = this;
|
190 |
-
var animation = {'opacity': 0};
|
191 |
-
|
192 |
-
self.$elem.removeClass('pressed');
|
193 |
-
|
194 |
-
switch(self.options.position) {
|
195 |
-
case 'top':
|
196 |
-
//animation.top = '+=20';
|
197 |
-
break;
|
198 |
-
case 'left':
|
199 |
-
animation.left = '+=20';
|
200 |
-
break;
|
201 |
-
case 'right':
|
202 |
-
animation.left = '-=20';
|
203 |
-
break;
|
204 |
-
case 'bottom':
|
205 |
-
animation.top = '-=20';
|
206 |
-
break;
|
207 |
-
}
|
208 |
-
|
209 |
-
self.toolbar.animate(animation, 200, function() {
|
210 |
-
self.toolbar.hide();
|
211 |
-
});
|
212 |
-
|
213 |
-
self.$elem.trigger('toolbarHidden');
|
214 |
-
},
|
215 |
-
|
216 |
-
getToolbarElement: function () {
|
217 |
-
return this.toolbar.find('.tool-items');
|
218 |
-
}
|
219 |
-
};
|
220 |
-
|
221 |
-
$.fn.toolbar = function( options ) {
|
222 |
-
if ($.isPlainObject( options )) {
|
223 |
-
return this.each(function() {
|
224 |
-
var toolbarObj = Object.create( ToolBar );
|
225 |
-
toolbarObj.init( options, this );
|
226 |
-
$(this).data('toolbarObj', toolbarObj);
|
227 |
-
});
|
228 |
-
} else if ( typeof options === 'string' && options.indexOf('_') !== 0 ) {
|
229 |
-
var toolbarObj = $(this).data('toolbarObj');
|
230 |
-
var method = toolbarObj[options];
|
231 |
-
return method.apply(toolbarObj, $.makeArray(arguments).slice(1));
|
232 |
-
}
|
233 |
-
};
|
234 |
-
|
235 |
-
$.fn.toolbar.options = {
|
236 |
-
content: '#myContent',
|
237 |
-
position: 'top',
|
238 |
-
hideOnClick: false,
|
239 |
-
zIndex: 120
|
240 |
-
};
|
241 |
-
|
242 |
-
}) ( jQuery, window, document );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Plugin link: http://wp-studio.net/how-it-works
|
|
5 |
Tags: language translator, google translator, language translate, translate wordpress, google language translator, translation, translate, multi language
|
6 |
Requires at least: 2.9
|
7 |
Tested up to: 4.6
|
8 |
-
Stable tag: 5.0.
|
9 |
|
10 |
Welcome to Google Language Translator! This plugin allows you to insert the Google Language Translator tool anywhere on your website using shortcode.
|
11 |
|
@@ -46,6 +46,10 @@ A: Yes! Add the "notranslate" class to the HTML element containing your text. Fo
|
|
46 |
|
47 |
== Changelog ==
|
48 |
|
|
|
|
|
|
|
|
|
49 |
5.0.26
|
50 |
- Fixed a small error in adding the setting for Floating Widget text.
|
51 |
|
5 |
Tags: language translator, google translator, language translate, translate wordpress, google language translator, translation, translate, multi language
|
6 |
Requires at least: 2.9
|
7 |
Tested up to: 4.6
|
8 |
+
Stable tag: 5.0.27
|
9 |
|
10 |
Welcome to Google Language Translator! This plugin allows you to insert the Google Language Translator tool anywhere on your website using shortcode.
|
11 |
|
46 |
|
47 |
== Changelog ==
|
48 |
|
49 |
+
5.0.27
|
50 |
+
- Removed toolbar.js and flags.js and combined to existing files (to improve efficiency of page load and http requests).
|
51 |
+
- Added new setting to allow or prevent floating widget text to translate.
|
52 |
+
|
53 |
5.0.26
|
54 |
- Fixed a small error in adding the setting for Floating Widget text.
|
55 |
|