Browse Source

Единственная точка входа: init(...)

master
Maxim Lihachev 9 years ago
parent
commit
3382af482f
  1. 9
      gofem.html
  2. 5
      js/feminitives.js

9
gofem.html

@ -10,13 +10,13 @@ @@ -10,13 +10,13 @@
<link href="css/feminitives.css" rel="stylesheet">
</head>
<body onload="init('definition')">
<body>
<div style="text-align: center;">
<div id="definition">
<h1>Феминизатор v1.0</h1>
<input id="definition-word" type="text" class="form-control" placeholder="Слово" autofocus>
<button id="convert" type="button" class="btn" onclick="tr()">Феминитивь!</button>
<input id="definition-word" type="text" placeholder="Слово" autofocus>
<button id="definition-convert" type="button">Феминитивь!</button>
<div id="definition-dict"></div>
<div id="definition-full"></div>
@ -34,6 +34,9 @@ @@ -34,6 +34,9 @@
<script src="js/feminitives.js"></script>
<script src="js/html2canvas.js"></script>
<script>
init('definition');
</script>
</body>
</html>

5
js/feminitives.js

@ -44,6 +44,7 @@ var HTML = { @@ -44,6 +44,7 @@ var HTML = {
container: "",
_select: function(element) { return document.getElementById(this.container + "-" + element); },
input: function() { return this._select("word"); },
button: function() { return this._select("convert"); },
dict: function() { return this._select("dict"); },
content: function() { return this._select("content"); },
full: function() { return this._select("full"); },
@ -60,6 +61,9 @@ HTML.init = function(root) { @@ -60,6 +61,9 @@ HTML.init = function(root) {
event.preventDefault();
event.keyCode == 13 && tr();
});
//Конвертирование по нажатию кнопки
this.button().onclick = tr();
};
//Разбор параметров
@ -327,6 +331,7 @@ function tr(word) { @@ -327,6 +331,7 @@ function tr(word) {
//Вывод информации
if (!wd) {
show_help();
return;
} else if (FEM.exceptions.contains(wd)) {
HTML.full().innerHTML = FEM.exceptions.definition(wd);
feminitives = FEM.exceptions.feminitives(wd);

Loading…
Cancel
Save