1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-07-10 16:16:18 +02:00
Files
php-monstra/plugins/box/pages/js/pages.js

36 lines
1.0 KiB
JavaScript

if (typeof $.monstra == 'undefined') $.monstra = {};
$.monstra.pages = {
init: function() {
this.pagesExpandProcess();
},
pageExpand: function(slug, expand, token) {
$.ajax({
type:"post",
data:"page_slug="+slug+"&page_expand="+expand+"&token="+token,
url: $('form input[name="url"]').val()
});
},
pagesExpandProcess: function() {
$(".parent").click(function() {
if ($(this).html() == "-") {
$('[rel="children_' + $(this).attr('rel')+'"]').hide();
$(this).html("+");
$.monstra.pages.pageExpand($(this).attr("rel"), "1", $(this).attr("token"));
} else {
$('[rel="children_' + $(this).attr('rel')+'"]').show();
$(this).html("-");
$.monstra.pages.pageExpand($(this).attr("rel"), "0", $(this).attr("token"));
}
});
}
};
$(document).ready(function(){
$.monstra.pages.init();
});