This commit is contained in:
8chan 2014-12-16 01:52:58 +00:00
commit d956c9a58e
10 changed files with 99 additions and 24 deletions

View File

@ -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']);

35
js/disable-styles.js Normal file
View File

@ -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<document.styleSheets.length) {
var protAndHost = window.location.protocol + '//' + window.location.host
if(document.styleSheets[i].href == protAndHost + $('link[id="stylesheet"]').attr('href'))
{
var sheet = i
document.styleSheets[sheet].disabled = disableStyles
break
}
i++
}
}
/* add the option on all pages so that the user doesn't need to goto a board to toggle it */
if (window.Options && Options.get_tab('general')){
Options.extend_tab('general','<label id=\'disablestyle\'><input type=\'checkbox\' />' + ' Disable board specific style sheets' + '</label>')
$('#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
})
})

View File

@ -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('<a id="favorite-star" href="#" data-active="'+(is_board_favorite ? 'true' : 'false')+'" style="color: '+(is_board_favorite ? 'yellow' : 'grey')+'; text-decoration:none">\u2605</span>');
add_favorites();

View File

@ -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);
}
}

View File

@ -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'))

View File

@ -38,7 +38,8 @@ onready(function(){
var $link = $('<a class="mentioned-' + reply_id + '" onclick="highlightReply(\'' + reply_id + '\');" href="#' + reply_id + '">&gt;&gt;' +
reply_id + '</a>');
$link.appendTo($mentioned)
$link.appendTo($mentioned);
$link.after(" ");
if (window.init_hover) {
$link.each(init_hover);

View File

@ -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('<span class="posts_by_id"> ('+ ids[cur.text()] +')</span>');
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('<span class="posts_by_id"> ('+ ids[cur.text()] +')</span>');
});
var size = function(obj) {

View File

@ -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", "<label id='treeview-global'><input type='checkbox' /> "+_('Use tree view by default')+"</label>");
$(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 id="treeview" style="text-align:right"><a class="unimportant" href="javascript:void(0)"></a></div>');
$('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('&gt;&gt;', '')));
}
});
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('<div class="unimportant" style="text-align:right"><label for="treeview"><input type="checkbox" id="treeview"> '+_('Tree view')+'</label></div>');
$('input#treeview').on('change', function(e) { treeview($(this).is(':checked')); });
if (localStorage.treeview === 'true') {
treeview(true);
$('input#treeview').attr('checked', true);
}
});

View File

@ -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;
}

View File

@ -10,6 +10,14 @@
<input type="text" name="name" size="25" maxlength="35" autocomplete="off" value="{{ post.name }}">
</td>
</tr>
<tr>
<th>
{% trans %}Tripcode{% endtrans %}
</th>
<td>
Remove? <input type="checkbox" name="remove_trip" value="{{ post.trip }}">
</td>
</tr>
<tr>
<th>
{% trans %}Email{% endtrans %}