-
Notifications
You must be signed in to change notification settings - Fork 0
/
windowopen.html
147 lines (121 loc) · 5.94 KB
/
windowopen.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<!DOCTYPE html>
<html>
<head>
<style>
html, .scroller {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFpSURBVHhe7durEcJAAEVRgsXRCPVCRziQUAI/BdhgKCDXZSYn+oqds2/idhjHcTWz7/z67LabmR1qdbje13M705zPAyvcDixYQSCklgUrCITUsmAFgZBaFqwgEFLLghUEQmpZsIJASC0LVhAIqWXBCgIhtSxYQSCklgUrCITUsmAFgZBaFqwgEFLLghUEQmpZsIJASC0LVhAIqWXBCgIhtSxYQSCklgUrCITUsmAFgZBaFqwgEFLLghUEQmpZsIJASC0LVhAI6XB6vkO+4PT4+A5esk4cgJesE6H+mR988IIFKwiE1LJgBYGQWhasIBBSy4IVBEJqWbCCQEgtC1YQCKllwQoCIbUsWEEgpJYFKwiE1LJgBYGQWhasIBBSy4IVBEJqWbCCQEgtC1YQCKllwQoCIbUsWEEgpJYFKwiE1LJgBYGQWhasIBBSy4IVBEJqWbCCQEgtC1YQCKllwQoCIR32l1vIl53+AI/JGTUBmZViAAAAAElFTkSuQmCC) repeat local;
}
.scroller {
width: 400px;
height: 400px;
overflow: scroll;
position: relative;
}
.makeitscroll {
width: 1px;
height: 1px;
position: absolute;
top: 4000px;
left: 4000px;
}
</style>
<script>
var windowHandle;
function openWindow() {
var args = [];
var widthArg = document.getElementById("widtharg").value;
if(widthArg != "") args.push("width=" + widthArg);
var heightArg = document.getElementById("heightarg").value;
if(heightArg != "") args.push("height=" + heightArg);
var outerWidthArg = document.getElementById("outerwidtharg").value;
if(outerWidthArg != "") args.push("outerWidth=" + outerWidthArg);
var outerHeightArg = document.getElementById("outerheightarg").value;
if(outerHeightArg != "") args.push("outerHeight=" + outerHeightArg);
var innerWidthArg = document.getElementById("innerwidtharg").value;
if(innerWidthArg != "") args.push("innerWidth=" + innerWidthArg);
var innerHeightArg = document.getElementById("innerheightarg").value;
if(innerHeightArg != "") args.push("innerHeight=" + innerHeightArg);
var leftArg = document.getElementById("leftarg").value;
if(leftArg != "") args.push("left=" + leftArg);
var topArg = document.getElementById("toparg").value;
if(topArg != "") args.push("top=" + topArg);
var screenXArg = document.getElementById("screenxarg").value;
if(screenXArg != "") args.push("screenX=" + screenXArg);
var screenYArg = document.getElementById("screenyarg").value;
if(screenYArg != "") args.push("screenY=" + screenYArg);
var customArgs = document.getElementById("customargs").value;
if(customArgs != "") args.push(customArgs);
console.log("window.open(\"testprops.html\", \"TestPopup\", \"" + args.join(",") + "\")");
windowHandle = window.open("testprops.html", "TestPopup", args.join(","));
}
function moveToWindow() {
var args = [];
var leftMoveArg = document.getElementById("leftmovearg").value;
var topMoveArg = document.getElementById("topmovearg").value;
console.log("window.moveTo(" + leftMoveArg + ", " + topMoveArg + ")");
windowHandle.moveTo(leftMoveArg, topMoveArg);
}
function moveByWindow() {
var args = [];
var leftMoveArg = document.getElementById("leftmovearg").value;
var topMoveArg = document.getElementById("topmovearg").value;
console.log("window.moveBy(" + leftMoveArg + ", " + topMoveArg + ")");
windowHandle.moveBy(leftMoveArg, topMoveArg);
}
function resizeToWindow() {
var args = [];
var widthResizeArg = document.getElementById("widthresizearg").value;
var heightResizeArg = document.getElementById("heightresizearg").value;
console.log("window.resizeTo(" + widthResizeArg + ", " + heightResizeArg + ")");
windowHandle.resizeTo(widthResizeArg, heightResizeArg);
}
function resizeByWindow() {
var args = [];
var widthResizeArg = document.getElementById("widthresizearg").value;
var heightResizeArg = document.getElementById("heightresizearg").value;
console.log("window.resizeBy(" + widthResizeArg + ", " + heightResizeArg + ")");
windowHandle.resizeBy(widthResizeArg, heightResizeArg);
}
function handleLoad() {
document.getElementById("openbutton").addEventListener("click", openWindow);
document.getElementById("movetobutton").addEventListener("click", moveToWindow);
document.getElementById("movebybutton").addEventListener("click", moveByWindow);
document.getElementById("resizetobutton").addEventListener("click", resizeToWindow);
document.getElementById("resizebybutton").addEventListener("click", resizeByWindow);
}
function hangTime(time) {
var startTime = (new Date).getTime();
var endTime = startTime + time;
while((new Date).getTime() < endTime){
//wait for it...
}
}
document.addEventListener("DOMContentLoaded", handleLoad);
</script>
</head>
<body>
window.open():<br>
width=<input type="text" id="widtharg"><br>
height=<input type="text" id="heightarg"><br>
outerWidth=<input type="text" id="outerwidtharg"><br>
outerHeight=<input type="text" id="outerheightarg"><br>
innerWidth=<input type="text" id="innerwidtharg"><br>
innerHeight=<input type="text" id="innerheightarg"><br>
left=<input type="text" id="leftarg"><br>
top=<input type="text" id="toparg"><br>
screenX=<input type="text" id="screenxarg"><br>
screenY=<input type="text" id="screenyarg"><br>
Further custom args: <input type="text" id="customargs"><br>
<button id="openbutton">Open popup with these args</button><br>
<br>
window.moveTo(), window.moveBy()<br>
Left: <input type="text" id="leftmovearg"><br>
Top: <input type="text" id="topmovearg"><br>
<button id="movetobutton">moveTo popup with these args</button><button id="movebybutton">moveBy popup with these args</button>
<br>
window.resizeTo(), window.resizeBy()<br>
Width: <input type="text" id="widthresizearg"><br>
Height: <input type="text" id="heightresizearg"><br>
<button id="resizetobutton">resizeTo popup with these args</button><button id="resizebybutton">resizeBy popup with these args</button>
</body>
</html>