Monstra/monstra-cms — pull request #78 by mbarzda (2012-12-29 21:12:05+00:00)
Title: Plugins js updates

Updated **Plugins::load()** method and **blocks, menu, pages, snippets, users** plugins scripts for backend mode.
Removed **$.monstra** object is undefined conditional and **$.ready()** function from every plugin js file.
After update all plugins **init()** functions are running from one **$.ready()** function and fixed code is appending in **backend_site.minify.js**:
```javascript
function confirmDelete(msg){var data=confirm(msg+" ?"); return data;}

if (typeof $.monstra == 'undefined') $.monstra = {};
$.monstra.users = {

init: function() {
this.usersFrontendRegistration();
},

usersFrontendRegistration: function() {
$("[name=users_frontend_registration]").click(function() {
$("[name=users_frontend]").submit();
});
}

};
$.monstra.snippets = {

init: function() { },

showEmbedCodes: function(name) {
$('#shortcode').html('{snippet get="'+name+'"}');
$('#phpcode').html('<?php echo Snippet::get("'+name+'"); ?>');
$('#embedCodes').modal();
}

};
$.monstra.menu = {

init: function() { },

selectPage: function (slug, title) {
$('input[name=menu_item_link]').val(slug);
$('input[name=menu_item_name]').val(title);
$('#selectPageModal').modal('hide');
},

selectCategory: function (name) {
$('input[name=menu_item_category]').val(name);
$('#selectCategoryModal').modal('hide');
}

};
$.monstra.blocks = {

init: function() { },

showEmbedCodes: function(name) {
$('#shortcode').html('{block get="'+name+'"}');
$('#phpcode').html('<?php echo Block::get("'+name+'"); ?>');
$('#embedCodes').modal();
}

};
$.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="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.users.init();
$.monstra.snippets.init();
$.monstra.menu.init();
$.monstra.blocks.init();
$.monstra.pages.init();
});
```