mirror of
				https://github.com/gnh1201/welsonjs.git
				synced 2025-10-30 20:41:18 +00:00 
			
		
		
		
	Update chrome.js
This commit is contained in:
		
							parent
							
								
									233207c200
								
							
						
					
					
						commit
						15a6be1ec1
					
				|  | @ -600,18 +600,19 @@ var ChromeObject = function() { | |||
|     this.getNestedElementPosition = function(selector, subSelector, searchText, startIndex) { | ||||
|         var s = ''; | ||||
|         var startIndex = (typeof startIndex !== 'undefined' ? startIndex : 0); | ||||
|         var isSelfSelector = (subSelector == ":self");  | ||||
| 
 | ||||
|         if (searchText.indexOf(':tokenize(') == 0) { | ||||
|             searchText = searchText.substring(searchText.indexOf('(') + 1, searchText.lastIndexOf(')')); | ||||
|             s += '(function() {' | ||||
|                 + '    var elements = Object.values(document.querySelectorAll("' + selector + '")).filter(function(x) {' | ||||
|                 + '        var el = x.querySelector("' + subSelector + '");' | ||||
|                 + '        var el = x' + (!isSelfSelector ? '' : '.querySelector("' + subSelector + '")') + ';' | ||||
|                 + '        var keywords = decodeURIComponent("' + encodeURIComponent(searchText) + '").trim().split(" ");' | ||||
|                 + '        var text = el instanceof HTMLElement ? [el.innerText, el.getAttribute("aria-label"), el.getAttribute("class")].join(" ") : "";' | ||||
|                 + '        return (text.split(" ").filter(function(w) { return keywords.indexOf(w) > -1; }).length >= keywords.length);' | ||||
|                 + '    ' + (startIndex > 0 ? '}).slice(' + startIndex + ');' : '});') | ||||
|                 + '    if (elements.length > 0) {' | ||||
|                 + '        var rect = elements[0].getBoundingClientRect();' | ||||
|                 + '        var rect = elements[0]' + (!isSelfSelector ? '' : '.querySelector("' + subSelector + '")') + '.getBoundingClientRect();' | ||||
|                 + '        return [parseInt(rect.left), parseInt(rect.top), window.pageXOffset + parseInt(rect.left), window.pageYOffset + parseInt(rect.top), parseInt(rect.width), parseInt(rect.height)].join(",");'  | ||||
|                 + '    } else {' | ||||
|                 + '        return "";' | ||||
|  | @ -650,13 +651,13 @@ var ChromeObject = function() { | |||
|         } else { | ||||
|             s += '(function() {' | ||||
|                 + '    var elements = Object.values(document.querySelectorAll("' + selector + '")).filter(function(x) {' | ||||
|                 + '        var el = x.querySelector("' + subSelector + '");' | ||||
|                 + '        var el = x' + (!isSelfSelector ? '' : '.querySelector("' + subSelector + '")') + ';' | ||||
|                 + '        var searchText = decodeURIComponent("' + encodeURIComponent(searchText) + '").trim();' | ||||
|                 + '        var text = el instanceof HTMLElement ? [el.innerText, el.getAttribute("aria-label"), el.getAttribute("class")].join(" ") : "";' | ||||
|                 + '        return (text.indexOf(searchText) > -1);' | ||||
|                 + '    ' + (startIndex > 0 ? '}).slice(' + startIndex + ');' : '});') | ||||
|                 + '    if (elements.length > 0) {' | ||||
|                 + '        var rect = elements[0].getBoundingClientRect();' | ||||
|                 + '        var rect = elements[0]' + (!isSelfSelector ? '' : '.querySelector("' + subSelector + '")') + '.getBoundingClientRect();' | ||||
|                 + '        return [parseInt(rect.left), parseInt(rect.top), window.pageXOffset + parseInt(rect.left), window.pageYOffset + parseInt(rect.top), parseInt(rect.width), parseInt(rect.height)].join(",");'  | ||||
|                 + '    } else {' | ||||
|                 + '        return "";' | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 GitHub
							GitHub