Plugin Directory

Changeset 2180255


Ignore:
Timestamp:
10/25/2019 05:38:20 PM (6 years ago)
Author:
burlingtonbytes
Message:

Remove mutation observer for IE11

Location:
wp-smartcrop
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wp-smartcrop/tags/2.0.3/js/jquery.wp-smartcrop.js

    r2024370 r2180255  
    11/**
    2  * jQuery SmartCrop v2.0.0
     2 * jQuery SmartCrop v2.0.3
    33 * Copyright (c) 2017 Greg Schoppe
    44 * License: http://www.opensource.org/licenses/mit-license.php
     
    239239    };
    240240    init();
     241    var ua = ua || navigator.userAgent;
     242    var isIE11 = ua.indexOf('Trident/7') !== -1;
    241243    // mutation observer to make smartcrop run after ajax actions
    242     if ("MutationObserver" in window) {
     244    if ("MutationObserver" in window && !isIE11) {
    243245        // this should watch the entire document for new nodes, and trigger smartcrop when they are seen
    244246        var mutationObserver = new MutationObserver(function(mutations) {
  • wp-smartcrop/tags/2.0.3/js/jquery.wp-smartcrop.min.js

    r2024379 r2180255  
    11/**
    2  * jQuery WP-SmartCrop v2.0.0
     2 * jQuery WP-SmartCrop v2.0.3
    33 * Copyright (c) 2017 Greg Schoppe
    44 * License: http://www.opensource.org/licenses/mit-license.php
    55 **/
    6 (function($){$.fn.extend({'wpsmartcrop':function(options){var options=$.extend({'focal_point':null,'compatibility':null,'focus_mode':'power-lines'},options);var lastTime=0;var vendors=['webkit','moz'];var requestFrame=window.requestAnimationFrame;var cancelFrame=window.cancelAnimationFrame;for(var x=0;x<vendors.length&&!requestFrame;++x){requestFrame=window[vendors[x]+'RequestAnimationFrame'];cancelFrame=window[vendors[x]+'CancelAnimationFrame']||window[vendors[x]+'CancelRequestAnimationFrame']}
    7 if(!requestFrame){requestFrame=function(callback,element){var currTime=new Date().getTime();var timeToCall=Math.max(0,16-(currTime-lastTime));var id=window.setTimeout(function(){callback(currTime+timeToCall)},timeToCall);lastTime=currTime+timeToCall;return id}}
    8 if(!cancelFrame){cancelFrame=function(id){clearTimeout(id)}}
    9 var browser_supports_object_fit=(function(){var div=document.createElement("div");if("objectFit" in div.style&&"objectPosition" in div.style){return!0}
    10 if("OobjectFit" in div.style&&"OobjectPosition" in div.style){return!0}
    11 return!1})();function closest(num,arr){var curr=arr[0];var diff=Math.abs(num-curr);for(var val=0;val<arr.length;val++){var newdiff=Math.abs(num-arr[val]);if(newdiff<diff){diff=newdiff;curr=arr[val]}}
    12 return curr}
    13 function get_final_image_dims(natural_dims,target_dims){var natural_ratio=natural_dims[0]/natural_dims[1];var target_ratio=target_dims[0]/target_dims[1];if(natural_ratio>target_ratio){return[Math.round(target_dims[1]*natural_ratio),target_dims[1]]}
    14 return[target_dims[0],Math.round(target_dims[0]/natural_ratio)]}
    15 function get_crop_data($el){var get_smartcrop_offset=function(dim,orig_dim,focus_pos,focus_mode){if(!focus_mode){focus_mode='power-lines'}
    16 focus_pos=focus_pos/100;var focus_target=focus_pos,max=orig_dim-dim,offset;if(focus_mode=='power-lines'){focus_target=closest(focus_pos,[.33333,.5,.66667])}
    17 offset=Math.round(focus_pos*orig_dim-focus_target*dim);if(offset>max){offset=max}
    18 if(offset<0){offset=0}
    19 return-1*offset};var focal_point=$el.data('smartcrop-focus'),focus_mode=$el.data('smartcrop-mode'),natural_dims=[($el[0].naturalWidth)?$el[0].naturalWidth:$el[0].getAttribute('width'),($el[0].naturalHeight)?$el[0].naturalHeight:$el[0].getAttribute('height')],target_dims=[$el.width(),$el.height()],final_dims=get_final_image_dims(natural_dims,target_dims),offsets=[0,0];if(!focal_point){focal_point=options.focal_point}
    20 if(!focal_point||focal_point.length<2||!natural_dims[0]||!natural_dims[1]||!target_dims[0]||!target_dims[1]){return!1}
    21 if(!focus_mode){if(typeof window.wpsmartcrop_focus_mode!=='undefined'){focus_mode=options.focus_mode}else{focus_mode="power-lines"}}
    22 if(target_dims[0]/target_dims[1]<final_dims[0]/final_dims[1]){offsets[0]=get_smartcrop_offset(target_dims[0],final_dims[0],focal_point[0],focus_mode)}else{offsets[1]=get_smartcrop_offset(target_dims[1],final_dims[1],focal_point[1],focus_mode)}
    23 return{final_width:final_dims[0],final_height:final_dims[1],offset_x:offsets[0],offset_y:offsets[1]}}
    24 function recrop_images($el,use_object_fit){var crop=get_crop_data($el);if(use_object_fit){var position_val=''+crop.offset_x+'px '+''+crop.offset_y+'px';$el.css({'-o-object-position':position_val,'object-position':position_val});$el.addClass('wpsmartcrop-rendered')}else{var img_pos=$el.position();var $overlay=$el.next('.wpsmartcrop-overlay');var $overlay_img=$overlay.find('img');$overlay.css({'width':$el.width()+'px','height':$el.height()+'px','top':img_pos.top+'px','left':img_pos.left+'px',});$overlay_img.css({'width':crop.final_width+'px','height':crop.final_height+'px','top':crop.offset_y+'px','left':crop.offset_x+'px',});$overlay.addClass('wpsmartcrop-overlay-rendered')}}
    25 return this.each(function(){var $this=$(this);if(!$this.is('img')){return}
    26 var natural_dims=[($this[0].naturalWidth)?$this[0].naturalWidth:$this[0].getAttribute('width'),($this[0].naturalHeight)?$this[0].naturalHeight:$this[0].getAttribute('height')];if(natural_dims[0]==0||natural_dims[1]==0){return}
    27 $this.data('wpsmartcrop-natural-dims',natural_dims);$this.next('wpsmartcrop-overlay').remove();if(options.focal_point){$this.data('smartcrop-focus',options.focal_point)}else{if(!$this.data('smartcrop-focus')){$this.data('smartcrop-focus',[50,50])}}
    28 var use_object_fit=!0;if(options.compatibility!='new'){if((options.compatibility=='old')||!browser_supports_object_fit){use_object_fit=!1;var $clone=$this.clone().removeClass('wpsmartcrop-image').removeAttr('data-smartcrop-focus');var $image_overlay=$('<div></div>').addClass('wpsmartcrop-overlay').append($clone);$image_overlay.insertAfter($this)}}
    29 recrop_images($this,use_object_fit);var resizer_frame_request=!1;$(window).resize(function(){cancelFrame(resizer_frame_request);resizer_frame_request=requestFrame(function(){recrop_images($this,use_object_fit)})});$(window).on('load',function(){recrop_images($this,use_object_fit)});$this.on('wpsmartcrop-redraw',function(){recrop_images($this,use_object_fit)})})}})}(jQuery));jQuery(document).ready(function($){if(typeof wpsmartcrop_options==='undefined'){wpsmartcrop_options={}}
    30 var init=function(){$('img.wpsmartcrop-image').wpsmartcrop(wpsmartcrop_options)};init();if("MutationObserver" in window){var mutationObserver=new MutationObserver(function(mutations){init()});mutationObserver.observe(document.documentElement,{attributes:!1,characterData:!1,childList:!0,subtree:!0,})}})
     6!function(t){t.fn.extend({wpsmartcrop:function(e){e=t.extend({focal_point:null,compatibility:null,focus_mode:"power-lines"},e);for(var o=0,i=["webkit","moz"],n=window.requestAnimationFrame,a=window.cancelAnimationFrame,r=0;r<i.length&&!n;++r)n=window[i[r]+"RequestAnimationFrame"],a=window[i[r]+"CancelAnimationFrame"]||window[i[r]+"CancelRequestAnimationFrame"];n||(n=function(t,e){var i=(new Date).getTime(),n=Math.max(0,16-(i-o)),a=window.setTimeout(function(){t(i+n)},n);return o=i+n,a}),a||(a=function(t){clearTimeout(t)});var s,c="objectFit"in(s=document.createElement("div")).style&&"objectPosition"in s.style||"OobjectFit"in s.style&&"OobjectPosition"in s.style;function p(t){var o=function(t,e,o,i){i||(i="power-lines");var n,a=o/=100,r=e-t;return"power-lines"==i&&(a=function(t,e){for(var o=e[0],i=Math.abs(t-o),n=0;n<e.length;n++){var a=Math.abs(t-e[n]);a<i&&(i=a,o=e[n])}return o}(o,[.33333,.5,.66667])),(n=Math.round(o*e-a*t))>r&&(n=r),n<0&&(n=0),-1*n},i=t.data("smartcrop-focus"),n=t.data("smartcrop-mode"),a=[t[0].naturalWidth?t[0].naturalWidth:t[0].getAttribute("width"),t[0].naturalHeight?t[0].naturalHeight:t[0].getAttribute("height")],r=[t.width(),t.height()],s=function(t,e){var o=t[0]/t[1];return o>e[0]/e[1]?[Math.round(e[1]*o),e[1]]:[e[0],Math.round(e[0]/o)]}(a,r),c=[0,0];return i||(i=e.focal_point),!(!i||i.length<2||!a[0]||!a[1]||!r[0]||!r[1])&&(n||(n=void 0!==window.wpsmartcrop_focus_mode?e.focus_mode:"power-lines"),r[0]/r[1]<s[0]/s[1]?c[0]=o(r[0],s[0],i[0],n):c[1]=o(r[1],s[1],i[1],n),{final_width:s[0],final_height:s[1],offset_x:c[0],offset_y:c[1]})}function d(t,e){var o=p(t);if(e){var i=o.offset_x+"px "+o.offset_y+"px";t.css({"-o-object-position":i,"object-position":i}),t.addClass("wpsmartcrop-rendered")}else{var n=t.position(),a=t.next(".wpsmartcrop-overlay"),r=a.find("img");a.css({width:t.width()+"px",height:t.height()+"px",top:n.top+"px",left:n.left+"px"}),r.css({width:o.final_width+"px",height:o.final_height+"px",top:o.offset_y+"px",left:o.offset_x+"px"}),a.addClass("wpsmartcrop-overlay-rendered")}}return this.each(function(){var o=t(this);if(o.is("img")){var i=[o[0].naturalWidth?o[0].naturalWidth:o[0].getAttribute("width"),o[0].naturalHeight?o[0].naturalHeight:o[0].getAttribute("height")];if(0!=i[0]&&0!=i[1]){o.data("wpsmartcrop-natural-dims",i),o.next("wpsmartcrop-overlay").remove(),e.focal_point?o.data("smartcrop-focus",e.focal_point):o.data("smartcrop-focus")||o.data("smartcrop-focus",[50,50]);var r=!0;if("new"!=e.compatibility&&("old"==e.compatibility||!c)){r=!1;var s=o.clone().removeClass("wpsmartcrop-image").removeAttr("data-smartcrop-focus");t("<div></div>").addClass("wpsmartcrop-overlay").append(s).insertAfter(o)}d(o,r);var p=!1;t(window).resize(function(){a(p),p=n(function(){d(o,r)})}),t(window).on("load",function(){d(o,r)}),o.on("wpsmartcrop-redraw",function(){d(o,r)})}}})}})}(jQuery),jQuery(document).ready(function(t){"undefined"==typeof wpsmartcrop_options&&(wpsmartcrop_options={});var e=function(){t("img.wpsmartcrop-image").wpsmartcrop(wpsmartcrop_options)};e();var o=o||navigator.userAgent,i=-1!==o.indexOf("Trident/7");"MutationObserver"in window&&!i&&new MutationObserver(function(t){e()}).observe(document.documentElement,{attributes:!1,characterData:!1,childList:!0,subtree:!0})});
  • wp-smartcrop/tags/2.0.3/readme.txt

    r2046274 r2180255  
    11=== WP SmartCrop ===
    2 Contributors: burlingtonbytes
     2Contributors: burlingtonbytes, gschoppe
    33Tags: image, crop, cropping, resize, aspect ratio, fit, size, advanced, simple, media, library, photography, featured image, content, responsive, design, smart, intelligent, live
    44Requires at least: 3.5.0
     
    1616
    1717---
    18 Learn More at: **[http://www.wpsmartcrop.com/](http://www.wpsmartcrop.com)**
     18Learn More at: **[https://www.wpsmartcrop.com/](https://www.wpsmartcrop.com)**
    1919---
    2020
     
    7272
    7373== Website ==
    74 [http://www.wpsmartcrop.com/](http://www.wpsmartcrop.com)
     74[https://www.wpsmartcrop.com/](https://www.wpsmartcrop.com)
    7575
    7676= Please Rate/Review and Enjoy =
     
    8989    }
    9090
    91 Once you've verified that the plugin is working, go wild!  Some example css for inspiration can be found at [http://www.wpsmartcrop.com/demos](http://www.wpsmartcrop.com/demos)
     91Once you've verified that the plugin is working, go wild!  Some example css for inspiration can be found at [https://www.wpsmartcrop.com/demos](https://www.wpsmartcrop.com/demos)
    9292
    9393= Q. Why can't you choose the focal points for me? =
     
    110110
    111111== Changelog ==
    112 = 2.0.2
     112
     113= 2.0.3 =
     114* Remove mutation observer for IE11
     115
     116= 2.0.2 =
    113117* Fix admin url
    114118
    115 = 2.0.1
     119= 2.0.1 =
    116120* Fix custom image size issue
    117121
  • wp-smartcrop/tags/2.0.3/wp-smartcrop.php

    r2046274 r2180255  
    22/**
    33 * Plugin Name: WP SmartCrop
    4  * Plugin URI: http://www.wpsmartcrop.com/
     4 * Plugin URI: https://www.wpsmartcrop.com/
    55 * Description: Style your images exactly how you want them to appear, for any screen size, and never get a cut-off face.
    6  * Version: 2.0.2
    7  * Author: Burlington Bytes
    8  * Author URI: https://www.burlingtonbytes.com
     6 * Version: 2.0.3
     7 * Author: Bytes.co
     8 * Author URI: https://bytes.co
    99 * License: GPLv2 or later
    1010 * Text Domain: wpsmartcrop
     
    1313if( !class_exists('WP_Smart_Crop') ) {
    1414    class WP_Smart_Crop {
    15         public  $version = '2.0.2';
     15        public  $version = '2.0.3';
    1616        private $plugin_dir_path;
    1717        private $plugin_dir_url;
     
    6868        function plugin_action_links( $links ) {
    6969            $links[] = '<a href="'. esc_url( get_admin_url(null, 'options-general.php?page=wp-smartcrop') ) .'">Settings</a>';
    70             $links[] = '<a href="http://www.wpsmartcrop.com/addons" target="_blank">Get Addons</a>';
     70            //$links[] = '<a href="https://www.wpsmartcrop.com/addons" target="_blank">Get Addons</a>';
    7171            return $links;
    7272        }
  • wp-smartcrop/trunk/js/jquery.wp-smartcrop.js

    r2024370 r2180255  
    11/**
    2  * jQuery SmartCrop v2.0.0
     2 * jQuery SmartCrop v2.0.3
    33 * Copyright (c) 2017 Greg Schoppe
    44 * License: http://www.opensource.org/licenses/mit-license.php
     
    239239    };
    240240    init();
     241    var ua = ua || navigator.userAgent;
     242    var isIE11 = ua.indexOf('Trident/7') !== -1;
    241243    // mutation observer to make smartcrop run after ajax actions
    242     if ("MutationObserver" in window) {
     244    if ("MutationObserver" in window && !isIE11) {
    243245        // this should watch the entire document for new nodes, and trigger smartcrop when they are seen
    244246        var mutationObserver = new MutationObserver(function(mutations) {
  • wp-smartcrop/trunk/js/jquery.wp-smartcrop.min.js

    r2024379 r2180255  
    11/**
    2  * jQuery WP-SmartCrop v2.0.0
     2 * jQuery WP-SmartCrop v2.0.3
    33 * Copyright (c) 2017 Greg Schoppe
    44 * License: http://www.opensource.org/licenses/mit-license.php
    55 **/
    6 (function($){$.fn.extend({'wpsmartcrop':function(options){var options=$.extend({'focal_point':null,'compatibility':null,'focus_mode':'power-lines'},options);var lastTime=0;var vendors=['webkit','moz'];var requestFrame=window.requestAnimationFrame;var cancelFrame=window.cancelAnimationFrame;for(var x=0;x<vendors.length&&!requestFrame;++x){requestFrame=window[vendors[x]+'RequestAnimationFrame'];cancelFrame=window[vendors[x]+'CancelAnimationFrame']||window[vendors[x]+'CancelRequestAnimationFrame']}
    7 if(!requestFrame){requestFrame=function(callback,element){var currTime=new Date().getTime();var timeToCall=Math.max(0,16-(currTime-lastTime));var id=window.setTimeout(function(){callback(currTime+timeToCall)},timeToCall);lastTime=currTime+timeToCall;return id}}
    8 if(!cancelFrame){cancelFrame=function(id){clearTimeout(id)}}
    9 var browser_supports_object_fit=(function(){var div=document.createElement("div");if("objectFit" in div.style&&"objectPosition" in div.style){return!0}
    10 if("OobjectFit" in div.style&&"OobjectPosition" in div.style){return!0}
    11 return!1})();function closest(num,arr){var curr=arr[0];var diff=Math.abs(num-curr);for(var val=0;val<arr.length;val++){var newdiff=Math.abs(num-arr[val]);if(newdiff<diff){diff=newdiff;curr=arr[val]}}
    12 return curr}
    13 function get_final_image_dims(natural_dims,target_dims){var natural_ratio=natural_dims[0]/natural_dims[1];var target_ratio=target_dims[0]/target_dims[1];if(natural_ratio>target_ratio){return[Math.round(target_dims[1]*natural_ratio),target_dims[1]]}
    14 return[target_dims[0],Math.round(target_dims[0]/natural_ratio)]}
    15 function get_crop_data($el){var get_smartcrop_offset=function(dim,orig_dim,focus_pos,focus_mode){if(!focus_mode){focus_mode='power-lines'}
    16 focus_pos=focus_pos/100;var focus_target=focus_pos,max=orig_dim-dim,offset;if(focus_mode=='power-lines'){focus_target=closest(focus_pos,[.33333,.5,.66667])}
    17 offset=Math.round(focus_pos*orig_dim-focus_target*dim);if(offset>max){offset=max}
    18 if(offset<0){offset=0}
    19 return-1*offset};var focal_point=$el.data('smartcrop-focus'),focus_mode=$el.data('smartcrop-mode'),natural_dims=[($el[0].naturalWidth)?$el[0].naturalWidth:$el[0].getAttribute('width'),($el[0].naturalHeight)?$el[0].naturalHeight:$el[0].getAttribute('height')],target_dims=[$el.width(),$el.height()],final_dims=get_final_image_dims(natural_dims,target_dims),offsets=[0,0];if(!focal_point){focal_point=options.focal_point}
    20 if(!focal_point||focal_point.length<2||!natural_dims[0]||!natural_dims[1]||!target_dims[0]||!target_dims[1]){return!1}
    21 if(!focus_mode){if(typeof window.wpsmartcrop_focus_mode!=='undefined'){focus_mode=options.focus_mode}else{focus_mode="power-lines"}}
    22 if(target_dims[0]/target_dims[1]<final_dims[0]/final_dims[1]){offsets[0]=get_smartcrop_offset(target_dims[0],final_dims[0],focal_point[0],focus_mode)}else{offsets[1]=get_smartcrop_offset(target_dims[1],final_dims[1],focal_point[1],focus_mode)}
    23 return{final_width:final_dims[0],final_height:final_dims[1],offset_x:offsets[0],offset_y:offsets[1]}}
    24 function recrop_images($el,use_object_fit){var crop=get_crop_data($el);if(use_object_fit){var position_val=''+crop.offset_x+'px '+''+crop.offset_y+'px';$el.css({'-o-object-position':position_val,'object-position':position_val});$el.addClass('wpsmartcrop-rendered')}else{var img_pos=$el.position();var $overlay=$el.next('.wpsmartcrop-overlay');var $overlay_img=$overlay.find('img');$overlay.css({'width':$el.width()+'px','height':$el.height()+'px','top':img_pos.top+'px','left':img_pos.left+'px',});$overlay_img.css({'width':crop.final_width+'px','height':crop.final_height+'px','top':crop.offset_y+'px','left':crop.offset_x+'px',});$overlay.addClass('wpsmartcrop-overlay-rendered')}}
    25 return this.each(function(){var $this=$(this);if(!$this.is('img')){return}
    26 var natural_dims=[($this[0].naturalWidth)?$this[0].naturalWidth:$this[0].getAttribute('width'),($this[0].naturalHeight)?$this[0].naturalHeight:$this[0].getAttribute('height')];if(natural_dims[0]==0||natural_dims[1]==0){return}
    27 $this.data('wpsmartcrop-natural-dims',natural_dims);$this.next('wpsmartcrop-overlay').remove();if(options.focal_point){$this.data('smartcrop-focus',options.focal_point)}else{if(!$this.data('smartcrop-focus')){$this.data('smartcrop-focus',[50,50])}}
    28 var use_object_fit=!0;if(options.compatibility!='new'){if((options.compatibility=='old')||!browser_supports_object_fit){use_object_fit=!1;var $clone=$this.clone().removeClass('wpsmartcrop-image').removeAttr('data-smartcrop-focus');var $image_overlay=$('<div></div>').addClass('wpsmartcrop-overlay').append($clone);$image_overlay.insertAfter($this)}}
    29 recrop_images($this,use_object_fit);var resizer_frame_request=!1;$(window).resize(function(){cancelFrame(resizer_frame_request);resizer_frame_request=requestFrame(function(){recrop_images($this,use_object_fit)})});$(window).on('load',function(){recrop_images($this,use_object_fit)});$this.on('wpsmartcrop-redraw',function(){recrop_images($this,use_object_fit)})})}})}(jQuery));jQuery(document).ready(function($){if(typeof wpsmartcrop_options==='undefined'){wpsmartcrop_options={}}
    30 var init=function(){$('img.wpsmartcrop-image').wpsmartcrop(wpsmartcrop_options)};init();if("MutationObserver" in window){var mutationObserver=new MutationObserver(function(mutations){init()});mutationObserver.observe(document.documentElement,{attributes:!1,characterData:!1,childList:!0,subtree:!0,})}})
     6!function(t){t.fn.extend({wpsmartcrop:function(e){e=t.extend({focal_point:null,compatibility:null,focus_mode:"power-lines"},e);for(var o=0,i=["webkit","moz"],n=window.requestAnimationFrame,a=window.cancelAnimationFrame,r=0;r<i.length&&!n;++r)n=window[i[r]+"RequestAnimationFrame"],a=window[i[r]+"CancelAnimationFrame"]||window[i[r]+"CancelRequestAnimationFrame"];n||(n=function(t,e){var i=(new Date).getTime(),n=Math.max(0,16-(i-o)),a=window.setTimeout(function(){t(i+n)},n);return o=i+n,a}),a||(a=function(t){clearTimeout(t)});var s,c="objectFit"in(s=document.createElement("div")).style&&"objectPosition"in s.style||"OobjectFit"in s.style&&"OobjectPosition"in s.style;function p(t){var o=function(t,e,o,i){i||(i="power-lines");var n,a=o/=100,r=e-t;return"power-lines"==i&&(a=function(t,e){for(var o=e[0],i=Math.abs(t-o),n=0;n<e.length;n++){var a=Math.abs(t-e[n]);a<i&&(i=a,o=e[n])}return o}(o,[.33333,.5,.66667])),(n=Math.round(o*e-a*t))>r&&(n=r),n<0&&(n=0),-1*n},i=t.data("smartcrop-focus"),n=t.data("smartcrop-mode"),a=[t[0].naturalWidth?t[0].naturalWidth:t[0].getAttribute("width"),t[0].naturalHeight?t[0].naturalHeight:t[0].getAttribute("height")],r=[t.width(),t.height()],s=function(t,e){var o=t[0]/t[1];return o>e[0]/e[1]?[Math.round(e[1]*o),e[1]]:[e[0],Math.round(e[0]/o)]}(a,r),c=[0,0];return i||(i=e.focal_point),!(!i||i.length<2||!a[0]||!a[1]||!r[0]||!r[1])&&(n||(n=void 0!==window.wpsmartcrop_focus_mode?e.focus_mode:"power-lines"),r[0]/r[1]<s[0]/s[1]?c[0]=o(r[0],s[0],i[0],n):c[1]=o(r[1],s[1],i[1],n),{final_width:s[0],final_height:s[1],offset_x:c[0],offset_y:c[1]})}function d(t,e){var o=p(t);if(e){var i=o.offset_x+"px "+o.offset_y+"px";t.css({"-o-object-position":i,"object-position":i}),t.addClass("wpsmartcrop-rendered")}else{var n=t.position(),a=t.next(".wpsmartcrop-overlay"),r=a.find("img");a.css({width:t.width()+"px",height:t.height()+"px",top:n.top+"px",left:n.left+"px"}),r.css({width:o.final_width+"px",height:o.final_height+"px",top:o.offset_y+"px",left:o.offset_x+"px"}),a.addClass("wpsmartcrop-overlay-rendered")}}return this.each(function(){var o=t(this);if(o.is("img")){var i=[o[0].naturalWidth?o[0].naturalWidth:o[0].getAttribute("width"),o[0].naturalHeight?o[0].naturalHeight:o[0].getAttribute("height")];if(0!=i[0]&&0!=i[1]){o.data("wpsmartcrop-natural-dims",i),o.next("wpsmartcrop-overlay").remove(),e.focal_point?o.data("smartcrop-focus",e.focal_point):o.data("smartcrop-focus")||o.data("smartcrop-focus",[50,50]);var r=!0;if("new"!=e.compatibility&&("old"==e.compatibility||!c)){r=!1;var s=o.clone().removeClass("wpsmartcrop-image").removeAttr("data-smartcrop-focus");t("<div></div>").addClass("wpsmartcrop-overlay").append(s).insertAfter(o)}d(o,r);var p=!1;t(window).resize(function(){a(p),p=n(function(){d(o,r)})}),t(window).on("load",function(){d(o,r)}),o.on("wpsmartcrop-redraw",function(){d(o,r)})}}})}})}(jQuery),jQuery(document).ready(function(t){"undefined"==typeof wpsmartcrop_options&&(wpsmartcrop_options={});var e=function(){t("img.wpsmartcrop-image").wpsmartcrop(wpsmartcrop_options)};e();var o=o||navigator.userAgent,i=-1!==o.indexOf("Trident/7");"MutationObserver"in window&&!i&&new MutationObserver(function(t){e()}).observe(document.documentElement,{attributes:!1,characterData:!1,childList:!0,subtree:!0})});
  • wp-smartcrop/trunk/readme.txt

    r2046274 r2180255  
    11=== WP SmartCrop ===
    2 Contributors: burlingtonbytes
     2Contributors: burlingtonbytes, gschoppe
    33Tags: image, crop, cropping, resize, aspect ratio, fit, size, advanced, simple, media, library, photography, featured image, content, responsive, design, smart, intelligent, live
    44Requires at least: 3.5.0
     
    1616
    1717---
    18 Learn More at: **[http://www.wpsmartcrop.com/](http://www.wpsmartcrop.com)**
     18Learn More at: **[https://www.wpsmartcrop.com/](https://www.wpsmartcrop.com)**
    1919---
    2020
     
    7272
    7373== Website ==
    74 [http://www.wpsmartcrop.com/](http://www.wpsmartcrop.com)
     74[https://www.wpsmartcrop.com/](https://www.wpsmartcrop.com)
    7575
    7676= Please Rate/Review and Enjoy =
     
    8989    }
    9090
    91 Once you've verified that the plugin is working, go wild!  Some example css for inspiration can be found at [http://www.wpsmartcrop.com/demos](http://www.wpsmartcrop.com/demos)
     91Once you've verified that the plugin is working, go wild!  Some example css for inspiration can be found at [https://www.wpsmartcrop.com/demos](https://www.wpsmartcrop.com/demos)
    9292
    9393= Q. Why can't you choose the focal points for me? =
     
    110110
    111111== Changelog ==
    112 = 2.0.2
     112
     113= 2.0.3 =
     114* Remove mutation observer for IE11
     115
     116= 2.0.2 =
    113117* Fix admin url
    114118
    115 = 2.0.1
     119= 2.0.1 =
    116120* Fix custom image size issue
    117121
  • wp-smartcrop/trunk/wp-smartcrop.php

    r2046274 r2180255  
    22/**
    33 * Plugin Name: WP SmartCrop
    4  * Plugin URI: http://www.wpsmartcrop.com/
     4 * Plugin URI: https://www.wpsmartcrop.com/
    55 * Description: Style your images exactly how you want them to appear, for any screen size, and never get a cut-off face.
    6  * Version: 2.0.2
    7  * Author: Burlington Bytes
    8  * Author URI: https://www.burlingtonbytes.com
     6 * Version: 2.0.3
     7 * Author: Bytes.co
     8 * Author URI: https://bytes.co
    99 * License: GPLv2 or later
    1010 * Text Domain: wpsmartcrop
     
    1313if( !class_exists('WP_Smart_Crop') ) {
    1414    class WP_Smart_Crop {
    15         public  $version = '2.0.2';
     15        public  $version = '2.0.3';
    1616        private $plugin_dir_path;
    1717        private $plugin_dir_url;
     
    6868        function plugin_action_links( $links ) {
    6969            $links[] = '<a href="'. esc_url( get_admin_url(null, 'options-general.php?page=wp-smartcrop') ) .'">Settings</a>';
    70             $links[] = '<a href="http://www.wpsmartcrop.com/addons" target="_blank">Get Addons</a>';
     70            //$links[] = '<a href="https://www.wpsmartcrop.com/addons" target="_blank">Get Addons</a>';
    7171            return $links;
    7272        }
Note: See TracChangeset for help on using the changeset viewer.