26 Commits

Author SHA1 Message Date
d6ae2fe437
introduce new block attribute to control sorting direction (#25) (#27)
All checks were successful
continuous-integration/drone/push Build is passing
2025-03-03 18:59:08 +01:00
Mahammed Zishan Khan
b7c236376b
fix: cast string to Number when setting attribute (#21)
Co-authored-by: zishan <zishan.khan@roularta.be>
2022-02-01 18:23:37 +01:00
e007f53e8c
make script evaluation optional
Some checks failed
continuous-integration/drone/push Build is failing
2022-01-23 17:07:37 +01:00
6ac1f85739
add support for embedded script execution in tick content (#14) (#20)
Evaluate embedded SCRIPT-tags in tick content or move them to the
document head for referenced resources.
2022-01-23 16:50:58 +01:00
b054dfaba2 fix typehint for lastPoll field in JavaScript
All checks were successful
continuous-integration/drone/push Build is passing
2021-05-19 19:31:44 +02:00
944c2dd6c1 rework update schedule, update existing ticks, use insertBefore()
All checks were successful
continuous-integration/drone/push Build is passing
Re-triggering the update is now done globally again with lock on
ticker level to avoid concurrent updates.

If a tick with a known ID is received, the markup is now updated, so no
duplicates should appear.

The prepend() function used to update the markup is replaced by
insertBefore() for Internet Explorer compatibility.
2021-04-12 18:09:03 +02:00
b2058dfe96 add unique IDs to ticker containers and ticks in HTML markup
Ticker containers get a consecutive number unique within a markup.
Ticks will get an ID based on this number and the post ID.
2021-04-12 18:09:03 +02:00
68efc83273 refactor frontend to use WP REST API instead of WP AJAX
Query new ticks using GET request to the REST API.
Also we now trigger one request per ticker, if more than one is
available on the same page.

HTML markup (list element, content container) is generated client side,
s.t. we can work on the generic response data model
2021-04-12 18:09:03 +02:00
6ed625dab2
prepend new elements instead of replacing HTML on AJAX update (#9) (#12)
Replacing the body by prepending HTML results in the full content
being re-rendered. This can be a performance issue, but is definitely
annoying when embedding media in ticks.
2020-05-01 14:52:25 +02:00
5c4b1eaf60 select first available ticker for new blocks 2020-01-13 17:28:19 +01:00
dba37eb64b remove undefined className attribute from block rendering 2020-01-13 17:18:52 +01:00
61a3e4a104 adjustments to block output when no tickers are available
Always show the first label and display spinner or message below.
2019-11-24 18:09:21 +01:00
dd074293a7 make block script ES5 compatible
There are polyfills for methods like apiFetch, so migrate the syntax to
ES5 (no generators, method shorthands, arrow functions, ...) and we are
done here without adding transpilers to the project.
2019-11-24 18:09:21 +01:00
df1de841e8 expose ticker taxonomy to API and add select element to Gutenberg block
This is more handy than entering the ticker slug manually.
2019-11-24 18:09:21 +01:00
acf3b010f1 wrap frontend JS into IIFE to
Exposing the liveticker functionality to a public namespace is not
necessary, so it is now wrapped into an anonymous function.
2019-11-24 18:09:21 +01:00
b88e1c2903 update ticker immediately, if not prefilled by backend
When a ticker is added by a Gutenberg block, it is initially empty. This
can be detected by checking the "last" flag for 0 value. If found, the
ticker is now updated immediately by the AJAX function and not waiting
for the poll interval to trigger.
2019-11-24 18:09:21 +01:00
9ddcc41c6b implement Gutenberg block to add liveticker without legacy shortcode
* implement react-based JS block
* refactor shortcode and widget to use the same syntax and classes
2019-11-24 18:09:21 +01:00
0cab1a3580 update JS code style to currently recommended conventions
ES5 support is still present to not introduce breaking changes (dropped
IE10 support) in minor updates.
2019-08-28 11:15:02 +02:00
65eafd2524 Renamed Plugin and changed slug to stklcode-liveticker
Due to naming conflicts with the original wp-liveticker plugin this one
is now renamed to a unique identifier.
2018-11-02 09:01:29 +01:00
6f1cac5404 Renamed AJAX variable, JS code style, added ESLint config 2018-10-17 20:42:10 +02:00
c3cc5b1b84 Refactored JavaScript without use of jQuery 2018-10-16 20:57:43 +02:00
2d5dde9664 Enabled AJAX update for widgets 2017-12-10 21:15:55 +01:00
f10e9c63e0 AJAX nonce verification enabled 2017-12-09 16:05:09 +01:00
de347e1f81 Only send new Ticks on AJAX update
THis reduces the overhead of re-sending huge amounts of HTML code to the frontend without any new data to display.
2017-12-09 11:48:23 +01:00
a5144f9f17 JavaScript refactored to its own namespace 2017-12-09 10:30:36 +01:00
8100d07eed Implemented AJAX skeleton with configurable poll interval 2017-12-07 21:15:40 +01:00