mpog-download-block.js
1 KB
(function($) {
'use strict';
function add_new_link(){
var newDownload = $(window.download_list_template);
newDownload.attr('data-counter-id', 1);
$("#droppable-list-downloads").append(newDownload);
}
function delete_link(add_element){
var deleteDownload = $(add_element).parent().parent().parent();
deleteDownload.remove();
}
function get_download_list_template() {
if(sessionStorage.getItem('download_list_block_template')) {
window.download_list_template = sessionStorage.getItem('download_list_block_template');
} {
$.get('/plugin/software_communities/get_block_template', function(response) {
window.download_list_template = response;
sessionStorage.setItem('download_list_block_template', response);
});
}
}
$(document).ready(function() {
window.add_new_link = add_new_link;
window.delete_link = delete_link;
if( window.download_list_template === undefined ) {
get_download_list_template();
}
});
})(jQuery);