PreLoader.html
1.74 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
<body style="text-align:center;padding-top:5%;font-size:2em;">
{loading}
<script type="text/javascript">
if (parent == undefined || parent.fid == undefined) {
window.location = "../index.php";
}
var data = parent.fid();
var preview_qeury = '';
if (data.url.indexOf('?') == -1) {
preview_qeury = '?preview=1';
} else {
preview_qeury = '&preview=1';
}
document.write(
'<form action="' + data.url + preview_qeury + '" name="preview_form" method="post" style="display:none;">' +
'<input type="hidden" name="bp_preview" value="1">' +
'<input type="hidden" name="session_id" value="' + data.session_id + '">' +
'<input type="hidden" name="user" value="' + data.user + '">'
);
previewdata = [];
els = data.form.elements;
for (i = 0; i < els.length; i++) {
el = els[i];
if (!el || el.name == undefined || !el.name || (data.isjform && el.name.substr(0, 6) != "jform[")) {
continue;
}
if (el.type == "radio" || el.type == "checkbox") {
if (!el.seleceted && !el.checked) {
continue;
}
}
key = el.name;
if (data.isjform) {
key = key.replace(/^jform\[(.*)\]/, "$1");
}
key = key.replace(/(\[.*)\]/, "]$1");
if (el.type == "select-multiple") {
var vals = [];
for (j = 0; j < el.options.length; j++) {
if (el.options[j].selected) {
vals[vals.length] = el.options[j].value;
}
}
previewdata[key] = vals.join(',');
}
previewdata[key] = el.value;
}
for (key in data.overrides) {
previewdata[key] = data.overrides[key];
}
for (key in previewdata) {
document.write('<textarea name="previewdata[' + key + ']">'
+ encodeURIComponent(previewdata[key].replace(/'/g, '''))
+ '</textarea>');
}
document.write('</form>');
document.forms['preview_form'].submit();
</script>
</body>