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

Add Support for ViewOfThings #5

Open
name024 opened this issue Oct 12, 2022 · 0 comments
Open

Add Support for ViewOfThings #5

name024 opened this issue Oct 12, 2022 · 0 comments

Comments

@name024
Copy link

name024 commented Oct 12, 2022

The Extension could also work for WinCC ViewOfThings Website (Hosted from S7- CPU), if some minor Change apply.

Here the nessary Changes in the "background.js":

Please test the Unified RT side. I have no test opportunity.

let isViewOfThings = tabs[0].url.toLowerCase().endsWith('ViewOfThings/index.html') && tabs[0].title === 'WinCC Unified View-of-Things';
let isWinCcUnified = tabs[0].url.toLowerCase().endsWith('/webrh') && tabs[0].title === 'WinCC Unified RT';



if(isViewOfThings) {
  chrome.tabs.executeScript(
    tabs[0].id,
    {
      code: `
      // console.log('Login!');
      setTimeout(function() {
        var user = document.getElementById('user');
        var pass = document.getElementById('pass');
        var btn = document.getElementById('loginbutton');
        user.value = '${data.user}';
        pass.value = '${data2.pass}';
        pass.dispatchEvent(new Event('login'));
        btn.click();
      }, ${waitingTime});
    `
  });
}
else if (isWinCcUnified)
{
  chrome.tabs.executeScript(
    tabs[0].id,
    {
      code: `
      // console.log('Login!');
      setTimeout(function() {
        var d = document.getElementsByTagName('iframe')[0].contentWindow.document;
        var user = d.getElementById('username');
        var pass = d.getElementById('password');
        var btn = d.getElementById('loginFormSubmit');
        user.value = '${data.user}';
        pass.value = '${data2.pass}';
        pass.dispatchEvent(new Event('input'));
        btn.click();
      }, ${waitingTime});
    `
  });
}
@name024 name024 changed the title Add Feature for ViewOfThings Add Support for ViewOfThings Oct 12, 2022
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

1 participant