-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
102 lines (91 loc) · 5.53 KB
/
index.html
File metadata and controls
102 lines (91 loc) · 5.53 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"
integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="alert info" role="alert"><a href="https://github.com/azarakovsky/inline-translator">Github</a></div>
<div class="row">
<ol>
<li>Drag-n-drop generated link to your bookmarks panel.</li>
<li>Go to a desired language (from) website</li>
<li>
<ul>
<li>Select text you want to translate (better a paragraph, so not the whole page)</li>
<li>Click the bookmark</li>
<li>The second click will erase translated data for the whole page</li>
</ul>
</li>
</ol>
</div>
<hr/>
<div class="row">
<div class="col-xs-12 col-md-12">
<form>
<div class="form-group">
<label for="from" class="col-sm-2 control-label">From language</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="from" placeholder="From language" value="nl">
</div>
<span class="help-block"><a href="https://tech.yandex.ru/translate/doc/dg/concepts/langs-docpage/"
target="_blank">https://tech.yandex.ru/translate/doc/dg/concepts/langs-docpage/</a></span>
</div>
<div class="form-group">
<label for="to" class="col-sm-2 control-label">To language</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="to" placeholder="To language" value="en">
</div>
</div>
<div class="form-group">
<label for="css" class="col-sm-2 control-label">CSS</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="css" placeholder="CSS"
value="font-size:80%;color:rgb(67,175,1);line-height:normal">
</div>
</div>
<button onclick="generate(); return false;">Generate</button>
</form>
<hr/>
<p id="result"></p>
</div>
</div>
</div>
<script>
function generate() {
var str = "javascript:!function()%7Bfunction%20e()%7Bvar%20e%3D%22nlentranslate%22%2Ct%3DjQuery(%22.%22%2Be)%3Bif(0!%3Dt.size())return%20void%20t.remove()%3Bvar%20n%3Dwindow.getSelection()%3Bif(!(n.rangeCount%3C1))%7Bvar%20a%3Dn.toString().split(%22.%20%22)%3BjQuery.get(%22https%3A%2F%2Ftranslate.yandex.net%2Fapi%2Fv1.5%2Ftr.json%2Ftranslate%3Fkey%3Dtrnsl.1.1.20160314T094828Z.9a4a9946c1276589.fc095296bcade3d9bb27e3ea480669b939bf4f9f%26lang%3DDIRECTION%26text%3D%22%2Ba.join(%22%26text%3D%22)%2Cfunction(e)%7Bvar%20t%3Ddocument.createElement(%22p%22)%3Bt.innerHTML%3De.text.join(%22.%20%22)%2Ct.className%3D%22nlentranslate%22%2Ct.style.cssText%3D%22CSSSTYLE%22%3Bvar%20a%3Dn.getRangeAt(0)%3Ba.collapse(!1)%2Ca.insertNode(t)%7D)%7D%7D%22undefined%22%3D%3Dtypeof%20jQuery%3Ffunction()%7Bvar%20t%3Ddocument.createElement(%22script%22)%3Bt.src%3D%22https%3A%2F%2Fcode.jquery.com%2Fjquery.min.js%22%3Bvar%20n%3Ddocument.getElementsByTagName(%22head%22)%5B0%5D%2Ca%3D!1%3Bt.onload%3Dt.onreadystatechange%3Dfunction()%7B!a%26%26(!this.readyState%7C%7C%22loaded%22%3D%3Dthis.readyState%7C%7C%22complete%22%3D%3Dthis.readyState)%26%26(a%3D!0%2Ct.onload%3Dt.onreadystatechange%3Dnull%2Cn.removeChild(t)%2Ce())%7D%2Cn.appendChild(t)%7D()%3Ae()%7D()%3B";
var direction = jQuery("#from").val() + "-" + jQuery("#to").val();
var css = jQuery("#css").val();
jQuery("#result").html("Add this to bookmarks panel: ").append(
jQuery("<a>" + direction.toUpperCase() + "</a>")
.attr("href",
str
.replace("DIRECTION", encodeURIComponent(direction))
.replace("CSSSTYLE", encodeURIComponent(css)))
)
;
}
</script>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"
integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS"
crossorigin="anonymous"></script>
</body>
</html>