mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-03 19:57:57 +02:00
Pages Plugin: general js refactoring
This commit is contained in:
36
plugins/box/pages/js/pages.js
Normal file
36
plugins/box/pages/js/pages.js
Normal file
@@ -0,0 +1,36 @@
|
||||
if (typeof $.monstra == 'undefined') $.monstra = {};
|
||||
|
||||
$.monstra.pages = {
|
||||
|
||||
init: function() {
|
||||
this.pagesExpandProcess();
|
||||
},
|
||||
|
||||
pageExpand: function(slug, expand, token) {
|
||||
$.ajax({
|
||||
type:"post",
|
||||
data:"slug="+slug+"&expand="+expand+"&token="+token,
|
||||
url: $('form input[name="siteurl"]').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();
|
||||
});
|
Reference in New Issue
Block a user