Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the interface buttons have moved to the side #223

Closed
Azrael1980 opened this issue Oct 14, 2024 · 35 comments
Closed

the interface buttons have moved to the side #223

Azrael1980 opened this issue Oct 14, 2024 · 35 comments

Comments

@Azrael1980
Copy link

Win 10 Chrome browser

изображение

rizwansoaib added a commit that referenced this issue Nov 3, 2024
i hope #223 #216 #145 Fixed issue
@rizwansoaib
Copy link
Owner

@Azrael1980 please let me know once you get updates latest version and this issue is resolved or not yet

@Azrael1980
Copy link
Author

Azrael1980 commented Nov 3, 2024

@Azrael1980 please let me know once you get updates latest version and this issue is resolved or not yet

not work( no icons, no writing logs to site

3.2 version, not log to site too (((

@Azrael1980
Copy link
Author

Uncaught TypeError: Cannot read properties of null (reading 'parentElement')

var nno=""
var nkey;
chrome.storage.local.get('nno', function (myresult) {
nno = myresult.nno;
console.log("nno val in online.js",nno);
if(nno==2){

var mnkey=""
chrome.storage.local.get('mnkey', function (result2) {
mnkey = result2.mnkey;
console.log("mnkey val from online.js",mnkey,typeof(mnkey))

      if(mnkey != "undefined"){
        alert("Subcribe any Device for Notification\n"+mnkey)
        nkey=mnkey;
      }
      
        
    });
    
    
    }
             
}); 

console.log("nno val from online.js",nno);

pso=""
chrome.storage.local.get('pso', function (result3) {
pso = result3.pso;

});


console.log("pso val from online.js",pso);

function onotif(user) {
if(nkey==null||nkey==undefined||nkey==""||nkey=="undefined")
return
else{
var xhr = new XMLHttpRequest();
xhr.open("POST", nkey,true);
xhr.send("📱WhatsApp Monitor: "+user+" is Online")

}

}

function save(user,t1,t2,t){
var d = new Date();
var curd=d.toLocaleDateString("en-GB").split(' ')[0]
user=user.replace(/[^a-zA-Z0-9]/g, "")
curd=curd.replace(/[^a-zA-Z0-9]/g, "")

const surl='https://wpmonitor.online/save/'+user+'/'+curd+'/'+t1+'/'+t2+'/'+t
var xhr = new XMLHttpRequest();
xhr.open("GET",surl);
xhr.send()

}

function playsound()
{

let url = chrome.runtime.getURL('open.mp3')
let a = new Audio(url)
a.play()

}

setInterval(function(){
try{
olb=document.querySelector('#online_list_btn').innerText
if(olb=='true' && pso=='3')
{

  playsound();
}
prev=document.querySelectorAll('#userbtn')[0].innerHTML
if(prev!='null'&&pso=='1')
{
  playsound();
}

}
catch(err){}

try{
olb=document.querySelector('#online_list_btn').innerText
if(olb=='true' && pso=='3')
{

  playsound();
}

user=document.querySelectorAll('#contactbtn')[0].innerHTML;
if(user!='null')
onotif(user);
}
catch(err){}

},2200)

function dcsv2() {
console.log("Downloading History as CSV File")
var rows = document.body.querySelectorAll(' table' + ' tr');
var csv = [];
for (var i = 0; i < rows.length; i++) {
var row = [], cols = rows[i].querySelectorAll('td, th');
for (var j = 0; j < cols.length; j++) {
var data = cols[j].innerText.replace(/(\r\n|\n|\r)/gm, '').replace(/(\s\s)/gm, ' ')
row.push('"' + data + '"');
}
csv.push(row.join(';'));
}
var csv_string = csv.join('\n');

var filename = `whatsapp-monitor_${new Date().toISOString().split('T')[0]}&&${new Date().toLocaleTimeString()}.csv`;
var link = document.createElement('a');
link.style.display = 'none';
link.setAttribute('target', '_blank');
link.setAttribute('href', 'data:text/csv;charset=utf-8,' + encodeURIComponent(csv_string));
link.setAttribute('download', filename);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);



 /*

console.log(csv,csv_string);
// Save the CSV file.
var blob = new Blob([csv], {type: 'text/csv'});
var url = window.URL.createObjectURL(blob);
var link = document.createElement('a');
console.log(link,url);
link.href = url;
link.download = 'table.csv';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);

*/

}

chrome.storage.local.get('save_interval', function (result4) {
save_interval = parseInt(result4.save_interval);
if(save_interval>=1)
setInterval(dcsv2,save_interval*60000);

});

function isElementPresentById(id) {
return document.getElementById(id) !== null;
}

function exec_after_delay(){

const element_present =document.querySelector('div[aria-label="Status"]').parentElement.parentElement;
if(element_present && !(isElementPresentById('download')))
{



    var elementHeight = "30px";

    var btn = document.createElement("BUTTON");
    var btnImage = document.createElement("IMG");


    btnImage.src = "https://raw.githubusercontent.com/rizwansoaib/whatsapp-monitor/master/Chrome-Extension/WhatsApp%20Monitor/images/icons/csv_download.jpg";

    btnImage.style.height = elementHeight;
    btn.appendChild(btnImage);
    btn.id="download";
    element_present.appendChild(btn);


    /*
    var img=document.createElement("IMG");
    img.id="download"
    img.src="https://raw.githubusercontent.com/rizwansoaib/whatsapp-monitor/master/Chrome-Extension/WhatsApp%20Monitor/images/icons/csv_download.jpg"
    document.querySelector("#side > header").appendChild(img);
    */

    var img=document.createElement("IMG");
    img.src="https://raw.githubusercontent.com/rizwansoaib/whatsapp-monitor/master/Chrome-Extension/WhatsApp%20Monitor/images/icons/icon_gray.png"
    img.style.height = elementHeight;
    img.addEventListener("click", function() {
        chrome.runtime.sendMessage({ action: "open_popup" });
    });
    element_present.appendChild(img);



    console.log('background online.js loaded successfully');



    document.getElementById('download').addEventListener('click', dcsv2);

}

else{
    setTimeout(exec_after_delay,60000);
}

}

setTimeout(exec_after_delay,20000);

var numarray=[]
chrome.storage.sync.get('numarray', function (data) {
numarray = data.numarray;
if(numarray)
{

      //console.log('start',numarray);





    numarray.forEach(function(obj, index) {
      setTimeout(function(){
        openChat(obj)
      }, 5000 * (index + 1));
  });

    }

        
});







var openChat = phone => {

 // console.log('opening chat...',phone);
  var link = document.createElement("a");
  link.setAttribute("href", `whatsapp://send?phone=${phone}`);
  document.body.append(link);
  link.click();
  document.body.removeChild(link);
};

/*
chrome.tabs.query({active: true, currentWindow: true}).then(([tab]) => {
chrome.scripting.executeScript(
{
target: {tabId: tab.id},
files: ['websocket.js'],
// function: () => {}, // files or function, both do not work.
})
})

chrome.tabs.query({active: true, currentWindow: true}).then(([tab]) => {
chrome.scripting.executeScript(
{
target: {tabId: tab.id},
files: ['protobuf.js'],
// function: () => {}, // files or function, both do not work.
})
})

chrome.tabs.query({active: true, currentWindow: true}).then(([tab]) => {
chrome.scripting.executeScript(
{
target: {tabId: tab.id},
files: ['main.js'],
// function: () => {}, // files or function, both do not work.
})
})

*/

@rizwansoaib
Copy link
Owner

@Azrael1980 please let me know once you get updates latest version and this issue is resolved or not yet

not work( no icons, no writing logs to site

3.2 version, not log to site too (((

I have updated in version 3.3 soon after publish by Google in chrome webstore it will update extension automatically

@rizwansoaib
Copy link
Owner

Temporary solution to use new version 3.3

https://github.com/rizwansoaib/whatsapp-monitor/tree/master/Chrome-Extension

Features -
1.Now no need to open extension everytime when you open whatsapp it will start automatically if user is logged in WhatsApp Web

  1. No need to move mouse only should be open whatsapp web main screen all time

Let me know if anyone facing issue unfortunately I didn't tested it more so may be face issue on based on os, chrome version just type your issue here we will try to fix those issues in future updates

@Azrael1980
Copy link
Author

3.2 works well, but the buttons are on the side. Which doesn't bother me.
3.3 Still doesn't work, writes errors

@rizwansoaib
Copy link
Owner

3.2 works well, but the buttons are on the side. Which doesn't bother me. 3.3 Still doesn't work, writes errors

How you are able to use 3.3 its not published on Chrome web store?

Have you tried from release section zip file?

@rizwansoaib
Copy link
Owner

Are you using Whatsapp business?

I have tested the issue is for different version have different UI on whatsapp web in my Whatsapp there is sidebar on whatsapp web for chat,status, setting,profile, meta ai chat

I think in your whatsapp web there is no sidebar

@Azrael1980
Copy link
Author

3.2 работает хорошо, но кнопки сбоку. Что меня не беспокоит. 3.3 Все равно не работает, пишет ошибки

Как вы можете использовать версию 3.3, которая не опубликована в интернет-магазине Chrome?

Вы пробовали из zip-файла раздела выпуска?

YES

@rizwansoaib
Copy link
Owner

Screenshot_2024-11-04-13-50-53-52_40deb401b9ffe8e1df2f1cc5ba480b12

Whatsapp Web SideBar

@Azrael1980
Copy link
Author

I use a regular WhatsApp, you can see the sidebar in the picture. This works with version 3.2
On version 3.3 the sidebar is not visible.

изображение

@Azrael1980
Copy link
Author

изображение
3.3 error

@rizwansoaib
Copy link
Owner

изображение 3.3 error

Click on next parent element error

@Azrael1980
Copy link
Author

Azrael1980 commented Nov 4, 2024

Click on next parent element error

изображение

@rizwansoaib
Copy link
Owner

I will try to fix in next updates this error

Within 5 days

@Azrael1980
Copy link
Author

Thanks

@rizwansoaib
Copy link
Owner

Thanks

Please update your whatsapp in smartphone

Maybe I am on latest version of Whatsapp so sidebar is showing

@Azrael1980
Copy link
Author

photo_2024-11-04_11-45-16
Latest version for Russia)

@rizwansoaib
Copy link
Owner

Ok i got that I have beta

Screenshot_2024-11-04-14-43-31-01_6012fa4d4ddec268fc5c7112cbb265e7

Now I will try to fix bug based on your whatsapp version

Thank you for sending screenshot

@rizwansoaib
Copy link
Owner

chromev3.3_new.zip

This is alpha development version

@Azrael1980 please can you check by using extension in developer mode

@Azrael1980
Copy link
Author

chromev3.3_new.zip

Это альфа-версия разработки

@Azrael1980 пожалуйста, можете ли вы проверить, используя расширение в режиме разработчика

Everything works. You need to enable the extension. You don't need to move the mouse anymore. Cool

@rizwansoaib
Copy link
Owner

Even don't need to enable extension now from version 3.3 no need to open extension popup every time or click ok

Only need to open WhatsApp web and open contact chat ( or add contacts in favourite to open chat automatically)

@rizwansoaib
Copy link
Owner

Please check this also just close browser, open browser, open Whatsapp web

Once Whatsapp web will open automatically monitoring will start

@Azrael1980
Copy link
Author

No. If I don't launch the application, it goes to WhatsApp error

@Azrael1980
Copy link
Author

изображение

изображение

@rizwansoaib
Copy link
Owner

Refresh url at whatsapp web opened already

Wait for 30 sec if (icon of CSV downloader, Extension icon) in chat header its mean its working

Please try above steps

If not working this send me console error( Ctrl+shift+c then console tab) or browser extension error ( chrome://extensions)

@Azrael1980
Copy link
Author

web.whatsapp.com-1730805808109.log

I clear phone numbers

@rizwansoaib
Copy link
Owner

From log i think there should be no issue

@Azrael1980 does after refresh Whatsapp web after 30 sec extension icon and CSV downloader appeared in chat header ?

@Azrael1980
Copy link
Author

From log i think there should be no issue

@Azrael1980 does after refresh Whatsapp web after 30 sec extension icon and CSV downloader appeared in chat header ?

No

@rizwansoaib
Copy link
Owner

Ok

I need to test it more on different devices,version,os etc.

I will update here if I found any bug or feature not working

@rizwansoaib
Copy link
Owner

chromev3.3_new.zip

@Azrael1980
Copy link
Author

chromev3.3_new.zip

Works well in the following sequence:
Refresh the tab - turn on the add-on. No need to move the mouse, there are no icons.
Doesn't work if the add-on is enabled - refresh the tab or open the browser. It seems to start, but there is no time stamp under the name (I'll attach a picture) And the pop-up does not appear when the user is online.

изображение

@rizwansoaib
Copy link
Owner

Final version released

https://github.com/rizwansoaib/whatsapp-monitor/releases

in Windows, no Notification is showing but i have added Sound Alert please let me know sound Alert is working or not
I have tested on Mac its works well both notifications and sound.

@Azrael1980
Copy link
Author

The sound works.
But other problems remained the same.

@rizwansoaib
Copy link
Owner

Please list other problems

Will try to fix in upcoming version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants