It is currently October 18th, 2024, 6:26 am

PluginWebView - Make skin using web technology

Share and get help with Plugins and Addons
User avatar
tass_co
Posts: 523
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: PluginWebView - Make skin using web technology

Post by tass_co »

Hello again :welcome:
I have a question.

Is there a chance to reload or refresh the page if there is a change in the page content?

I created a web page with Arduino. There is javascript code in the web page content. I access the page from different devices. When I make a change on my phone, the change is not updated on the open page on my PC. I need to refresh the skin. How can I do that solve?
I don't know where i going from here, but i promise it won't be boring... :great:
User avatar
Yincognito
Rainmeter Sage
Posts: 8485
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: PluginWebView - Make skin using web technology

Post by Yincognito »

tass_co wrote: June 26th, 2024, 12:28 pm Hello again :welcome:
I have a question.

Is there a chance to reload or refresh the page if there is a change in the page content?

I created a web page with Arduino. There is javascript code in the web page content. I access the page from different devices. When I make a change on my phone, the change is not updated on the open page on my PC. I need to refresh the skin. How can I do that solve?
I suppose the easiest way would be to periodically, at reasonable / acceptable intervals, update your WebView measure in the skin, using the OnUpdateAction of another UpdateDivider featured dummy measure, regardless of whether a change occurred or not.

Other than that, there are some GitHub tools appearing to do that (google them), there are various event listeners, there are some mutation observers, though I'm not sure they'll suit your case given its particularities:
https://www.w3schools.com/jsref/dom_obj_event.asp
https://en.m.wikipedia.org/wiki/DOM_event
https://stackoverflow.com/questions/5416822/dom-mutation-events-replacement
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
tass_co
Posts: 523
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: PluginWebView - Make skin using web technology

Post by tass_co »

Yincognito wrote: June 26th, 2024, 3:51 pm I suppose the easiest way would be to periodically, at reasonable / acceptable intervals, update your WebView measure in the skin, using the OnUpdateAction of another UpdateDivider featured dummy measure, regardless of whether a change occurred or not.

Other than that, there are some GitHub tools appearing to do that (google them), there are various event listeners, there are some mutation observers, though I'm not sure they'll suit your case given its particularities:
https://www.w3schools.com/jsref/dom_obj_event.asp
https://en.m.wikipedia.org/wiki/DOM_event
https://stackoverflow.com/questions/5416822/dom-mutation-events-replacement
Thank you :great:

Actually, I found different solutions, but this time I got stuck in the CORS obstacle. I need to do some more research
I don't know where i going from here, but i promise it won't be boring... :great:
User avatar
Yincognito
Rainmeter Sage
Posts: 8485
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: PluginWebView - Make skin using web technology

Post by Yincognito »

tass_co wrote: June 26th, 2024, 4:10 pm but this time I got stuck in the CORS obstacle
Don't remind me of it, lol. It may be necessary and all in some cases, but otherwise workarounding it is a pain in the... :twisted:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
tass_co
Posts: 523
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: PluginWebView - Make skin using web technology

Post by tass_co »

Yincognito wrote: June 26th, 2024, 4:31 pm Don't remind me of it, lol. It may be necessary and all in some cases, but otherwise workarounding it is a pain in the... :twisted:
:D
I don't know where i going from here, but i promise it won't be boring... :great:
tit
Posts: 2
Joined: December 23rd, 2010, 8:39 pm

Re: PluginWebView - Make skin using web technology

Post by tit »

I also thought for a long time how to update the page, try the script

Code: Select all

-- urls.lua
urls = {
    "https://ohohohoho.com",
    "https://ohohohoho.com"
}
currentIndex = 1

function Initialize()
    -- oho
end

function Update()

    SKIN:Bang('!SetOption', 'MeasureWebView', 'URL', urls[currentIndex])
    SKIN:Bang('!UpdateMeasure', 'MeasureWebView')
    SKIN:Bang('!Redraw')

    currentIndex = currentIndex + 1
    if currentIndex > #urls then
        currentIndex = 1
    end
end

config ini

Code: Select all


[Rainmeter]
Update=60000  ; 60s

[MeasureScript]
Measure=Script
ScriptFile=urls.lua
UpdateDivider=1

[MeasureWebView]
Measure=Plugin
Plugin=WebView
URL=https://ohohohoho.com

[WebViewMeter]
Meter=String
MeasureName=MeasureWebView
X=10
Y=10
W=800
H=600

User avatar
tass_co
Posts: 523
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: PluginWebView - Make skin using web technology

Post by tass_co »

tit wrote: July 2nd, 2024, 7:01 am I also thought for a long time how to update the page, try the script

Code: Select all

-- urls.lua
urls = {
    "https://ohohohoho.com",
    "https://ohohohoho.com"
}
currentIndex = 1

function Initialize()
    -- oho
end

function Update()

    SKIN:Bang('!SetOption', 'MeasureWebView', 'URL', urls[currentIndex])
    SKIN:Bang('!UpdateMeasure', 'MeasureWebView')
    SKIN:Bang('!Redraw')

    currentIndex = currentIndex + 1
    if currentIndex > #urls then
        currentIndex = 1
    end
end

config ini

Code: Select all


[Rainmeter]
Update=60000  ; 60s

[MeasureScript]
Measure=Script
ScriptFile=urls.lua
UpdateDivider=1

[MeasureWebView]
Measure=Plugin
Plugin=WebView
URL=https://ohohohoho.com

[WebViewMeter]
Meter=String
MeasureName=MeasureWebView
X=10
Y=10
W=800
H=600


Thank you for the code :bow:
I decided to use !ToggleConfig instead of updating
I don't know where i going from here, but i promise it won't be boring... :great: