/
stylinggt.js
75 lines (66 loc) · 1.92 KB
/
stylinggt.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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
70
71
72
73
74
75
/* --------------------------------------------------------------------
* StylingGT - A Javascript plug-in
* Author: Winner Crespo, http://winnercrespo.com
* Copyright (c) 2014 Winner Crespo
* Licensed under The MIT License (MIT) [http://opensource.org/licenses/MIT]
* --------------------------------------------------------------------
*/
function defaultStyle(remove, leftIcon, centerText, rightIcon, borderColor, backgroundColor, textColor, textSize){
if(remove){
removeLeftIcon();
}
changeLeftIcon(leftIcon);
changeCenterText(centerText);
changeRightIcon(rightIcon);
changeBorderColor(borderColor);
changeBackgroundColor(backgroundColor);
changeTextColor(textColor);
changeTextSize(textSize);
}
function removeLeftIcon(){
$("#google_translate_element img").eq(0).remove();
}
function changeLeftIcon(url){
if(url != ''){
$("#google_translate_element img").eq(0).css("background-image", "");
$("#google_translate_element img").eq(0).attr("src", url);
$("#urlLeftIcon").val('');
}
}
function changeCenterText(text){
if(text != ''){
$("#google_translate_element span").eq(1).text(text);
$("#centerText").val('');
}
}
function changeRightIcon(text){
if(text != ''){
$("#google_translate_element span").eq(3).text(text);
$("#rightIcon").val('');
}
}
function changeBorderColor(color){
if(color != ''){
$("#google_translate_element span").css("border-color", color);
$("#google_translate_element div").eq(1).css("border-color", color);
$("#borderColor").val('');
}
}
function changeBackgroundColor(color){
if(color != ''){
$("#google_translate_element div").eq(1).css("background-color", color);
$("#backgroundColor").val('');
}
}
function changeTextColor(color){
if(color != ''){
$("#google_translate_element a").css("color", color);
$("#textColor").val('');
}
}
function changeTextSize(size){
if(size != ''){
$("#google_translate_element a").css("font-size", size);
$("#textSize").val('');
}
}