-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrdt.js
More file actions
102 lines (87 loc) · 3.98 KB
/
rdt.js
File metadata and controls
102 lines (87 loc) · 3.98 KB
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
var rdt = function() {
var copyUrl = function() {
return window.location.href;
}
var removeBody = function() {
var bodyChildren = document.body.children;
var len = bodyChildren.length;
for (var i = 1; i <= len; i++) {
var child = bodyChildren[len - i];
child.parentNode.removeChild(child);
}
};
var addIFrame = function() {
var url = copyUrl();
var frame = document.createElement('iframe');
frame.src = url;
frame.style.width = '320px';
frame.style.height = '480px';
frame.style.backgroundColor = '#fff';
var div = document.createElement('div');
div.style.margin = '0 auto';
div.style.textAlign = 'center';
div.appendChild(frame);
var refresh = document.createElement('a');
refresh.style.color = '#fff';
refresh.innerHTML = 'Refresh the Frame';
refresh.href = 'javascript:document.getElementById(\'responsiveFrame\').src += \' \'';
refresh.style.float = 'right';
div.appendChild(refresh);
var iphone = document.createElement('a');
iphone.style.color = '#fff';
iphone.innerHTML = 'iPhone - Portrait';
iphone.href = 'javascript: document.getElementById(\'responsiveFrame\').style.width=\'320px\';document.getElementById(\'responsiveFrame\').style.height=\'480px\';';
iphone.style.float = 'right';
iphone.style.clear = 'right';
iphone.style.margin = '10px 0 0 0';
div.appendChild(iphone);
var iphone = document.createElement('a');
iphone.style.color = '#fff';
iphone.innerHTML = 'iPhone - Landscape';
iphone.href = 'javascript: document.getElementById(\'responsiveFrame\').style.width=\'480px\';document.getElementById(\'responsiveFrame\').style.height=\'320px\';';
iphone.style.float = 'right';
iphone.style.clear = 'right';
div.appendChild(iphone);
var iphone = document.createElement('a');
iphone.style.color = '#fff';
iphone.innerHTML = 'iPhone 5 - Portrait';
iphone.href = 'javascript: document.getElementById(\'responsiveFrame\').style.width=\'320px\';document.getElementById(\'responsiveFrame\').style.height=\'568px\';';
iphone.style.float = 'right';
iphone.style.clear = 'right';
iphone.style.margin = '10px 0 0 0';
div.appendChild(iphone);
var iphone = document.createElement('a');
iphone.style.color = '#fff';
iphone.innerHTML = 'iPhone 5 - Landscape';
iphone.href = 'javascript: document.getElementById(\'responsiveFrame\').style.width=\'568px\';document.getElementById(\'responsiveFrame\').style.height=\'320px\';';
iphone.style.float = 'right';
iphone.style.clear = 'right';
div.appendChild(iphone);
var iphone = document.createElement('a');
iphone.style.color = '#fff';
iphone.innerHTML = 'iPad - Portrait';
iphone.href = 'javascript: document.getElementById(\'responsiveFrame\').style.width=\'768px\';document.getElementById(\'responsiveFrame\').style.height=\'1024px\';';
iphone.style.float = 'right';
iphone.style.clear = 'right';
iphone.style.margin = '10px 0 0 0';
div.appendChild(iphone);
var iphone = document.createElement('a');
iphone.style.color = '#fff';
iphone.innerHTML = 'iPad - Landscape';
iphone.href = 'javascript: document.getElementById(\'responsiveFrame\').style.width=\'1024px\';document.getElementById(\'responsiveFrame\').style.height=\'768px\';';
iphone.style.float = 'right';
iphone.style.clear = 'right';
div.appendChild(iphone);
document.body.style.backgroundColor = '#333';
document.body.style.background = '#333';
document.body.style.backgroundImage = 'none';
document.body.appendChild(div);
};
var go = function() {
removeBody();
addIFrame();
};
return {
go: go
};
}();