iframe - Version 1.6.0

Version Description

  • Adding auto-height feature (thanks to Willem Veelenturf);
Download this release

Release Info

Developer webvitaly
Plugin Icon wp plugin iframe
Version 1.6.0
Comparing to
See all releases

Code changes from version 1.5.0 to 1.6.0

Files changed (2) hide show
  1. iframe.php +27 -9
  2. readme.txt +5 -2
iframe.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Iframe
4
  Plugin URI: http://web-profile.com.ua/wordpress/plugins/iframe/
5
  Description: Plugin shows iframe with [iframe src="http://player.vimeo.com/video/3261363" width="100%" height="480"] shortcode.
6
- Version: 1.5.0
7
  Author: webvitaly
8
  Author Email: webvitaly(at)gmail.com
9
  Author URI: http://web-profile.com.ua/wordpress/
@@ -38,14 +38,32 @@ if ( !function_exists( 'iframe_embed_shortcode' ) ) :
38
  }
39
  $return = '';
40
  if( $same_height_as != '' ){
41
- $return .= '
42
- <script>
43
- jQuery(document).ready(function($) {
44
- var target_height = $("'.$same_height_as.'").height();
45
- $("iframe.'.$class.'").height(target_height);
46
- });
47
- </script>
48
- ';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  }
50
  if( $id != '' ){
51
  $id_text = 'id="'.$id.'" ';
3
  Plugin Name: Iframe
4
  Plugin URI: http://web-profile.com.ua/wordpress/plugins/iframe/
5
  Description: Plugin shows iframe with [iframe src="http://player.vimeo.com/video/3261363" width="100%" height="480"] shortcode.
6
+ Version: 1.6.0
7
  Author: webvitaly
8
  Author Email: webvitaly(at)gmail.com
9
  Author URI: http://web-profile.com.ua/wordpress/
38
  }
39
  $return = '';
40
  if( $same_height_as != '' ){
41
+ if( $same_height_as != 'content' ){ // we are setting the height of the iframe like as target element
42
+ if( $same_height_as == 'document' || $same_height_as == 'window' ){ // remove quotes for window or document selectors
43
+ $target_selector = $same_height_as;
44
+ }else{
45
+ $target_selector = '"'.$same_height_as.'"';
46
+ }
47
+ $return .= '
48
+ <script>
49
+ jQuery(document).ready(function($) {
50
+ var target_height = $('.$target_selector.').height();
51
+ $("iframe.'.$class.'").height(target_height);
52
+ });
53
+ </script>
54
+ ';
55
+ }else{ // set the actual height of the iframe (show all content of the iframe without scroll)
56
+ $return .= '
57
+ <script>
58
+ jQuery(document).ready(function($) {
59
+ $("iframe.'.$class.'").bind("load", function() {
60
+ var embed_height = $(this).contents().find("body").height();
61
+ $(this).height(embed_height);
62
+ });
63
+ });
64
+ </script>
65
+ ';
66
+ }
67
  }
68
  if( $id != '' ){
69
  $id_text = 'id="'.$id.'" ';
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: iframe, embed, youtube, vimeo, google-map, google-maps
5
  Author URI: http://web-profile.com.ua/wordpress/
6
  Requires at least: 3.0
7
  Tested up to: 3.3
8
- Stable tag: 1.5.0
9
 
10
  You can embed iframe with [iframe src="http://vimeo.com/123" width="100%" height="480"] shortcode.
11
 
@@ -26,7 +26,7 @@ So you can embed iframe code using this shortcode `[iframe src="http://player.vi
26
  * allowtransparency - allows to set transparency of the iframe `[iframe allowtransparency="true" src="http://player.vimeo.com/video/3261363"]` (by default allowtransparency="true");
27
  * id - allows to add the id of the iframe `[iframe id="my-id" src="http://player.vimeo.com/video/3261363"]` (by default id="");
28
  * class - allowing to add the class of the iframe `[iframe class="my-class" src="http://player.vimeo.com/video/3261363"]` (by default class="iframe-class");
29
- * same_height_as - allows to set the height of iframe same as target element `[iframe same_height_as="body" src="http://player.vimeo.com/video/3261363"]`, `[iframe same_height_as="div.sidebar"]`, `[iframe same_height_as="div#content"]`, `[iframe same_height_as="window"]` - iframe will have the height of the viewport (visible area), `[iframe same_height_as="document"]` - iframe will have the height of the document (by default same_height_as="");
30
 
31
  [Iframe plugin page](http://web-profile.com.ua/wordpress/plugins/iframe/)
32
 
@@ -34,6 +34,9 @@ So you can embed iframe code using this shortcode `[iframe src="http://player.vi
34
 
35
  == Changelog ==
36
 
 
 
 
37
  = 1.5.0 =
38
  * Using native jQuery from include directory;
39
  * Improving "same_height_as" parameter;
5
  Author URI: http://web-profile.com.ua/wordpress/
6
  Requires at least: 3.0
7
  Tested up to: 3.3
8
+ Stable tag: 1.6.0
9
 
10
  You can embed iframe with [iframe src="http://vimeo.com/123" width="100%" height="480"] shortcode.
11
 
26
  * allowtransparency - allows to set transparency of the iframe `[iframe allowtransparency="true" src="http://player.vimeo.com/video/3261363"]` (by default allowtransparency="true");
27
  * id - allows to add the id of the iframe `[iframe id="my-id" src="http://player.vimeo.com/video/3261363"]` (by default id="");
28
  * class - allowing to add the class of the iframe `[iframe class="my-class" src="http://player.vimeo.com/video/3261363"]` (by default class="iframe-class");
29
+ * same_height_as - allows to set the height of iframe same as target element `[iframe same_height_as="body" src="http://player.vimeo.com/video/3261363"]`, `[iframe same_height_as="div.sidebar"]`, `[iframe same_height_as="div#content"]`, `[iframe same_height_as="window"]` - iframe will have the height of the viewport (visible area), `[iframe same_height_as="document"]` - iframe will have the height of the document, `[iframe same_height_as="content"]` - auto-height feature, so the height of the iframe will be the same as embedded content (works only with the same domain) (by default same_height_as="");
30
 
31
  [Iframe plugin page](http://web-profile.com.ua/wordpress/plugins/iframe/)
32
 
34
 
35
  == Changelog ==
36
 
37
+ = 1.6.0 =
38
+ * Adding auto-height feature (thanks to Willem Veelenturf);
39
+
40
  = 1.5.0 =
41
  * Using native jQuery from include directory;
42
  * Improving "same_height_as" parameter;