Skip to content

Instantly share code, notes, and snippets.

@MaxPower15
MaxPower15 / pause-on-not-visible.js
Last active February 1, 2021 21:06
Pause all Wistia videos when tab isn't visible, resume when visible again
var pausedDueToVisibility = [];
function pauseAllActiveWistiaVideos() {
window._wq = window._wq || [];
window._wq.push({
id: "_all",
function (video) {
if (video.state() === "playing") {
pausedDueToVisibility.push(video);
video.pause();
@MaxPower15
MaxPower15 / clap-your-hands.js
Created January 11, 2016 14:57
My Public Test
(function() {
if (this.isWorking()) {
clapYourHands(); // bottles and cans
}
}())
@MaxPower15
MaxPower15 / gist:6043b930ab22fdd2fe15
Created January 11, 2016 14:52
Public gist test
this is a test
<span style="font-size:15px;">My smaller text</span>
@MaxPower15
MaxPower15 / gist:5957653
Created July 9, 2013 14:12
Easily report email conversions for all Wistia embeds on a page.
<!--
For full control, the embed shepherd can be dynamically loaded from another script, and the inline script executed
after it's loaded.
-->
<script src="http://fast.wistia.com/static/embed_shepherd-v1.js"></script>
<script>
wistiaEmbeds.onFind(function(video) {
video.bind("conversion", function(type, email) {
if (/(pre|mid|post)-roll/.test(type)) {
// Using jsonp is a simple way to allow cross-domain data sharing
@MaxPower15
MaxPower15 / gist:5537604
Created May 8, 2013 01:46
jQuery line/word dimensions
(function($) {
var deNthWordize, mode, nthWordize;
nthWordize = function(el) {
var $escaper, $this, $tns, textNode, textNodes, _i, _len;
$this = $(el);
textNodes = $this.find(":not(iframe)").andSelf().contents().filter(function() {
return this.nodeType === 3;
});
for (_i = 0, _len = textNodes.length; _i < _len; _i++) {
textNode = textNodes[_i];
<div id="wistia_036h4wlrgo" class="wistia_embed" style="width:500px;height:281px;" data-video-width="500" data-video-height="281">&nbsp;</div>
<script charset="ISO-8859-1" src="http://fast.wistia.net/static/concat/E-v1%2Cplaylist-v1.js"></script>
<script>
wistiaPlaylist = Wistia.playlist("036h4wlrgo", {
version: "v1",
videoOptions: {
volumeControl: true,
autoPlay: true,
videoWidth: 500,
videoHeight: 281
@MaxPower15
MaxPower15 / gist:4498734
Created January 10, 2013 01:56
Pseudocode for pre-roll on playlist
wistiaPlaylist = Wistia.playlist("playlisthashedid", {
... the options generated by Wistia ...
});
var savedSection, savedVideo;
wistiaPlaylist.bind("play", function() {
savedSection = wistiaPlaylist.currentSectionIndex();
savedVideo = wistiaPlaylist.currentVideoIndex();
wistiaPlaylist.remove();
wistiaEmbed = Wistia.embed("prerollhashedid", {
... whatever options you want ...
@MaxPower15
MaxPower15 / gist:4333664
Last active December 9, 2015 21:58
How to asyncify Wistia API embed codes
<!-- A default Wistia embed code, plus the 'container' attribute so we can have multiples of the same video on the page. -->
<div id="wistia_4d8229898d_1" class="wistia_embed" style="width:640px;height:360px;" data-video-width="640" data-video-height="360">&nbsp;</div>
<script charset="ISO-8859-1" src="http://fast.wistia.com/static/concat/E-v1.js"></script>
<script>
wistiaEmbed1 = Wistia.embed("4d8229898d", {
version: "v1",
videoWidth: 640,
videoHeight: 360,
container: "wistia_4d8229898d_1"
});
@MaxPower15
MaxPower15 / gist:4278527
Created December 13, 2012 18:31
Programmatically launch an existing popover on the page.
<a id="my_popover" href="http://fast.wistia.com/embed/iframe/fcf31a497a?autoPlay=true&controlsVisibleOnLoad=true&playerColor=81c2f0&popover=true&version=v1&videoHeight=360&videoWidth=640" class="wistia-popover[height=360,playerColor=81c2f0,width=640]"><img src="http://embed.wistia.com/deliveries/e45e6fd93899ef7abbbd0d1dc643e99e8d2f84d7.jpg?image_play_button=true&image_play_button_color=4991C4e0&image_crop_resized=150x84" alt="" /></a><script charset="ISO-8859-1" src="http://fast.wistia.com/static/popover-v1.js"></script>
<script>
wistiaJQuery("#my_popover").click();
</script>