summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2015-06-26 14:04:20 +0200
committerAndreas Gohr <andi@splitbrain.org>2015-06-26 14:04:20 +0200
commitc2f2dedb56cd3872aa50d58de0cb3083b36b7872 (patch)
tree48d3b3a417f0558111051dacbed5d3024ff08031 /lib
parentbcea9d64ebf4b0cc2c80209b7669e3e7e954c4c8 (diff)
downloadrpg-c2f2dedb56cd3872aa50d58de0cb3083b36b7872.tar.gz
rpg-c2f2dedb56cd3872aa50d58de0cb3083b36b7872.tar.bz2
reset page back to normal on closing dialog
Diffstat (limited to 'lib')
-rw-r--r--lib/plugins/styling/script.js31
1 files changed, 27 insertions, 4 deletions
diff --git a/lib/plugins/styling/script.js b/lib/plugins/styling/script.js
index 409148471..6fc2b9043 100644
--- a/lib/plugins/styling/script.js
+++ b/lib/plugins/styling/script.js
@@ -2,12 +2,15 @@
jQuery(function () {
+ var doreload = 1;
+
var $styling_plugin = jQuery('#plugin__styling');
if (!$styling_plugin.length) return;
// add the color picker
$styling_plugin.find('.color').iris({});
+ // add button on main page
if (!$styling_plugin.hasClass('ispopup')) {
var $hl = $styling_plugin.find('h1').first();
var $btn = jQuery('<button class="btn">' + LANG.plugins.styling.popup + '</button>');
@@ -20,6 +23,23 @@ jQuery(function () {
return;
}
+ // reload the main page on close
+ window.onunload = function(e) {
+ if(doreload) {
+ window.opener.document.location.reload();
+ }
+ return null;
+ };
+
+ // don't reload on our own buttons
+ jQuery('input[type=submit]').click(function(e){
+ doreload = false;
+ });
+
+ // remove style
+ var $style = window.opener.jQuery('link[rel=stylesheet][href*="lib/exe/css.php"]');
+ $style.attr('href', '');
+
// append the loader screen
$loader = window.opener.jQuery('#plugin__styling_loader');
if (!$loader.length) {
@@ -41,8 +61,11 @@ jQuery(function () {
window.opener.jQuery('body').append($loader);
}
- // load preview in main window
- var now = new Date().getTime();
- var $style = window.opener.jQuery('link[rel=stylesheet][href*="lib/exe/css.php"]');
- $style.attr('href', DOKU_BASE + 'lib/exe/css.php?preview=1&tseed=' + now);
+ // load preview in main window (timeout works around chrome updating CSS weirdness)
+ window.setTimeout(function() {
+ var now = new Date().getTime();
+ $style.attr('href', DOKU_BASE + 'lib/exe/css.php?preview=1&tseed=' + now);
+ }, 500);
+
+
});