forked from GithubBackups/vichan
This commit is contained in:
commit
d956c9a58e
@ -1599,12 +1599,13 @@ function mod_edit_post($board, $edit_raw_html, $postID) {
|
|||||||
error($config['error']['404']);
|
error($config['error']['404']);
|
||||||
|
|
||||||
if (isset($_POST['name'], $_POST['email'], $_POST['subject'], $_POST['body'])) {
|
if (isset($_POST['name'], $_POST['email'], $_POST['subject'], $_POST['body'])) {
|
||||||
|
$trip = isset($_POST['remove_trip']) ? ' `trip` = NULL,' : '';
|
||||||
if ($edit_raw_html)
|
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
|
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(':id', $postID);
|
||||||
$query->bindValue('name', $_POST['name']);
|
$query->bindValue(':name', $_POST['name'] ? $_POST['name'] : $config['anonymous']);
|
||||||
$query->bindValue(':email', $_POST['email']);
|
$query->bindValue(':email', $_POST['email']);
|
||||||
$query->bindValue(':subject', $_POST['subject']);
|
$query->bindValue(':subject', $_POST['subject']);
|
||||||
$query->bindValue(':body', $_POST['body']);
|
$query->bindValue(':body', $_POST['body']);
|
||||||
|
35
js/disable-styles.js
Normal file
35
js/disable-styles.js
Normal 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
|
||||||
|
})
|
||||||
|
})
|
@ -56,7 +56,6 @@ if (active_page == 'thread' || active_page == 'index' || active_page == 'catalog
|
|||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
var favorites = JSON.parse(localStorage.favorites);
|
var favorites = JSON.parse(localStorage.favorites);
|
||||||
var is_board_favorite = ~$.inArray(board_name, 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>');
|
$('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();
|
add_favorites();
|
||||||
|
@ -74,10 +74,10 @@ onready(function(){
|
|||||||
|
|
||||||
if (still_open > 1) {
|
if (still_open > 1) {
|
||||||
if (e.target.getBoundingClientRect().top - padding < 0)
|
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 {
|
} else {
|
||||||
if (post_body[0].getBoundingClientRect().top - padding < 0)
|
if (post_body[0].getBoundingClientRect().top - padding < 0)
|
||||||
$('body').scrollTop(post_body.offset().top - padding);
|
$(document).scrollTop(post_body.offset().top - padding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ onready(function(){
|
|||||||
.css('font-style', 'normal')
|
.css('font-style', 'normal')
|
||||||
.css('z-index', '100')
|
.css('z-index', '100')
|
||||||
.css('left', '0')
|
.css('left', '0')
|
||||||
|
.css('margin-left', '')
|
||||||
.addClass('reply').addClass('post')
|
.addClass('reply').addClass('post')
|
||||||
.appendTo(link.closest('div.post'))
|
.appendTo(link.closest('div.post'))
|
||||||
|
|
||||||
|
@ -38,7 +38,8 @@ onready(function(){
|
|||||||
|
|
||||||
var $link = $('<a class="mentioned-' + reply_id + '" onclick="highlightReply(\'' + reply_id + '\');" href="#' + reply_id + '">>>' +
|
var $link = $('<a class="mentioned-' + reply_id + '" onclick="highlightReply(\'' + reply_id + '\');" href="#' + reply_id + '">>>' +
|
||||||
reply_id + '</a>');
|
reply_id + '</a>');
|
||||||
$link.appendTo($mentioned)
|
$link.appendTo($mentioned);
|
||||||
|
$link.after(" ");
|
||||||
|
|
||||||
if (window.init_hover) {
|
if (window.init_hover) {
|
||||||
$link.each(init_hover);
|
$link.each(init_hover);
|
||||||
|
@ -50,8 +50,11 @@ $(document).ready(function(){
|
|||||||
ids[opID] = 0;
|
ids[opID] = 0;
|
||||||
}
|
}
|
||||||
ids[opID]++;
|
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(){
|
replies.each(function(){
|
||||||
var cur = $(this).find('> .intro > .poster_id');
|
cur = $(this).find('>.intro >.poster_id');
|
||||||
cur.find('+.posts_by_id').remove();
|
cur.find('+.posts_by_id').remove();
|
||||||
cur.after('<span class="posts_by_id"> ('+ ids[cur.text()] +')</span>');
|
cur.after('<span class="posts_by_id"> ('+ ids[cur.text()] +')</span>');
|
||||||
});
|
});
|
||||||
|
@ -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')
|
if (active_page == 'thread')
|
||||||
$(function() {
|
$(function() {
|
||||||
$('hr:first').before('<div id="treeview" style="text-align:right"><a class="unimportant" href="javascript:void(0)"></a></div>');
|
var treeview = function(enable) {
|
||||||
$('div#treeview a')
|
if (enable === true) {
|
||||||
.text(_('Tree view'))
|
|
||||||
.click(function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
$('.post.reply').each(function(){
|
$('.post.reply').each(function(){
|
||||||
var references = [];
|
var references = [];
|
||||||
$(this).find('.body a').each(function(){
|
$(this).find('.body a').each(function(){
|
||||||
@ -26,7 +40,6 @@ $(function() {
|
|||||||
references.push(parseInt($(this).html().replace('>>', '')));
|
references.push(parseInt($(this).html().replace('>>', '')));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var maxref = references.reduce(function(a,b) { return a > b ? a : b; }, 0);
|
var maxref = references.reduce(function(a,b) { return a > b ? a : b; }, 0);
|
||||||
|
|
||||||
var parent_post = $("#reply_"+maxref);
|
var parent_post = $("#reply_"+maxref);
|
||||||
@ -39,7 +52,24 @@ $(function() {
|
|||||||
|
|
||||||
post.detach().css("margin-left", margin).insertAfter(parent_post.next());
|
post.detach().css("margin-left", margin).insertAfter(parent_post.next());
|
||||||
br.detach().insertAfter(post);
|
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);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
@ -257,7 +257,7 @@ p.intro span.capcode,p.intro a.capcode,p.intro a.nametag {
|
|||||||
}
|
}
|
||||||
|
|
||||||
p.intro a {
|
p.intro a {
|
||||||
margin-left: 8px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.delete {
|
div.delete {
|
||||||
@ -858,7 +858,7 @@ pre {
|
|||||||
|
|
||||||
#options_div {
|
#options_div {
|
||||||
width: 600px;
|
width: 600px;
|
||||||
height: 300px;
|
height: 320px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#alert_div {
|
#alert_div {
|
||||||
@ -925,6 +925,7 @@ pre {
|
|||||||
right: 0px;
|
right: 0px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.options_tab h2 {
|
.options_tab h2 {
|
||||||
@ -939,10 +940,6 @@ pre {
|
|||||||
margin-top: 0px;
|
margin-top: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mentioned {
|
|
||||||
word-wrap: break-word;
|
|
||||||
}
|
|
||||||
|
|
||||||
.poster_id {
|
.poster_id {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,14 @@
|
|||||||
<input type="text" name="name" size="25" maxlength="35" autocomplete="off" value="{{ post.name }}">
|
<input type="text" name="name" size="25" maxlength="35" autocomplete="off" value="{{ post.name }}">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
{% trans %}Tripcode{% endtrans %}
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
Remove? <input type="checkbox" name="remove_trip" value="{{ post.trip }}">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
{% trans %}Email{% endtrans %}
|
{% trans %}Email{% endtrans %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user