mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-12 04:31:04 +00:00
Update chrome.js
This commit is contained in:
parent
0522f77dde
commit
44a885788d
|
@ -369,6 +369,8 @@ var ChromeObject = function() {
|
|||
};
|
||||
|
||||
this.focus = function() {
|
||||
var title = "";
|
||||
|
||||
if (this.debuggingPort > 0) {
|
||||
try {
|
||||
// set page id
|
||||
|
@ -379,25 +381,27 @@ var ChromeObject = function() {
|
|||
// get current title
|
||||
this.title = this.getTitle();
|
||||
|
||||
// new title
|
||||
var _title = this.title + " " + this.pageId.substring(0, 6);
|
||||
// will be change title
|
||||
title = this.title + " " + this.pageId.substring(0, 6);
|
||||
|
||||
// change webpage title for focusing window
|
||||
this.setTitle(_title);
|
||||
this.setTitle(title);
|
||||
|
||||
// find window by title
|
||||
var pageList = this.getPageList();
|
||||
if (pageList.length > 0) {
|
||||
this.oAutoIt.WinActivate(_title);
|
||||
this.oAutoIt.WinActivate(title);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("ChromeObject._focus() ->", e.message);
|
||||
}
|
||||
}
|
||||
|
||||
return title;
|
||||
};
|
||||
|
||||
this.blur = function() {
|
||||
this.setTitle(this.title);
|
||||
return this.setTitle(this.title);
|
||||
};
|
||||
|
||||
this.getScrollHeight = function(selector) {
|
||||
|
@ -424,11 +428,9 @@ var ChromeObject = function() {
|
|||
};
|
||||
|
||||
this.autoAdjust = function(sX, sY) {
|
||||
// get current title
|
||||
var _title = this.getTitle();
|
||||
|
||||
// change webpage title
|
||||
this.setTitle(this.pageId);
|
||||
// catch focus
|
||||
var title = this.focus();
|
||||
sleep(300);
|
||||
|
||||
// adjust window position and size
|
||||
var bX = Math.floor(sX / 6);
|
||||
|
@ -437,14 +439,10 @@ var ChromeObject = function() {
|
|||
var y = this.getRandomInt(0, bY);
|
||||
var w = this.getRandomInt(bX * 3, sX - bX);
|
||||
var h = this.getRandomInt(bY, sY - bY);
|
||||
this.oAutoIt.WinMove(this.pageId, "", x, y, w, h);
|
||||
this.oAutoIt.WinMove(title, "", x, y, w, h);
|
||||
|
||||
// change webpage title to original
|
||||
this.setTitle(_title);
|
||||
};
|
||||
|
||||
this.blur = function() {
|
||||
return this.evaluate("window.blur()");
|
||||
// release focus
|
||||
this.blur();
|
||||
};
|
||||
|
||||
this.downMouseWheel = function(times) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user