-
Notifications
You must be signed in to change notification settings - Fork 0
/
index-d3.html
188 lines (156 loc) · 6 KB
/
index-d3.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!-- Based off of draggable.html accompanying chapter12:
<p>JavaScript & jQuery: The Missing Manual, 3rd Edition, by <a href="http://sawmac.com/">David McFarland</a>. Published by <a href="http://oreilly.com/">O'Reilly Media, Inc</a>.</p>
-->
<!DOCTYPE html>
<html>
<head>
<link rel = "stylesheet" type="text/css" href="css/style.css">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width" orientation="portrait">
<link rel="stylesheet" href="css/jquery-ui.css">
<!-- <link rel="stylesheet" href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> -->
<!-- <link rel="stylesheet" href="http://localhost/test/sites/all/modules/jquery_update/replace/ui/themes/base/jquery-ui.css"> -->
<link rel="stylesheet" href="css/index-adid-strip-button.css">
<script src="node_modules/requirejs/require.js"></script>
<script src="./js/1-bootstrap.js" data-modules="effect">
require(['d3sketch'], function(d3sketch) {
// require(['isthebest'], function(isthebest) {
$( function() {
var dialog, form,
name = $( "#name" );
function addUser() {
// var siteDomain = "http://localhost:8080/marmotta/sparql?query=";
alert(name.val());
// $( "#users" ).append( name.val() );
// I only want to append if name.val() ) resolves... (so I need to do an xmlhttp request...)
// alert('hello!');
// I added the following two lines of code to allow for overwriting
var container = document.getElementById('graphcontainer');
container.innerHTML = '';
$("#graphcontainer").append( d3sketch(name.val()) );
// $("#graphcontainer").replaceWith( d3sketch(name.val()) );
// $( "#users" ).append( siteDomain + encodeURIComponent(name.val()) );
dialog.dialog( "close" );
}
dialog = $( "#dialog-form" ).dialog({
autoOpen: false,
height: 220,
width: 285,
modal: true,
buttons: {
"Execute": addUser,
Cancel: function() {
dialog.dialog( "close" );
}
},
close: function() {
form[ 0 ].reset();
}
});
form = dialog.find( "form" ).on( "submit", function( event ) {
event.preventDefault();
addUser();
});
$( "#create-user" ).button().on( "click", function() {
dialog.dialog( "open" );
});
$("#loadfileldpbutton").button().on("click", function() {
// alert("howdy");
var $field = $('#textfield');
var fieldVal = $field.val();
alert(fieldVal);
if(fieldVal) {
// erase the present contents of the graphcontainer container
var container = document.getElementById('graphcontainer');
container.innerHTML = '';
// add new content to the graphcontainer container
// $('#graphcontainer').append(fieldVal);
// $('#graphcontainer').append(isthebest(fieldVal));
$('#graphcontainer').append(d3sketch(fieldVal));
// $('#graphcontainer').replaceWith(d3sketch(fieldVal));
// $('#tasklist').replaceWith(d3sketch(fieldVal));
$field.val('');
$field.focus();
}
});
/*
function isthebest(value) {
return value+" is the best!";
}
*/
/*
$( "#loadfileldpbutton" ).button().on( "click", function() {
var $field = $('#textfield');
var fieldVal = $field.val();
if(fieldVal) {
// erase the present contents of the graphcontainer container
var container = document.getElementById('graphcontainer');
container.innerHTML = '';
// add new content to the graphcontainer container via the tasklist id
$('#tasklist').replaceWith(d3sketch(fieldVal));
$field.val('');
$field.focus();
}
});
*/
} );
});
</script>
<!--end McFarland's book -->
</head>
<body>
<!-- Modified McFarland Book code -->
<div id="dialog-form" title="SPARQL Endpoint">
<form>
<fieldset>
<label for="name">Do your SPARQL Query here:</label>
<input type="text" name="name" id="name" value="Jane Smith" class="text ui-widget-content ui-corner-all">
<input type="submit" tabindex="-1" style="position:absolute; top:-1000px">
</fieldset>
</form>
</div>
<div class="wrapper">
<div style="background-color:#EEEEEE" class="box a">
<button id="create-user">SPARQL Endpoint</button>
<!-- <input name="button" type="button" id="create-user" value="SPARQL Endpoint"> -->
<input name="textfield" type="text" id="textfield">
<button id="loadfileldpbutton">Load File / LDP Container</button>
<!-- <input name="button" type="button" id="button" value="Load File / LDP Container"> -->
<!--
<div style="width:100px"> --> <!-- for now this will set the width of the text field. I need to work -->
<!--
<input type="text" name="name" id="loadfileldptext" value="miserables.json" class="text ui-widget-content ui-corner-all">
</div>
-->
<span>History:</span>
<img src="buttons/history-rewind.svg" width="auto" height="20px">
<img src="buttons/history-backward-one.svg" width="auto" height="20px">
<img src="buttons/history-forward-one-1.svg" width="auto" height="20px">
<img src="buttons/history-fast-forward-1.svg" width="auto" height="20px">
<img src="buttons/history-animation.svg" width="auto" height="20px">
<img src="buttons/history-stop-animation.svg" width="auto" height="20px">
</div>
<div class="box b">
<div class="box ba">BA
<img src="buttons/view-directed-graph.svg" height="auto" width="60px">
<img src="buttons/view-raw-triples.svg" height="auto" width="60px">
</div>
<div class="box bb">BB</div>
<div class="box bc">BC</div>
</div>
<div class="box c" id="graphcontainer">
<!--
<script src="https://d3js.org/d3.v4.min.js"></script>
<script>
// var file = "miserables.json";
//d3sketch(file);
</script>
-->
</div>
<div class="box d">
<div class="box da" id="users">DA</div>
<div class="box db">DB</div>
</div>
</div>
</body>
</html>