Commit c9196328 authored by Benoît Minisini's avatar Benoît Minisini
Browse files

Support for absolute URLs in WebImage and WebAudio. Add WebAudio.Loop property.

[GB.WEB.GUI]
* NEW: WebImage: The Image property can be an absolute URL now.
* NEW: WebAudio: The Audio property can be an absolute URL now.
* NEW: WebAudio: Add a Loop property to make the sound automatically loop.
parent ddc985ce
Pipeline #361903686 passed with stage
in 26 minutes and 11 seconds
......@@ -25,6 +25,8 @@ End
Public Sub WebForm_Open()
WebImage1.Image = "https://radio.erfm.fr/static/erfm.png"
ReloadTable
WebTimer1_Timer
......
......@@ -4,7 +4,7 @@
#MoveScaled(0,0,138,91)
Height = "100%"
Arrangement = Arrange.Vertical
Shortcuts = ["F12", "F11"]
Shortcuts = ["F11"]
{ WebMenu1 WebMenu
Text = ("WebMenu1")
{ WebMenu3 WebMenu
......@@ -207,7 +207,6 @@
}
{ WebImage1 WebImage
#MoveScaled(1,8,133.75,6)
Image = "favicon.png"
}
{ lblTime WebLabel
#MoveScaled(1,15,133.75,4)
......
......@@ -12,8 +12,10 @@ Public Const _DefaultEvent As String = "Timer"
Event Timer
Property Audio As String
Property Loop As Boolean
Private $sAudio As String
Private $bLoop As Boolean
Public Sub _new()
......@@ -38,7 +40,9 @@ End
Public Sub _Render()
Print "<audio"; Me._GetClassId(); " src=\""; Html("/" & Application.Root &/ $sAudio); "\"></audio>";
Print "<audio"; Me._GetClassId(); " src=\""; Html(Me._GetLink($sAudio)); "\"";
If $bLoop Then Print " loop=\"1\"";
Print "></audio>";
End
......@@ -64,3 +68,16 @@ Public Sub Stop()
End
Private Function Loop_Read() As Boolean
Return $bLoop
End
Private Sub Loop_Write(Value As Boolean)
$bLoop = Value
Me.Refresh
End
......@@ -956,6 +956,17 @@ Private Sub Tooltip_Write(Value As String)
End
Public Sub _GetLink(sLink As String) As String
If sLink Begins "http://" Or If sLink Begins "https://" Then
Return sLink 'Application.Protocol &/ Mid$(sLink, InStr(sLink, ":"))
Else
Return "/" &/ Application.Root &/ sLink
Endif
End
Public Sub _GetImageLink(sImage As String) As String
' If Left(sImage) = "/" Then
......@@ -966,8 +977,8 @@ Public Sub _GetImageLink(sImage As String) As String
If sImage Begins "icon:/" Then
Return "/" &/ Application.Root &/ "icon:" & Replace(Mid$(sImage, 7), "/", ":")
Else
Return "/" &/ Application.Root &/ sImage
Else
Return _GetLink(sImage)
Endif
End
......
......@@ -73,8 +73,8 @@ Public Sub _RenderStyleSheet()
Endif
Me._AddStyleSheet("display:flex;")
Me._AddStyleSheet("flex-flow:column;")
'Me._AddStyleSheet("display:flex;")
'Me._AddStyleSheet("flex-flow:column;")
Me._EndStyleSheet
......@@ -83,7 +83,7 @@ End
Public Sub _Render()
If $sImage And If $iMode = Normal Then
Print "<img"; Me._GetClassId(); " style=\"visibility:hidden\" src=\""; Me._GetImageLink($sImage); "\">";
Print "<img"; Me._GetClassId(); " style=\"visibility:hidden;\" src=\""; Me._GetImageLink($sImage); "\">";
Endif
End
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment