summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Foster <savetheinternet@tinyboard.org>2013-09-15 10:29:35 +1000
committerMichael Foster <savetheinternet@tinyboard.org>2013-09-15 10:29:35 +1000
commit41a3f9be258c0ec5668e9f1b923f39e08a9caca2 (patch)
treea01b20243e2ce5efaa0793a4dc92a1866d1f7daf
parent91e973fd6e63cf2a81ec8618f360a79d56ee99b3 (diff)
bugfix and work with other stylesheets
-rw-r--r--js/quick-reply.js31
-rw-r--r--templates/main.js5
2 files changed, 26 insertions, 10 deletions
diff --git a/js/quick-reply.js b/js/quick-reply.js
index db0903f7..a35047aa 100644
--- a/js/quick-reply.js
+++ b/js/quick-reply.js
@@ -11,19 +11,21 @@
*
*/
-var show_quick_reply = function(){
- if($('div.banner').length == 0)
- return;
- if($('#quick-reply').length != 0)
- return;
-
- $('<style type="text/css">\
+var do_css = function() {
+ $('#quick-reply-css').remove();
+
+ // 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) {
diff --git a/templates/main.js b/templates/main.js
index a395852a..984b1976 100644
--- a/templates/main.js
+++ b/templates/main.js
@@ -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();
}