mirror of
https://bitbucket.org/grumdrig/pq-web.git
synced 2026-09-29 08:44:00 -06:00
W key opens the game in a bare popup
This commit is contained in:
@@ -60,6 +60,25 @@ div.progress-container:hover div.hint {
|
||||
width: 686px;
|
||||
}
|
||||
|
||||
body.bare #main.window {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
/*
|
||||
This is goood to get rid of in chrome, but other browsers don't have a sensible
|
||||
title bar (on Mac at least)
|
||||
*/
|
||||
|
||||
body.bare #titlebar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
_::-webkit-full-page-media, _:future, :root body.bare #titlebar {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
#Trats,
|
||||
#Plots, #Plots table,
|
||||
#Quests, #Quests table {
|
||||
|
||||
@@ -990,8 +990,39 @@ function FormCreate() {
|
||||
|
||||
var name = unescape(window.location.href.split('#')[1]);
|
||||
storage.loadSheet(name, LoadGame);
|
||||
|
||||
if (window.opener) {
|
||||
// Opened as a popup, so go bare style
|
||||
prepPopup();
|
||||
}
|
||||
}
|
||||
|
||||
function prepPopup() {
|
||||
document.body.classList.add("bare");
|
||||
window.resizeBy($("#main")[0].offsetWidth - window.innerWidth,
|
||||
$("#main")[0].offsetHeight - window.innerHeight);
|
||||
|
||||
let titlebar = $("#titlebar");
|
||||
let delta;
|
||||
|
||||
titlebar.on("mousedown", e => {
|
||||
delta = {
|
||||
x: e.pageX,
|
||||
y: e.pageY
|
||||
};
|
||||
console.log(delta);
|
||||
});
|
||||
|
||||
$("html").on("mouseup", e => { delta = null; });
|
||||
|
||||
$("html").on("mousemove", e => {
|
||||
if (!e.which) delta = null;
|
||||
if (delta) {
|
||||
window.moveBy(e.pageX - delta.x,
|
||||
e.pageY - delta.y);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function pause(msec) {
|
||||
@@ -1004,7 +1035,13 @@ function pause(msec) {
|
||||
|
||||
function quit() {
|
||||
$(window).unbind('unload');
|
||||
SaveGame(function () { window.location.href = "roster.html"; });
|
||||
SaveGame(() => {
|
||||
if (window.opener) {
|
||||
window.close();
|
||||
} else {
|
||||
window.location.href = "roster.html";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1163,6 +1200,20 @@ function FormKeyDown(e) {
|
||||
alert('Saved (' + JSON.stringify(game).length + ' bytes).');
|
||||
}
|
||||
|
||||
if (key === 'w') {
|
||||
if (window.opener) return;
|
||||
$(window).unbind('unload'); // we're about to save it anyway
|
||||
SaveGame(() => {
|
||||
let ext = window.open(window.location.href, "Progress Quest",
|
||||
`resizable,width=${$("#main")[0].offsetWidth},height=${$("#main")[0].offsetHeight},popup,location=0`);
|
||||
console.log(ext);
|
||||
if(ext && !ext.closed && typeof ext.closed !== 'undefined') {
|
||||
// popup was apparently not blocked
|
||||
window.location.href = "roster.html"; // this window can go back to the roster
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
if (key === 't') {
|
||||
TaskBar.reposition(TaskBar.Max());
|
||||
|
||||
@@ -112,6 +112,10 @@ body {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
body.bare {
|
||||
background: silver;
|
||||
}
|
||||
|
||||
div.scroll {
|
||||
overflow: scroll;
|
||||
height: 100px;
|
||||
|
||||
Reference in New Issue
Block a user