|
@ -10,6 +10,9 @@ |
|
|
} |
|
|
} |
|
|
</style> |
|
|
</style> |
|
|
|
|
|
|
|
|
|
|
|
<script src="http://t4t5.github.io/sweetalert/dist/sweetalert.min.js"></script> |
|
|
|
|
|
<link href="http://t4t5.github.io/sweetalert/dist/sweetalert.css" rel="stylesheet" type="text/css"/> |
|
|
|
|
|
|
|
|
<script src="../../../dist/vis.js"></script> |
|
|
<script src="../../../dist/vis.js"></script> |
|
|
<link href="../../../dist/vis.css" rel="stylesheet" type="text/css" /> |
|
|
<link href="../../../dist/vis.css" rel="stylesheet" type="text/css" /> |
|
|
<script src="../../googleAnalytics.js"></script> |
|
|
<script src="../../googleAnalytics.js"></script> |
|
@ -42,24 +45,30 @@ |
|
|
editable: true, |
|
|
editable: true, |
|
|
|
|
|
|
|
|
onAdd: function (item, callback) { |
|
|
onAdd: function (item, callback) { |
|
|
item.content = prompt('Enter text content for new item:', item.content); |
|
|
|
|
|
if (item.content != null) { |
|
|
|
|
|
callback(item); // send back adjusted new item |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
callback(null); // cancel item creation |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
prettyPrompt('Add item', 'Enter text content for new item:', item.content, function (value) { |
|
|
|
|
|
if (value) { |
|
|
|
|
|
item.content = value; |
|
|
|
|
|
callback(item); // send back adjusted new item |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
callback(null); // cancel item creation |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
onMove: function (item, callback) { |
|
|
onMove: function (item, callback) { |
|
|
if (confirm('Do you really want to move the item to\n' + |
|
|
|
|
|
|
|
|
var title = 'Do you really want to move the item to\n' + |
|
|
'start: ' + item.start + '\n' + |
|
|
'start: ' + item.start + '\n' + |
|
|
'end: ' + item.end + '?')) { |
|
|
|
|
|
callback(item); // send back item as confirmation (can be changed) |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
callback(null); // cancel editing item |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
'end: ' + item.end + '?'; |
|
|
|
|
|
|
|
|
|
|
|
prettyConfirm('Move item', title, function (ok) { |
|
|
|
|
|
if (ok) { |
|
|
|
|
|
callback(item); // send back item as confirmation (can be changed) |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
callback(null); // cancel editing item |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
onMoving: function (item, callback) { |
|
|
onMoving: function (item, callback) { |
|
@ -71,22 +80,26 @@ |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
onUpdate: function (item, callback) { |
|
|
onUpdate: function (item, callback) { |
|
|
item.content = prompt('Edit items text:', item.content); |
|
|
|
|
|
if (item.content != null) { |
|
|
|
|
|
callback(item); // send back adjusted item |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
callback(null); // cancel updating the item |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
prettyPrompt('Update item', 'Edit items text:', item.content, function (value) { |
|
|
|
|
|
if (value) { |
|
|
|
|
|
item.content = value; |
|
|
|
|
|
callback(item); // send back adjusted item |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
callback(null); // cancel updating the item |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
onRemove: function (item, callback) { |
|
|
onRemove: function (item, callback) { |
|
|
if (confirm('Remove item ' + item.content + '?')) { |
|
|
|
|
|
callback(item); // confirm deletion |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
callback(null); // cancel deletion |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
prettyConfirm('Remove item', 'Do you really want to remove item ' + item.content + '?', function (ok) { |
|
|
|
|
|
if (ok) { |
|
|
|
|
|
callback(item); // confirm deletion |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
callback(null); // cancel deletion |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
var timeline = new vis.Timeline(container, items, options); |
|
|
var timeline = new vis.Timeline(container, items, options); |
|
@ -103,6 +116,27 @@ |
|
|
log.firstChild ? log.insertBefore(msg, log.firstChild) : log.appendChild(msg); |
|
|
log.firstChild ? log.insertBefore(msg, log.firstChild) : log.appendChild(msg); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function prettyConfirm(title, text, callback) { |
|
|
|
|
|
swal({ |
|
|
|
|
|
title: title, |
|
|
|
|
|
text: text, |
|
|
|
|
|
type: 'warning', |
|
|
|
|
|
showCancelButton: true, |
|
|
|
|
|
confirmButtonColor: "#DD6B55" |
|
|
|
|
|
}, callback); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function prettyPrompt(title, text, inputValue, callback) { |
|
|
|
|
|
console.log(title, text, inputValue) |
|
|
|
|
|
swal({ |
|
|
|
|
|
title: title, |
|
|
|
|
|
text: text, |
|
|
|
|
|
type: 'input', |
|
|
|
|
|
showCancelButton: true, |
|
|
|
|
|
inputValue: inputValue |
|
|
|
|
|
}, callback); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
</script> |
|
|
</script> |
|
|
</body> |
|
|
</body> |
|
|
</html> |
|
|
</html> |