diff --git a/inc/mod/pages.php b/inc/mod/pages.php index a933f95a..734a936e 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1599,12 +1599,13 @@ function mod_edit_post($board, $edit_raw_html, $postID) { error($config['error']['404']); if (isset($_POST['name'], $_POST['email'], $_POST['subject'], $_POST['body'])) { + $trip = isset($_POST['remove_trip']) ? ' `trip` = NULL,' : ''; if ($edit_raw_html) - $query = prepare(sprintf('UPDATE ``posts_%s`` SET `name` = :name, `email` = :email, `subject` = :subject, `body` = :body, `body_nomarkup` = :body_nomarkup, `edited_at` = NOW() WHERE `id` = :id', $board)); + $query = prepare(sprintf('UPDATE ``posts_%s`` SET `name` = :name,'. $trip .' `email` = :email, `subject` = :subject, `body` = :body, `body_nomarkup` = :body_nomarkup, `edited_at` = NOW() WHERE `id` = :id', $board)); else - $query = prepare(sprintf('UPDATE ``posts_%s`` SET `name` = :name, `email` = :email, `subject` = :subject, `body_nomarkup` = :body, `edited_at` = NOW() WHERE `id` = :id', $board)); + $query = prepare(sprintf('UPDATE ``posts_%s`` SET `name` = :name,'. $trip .' `email` = :email, `subject` = :subject, `body_nomarkup` = :body, `edited_at` = NOW() WHERE `id` = :id', $board)); $query->bindValue(':id', $postID); - $query->bindValue('name', $_POST['name']); + $query->bindValue(':name', $_POST['name'] ? $_POST['name'] : $config['anonymous']); $query->bindValue(':email', $_POST['email']); $query->bindValue(':subject', $_POST['subject']); $query->bindValue(':body', $_POST['body']); diff --git a/js/disable-styles.js b/js/disable-styles.js new file mode 100644 index 00000000..c69f4e2d --- /dev/null +++ b/js/disable-styles.js @@ -0,0 +1,35 @@ +/* Adds a checkbox in the General options tab to disable and enable board style sheets. */ + +$(document).ready(function () { + var disableStyles = localStorage['disablestylesheet'] ? true : false; + /* only search for and disable board stylesheets if the user is on a page that uses them */ + if(active_page == 'ukko' || active_page == 'thread' || active_page == 'index' || active_page == 'catalog') + { + var i = 0 + while(i' + ' Disable board specific style sheets' + '') + $('#disablestyle').find('input').prop('checked', disableStyles) + } + + $('#disablestyle').on('change', function() { + if(disableStyles) { + delete localStorage.disablestylesheet + } else { + localStorage.disablestylesheet = true + } + disableStyles =! disableStyles + if(active_page == 'ukko' || active_page == 'thread' || active_page == 'index' || active_page == 'catalog') document.styleSheets[sheet].disabled = disableStyles + }) +}) diff --git a/js/favorites.js b/js/favorites.js index 39bae783..acef9c7e 100644 --- a/js/favorites.js +++ b/js/favorites.js @@ -56,7 +56,6 @@ if (active_page == 'thread' || active_page == 'index' || active_page == 'catalog $(document).ready(function(){ var favorites = JSON.parse(localStorage.favorites); var is_board_favorite = ~$.inArray(board_name, favorites); - console.log(is_board_favorite); $('header>h1').append('\u2605'); add_favorites(); diff --git a/js/inline-expanding.js b/js/inline-expanding.js index 8da66898..05300138 100644 --- a/js/inline-expanding.js +++ b/js/inline-expanding.js @@ -74,10 +74,10 @@ onready(function(){ if (still_open > 1) { if (e.target.getBoundingClientRect().top - padding < 0) - $('body').scrollTop($(e.target).parent().parent().offset().top - padding); + $(document).scrollTop($(e.target).parent().parent().offset().top - padding); } else { if (post_body[0].getBoundingClientRect().top - padding < 0) - $('body').scrollTop(post_body.offset().top - padding); + $(document).scrollTop(post_body.offset().top - padding); } } diff --git a/js/post-hover.js b/js/post-hover.js index eefb3875..94841cc5 100644 --- a/js/post-hover.js +++ b/js/post-hover.js @@ -73,6 +73,7 @@ onready(function(){ .css('font-style', 'normal') .css('z-index', '100') .css('left', '0') + .css('margin-left', '') .addClass('reply').addClass('post') .appendTo(link.closest('div.post')) diff --git a/js/show-backlinks.js b/js/show-backlinks.js index fa4865fd..4056119e 100644 --- a/js/show-backlinks.js +++ b/js/show-backlinks.js @@ -38,7 +38,8 @@ onready(function(){ var $link = $('>>' + reply_id + ''); - $link.appendTo($mentioned) + $link.appendTo($mentioned); + $link.after(" "); if (window.init_hover) { $link.each(init_hover); diff --git a/js/thread-stats.js b/js/thread-stats.js index c787bbdb..c66916f1 100644 --- a/js/thread-stats.js +++ b/js/thread-stats.js @@ -50,9 +50,12 @@ $(document).ready(function(){ ids[opID] = 0; } ids[opID]++; + var cur = op.find('>.intro >.poster_id'); + cur.find('+.posts_by_id').remove(); + cur.after(' ('+ ids[cur.text()] +')'); replies.each(function(){ - var cur = $(this).find('> .intro > .poster_id'); - cur.find('+ .posts_by_id').remove(); + cur = $(this).find('>.intro >.poster_id'); + cur.find('+.posts_by_id').remove(); cur.after(' ('+ ids[cur.text()] +')'); }); var size = function(obj) { diff --git a/js/treeview.js b/js/treeview.js index 78ad620b..1709debb 100644 --- a/js/treeview.js +++ b/js/treeview.js @@ -11,14 +11,28 @@ * */ +if (active_page == 'thread' || active_page == 'ukko' || active_page == 'index') +$(function() { + if (window.Options && Options.get_tab('general')) { + var selector = '#treeview-global>input'; + Options.extend_tab("general", ""); + $(selector).on('change', function() { + if (localStorage.treeview === 'true') { + localStorage.treeview = 'false'; + } else { + localStorage.treeview = 'true'; + } + }); + if (localStorage.treeview === 'true') { + $(selector).attr('checked', 'checked'); + } + } +}); + if (active_page == 'thread') $(function() { - $('hr:first').before('
'); - $('div#treeview a') - .text(_('Tree view')) - .click(function(e) { - e.preventDefault(); - + var treeview = function(enable) { + if (enable === true) { $('.post.reply').each(function(){ var references = []; $(this).find('.body a').each(function(){ @@ -26,7 +40,6 @@ $(function() { references.push(parseInt($(this).html().replace('>>', ''))); } }); - var maxref = references.reduce(function(a,b) { return a > b ? a : b; }, 0); var parent_post = $("#reply_"+maxref); @@ -39,7 +52,24 @@ $(function() { post.detach().css("margin-left", margin).insertAfter(parent_post.next()); br.detach().insertAfter(post); - }); - }); + } else { + $('.post.reply').sort(function(a,b) { + return parseInt(a.id.replace('reply_', '')) - parseInt(b.id.replace('reply_', '')); + }).each(function () { + var post = $(this); + var br = post.next(); + post.detach().css('margin-left', '').appendTo('.thread'); + br.detach().insertAfter(post); + }); + } + } + + $('hr:first').before('
'); + $('input#treeview').on('change', function(e) { treeview($(this).is(':checked')); }); + + if (localStorage.treeview === 'true') { + treeview(true); + $('input#treeview').attr('checked', true); + } }); diff --git a/stylesheets/style.css b/stylesheets/style.css index 4a038483..0dc481a9 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -257,7 +257,7 @@ p.intro span.capcode,p.intro a.capcode,p.intro a.nametag { } p.intro a { - margin-left: 8px; + margin-left: 5px; } div.delete { @@ -858,7 +858,7 @@ pre { #options_div { width: 600px; - height: 300px; + height: 320px; } #alert_div { @@ -925,6 +925,7 @@ pre { right: 0px; text-align: left; font-size: 12px; + overflow-y: auto; } .options_tab h2 { @@ -939,10 +940,6 @@ pre { margin-top: 0px; } -.mentioned { - word-wrap: break-word; -} - .poster_id { cursor: pointer; } diff --git a/templates/mod/edit_post_form.html b/templates/mod/edit_post_form.html index a2980d35..09dc3fcd 100644 --- a/templates/mod/edit_post_form.html +++ b/templates/mod/edit_post_form.html @@ -10,6 +10,14 @@ + + + {% trans %}Tripcode{% endtrans %} + + + Remove? + + {% trans %}Email{% endtrans %}