2022-02-14 13:19:20 +01:00
|
|
|
|
2022-11-08 16:11:59 +01:00
|
|
|
(function ($) {
|
2022-02-14 13:19:20 +01:00
|
|
|
|
2022-11-08 16:11:59 +01:00
|
|
|
"use strict";
|
2022-02-14 13:19:20 +01:00
|
|
|
|
2022-11-08 16:11:59 +01:00
|
|
|
var fullHeight = function () {
|
2022-02-14 13:19:20 +01:00
|
|
|
|
2022-11-08 16:11:59 +01:00
|
|
|
$('.js-fullheight').css('height', $(window).height());
|
|
|
|
$(window).resize(function () {
|
|
|
|
$('.js-fullheight').css('height', $(window).height());
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
fullHeight();
|
|
|
|
|
|
|
|
$('#sidebarCollapse').on('click', function () {
|
|
|
|
$('#sidebar').toggleClass('active');
|
|
|
|
});
|
2022-02-14 13:19:20 +01:00
|
|
|
|
2022-08-14 21:05:26 +02:00
|
|
|
$.ajaxSetup({
|
2022-11-08 16:11:59 +01:00
|
|
|
headers: {
|
|
|
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
|
|
|
}
|
2022-08-14 21:05:26 +02:00
|
|
|
});
|
2022-11-08 16:11:59 +01:00
|
|
|
var sortableTbody = document.getElementById("links-table-body");
|
|
|
|
if (sortableTbody) {
|
|
|
|
const sortableLinkTable = Sortable.create(sortableTbody, {
|
|
|
|
handle: ".sortable-handle",
|
|
|
|
animation: 150,
|
|
|
|
swapThreshold: 0.60,
|
|
|
|
ghostClass: 'bg-info',
|
|
|
|
onChange: function (event) {
|
|
|
|
},
|
|
|
|
store: {
|
|
|
|
get: function (sortable) {
|
|
|
|
var order = linksTableOrders || "";
|
|
|
|
return order ? order.split('|') : [];
|
|
|
|
},
|
|
|
|
set: function (sortable) {
|
|
|
|
const linkOrders = sortable.toArray();
|
|
|
|
const currentPage = sortableTbody.dataset.page || 1;
|
|
|
|
const perPage = sortableTbody.dataset.perPage || 0;
|
|
|
|
const formData = {
|
|
|
|
'linkOrders': linkOrders,
|
|
|
|
'currentPage': currentPage,
|
|
|
|
'perPage': perPage,
|
|
|
|
};
|
|
|
|
// $.blockUI({
|
|
|
|
// message: '<img width="70px" src="img/loading.gif" />',
|
|
|
|
// css: {
|
|
|
|
// backgroundColor: 'transparent',
|
|
|
|
// border: 'none',
|
|
|
|
// color: '#444444',
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
|
|
|
|
// VERY janky solution; have to fix later
|
|
|
|
var str = window.location.pathname;
|
|
|
|
str = str.replace("/studio/links", "");
|
|
|
|
|
|
|
|
$.post(str + "/studio/sort-link", formData, function (response) {
|
|
|
|
if (response.linkOrders) {
|
|
|
|
$.each(response.linkOrders, function (linkId, linkOrder) {
|
|
|
|
// $("#links-table-body div[data-id='"+linkId+"']")
|
|
|
|
// .find("div:eq(3)")
|
|
|
|
// .html(linkOrder);
|
|
|
|
});
|
|
|
|
//$.unblockUI();
|
|
|
|
} else {
|
|
|
|
alert("Something went wrong! Please, Try again.")
|
|
|
|
}
|
|
|
|
});
|
2022-11-12 22:54:24 +01:00
|
|
|
|
|
|
|
setTimeout(function(){
|
|
|
|
document.getElementById('frPreview1').src += '';
|
|
|
|
document.getElementById('frPreview2').src += '';
|
|
|
|
}, 300);
|
2022-11-08 16:11:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-14 13:19:20 +01:00
|
|
|
})(jQuery);
|