Jump to content

jQuerify a web page (injecting jQuery)


Gianni
 Share

Recommended Posts

Thank two masters!

https://stackoverflow.com/questions/5371139/window-scrolltop-vs-document-scrolltop

https://stackoverflow.com/questions/19291873/window-width-not-the-same-as-media-query

$jQuery(window).
$jQuery(document).

This writing-form  is still more common.

My browser is the IE11.

There is no problem running in a jquery environment.

But in Au3 if the jquery selector is not a string form it reports an error.

But nothing, and alternatives can be done...:)

 

 

 

Link to comment
Share on other sites

  • 2 weeks later...
#include <IE.au3>

Local $sID = "div1"
Local $oIE = _IECreate()
_IENavigate($oIE, @ScriptDir & "style.htm")

Local $Str = _
        'function getEleStyle(sid) {' & _
        '   var res = "";' & _
        '   var ele = document.getElementById(sid);' & _
        '   var css =(ele.currentStyle ? ele.currentStyle: window.getComputedStyle(ele, null));' & _
        '   var nam = "";' & _
        '   var val = "";' & _
        '   for (var i = 0; i < css.length; i++) {' & _
        '       nam = css.item(i);' & _
        '       val = css.getPropertyValue(nam);' & _
        '       res += nam + " = " + val + "%";' & _
        '   };' & _
        '   return res;' & _
        '};' & _
        'var sss = getEleStyle(' & $sID & ');sss;'

Local $Res = $oIE.document.parentWindow.eval($Str)
MsgBox(4096,"",$Res)

Again for au3 running the javascript-script.
The code is as above.Web-page file in the attachment.
After opening web file directly with a browser (IE11) ,it's running properly.
But turning to the au3 environment  it don't work.
What is the problem?

thanks advance!

style.htm

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...