Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
90305cc1
Commit
90305cc1
authored
Jan 15, 2021
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
romain_dev: thread reader use page language inqtead of local
parent
da02c666
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
14 deletions
+19
-14
bt5/romain_dev/PathTemplateItem/web_page_module/romain_thread_reader_js.js
...thTemplateItem/web_page_module/romain_thread_reader_js.js
+17
-12
bt5/romain_dev/PathTemplateItem/web_page_module/romain_thread_reader_js.xml
...hTemplateItem/web_page_module/romain_thread_reader_js.xml
+2
-2
No files found.
bt5/romain_dev/PathTemplateItem/web_page_module/romain_thread_reader_js.js
View file @
90305cc1
...
...
@@ -7,7 +7,7 @@
loading_class_list
=
[
'
ui-icon-spinner
'
,
'
ui-btn-icon-left
'
],
disabled_class
=
'
ui-disabled
'
;
function
getRelativeTimeString
(
current_date
,
date
)
{
function
getRelativeTimeString
(
language
,
current_date
,
date
)
{
var
diff
,
abs
,
second
=
1000
,
...
...
@@ -15,7 +15,7 @@
hour
=
minute
*
60
,
day
=
hour
*
24
,
week
=
day
*
7
,
time_format
=
new
Intl
.
RelativeTimeFormat
();
time_format
=
new
Intl
.
RelativeTimeFormat
(
language
);
diff
=
date
.
getFullYear
()
-
current_date
.
getFullYear
();
if
(
diff
!==
0
)
{
...
...
@@ -373,6 +373,7 @@
.
declareAcquiredMethod
(
"
getUrlForList
"
,
"
getUrlForList
"
)
.
declareAcquiredMethod
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
.
declareAcquiredMethod
(
"
getTranslationList
"
,
"
getTranslationList
"
)
.
declareAcquiredMethod
(
'
getSelectedLanguage
'
,
'
getSelectedLanguage
'
)
//////////////////////////////////////////////
// initialize the gadget content
...
...
@@ -384,14 +385,18 @@
// Cancel previous line rendering to not conflict with the asynchronous render for now
gadget
.
fetchLineContent
(
true
);
return
gadget
.
changeState
({
query_string
:
new
URI
(
options
.
query
).
query
(
true
).
query
||
''
,
begin_from
:
0
,
lines
:
options
.
lines
||
1
,
// Force line calculation in any case
render_timestamp
:
new
Date
().
getTime
(),
allDocs_result
:
undefined
});
return
gadget
.
getSelectedLanguage
()
.
push
(
function
(
language
)
{
return
gadget
.
changeState
({
language
:
language
,
query_string
:
new
URI
(
options
.
query
).
query
(
true
).
query
||
''
,
begin_from
:
0
,
lines
:
options
.
lines
||
1
,
// Force line calculation in any case
render_timestamp
:
new
Date
().
getTime
(),
allDocs_result
:
undefined
});
});
})
.
onStateChange
(
function
onStateChange
(
modification_dict
)
{
...
...
@@ -442,7 +447,7 @@
datetime
:
entry
.
value
.
modification_date
,
title
:
entry
.
value
.
modification_date
,
text
:
getRelativeTimeString
(
now
,
new
Date
(
entry
.
value
.
modification_date
)
gadget
.
state
.
language
,
now
,
new
Date
(
entry
.
value
.
modification_date
)
)
}),
domsugar
(
'
br
'
),
...
...
@@ -830,7 +835,7 @@
this
.
element
.
querySelectorAll
(
"
div.post_content > time
"
).
forEach
(
function
(
element
)
{
element
.
textContent
=
getRelativeTimeString
(
now
,
new
Date
(
element
.
getAttribute
(
'
datetime
'
))
gadget
.
state
.
language
,
now
,
new
Date
(
element
.
getAttribute
(
'
datetime
'
))
);
}
);
...
...
bt5/romain_dev/PathTemplateItem/web_page_module/romain_thread_reader_js.xml
View file @
90305cc1
...
...
@@ -240,7 +240,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
989.2
1883.22115.61832
</string>
</value>
<value>
<string>
989.2
2938.36309.58180
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>
1610
641779.85
</float>
<float>
1610
705058.31
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment