]> git.wh0rd.org - tt-rss.git/blame - plugins/af_sort_bayes/init.js
bayes: properly reset score when going good -> ugly
[tt-rss.git] / plugins / af_sort_bayes / init.js
CommitLineData
853cc128
AD
1function bayesTrain(id, train_up) {
2 try {
3
4 var query = "backend.php?op=pluginhandler&plugin=af_sort_bayes&method=trainArticle&article_id=" + param_escape(id) +
a72cd54c 5 "&train_up=" + param_escape(train_up);
853cc128
AD
6
7 new Ajax.Request("backend.php", {
8 parameters: query,
9 onComplete: function(transport) {
10 notify(transport.responseText);
a72cd54c 11 updateScore(id);
853cc128
AD
12 } });
13
14 } catch (e) {
15 exception_error("showTrgmRelated", e);
16 }
17}
18
3c43def9
AD
19function bayesClearDatabase() {
20 try {
21
22 if (confirm(__("Clear classifier database?"))) {
23
24 var query = "backend.php?op=pluginhandler&plugin=af_sort_bayes&method=clearDatabase";
25
26 new Ajax.Request("backend.php", {
27 parameters: query,
28 onComplete: function (transport) {
29 notify(transport.responseText);
308c55c0 30 bayesUpdateUI();
3c43def9
AD
31 }
32 });
33 }
34
35 } catch (e) {
36 exception_error("showTrgmRelated", e);
37 }
38}
39
308c55c0
AD
40function bayesUpdateUI() {
41 try {
42
43 var query = "backend.php?op=pluginhandler&plugin=af_sort_bayes&method=renderPrefsUI";
44
45 new Ajax.Request("backend.php", {
46 parameters: query,
47 onComplete: function (transport) {
48 dijit.byId("af_sort_bayes_prefs").attr("content", transport.responseText);
49 }
50 });
51
52 } catch (e) {
53 exception_error("showTrgmRelated", e);
54 }
55}