1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-25 16:00:22 +01:00

bugfix and work with other stylesheets

This commit is contained in:
Michael Foster 2013-09-15 10:29:35 +10:00
parent 448d090af8
commit 9bffc85a66
2 changed files with 26 additions and 10 deletions

View File

@ -11,19 +11,21 @@
*
*/
var show_quick_reply = function(){
if($('div.banner').length == 0)
return;
if($('#quick-reply').length != 0)
return;
var do_css = function() {
$('#quick-reply-css').remove();
$('<style type="text/css">\
// Find background of reply posts
var dummy_reply = $('<div class="post reply"></div>').appendTo($('body'));
var reply_background = dummy_reply.css('background');
dummy_reply.remove();
$('<style type="text/css" id="quick-reply-css">\
#quick-reply {\
position: fixed;\
right: 0;\
top: 5%;\
float: right;\
background: #D6DAF0;\
background: ' + reply_background + ';\
display: block;\
padding: 0 0 0 0;\
width: 350px;\
@ -84,6 +86,17 @@ var show_quick_reply = function(){
}\
</style>').appendTo($('head'));
console.log('h');
};
var show_quick_reply = function(){
if($('div.banner').length == 0)
return;
if($('#quick-reply').length != 0)
return;
do_css();
var $postForm = $('form[name="post"]').clone();
$postForm.clone();
@ -193,7 +206,7 @@ var show_quick_reply = function(){
$postForm.fadeOut(100);
else
$postForm.fadeIn(100);
});
}).on('stylesheet', do_css);
};
$(window).on('cite', function(e, id, with_link) {

View File

@ -67,6 +67,9 @@ function changeStyle(styleName, link) {
if (link) {
link.className = 'selected';
}
if (typeof $ != 'undefined')
$(window).trigger('stylesheet', styleName);
}
@ -198,7 +201,7 @@ function citeReply(id, with_link) {
// ???
body.value += '>>' + id + '\n';
}
if ($) {
if (typeof $ != 'undefined') {
$(window).trigger('cite', [id, with_link]);
$(body).change();
}