savetheinternet / Tinyboard

The better imageboard software
http://tinyboard.org
Other
368 stars 311 forks source link

expand.js missing } somewhere #152

Open tunayuyar opened 10 years ago

tunayuyar commented 10 years ago

Hi,

Expand.js missing a } in code so it is not working properly. I corrected the error.

Please change this lines to fit your needs, as it is translated for Turkish.

html($(this).text().replace(("Görmek için cevapla tuşuna tıklayın."), ''+("Genişletmek için tıklayın")+'.'))

Code below: /*

$(document).ready(function(){ if($('span.omitted').length == 0) return; // nothing to expand

var do_expand = function() {
    $(this)
        .html($(this).text().replace(_("Görmek için cevapla tuşuna tıklayın."), '<a href="javascript:void(0)">'+_("Genişletmek için tıklayın")+'</a>.'))
        .find('a').click(function() {
            var thread = $(this).parent().parent().parent();
            var id = thread.attr('id').replace(/^thread_/, '');
            $.ajax({
                url: thread.find('p.intro a.post_no:first').attr('href'),
                context: document.body,
                success: function(data) {
                    var last_expanded = false;
                    $(data).find('div.post.reply').each(function() {
                        thread.find('.hidden').remove();
                        var post_in_doc = thread.find('#' + $(this).attr('id'));
                        if(post_in_doc.length == 0) {
                            if(last_expanded) {
                                $(this).addClass('expanded').insertAfter(last_expanded).before('<br class="expanded">');
                            } else {
                                $(this).addClass('expanded').insertAfter(thread.find('div.post:first')).after('<br class="expanded">');
                            }
                            last_expanded = $(this);
                            $(document).trigger('new_post', this);
                        } else {
                            last_expanded = post_in_doc;
                        }
                    });
                    $('<span class="omitted"><a href="javascript:void(0)">' + _('Hide expanded replies') + '</a>.</span>')
                        .insertAfter(thread.find('span.omitted').css('display', 'none'))
                        .click(function() {
                            thread.find('.expanded').remove();
                            $(this).prev().css('display', '');
                            $(this).remove();
                        });
                }
            });
        });
}

$('div.post.op span.omitted').each(do_expand);

$(document).bind("new_post", function(e, post) {
    if (!$(post).hasClass("reply")) {
        $(post).find('div.post.op span.omitted').each(do_expand);
    }
});

});

czaks commented 10 years ago

Yes, STI probably messed it up a little during merging it from my branch.

Wrt translations: these can be handled using gettext, i've posted somewhere on /sup/ board how to do it

tunayuyar commented 10 years ago

About translation thing: I just wanted to give heads up, who will copy paste it from here because I changed text in templates, so thought that code needs to replace that exact text in it.Im have no knowledge of coding :).

It is good that contributing software you use, this was my first post on github.