-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsearch_mobile.template
64 lines (53 loc) · 1.87 KB
/
search_mobile.template
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>metasearch based on duckduckgo !bang commands</title>
<link rel="stylesheet" href="template/github-markdown-mobile.css">
</head>
<script type="text/javascript">
var eventMethod = window.addEventListener
? "addEventListener"
: "attachEvent";
var eventer = window[eventMethod];
var messageEvent = eventMethod === "attachEvent"
? "onmessage"
: "message";
eventer(messageEvent, function (e) {
var ed = document.getElementById('textin');
if (e.data != "") {
ed.value = "!" + e.data + " ";
}
ed.focus();
});
function go() {
var bangText = document.getElementById('textin').value;
window.parent.postMessage( '{ "cmd": "query", "query": "' + bangText + '"}', '*')
}
function onTop() {
window.parent.postMessage( '{ "cmd": "top" }', '*')
}
function onLoad() {
//document.getElementById("body").style.margin = "0px 0px 0px 0px";
window.parent.postMessage( '{ "cmd": "search-load", "height": "' + document.body.offsetHeight + '" }', '*')
}
/*
window.addEventListener('DOMContentLoaded', function(e) {
var tblObj = document.getElementById( 'stbl' );
window.parent.postMessage( '{ "cmd": "resize", "size": "' + tblObj.offsetHeight + '"; }', '*')
} );
*/
</script>
<body class="markdown-body" id="body" style="margin-top: 0px; margin-left: 0px; margin-right: 0px; margin-left: 0px;" onLoad="onLoad()">
<table id="stbl" border="0">
<tr>
<td>
<form onSubmit="go()">
<input id="textin" type-"text" autocomplete="true" spellcheck="true" size="30"></a> <input type="submit" value="{{go}}"/>
</form>
</td>
<td>
<a href="javascript:onTop()">{{top}}</a>
</td>
</tr>
</table>