-
Notifications
You must be signed in to change notification settings - Fork 105
refactor(countdown): move streams into lua #4372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 4 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
364cc90
refactor `Module:Links/Stream`
hjpalpha e906b15
add `module:COuntdown`
hjpalpha c1fbe6a
adjust the js & add option to not show streams
hjpalpha 61eee43
make space between the streams options
hjpalpha c3e4bac
move stream adding completely to lua
hjpalpha d8a7476
simplify as per review
hjpalpha 41cf2c0
do not display dash if live is over (12h, same as in js)
hjpalpha 73092a0
rename const var as per review
hjpalpha d001c31
refactor finished handling
hjpalpha a210926
fix
hjpalpha 63231d3
invert
hjpalpha 6996e03
Update standard/links_stream.lua
hjpalpha 7d31a53
mirror old behaviour exactly
hjpalpha 3756685
kick unused const var
hjpalpha 9e10572
Update standard/links_stream.lua
hjpalpha 9a69017
as per review
hjpalpha c2cadfe
as per review
hjpalpha 0e3c5ff
as per review
hjpalpha 3b56714
Merge branch 'main' into countdown
hjpalpha 3a42523
thx, linter
hjpalpha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| --- | ||
| -- @Liquipedia | ||
| -- wiki=commons | ||
| -- page=Module:Countdown | ||
| -- | ||
| -- Please see https://github.com/Liquipedia/Lua-Modules to contribute | ||
| -- | ||
|
|
||
| local Arguments = require('Module:Arguments') | ||
| local DateExt = require('Module:Date/Ext') | ||
| local Logic = require('Module:Logic') | ||
| local StreamLinks = require('Module:Links/Stream') | ||
|
|
||
| local Countdown = {} | ||
|
|
||
| ---@param frame Frame | ||
| ---@return string | ||
| function Countdown.create(frame) | ||
| return Countdown._create(Arguments.getArgs(frame)) | ||
| end | ||
|
|
||
| ---@param args table | ||
| ---@return string | ||
| function Countdown._create(args) | ||
| if Logic.isEmpty(args.date) and not args.timestamp then | ||
| return '' | ||
| end | ||
|
|
||
| local wrapper = mw.html.create('span') | ||
| :addClass('timer-object') | ||
|
|
||
| if Logic.readBool(args.rawcountdown) then | ||
| wrapper:addClass('timer-object-countdown-only') | ||
| end | ||
| if Logic.readBool(args.rawdatetime) then | ||
| wrapper:addClass('timer-object-datetime-only') | ||
| end | ||
| if Logic.readBool(args.finished) then | ||
| wrapper:attr('data-finished', 'finished') | ||
| elseif not Logic.readBool(args.nostreams) then | ||
| wrapper:attr('data-streams', StreamLinks.display(StreamLinks.filterStreams(args), {addSpace = true})) | ||
| end | ||
|
|
||
| -- Timestamp | ||
| wrapper:attr('data-timestamp', args.timestamp or DateExt.readTimestampOrNil(args.date) or 'error') | ||
|
|
||
| if args.text then | ||
| wrapper:attr('data-countdown-end-text', args.text) | ||
| end | ||
| if args.separator then | ||
| wrapper:attr('data-separator', args.separator) | ||
| end | ||
|
|
||
| wrapper:wikitext(args.date) | ||
|
|
||
| return tostring(wrapper:done()) | ||
| end | ||
|
|
||
| return Countdown |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.