Template:VideoGallery/sandbox: Difference between revisions

From Dolphin Emulator Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 10: Line 10:


{{{1|}}}|/videolist(\n.*){1,{{#var:tl_vg_currentvideo}}}\n(.+?) (.*)([\s\S]*)/|{{#vardefine:tl_vg_currentvideo|{{#expr:{{#var:tl_vg_currentvideo}}-1}}}}$3}}}}}}
{{{1|}}}|/videolist(\n.*){1,{{#var:tl_vg_currentvideo}}}\n(.+?) (.*)([\s\S]*)/|{{#vardefine:tl_vg_currentvideo|{{#expr:{{#var:tl_vg_currentvideo}}-1}}}}$3}}}}}}
{{#vardefine:tl_vg_luckyvideos|3}}
{{#vardefine:tl_vg_embedslots|{{#ifexpr:{{#var:tl_vg_videocount}}<3|{{#var:tl_vg_videocount}}|3}}}}
{{#while:|{{#ifeq:{{#var:tl_vg_luckyvideos}}|0||lucky!}}|{{#vardefine:tl_vg_luckyvideo|{{#expr:{{Mod|{{CURRENTTIMESTAMP}}+({{#vardefineecho:tl_vg_luckyvideos|{{#expr:{{#var:tl_vg_luckyvideos}}-1}}}}*{{NUMBEROFPAGES:R}})|{{#var:tl_vg_videocount}}}}+1}}}}<div style="float:left; margin: .5em 0 1.3em 1.4em;">{{#ev:{{#regex:{{#var:server{{#var:tl_vg_luckyvideo}}}}|/.*(youtube{{!}}dailymotion).*/|$1}}|{{#var:video{{#var:tl_vg_luckyvideo}}}}|302||<span style="text-overflow: ellipsis; display: inline-block; width: 275px; white-space: nowrap; overflow: hidden; vertical-align: top;" title="{{#var:caption{{#var:tl_vg_luckyvideo}}}}">[{{#var:server{{#var:tl_vg_luckyvideo}}}}{{#var:video{{#var:tl_vg_luckyvideo}}}} {{#tag:nowiki|{{#var:caption{{#var:tl_vg_luckyvideo}}}}}}]</span>|frame}}</div>{{#vardefine:video{{#var:tl_vg_luckyvideo}}|}}}}
{{#while:|{{#ifeq:{{#var:tl_vg_embedslots}}|0||lucky!}}|{{#vardefine:tl_vg_luckyvideo|{{#expr:{{Mod|{{CURRENTTIMESTAMP}}+({{#vardefineecho:tl_vg_embedslots|{{#expr:{{#var:tl_vg_embedslots}}-1}}}}*{{NUMBEROFPAGES:R}})|{{#var:tl_vg_videocount}}}}+1}}}}<div style="float:left; margin: .5em 0 1.3em 1.4em;">{{#ev:{{#regex:{{#var:server{{#var:tl_vg_luckyvideo}}}}|/.*(youtube{{!}}dailymotion).*/|$1}}|{{#var:video{{#var:tl_vg_luckyvideo}}}}|302||<span style="text-overflow: ellipsis; display: inline-block; width: 275px; white-space: nowrap; overflow: hidden; vertical-align: top;" title="{{#var:caption{{#var:tl_vg_luckyvideo}}}}">[{{#var:server{{#var:tl_vg_luckyvideo}}}}{{#var:video{{#var:tl_vg_luckyvideo}}}} {{#tag:nowiki|{{#var:caption{{#var:tl_vg_luckyvideo}}}}}}]</span>|frame}}</div>{{#vardefine:video{{#var:tl_vg_luckyvideo}}|}}}}
<div style="clear:left"></div>
<div style="clear:left"></div>
{{#vardefine:tl_vg_videocount|{{#expr:{{#var:tl_vg_videocount}}+1}}}}
{{#vardefine:tl_vg_videocount|{{#expr:{{#var:tl_vg_videocount}}+1}}}}

Revision as of 07:55, 28 January 2018

[edit] [purge] Template documentation
{{VideoGallery|{{#vardefineecho: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.dailymotion.com/video/x1k9hnl Cocoto Platform Jumper HD on Dolphin Emulator (Widescreen Hack) part1
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)
}}}}

Compare below and #Legacy compatibility! True randomization is our key feature. Requires JavaScript which I have provided a working sample in the talk page. Without JavaScript this will just display as hyperlinked list in reverse order. Another benefit is reducing editing required. Just copy/paste the video link and write caption!


Legacy compatibility

Videos like below still use the old template parameters, they will work fine.

{{VideoGallery/sandbox
|vid1=wjzv0KtDXOA|cap1=Xenoblade JP 1 (Dolphin Emulator @ 720p)
|vid2=tJtCp8rPXWg|cap2=Xenoblade PAL 1 [Dolphin Emulator @ 1080p]
|srv3=dailymotion|vid3=x1k9hnl|cap3=Cocoto Platform Jumper HD on Dolphin Emulator (Widescreen Hack) part1
|vid4=_VLNa9PKT0Y|cap4=Xenoblade PAL 2 (Dolphin Emulator @ 720p)
|vid5=dp3QnvFn_Hc|cap5=Xenoblade PAL 3 (Dolphin Emulator @ 720p)
}}

Other rationale

  • Requires {{#vardefineecho:videogallery|}} to avoid issues with equal sign ("=") in template. If {{Problems}} is doing it then why not this?
  • Parameterless to prevent parameter typo or tampering. This has happened before. Can't remember where is our old discussion at, there was a delusional anonymous tampering the parameter number in attempt of having his video first on the list - in assumption of only the first three videos will embed on the page. This won't be the case when parameters weren't there. They can paste their url anywhere in the list, doesn't matter. Also with JS they wouldn't be thinking about the edit save grinding.
  • Quality categories added: checks if the video url is accepted for embedding and checks for the missing caption.