Commits (5)
../../gambas3/help/wiki/highlight.js
\ No newline at end of file
......@@ -686,9 +686,7 @@ DIV.welcome {
color: #3398C3;
/*padding: 0.5em 1em;*/
/*border-radius: 1em;*/
font-size: 150%;
line-height: normal;
letter-spacing: 1px;
}
DIV.news {
......@@ -697,8 +695,8 @@ DIV.news {
border-radius: 0.6em;*/
margin-top: 2em;
margin-bottom: 1em;
border-top: solid 0.4em #3398C3;
padding-left: 8em;
border-top: solid 1px #3398C3;
padding-left: 5em;
padding-right: 2em;
}
......@@ -710,17 +708,17 @@ DIV.news > H3 {
DIV.date {
position: relative;
float: left;
display: table;
font-weight: bold;
border: solid 0.4em #3398C3;
border-radius: 100%;
margin-top: -1.5em;
margin-left: -7em;
width: 5em;
display: flex;
flex-direction: column;
border: solid 1px #3398C3;
margin-top: -1px;
margin-left: -5em;
width: 4em;
height: 5em;
background: white;
color: #3398C3;
line-height: 1.2em;
padding: 0.25em 0;
box-sizing: border-box;
}
DIV.release {
......@@ -728,11 +726,29 @@ DIV.release {
color: white;
}
DIV.date P {
display: table-cell;
vertical-align: middle;
DIV.date > * {
display: block;
text-align: center;
line-height: initial;
}
DIV.date > M {
flex-grow: 0;
flex-shrink: 0;
text-transform: uppercase;
font-weight: bold;
}
DIV.date > D {
font-size: 200%;
flex-grow: 1;
line-height: 100%;
}
DIV.date > Y {
flex-grow: 0;
flex-shrink: 0;
font-size: 75%;
font-weight: bold;
}
DIV.result {
......@@ -761,6 +777,10 @@ IMG.screenshot {
box-shadow: 0 0 0.5em rgba(0,0,0,0.25);
}
VIDEO.screenshot {
box-shadow: 0 0 0.5em rgba(0,0,0,0.25);
}
#welcome {
font-size: 200%;
font-weight: bold;
......
' Gambas module file
Enum WANT_DATE, WANT_DAY, WANT_MONTH, WANT_YEAR, WANT_END_DATE
Public Sub Main()
Dim hFile As File
Dim sLine As String
Dim aResult As String[]
Dim sTrim As String
Dim iMode As Integer
Dim sDate As String
Dim sDay As String
hFile = Open "news.txt"
aResult = New String[]
iMode = WANT_DATE
For Each sLine In hFile.Lines
sTrim = Trim(sLine)
Select Case iMode
Case WANT_DATE
If sTrim Begins "[[ date" Then
sDate = "<div class=\"" & Mid$(sTrim, 4) & "\">"
iMode = WANT_DAY
Continue
Endif
Case WANT_DAY
sDay = sTrim
iMode = WANT_MONTH
Continue
Case WANT_MONTH
sDate &= "<m>" & Left(Replace(sTrim, "\\", ""), 3) & "</m>"
sDate &= "<d>" & Format(CInt(Replace(sDay, "\\", "")), "00") & "</d>"
iMode = WANT_YEAR
Continue
Case WANT_YEAR
sDate &= "<y>" & Replace(sTrim, "\\", "") & "</y></div>"
aResult.Add(sDate)
iMode = WANT_END_DATE
Continue
Case WANT_END_DATE
iMode = WANT_DATE
If sTrim = "]]" Then Continue
End Select
aResult.Add(sLine)
Next
Print aResult.Join("\n")
End
......@@ -493,6 +493,16 @@ Public Sub Main()
Try Mkdir Root
' Protocol
If CGI["HTTP_X_CGI"] = "https" Or If CGI["REQUEST_SCHEME"] = "https" Or If CGI["X_CGI"] = "https" Then
Application.Protocol = "https"
Else If CGI["HTTP_CF_VISITOR"] Then
If InStr(CGI["HTTP_CF_VISITOR"], "\"scheme\":\"https\"") Then
Application.Protocol = "https"
Endif
Endif
' All pages are stored in a "data" directory stored in the root directory.
' If the "data" directory does not exist, the wiki is initialized with a default root page.
......@@ -1229,6 +1239,12 @@ Public Sub GetChanges() As String[]
aCol = Split(aLine[I], "|")
If aCol.Count < 3 Then Continue
' Fix a Gambas Format$() bug
If aCol[0] Begins "/" Then
aCol[0] = Mid$(aCol[0], 2, 2) & "/" & Mid$(aCol[0], 5, 2) & "/" & Mid$(aCol[0], 7, 4) & " " & Mid$(aCol[0], 13, 2) & ":" & Mid$(aCol[0], 16, 2) & ":" & Mid$(aCol[0], 18, 2)
Endif
aResult.Add("<tr><td>" & Left(Trim(aCol[0]), 19) & "</td><td>" & Trim(aCol[1]) & "</td>")
sLink = Trim(aCol[2])
......@@ -1564,11 +1580,16 @@ Private Sub SearchWiki(sText As String)
Dim sDir As String
Dim sFile As String
Dim sPath As String
Dim aFind As String[]
Dim sData As String
Dim iPos As Integer
Dim sCar As String
Dim sRoot As String
Dim aDir As New String[]
Dim aImageExt As String[]
Dim aSearch As String[]
Dim sSearch As String
Dim sLink As String
Dim sExt As String
Dim sTitle As String
sText = Trim(sText)
If Not sText Then Return
......@@ -1576,41 +1597,37 @@ Private Sub SearchWiki(sText As String)
Session["search-query"] = sText
'sText = String.RemoveDiacritics(sText)
aImageExt = ["png", "jpg", "jpeg", "gif", "webm", "mov", "mp4", "mp3"]
aSearch = Split(sText, " ", Chr$(34), True)
aFind = New String[]
sDir = Root &/ "data" &/ Lang
For Each sFile In RDir(sDir, "*", gb.Directory)
sPath = GetPagePathFrom(sFile)
If Not Exist(sPath) Then Continue
sData = File.Load(sPath)
iPos = 0
sRoot = Root &/ "data" &/ Lang
aDir.Add(sRoot)
While aDir.Count
Do
iPos = InStr(sData, sText, iPos + 1, gb.IgnoreCase)
If iPos = 0 Then Break
If iPos > 1 Then
sCar = Mid$(sData, iPos - 1, 1)
If IsLetter(sCar) Or If IsDigit(sCar) Or If Not IsAscii(sCar) Then Goto NEXT_SEARCH
Endif
If iPos < Len(sData) Then
sCar = Mid$(sData, iPos + Len(sText), 1)
If IsLetter(sCar) Or If IsDigit(sCar) Or If Not IsAscii(sCar) Then Goto NEXT_SEARCH
Endif
Break
NEXT_SEARCH:
iPos += Len(sText)
Loop
sDir = aDir.Pop()
sLink = Mid$(sDir, Len(sRoot) + 1)
sTitle = GetPageTitle(sLink)
Try sData = File.Load(sDir &/ "~page")
If Not Error Then
For Each sSearch In aSearch
If String.InStr(sTitle, sSearch, 1, gb.IgnoreCase) Or If String.InStr(sData, sSearch, 1, gb.IgnoreCase) Then
sLink = Mid$(sDir, Len(sRoot) + 1)
If Not sLink Then sLink = "/"
aFind.Add(sLink)
Break
Endif
Next
Endif
If iPos Then aFind.Add("/" & sFile)
For Each sFile In Dir(sDir, "*", gb.Directory)
sExt = File.Ext(sFile)
If aImageExt.Exist(sExt) Then Continue
aDir.Add(sDir &/ sFile, 0)
Next
Next
Wend
Session["search-result"] = aFind
......
......@@ -15,11 +15,11 @@
<title><%_PrintTitle%> - <%=("Gambas Documentation")%></title>
<script type="text/javascript" src="<%/%>/playground.js?l=<%=Request["l"]%>"></script>
<%If Request["ht"]%>
<script type="text/javascript" src="<%/%>/hilitor.js"></script>
<script type="text/javascript" src="<%/%>/highlight.js"></script>
<%Endif%>
</head>
<body<%If Main.Edit Then%> style="overflow:hidden;"<%Endif%><%If Request["ht"]%> onload="highlight_text()"<%Endif%>>
<body<%If Main.Edit Then%> style="overflow:hidden;"<%Endif%><%If Request["ht"]%> onload="highlight_check()"<%Endif%>>
<%If Request.Exist("nt")%>
<style type="text/css">
......
......@@ -47,8 +47,8 @@ End
Public Sub Main()
Dim hHighlighter As TextHighlighter
'Dim sLine As String
' Dim L As Integer
' Dim sLine As String
' Dim L As Integer
hHighlighter = TextHighlighter["webpage"]
......
......@@ -17,8 +17,9 @@ Static Public Sub _init()
$aKeywords = New String[]
For Each sStr In ["break", "case", "catch", "class", "const", "continue", "debugger", "default", "delete", "do", "else", "enum", "export", "extends", "finally", "for",
"function", "if", "import", "in", "instanceof", "new", "return", "super", "switch", "throw", "try", "typeof", "var", "void", "while", "with", "yield"]
For Each sStr In ["break", "case", "catch", "class", "const", "continue", "debugger", "default", "delete", "do", "else", "enum", "export",
"extends", "finally", "for", "function", "get", "if", "import", "in", "instanceof", "new", "return", "set", "super", "switch", "throw",
"try", "typeof", "var", "void", "while", "with", "yield"]
$cKeyword[sStr] = 0
$aKeywords.Add(sStr)
Next
......
......@@ -13,6 +13,7 @@ animation-iteration-count #number,infinite,initial,inherit,unset
animation-name #keyframename,none,initial,inherit,unset
animation-play-state paused,running,initial,inherit,unset
animation-timing-function linear,ease,ease-in,ease-out,ease-in-out,step-start,step-end,steps,cubic-bezier,initial,inherit,unset
appearance none,auto,menulist-button,textfield
backface-visibility visible,hidden,initial,inherit,unset
background @background-color,@background-image,@background-position,@background-size,@background-repeat,@background-origin,@background-clip,@background-attachment,initial,inherit,unset
background-attachment scroll,fixed,local,initial,inherit,unset
......
' Gambas class file
Export
Static Property Read Shift As Boolean
Static Property Read Control As Boolean
Static Property Read Alt As Boolean
Static Property Read Meta As Boolean
Static Property Read Normal As Boolean
Static Property Read Code As String
Static Public _Event As Collection
Static Private Function Shift_Read() As Boolean
If Not _Event Then Error.Raise("No keyboard data")
Return _Event["shiftKey"]
End
Static Private Function Control_Read() As Boolean
If Not _Event Then Error.Raise("No keyboard data")
Return _Event["controlKey"]
End
Static Private Function Alt_Read() As Boolean
If Not _Event Then Error.Raise("No keyboard data")
Return _Event["altKey"]
End
Static Private Function Meta_Read() As Boolean
If Not _Event Then Error.Raise("No keyboard data")
Return _Event["metaKey"]
End
Static Private Function Normal_Read() As Boolean
If Not _Event Then Error.Raise("No keyboard data")
If Shift_Read() Or If Control_Read() Or If Alt_Read() Or If Meta_Read() Then Return
Return True
End
Static Private Function Code_Read() As String
If Not _Event Then Error.Raise("No keyboard data")
Return _Event["key"]
End
......@@ -230,3 +230,9 @@ Public Sub WebButton10_Click()
WebAudio1.Play()
End
Public Sub WebSpinBox1_Change()
lblSpinBox.Text = "-> " & CStr(WebSpinBox1.Value)
End
......@@ -79,25 +79,32 @@
Image = "icon:/small/apply"
}
{ WebLabel1 WebLabel
#MoveScaled(13,1,30,4)
#MoveScaled(13,1,18,4)
Expand = True
Font = "bold,1.5em"
Border = True
}
{ WebSpinBox1 WebSpinBox
#MoveScaled(32,1,10,4)
}
{ lblSpinBox WebLabel
#MoveScaled(43,1,17,4)
Border = True
}
{ WebButton6 WebButton
#MoveScaled(44,1,16,4)
#MoveScaled(61,1,16,4)
Text = ("Remove tab 2")
}
{ WebButton2 WebButton
#MoveScaled(61,1,11,4)
#MoveScaled(78,1,11,4)
Text = ("Logout")
}
{ WebButton9 WebButton
#MoveScaled(73,1,16,4)
#MoveScaled(90,1,16,4)
Text = ("Select first")
}
{ WebButton10 WebButton
#MoveScaled(90,1,10,4)
#MoveScaled(107,1,10,4)
Text = ("Bip")
}
}
......
......@@ -2,7 +2,13 @@
Export
' Static Public Sub _init()
'
' WebForm.Debug = True
'
' End
'
'
Public Sub WebComboBox1_Click()
Message(Last.Name & " = " & Last.Index)
......@@ -14,3 +20,16 @@ Public Sub WebComboBox2_Click()
Message(Last.Name & " = " & Last.Index)
End
Public Sub WebForm_KeyPress()
WebForm.Print(Last.Name & ": " & JSON.ToString(Key._Event))
End
Public Sub WebTextBox1_KeyPress()
WebForm.Print(Last.Name & ": " & JSON.ToString(Key._Event))
End
......@@ -18,4 +18,7 @@
#MoveScaled(1,11,62,28)
List = [("Élément 1"), ("Élément 2"), ("Élément 3"), ("Élément 4"), ("Élément 5"), ("Élément 6"), ("Élément 7"), ("Élément 8"), ("Élément 9"), ("Élément 10"), ("Élément 11"), ("Élément 12")]
}
{ WebTextBox1 WebTextBox
#MoveScaled(1,40,62,4)
}
}
......@@ -15,6 +15,8 @@ Public Const _DefaultEvent As String = "Render"
'' This event is raised just after the rendering of the control, so that you can add your own HTML contents.
Event Render
Event KeyPress
'' Return the server control identifier.
Property Read Id As Integer
......@@ -281,6 +283,13 @@ Private Sub Tag_Write(Value As Variant)
End
Public Sub _GetKeyPressHandler() As String
If Object.CanRaise(Me, "KeyPress") Then Return " onkeydown=\"gw.onkeypress(" & JS($sName) & ", event)\""
End
Public Sub _GetClassId(Optional sClass As String) As String
Dim sResult As String
......@@ -292,6 +301,7 @@ Public Sub _GetClassId(Optional sClass As String) As String
If $bHidden Then sClass &= " gw-hidden"
sResult = " class=\"" & Html(sClass) & "\" id=\"" & Html($sName) & "\""
If $sTooltip Then sResult &= " title=\"" & Html($sTooltip) & "\""
Return sResult
End
......@@ -1145,3 +1155,15 @@ Public Sub _Redraw()
'_Refresh = False
End
Public Sub _RaiseKeyPress(cEvent As Variant)
Dim cSave As Collection
cSave = Key._Event
Key._Event = cEvent
Object.Raise(Me, "KeyPress")
Key._Event = cSave
End
......@@ -532,7 +532,7 @@ Static Public Sub Application_Signal(Num As Integer)
While Not Eof($hRead)
sData = Read #$hRead, -4096
Print sData;
PrintLog("READ RESPONSE ==> " & Replace(sData, "\n", "\nREAD RESPONSE ==> "))
If $bLogEnabled Then PrintLog("READ RESPONSE ==> " & Replace(sData, "\n", "\nREAD RESPONSE ==> "))
Wend
Quit
......@@ -740,8 +740,9 @@ Public Sub _BeforeRender()
Print "<div class=\"gw-form";
If Me.Class Then Print " "; Me.Class;
Print "\" id=\""; Me.Name; "\""
Print "\" id=\""; Me.Name; "\"";
Me._RenderStyleSheet()
Print Me._GetKeyPressHandler();
Print ">"
End
......@@ -924,8 +925,17 @@ Public Sub _HandleMessage()
Else
hCtrl = Me
Endif
hCtrl._UpdateProperty(aCmd[2], aCmd[3])
Case "keypress"
If aCmd[1] Then
hCtrl = WebControl.FromName(aCmd[1])
If hCtrl Then hCtrl._RaiseKeyPress(aCmd[2])
Endif
Me._RaiseKeyPress(aCmd[2])
Case "finish"
Upload.Finish(aCmd[1])
......
......@@ -52,7 +52,11 @@ End
Public Sub _UpdateProperty(sProp As String, vValue As Variant)
If sProp = "value" Then Try Me.Value = vValue
If sProp = "value" Then
Inc Me._NoRefresh
Try Me.Value = vValue
Dec Me._NoRefresh
Endif
End
......
......@@ -86,7 +86,9 @@ Public Sub _Render()
If $bShowClear Then Print " style=\"padding-right:2.25em;\"";
Print " type=\""; If($bPassword, "password", "text"); "\""; Me._GetUpdateJS("onblur", "text", "this.value"); 'Me._GetUpdateJS("oninput", "text", "this.value"); '
If Object.CanRaise(Me, "Change") Then Print " oninput=\"gw.textbox.onchange("; JS(Me.Name); ");\"";
If Object.CanRaise(Me, "Activate") Then Print " onkeypress=\"gw.textbox.onactivate("; JS(Me.Name); ",event);\""; 'WebForm._AddJavascript("gw.textbox.onactivate(" & JS(Me.Name) & ")")
If Object.CanRaise(Me, "Activate") Then Print " onkeypress=\"gw.textbox.onactivate("; JS(Me.Name); ",event);\"";
'WebForm._AddJavascript("gw.textbox.onactivate(" & JS(Me.Name) & ")")
Print Me._GetKeyPressHandler();
If Not Me.Enabled Then Print " disabled";
If $bReadOnly Then Print " readonly";
......
......@@ -1570,6 +1570,38 @@ gw = {
elt.currentTime = 0;
elt.play();
}
},
onkeypress: function(event)
{
console.log('onkeypress: ' + event);
if (!event.bubbles)
return;
var elt = document.activeElement;
var id = '';
while (elt)
{
id = elt.id;
if (id && id.indexOf(':') < 0)
break;
elt = elt.parentNode;
id = '';
}
gw.send(['keypress', id,
{
'altKey': event.altKey,
'ctrlKey': event.ctrlKey,
'key': event.key,
'metaKey': event.meta,
'shiftKey': event.shiftKey
}],
null);
}
}
document.onkeydown = gw.onkeypress;
......@@ -28,6 +28,12 @@ IFRAME {
border: none;
}
:focus {
outline: none;
}
::-moz-focus-inner { border: 0; }
/*UL, OL {
padding-left: 2em;
margin-bottom: 0;
......
......@@ -49,7 +49,7 @@ int ERROR_depth = 0;
static int _lock = 0;
static char *_print_prefix = NULL;
static const char *const _message[77] =
static const char *const _message[78] =
{
/* 0 E_UNKNOWN */ "Unknown error",
/* 1 E_MEMORY */ "Out of memory",
......@@ -127,7 +127,8 @@ static const char *const _message[77] =
/* 73 E_ASSERT */ "Assertion failed",
/* 74 E_MARRAY */ "Multidimensional array",
/* 75 E_UCLASS */ ".1Unknown class '&1'",
/* 76 E_SPEC */ ".2Incorrect declaration of symbol '&1' in class '&2'"
/* 76 E_SPEC */ ".2Incorrect declaration of symbol '&1' in class '&2'",
/* 77 E_USIZE */ "Unknow stream size"
};
static void clear_info(ERROR_INFO *info)
......