@@ -138,11 +138,11 @@ function demo() {
138
138
case 's' :
139
139
return "Sparse (U)" ;
140
140
case 'u' :
141
- return "Sparse (¬ ;U)"
141
+ return "Sparse (¬ ;U)"
142
142
case 'q' :
143
143
return "Singleton (U)" ;
144
144
case 'c' :
145
- return "Singleton (¬ ;U)" ;
145
+ return "Singleton (¬ ;U)" ;
146
146
default :
147
147
return "" ;
148
148
}
@@ -185,43 +185,45 @@ function demo() {
185
185
listTensorsBody += "<li id=\"" ;
186
186
listTensorsBody += id ;
187
187
listTensorsBody += "\" class=\"ui-state-default\">" ;
188
- listTensorsBody += "<div class=\"mdl-textfield mdl-js-textfield " ;
188
+ listTensorsBody += "<div class=\"dropdown mdl-textfield mdl-js-textfield " ;
189
189
listTensorsBody += "mdl-textfield--floating-label getmdl-select\" " ;
190
190
listTensorsBody += "style=\"cursor: move\">" ;
191
191
listTensorsBody += "<input class=\"mdl-textfield__input " ;
192
- listTensorsBody += "format-input\" id=\"" ;
192
+ listTensorsBody += "format-input\" data-toggle=\"dropdown\" id=\"" ;
193
193
listTensorsBody += selectId ;
194
194
listTensorsBody += "\" type=\"text\" readonly " ;
195
195
listTensorsBody += "value=\"" ;
196
196
listTensorsBody += tblFormatsView . getFormatString ( format ) ;
197
197
listTensorsBody += "\" data-val=\"" ;
198
198
listTensorsBody += format ;
199
199
listTensorsBody += "\"/>" ;
200
- listTensorsBody += "<label for=\"" ;
201
- listTensorsBody += selectId
202
- listTensorsBody += "\">" ;
200
+ listTensorsBody += "<label>" ;
203
201
listTensorsBody += "<i class=\"mdl-icon-toggle__label " ;
204
202
listTensorsBody += "material-icons\">keyboard_arrow_down</i>" ;
205
203
listTensorsBody += "</label>" ;
206
- listTensorsBody += "<label class=\"mdl-textfield__label\" for=\"" ;
207
- listTensorsBody += selectId ;
208
- listTensorsBody += "\">Dimension " ;
204
+ listTensorsBody += "<label class=\"mdl-textfield__label\">Dimension " ;
209
205
listTensorsBody += ( dim + 1 ) ;
210
206
listTensorsBody += "</label>" ;
211
- listTensorsBody += "<ul class=\"mdl-menu mdl-menu--bottom-left " ;
212
- listTensorsBody += "mdl-js-menu\" for=\"" ;
207
+ listTensorsBody += "<ul class=\"dropdown-menu\" for=\""
213
208
listTensorsBody += selectId ;
214
- listTensorsBody += "\">" ;
215
- listTensorsBody += "<li class=\"mdl-menu__item\" data-val=\"" ;
216
- listTensorsBody += "d\">Dense</li>" ;
217
- listTensorsBody += "<li class=\"mdl-menu__item\" data-val=\"" ;
218
- listTensorsBody += "s\">Sparse (U)</li>" ;
219
- listTensorsBody += "<li class=\"mdl-menu__item\" data-val=\"" ;
220
- listTensorsBody += "u\">Sparse (¬U)</li>" ;
221
- listTensorsBody += "<li class=\"mdl-menu__item\" data-val=\"" ;
222
- listTensorsBody += "q\">Singleton (U)</li>" ;
223
- listTensorsBody += "<li class=\"mdl-menu__item\" data-val=\"" ;
224
- listTensorsBody += "c\">Singleton (¬U) </li>" ;
209
+ listTensorsBody += "\"><li class =\"dense\"><a data-val=\""
210
+ listTensorsBody += "d\">Dense</a></li>" ;
211
+ listTensorsBody += "<li class=\"sparse dropdown-submenu\">" ;
212
+ listTensorsBody += "<a>Sparse" ;
213
+ listTensorsBody += "<i class=\"material-icons\" style=\"float:right\">" ;
214
+ listTensorsBody += "keyboard_arrow_right</i></a>" ;
215
+ listTensorsBody += "<ul class=\"dropdown-menu\">" ;
216
+ listTensorsBody += "<li><a data-val=\"s\">Unique</a></li>" ;
217
+ listTensorsBody += "<li><a data-val=\"u\">Not Unique</a></li>" ;
218
+ listTensorsBody += "</ul></li>" ;
219
+ listTensorsBody += "<li class=\"singleton dropdown-submenu\">" ;
220
+ listTensorsBody += "<a>Singleton" ;
221
+ listTensorsBody += "<i class=\"material-icons\" style=\"float:right\">" ;
222
+ listTensorsBody += "keyboard_arrow_right</i></a>" ;
223
+ listTensorsBody += "<ul class=\"dropdown-menu\">" ;
224
+ listTensorsBody += "<li><a data-val=\"q\">Unique</a></li>" ;
225
+ listTensorsBody += "<li><a data-val=\"c\">Not Unique</a></li>" ;
226
+ listTensorsBody += "</ul></li>" ;
225
227
listTensorsBody += "</ul></div></li>" ;
226
228
}
227
229
@@ -236,32 +238,58 @@ function demo() {
236
238
$ ( ".sortable" ) . sortable ( {
237
239
update : function ( ev , ui ) {
238
240
var listId = ui . item . parent ( ) . attr ( 'id' ) ;
239
- var tensor = listId . replace ( "dims" , "" ) ;
240
-
241
- tblFormatsView . insertCacheEntry ( tensor ,
242
- tblFormatsView . createCacheEntry ( listId ) ) ;
243
-
244
- model . cancelReq ( ) ;
245
- model . setOutput ( "" , "" , "" , "" ) ;
246
241
}
247
242
} ) ;
248
- $ ( ".format-input" ) . change ( function ( ) {
249
- var listId = $ ( this ) . parent ( ) . parent ( ) . parent ( ) . attr ( 'id' ) ;
243
+
244
+ function updateCache ( selectParent , val ) {
245
+ var selectId = selectParent . attr ( 'for' ) ;
246
+ var listId = selectParent . parent ( ) . parent ( ) . parent ( ) . attr ( 'id' ) ;
250
247
var tensor = listId . replace ( "dims" , "" ) ;
251
248
249
+ var format = tblFormatsView . getFormatString ( val ) ;
250
+ format = format . replace ( "¬" , $ ( "<div>" ) . html ( "¬" ) . text ( ) ) ;
251
+
252
+ $ ( "#" + selectId ) . val ( format ) ;
253
+ $ ( "#" + selectId ) . attr ( 'data-val' , val ) ;
254
+
252
255
tblFormatsView . insertCacheEntry ( tensor ,
253
256
tblFormatsView . createCacheEntry ( listId ) ) ;
254
257
255
258
model . cancelReq ( ) ;
256
259
model . setOutput ( "" , "" , "" , "" ) ;
257
- } ) ;
260
+ }
261
+
258
262
for ( t in model . input . tensorOrders ) {
259
263
if ( model . input . tensorOrders [ t ] > 0 ) {
260
264
tblFormatsView . insertCacheEntry ( t ,
261
265
tblFormatsView . createCacheEntry ( "dims" + t ) ) ;
262
266
}
263
267
}
264
268
269
+ $ ( '.dropdown-submenu a' ) . on ( "mouseover" , function ( e ) {
270
+ $ ( this ) . next ( 'ul' ) . show ( ) ;
271
+ } ) ;
272
+
273
+ $ ( '.sparse' ) . on ( "mouseleave" , function ( e ) {
274
+ $ ( this ) . find ( 'ul' ) . hide ( ) ;
275
+ } ) ;
276
+
277
+ $ ( '.singleton' ) . on ( "mouseleave" , function ( e ) {
278
+ $ ( this ) . find ( 'ul' ) . hide ( ) ;
279
+ } ) ;
280
+
281
+ $ ( ".dense a" ) . on ( "click" , function ( e ) {
282
+ var selectParent = $ ( this ) . parent ( ) . parent ( ) ;
283
+ var val = $ ( this ) . attr ( "data-val" ) ;
284
+ updateCache ( selectParent , val ) ;
285
+ } ) ;
286
+
287
+ $ ( '.dropdown-submenu .dropdown-menu a' ) . on ( "click" , function ( e ) {
288
+ var selectParent = $ ( this ) . parent ( ) . parent ( ) . parent ( ) . parent ( ) ;
289
+ var val = $ ( this ) . attr ( "data-val" ) ;
290
+ updateCache ( selectParent , val ) ;
291
+ } ) ;
292
+
265
293
$ ( "#tblFormats" ) . show ( ) ;
266
294
} else {
267
295
$ ( "#tblFormats" ) . hide ( ) ;
@@ -470,6 +498,4 @@ function demo() {
470
498
assemblyGet . responseText ,
471
499
fullGet . responseText , "" ) ;
472
500
} ) ;
473
-
474
- hljs . initHighlightingOnLoad ( ) ;
475
501
}
0 commit comments