Browse Source

bugfix and work with other stylesheets

pull/40/head
Michael Foster 11 years ago
parent
commit
41a3f9be25
  1. 31
      js/quick-reply.js
  2. 5
      templates/main.js

31
js/quick-reply.js

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

5
templates/main.js

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

Loading…
Cancel
Save