Well, it took a little longer because I had some WebView issues I had to solve before getting into this, since communicating between the plugin and the skin via the RainmeterAPI object was key in this case, but here it is...Yes, I'll wait and I'm ready to test.
[SkinFolder]\@Resources\Page.html:
Code:
<!DOCTYPE html><html> <body style="margin: 0; background-color: red;"> <script> var r = new XMLHttpRequest(), p = ""; r.onreadystatechange = function() {if (r.readyState == 4 && r.status == 200) {p = r.response; RainmeterAPI.Bang('[!SetOption Data String """' + p + '"""][!UpdateMeasure Data][!UpdateMeter *][!Redraw]');};}; r.open("GET", `https://api.allorigins.win/get?url=${encodeURIComponent("https://google.com")}`, true); r.responseType = "text"; r.send(); </script> </body></html>
Code:
[Rainmeter]Update=1000AccurateText=1DynamicWindowSize=1---Measures---[Page]Measure=PluginPlugin=WebViewX=0Y=0W=5H=5URL=file:///#@#Page.htmlUpdateDivider=-1[Data]Measure=StringString=UpdateDivider=-1RegExpSubstitute=1Substitute='(?siU)(?:^.*lang=(.*)>.*$|^.*$)':"\1",'\\(?=")':"","^\\\d+$":""---Meters---[Background]Meter=ShapeShape=Rectangle 0,0,600,350 | Fill Color 0,0,0,128 | StrokeWidth 0 | Stroke Color 0,0,0,0[PageData]Meter=StringX=(600/2)Y=(350/2)W=600H=350FontFace=ConsolasFontSize=12FontColor=255,255,255,255FontEffectColor=0,0,0,255StringEffect=ShadowStringAlign=CenterCenterAntiAlias=1ClipString=2MeasureName=DataText=Language: %1
P.S. The local page doesn't really need to be shown in the skin, since the response is passed to the [Data] measure automatically by the RainmeterAPI.Bang() part of the Javascript code, but I let it as a red 5 x 5 pixel "dot" in the top left corner of the skin, in case it's needed. If you want to see if getting the entire page source for a site works, just comment out (i.e. precede lines in the .ini with a ; symbol) the RegExpSubstitute and Substiitute lines, save the .ini and refresh the skin (the text will wrap and be clipped to fit the skin area, so it'll be just the part at the start of the desired page source).
P.S.S. In the Javascript code above, I used the "deprecated" XMLHttpRequest() to get the response. The "modern" fetch() can be used instead, if needed.
Statistics: Posted by Yincognito — Today, 2:18 pm