User talk:Lucario: Difference between revisions

Jump to navigation Jump to search
m
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Exploring ways to deprecate the parameters in [[Template:VideoGallery]] ==
What am I trying to accomplish?
<pre>
{{VideoGallery|
https://www.youtube.com/watch?v=wjzv0KtDXOA Xenoblade JP 1 (Dolphin Emulator @ 720p)
https://www.youtube.com/watch?v=tJtCp8rPXWg Xenoblade PAL 1 [Dolphin Emulator @ 1080p]
https://www.youtube.com/watch?v=_VLNa9PKT0Y Xenoblade PAL 2 (Dolphin Emulator @ 720p)
https://www.youtube.com/watch?v=dp3QnvFn_Hc Xenoblade PAL 3 (Dolphin Emulator @ 720p)
}}
</pre>
... to produce the familiar layout & random video logic the VideoGallery has been doing.
;Find max number
{{#vardefineecho:tl_vg_videocount|{{#vardefineecho:tl_vg_currentvideo|{{#expr:{{#regex:https://www.youtube.com/watch?v=wjzv0KtDXOA Xenoblade JP 1 (Dolphin Emulator @ 720p)
https://www.youtube.com/watch?v=tJtCp8rPXWg Xenoblade PAL 1 [Dolphin Emulator @ 1080p]
https://www.youtube.com/watch?v=_VLNa9PKT0Y Xenoblade PAL 2 (Dolphin Emulator @ 720p)
https://www.youtube.com/watch?v=dp3QnvFn_Hc Xenoblade PAL 3 (Dolphin Emulator @ 720p)|/(.+)/|+1}}}}}}}}
;Incremental #vardefine for each video (soon... #vardefine for server, video id, and caption)
{{#while:|{{#ifeq:{{#var:tl_vg_currentvideo}}|0||yo}}|{{#vardefine:video{{#var:tl_vg_currentvideo}}|{{#regex:videolist
https://www.youtube.com/watch?v=wjzv0KtDXOA Xenoblade JP 1 (Dolphin Emulator @ 720p)
https://www.youtube.com/watch?v=tJtCp8rPXWg Xenoblade PAL 1 [Dolphin Emulator @ 1080p]
https://www.youtube.com/watch?v=_VLNa9PKT0Y Xenoblade PAL 2 (Dolphin Emulator @ 720p)
https://www.youtube.com/watch?v=dp3QnvFn_Hc Xenoblade PAL 3 (Dolphin Emulator @ 720p)|/videolist(\n.*){1,{{#var:tl_vg_currentvideo}}}\n(.+)([\s\S]*)/|{{#vardefine:tl_vg_currentvideo|{{#expr:{{#var:tl_vg_currentvideo}}-1}}}}$2}}}}}}
(check in edit source!)
;Shuffle! Three lucky videos are...
{{#vardefine:tl_vg_luckyvideos|3}}
{{#while:|{{#ifeq:{{#var:tl_vg_luckyvideos}}|0||lucky!}}|{{#var:video{{#vardefineecho:tl_vg_luckyvideo|{{#expr:{{Mod|{{CURRENTTIMESTAMP}}+({{#vardefineecho:tl_vg_luckyvideos|{{#expr:{{#var:tl_vg_luckyvideos}}-1}}}}*{{NUMBEROFPAGES:R}})|{{#var:tl_vg_videocount}}}}+1}}}}}}{{#vardefine:video{{#var:tl_vg_luckyvideo}}|}}}}
;Losers
{{#vardefine:tl_vg_videocount|{{#expr:{{#var:tl_vg_videocount}}+1}}}}
{{#while:|{{#ifeq:{{#var:tl_vg_videocount}}|0||dang!}}|{{#if:{{#var:video{{#vardefineecho:tl_vg_videocount|{{#expr:{{#var:tl_vg_videocount}}-1}}}}}}|{{#var:video{{#var:tl_vg_videocount}}}}|}}}}
=== Currenttimestamp? ===
=== Currenttimestamp? ===
As far as I can see, the CURRENTTIMESTAMP template (i.e. {{CURRENTTIMESTAMP}}) doesn't update per page refresh, it seems to stay stuck at the point when the last edit occurred or the cache page was generated. So I'm not sure it can be used to generate the random value. I think we had determined that some JavaScript is needed to either handle the random selection, or minimally generate an actual random value here. BTW, a parameterless version of things would be nicer, even if it can't handle the random selection. [[User:Kolano|Kolano]] ([[User talk:Kolano|talk]]) 08:42, 27 January 2018 (CET)
As far as I can see, the CURRENTTIMESTAMP template (i.e. {{CURRENTTIMESTAMP}}) doesn't update per page refresh, it seems to stay stuck at the point when the last edit occurred or the cache page was generated. So I'm not sure it can be used to generate the random value. I think we had determined that some JavaScript is needed to either handle the random selection, or minimally generate an actual random value here. BTW, a parameterless version of things would be nicer, even if it can't handle the random selection. [[User:Kolano|Kolano]] ([[User talk:Kolano|talk]]) 08:42, 27 January 2018 (CET)
Line 42: Line 5:


::You can't cheat the cache. You have to use [[MediaWiki:Common.js]]. That's the only way. If you put logic in there to generate a random seed, that should be enough. - [[User:Xerxes|Xerxes]] ([[User talk:Xerxes|talk]]) 09:15, 27 January 2018 (CET)
::You can't cheat the cache. You have to use [[MediaWiki:Common.js]]. That's the only way. If you put logic in there to generate a random seed, that should be enough. - [[User:Xerxes|Xerxes]] ([[User talk:Xerxes|talk]]) 09:15, 27 January 2018 (CET)
:::Thanks for letting me know, it kinda suck we've had to wait for the cache to purge out for the time to update. [[User:Lucario|Lucario]] ([[User talk:Lucario|talk]]) 14:18, 27 January 2018 (CET)


:I agree! Parameterless seems better. With it the uploader can just select all > copy'n'paste the url then append with caption. It'll have same feel as you'd copy full url then append with caption in brackets. There was one editor who deliberately assign +1 to all vid/cap parameters then use the first parameter for his video. It made me want to curl! [[User:Lucario|Lucario]] ([[User talk:Lucario|talk]]) 09:12, 27 January 2018 (CET)
:I agree! Parameterless seems better. With it the uploader can just select all > copy'n'paste the url then append with caption. It'll have same feel as you'd copy full url then append with caption in brackets. There was one editor who deliberately assign +1 to all vid/cap parameters then use the first parameter for his video. It made me want to curl! [[User:Lucario|Lucario]] ([[User talk:Lucario|talk]]) 09:12, 27 January 2018 (CET)
Line 48: Line 12:


: Generating a random ID in common.js is easy enough. However, I'm not clear there is any way for that to hand off to wiki handling, so I think any randomization related logic here is likely pointless. Since I'm not clear there is any good way to perform a hand-off, I think we need to perform the random selection and HTML generation in JavaScript, which makes things more complicated (though not particularly difficult). [[User:Kolano|Kolano]] ([[User talk:Kolano|talk]]) 09:37, 27 January 2018 (CET)
: Generating a random ID in common.js is easy enough. However, I'm not clear there is any way for that to hand off to wiki handling, so I think any randomization related logic here is likely pointless. Since I'm not clear there is any good way to perform a hand-off, I think we need to perform the random selection and HTML generation in JavaScript, which makes things more complicated (though not particularly difficult). [[User:Kolano|Kolano]] ([[User talk:Kolano|talk]]) 09:37, 27 January 2018 (CET)
:: I don't think I'll be around to do that stuff. Anyone else can try. [[User:Lucario|Lucario]] ([[User talk:Lucario|talk]]) 14:18, 27 January 2018 (CET)


== Time refresh on page load test ==
== Time refresh on page load test ==
6,576

edits

Navigation menu