Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
izidorio committed Dec 21, 2021
1 parent f92d46e commit 270b0bf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/js/models/handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ export async function preview(){

const name = nameGroup();
const created = dateCreatedGroup();


readGroup().then( ( contacts ) => {

contacts.sort( (a, b) => {
return b.admin - a.admin;
})

let html = `<title>${name}</title>${style}<h2>${name} (${contacts.length} participantes, <small>${created}</small>)</h2>`;
const meta = '<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">';
let html = `${meta}<title>${name}</title>${style}<h2>${name} (${contacts.length} participantes, <small>${created}</small>)</h2>`;

let cards = '';
let i = 1;
Expand Down
9 changes: 6 additions & 3 deletions src/js/models/scraping.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@ export function dateCreatedGroup() {

export async function readGroup() {

await setHeight('9999999999px');
// await setHeight('9999999999px');

return new Promise( async ( resolve ) => {

setTimeout( () => {
// div que envolve o avatar e os dados dos participantes do grupo
const elements = document.querySelectorAll('._2nY6U._3A-iD');
let elements = document.querySelectorAll('._2nY6U._3A-iD');


let contacts = [];

for (let item of elements){
Expand Down Expand Up @@ -83,7 +86,7 @@ export async function readGroup() {
}

resolve(contacts);
setHeight('100%');
//setHeight('100%');

}, 1500);

Expand Down
12 changes: 11 additions & 1 deletion src/js/models/setButtons.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const btnCopy = `<img id="btnCopy" title="Copia os participantes do grupo para a área de transferência" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABPlBMVEUAAAAnmIkklogmlocimYgllogmlYgllYkllokmlogll4gnk4sklYkllogllogpmYUllogmmIYllogmlogllogkkoAllYgjlYkjlocnlosmlogklogklocll4gllogmlogllogll4gklockl4gllogllYknl4YllogllogllogklYgmlYgkkokkl4kmlocml4Qgj48mlogllogllokllognl4cllogklogllokml4clloghm4UllYkkkoYklocllIgllogllYgjl4sllogllocllogmmYYllogkmIYllogllogolIYllogrlY4llogklYclmIkllocllYgmlokllocklokmlYcklIgmlogmlYgmlocllogllognk4kAgIAllockl4gui4sllogllogmlogll4oml4gllogllogAAAAZSkVZAAAAaHRSTlMANNlkD7upKdO+4yFquNsZrUrf7sMOmEEzLud+VcHczPDNd0fsUjue1eXLhxxbIhsQnPZh/kKlXJlR8hd7FeA++XQs+tHUKLQ588cmyiT8k0Wx17d1xIArejxmWvQaArNpC6z7ckyw3kT/zKcAAAABYktHRACIBR1IAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH5AgNARUt8LOwfgAAAO1JREFUKM9jYGBkyoACZhYGZMCaAZdgY0eW4EBIcHJxY5Xg4c3g48cmISAoJCwiikUiQ0xcQkISmwQISFEmIS0DArKYEnLyIKCQkaGopIzNchVVNXUNTS1tHbiErh4I6BsYQhQYGaPoMDE1g+s1h0oIgaywsEQ4zcoaImEDcpQtJ1TUzt4hwxHJKCfnDBdhIO3qBowIdyQJPWAoenhmeHn7ADk+QAl5qISvX0aGf0AgexCIEwyUCIFKyIQCibBwLjAnAuSsyCgw8IgGOxosHhOLHMdx8XDnJqCkCobEJIhwcgoDOkhNk3JIt3ADMQHjyH6B24+svQAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMC0wOC0xM1QwMToyMTo0NSswMDowMBcZLuEAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjAtMDgtMTNUMDE6MjE6NDUrMDA6MDBmRJZdAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAABJRU5ErkJggg==">`;
const btnDown = `<img id="btnDown" title="Baixa os participantes do grupo em .csv" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABSlBMVEUAAAAnmIkklogmlocimYgllogmlYgllYkllokmlogll4gnk4sklYkllogllogpmYUllogmmIYllogmlogllogkkoAllYgjlYkjlocnlosmlogklogklocll4gllogmlogllogll4gklockl4gllogllYknl4YllogllogllogklYgmlYgkkokkl4kmlocml4Qgj48mlogllogllokllognl4cllogllogllogklogllokml4cmlYclloghm4UllYkkkoYllogllYgjl4sllogllogllokmlokllogrlY4llogklYcll4gllogklogmlokllocklokllogmlooll4gllYcllogmlokmlYgmlockmIYllogllogA//8llognk4kAgIAllocllogllogkl4gui4sllogmlogll4oml4gllogmmYYllogAAADCz5b+AAAAbHRSTlMANNlkD7upKdO+4yFquNsZrUrf7sMOmEEzLud+VcHczPDNd0fsUjue1eXLhxxbIhsQnPZh/kKl/KxcmVE18hd7Fb90LPq0l4jKJPlGkEuNt3XE9T2JYHx5PGY5Wu0B9BoCs+b9aQv7ckyw3ijXHdg6AAAAAWJLR0QAiAUdSAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAAd0SU1FB+QIDQEPL66QK4kAAAD3SURBVCjPY2BgZMqBAmYWBmTAmgOXYGNHluBASHBycWOV4OHN4ePHJiEgKCQsIopFIkdMXEJCEpsECEhRJiEtAwKymBJy8iCgkJOjqKSMzXIVVTV1DU0tbR24hK4eCOgbGEIUGBmj6DAxNQOS5hYgtiVUQghkhZU12DgbEGlrB5GwBznKwREhkeOEZJSzC5KEK5KEXk6OphtIwsg9J8cDKCEPlfA0z/Hy9lGxcfH1y8nxB0oEQCVkAnNygoJDGEPDgJxwkLMiIsEgKhooECMZywOk4uKR4zghESiUpJ0MJFNQUgVDqgXE0LR0BnSQkSnllWWVDWICAI0UgJVgUvU0AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIwLTA4LTEzVDAxOjE1OjQ3KzAwOjAwEI/5swAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMC0wOC0xM1QwMToxNTo0NyswMDowMGHSQQ8AAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAAAElFTkSuQmCC">`;
const btnPrt = `<img id="btnPrt" title="Preview para impressão" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABblBMVEUAAAAnmIkklogmlocimYgllogmlYgllYkllokmlogll4gnk4sklYkllogllogpmYUllogmmIYllogmlogllogkkoAllYgjlYkjlocnlosmlogklogklocll4gllogmlogllogll4gklockl4gllogllYknl4YllogllogllogklYgmlYgkkokkl4kmlocml4Qgj48mlogllogmmYYmlYcllogllokllognl4cllogklYkkl4gllogml4cllogklogllokmlokmlocllogllogllYcmmYwllYkkkoYmlokjm4wimoYllYgjl4sllogllogmlYgmlogllogllogjl4UmlYcmlocklooklYkllogllogrlY4llogkl4sllocmlogllogmlokllocklokomo0llogll4cmlogmlYgkmIYllogllogok4gmlognk4kAgIAllocll4gkl4gui4sklokll4oml4gllogllogAAACb4XD3AAAAeHRSTlMANNlkD7upKdO+4yFquNsZrUrf7sMOmEEzLud+VcHczPDNd0fsUjue1eXLhxxbIhsQnOoogPZh/kKlY5r4UbJcmVBE2ouRFHsVqjMmdCz6+WXFtNgsV2Y/VPvKJPxAwnKSt3XEJs5Tejw5WvQtSRoCs59pC3BMsN49qpmoAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAAd0SU1FB+QIDQEQG0J+0aIAAAEOSURBVCjPY2BgZKqAAmYWBmTAWgGXYGNHluBASHBycWOV4OGt4OPHJiEgKCQsIopFokJMXEJCEpsECEhRJiEtAwKymBJy8iCgUFGhqKSMzXIVVTV1DU0tbR24hK4eCOgbGFYYyRibVJiaoegwt7CsqLCytrG1q6iwh0oIgaxwcATKOjlXuLhWVCi4QSTcQY7y4ARKeHopeWsCaR8ko3z9gIS/ekAgiBOEJKEHxMEhoWHhEZEVFVFACXmoRHRMRUVsHJARn1BRkQiUSIJKyCRX+KWAGKlpFRXpIGdlhIFBZlZFdg5Igim3IjsPOY7zC7K5WYGgMLeiCCVVMBR7loD1GsYzoIPSMin/cgdjEBMAbpqJtZrTgGcAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjAtMDgtMTNUMDE6MTY6MjcrMDA6MDA910s3AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIwLTA4LTEzVDAxOjE2OjI3KzAwOjAwTIrziwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAAASUVORK5CYII=">`;
const btnPrtModal = `<img id="btnPrtModal" title="Preview para impressão" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABblBMVEUAAAAnmIkklogmlocimYgllogmlYgllYkllokmlogll4gnk4sklYkllogllogpmYUllogmmIYllogmlogllogkkoAllYgjlYkjlocnlosmlogklogklocll4gllogmlogllogll4gklockl4gllogllYknl4YllogllogllogklYgmlYgkkokkl4kmlocml4Qgj48mlogllogmmYYmlYcllogllokllognl4cllogklYkkl4gllogml4cllogklogllokmlokmlocllogllogllYcmmYwllYkkkoYmlokjm4wimoYllYgjl4sllogllogmlYgmlogllogllogjl4UmlYcmlocklooklYkllogllogrlY4llogkl4sllocmlogllogmlokllocklokomo0llogll4cmlogmlYgkmIYllogllogok4gmlognk4kAgIAllocll4gkl4gui4sklokll4oml4gllogllogAAACb4XD3AAAAeHRSTlMANNlkD7upKdO+4yFquNsZrUrf7sMOmEEzLud+VcHczPDNd0fsUjue1eXLhxxbIhsQnOoogPZh/kKlY5r4UbJcmVBE2ouRFHsVqjMmdCz6+WXFtNgsV2Y/VPvKJPxAwnKSt3XEJs5Tejw5WvQtSRoCs59pC3BMsN49qpmoAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAAd0SU1FB+QIDQEQG0J+0aIAAAEOSURBVCjPY2BgZKqAAmYWBmTAWgGXYGNHluBASHBycWOV4OGt4OPHJiEgKCQsIopFokJMXEJCEpsECEhRJiEtAwKymBJy8iCgUFGhqKSMzXIVVTV1DU0tbR24hK4eCOgbGFYYyRibVJiaoegwt7CsqLCytrG1q6iwh0oIgaxwcATKOjlXuLhWVCi4QSTcQY7y4ARKeHopeWsCaR8ko3z9gIS/ekAgiBOEJKEHxMEhoWHhEZEVFVFACXmoRHRMRUVsHJARn1BRkQiUSIJKyCRX+KWAGKlpFRXpIGdlhIFBZlZFdg5Igim3IjsPOY7zC7K5WYGgMLeiCCVVMBR7loD1GsYzoIPSMin/cgdjEBMAbpqJtZrTgGcAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjAtMDgtMTNUMDE6MTY6MjcrMDA6MDA910s3AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIwLTA4LTEzVDAxOjE2OjI3KzAwOjAwTIrziwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAAASUVORK5CYII=">`;


import { saveCsv, preview, contactsToClipboard } from './handle.js';
Expand Down Expand Up @@ -84,7 +85,6 @@ const setButtons = setInterval( () => {
const wrapper_participantes = document.querySelector('._3e6xi');


console.log();
if( wrapper_participantes && !document.getElementById('btnCopy')){

const text = wrapper_participantes.innerHTML;
Expand All @@ -103,6 +103,16 @@ const setButtons = setInterval( () => {

}
}

const header = document.querySelector('header.-bGGW');
if(header && !document.getElementById('btnPrtModal')){
const button = document.createElement("div")
button.addEventListener("click", preview);
button.setAttribute('style',"margin-left: -25px; cursor: pointer")
button.innerHTML = `${btnPrtModal}`;
header.appendChild(button);
}


}, 2000);

Expand Down

0 comments on commit 270b0bf

Please sign in to comment.