diff options
author | MaZderMind | 2015-08-13 18:18:08 +0200 |
---|---|---|
committer | MaZderMind | 2015-08-21 12:14:53 +0200 |
commit | 5e446908ea962ca25ebdd7b15efed0804a0ad7c7 (patch) | |
tree | f6daeffdcdea8fca05e00f0bd858c92c2bc78353 /assets/js | |
parent | 5b279f983a76ad7994089ad2d97f3e7fec27afbc (diff) |
Allow Disabling Embed-Autoplay
Diffstat (limited to 'assets/js')
-rw-r--r-- | assets/js/lustiges-script.js | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/assets/js/lustiges-script.js b/assets/js/lustiges-script.js index 0aa87ff..fff3896 100644 --- a/assets/js/lustiges-script.js +++ b/assets/js/lustiges-script.js @@ -524,16 +524,28 @@ $(function() { // embed-form $(function() { - $('.embed-form #size').on('click', function() { + var originalsrc; + $('.embed-form #size, .embed-form #autoplay').on('click', function() { var - $size = $(this), + $size = $('.embed-form #size'), selected = $size.val().split(','), - $codefield = $('#embed-code') + $size = $('.embed-form #size'), + $codefield = $('#embed-code'), + $urlfield = $('#embed-url'), $iframe = $( $codefield.val() ), - $iframe.attr({width: selected[0], height: selected[1]}); + autoplay = $('.embed-form #autoplay').prop('checked'); + + if(!originalsrc) + originalsrc = $iframe.attr('src'); + + var src = originalsrc + (autoplay ? '' : 'no-autoplay/'); + + $iframe.attr({width: selected[0], height: selected[1]}); + $iframe.attr({src: src}); $codefield.val( $iframe.prop('outerHTML') ); - }).trigger('click'); + $urlfield.val( src ); + }) $('.embed-form').on('click', 'input[type=text]', function() { $(this).select(); |