1doc

mod 1doc!

  1. // ==UserScript==
  2. // @name 1doc
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.7
  5. // @description mod 1doc!
  6. // @license MIT
  7. // @author Dione
  8. // @match https://rolandia.1doc.com.br/?pg=doc/*
  9. // @match https://rolandia.1doc.com.br/?pg=painel/*
  10. // @require https://cdnjs.cloudflare.com/ajax/libs/PapaParse/4.3.3/papaparse.min.js
  11. // @resource csv https://drive.google.com/uc?export=download&id=1CcJqb-Fk-AG4iN46oNrGtDWk0ECmN0Q5
  12. // @grant GM_getResourceURL
  13. // ==/UserScript==
  14.  
  15. // contats alt. com wp https://drive.google.com/uc?export=download&id=1WLdEKU5roDkJN_KGaJUKsu-6-0t_nJbj
  16. //identificador nome email email2 cpf_cnpj funcao data_nasc telefone telefone2
  17.  
  18. (function() {
  19. 'use strict';
  20. var paginaAtual = window.location.href;
  21.  
  22. var divTitFixa = document.querySelectorAll('.tit')[document.querySelectorAll('.tit').length -1]
  23. document.onscroll = function() {
  24. if (window.scrollY > 800) {
  25. document.querySelectorAll(".envolucro")[0].appendChild(divTitFixa);
  26. } else if (window.scrollY < 100){
  27. document.querySelectorAll(".div_em_titulo")[document.querySelectorAll('.div_em_titulo').length -1].appendChild(divTitFixa);
  28. }
  29. };
  30.  
  31. $(".link_voltar").css('top', '140px');
  32. if (paginaAtual.search(/pg=painel\/listar/g) > 1) {
  33. var btn86 = document.createElement('a');
  34. btn86.className = "btn btn_nav btn-mini";
  35. btn86.id = "btn86";
  36. btn86.onclick = verificaAssinaturas;
  37. btn86.innerHTML = "<i class='icon-fire'></i>"
  38. var ref = document.querySelectorAll('.navega_caixa_refresh')[0]
  39. ref.insertAdjacentElement('afterend', btn86)
  40. }else if(paginaAtual.search(/pg=doc\/ver/g) > 1){
  41. var elmAss;
  42. agrupaAssinaturas();
  43. setInterval(function() {
  44. if (paginaAtual != window.location.href) {
  45. paginaAtual = window.location.href
  46. if (paginaAtual.search(/pg=doc\/ver/g) > 1) {
  47. agrupaAssinaturas();
  48. } else {
  49. document.getElementById('ass86').remove();
  50. }
  51. }
  52. }, 500);
  53.  
  54. Papa.parse(GM_getResourceURL("csv"), {
  55. download: true,
  56. header: true,
  57. complete: function(results) {
  58. var divinfo = document.getElementsByClassName('media-heading-user-info');
  59. for (let index = 0; index < divinfo.length; index++) {
  60.  
  61. var nome = divinfo[index].firstElementChild.dataset.content
  62. var contato = results.data.find(function(contato) { return contato.nome == nome; })
  63. var pai = divinfo[index].parentNode.parentNode;
  64. //elmInfo.append("telefone:",contato.telefone2)
  65. var elmInfo = document.createElement("span");
  66. elmInfo.class = 'inf86';
  67. if(contato?.fone == undefined)continue
  68. elmInfo.append("Telefone:", contato?.fone)
  69. pai.append(elmInfo)
  70. }
  71. }
  72. });
  73. }
  74.  
  75. function verificaAssinaturas() {
  76. let obj = document.querySelectorAll('.link_emissao_a');
  77. for (let p of obj) {
  78. if(p.parentElement.parentElement.children[4].lastElementChild.nodeName == 'SMALL')continue
  79. let xhr = new XMLHttpRequest();
  80. xhr.open('GET', p.href);
  81. xhr.responseType = 'document';
  82. xhr.onload = function() {
  83. var local = p.parentElement.parentElement.lastElementChild.previousElementSibling;
  84. if (xhr.status == 200) {
  85. var assinados = xhr.response.querySelectorAll('.badge-success');
  86. var pendentes = xhr.response.querySelectorAll('.badge-warning');
  87. if (pendentes.length > 0) {
  88. local.innerHTML += "<span style='color: #f3581c'><b>" + `Assinaturas:${assinados.length}/${pendentes.length+assinados.length}` + "<b></span>";
  89. } else {
  90. local.innerHTML += "<span style='color: #1b901b'><b>" + `Assinaturas:${assinados.length}/${pendentes.length+assinados.length}` + "<b></span>";
  91. }
  92.  
  93. for (let n = 0; n < pendentes.length; n++) {
  94. local.innerHTML += "<br>" + pendentes[n].title.replace(" ainda", '');
  95. }
  96. } else {
  97. alert(`Error ${xhr.status}: ${xhr.statusText}`);
  98. }
  99. };
  100. xhr.onerror = function() {
  101. alert("Request failed");
  102. };
  103. xhr.send();
  104. }
  105. verificaAssinaturas = undefined
  106. }
  107.  
  108. function agrupaAssinaturas(t) {
  109. if(elmAss){return}
  110. elmAss = document.createElement("div");
  111. elmAss.id = 'ass86';
  112. var ook = document.getElementsByClassName('badge-success');
  113. var not = document.getElementsByClassName('badge-warning');
  114. var linha = [];
  115. document.body.append(elmAss);
  116.  
  117. not.forEach(function(val) {
  118. linha.push("<span class='badge badge_env badge-warning tt' data-placement='left'><i class='icon-certificate'></i> Pendente </span>");
  119. linha.push(val.dataset.originalTitle);
  120. });
  121. ook.forEach(function(val) {
  122. linha.push("<span class='badge badge_env badge-success tt' data-placement='left'><i class='icon-certificate'></i> Assinado</span>");
  123. linha.push(val.dataset.originalTitle);
  124. });
  125.  
  126. for (let li of linha) {
  127. elmAss.innerHTML += (li);
  128. }
  129.  
  130. elmAss.style.setProperty('font-weight', 'initial');
  131. elmAss.style.setProperty('font-size', '12px');
  132. elmAss.style.setProperty('display', 'flex');
  133. elmAss.style.setProperty('position', 'fixed');
  134. elmAss.style.setProperty('top', '240px');
  135. elmAss.style.setProperty('right', '70px');
  136. elmAss.style.setProperty('flex-direction', 'column');
  137.  
  138. };
  139.  
  140.  
  141.  
  142. })();