script.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. $(document).ready(function(){
  2. $('.date').date();
  3. $('.infobulle').tooltip({placement:'bottom'});
  4. if($.urlParam('init')=='1'){
  5. $.getJSON($("#UPDATE_URL").html(),function(data){});
  6. }
  7. var page = window.location.href.split('/');
  8. page = page[page.length-1];
  9. if(page=='index.php' && $.trim($('.container .row:eq(0)').html()) == ''){
  10. $('.container .row:eq(0)').html('<div class="alert alert-warning">Aucune plugin n\'utilise la home actuellement, souhaitez vous <a href="action.php?action=ENABLE_DASHBOARD">activer la dashboard?</a></div>');
  11. }
  12. $('#btnSearchPlugin').trigger("click");
  13. });
  14. function maj(data){
  15. server = data.maj["yana-server"];
  16. if(server.version!=null && server.version!=$("#PROGRAM_VERSION").html()){
  17. $('#notification').html('1');
  18. $('#notification').css('visibility','visible');
  19. $('#notification').attr('title','Version '+server.version+' disponible.');
  20. if(server.link != null) $('#notification').attr('onclick','window.location="'+server.link+'";');
  21. }
  22. }
  23. function setRankAccess(rank,section,access,elem){
  24. var data = {
  25. action : 'set_rank_access',
  26. rank : rank,
  27. section : section,
  28. access : access,
  29. state : 0
  30. }
  31. if($(elem).is(':checked')) data.state = 1;
  32. $.ajax({
  33. url: "action.php",
  34. type: "POST",
  35. data: data
  36. });
  37. }
  38. function searchPlugin(keyword){
  39. $('#resultsPlugin').html('Chargement en cours...');
  40. var baseUrl = (location.protocol == 'https:'?"https://market.idleman.fr:666":"http://market.idleman.fr")
  41. $.getJSON(baseUrl+"/action.php?action=api&s=yana-server&m=search&k="+keyword+"&callback=?");
  42. }
  43. function jsonp(data){
  44. switch(data.method){
  45. case 'search':
  46. $('#resultsPlugin').html('');
  47. if(data.results!=null && data.results.length>0){
  48. for(var key in data.results){
  49. var plugin = data.results[key];
  50. tpl =
  51. '<li>\
  52. <ul>\
  53. <li><h4>Nom: </h4>'+plugin.name+'</li>\
  54. <li><h4>Auteur: </h4><a href="mailto:'+plugin.mail+'">'+plugin.author+'</a></li>\
  55. <li><h4>Licence: </h4><a href="http://google.fr/#q='+plugin.licence+'">'+plugin.licence+'</a></li>\
  56. <li><h4>Version: </h4><code>'+plugin.version+'</code></li>\
  57. <li><h4>Site web: </h4><a href="'+plugin.link+'">'+plugin.link+'</a></li>\
  58. <li>'+plugin.description+'</li>\
  59. <li><button class="btn" onclick="installPlugin(\''+plugin.dll+'\');">Installer</button></li>\
  60. </ul>\
  61. </li>';
  62. $('#resultsPlugin').append(tpl);
  63. }
  64. }else{
  65. $('#resultsPlugin').append('<li>Aucun résultats pour cette recherche.</li>');
  66. }
  67. break;
  68. case 'get':
  69. break;
  70. }
  71. }
  72. function installPlugin(url){
  73. $('#resultsPlugin').load('action.php?action=installPlugin&zip='+encodeURIComponent(url));
  74. }