-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
89 lines (73 loc) · 3.46 KB
/
demo.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
<!DOCTYPE html>
<html>
<head>
<title>Featurely</title>
<style></style>
<script type="text/javascript">
function buildURI(){
//get textbox
var txtJiraID = document.getElementById("txtJiraID");
//build URL
var txtURIPrefix = "https://feature-";
var txtURISuffux = ".inshur.com";
var txtURI = txtURIPrefix + txtJiraID.value + txtURISuffux;
//output
txtOutput = document.getElementById("txtOutput");
//txtOutput.value = txtURI;
//window.location.href = txtURI;
window.open(
txtURI,
'_blank' // <- _blank for new window. _self for same window.
);
//update list
var maxItems = 3; // Set max list length
var newItem = document.createElement("LI"); // Create a <li> node
var newLink = document.createElement("A"); // Create and populate link href
newLink.setAttribute('href', txtURI);
newLink.setAttribute('target', '_blank');
var textNode = document.createTextNode(txtURI); // Create a text node for link text
newLink.appendChild(textNode); // Append the text to <a>
newItem.appendChild(newLink); // Append a to li
//write URL to top of list
var list = document.getElementById("ulFeatureList");
list.insertBefore(newItem, list.childNodes[0]);
// If the <ul> element now has more than maxItems, remove its last child node
var itemCount = list.children.length;
//var itemCount = list.childElementCount(); //not working??
//txtOutput.value = itemCount;
//window.alert("tezt");
if (itemCount > maxItems) {
list.removeChild(list.childNodes[maxItems]);
}
}
</script>
</head>
<body>
<div class="header">
<h1>Featurely</h1>
<h2>Feature Server URL Builder</h2>
</div>
<form >
<fieldset>
<label>Enter Jira ID: </label>
<input type="text"
id = "txtJiraID"
value="IN-" />
<input type="button"
value="Launch Nuke"
onclick="buildURI()" />
<!-- <input type="text"
id = "txtOutput" /> -->
</fieldset>
</form>
<div>
<h2>Previous Entries</h2>
<div class="list" id="list">
<ul id="ulFeatureList">
<!--stub seed data-->
<!-- <li><a href="https://feature-IN-3333.inshur.com" target="_blank">https://feature-IN-3333.inshur.com</a></li><li><a href="https://feature-IN-2222.inshur.com" target="_blank">https://feature-IN-2222.inshur.com</a></li><li><a href="https://feature-IN-1111.inshur.com" target="_blank">https://feature-IN-1111.inshur.com</a></li> -->
</ul>
</div>
</div>
</body>
</html>