Skip to content
Snippets Groups Projects
Commit c2f2dedb authored by Andreas Gohr's avatar Andreas Gohr
Browse files

reset page back to normal on closing dialog

parent bcea9d64
No related branches found
No related tags found
No related merge requests found
......@@ -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);
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment