update JS code style to currently recommended conventions
ES5 support is still present to not introduce breaking changes (dropped IE10 support) in minor updates.
This commit is contained in:
parent
2906d435d9
commit
0cab1a3580
@ -1,3 +1,23 @@
|
||||
{
|
||||
"extends": "eslint-config-wordpress"
|
||||
"env": {
|
||||
"es6": false,
|
||||
"browser": true
|
||||
},
|
||||
"globals": {
|
||||
"sclivetickerAjax": "readonly"
|
||||
},
|
||||
"extends": [
|
||||
"plugin:@wordpress/eslint-plugin/recommended",
|
||||
"plugin:@wordpress/eslint-plugin/es5"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*"
|
||||
],
|
||||
"rules": {
|
||||
"no-var": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
"license": "GPL-2.0+",
|
||||
"devDependencies": {
|
||||
"eslint": "^6",
|
||||
"eslint-config-wordpress": "^2.0",
|
||||
"@wordpress/eslint-plugin": "^2.4",
|
||||
"stylelint": "^10.1",
|
||||
"stylelint-config-wordpress": "^14.0"
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ function scLiveticker() {
|
||||
* @return {void}
|
||||
*/
|
||||
scLiveticker.init = function() {
|
||||
|
||||
// Opt out if AJAX pobject not present.
|
||||
if ( 'undefined' === typeof sclivetickerAjax ) {
|
||||
return;
|
||||
@ -31,7 +30,7 @@ scLiveticker.init = function() {
|
||||
s: elem.getAttribute( 'data-sclt-ticker' ),
|
||||
l: elem.getAttribute( 'data-sclt-limit' ),
|
||||
t: elem.getAttribute( 'data-sclt-last' ),
|
||||
e: elem
|
||||
e: elem,
|
||||
};
|
||||
}
|
||||
);
|
||||
@ -44,7 +43,7 @@ scLiveticker.init = function() {
|
||||
w: elem.getAttribute( 'data-sclt-ticker' ),
|
||||
l: elem.getAttribute( 'data-sclt-limit' ),
|
||||
t: elem.getAttribute( 'data-sclt-last' ),
|
||||
e: elem
|
||||
e: elem,
|
||||
};
|
||||
}
|
||||
);
|
||||
@ -61,7 +60,6 @@ scLiveticker.init = function() {
|
||||
* @return {void}
|
||||
*/
|
||||
scLiveticker.update = function() {
|
||||
|
||||
// Extract ticker-slug, limit and timestamp of last poll.
|
||||
var updateReq = 'action=sclt_update-ticks&_ajax_nonce=' + scLiveticker.nonce;
|
||||
var i, j;
|
||||
@ -112,6 +110,7 @@ scLiveticker.update = function() {
|
||||
}
|
||||
setTimeout( scLiveticker.update, scLiveticker.pollInterval ); // Re-trigger update.
|
||||
} catch ( e ) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn( 'Liveticker AJAX update failed, stopping automatic updates.' );
|
||||
}
|
||||
}
|
||||
@ -131,7 +130,6 @@ scLiveticker.update = function() {
|
||||
* @return {void}
|
||||
*/
|
||||
scLiveticker.updateHTML = function( t, u ) {
|
||||
|
||||
// Prepend HTML of new ticks.
|
||||
t.e.innerHTML = u.h + t.e.innerHTML;
|
||||
t.e.setAttribute( 'data-sclt-last', u.t );
|
||||
|
Loading…
x
Reference in New Issue
Block a user