forked from GithubBackups/vichan
This commit is contained in:
commit
81e6385351
@ -107,6 +107,7 @@ $(window).ready(function() {
|
|||||||
}, 'html');
|
}, 'html');
|
||||||
}
|
}
|
||||||
$(form).find('input[type="submit"]').val(_('Posted...'));
|
$(form).find('input[type="submit"]').val(_('Posted...'));
|
||||||
|
$(document).trigger("ajax_after_post", post_response);
|
||||||
} else {
|
} else {
|
||||||
alert(_('An unknown error occured when posting!'));
|
alert(_('An unknown error occured when posting!'));
|
||||||
$(form).find('input[type="submit"]').val(submit_txt);
|
$(form).find('input[type="submit"]').val(submit_txt);
|
||||||
|
@ -43,7 +43,7 @@ var apply_css = function() {
|
|||||||
var update_textarea = function() {
|
var update_textarea = function() {
|
||||||
if (!localStorage.user_css) {
|
if (!localStorage.user_css) {
|
||||||
textarea.text("/* "+_("Enter here your own CSS rules...")+" */\n" +
|
textarea.text("/* "+_("Enter here your own CSS rules...")+" */\n" +
|
||||||
"/* "+_("If you want to make a redistributable style, be sure to\n have a Yotsuba B theme selected.")+" */\n" +
|
"/* "+_("If you want to make a redistributable style, be sure to\nhave a Yotsuba B theme selected.")+" */\n" +
|
||||||
"/* "+_("You can include CSS files from remote servers, for example:")+" */\n" +
|
"/* "+_("You can include CSS files from remote servers, for example:")+" */\n" +
|
||||||
'@import "http://example.com/style.css";');
|
'@import "http://example.com/style.css";');
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ var apply_js = function() {
|
|||||||
var update_textarea = function() {
|
var update_textarea = function() {
|
||||||
if (!localStorage.user_js) {
|
if (!localStorage.user_js) {
|
||||||
textarea.text("/* "+_("Enter here your own Javascript code...")+" */\n" +
|
textarea.text("/* "+_("Enter here your own Javascript code...")+" */\n" +
|
||||||
"/* "+_("Have a backup of your storage somewhere, as messing here\n may render you this website unusable.")+" */\n" +
|
"/* "+_("Have a backup of your storage somewhere, as messing here\nmay render you this website unusable.")+" */\n" +
|
||||||
"/* "+_("You can include JS files from remote servers, for example:")+" */\n" +
|
"/* "+_("You can include JS files from remote servers, for example:")+" */\n" +
|
||||||
'load_js("http://example.com/script.js");');
|
'load_js("http://example.com/script.js");');
|
||||||
}
|
}
|
||||||
|
87
js/show-own-posts.js
Normal file
87
js/show-own-posts.js
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* show-own-posts.js
|
||||||
|
* https://github.com/savetheinternet/Tinyboard/blob/master/js/show-op.js
|
||||||
|
*
|
||||||
|
* Adds "(You)" to a name field when the post is yours. Update references as well.
|
||||||
|
*
|
||||||
|
* Released under the MIT license
|
||||||
|
* Copyright (c) 2014 Marcin Łabanowski <marcin@6irc.net>
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
* $config['additional_javascript'][] = 'js/jquery.min.js';
|
||||||
|
* $config['additional_javascript'][] = 'js/show-own-posts.js';
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
+function(){
|
||||||
|
|
||||||
|
|
||||||
|
var update_own = function() {
|
||||||
|
if ($(this).is('.you')) return;
|
||||||
|
|
||||||
|
var thread = $(this).parents('[id^="thread_"]').first();
|
||||||
|
if (!thread.length) {
|
||||||
|
thread = $(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
var board = thread.attr('data-board');
|
||||||
|
var posts = JSON.parse(localStorage.own_posts || '{}');
|
||||||
|
|
||||||
|
var id = $(this).attr('id').split('_')[1];
|
||||||
|
|
||||||
|
console.log([board, id, posts]);
|
||||||
|
|
||||||
|
if (posts[board] && posts[board].indexOf(id) !== -1) { // Own post!
|
||||||
|
$(this).addClass('you');
|
||||||
|
$(this).find('span.name').first().append(' '+_('(You)'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update references
|
||||||
|
$(this).find('div.body:first a:not([rel="nofollow"])').each(function() {
|
||||||
|
var postID;
|
||||||
|
|
||||||
|
if(postID = $(this).text().match(/^>>(\d+)$/))
|
||||||
|
postID = postID[1];
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (posts[board].indexOf(postID) !== -1) {
|
||||||
|
$(this).after(' <small>'+_('(You)')+'</small>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var update_all = function() {
|
||||||
|
$('div[id^="thread_"], div.post.reply').each(update_own);
|
||||||
|
};
|
||||||
|
|
||||||
|
var board = null;
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
board = $('input[name="board"]').first().val();
|
||||||
|
|
||||||
|
update_all();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('ajax_after_post', function(e, r) {
|
||||||
|
var posts = JSON.parse(localStorage.own_posts || '{}');
|
||||||
|
posts[board] = posts[board] || [];
|
||||||
|
posts[board].push(r.id);
|
||||||
|
localStorage.own_posts = JSON.stringify(posts);
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('new_post', function(e,post) {
|
||||||
|
var $post = $(post);
|
||||||
|
if ($post.is('div.post.reply')) { // it's a reply
|
||||||
|
$post.each(update_own);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$post.each(update_own); // first OP
|
||||||
|
$post.find('div.post.reply').each(update_own); // then replies
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}();
|
@ -822,6 +822,10 @@ div.thread:hover {
|
|||||||
height: 300px;
|
height: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#options_div textarea {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
#options_close {
|
#options_close {
|
||||||
top: 0px;
|
top: 0px;
|
||||||
right: 0px;
|
right: 0px;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user