forked from MetaTunes/ProcessDbMigrate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProcessDbMigrate.js
60 lines (52 loc) · 1.65 KB
/
ProcessDbMigrate.js
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
/**
* Abbreviate notes and provide popup
*
* @param event
*/
function shortNotes(event) {
// console.log($(this).html());
if ($(this).html().length > 200) {
var note = $(this).html();
var shortNote = $(this).html().substring(0, 150) + '... <span style="font-style: italic">(click for more)</span>';
$(this).html(shortNote);
$(this).after('<div uk-dropdown="mode: click">' + note + '</div>');
event.stopImmediatePropagation();
}
}
/**
* Pop-out for help
*
* @param event
* @returns {boolean}
*/
function popOut(event) {
var link = $(this).attr('href');
window.open(link, 'popup', 'resizable= 1, height = 800, width=1200, scrollbars=1');
return false;
}
$(document).ready(function () {
$('.AdminDataTable .abbreviate').each(shortNotes);
if($('#ProcessDbMigrate').length) {
$('#ProcessDbMigrate').WireTabs({
items: $('.WireTab')
});
}
var arr = window.location.href.split('/');
var seg = arr[arr.length-1];
if (seg.startsWith("#")) $(seg).click();
$('.ProcessPageEdit-template-DbMigration #delete_page').click(function (event) {
if ($(this).prop('checked')) {
if (!confirm(ProcessWire.config.ProcessDbMigrate.confirmDelete)) {
event.preventDefault();
}
}
});
$('.ProcessPageEdit-template-DbComparison #delete_page').click(function (event) {
if ($(this).prop('checked')) {
if (!confirm(ProcessWire.config.ProcessDbMigrate.confirmDelete)) {
event.preventDefault();
}
}
});
$(document).on('click', 'a.popout-help', popOut);
});