This file is indexed.

/usr/share/hotot/js/ui.kismet_dlg.js is in hotot-common 1:0.9.8.14-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
if (typeof ui == 'undefined') var ui = {};
ui.KismetDlg = {
init:
function init() {
    var filter_btns = new widget.RadioGroup('#kismet_cat_btns');
    filter_btns.on_clicked = function (btn, event) {
        var name = btn.attr('href').substring(1);
        ui.KismetDlg.switch_category(name);
        return false;
    };
    filter_btns.create();
    $('#kismet_cat_btns .radio_group_btn:eq(0)').click();

    // dialogs
    ui.KismetDlg.rule_edit_dialog = new widget.Dialog('#kismet_rule_edit_dialog');
    ui.KismetDlg.rule_edit_dialog.set_styles('header', 
            {'height': '0px', 'padding':'0px', 'display': 'none'});
    ui.KismetDlg.rule_edit_dialog.resize(500, 500);
    ui.KismetDlg.rule_edit_dialog.create();
    
    ui.KismetDlg.guide_dialog = new widget.Dialog('#kismet_guide_dialog');
    ui.KismetDlg.guide_dialog.set_styles('header', 
            {'height': '0px', 'padding':'0px', 'display': 'none'});
    ui.KismetDlg.guide_dialog.resize(500, 400);
    ui.KismetDlg.guide_dialog.create();
    
    ui.KismetDlg.color_guide_dialog = new widget.Dialog('#kismet_color_guide_dialog');
    ui.KismetDlg.color_guide_dialog.set_styles('header', 
            {'height': '0px', 'padding':'0px', 'display': 'none'});
    ui.KismetDlg.color_guide_dialog.set_styles('footer', 
            {'height': '0px', 'padding':'0px', 'display': 'none'});
    ui.KismetDlg.color_guide_dialog.resize(500, 300);
    ui.KismetDlg.color_guide_dialog.create();

    var color_cells = $('#kismet_color_list .cell');
    var color_hrefs = $('#kismet_color_list a');
    for (var i = 0; i < kismet.default_color.length; i += 1) {
        $(color_cells.get(i+1)).css('background-color', kismet.default_color[i]);
        $(color_hrefs.get(i+1)).attr('href', kismet.default_color[i]);
    }

    $('.kismet_sample').click(function () {
        var text = $(this).text();
        $('#kismet_rule_edit_data').val($('#kismet_rule_edit_data').val() + ' ' +text);
        return false;
    });

    $('#kismet_add_rule_btn').click(function () {
        ui.KismetDlg.show_edit_dialog({name:'', rule:''});
        return false;
    });

    $('#kismet_rule_edit_ok').click(function () {
        var name = $.trim($('#kismet_rule_edit_name').val());
        var data = $.trim($('#kismet_rule_edit_data').val());
        if (name.length == 0 || data.length == 0) {
            toast.set('Please fill all fields.').show(3);
            return false;
        }
        if (kismet.compile(data) == kismet.ERROR) {
            toast.set('Verify failed, please check your rule.').show(3);
            return false;
        }
        var rule = { name: name, data: data };
        kismet.update_rule(rule);
        kismet.save();
        ui.KismetDlg.reload();
        ui.KismetDlg.rule_edit_dialog.close();
        return false;
    });
    
    $('#kismet_rule_edit_verify').click(function () {
        var data = $.trim($('#kismet_rule_edit_data').val());
        var ret = kismet.compile(data);
        if (ret != kismet.ERROR) {
            widget.DialogManager.alert('Verify Result', kismet.rule_string);
        } else {
            toast.set('Verify failed, please check your rule.').show(3);
        }
        return false;
    });

    $('#kismet_dialog .rule').live('click', function () {
        $('#kismet_rule_list .rule').removeClass('selected');
        $(this).addClass('selected');
        $('#kismet_rule_list .rule').parent().removeClass('selected');
        $(this).parent().addClass('selected');
        return false;
    });
    
    $('#kismet_dialog .delete_btn').live('click', function () {
        var s=$('#kismet_rule_list .rule.selected');
        if (s.length == 0) { return false; }
        kismet.remove_rule(decodeURIComponent(s.attr('rule_name')));
        ui.KismetDlg.reload();
        return false;
    });
    
    $('#kismet_dialog .edit_btn').live('click', function () {
        var s=$('#kismet_rule_list .rule.selected');
        if (s.length == 0) { return false; }
        var rule = {
            name: decodeURIComponent(s.attr('rule_name')),
            data: decodeURIComponent(s.attr('rule_data'))
        };
        ui.KismetDlg.show_edit_dialog(rule);
        return false;
    });
    
    $('#kismet_save_btn').click(function () {
        ui.KismetDlg.save();
        globals.kismet_dialog.close();
        return false;
    });

    $('#kismet_guide_next_btn').click(function () {
        var marked = $('#kismet_guide_dialog .marked');
        var actions = $('#kismet_guide_dialog .action_block .checkbox:checked');
        var columns = $('#kismet_guide_dialog .column_block .checkbox:checked');
        if (marked.length === 0) { //  
            toast.set('Please select a field!').show(3);
            return false;
        }
        if (marked.length === 1 && columns.length == 0
            && (actions.length == 0 || actions.length === 1 
                && actions.val() === 'drop')) { // simple, use mute list
            var field = 'word';
            var text = $.trim($(marked[0]).text());
            if ($(marked[0]).hasClass('who_href')) {
                field = 'name';
            } else if ($(marked[0]).parent().hasClass('tweet_source')) {
                field = 'source';
            } else if ($(marked[0]).hasClass('word')) {
                field = 'word';
            }
            kismet.update_mute_list(field, text);
            toast.set('You have muted '+ field +' "'+text+'"').show(3);
        } else { // complex, use kismet rule 
            var rule_data_arr = [];
            for (var i = 0; i < marked.length; i += 1) {
                var text = $.trim($(marked[i]).text());
                if ($(marked[i]).hasClass('who_href')) {
                    rule_data_arr.push('name:' + text);
                } else if ($(marked[i]).parent().hasClass('tweet_source')) {
                    rule_data_arr.push('via:"' + text + '"');
                } else if ($(marked[i]).hasClass('word')) {
                    if (text[0] == '#') {
                        rule_data_arr.push('tag:' + text.substring(1));
                    } else if (text[0] == '@') {
                        rule_data_arr.push('mention:' + text.substring(1));
                    } else {
                        rule_data_arr.push('"'+text+'"');
                    }
                }
            }
            actions.each(
                function (i, n) {
                    rule_data_arr.push('do:' + $(n).val());
                }
            );
            columns.each(
                function (i, n) {
                    rule_data_arr.push('column:' + $(n).val());
                }
            );
            var rule_data = rule_data_arr.join(' ');
            if (kismet.compile(rule_data) != kismet.ERROR) {
                var rule = {name: kismet.rule_string, data: rule_data};
                ui.KismetDlg.show_edit_dialog(rule);
            }
        }
        ui.KismetDlg.guide_dialog.close();
        return false;
    });

    $('#kismet_color_list a').click(function () {
        var color_code = $(this).attr('href');
        var screen_name = $('#kismet_color_guide_dialog').data('screen_name');
        var li = $('.card[screen_name="'+screen_name+'"]');
        if (screen_name) {
            kismet.set_user_color(screen_name, color_code);
            li.find('.tweet_color_label').css('background-color', color_code);
        }
        ui.KismetDlg.color_guide_dialog.close();
        conf.save_prefs(conf.current_name);
        return false;
    });

    $('#context_menuitem_kismet_username').click(function () {
        kismet.update_mute_list('name', ui.ContextMenu.selected_string);
        kismet.save();
        toast.set('You muted @'+ui.ContextMenu.selected_string).show(3);
        return false;
    });

    $('#context_menuitem_kismet_word').click(function () {
        kismet.update_mute_list('word', ui.ContextMenu.selected_string);
        kismet.save();
        toast.set('You muted tweets containing '+ui.ContextMenu.selected_string).show(3);
        return false;
    });

    $('#context_menuitem_kismet_source').click(function () {
        kismet.update_mute_list('source', ui.ContextMenu.selected_string);
        kismet.save();
        toast.set('You muted tweets from '+ui.ContextMenu.selected_string).show(3);
        return false;
    });

    ui.KismetDlg.reload();
},

switch_category:
function switch_category(name) {
    $('#kismet_dialog .kismet_page').hide();
    $('#kismet_dialog .'+name).show();
},

show_edit_dialog:
function show_edit_dialog(default_value) {
    if (default_value) {
        $('#kismet_rule_edit_name').val(default_value.name);
        $('#kismet_rule_edit_data').val(default_value.data);
    } else {
        $('#kismet_rule_edit_dialog .entry').val('');
    }
    ui.KismetDlg.rule_edit_dialog.open();
    var e = $('#kismet_rule_edit_dialog .entry:eq(0)');
    e.get(0).selectionStart = e.val().length;
    e.get(0).selectionEnd = e.val().length;
    e.focus();
},

load_guide:
function load_guide(tweet) {
    if (tweet.user != undefined) {
        var html = ui.Template.form_tweet(tweet, "kismet_guide");
        $('#kismet_guide_dialog .sample_area').html(html);
        var words = tweet.text.split(/[\s,-:;'".,。;:-]/)
            .filter(function (x) { return x.length != 0; })
            .map(function (x) {
                return '<span class="word">' + x + '</span>';
            });
        $('#kismet_guide_dialog .sample_area .text').html(words.join(' '));
    }
    $('#kismet_guide_dialog .sample_area .who_href, #kismet_guide_dialog .sample_area .word, #kismet_guide_dialog .sample_area .tweet_source > a, #kismet_guide_dialog .sample_area .hash_href')
        .unbind()
        .click(function (ev) {
            if (ev.target == this) {
                $(this).toggleClass('marked');
            }
            return false;
        });
},

save:
function save() {
    var names = $('#kismet_dialog .mute_name_list').val().split(',');
    var words = $('#kismet_dialog .mute_word_list').val().split(',');
    var sources = $('#kismet_dialog .mute_source_list').val().split(',');
    names = names.filter(function (x) { return !(/^\s*$/.test(x));});
    words = words.filter(function (x) { return !(/^\s*$/.test(x));});
    sources = sources.filter(function (x) { return !(/^\s*$/.test(x));});
    names = names.map(function (x) { return $.trim(x).toLowerCase();});
    words = words.map(function (x) { return $.trim(x);});
    sources = sources.map(function (x) { return $.trim(x);});
    kismet.mute_list = {
        name: names, word: words, source: sources
    };
    kismet.save();
},

reload_mute_list:
function reload_mute_list() {
    $('#kismet_dialog .mute_name_list').val(kismet.mute_list.name.join(', '));
    $('#kismet_dialog .mute_word_list').val(kismet.mute_list.word.join(', '));
    $('#kismet_dialog .mute_source_list').val(kismet.mute_list.source.join(', '));
},

reload_rules:
function reload_rules() {
    $('#kismet_rule_list .button').unbind();
    $('#kismet_rule_list .rule').unbind();
    $('#kismet_rule_list').empty();
    for (var i = 0; i < kismet.rules.length; i += 1) {
        var li = $('<li/>');
        var rule = $('<a class="rule"/>');
        rule.appendTo(li);
        rule.text(kismet.rules[i].name);
        rule.attr('rule_name', encodeURIComponent(kismet.rules[i].name));
        rule.attr('rule_data', encodeURIComponent(kismet.rules[i].data));
        $('<div class="item_ctrl"><a href="#" class="button edit_btn">' + _('edit') + '</a><a href="#" class="button delete_btn">'+_('delete')+'</a></div>').appendTo(li);
        li.appendTo($('#kismet_rule_list'));
    }
},

reload:
function reload() {
    ui.KismetDlg.reload_mute_list();
    ui.KismetDlg.reload_rules();
}

}