User talk:Lucario: Difference between revisions

Jump to navigation Jump to search
m
mNo edit summary
(17 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Exploring ways to deprecate the parameters in [[Template:VideoGallery]] ==
=== Currenttimestamp? ===
What am I trying to accomplish?
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)
<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.
:You're right, it didn't update on page load. I was hoping that it was just cache of another template rather than on page directly, but nope it's still not updated, as confirmed in next section below. We'll look into Javascript I guess. I've wondered how will Javascript look and how will it pick three lucky videos and list the rest. I'm no Javascript expert so I won't be able to tell how hard it'd be. [[User:Lucario|Lucario]] ([[User talk:Lucario|talk]]) 09:00, 27 January 2018 (CET)


;Find max number
::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)
{{#vardefineecho:tl_vg_videocount|{{#vardefineecho:tl_vg_currentvideo|{{#expr:{{#regex:https://www.youtube.com/watch?v=wjzv0KtDXOA Xenoblade JP 1 (Dolphin Emulator @ 720p)
:::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)
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)
: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)
{{#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)
:: Yes, they also frequently will perform arbitrary edits (i.e. adding/removing spacing) until their video comes to the top. This is the exact reason we want to restore true randomness. [[User:Kolano|Kolano]] ([[User talk:Kolano|talk]]) 09:32, 27 January 2018 (CET)
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!)
: 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)
;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|(({{#time:U}}+({{#vardefineecho:tl_vg_luckyvideos|{{#expr:{{#var:tl_vg_luckyvideos}}-1}}}}))*(67)+({{NUMBEROFARTICLES:R}} mod (67)))|{{#var:tl_vg_videocount}}}}+1}}}}}}{{#vardefine:video{{#var:tl_vg_luckyvideo}}|done}}}}
 
;Losers
{{#while:|{{#ifeq:{{#var:tl_vg_videocount}}|0||dang!}}|{{#ifeq:{{#var:video{{#vardefineecho:tl_vg_videocount|{{#expr:{{#var:tl_vg_videocount}}-1}}}}}}|done||{{#var:video{{#var:tl_vg_videocount}}}}}}}}


== Time refresh on page load test ==
== Time refresh on page load test ==
Line 41: Line 20:
* expecting empty #var:trololo default: <code>{{#var:trololo|{{CURRENTTIMESTAMP}}}}</code>
* expecting empty #var:trololo default: <code>{{#var:trololo|{{CURRENTTIMESTAMP}}}}</code>
* expecting defined #var:trololo: <code>{{#vardefine:trololo|{{CURRENTTIMESTAMP}}}}{{#var:trololo}}</code>
* expecting defined #var:trololo: <code>{{#vardefine:trololo|{{CURRENTTIMESTAMP}}}}{{#var:trololo}}</code>
Which one updates faster?
:{{CURRENTTIMESTAMP}}
:{{#time:U}}
:{{#time:z}}


== SNES Ratings==
== SNES Ratings==
6,576

edits

Navigation menu