mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-21 09:01:05 +00:00
Update chrome.js
This commit is contained in:
parent
cc42490106
commit
730de840bf
|
@ -17,6 +17,7 @@ var pageEventId = 0;
|
|||
var ChromeObject = function() {
|
||||
STD.EventableObject.apply(this, arguments); // set this object to `eventable`
|
||||
|
||||
this.vendor = "Chrome";
|
||||
this.workingDirectory = SYS.getEnvString("PROGRAMFILES") + "\\Google\\Chrome\\Application";
|
||||
this.binPath = SYS.getEnvString("PROGRAMFILES") + "\\Google\\:installedDir\\Application\\chrome.exe";
|
||||
//this.processID = 0;
|
||||
|
@ -520,6 +521,28 @@ var ChromeObject = function() {
|
|||
this.setPageId(null);
|
||||
}
|
||||
|
||||
// calling _focus()
|
||||
title = this._focus();
|
||||
|
||||
// find window by title
|
||||
var pageList = this.getPageList();
|
||||
if (pageList.length > 0) {
|
||||
this.oAutoIt.WinActivate(title);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("ChromeObject._focus() ->", e.message);
|
||||
}
|
||||
}
|
||||
|
||||
// calling `onfocus` event
|
||||
this.dispatchEvent(new STD.Event("focus"));
|
||||
|
||||
return title;
|
||||
};
|
||||
|
||||
this._focus = function() {
|
||||
var title = "";
|
||||
|
||||
// get current title
|
||||
var _title = this.getTitle();
|
||||
|
||||
|
@ -537,19 +560,6 @@ var ChromeObject = function() {
|
|||
title = _title; /// when it is already catch
|
||||
}
|
||||
|
||||
// find window by title
|
||||
var pageList = this.getPageList();
|
||||
if (pageList.length > 0) {
|
||||
this.oAutoIt.WinActivate(title);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("ChromeObject._focus() ->", e.message);
|
||||
}
|
||||
}
|
||||
|
||||
// calling `onfocus` event
|
||||
this.dispatchEvent(new STD.Event("focus"));
|
||||
|
||||
return title;
|
||||
};
|
||||
|
||||
|
@ -1124,6 +1134,24 @@ var ChromeObject = function() {
|
|||
return 'decodeURIComponent("' + encodeURIComponent(value) + '")';
|
||||
};
|
||||
|
||||
this.setVendor = function(vendor) {
|
||||
var vendor = vendor.toLowerCase();
|
||||
|
||||
switch (vendor) {
|
||||
case "msedge":
|
||||
this.workingDirectory = SYS.getEnvString("PROGRAMFILES(X86)") + "\\Microsoft\\Edge\\Application";
|
||||
this.binPath = SYS.getEnvString("PROGRAMFILES(X86)") + "\\Microsoft\\Edge\\Application\\chrome.exe";
|
||||
break;
|
||||
|
||||
case "chrome":
|
||||
this.workingDirectory = SYS.getEnvString("PROGRAMFILES") + "\\Google\\Chrome\\Application";
|
||||
this.binPath = SYS.getEnvString("PROGRAMFILES") + "\\Google\\:installedDir\\Application\\chrome.exe";
|
||||
break;
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
this.create();
|
||||
};
|
||||
ChromeObject.prototype = new STD.EventableObject();
|
||||
|
|
Loading…
Reference in New Issue
Block a user