<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[26292] trunk/src/wp-admin/js/image-edit.js: Fix JSHint errors in image-edit.js.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/26292">26292</a></dd>
<dt>Author</dt> <dd>SergeyBiryukov</dd>
<dt>Date</dt> <dd>2013-11-20 22:46:43 +0000 (Wed, 20 Nov 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fix JSHint errors in image-edit.js.
props dougwollison.
fixes <a href="http://core.trac.wordpress.org/ticket/26000">#26000</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminjsimageeditjs">trunk/src/wp-admin/js/image-edit.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminjsimageeditjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/js/image-edit.js (26291 => 26292)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/image-edit.js 2013-11-20 19:43:36 UTC (rev 26291)
+++ trunk/src/wp-admin/js/image-edit.js 2013-11-20 22:46:43 UTC (rev 26292)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><del>-var imageEdit;
</del><ins>+/* global imageEditL10n, ajaxurl, confirm */
</ins><span class="cx">
</span><span class="cx"> (function($) {
</span><del>-imageEdit = {
</del><ins>+var imageEdit = window.imageEdit = {
</ins><span class="cx"> iasapi : {},
</span><span class="cx"> hold : {},
</span><span class="cx"> postid : '',
</span><span class="lines">@@ -20,28 +20,30 @@
</span><span class="cx"> }
</span><span class="cx"> },
</span><span class="cx">
</span><del>- init : function(postid, nonce) {
</del><ins>+ init : function(postid) {
</ins><span class="cx"> var t = this, old = $('#image-editor-' + t.postid),
</span><span class="cx"> x = t.intval( $('#imgedit-x-' + postid).val() ),
</span><span class="cx"> y = t.intval( $('#imgedit-y-' + postid).val() );
</span><span class="cx">
</span><del>- if ( t.postid != postid && old.length )
</del><ins>+ if ( t.postid !== postid && old.length ) {
</ins><span class="cx"> t.close(t.postid);
</span><ins>+ }
</ins><span class="cx">
</span><del>- t.hold['w'] = t.hold['ow'] = x;
- t.hold['h'] = t.hold['oh'] = y;
- t.hold['xy_ratio'] = x / y;
- t.hold['sizer'] = parseFloat( $('#imgedit-sizer-' + postid).val() );
</del><ins>+ t.hold.w = t.hold.ow = x;
+ t.hold.h = t.hold.oh = y;
+ t.hold.xy_ratio = x / y;
+ t.hold.sizer = parseFloat( $('#imgedit-sizer-' + postid).val() );
</ins><span class="cx"> t.postid = postid;
</span><span class="cx"> $('#imgedit-response-' + postid).empty();
</span><span class="cx">
</span><span class="cx"> $('input[type="text"]', '#imgedit-panel-' + postid).keypress(function(e) {
</span><span class="cx"> var k = e.keyCode;
</span><span class="cx">
</span><del>- if ( 36 < k && k < 41 )
- $(this).blur()
</del><ins>+ if ( 36 < k && k < 41 ) {
+ $(this).blur();
+ }
</ins><span class="cx">
</span><del>- if ( 13 == k ) {
</del><ins>+ if ( 13 === k ) {
</ins><span class="cx"> e.preventDefault();
</span><span class="cx"> e.stopPropagation();
</span><span class="cx"> return false;
</span><span class="lines">@@ -52,10 +54,11 @@
</span><span class="cx"> toggleEditor : function(postid, toggle) {
</span><span class="cx"> var wait = $('#imgedit-wait-' + postid);
</span><span class="cx">
</span><del>- if ( toggle )
</del><ins>+ if ( toggle ) {
</ins><span class="cx"> wait.height( $('#imgedit-panel-' + postid).height() ).fadeIn('fast');
</span><del>- else
</del><ins>+ } else {
</ins><span class="cx"> wait.fadeOut('fast');
</span><ins>+ }
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> toggleHelp : function(el) {
</span><span class="lines">@@ -72,29 +75,32 @@
</span><span class="cx"> warn = $('#imgedit-scale-warn-' + postid), w1 = '', h1 = '';
</span><span class="cx">
</span><span class="cx"> if ( x ) {
</span><del>- h1 = (w.val() != '') ? Math.round( w.val() / this.hold['xy_ratio'] ) : '';
</del><ins>+ h1 = ( w.val() !== '' ) ? Math.round( w.val() / this.hold.xy_ratio ) : '';
</ins><span class="cx"> h.val( h1 );
</span><span class="cx"> } else {
</span><del>- w1 = (h.val() != '') ? Math.round( h.val() * this.hold['xy_ratio'] ) : '';
</del><ins>+ w1 = ( h.val() !== '' ) ? Math.round( h.val() * this.hold.xy_ratio ) : '';
</ins><span class="cx"> w.val( w1 );
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if ( ( h1 && h1 > this.hold['oh'] ) || ( w1 && w1 > this.hold['ow'] ) )
</del><ins>+ if ( ( h1 && h1 > this.hold.oh ) || ( w1 && w1 > this.hold.ow ) ) {
</ins><span class="cx"> warn.css('visibility', 'visible');
</span><del>- else
</del><ins>+ } else {
</ins><span class="cx"> warn.css('visibility', 'hidden');
</span><ins>+ }
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> getSelRatio : function(postid) {
</span><del>- var x = this.hold['w'], y = this.hold['h'],
</del><ins>+ var x = this.hold.w, y = this.hold.h,
</ins><span class="cx"> X = this.intval( $('#imgedit-crop-width-' + postid).val() ),
</span><span class="cx"> Y = this.intval( $('#imgedit-crop-height-' + postid).val() );
</span><span class="cx">
</span><del>- if ( X && Y )
</del><ins>+ if ( X && Y ) {
</ins><span class="cx"> return X + ':' + Y;
</span><ins>+ }
</ins><span class="cx">
</span><del>- if ( x && y )
</del><ins>+ if ( x && y ) {
</ins><span class="cx"> return x + ':' + y;
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> return '1:1';
</span><span class="cx"> },
</span><span class="lines">@@ -103,7 +109,7 @@
</span><span class="cx"> // apply undo state to history
</span><span class="cx"> var history = $('#imgedit-history-' + postid).val(), pop, n, o, i, op = [];
</span><span class="cx">
</span><del>- if ( history != '' ) {
</del><ins>+ if ( history !== '' ) {
</ins><span class="cx"> history = JSON.parse(history);
</span><span class="cx"> pop = this.intval( $('#imgedit-undone-' + postid).val() );
</span><span class="cx"> if ( pop > 0 ) {
</span><span class="lines">@@ -115,8 +121,8 @@
</span><span class="cx">
</span><span class="cx"> if ( setSize ) {
</span><span class="cx"> if ( !history.length ) {
</span><del>- this.hold['w'] = this.hold['ow'];
- this.hold['h'] = this.hold['oh'];
</del><ins>+ this.hold.w = this.hold.ow;
+ this.hold.h = this.hold.oh;
</ins><span class="cx"> return '';
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -125,8 +131,8 @@
</span><span class="cx"> o = o.c || o.r || o.f || false;
</span><span class="cx">
</span><span class="cx"> if ( o ) {
</span><del>- this.hold['w'] = o.fw;
- this.hold['h'] = o.fh;
</del><ins>+ this.hold.w = o.fw;
+ this.hold.h = o.fh;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -167,18 +173,20 @@
</span><span class="cx"> // w, h are the new full size dims
</span><span class="cx"> max1 = Math.max( t.hold.w, t.hold.h );
</span><span class="cx"> max2 = Math.max( $(img).width(), $(img).height() );
</span><del>- t.hold['sizer'] = max1 > max2 ? max2 / max1 : 1;
</del><ins>+ t.hold.sizer = max1 > max2 ? max2 / max1 : 1;
</ins><span class="cx">
</span><span class="cx"> t.initCrop(postid, img, parent);
</span><span class="cx"> t.setCropSelection(postid, 0);
</span><span class="cx">
</span><del>- if ( (typeof callback != "unknown") && callback != null )
</del><ins>+ if ( (typeof callback !== 'undefined') && callback !== null ) {
</ins><span class="cx"> callback();
</span><ins>+ }
</ins><span class="cx">
</span><del>- if ( $('#imgedit-history-' + postid).val() && $('#imgedit-undone-' + postid).val() == 0 )
</del><ins>+ if ( $('#imgedit-history-' + postid).val() && $('#imgedit-undone-' + postid).val() === 0 ) {
</ins><span class="cx"> $('input.imgedit-submit-btn', '#imgedit-panel-' + postid).removeAttr('disabled');
</span><del>- else
</del><ins>+ } else {
</ins><span class="cx"> $('input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', true);
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> t.toggleEditor(postid, 0);
</span><span class="cx"> })
</span><span class="lines">@@ -192,8 +200,9 @@
</span><span class="cx"> action : function(postid, nonce, action) {
</span><span class="cx"> var t = this, data, w, h, fw, fh;
</span><span class="cx">
</span><del>- if ( t.notsaved(postid) )
</del><ins>+ if ( t.notsaved(postid) ) {
</ins><span class="cx"> return false;
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> data = {
</span><span class="cx"> 'action': 'image-editor',
</span><span class="lines">@@ -201,7 +210,7 @@
</span><span class="cx"> 'postid': postid
</span><span class="cx"> };
</span><span class="cx">
</span><del>- if ( 'scale' == action ) {
</del><ins>+ if ( 'scale' === action ) {
</ins><span class="cx"> w = $('#imgedit-scale-width-' + postid),
</span><span class="cx"> h = $('#imgedit-scale-height-' + postid),
</span><span class="cx"> fw = t.intval(w.val()),
</span><span class="lines">@@ -215,13 +224,14 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if ( fw == t.hold.ow || fh == t.hold.oh )
</del><ins>+ if ( fw === t.hold.ow || fh === t.hold.oh ) {
</ins><span class="cx"> return false;
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> data['do'] = 'scale';
</span><del>- data['fwidth'] = fw;
- data['fheight'] = fh;
- } else if ( 'restore' == action ) {
</del><ins>+ data.fwidth = fw;
+ data.fheight = fh;
+ } else if ( 'restore' === action ) {
</ins><span class="cx"> data['do'] = 'restore';
</span><span class="cx"> } else {
</span><span class="cx"> return false;
</span><span class="lines">@@ -237,8 +247,9 @@
</span><span class="cx"> save : function(postid, nonce) {
</span><span class="cx"> var data, target = this.getTarget(postid), history = this.filterHistory(postid, 0);
</span><span class="cx">
</span><del>- if ( '' == history )
</del><ins>+ if ( '' === history ) {
</ins><span class="cx"> return false;
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> this.toggleEditor(postid, 1);
</span><span class="cx"> data = {
</span><span class="lines">@@ -260,14 +271,17 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if ( ret.fw && ret.fh )
</del><ins>+ if ( ret.fw && ret.fh ) {
</ins><span class="cx"> $('#media-dims-' + postid).html( ret.fw + ' × ' + ret.fh );
</span><ins>+ }
</ins><span class="cx">
</span><del>- if ( ret.thumbnail )
</del><ins>+ if ( ret.thumbnail ) {
</ins><span class="cx"> $('.thumbnail', '#thumbnail-head-' + postid).attr('src', ''+ret.thumbnail);
</span><ins>+ }
</ins><span class="cx">
</span><del>- if ( ret.msg )
</del><ins>+ if ( ret.msg ) {
</ins><span class="cx"> $('#imgedit-response-' + postid).html('<div class="updated"><p>' + ret.msg + '</p></div>');
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> imageEdit.close(postid);
</span><span class="cx"> });
</span><span class="lines">@@ -316,7 +330,7 @@
</span><span class="cx"> minWidth: 3,
</span><span class="cx"> minHeight: 3,
</span><span class="cx">
</span><del>- onInit: function(img, c) {
</del><ins>+ onInit: function() {
</ins><span class="cx"> parent.children().mousedown(function(e){
</span><span class="cx"> var ratio = false, sel, defRatio;
</span><span class="cx">
</span><span class="lines">@@ -332,7 +346,7 @@
</span><span class="cx"> });
</span><span class="cx"> },
</span><span class="cx">
</span><del>- onSelectStart: function(img, c) {
</del><ins>+ onSelectStart: function() {
</ins><span class="cx"> imageEdit.setDisabled($('#imgedit-crop-sel-' + postid), 1);
</span><span class="cx"> },
</span><span class="cx">
</span><span class="lines">@@ -350,7 +364,7 @@
</span><span class="cx">
</span><span class="cx"> setCropSelection : function(postid, c) {
</span><span class="cx"> var sel, min = $('#imgedit-minthumb-' + postid).val() || '128:128',
</span><del>- sizer = this.hold['sizer'];
</del><ins>+ sizer = this.hold.sizer;
</ins><span class="cx"> min = min.split(':');
</span><span class="cx"> c = c || 0;
</span><span class="cx">
</span><span class="lines">@@ -377,8 +391,9 @@
</span><span class="cx"> close : function(postid, warn) {
</span><span class="cx"> warn = warn || false;
</span><span class="cx">
</span><del>- if ( warn && this.notsaved(postid) )
</del><ins>+ if ( warn && this.notsaved(postid) ) {
</ins><span class="cx"> return false;
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> this.iasapi = {};
</span><span class="cx"> this.hold = {};
</span><span class="lines">@@ -390,12 +405,13 @@
</span><span class="cx">
</span><span class="cx"> notsaved : function(postid) {
</span><span class="cx"> var h = $('#imgedit-history-' + postid).val(),
</span><del>- history = (h != '') ? JSON.parse(h) : new Array(),
</del><ins>+ history = ( h !== '' ) ? JSON.parse(h) : [],
</ins><span class="cx"> pop = this.intval( $('#imgedit-undone-' + postid).val() );
</span><span class="cx">
</span><span class="cx"> if ( pop < history.length ) {
</span><del>- if ( confirm( $('#imgedit-leaving-' + postid).html() ) )
</del><ins>+ if ( confirm( $('#imgedit-leaving-' + postid).html() ) ) {
</ins><span class="cx"> return false;
</span><ins>+ }
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx"> return false;
</span><span class="lines">@@ -403,7 +419,7 @@
</span><span class="cx">
</span><span class="cx"> addStep : function(op, postid, nonce) {
</span><span class="cx"> var t = this, elem = $('#imgedit-history-' + postid),
</span><del>- history = (elem.val() != '') ? JSON.parse(elem.val()) : new Array(),
</del><ins>+ history = ( elem.val() !== '' ) ? JSON.parse( elem.val() ) : [],
</ins><span class="cx"> undone = $('#imgedit-undone-' + postid),
</span><span class="cx"> pop = t.intval(undone.val());
</span><span class="cx">
</span><span class="lines">@@ -423,17 +439,19 @@
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> rotate : function(angle, postid, nonce, t) {
</span><del>- if ( $(t).hasClass('disabled') )
</del><ins>+ if ( $(t).hasClass('disabled') ) {
</ins><span class="cx"> return false;
</span><ins>+ }
</ins><span class="cx">
</span><del>- this.addStep({ 'r': { 'r': angle, 'fw': this.hold['h'], 'fh': this.hold['w'] }}, postid, nonce);
</del><ins>+ this.addStep({ 'r': { 'r': angle, 'fw': this.hold.h, 'fh': this.hold.w }}, postid, nonce);
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> flip : function (axis, postid, nonce, t) {
</span><del>- if ( $(t).hasClass('disabled') )
</del><ins>+ if ( $(t).hasClass('disabled') ) {
</ins><span class="cx"> return false;
</span><ins>+ }
</ins><span class="cx">
</span><del>- this.addStep({ 'f': { 'f': axis, 'fw': this.hold['w'], 'fh': this.hold['h'] }}, postid, nonce);
</del><ins>+ this.addStep({ 'f': { 'f': axis, 'fw': this.hold.w, 'fh': this.hold.h }}, postid, nonce);
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> crop : function (postid, nonce, t) {
</span><span class="lines">@@ -441,13 +459,14 @@
</span><span class="cx"> w = this.intval( $('#imgedit-sel-width-' + postid).val() ),
</span><span class="cx"> h = this.intval( $('#imgedit-sel-height-' + postid).val() );
</span><span class="cx">
</span><del>- if ( $(t).hasClass('disabled') || sel == '' )
</del><ins>+ if ( $(t).hasClass('disabled') || sel === '' ) {
</ins><span class="cx"> return false;
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> sel = JSON.parse(sel);
</span><span class="cx"> if ( sel.w > 0 && sel.h > 0 && w > 0 && h > 0 ) {
</span><del>- sel['fw'] = w;
- sel['fh'] = h;
</del><ins>+ sel.fw = w;
+ sel.fh = h;
</ins><span class="cx"> this.addStep({ 'c': sel }, postid, nonce);
</span><span class="cx"> }
</span><span class="cx"> },
</span><span class="lines">@@ -456,13 +475,14 @@
</span><span class="cx"> var t = this, button = $('#image-undo-' + postid), elem = $('#imgedit-undone-' + postid),
</span><span class="cx"> pop = t.intval( elem.val() ) + 1;
</span><span class="cx">
</span><del>- if ( button.hasClass('disabled') )
</del><ins>+ if ( button.hasClass('disabled') ) {
</ins><span class="cx"> return;
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> elem.val(pop);
</span><span class="cx"> t.refreshEditor(postid, nonce, function() {
</span><span class="cx"> var elem = $('#imgedit-history-' + postid),
</span><del>- history = (elem.val() != '') ? JSON.parse(elem.val()) : new Array();
</del><ins>+ history = ( elem.val() !== '' ) ? JSON.parse( elem.val() ) : [];
</ins><span class="cx">
</span><span class="cx"> t.setDisabled($('#image-redo-' + postid), true);
</span><span class="cx"> t.setDisabled(button, pop < history.length);
</span><span class="lines">@@ -473,8 +493,9 @@
</span><span class="cx"> var t = this, button = $('#image-redo-' + postid), elem = $('#imgedit-undone-' + postid),
</span><span class="cx"> pop = t.intval( elem.val() ) - 1;
</span><span class="cx">
</span><del>- if ( button.hasClass('disabled') )
</del><ins>+ if ( button.hasClass('disabled') ) {
</ins><span class="cx"> return;
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> elem.val(pop);
</span><span class="cx"> t.refreshEditor(postid, nonce, function() {
</span><span class="lines">@@ -487,7 +508,7 @@
</span><span class="cx"> var sel, elX = $('#imgedit-sel-width-' + postid), elY = $('#imgedit-sel-height-' + postid),
</span><span class="cx"> x = this.intval( elX.val() ), y = this.intval( elY.val() ),
</span><span class="cx"> img = $('#image-preview-' + postid), imgh = img.height(), imgw = img.width(),
</span><del>- sizer = this.hold['sizer'], x1, y1, x2, y2, ias = this.iasapi;
</del><ins>+ sizer = this.hold.sizer, x1, y1, x2, y2, ias = this.iasapi;
</ins><span class="cx">
</span><span class="cx"> if ( x < 1 ) {
</span><span class="cx"> elX.val('');
</span><span class="lines">@@ -527,15 +548,17 @@
</span><span class="cx"> var s;
</span><span class="cx"> num = Math.round(num);
</span><span class="cx">
</span><del>- if ( this.hold.sizer > 0.6 )
</del><ins>+ if ( this.hold.sizer > 0.6 ) {
</ins><span class="cx"> return num;
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> s = num.toString().slice(-1);
</span><span class="cx">
</span><del>- if ( '1' == s )
</del><ins>+ if ( '1' === s ) {
</ins><span class="cx"> return num - 1;
</span><del>- else if ( '9' == s )
</del><ins>+ } else if ( '9' === s ) {
</ins><span class="cx"> return num + 1;
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> return num;
</span><span class="cx"> },
</span><span class="lines">@@ -556,14 +579,15 @@
</span><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> if ( sel = this.iasapi.getSelection(true) ) {
</span><del>- r = Math.ceil( sel.y1 + ((sel.x2 - sel.x1) / (x / y)) );
</del><ins>+ r = Math.ceil( sel.y1 + ( ( sel.x2 - sel.x1 ) / ( x / y ) ) );
</ins><span class="cx">
</span><span class="cx"> if ( r > h ) {
</span><span class="cx"> r = h;
</span><del>- if ( n )
</del><ins>+ if ( n ) {
</ins><span class="cx"> $('#imgedit-crop-height-' + postid).val('');
</span><del>- else
</del><ins>+ } else {
</ins><span class="cx"> $('#imgedit-crop-width-' + postid).val('');
</span><ins>+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> this.iasapi.setSelection( sel.x1, sel.y1, sel.x2, r );
</span><span class="lines">@@ -571,5 +595,5 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-}
</del><ins>+};
</ins><span class="cx"> })(jQuery);
</span></span></pre>
</div>
</div>
</body>
</html>