mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-03-12 00:45:14 +00:00
Update chrome.js
This commit is contained in:
parent
cc42490106
commit
730de840bf
|
@ -16,7 +16,8 @@ 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,22 +521,8 @@ var ChromeObject = function() {
|
|||
this.setPageId(null);
|
||||
}
|
||||
|
||||
// get current title
|
||||
var _title = this.getTitle();
|
||||
|
||||
// if not focused
|
||||
if (_title.indexOf(this.pageId.substring(0, 6)) < 0) {
|
||||
// save previous title
|
||||
this.title = _title;
|
||||
|
||||
// will be change title
|
||||
title = this.title + " " + this.pageId.substring(0, 6);
|
||||
|
||||
// change webpage title for focusing window
|
||||
this.setTitle(title);
|
||||
} else {
|
||||
title = _title; /// when it is already catch
|
||||
}
|
||||
// calling _focus()
|
||||
title = this._focus();
|
||||
|
||||
// find window by title
|
||||
var pageList = this.getPageList();
|
||||
|
@ -553,6 +540,29 @@ var ChromeObject = function() {
|
|||
return title;
|
||||
};
|
||||
|
||||
this._focus = function() {
|
||||
var title = "";
|
||||
|
||||
// get current title
|
||||
var _title = this.getTitle();
|
||||
|
||||
// if not focused
|
||||
if (_title.indexOf(this.pageId.substring(0, 6)) < 0) {
|
||||
// save previous title
|
||||
this.title = _title;
|
||||
|
||||
// will be change title
|
||||
title = this.title + " " + this.pageId.substring(0, 6);
|
||||
|
||||
// change webpage title for focusing window
|
||||
this.setTitle(title);
|
||||
} else {
|
||||
title = _title; /// when it is already catch
|
||||
}
|
||||
|
||||
return title;
|
||||
};
|
||||
|
||||
this.blur = function() {
|
||||
return this.setTitle(this.title);
|
||||
};
|
||||
|
@ -1123,6 +1133,24 @@ var ChromeObject = function() {
|
|||
this.__escape = function(value) {
|
||||
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();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user