main.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //CHARGEMENT DE LA PAGE
  2. function init_plugin_customiser(){
  3. switch($.urlParam('page')){
  4. default:
  5. break;
  6. }
  7. }
  8. function customiser_preview(element){
  9. var card = $(element);
  10. var css = card.attr('data-css');
  11. var head = $('head');
  12. //Reset des cards
  13. $('.theme-cover.active').removeClass('active');
  14. $('.theme-cover span.info').text('Activer le thème');
  15. //Passe la card courante en active
  16. $('.theme-cover', card).addClass('active');
  17. $('span.info', card).text('Thème actif');
  18. $('link[href*="customiser/theme"]', head).remove();
  19. $('#customiser-preview').remove();
  20. if(css!='') head.append('<link rel="stylesheet" id="customiser-preview" type="text/css" href="'+css+'">');
  21. }
  22. function customiser_theme_install(){
  23. var file = JSON.parse($('#zipTheme').val());
  24. file = file[0];
  25. var data = {
  26. file: [{
  27. extension: file.extension,
  28. icon: file.icon,
  29. label: file.label,
  30. path: file.path,
  31. readableSize: file.readableSize,
  32. size: file.size,
  33. sort: file.sort,
  34. url: file.url,
  35. }],
  36. action : 'customiser_theme_install'
  37. };
  38. $.action(data,function(){
  39. $.message('success','Installé');
  40. $('#zipTheme').val('');
  41. init_components($('#zipTheme').parent());
  42. },function(){
  43. $('#zipTheme').val('');
  44. init_components($('#zipTheme').parent());
  45. });
  46. }
  47. function customiser_theme_save(){
  48. $.action({
  49. action : 'customiser_theme_save',
  50. theme : $('[name="selected-theme"]:checked').val()
  51. },function(){
  52. $.message('success','Enregistré');
  53. });
  54. }