Skip to content

Commit 61ae111

Browse files
Minor coding style fixes.
1 parent 122577c commit 61ae111

4 files changed

Lines changed: 37 additions & 26 deletions

File tree

src/css/bulk-optimization.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ div.tiny-bulk-optimization div.optimize div.progressbar div.progress {
261261
}
262262
}
263263

264-
#tiny-bulk-optimization > div.dashboard > div.statistics td.item.costs > div.cost-currency {
264+
div.tiny-bulk-optimization > div.dashboard > div.statistics td.item.costs > div.cost-currency {
265265
display: inline-block;
266266
}
267267

src/js/bulk-optimization.js

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -211,23 +211,28 @@
211211
}
212212
});
213213

214-
jQuery('.tooltip').mouseenter(function(){
215-
jQuery(this).find('.tip').show()
216-
clearTimeout('.tooltip')
217-
})
218-
219-
jQuery('.tooltip').mouseleave(function(){
220-
var that = this
221-
toolTip = setTimeout(function() {
222-
if (jQuery(that).find('.tip').is(':visible')) {
223-
jQuery('.tip').hide()
224-
}
225-
}, 150)
226-
})
214+
function attachToolTipEventHandlers() {
215+
var tooltip = '#tiny-bulk-optimization div.tooltip'
216+
var tip = 'div.tip'
217+
var toolTipTimeout = null
218+
jQuery(tooltip).mouseleave(function(){
219+
var that = this
220+
toolTipTimeout = setTimeout(function() {
221+
if (jQuery(that).find(tip).is(':visible')) {
222+
jQuery(tooltip).find(tip).hide()
223+
}
224+
}, 100)
225+
})
226+
jQuery(tooltip).mouseenter(function(){
227+
jQuery(this).find(tip).show()
228+
clearTimeout(toolTipTimeout)
229+
})
230+
jQuery(tooltip).find(tip).mouseenter(function(){
231+
clearTimeout(toolTipTimeout)
232+
})
233+
}
227234

228-
jQuery('.tip').mouseenter(function(){
229-
clearTimeout(toolTip)
230-
})
235+
attachToolTipEventHandlers()
231236

232237
window.bulkOptimizationAutorun = startBulkOptimization
233238
window.bulkOptimization = prepareBulkOptimization

src/views/bulk-optimization.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,10 @@
114114
}
115115
?>
116116
</p>
117-
<p><b>1 image = <?php echo sizeof( $active_tinify_sizes ) ?> compressions</b></p><p> <a href="/wp-admin/options-media.php#tiny-compress-images">Change Settings</a></p>
117+
<p>
118+
For each uploaded image, <b> <?php echo sizeof( $active_tinify_sizes ) ?> image sizes </b>are compressed. You can changed these settings
119+
<a href="/wp-admin/options-media.php#tiny-compress-images">here</a>.
120+
</p>
118121
</div>
119122
</div>
120123
</td>
@@ -124,14 +127,17 @@
124127
</h3>
125128
<span id="estimated-cost">$ <?php echo number_format( $estimated_costs, 2 ) ?></span>
126129
<div class="cost-currency">USD</div>
127-
128-
<div class="tooltip">
129-
<span class="dashicons dashicons-info"></span>
130-
<div class="tip">
131-
<p>If you wish to compress more than <b>500 images a month</b> and you are still on a free account <a href="https://tinypng.com/developers">upgrade here.</a></p>
130+
<?php if ($estimated_costs > 0): ?>
131+
<div class="tooltip">
132+
<span class="dashicons dashicons-info"></span>
133+
<div class="tip">
134+
<p>
135+
If you wish to compress more than <b>500 image sizes</b> a month and you are still on a free account
136+
<a href="https://tinypng.com/developers">upgrade here.</a>
137+
</p>
138+
</div>
132139
</div>
133-
</div>
134-
140+
<? endif; ?>
135141
</td>
136142
</tr>
137143
</table>

test/integration/BulkOptimizationIntegrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,6 @@ public function test_start_bulk_optimization_should_optimize_remaining_images()
7979
}
8080

8181
public function test_should_display_tooltips() {
82-
$this->assertEquals( '2', sizeof($this->find_all( 'div.tip' )));
82+
$this->assertGreaterThanOrEqual( '1', sizeof($this->find_all( 'div.tip' )));
8383
}
8484
}

0 commit comments

Comments
 (0)