-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdpla-search-widget.js
More file actions
45 lines (34 loc) · 1.36 KB
/
dpla-search-widget.js
File metadata and controls
45 lines (34 loc) · 1.36 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
var DPLAWidgetConfig = {
css_href: 'http://dp.la/info/wp-content/uploads/2013/12/dpla-search-widget.css',
dpla_logo: 'http://dp.la/info/wp-content/uploads/2013/12/dpla-search-widget-logo.png'
};
;(window.onload = function() {
var css = document.createElement('link');
css.href = DPLAWidgetConfig.css_href;
css.type = 'text/css';
css.rel = 'stylesheet';
var headTag = document.getElementsByTagName('head')[0];
headTag.appendChild(css);
var widgetImg = document.createElement('img');
widgetImg.src = DPLAWidgetConfig.dpla_logo;
widgetImg.title = 'Search the DPLA!';
widgetImg.alt = 'Search the DPLA!';
var form = document.createElement('form');
form.method = 'get';
form.action = 'http://dp.la/search';
form.name = 'dpla_search_widget';
var widgetInputDiv = document.createElement('div');
widgetInputDiv.id = 'dpla-form-input';
var search = document.createElement('input');
search.type = 'text';
search.placeholder = 'Search the DPLA!';
search.name = 'q';
var submit = document.createElement('input');
submit.type = 'submit';
submit.value = 'Search';
form.appendChild(widgetImg);
form.appendChild(search);
form.appendChild(submit);
var search_div = document.getElementById("dpla_search_widget");
search_div.appendChild(form);
})();