kopia lustrzana https://github.com/inkstitch/inkstitch
handle firefox's window.close() permission denied
rodzic
aea5919c63
commit
dc547108e1
|
@ -133,7 +133,7 @@ class PrintPreviewServer(Thread):
|
||||||
def shutdown():
|
def shutdown():
|
||||||
self.shutting_down = True
|
self.shutting_down = True
|
||||||
request.environ.get('werkzeug.server.shutdown')()
|
request.environ.get('werkzeug.server.shutdown')()
|
||||||
return 'Server shutting down...'
|
return _('Closing...') + '<br/><br/>' + _('It is safe to close this window now.')
|
||||||
|
|
||||||
@self.app.route('/resources/<path:resource>', methods=['GET'])
|
@self.app.route('/resources/<path:resource>', methods=['GET'])
|
||||||
def resources(resource):
|
def resources(resource):
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PROJECT VERSION\n"
|
"Project-Id-Version: PROJECT VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||||
"POT-Creation-Date: 2018-04-18 16:29-0400\n"
|
"POT-Creation-Date: 2018-04-18 22:30-0400\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@ -98,6 +98,12 @@ msgid ""
|
||||||
"\"Overwrite\""
|
"\"Overwrite\""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Closing..."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "It is safe to close this window now."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid ""
|
msgid ""
|
||||||
"A print preview has been opened in your web browser. This window will "
|
"A print preview has been opened in your web browser. This window will "
|
||||||
"stay open in order to communicate with the JavaScript code running in "
|
"stay open in order to communicate with the JavaScript code running in "
|
||||||
|
|
|
@ -213,6 +213,18 @@ $(function() {
|
||||||
$.post('/shutdown', {})
|
$.post('/shutdown', {})
|
||||||
.done(function(data) {
|
.done(function(data) {
|
||||||
window.close();
|
window.close();
|
||||||
|
|
||||||
|
/* Chrome and Firefox both have a rule: scripts can only close windows
|
||||||
|
* that they opened. Chrome seems to have an exception for windows that
|
||||||
|
* were opened by an outside program, so the above works fine. Firefox
|
||||||
|
* steadfastly refuses to allow us to close the window, so we'll tell
|
||||||
|
* the user (in their language) that they can close it.
|
||||||
|
*/
|
||||||
|
setTimeout(function() {
|
||||||
|
document.open();
|
||||||
|
document.write("<html><body>" + data + "</body></html>");
|
||||||
|
document.close();
|
||||||
|
}, 1000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -240,7 +252,6 @@ $(function() {
|
||||||
$('select#printing-size').change(function(){
|
$('select#printing-size').change(function(){
|
||||||
var size = $(this).find(':selected').val();
|
var size = $(this).find(':selected').val();
|
||||||
$('.page').toggleClass('a4', size == 'a4');
|
$('.page').toggleClass('a4', size == 'a4');
|
||||||
console.log("" + Date.now() + "paper size changed");
|
|
||||||
$.postJSON('/settings/paper-size', {value: size});
|
$.postJSON('/settings/paper-size', {value: size});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue