709380f131f2c851e346c365248d7877362fc55c
[myslice.git] / plugins / scheduler / static / js / scheduler.js
1 /**
2  * Description: display a query result in a Google map
3  * Copyright (c) 2012-2013 UPMC Sorbonne Universite - INRIA
4  * License: GPLv3
5  */
6
7 /* based on the leases.js code in PLE WWW interface for MyPLC by Thierry Parmentelat -- INRIA */
8
9 /* XXX Those declarations should not be part of the js file... */
10
11 /* decorations / headers */
12 /* note: looks like the 'font' attr is not effective... */
13
14 // vertical rules
15 var attr_rules={'fill':"#888", 'stroke-dasharray':'- ', 'stroke-width':0.5};
16 // set font-size separately in here rather than depend on the height
17 var txt_timelabel = {"font": 'Times, "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif', 
18              stroke: "none", fill: "#008", 'font-size': 9};
19 var txt_allnodes = {"font": '"Trebuchet MS", Verdana, Arial, Helvetica, sans-serif', stroke: "none", fill: "#404"};
20 var txt_nodelabel = {"font": '"Trebuchet MS", Verdana, Arial, Helvetica, sans-serif', stroke: "none", fill: "#008"};
21
22 var attr_timebutton = {'fill':'#bbf', 'stroke': '#338','stroke-width':1, 
23                'stroke-linecap':'round', 'stroke-linejoin':'miter', 'stroke-miterlimit':3};
24 var attr_daymarker = {'stroke':'#000','stroke-width':2};
25 var attr_half_daymarker = {'stroke':'#444','stroke-width':2};
26
27 /* lease dimensions and colors */
28 /* refrain from using gradient color, seems to not be animated properly */
29 /* lease was originally free and is still free */
30 var attr_lease_free_free={'fill':"#def", 'stroke-width':0.5, 'stroke-dasharray':''};
31 /* lease was originally free and is now set for our usage */
32 var attr_lease_free_mine={'fill':"green", 'stroke-width':1, 'stroke-dasharray':'-..'};
33 /* was mine and is still mine */
34 var attr_lease_mine_mine={'fill':"#beb", 'stroke-width':0.5, 'stroke-dasharray':''};
35 /* was mine and is about to be released */
36 var attr_lease_mine_free={'fill':"white", 'stroke-width':1, 'stroke-dasharray':'-..'};
37 var attr_lease_other={'fill':"#f88"};
38
39 /* other slices name */
40 var txt_otherslice = {"font": '"Trebuchet MS", Verdana, Arial, Helvetica, sans-serif', stroke: "none", fill: "#444", "font-size": "12px"};
41
42 (function($){
43
44     var Scheduler = Plugin.extend({
45
46         init: function(options, element) 
47         {
48             this._super(options, element);
49
50                 /* Member variables */
51             this.options = options;
52             this.canvas_id = 'leases_area-' + options.plugin_uuid;
53
54             this.query_uuid = options.query_uuid;
55             this.rows = null;
56             // XXX TODEL
57             //this.current_resources = Array();
58             //this.current_leases = Array();
59
60             this.myLeases = Array();
61             this.allLeases = Array();
62
63             this.listLeases = Array();
64
65             this.axisx = Array();
66             this.axisy = Array();
67             this.data = Array();
68             this.default_granularity = 1800; /* 30 min */
69             this.initial_timestamp = null;
70
71             /* This should be updated to be the ppcm of all granularities */
72             this.min_granularity = this.default_granularity;
73
74             // the data contains slice names, and lease_id, we need this to find our own leases (mine)
75             this.paper=null;
76
77             /* XXX Events */
78
79             /* XXX Keys */
80
81             /* Listening to queries */
82             this.listen_query(options.resource_query_uuid);
83             this.listen_query(options.lease_query_uuid);
84
85             /* XXX GUI setup and event binding */
86             jQuery("#datepicker").datetimepicker({
87                 //Timezone wise selection option
88                 //timeFormat: 'hh:mm tt z',
89                 //showTimezone: true,
90                 
91                 onSelect: function(value) { 
92                     //console.log(value);
93                     //converting time to timestamp
94                     currentDate= Math.round(Date.parse(value)/ 1000);
95                     // TODO -- DONE
96                     // convert value to timestamp --done
97                     // Get jQuery("#timepicker").val(); - no need anymore
98                     // convert timepicker into seconds - no need
99                     // Add time to date - done
100                     // pass the result to init_axisx - done
101                     //console.log(currentDate);
102                     s.clear();
103                     s.init_axisx(currentDate);
104                     s.draw();
105                     // Do we need to populate the timeslots with existing leases? 
106                     // Look how to populate with initial_leases [we have to show the leases]
107                     
108                 } 
109             });
110             //console.log(s.nodelabels[1]);
111             // Do we need to populate the timeslots with existing leases? 
112             // Look how to populate with initial_leases
113             
114             // TODO -- DONE  Note: autocomplete is not search box
115             // Implement a filtering functionality, on the name of the node
116             // http://jqueryui.com/autocomplete/
117             // pass s.nodelabels to autocomplete function
118             //jQuery("#search").autocomplete('s.nodelabel');
119             //console.log(s.nodelabel);
120             
121             /*
122              * TODO
123              * During init, there are no resources
124              * So the list of nodes is empty
125              * The function triggered by the subscription to the resources query
126              * var RESULTS_RESOURCES = '/results/' + options.resource_query_uuid + '/changed';
127              * $.subscribe(RESULTS_RESOURCES, function(e, resources) { s.set_resources(resources);   });
128              * Will have to update the list of nodes available through autocomplete (availableTags)
129              * 
130              * Be inspired by QueryEditor plugin
131              * 
132              * Resources informations in s.axisy ???
133              * 
134              * Filter what has been selected in other plugins:
135              * QueryEditor
136              * QuickFilter
137              * AdvancedFilter
138              * 
139              * Implement an action of filtering while typing
140              * filter what correspond to the user choice
141              * 
142              */
143             $(function() {
144                 var availableTags = ['omf','nitos','ple', s.nodelabel];
145             $( "#search" ).autocomplete({
146               source: availableTags
147                 });
148             });
149
150             this.init_axisx('');
151             this.draw();
152
153         }, /* init */
154
155         /* Default settings */
156         default_options: {
157             leases_offset:       0,
158             leases_slots:        36,
159             leases_w:            180,
160             leases_granularity:  3600,
161
162             x_nodelabel:         200,   /* space for the nodenames */
163             x_sep:               20,    /* right space after the nodename - removed from the above */
164             y_header:            12,    /* height for the (two) rows of timelabels */
165             y_sep:               10,    /* space between nodes */
166             leases_w:            20,    /* 1-grain leases attributes */
167             y_node:              15,
168             radius:              6,
169             anim_delay:          350,
170             checkboxes:          false,
171             resource_query_uuid: null,  /* resources */
172             lease_query_uuid:    null,  /* leases */
173         },
174
175         /* PLUGIN EVENTS */
176
177         /* GUI EVENTS */
178
179         /* GUI MANIPULATION */
180
181         /* TEMPLATES */
182
183         /* QUERY HANDLERS */
184
185         set_resources: function(resources) 
186         {
187             //console.log(resources);
188             var scheduler = this;
189             jQuery.each(resources, function(i, resource) {
190                 // ... add reservable ones to the x axis
191                 if ((typeof resource.exclusive != 'undefined') && (resource.exclusive)) {
192                     scheduler.axisy.push(Array(resource.urn, resource.resource_hrn, resource.type));
193                 }
194                 // ... if we do not have information about slivers (first update), update it
195                 if (typeof resource.sliver != 'undefined') {
196                     // XXX
197                 }
198             });
199
200             this.draw(this.canvas_id);
201         }
202
203         this.set_leases = function(leases) {
204             this.initial_leases=leases;
205             this.draw(this.canvas_id);
206         }
207
208         this.update_resources = function(resources) {
209             //
210         }
211
212         this.update_leases = function(leases) {
213             //
214         }
215
216         /* RECORD HANDLERS */
217
218         /* INTERNAL FUNCTIONS */
219
220         /**
221          * @brief Return the number of time slots
222          */
223         nb_grains: function () 
224         {
225             return this.axisx.length; 
226         },
227
228         /**
229          * @brief Returns whether there is a pending lease at this timestamp
230          */
231         find_lease: function(urn, timestamp)
232         {
233             var scheduler = this;
234             var result = null;
235
236             $.each(Array(scheduler.myLeases, scheduler.allLeases), function(i, array) {
237                 $.each(array, function(i, lease) {
238                     if (lease[0] == urn) {
239                         if ((timestamp >= lease[1]) && (timestamp < (lease[1] + lease[2] * 1800))) {
240                             result = lease;
241                             
242                             return false;
243                         }
244                     }
245                 });
246                 if (result)
247                     return false;
248             });
249             return result;
250         },
251
252         /**
253          * @brief Draw
254          */
255         draw: function() 
256         { 
257             var canvas_id = this.canvas_id;
258             var o = this.options;
259             var total_width = o.x_nodelabel + this.nb_grains() * this.options.leases_w;
260             var total_height = 2 * o.y_header /* the timelabels */
261                              + 2 * o.y_sep    /* extra space */
262                              + o.y_node   /* all-nodes & timebuttons row */ 
263                              + (this.axisy.length)*(o.y_node+o.y_sep);  /* the regular nodes and preceding space */
264
265             /* reuse for paper if exists with same size, or (re-)create otherwise */
266             var paper;
267             if (this.paper == null) {
268                 paper = Raphael (canvas_id, total_width+o.x_sep, total_height);
269             } else if (this.paper.width==total_width && this.paper.height==total_height) {
270                 paper=this.paper;
271                 paper.clear();
272             } else {
273                 $$("#"+canvas_id)[0].innerHTML="";
274                 paper = Raphael (canvas_id, total_width+o.x_sep, total_height);
275             }
276             this.paper=paper;
277
278             /* the path for the triangle-shaped buttons */
279             this.timebutton_path = "M1,0L"+(this.options.leases_w-1)+",0L"+(this.options.leases_w/2)+","+o.y_header+"L1,0";
280
281             var axisx = this.axisx;
282             var axisy = this.axisy;
283
284             /* maintain the list of nodelabels for the 'all nodes' button */
285             this.nodelabels=[];
286             
287
288             /* create the time slots legend */
289             var top = 0;
290             var left = o.x_nodelabel;
291
292             var daymarker_height= 2*o.y_header + 2*o.y_sep + (axisy.length+1)*(o.y_node+o.y_sep);
293             var daymarker_path="M0,0L0," + daymarker_height;
294
295             var half_daymarker_off= 2*o.y_header + o.y_sep;
296             var half_daymarker_path="M0," + half_daymarker_off + "L0," + daymarker_height;
297
298             var col=0;
299             for (var i=0, len=axisx.length; i < len; ++i) {
300                 /* pick the printable part */
301                 var timelabel=axisx[i][1];
302                 var y = top + o.y_header;
303                 if (col%2 == 0) y += o.y_header;
304                 col +=1;
305                 /* display time label */
306                 var timelabel=paper.text(left,y,timelabel).attr(txt_timelabel).attr({"text-anchor":"middle"});
307                 /* draw vertical line */
308                 var path_spec="M"+left+" "+(y+o.y_header/2)+"L"+left+" "+this.total_height;
309                 var rule=paper.path(path_spec).attr(attr_rules);
310                 /* show a day marker when relevant */
311                 var timestamp=parseInt(axisx[i][0]);
312                 if ( (timestamp%(24*3600))==0) {
313                     paper.path(daymarker_path).attr({'translation':left+','+top}).attr(attr_daymarker);
314                 } else if ( (timestamp%(12*3600))==0) {
315                     paper.path(half_daymarker_path).attr({'translation':left+','+top}).attr(attr_daymarker);
316                 }
317                 left += this.options.leases_w;
318             },
319
320             ////////// the row with the timeslot buttons (the one labeled 'All nodes')
321             this.granularity= this.min_granularity; // XXX axisx[1][0]-axisx[0][0];
322
323             // move two lines down
324             top += 2*o.y_header + 2*o.y_sep;
325             left=o.x_nodelabel;
326             // all nodes buttons
327             var allnodes = paper.text (o.x_nodelabel-o.x_sep,top+o.y_node/2,"All nodes").attr(txt_allnodes)
328                 .attr ({"font-size":o.y_node, "text-anchor":"end","baseline":"bottom"});
329             allnodes.scheduler=this;
330             allnodes.click(allnodes_methods.click);
331             
332             // timeslot buttons [it's the triangles above the slots]
333             for (var i=0, len=axisx.length; i < len; ++i) {
334                 var timebutton=paper.path(this.timebutton_path).attr({'translation':left+','+top}).attr(attr_timebutton);
335                 timebutton.from_time=axisx[i][0];
336                 timebutton.scheduler=this;
337                 timebutton.click(timebutton_methods.click);
338                 left+=(this.options.leases_w);
339             }
340             
341             //////// the body of the scheduler : loop on nodes
342             top += o.y_node + o.y_sep;
343             var data_index=0;
344             this.leases=[];
345             for (var i=0, len=axisy.length; i<len; ++i) {
346                 var urn=axisy[i][0];
347                 var nodename=axisy[i][1];
348                 var type=axisy[i][2];
349                 left=0;            
350                 /*
351                  *  MODIFIED font-size
352                 var nodelabel = paper.text(o.x_nodelabel-x_sep,top+y_node/2,nodename).attr(txt_nodelabel)
353                 .attr ({"font-size":y_node, "text-anchor":"end","baseline":"bottom"});
354                 */
355                 var nodelabel = paper.text(o.x_nodelabel-o.x_sep,top+o.y_node/3,nodename).attr(txt_nodelabel)
356                 .attr ({"font-size":"12px", "text-anchor":"end","baseline":"bottom"});    
357                 //console.log(nodelabel);
358                 nodelabel_methods.selected(nodelabel,1);
359                 //nodelabel_methods.selected( this, ! this.selected );
360                 nodelabel.click(nodelabel_methods.click); //click action works here
361                 //timebutton.click(timebutton_methods.click);
362                 
363                // lease_methods.init_free(nodelabel.click, lease_methods.click_mine);
364                //lease_methods.init_free(nodelabel.lease);
365                 this.nodelabels.push(nodelabel);
366                 
367                 left += o.x_nodelabel;
368                 var grain=0;
369                 // data index contains the full array of leases
370                 // not the same amount of grains per node
371
372                 // NOTE: remembering the previous lease might help for long leases.
373                 while (grain < this.nb_grains()) {
374
375                     if (l = this.find_lease(urn, this.initial_timestamp + grain * 1800)) {
376                         slicename = l.slice_id;
377                     } else {
378                         slicename = "";
379                     }
380
381                     //lease_id  = this.data[data_index][0];
382                     //slicename = this.data[data_index][1];
383                     /* Duration should not be the lease duration, but the grain */
384                     var duration = 1; // this.data[data_index][2];
385
386                     var lease=paper.rect (left,top,this.options.leases_w*duration,o.y_node,o.radius);
387                     // record scheduler in lease - early as we need this in init_other
388                     lease.scheduler=this;
389                     //lease.lease_id=lease_id;
390                     lease.nodename=nodename;
391                     lease.urn=urn;
392                     lease.nodelabel=nodelabel;
393                     if (slicename == "") {
394                         lease.initial="free";
395                         lease_methods.init_free(lease);
396                     } else if (slicename == this.options.slicename) {
397                         lease.initial="mine";
398                         lease_methods.init_mine(lease);
399                     } else {
400                         lease.initial="other";
401                         lease_methods.init_other(lease,slicename);
402                     }
403                     lease.from_time = axisx[grain%this.nb_grains()][0];
404                     grain += duration;
405                     lease.until_time = axisx[grain%this.nb_grains()][0];
406                     // and vice versa
407                     this.leases.push(lease);
408                     // move on with the loop
409                     left += this.options.leases_w*duration;
410                     data_index +=1;
411                 }
412                 top += o.y_node + o.y_sep;
413             };
414         }, /* draw */
415
416         init_axisx: function(currentDate) 
417         {
418             this.axisx = Array();
419     
420             if(currentDate=="") {
421                 // creating timestamp of the current time
422                 currentDate = new Date().getTime() / 1000;
423             }
424             this.initial_timestamp = currentDate;
425             //console.log(currentDate);
426     
427             // round it by granularity (becomes an Int)
428             var rounded = Math.round(currentDate/this.min_granularity)*this.min_granularity;
429             // Convert Int to Date
430             rounded = new Date(rounded*1000);
431             // get hours and minutes in a 24h format 00:00
432             var roundedHours=(rounded.getHours()<10?'0':'') + rounded.getHours();
433             var roundedMinutes=(rounded.getMinutes()<10?'0':'') + rounded.getMinutes();
434     
435             //timeFrame.push(rounded);
436             this.axisx.push(Array(rounded, roundedHours+":"+roundedMinutes));
437     
438             // Generate as man slots as we need
439             for(i=0; i<this.options.leases_slots;i++) {
440                 rounded = this.min_granularity+(rounded.getTime()/1000);
441                 rounded = new Date(rounded*1000);
442                 roundedHours=(rounded.getHours()<10?'0':'') + rounded.getHours();
443                 roundedMinutes=(rounded.getMinutes()<10?'0':'') + rounded.getMinutes();
444     
445                 //timeFrame.push(rounded);
446                 this.axisx.push(Array(rounded, roundedHours+":"+roundedMinutes));
447             }
448         },
449
450         clear: function ()
451         {
452             for (var i=0, len=this.leases.length; i<len; ++i) {
453                 var lease=this.leases[i];
454                 if (lease.current != lease.initial) {
455                 if (lease.initial == 'free') lease_methods.init_free(lease,lease_methods.click_mine);
456                 else                         lease_methods.init_mine(lease,lease_methods.click_free);
457                 }
458             }
459         },
460
461         // XXX Couldn't find how to inhererit from the raphael objects...
462
463         /* ---------------------------------------------------------------------
464          * The 'all nodes' button
465          */
466         allnodes_methods: {
467             click: function (event) {
468                 var scheduler=this.scheduler;
469                 /* decide what to do */
470                 var unselected=0;
471                 for (var i=0, len=scheduler.nodelabels.length; i<len; ++i) 
472                     if (! scheduler.nodelabels[i].selected) unselected++;
473                 /* if at least one is not selected : select all */
474                 var new_state = (unselected >0) ? 1 : 0;
475                 for (var i=0, len=scheduler.nodelabels.length; i<len; ++i) 
476                     nodelabel_methods.selected(scheduler.nodelabels[i],new_state);
477             }
478         },
479
480         /* ---------------------------------------------------------------------
481          * The buttons for managing the whole timeslot
482          */
483         timebutton_methods: {
484
485             /* clicking */
486             click: function (event) {
487                 var scheduler = this.scheduler;
488                 var from_time = this.from_time;
489                 var until_time = from_time + scheduler.granularity;
490                 /* scan leases on selected nodes, store in two arrays */
491                 var relevant_free=[], relevant_mine=[];
492                 for (var i=0,len=scheduler.leases.length; i<len; ++i) {
493                     var scan=scheduler.leases[i];
494                     if ( ! scan.nodelabel.selected) continue;
495                     // overlap ?
496                     if (scan.from_time<=from_time && scan.until_time>=until_time) {
497                     if (scan.current == "free")       relevant_free.push(scan);
498                     else if (scan.current == "mine")  relevant_mine.push(scan);
499                     }
500                 }
501                 // window.console.log("Found " + relevant_free.length + " free and " + relevant_mine.length + " mine");
502                 /* decide what to do, whether book or release */
503                 if (relevant_mine.length==0 && relevant_free.length==0) {
504                     alert ("Nothing to do in this timeslot on the selected nodes");
505                     return;
506                 }
507                 // if at least one is free, let's book
508                 if (relevant_free.length > 0) {
509                     for (var i=0, len=relevant_free.length; i<len; ++i) {
510                         var lease=relevant_free[i];
511                         lease_methods.init_mine(lease,lease_methods.click_free);
512                     }
513                 // otherwise we unselect
514                 } else {
515                     for (var i=0, len=relevant_mine.length; i<len; ++i) {
516                         var lease=relevant_mine[i];
517                         lease_methods.init_free(lease,lease_methods.click_mine);
518                     }
519                 }
520             } /* click */
521         }, 
522
523         /* ---------------------------------------------------------------------
524          * The nodelabel buttons
525          */
526         nodelabel_methods: {
527             
528             // set selected mode and render visually
529             selected: function (nodelabel, flag) {
530                 nodelabel.selected=flag;
531                 nodelabel.attr({'font-weight': (flag ? 'bold' : 'normal')});
532                 // TODO
533                 // 
534                 // loop on axis x and select each timebutton
535                 // for (var i=0, len=axisx.length; i < len; ++i)
536                 // figure out how to use timebutton_methods.click();
537                     
538             },
539
540             // toggle selected
541             click: function (event) {
542                 nodelabel_methods.selected( this, ! this.selected );
543             }
544         },
545
546
547         /* ---------------------------------------------------------------------
548          * The lease buttons
549          */
550         lease_methods: {
551         
552             init_free: function (lease, unclick) {
553                 var o = lease.scheduler.options;
554                 lease.current="free";
555                 // set color
556                 lease.animate((lease.initial=="free") ? attr_lease_free_free : attr_lease_mine_free, o.anim_delay);
557                 // keep track of the current status
558                 // record action
559                 lease.click (lease_methods.click_free);
560                 if (unclick) lease.unclick(unclick);
561             },
562                      
563             // find out all the currently free leases that overlap this one
564             click_free: function (event) {
565                 var scheduler = this.scheduler;
566                 lease_methods.init_mine(this,lease_methods.click_free);        
567                 //publish
568                 //this.from_time
569                 //this.urn
570                 //this.until_time
571                 var urn = this.urn
572                 var start_time=new Date(this.from_time).getTime() / 1000;        
573                 var end_time=new Date(this.until_time).getTime() / 1000;
574                 var duration=(end_time-start_time)/1800; // XXX HARDCODED LEASE GRAIN
575
576                 /* Add a new lease : XXX should be replaced by a dictionary */
577                 // Do we have a lease with the same urn  just before or just after ?
578                 var removeIdBefore = null;
579                 var removeIdAfter = null;
580                 jQuery.each(scheduler.listLeases, function(i, lease) {
581                     if (lease[0] == urn) {
582                         if (lease[1] + lease[2] * 1800 == start_time) { // XXX HARDCODED LEASE GRAIN
583                             // Merge with previous lease
584                             removeIdBefore = i;
585                             start_time = lease[1];
586                             duration += lease[2];
587                         }
588                         if (lease[1] == end_time) {
589                             // Merge with following lease
590                             removeIdAfter = i;
591                             duration += lease[2];
592                         }
593                     }
594                 });
595                 if (removeIdBefore != null) {
596                     scheduler.listLeases.splice(removeIdBefore , 1);
597                     if (removeIdAfter != null)
598                         removeIdAfter -= 1;
599                 }
600                 if (removeIdAfter != null) {
601                     scheduler.listLeases.splice(removeIdAfter , 1);
602                 }
603
604                 scheduler.listLeases.push([this.urn, start_time, duration]);
605
606                 console.log(scheduler.listLeases);
607                 //jQuery.publish('/update-set/' + scheduler.options.query_uuid, [scheduler.listLeases]);
608                 jQuery.publish('/update-set/' + scheduler.options.lease_query_uuid, [scheduler.listLeases]);
609             },
610
611             init_mine: function (lease, unclick) {
612                 var o = lease.scheduler.options;
613                 lease.current="mine";
614                 lease.animate((lease.initial=="mine") ? attr_lease_mine_mine : attr_lease_free_mine,o.anim_delay);
615                 lease.click (lease_methods.click_mine);
616                 if (unclick) lease.unclick(unclick);
617             },
618             
619             /* TODO: remove selected lease from array listLeases and publish change */
620             click_mine: function (event) {
621                 var scheduler = this.scheduler;
622                 // this lease was originally free but is now marked for booking
623                 // we free just this lease
624                 //console.log('this is mine');
625                 lease_methods.init_free(this, lease_methods.click_mine);
626             },
627
628
629             init_other: function (lease, slicename) {
630                 lease.animate (attr_lease_other,anim_delay);
631                 /* a text obj to display the name of the slice that owns that lease */
632                 var otherslicelabel = lease.scheduler.paper.text (lease.attr("x")+lease.attr("width")/2,
633                                           // xxx
634                                           lease.attr("y")+lease.attr("height")/2,slicename).attr(txt_otherslice);
635                 /* hide it right away */
636                 otherslicelabel.hide();
637                 /* record it */
638                 lease.label=otherslicelabel;
639                 lease.hover ( function (e) {this.label.toFront();this.label.show();},
640                           function (e) {this.label.hide();} ); 
641             }
642         }
643
644     });
645
646     $.plugin('Scheduler', Scheduler);
647
648 })(jQuery);