5Outils

Outils complémentaires pour les vendeurs du site 5euros.com. Ce plugin est gratuit :-)

当前为 2018-01-10 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name 5Outils
  3. // @namespace http://tampermonkey.net/
  4. // @version 3.4
  5. // @description Outils complémentaires pour les vendeurs du site 5euros.com. Ce plugin est gratuit :-)
  6. // @author Thomas21
  7. // @match https://5euros.com/dashboard/commande/*
  8. // @match https://5euros.com/dashboard/thread/*
  9. // @match https://5euros.com/ventes
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. var APIKEY = "VotreCleIci"; // Entrez votre clé API ici, entre les guillemets
  16.  
  17.  
  18. var curPage = "";
  19.  
  20. if (window.location.href.indexOf("thread") > -1 || window.location.href.indexOf("commande") > -1) {
  21. curPage = "conversation";
  22. }
  23. if (window.location.href.indexOf("ventes") > -1) {
  24. curPage = "ventes";
  25. }
  26.  
  27. // Features appliquées aux conversations
  28. if(curPage == "conversation"){
  29. // Conteneur du script Boutons Custom
  30. var PageTargetBlock = $('.trackingControl-Timeline');
  31. if (window.location.href.indexOf("thread") > -1) {
  32. PageTargetBlock = $('.messageSubmit');
  33. }
  34.  
  35. $('body').on('click', '#restartAjax', function(){
  36. $('#restartAjax').parent().hide();
  37. loadDynamicButtons();
  38. });
  39. $(document).ready(function(){
  40. loadDynamicButtons();
  41. });
  42. }
  43.  
  44.  
  45. // Features appliquées au listing des commandes
  46. if(curPage == "ventes"){
  47. var tableauContainer = $('#threads-listing');
  48.  
  49. $(document).ready(function(){
  50. showCustomBadge(true);
  51. });
  52.  
  53. // Override la fonction
  54. var origupdateButtonFilters = window.updateButtonFilters;
  55. window.updateButtonFilters = function(argument) {
  56. origupdateButtonFilters();
  57. showCustomBadge(false);
  58. }
  59.  
  60. }
  61.  
  62.  
  63.  
  64.  
  65.  
  66. function loadDynamicButtons(){
  67. $.ajax({
  68. url: 'https://5outils.social-provider.com/controller/messagesController.php',
  69. type: 'GET',
  70. dataType: 'json',
  71. data: {
  72. ajax: '1',
  73. version: '3.4',
  74. security: APIKEY,
  75. url: window.location.href
  76. },
  77. error: function(retour) {
  78. erreurAjaxDynamicButtons('Impossible de joindre le serveur Social Provider.');
  79. },
  80. success: function(retour) {
  81. if(retour.status){
  82. PageTargetBlock.prepend(retour.content);
  83. }
  84. else {
  85. erreurAjaxDynamicButtons(retour.content);
  86. }
  87. },
  88. });
  89. }
  90.  
  91. function erreurAjaxDynamicButtons(messageErreur){
  92. PageTargetBlock.prepend('<div class="alert-danger"><b>Impossible de charger les boutons dynamiques :</b> '+messageErreur+' <button id="restartAjax" class="btn btn-small btn-default">Recommencer</button></div>');
  93. }
  94.  
  95.  
  96. function showCustomBadge(firstLoad){
  97. var messagesId = [];
  98. $('table.table tbody tr').each(function(){
  99. messagesId.push(($(this).attr("data-id")));
  100. });
  101. console.log("showCustomBadge() firstLoad: "+firstLoad);
  102.  
  103. $.ajax({
  104. url: 'https://5outils.social-provider.com/controller/orderController.php',
  105. type: 'GET',
  106. data: {
  107. action: 'badge',
  108. messagesId: messagesId,
  109. firstLoad: firstLoad,
  110. security: APIKEY
  111. },
  112. success: function(retour) {
  113. $('body').append(retour);
  114. },
  115. });
  116. }
  117.  
  118. })();