Commit 11e2a2eb authored by Romain Courteaud's avatar Romain Courteaud

romain_dev: forum jslint

parent d9588e56
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>989.23331.40399.10871</string> </value> <value> <string>989.27664.22728.10274</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1610728771.86</float> <float>1610988520.24</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*jslint indent: 2, maxerr: 3, nomen: true */ /*jslint indent: 2, maxerr: 3, nomen: true */
/*global window, document, rJS, URI, RSVP, isEmpty, console, domsugar*/ /*global window, document, rJS, URI, RSVP, isEmpty, console, domsugar, Intl*/
(function () { (function () {
"use strict"; "use strict";
var variable = {},
loading_class_list = ['ui-icon-spinner', 'ui-btn-icon-left'],
disabled_class = 'ui-disabled';
function getRelativeTimeString(language, current_date, date) { function getRelativeTimeString(language, current_date, date) {
var diff, var diff,
abs, abs,
...@@ -28,36 +24,14 @@ ...@@ -28,36 +24,14 @@
console.log(current_date, date, abs, week, day); console.log(current_date, date, abs, week, day);
if (abs > (week * 2)) { if (abs > (week * 2)) {
return time_format.format(Math.floor(diff / week), 'week'); return time_format.format(Math.floor(diff / week), 'week');
} else if (abs > (day * 2)) { }
if (abs > (day * 2)) {
return time_format.format(Math.floor(diff / day), 'day'); return time_format.format(Math.floor(diff / day), 'day');
} else if (abs > (hour * 2)) {
return time_format.format(Math.floor(diff / hour), 'hour');
} else {
return time_format.format(Math.floor(diff / minute), 'minute');
} }
return date; if (abs > (hour * 2)) {
} return time_format.format(Math.floor(diff / hour), 'hour');
function buildFieldGadgetParam(value) {
var field_gadget_param;
if ((value !== undefined) && (value !== null) && (value.constructor === Object)) {
if (value.field_gadget_param) {
field_gadget_param = value.field_gadget_param;
} else {
field_gadget_param = {
'editable': 0,
'default': value.default
};
}
} else {
field_gadget_param = {
'editable': 0,
'default': value
};
} }
return time_format.format(Math.floor(diff / minute), 'minute');
return field_gadget_param;
} }
function setPaginationElement(gadget, count, url_list) { function setPaginationElement(gadget, count, url_list) {
...@@ -166,7 +140,7 @@ ...@@ -166,7 +140,7 @@
domsugar(gadget.element.querySelector(':scope > nav > span'), { domsugar(gadget.element.querySelector(':scope > nav > span'), {
class: "ui-icon-spinner ui-btn-icon-left", class: "ui-icon-spinner ui-btn-icon-left",
text: '' text: ''
}) });
return gadget.fetchLineContent(false); return gadget.fetchLineContent(false);
} }
...@@ -221,7 +195,7 @@ ...@@ -221,7 +195,7 @@
text: source_short_title text: source_short_title
}), }),
domsugar('div', { domsugar('div', {
class: 'post_content', class: 'post_content'
}, [ }, [
domsugar('strong', {text: source_title}), domsugar('strong', {text: source_title}),
" ", " ",
...@@ -229,18 +203,20 @@ ...@@ -229,18 +203,20 @@
datetime: entry.value.modification_date, datetime: entry.value.modification_date,
title: entry.value.modification_date, title: entry.value.modification_date,
text: getRelativeTimeString( text: getRelativeTimeString(
gadget.state.language, now, new Date(entry.value.modification_date) gadget.state.language,
now,
new Date(entry.value.modification_date)
) )
}), }),
domsugar('br'), domsugar('br'),
result_dict.viewer_list[i].element, result_dict.viewer_list[i].element
// domsugar('hr') // domsugar('hr')
]) ])
]); ]);
})); }));
setPaginationElement(gadget, allDocs_result.data.total_rows, result_dict.url_list); setPaginationElement(gadget, allDocs_result.data.total_rows,
result_dict.url_list);
}); });
return;
} }
}) })
...@@ -251,7 +227,9 @@ ...@@ -251,7 +227,9 @@
this.element.querySelectorAll("div.post_content > time").forEach( this.element.querySelectorAll("div.post_content > time").forEach(
function (element) { function (element) {
element.textContent = getRelativeTimeString( element.textContent = getRelativeTimeString(
gadget.state.language, now, new Date(element.getAttribute('datetime')) gadget.state.language,
now,
new Date(element.getAttribute('datetime'))
); );
} }
); );
...@@ -267,8 +245,7 @@ ...@@ -267,8 +245,7 @@
} }
var gadget = this, var gadget = this,
limit_options = [], limit_options = [];
i;
if (gadget.state.lines === 0) { if (gadget.state.lines === 0) {
limit_options = undefined; limit_options = undefined;
......
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>989.23313.49582.17834</string> </value> <value> <string>989.27674.58520.17527</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1610727867.53</float> <float>1610989162.51</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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